Re: how to export function from fs/dropcache.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Tue, Jul 21, 2009 at 11:13 AM, er krishna <erkrishna@xxxxxxxxx> wrote:

I am again repeating the steps, i found something interested,  when I am doing make after making EXPORT_SYMBOL entries in fs/drop_caches.c  ( during kernel compilation); I am getting following warning messages for each of the exported function from this file only, the messages are:

data definition has no type or storage class

type defaults to 'int' in declaration of  'EXPORT_SYMBOL'

parameter names (without types) in function declaration

Although these are the warning messages, but why it is coming from fs/drop_caches file only. The function which I have exported from fs/buffer.c and block/genhd.c are easily exported and there is no warning messages against  any exported function from other than fs/drop_caches.c


Yes these warning messages do come, I am not sure why, may be someone can help with that.

On Tue, Jul 21, 2009 at 10:30 AM, Mulyadi Santosa <mulyadi.santosa@xxxxxxxxx> wrote:
On Mon, Jul 20, 2009 at 9:40 PM, er krishna<erkrishna@xxxxxxxxx> wrote:
> I have exported three functions from fs/dropcaches.c by making their
> function declaration in linux/mm.h, compiled the  corresponding 2.6.26
> kernel & got their entries in System.map file as follows:
>
>
> c0174d98 T drop_slab
> c0174db2 T drop_pagecache
> c0174ea7 T drop_caches_sysctl_handler

Upper case T, according to "man nm" means it's a global symbol. In
other word, other function located in separate object file could
reference it. OK, seems you do correctly here in exporting symbol

> These entries are quite different from the actual exported functions from
> other files, it has only T option.

What do you mean by the above paragraph?

 
Mylyadi, Actually when we do compilation, there are warning messages and when i do insmod there is error and in dmesg it shows that the above symbols are not resolved (it means there is a linking error) , I have exported some other function from other file and checked all those entries in /proc/kallsyms and in System.map file. These are different in nature. Thats why I asked ?




Other than that, as Peter has suggested, are you sure you have
declared drop_slab() etc as "extern" function in your module?


As I have declared their definition in linux/mm.h, I dont think that i have to do extern in my module coz i have included linux/mm.h after making proper declaration of these functions. But let me check with extern once more.

I could invoke the drop_XXXX functions successfully, after simply declaring the function signature with "extern" before using it.

 

And as far as I can see here, they are warning messages so there's a
chance the final kernel module can be successfully build. What happen
if you do "insmod -f"? Does it work as expected?

I will let you know after repeating the above steps, coz I am once again compiling the kernel.

 

--

regards,

Mulyadi Santosa
Freelance Linux trainer
blog: the-hydra.blogspot.com


regards,
Vikash Kumar
http://vikashkumar.com

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux