Re: question about linked list implementation in kernel.h

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

 





On Sat, Sep 11, 2010 at 8:37 PM, Robert P. J. Day <rpjday@xxxxxxxxxxxxxx> wrote:

 you're making this too difficult -- all container_of() does is,
given:

 * a structure definition,
 * the name of a member field within that structure, and
 * the address of that internal member field in an instance

what you get back is the address of the enclosing structure.

 this allows you to work with member fields of a structure but, when
you need to, "back up" to the structure they're contained in.  kernel
linked lists are built on this idea.

http://crashcourse.ca/introduction-linux-kernel-programming/intermission-lets-talk-about-linked-lists-and-containerof-free


rday

Yeah thanks Robert you saved my day.

[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