container_of 是在那个文件中定义的
Jump to turn (12)
- User
container_of 是在那个文件中定义的
- Assistant
container_of是在include/linux/kernel.h文件中定义的。它是一个宏,用于根据结构体中的某个成员变量的指针,获取整个结构体的指针。这个宏的定义如下:
#define container_of(ptr, type, member) ({
const typeof(((type *)0)->member) * __mptr = (ptr);
(type *)((char *)__mptr - offsetof(type, member)); })具体来说,它通过指针运算和偏移量计算,得到整个结构体的指针。因此,它可以方便地在内核开发中进行数据结构的访问和操作。
- User
list_add_tail是哪个文件中定义的
- Assistant