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

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

 



I have already done the above things, not only one time but many time, & all the function except fs/dropcache.c are exported in usual manner, but the function from fs/dropcache.c file are never get exported; please check its entry in system.map file.

I have exported myfunction, myfunction2 and myfunction3 ; myfunction2 and myfunction3 has three entires coz these are exported but myfunction, drop_pagecache and drop_slab are never get exported in right manner and it has only one entry with T option.

On Tue, Jul 21, 2009 at 5:39 AM, Peter Teoh <htmldeveloper@xxxxxxxxx> wrote:
sorry...let me debug my statement, one more thing to do:

d.   and from the function user side (whoever use the function)
"extern drop_pagecache()" have to be declared.

On Tue, Jul 21, 2009 at 8:03 AM, Peter Teoh<htmldeveloper@xxxxxxxxx> wrote:
> since drop_cache is part of kernel, u have to do 3 things:
>
> a.   declare EXPORT_SYMBOL() at the end of the fs/drop_caches.c file.
> b.   remove the "static" in front of drop_pagecache() declaration.
> c.   recompile the kernel + modules etc, and reboot into the new kernel.
>
> On Tue, Jul 21, 2009 at 12:35 AM, er krishna<erkrishna@xxxxxxxxx> wrote:
>>
>>
>> On Mon, Jul 20, 2009 at 9:54 PM, SandeepKsinha <sandeepksinha@xxxxxxxxx>
>> wrote:
>>>
>>> Hi Krishna,
>>>
>>>
>>>
>>> On Mon, Jul 20, 2009 at 8:10 PM, er krishna <erkrishna@xxxxxxxxx> wrote:
>>>>
>>>>
>>>>
>>>> Dear All,
>>>>
>>>>
>>>>
>>>>  I have one  simple problem in exporting the function. Everything is
>>>> fine, but its not working as per the expectation.  Actually I have to export
>>>> some function from fs/dropcache.c, but it is not working as per the
>>>> expectataion, [ I am able to export any function from other files like
>>>> fs/buffer.c and block/genhd.c but dropcache.c creates a problem] .I am
>>>> attaching the file. Just once check & please tell if something is missing,
>>>> what I have done is as follows:
>>>>
>>>>
>>>>
>>>> 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
>>>>
>>>> These entries are quite different from the actual exported functions from
>>>> other files, it has only T option. Can antbody elaborate what is the meaning
>>>> of these options  like T, t, r , u and so on?
>>>>
>>>> I have booted with same 2.6.26 kernel.  I included linux/mm.h  and all
>>>> the above three function in my module done make & found following warnings
>>>> in compilation & following error message in insmod due to some linking
>>>> error:
>>>>
>>>>
>>>> [root@CENTOS2 kernel]# make
>>>> make -C /lib/modules/2.6.26/build M=/root/kernel modules
>>>> make[1]: Entering directory `/root/Desktop/linux-2.6.26'
>>>>   Building modules, stage 2.
>>>>   MODPOST 2 modules
>>>> WARNING: "drop_slab" [/root/kernel/dropcache.ko] undefined!
>>>> WARNING: "drop_pagecache" [/root/kernel/dropcache.ko] undefined!
>>>> WARNING: "drop_caches_sysctl_handler" [/root/kernel/dropcache.ko]
>>>> undefined!
>>>> make[1]: Leaving directory `/root/Desktop/linux-2.6.26'
>>>> [root@CENTOS2 kernel]#
>>>> [root@CENTOS2 kernel]#
>>>> [root@CENTOS2 kernel]# insmod dropcache.ko
>>>> insmod: error inserting 'dropcache.ko': -1 Unknown symbol in module
>>>
>>> Do a dmesg and provide the results?
>>>
>>> You will see that which symbol still remains unresolved. May be you need
>>> to export some more of them.
>>
>> dropcache: module license 'unspecified' taints kernel.
>> dropcache: Unknown symbol drop_slab
>> dropcache: Unknown symbol drop_pagecache
>> dropcache: Unknown symbol drop_caches_sysctl_handler
>>
>>
>> Actually what happend I have made some own functiion and put those function
>> in different files, all of the function from other files are exported easily
>> but the function from this particular file is not exported due to linking
>> error. I suspect the entries which it created in System.map file is also not
>> good. Anybody knows various options of system.map file the please tell me. I
>> am attaching system.map file .
>>
>>
>>>
>>>
>>>>
>>>> [root@CENTOS2 kernel]#
>>>> [root@CENTOS2 kernel]#
>>>>
>>>>
>>>> Any idea how to trace it & what is missing, as I got all the exported
>>>> entries in System.map file & I have included the function declaration file
>>>> linux/mm.h on the same compiled kernel, it should do the things in right
>>>> manner.
>>>>
>>>> Please suggest, If I am missing something or you want any more
>>>> information. I am attaching my kernel module and these are some more snippet
>>>> :
>>>> [root@CENTOS2 kernel]# uname -a
>>>> Linux CENTOS2 2.6.26 #1 SMP Sun Jul 19 10:54:05 IST 2009 i686 i686 i386
>>>> GNU/Linux
>>>> [root@CENTOS2 kernel]#
>>>> [root@CENTOS2 kernel]# tail -1
>>>> /root/Desktop/linux-2.6.26/fs/drop_caches.c
>>>> EXPORT_SYMBOL(drop_caches_sysctl_handler);
>>>> [root@CENTOS2 kernel]#
>>>> [root@CENTOS2 kernel]#
>>>>
>>>>
>>>>
>>>
>>> Regards,
>>> Sandeep.
>>>
>>>
>>>
>>>
>>>
>>>
>>> “To learn is to change. Education is a process that changes the learner.”
>>>
>>>
>>>
>>>
>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Thanks and Best Regards,
>>>> ------------------------
>>>> Krishna Kumar
>>>>
>>>>
>>>
>>
>>
>
>
>
> --
> Regards,
> Peter Teoh
>



--
Regards,
Peter Teoh


[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