container_of()宏
来源:互联网 发布:剑网3淘宝代练 编辑:程序博客网 时间:2024/05/21 10:37
指针ptr指向结构体type中的成员member;通过指针ptr,返回结构体type的起始地址
type
|----------|
| |
| |
|----------|
ptr-->| member --|
|----------|
| |
| |
|----------|
/**
* 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); -/
(type *)( (char *)__mptr - offsetof(type,member) );})
- 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()宏
- AS3: Sprite的鼠标经过事件,Tween缓动alpha的简单例子。
- eclipse中的linksource
- Android内核移植
- tomcat6.0配置
- 编译安装STLport和Boost
- container_of()宏
- Linux slab 分配器剖析(转载)
- Android开机LOGO制作
- 自动挂载文件分区 ntfs
- 用startx指令选择性启动桌面环境或窗口管理器
- 揭开Wayland的面纱
- EQL复制特点
- 用代码呈现,抛弃控件绑定
- 项目生命周期管理VS2010 ALM(二)