Re: hlist in list.h

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

 







http://tenyear.net/books/LinuxKernelPrimer/ch02lev1sec1.html

You will see that it was added to allow the head of the list to contain
just one pointer (thus saving space). To allow insertion and deletion,
however, nodes must still reference the pointers that reference them.
They (the pointers) don't need to point to the actual nodes. They just
need to point to whatever is pointing to that particular node (the
'first' member of hlist_head, or the 'next' pointer of the previous node).

If it were a single pointer (i.e. struct hlist_node *prev), then that
pointer on the first node would be broken since it would be pointing to
a struct hlist_head instead of a hlist_node.

If you're really interested you can also take a look at lkml posts
introducing this new type of list here:

http://lkml.org/lkml/2000/7/28/10
 
Hi,
 
Thanks for the link and the answer, it really helps me!
 
 

 


[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