Re: list.h/macro(continue

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

 



On Sun, Feb 15, 2004 at 02:45:51AM -0800, prasanna wakhare wrote:
[...]
> I think the minus is a bug.  It should be plus.  Let's
> take a case where the
> third parameter is NOT "list":
> 
> 	struct list_head *ln;
> 	struct pci_driver *drv = list_entry(ln, struct
> pci_driver, node);
> 
> "(unsigned long)(&((type *)0)->member)" gives you the
> offset of name, which is
[...]

No, it gives you the offset of 'node' in 'struct pci_driver', which is
then subtracted from the address of 'node'. And this yields just the
address of the structure containing 'node'.

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[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