Re: #define THIS_MODULE - related query ?

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

 



On Tue, Mar 30, 2004 at 18:52:28 +0530, Amith wrote:
> hi ,
>            but the question still remains - how does THIS_MODULE convert
> itself into the struct module * of the module where
>            it is declared ?  .

It seems to be a magic symbol, that is treated specialy by the module
loader. (Cf. /proc/ksyms, nm <any-module> and the comment in
linux/module.h). You'll have to read the source, if you want the exact
details -- the interesting function is called sys_init_module.

>           #define THIS_MODULE (&__this_module).  /* from
> <linux/module.h> */
> 
> 
> 
>           int init_module (void)
>         {
>                 struct module *mine = THIS_MODULE ;
>                 ......
>          }
> 
> could someone explain ?
> 
> cheers,
> Amith
> 
> 
-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@ucw.cz>

Attachment: signature.asc
Description: Digital signature


[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