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 12:45 PM, Siddu <siddu.sjce@xxxxxxxxx> wrote:


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
Could you tell what other functions were you able to export successfully  from buffer.c and genhd.c  


[root@CENTOS2 linux-2.6.26]# grep myfunction System.map
c0175a00 T myfunction
c0177cad T myfunction2
c02ac3a5 T myfunction3
c063e178 r __ksymtab_myfunction2
c063ea30 r __ksymtab_myfunction3
c06492da r __kstrtab_myfunction2
c064b00c r __kstrtab_myfunction3
[root@CENTOS2 linux-2.6.26]#



Check it out myfunctio2 & myfunction3 I am able 2 export from fs/buffer.c and block/genhd.c but I am not able to export any of the function from fs/dropcacahe.c



& whenever I do make after doing the entry in dropcache.c I am always getting following error message :



[root@CENTOS2 linux-2.6.26]# cat kk
fs/drop_caches.c:85: warning: data definition has no type or storage class
fs/drop_caches.c:85: warning: type defaults to ‘int’ in declaration of ‘EXPORT_SYMBOL’
fs/drop_caches.c:85: warning: parameter names (without types) in function declaration
fs/drop_caches.c:86: warning: data definition has no type or storage class
fs/drop_caches.c:86: warning: type defaults to ‘int’ in declaration of ‘EXPORT_SYMBOL’
fs/drop_caches.c:86: warning: parameter names (without types) in function declaration
fs/drop_caches.c:87: warning: data definition has no type or storage class
fs/drop_caches.c:87: warning: type defaults to ‘int’ in declaration of ‘EXPORT_SYMBOL’
fs/drop_caches.c:87: warning: parameter names (without types) in function declaration
fs/drop_caches.c:88: warning: data definition has no type or storage class
fs/drop_caches.c:88: warning: type defaults to ‘int’ in declaration of ‘EXPORT_SYMBOL’
fs/drop_caches.c:88: warning: parameter names (without types) in function declaration
fs/drop_caches.c:89: warning: data definition has no type or storage class
fs/drop_caches.c:89: warning: type defaults to ‘int’ in declaration of ‘EXPORT_SYMBOL’
fs/drop_caches.c:89: warning: parameter names (without types) in function declaration
make[2]: *** Deleting file `fs/configfs/inode.o'
make[2]: *** [fs/configfs/inode.o] Interrupt
make[1]: *** [fs/configfs] Interrupt
make: *** [fs] Interrupt
[root@CENTOS2 linux-2.6.26]#




So, these are the two clues, can anybody help me out.


Peter , I have tried with extern optaion also , but the results are same.


Thanks & Best regards,
Krishna






 

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 ?

Please paste the relevant portion of /proc/kallsym and System.map so that all of us can see in what way they differ  


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.



 

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
Other than that, as Peter has suggested, are you sure you have
declared drop_slab() etc as "extern" function in your module?
 



--
Regards,
~Sid~
http://sidsenclave.blogspot.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