My Kernel v0.1.0
linked_list.h File Reference
#include <kernel/types.h>
#include <utils/container_of.h>
#include <utils/compiler.h>
Include dependency graph for linked_list.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  linked_list_node
 Intrusive doubly-linked list node. More...
 
struct  linked_list_head
 The head of a doubly linked list. More...
 

Macros

#define __LLIST_INIT(_head)
 Linked list head default init value (one entry)
 
#define __INIT_LLIST(_name)   _name = __LLIST_INIT(_name)
 Initialize an empty linked list head.
 
#define DECLARE_LLIST(_name)   llist_t INIT_LLIST(_name)
 Declare empty linked list head.
 
#define LLIST_NODE(_name)   node_t _name
 Declare an intrusive list node. More...
 
#define FOREACH_LLIST(_name, _list)
 Loop over each element inside a linked list. More...
 
#define FOREACH_LLIST_SAFE(_name, _tmp, _list)
 Loop over each element inside a linked list in a safer way. More...
 
#define FOREACH_LLIST_REVERSE(_name, _list)
 Loop over each element inside a linked list in reverse order. More...
 
#define FOREACH_LLIST_SAFE_REVERSE(_name, _tmp, _list)
 Loop over each element inside a linked list in reverse order in a safer way. More...
 
#define FOREACH_LLIST_ENTRY(_entry, _list, _field)
 Loop over each entry inside a linked list. More...
 
#define FOREACH_LLIST_ENTRY_SAFE(_entry, _tmp, _list, _field)
 Loop over each entry inside a linked list in a safer manner. More...
 
#define FOREACH_LLIST_ENTRY_REVERSE(_entry, _list, _field)
 Loop over each entry inside a linked list in reverse order. More...
 
#define FOREACH_LLIST_ENTRY_REVERSE_SAFE(_entry, _tmp, _list, _field)
 Loop over each entry inside a linked list in reverse order in a safer manner. More...
 
#define llist_head(_list)   (&(_list)->head)
 
#define llist_entry(ptr, type, member)   container_of(ptr, type, member)
 Return the struct containing this list node.
 

Functions

static node_tllist_first (const llist_t *list)
 
static node_tllist_last (const llist_t *list)
 
static PURE bool llist_is_empty (const llist_t *list)
 
static void __llist_add (node_t *new, node_t *prev, node_t *next)
 Insert a new entry between two known consecutive ones (internal use only)
 
static void __list_remove (node_t *prev, node_t *next)
 Delete a list entry (internal use only). More...
 
static void llist_add_after (node_t *prev, node_t *new)
 Insert a new entry into a list. More...
 
static void llist_add_before (node_t *next, node_t *new)
 Insert a new entry into a list. More...
 
static void llist_add (llist_t *list, node_t *new)
 Insert a new entry as the first element of the list. More...
 
static void llist_add_tail (llist_t *list, node_t *new)
 Insert a new entry as the last element of the list. More...
 
static node_tllist_remove (node_t *node)
 Remove an entry from a list. More...
 
static node_tllist_pop (llist_t *list)
 Pop the first element in a list. More...
 
static node_tllist_pop_tail (llist_t *list)
 Pop the last element in a list. More...
 
static void llist_insert_sorted (llist_t *list, node_t *new, compare_t compare)
 Insert a new item inside a sorted list in ascending order. More...
 
static bool llist_insert_sorted_unique (llist_t *list, node_t *new, compare_t compare)
 Insert a new item inside a sorted list in ascending order. More...
 
static node_tllist_find_first (const llist_t *list, const void *data, compare_t compare)
 Retreive the first matching element inside the list (or NULL) More...