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.