libosmocore
0.12.1
Osmocom core library
|
Simple doubly linked list implementation. More...
#include <stddef.h>
Go to the source code of this file.
Data Structures | |
struct | llist_head |
(double) linked list header structure More... | |
Macros | |
#define | inline __inline__ |
#define | container_of(ptr, type, member) |
cast a member of a structure out to the containing structure More... | |
#define | LLIST_POISON1 ((void *) 0x00100100) |
These are non-NULL pointers that will result in page faults under normal circumstances, used to verify that nobody uses non-initialized llist entries. More... | |
#define | LLIST_POISON2 ((void *) 0x00200200) |
#define | LLIST_HEAD_INIT(name) { &(name), &(name) } |
#define | LLIST_HEAD(name) struct llist_head name = LLIST_HEAD_INIT(name) |
define a statically-initialized llist_head More... | |
#define | INIT_LLIST_HEAD(ptr) |
initialize a llist_head to point back to self More... | |
#define | llist_entry(ptr, type, member) container_of(ptr, type, member) |
Get the struct containing this list entry. More... | |
#define | llist_first_entry(ptr, type, member) llist_entry((ptr)->next, type, member) |
Get the first element from a list. More... | |
#define | llist_last_entry(ptr, type, member) llist_entry((ptr)->prev, type, member) |
Get the last element from a list. More... | |
#define | llist_first_entry_or_null(ptr, type, member) (!llist_empty(ptr) ? llist_first_entry(ptr, type, member) : NULL) |
Get the first element from a list, or NULL. More... | |
#define | llist_for_each(pos, head) |
Iterate over a linked list. More... | |
#define | __llist_for_each(pos, head) for (pos = (head)->next; pos != (head); pos = pos->next) |
Iterate over a llist (no prefetch) More... | |
#define | llist_for_each_prev(pos, head) |
Iterate over a llist backwards. More... | |
#define | llist_for_each_safe(pos, n, head) |
Iterate over a list; safe against removal of llist entry. More... | |
#define | llist_for_each_entry(pos, head, member) |
Iterate over llist of given type. More... | |
#define | llist_for_each_entry_reverse(pos, head, member) |
Iterate backwards over llist of given type. More... | |
#define | llist_for_each_entry_continue(pos, head, member) |
iterate over llist of given type continuing after existing point More... | |
#define | llist_for_each_entry_safe(pos, n, head, member) |
iterate over llist of given type, safe against removal of non-consecutive(!) llist entries More... | |
#define | llist_for_each_rcu(pos, head) |
llist_for_each_rcu - iterate over an rcu-protected llist : the &struct llist_head to use as a loop counter. More... | |
#define | __llist_for_each_rcu(pos, head) |
#define | llist_for_each_safe_rcu(pos, n, head) |
llist_for_each_safe_rcu - iterate over an rcu-protected llist safe against removal of llist entry : the &struct llist_head to use as a loop counter. More... | |
#define | llist_for_each_entry_rcu(pos, head, member) |
llist_for_each_entry_rcu - iterate over rcu llist of given type : the type * to use as a loop counter. More... | |
#define | llist_for_each_continue_rcu(pos, head) |
llist_for_each_continue_rcu - iterate over an rcu-protected llist continuing after existing point. More... | |
Functions | |
static void | prefetch (const void *x) |
static void | __llist_add (struct llist_head *_new, struct llist_head *prev, struct llist_head *next) |
Insert a new entry between two known consecutive entries. More... | |
static void | llist_add (struct llist_head *_new, struct llist_head *head) |
add a new entry into a linked list (at head) More... | |
static void | llist_add_tail (struct llist_head *_new, struct llist_head *head) |
add a new entry into a linked list (at tail) More... | |
static void | __llist_del (struct llist_head *prev, struct llist_head *next) |
static void | llist_del (struct llist_head *entry) |
Delete entry from linked list. More... | |
static void | llist_del_init (struct llist_head *entry) |
Delete entry from linked list and reinitialize it. More... | |
static void | llist_move (struct llist_head *llist, struct llist_head *head) |
Delete from one llist and add as another's head. More... | |
static void | llist_move_tail (struct llist_head *llist, struct llist_head *head) |
Delete from one llist and add as another's tail. More... | |
static int | llist_empty (const struct llist_head *head) |
Test whether a linked list is empty. More... | |
static void | __llist_splice (struct llist_head *llist, struct llist_head *head) |
static void | llist_splice (struct llist_head *llist, struct llist_head *head) |
Join two llists. More... | |
static void | llist_splice_init (struct llist_head *llist, struct llist_head *head) |
join two llists and reinitialise the emptied llist. More... | |
static unsigned int | llist_count (struct llist_head *head) |
count nr of llist items by iterating. More... | |
Simple doubly linked list implementation.
Some of the internal functions ("__xxx") are useful when manipulating whole llists rather than single entries, as sometimes we already know the next/prev entries and we can generate better code by using them directly rather than using the generic single-entry routines.