container_of
来源:互联网 发布:邓肯生涯总数据 编辑:程序博客网 时间:2024/05/16 07:43
- /**
- * container_of - 通过结构体的一个成员获取容器结构体的指针
- * @ptr: 指向成员的指针。
- * @type: 成员所嵌入的容器结构体类型。
- * @member: 结构体中的成员名。
- *
- */
- #define container_of(ptr, type, member) ({ \
- const typeof( ((type *)0)->member ) *__mptr = (ptr); \
- (type *)( (char *)__mptr - offsetof(type,member) );})
这个宏的作用其实很简单,就是通过一个容器(结构体)中某个成员的指针得到指向这个容器(结构体)的指针,简单的说就是通过成员找容器。
也就是 说 如果成员包含指针,那么 根据该成员来找时,传进去的应该是指针的指针。
0 0
- container_of
- container_of
- container_of
- container_of
- container_of()
- container_of()
- container_of
- container_of
- container_of()
- container_of
- container_of()
- container_of
- container_of
- container_of()
- container_of()
- container_of
- container_of
- container_of
- 计算机设计阶段
- 正能量读后感_自我反思之路。
- android 反编译和代码解读
- 项目2-学生成绩统计
- BZOJ 1056: [HAOI2008]排名系统 & BZOJ 1862: [Zjoi2006]GameZ游戏排名系统
- container_of
- nginx配置2个tomcat的负载均衡+配置静态文件处理(图片等)
- 第二周上机实践项目——学生成绩统计
- Core Animation 深入理解3
- usaco 月赛 2008 February Eating Together 题解
- 2-1学生成绩统计
- deep learning toolbox学习使用3之DBN
- C语言 WEEK2 - FOR循环 & Function & Scanf & more Variables
- 流年有爱,岁月有痕