working with the linux-next tree

Previous thread: Copying user space data to PCI memory by arun c on Saturday, May 16, 2009 - 5:18 am. (8 messages)

Next thread: Regarding implementation of copy_from_user() and copy_to_user() by seshikanth varma on Sunday, May 17, 2009 - 2:48 am. (11 messages)
From: er krishna
Date: Monday, July 20, 2009 - 7:40 am

--00163646c7c6a1e033046f241dc3
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

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
[root@CENTOS2 kernel]#
[root@CENTOS2 kernel]#


Any idea how to trace it & what is ...
From: Robert P. J. Day
Date: Saturday, May 16, 2009 - 9:41 am

i just want to verify how to play with the linux-next tree.
following the instructions here:

http://linux.f-seidel.de/linux-next/pmwiki/pmwiki.php?n=Linux-next.FAQ

i took my clone of linus' tree and ran those instructions, at which
point, i have:

$ git branch -a
* master
  linux-next/history
  linux-next/master
  linux-next/stable
  origin/HEAD
  origin/master
$

  now, to switch to linux-next, is it sufficient to just:

$ git checkout linux-next/master

  i don't see any overwhelming need to create a new branch since i
want to use linux-next read-only, so here's the end result of that
command:

$ git branch -a
* (no branch)
  master
  linux-next/history
  linux-next/master
  linux-next/stable
  origin/HEAD
  origin/master
$

and to return to linus' tree:

$ git checkout master

  is that about right?  or is there a more standard way of doing this?

rday
--

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

        Linux Consulting, Training and Annoying Kernel Pedantry.

Web page:                                          http://crashcourse.ca
Linked In:                             http://www.linkedin.com/in/rpjday
Twitter:                                       http://twitter.com/rpjday
========================================================================

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ

From: SandeepKsinha
Date: Saturday, May 16, 2009 - 10:16 am

On Sat, May 16, 2009 at 10:11 PM, Robert P. J. Day



-- 
Regards,
Sandeep.





 	
“To learn is to change. Education is a process that changes the learner.”

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ

From: SandeepKsinha
Date: Monday, July 20, 2009 - 9:24 am

Hi Krishna,




Do a dmesg and provide the results?

You will see that which symbol still remains unresolved. May be you need to
Regards,
Sandeep.






=93To learn is to change. Education is a process that changes the learner.=
From: Mulyadi Santosa
Date: Monday, July 20, 2009 - 10:00 pm

Upper case T, according to "man nm" means it's a global symbol. In
other word, other function located in separate object file could

What do you mean by the above paragraph?

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

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?

-- 
regards,

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

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ

From: er krishna
Date: Monday, July 20, 2009 - 10:43 pm

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




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


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

I will let you know after repeating the above steps, coz I am once again
From: Siddu
Date: Tuesday, July 21, 2009 - 12:15 am

Could you tell what other functions were you able to export successfully



-- 
Regards,
~Sid~
http://sidsenclave.blogspot.com
From: er krishna
Date: Tuesday, July 21, 2009 - 12:37 am

[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 =91int=92 in declaration of
=91EXPORT_SYMBOL=92
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 =91int=92 in declaration of
=91EXPORT_SYMBOL=92
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 =91int=92 in declaration of
=91EXPORT_SYMBOL=92
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 =91int=92 in declaration of
=91EXPORT_SYMBOL=92
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 =91int=92 in declaration of
=91EXPORT_SYMBOL=92
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]: *** ...
From: SandeepKsinha
Date: Tuesday, July 21, 2009 - 2:25 am

Hi Krishna,



Surely, the issue looks like you are not doing a #include<module.h>
Add it to fs/dropcache.c

Regards,
Sandeep.






=93To learn is to change. Education is a process that changes the learner.=
From: Vikash Kumar
Date: Tuesday, July 21, 2009 - 12:30 am

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

I could invoke the drop_XXXX functions successfully, after simply declaring
regards,
Vikash Kumar
http://vikashkumar.com
From: Pei Lin
Date: Tuesday, July 21, 2009 - 1:59 am

^_^  I found the root cause of your issue. u forgot
"include<module.h>" in your fs/drop_caches.c .......

BRs,

Lin



--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ

From: er krishna
Date: Tuesday, July 21, 2009 - 2:58 am

Thanks a lot to all of you, In the mean while I have also found the same
reason due to the problem of EXPORT_SYMBOL , AND AFTER INCLUDING
linux/module.h, it has resolved now .

Now my module is working fine.


You know now the entries in System.map file has also changed and there is no
warning message in compilation.

Best Regards,
Krishna




Previous thread: Copying user space data to PCI memory by arun c on Saturday, May 16, 2009 - 5:18 am. (8 messages)

Next thread: Regarding implementation of copy_from_user() and copy_to_user() by seshikanth varma on Sunday, May 17, 2009 - 2:48 am. (11 messages)