#define container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );})
where
#define offsetof(type, member) \
((size_t) ( (char *)&((type *)(0))->member - (char *)0 ))
No comments:
Post a Comment