list.h¶
Intrusive linked list.
Lists are represented as element pointing to the first actual list element.
-
struct list_node
list_node_t
¶ List node structure.
Used as is as reference to a list, or as member of any data structure that should be member of a list.
Actual list objects should have a
list_node_t
as member and then use thekernel_defines.h::container_of
macro in list operations. Seethread.h::thread_add_to_list()
as example.
-
void
list_add
(list.h::list_node_t
* node,list.h::list_node_t
* new_node)¶ Insert object into list.
If called with a list reference as node, the new node will become the new list head.
Parameters
node: list node before new entry new_node: list node to insert
-
list.h::list_node_t
*list_remove_head
(list.h::list_node_t
* list)¶ Removes the head of the list and returns it.
Parameters
list: Pointer to the list itself, where list->next points to the root node Return values
- removed old list head, or NULL if empty
-
list.h::list_node_t
*list_remove
(list.h::list_node_t
* list,list.h::list_node_t
* node)¶ Removes the node from the list.
Parameters
list: Pointer to the list itself, where list->next points to the root node node: List node to remove from the list Return values
- removed node, or NULL if empty or not found
-
struct
list_node
¶ List node structure.
Used as is as reference to a list, or as member of any data structure that should be member of a list.
Actual list objects should have a
list_node_t
as member and then use thekernel_defines.h::container_of
macro in list operations. Seethread.h::thread_add_to_list()
as example.