added container_of macro

This commit is contained in:
Fabrice Bellard
2023-12-22 11:03:44 +01:00
parent 1692f2a7a3
commit c3599515c8
3 changed files with 5 additions and 3 deletions

3
list.h
View File

@@ -36,8 +36,7 @@ struct list_head {
#define LIST_HEAD_INIT(el) { &(el), &(el) }
/* return the pointer of type 'type *' containing 'el' as field 'member' */
#define list_entry(el, type, member) \
((type *)((uint8_t *)(el) - offsetof(type, member)))
#define list_entry(el, type, member) container_of(el, type, member)
static inline void init_list_head(struct list_head *head)
{