10 #define list_head_init(name) {&name, &name}
12 static inline void list_init_head(
list_node_t *head) {
22 return head == list_front(head);
26 return head->
next == node;
30 return head->
prev == node;
33 #define list_entry(node, type, member) \
34 ((type *) ((u8 *) (node) - offsetof(type, member)))
35 #define list_first_entry(head, type, member) \
36 list_entry(list_front(head), type, member)
37 #define list_last_entry(head, type, member) \
38 list_entry(list_back(head), type, member)
48 list_insert(list_front(head), node);
52 list_insert(head, node);
60 static inline void list_remove_init(
list_node_t *node) {
66 static inline void list_pop_front(
list_node_t *head) {
67 list_remove(list_front(head));
70 static inline void list_pop_back(
list_node_t *head) {
71 list_remove(list_back(head));
74 #define list_for_each(head, node) \
75 for (node = (head)->next; node != (head); node = node->next)
76 #define list_for_each_entry(head, member, entry) \
77 for (entry = list_first_entry(head, typeof(*entry), member); \
78 &entry->member != (head); \
79 entry = list_entry(entry->member.next, typeof(*entry), member))
struct list_node list_node_t
struct list_node * prev
Definition: list.h:7
struct list_node * next
Definition: list.h:7