list_entry
来源:互联网 发布:手机服装绘图软件 编辑:程序博客网 时间:2024/05/23 01:22
说明:以下所有代码基于linux-2.6.22.6内核;
1、<include/linux/list.h>
1、<include/linux/list.h>
/**
* list_entry - get the struct for this entry
* @ptr:the &struct list_head pointer.
* @type:the type of the struct this is embedded in.
* @member:the name of the list_struct within the struct.
*/
#define list_entry(ptr, type, member) \container_of(ptr, type, member)
1.1、list_entry的功能是获取链表结构中的节点地址;
2、<include/linux/kernel.h>
2.1、typeof是C语言的关键字,返回表达式的类型;
2.2、"( (char *)__mptr"中使用"(char *)"强制转换的原因是:字符类型的指针加减操作步长是一个字节;
2.3、 "offsetof(type,member)"在arm体系结构中返回类型为无符号整型;
1.1、list_entry的功能是获取链表结构中的节点地址;
2、<include/linux/kernel.h>
#define container_of(ptr, type, member) ({\
const typeof( ((type *)0)->member ) *__mptr = (ptr);\
(type *)( (char *)__mptr - offsetof(type,member) );}) 2.1、typeof是C语言的关键字,返回表达式的类型;
2.2、"( (char *)__mptr"中使用"(char *)"强制转换的原因是:字符类型的指针加减操作步长是一个字节;
2.3、 "offsetof(type,member)"在arm体系结构中返回类型为无符号整型;
3、<include/linux/stddef.h>
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
4、<include/linux/types.h>
typedef __kernel_size_t size_t;
5、<include/asm-arm/posix_types.h>
typedef unsigned int __kernel_size_t;
4、<include/linux/types.h>
typedef __kernel_size_t size_t;
5、<include/asm-arm/posix_types.h>
typedef unsigned int __kernel_size_t;
0 0
- list_entry
- list_entry
- list_entry
- list_entry
- list_entry
- LIST_ENTRY
- list_entry()
- list_entry()
- list_entry
- list_entry()
- list_entry()
- list_entry 等
- 使用LIST_ENTRY
- list_entry()详解
- list_entry , container_of
- list_entry()宏
- list_entry()宏
- list_entry 解析
- JS 对象与数组的变化监听
- 图片CSS模糊滤镜浏览器兼容解决方法
- glew库初始化问题
- Swift开篇011->继承
- 如何用DataStage构建企业异构数据库之间的高速通道
- list_entry
- ActiveMQ vs JbossMQ
- 使用Spark DataFrame进行大数据处理
- Android实现定时器
- mybatis 返回主键
- window7远程桌面到服务器不能复制粘贴解决办法
- iOS 关于屏幕旋转shouldAutorotate
- SourceForge和Github开源软件开发管理场所
- HTTPS科普扫盲帖