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

Re: get_module_symbol missing in 2.4?



On Mon, May 07, 2001 at 02:16:25PM -0500, Timur Tabi wrote:
> ** Reply to message from Erik Mouw <J.A.K.Mouw@ITS.TUDelft.NL> on Mon, 7 May
> 2001 20:06:39 +0200
> 
> > Ehm, you're right, it's not there yet. The documentation is in
> > kernel/module.c, but it's not yet included in the kernel API book. Try
> > this patch (against linux-2.4.4, but will apply to other kernel
> > versions as well) and type "make {psdocs|pdfdocs|htmldocs}" to generate
> > the documentation.
> 
> If by documentation you mean the paltry comments that prefix each function,
> then I don't need to compile anything because I can just read them (not that
> it'll help any).

Hey, lighten up a bit! Linux-kernel hacking is fun! :)

>  However, after fixing/applying your patch to 2.4.2, I got this
> error during the build:
> 
> working on ../parportbook.sgml
> about to copy cascading stylesheet and admon graphics to temp dir
> about to rename temporary directory to parportbook
> if [ ! -z " parport-share.jpeg  parport-multi.jpeg  parport-structure.jpeg" ];
> then cp  parport-share.jpeg  parport-multi.jpeg  parport-structure.jpeg
> parportbook; fi
> cp: parport-share.jpeg: No such file or directory
> cp: parport-multi.jpeg: No such file or directory
> cp: parport-structure.jpeg: No such file or directory
> make[1]: *** [parportbook] Error 1
> make[1]: Leaving directory `/usr/src/linux-2.4.2/Documentation/DocBook'
> make: *** [htmldocs] Error 2
> 
> parport-share.jpeg doesn't exist anywhere.

That's right, it's generated from parport-share.fig with fig2dev. You
need a fairly complete SGML and LaTeX system to generate the kernel
documentation ("apt-get install task-sgml task-tex" installed the
necessary components on my debian system).

> My question is this: I was able to use get_module_symbol in 2.2 to gind the
> address of various data structures in the kernel.  With the inter_module stuff,
> it appears that I can only use those functions for addresses that are
> specifically "exported" with inter_module_register.  If so, then I'm screwed
> because the data structures I want are not exported by inter_module_register.

Why not? Just make a single data type with everything you want to share
and pass a pointer around:

Header file:

  typedef struct {
	int *fooptr;
	int *barptr;
  } my_type_t;

#define MY_STRING "my data"

Module 1:

  my_type_t mydata;
  mydata.fooptr = whatever_foo_data_I_d_like_to_share;
  mydata.barptr = even_more_data;

  inter_module_register(MY_STRING, THIS_MODULE, &mydata);

Module 2:

  my_type_t *dataptr;
  int *foo;

  dataptr = (my_type_t *)inter_module_get(MY_STRING);
  foo = dataptr->fooptr;
  *foo = 42;

> According to a scan of the 2.4.2 source code, it's only used by about two or
> three modules.

Probably because the functionality is fairly new (included in
linux-2.4.0-test1, according to my CVS tree). 


Erik

-- 
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Department
of Electrical Engineering, Faculty of Information Technology and Systems,
Delft University of Technology, PO BOX 5031,  2600 GA Delft, The Netherlands
Phone: +31-15-2783635  Fax: +31-15-2781843  Email: J.A.K.Mouw@its.tudelft.nl
WWW: http://www-ict.its.tudelft.nl/~erik/
-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/