SHARE
TWEET

Untitled

a guest Nov 8th, 2011 16 Never
  1. /**
  2.  * container_of - cast a member of a structure out to the containing structure
  3.  * @ptr:        the pointer to the member.
  4.  * @type:       the type of the container struct this is embedded in.
  5.  * @member:     the name of the member within the struct.
  6.  *
  7.  */
  8. #define container_of(ptr, type, member) ({                      \
  9.         const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
  10.         (type *)( (char *)__mptr - offsetof(type,member) );})
  11.  
  12.  
RAW Paste Data
Top