/**
* container_of - cast a member of a structure out to the containing structure
* @ptr: the pointer to the member.
* @type: the type of the container struct this is embedded in.
* @member: the name of the member within the struct.
*
*/
#define container_of(ptr, type, member)
(
{
const typeof(((type *)0)->member)*__mptr = (ptr); //typeof(((type *)0)->member)获取member的数据类型,
//然后将ptr的地址赋给__mptr;
(type *)((char *)__mptr - offsetof(type, member)); //使用__mptr的地址减去type和member地址的差值。最后再强转类型。
}
)