您的位置:首页 > 大数据 > 人工智能

list_entry()等价于container_of()

2016-11-02 10:03 513 查看
    list_entry() 宏在 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)
    可见 list_entry() 宏就是 container_of() 宏的一个别名。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: