Linux C: container_of()和offsetof()函数与结构体成员的偏移量计算
就内核的container_of()函数,发表一下个人见解。在内核中,多处地方用到container_of()这个函数(如内核链表),其定义在内核代码 include/linux/kernel.h中:/** * container_of - cast a member of a structure out to the containing structure * @ptr: ...
原创
2019-09-28 16:44:47 ·
918 阅读 ·
0 评论