1 /* Taken from depthcharge: src/base/list.h */
2 /* SPDX-License-Identifier: GPL-2.0-or-later */
8 struct list_node
*next
;
9 struct list_node
*prev
;
12 // Remove list_node node from the doubly linked list it's a part of.
13 void list_remove(struct list_node
*node
);
14 // Insert list_node node after list_node after in a doubly linked list.
15 void list_insert_after(struct list_node
*node
, struct list_node
*after
);
16 // Insert list_node node before list_node before in a doubly linked list.
17 void list_insert_before(struct list_node
*node
, struct list_node
*before
);
18 // Appends the node to the end of the list.
19 void list_append(struct list_node
*node
, struct list_node
*head
);
21 #define list_for_each(ptr, head, member) \
22 for ((ptr) = container_of((head).next, typeof(*(ptr)), member); \
23 (uintptr_t)ptr + (uintptr_t)offsetof(typeof(*(ptr)), member); \
24 (ptr) = container_of((ptr)->member.next, \
25 typeof(*(ptr)), member))
27 #endif /* __LIST_H__ */