metootxy

导航

 

2013年7月24日

摘要: 在linux内核驱动中,我们经常会用到container_of,实际上他是一个宏,其作用是我们可以根据该结构体变量中的某个成员首地址从而获得该结构体变量的首地址。其具体的定义如下:#define container_of(ptr, type, member) ({ \ 681 const typeof( ((type *)0)->member ) *__mptr = (ptr); \682 (type *)( (char *)__mptr - of... 阅读全文
posted @ 2013-07-24 21:04 metootxy 阅读(269) 评论(0) 推荐(0)