container_of
来源:互联网 发布:钢板承载力计算软件 编辑:程序博客网 时间:2024/04/29 04:07
container_of(ptr, type, member)
ptr为type中的member,container_of能够取出type的指针。
例:
struct sample {
int member;
char* name;
int version;
};
struct sample smp;
smp.member = 10;
smp.name = "Hello!";
smp.version = sizeof(struct sample);
struct sample sout;
int fn = smp.member;
sout = container_of(&fn, struct sample, member);
这样就能取到smp的结构体指针,从而也就可以有:
sout.member 为10;
sout.name 为 Hello!
sout.version 为12。
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
- container_of
- spring mvc的获取参数和传递参数
- python 写的归并排序
- "Introduction to the Theory of Computation" Reading notes - Ch. 0 and 1
- 电容,电阻的误差值
- UIPickerView内容居中显示,设置初始默认值
- container_of
- 电子签名的早期应用与未来趋势
- Android将Activity打成jar包供第三方调用(解决资源文件不能打包的问题)
- PHPExcel分析
- Epoll and 介绍Sniff网络嗅探器代码
- linux安装之磁盘分区与系统目录的挂载
- 调用系统的短信和邮件分享功能
- iOS - webView检测电话和邮箱问题
- C++ Config 配置文件类