NULL isn't used anywhere in this code. 0 is used. Essentially, you've subtracted 0 from the original address, which is unnecessary. On Thu, 18 Apr 2002, Neeraj wrote: > Thanks John. > > Later I understood the code. But I would like to ask that is this code portable > ? becoz when you are using (struct module *)0L then it is going to become a NULL > pointer and it is not necessary NULL will have a value 0 (zero). So would'nt it > be better if this code is written as : > > ((unsigned long)&((struct module *)0L)->persist_start - (unsigned long)(struct > module *)0L) > > I think this is portable! > > -neeraj > > => 0L refers to the number 0 as a Long integer. > => > => Basically, what is happening is, the kernel is acting as if the module > => struct is located at address 0. Obviously, this structure isn't there, but > => the effect is that the address returned is the size of the data contained > => in the structure before the persist_start member. > => > => John > => > => On Thu, 18 Apr 2002, Neeraj wrote: > => > => > Hello friends, > => > > => > I have just started reading the kernel code and hence a kernel newbie. Right now > => > I am reading the code of Linux kernel version 2.4.3. The file module.c conatins > => > a function sys_init_module. I am not able to the understand the following LOC. > => > > => > <snip> > => > > => > if (mod_user_size < (unsigned long)&((struct module *)0L)->persist_start > => > > => > </snip> > => > > => > What does 0L refers to ? Can somebody please explain it to me. > => > > => > Thanks > => > neeraj > => > > => > > => > > => > -- > => > Kernelnewbies: Help each other learn about the Linux kernel. > => > Archive: http://mail.nl.linux.org/kernelnewbies/ > => > FAQ: http://kernelnewbies.org/faq/ > => > > => > => > > -- > Kernelnewbies: Help each other learn about the Linux kernel. > Archive: http://mail.nl.linux.org/kernelnewbies/ > FAQ: http://kernelnewbies.org/faq/ > -- John Tyner jtyner@cs.ucr.edu -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/