libosmocore 1.11.1
Osmocom core library
|
Simple doubly linked list implementation. More...
#include <stddef.h>
#include <stdbool.h>
Go to the source code of this file.
Data Structures | |
struct | llist_head |
(double) linked list header structure More... | |
struct | hlist_head |
Double linked lists with a single pointer list head. More... | |
struct | hlist_node |
Macros | |
#define | inline __inline__ |
#define | container_of(ptr, type, member) |
Cast a member of a structure out to the containing structure. | |
#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. | |
#define | LLIST_POISON2 ((void *) 0x00200200) |
#define | LLIST_HEAD_INIT(name) |
Define a new llist_head pointing to a given llist_head. | |
#define | LLIST_HEAD(name) |
Define a statically-initialized variable of type llist_head. | |
#define | INIT_LLIST_HEAD(ptr) |
Initialize a llist_head to point back to itself. | |
#define | llist_entry(ptr, type, member) |
Get the struct containing this list entry. | |
#define | llist_first_entry(ptr, type, member) |
Get the first element from a linked list. | |
#define | llist_last_entry(ptr, type, member) |
Get the last element from a list. | |
#define | llist_last(head) |
Return the last element of the list. | |
#define | llist_first_entry_or_null(ptr, type, member) |
Get the first element from a list, or NULL. | |
#define | llist_for_each(pos, head) |
Iterate over a linked list. | |
#define | __llist_for_each(pos, head) |
Iterate over a linked list (no prefetch). | |
#define | llist_for_each_prev(pos, head) |
Iterate over a linked list backwards. | |
#define | llist_for_each_safe(pos, n, head) |
Iterate over a linked list, safe against removal of llist entry. | |
#define | llist_for_each_entry(pos, head, member) |
Iterate over a linked list of a given type. | |
#define | llist_for_each_entry_reverse(pos, head, member) |
Iterate backwards over a linked list of a given type. | |
#define | llist_for_each_entry_continue(pos, head, member) |
Iterate over a linked list of a given type, continuing after an existing point. | |
#define | llist_for_each_entry_safe(pos, n, head, member) |
Iterate over llist of given type, safe against removal of llist entry. | |
#define | llist_for_each_rcu(pos, head) |
Iterate over an rcu-protected llist. | |
#define | __llist_for_each_rcu(pos, head) |
#define | llist_for_each_safe_rcu(pos, n, head) |
Iterate over an rcu-protected llist, safe against removal of llist entry. | |
#define | llist_for_each_entry_rcu(pos, head, member) |
Iterate over an rcu-protected llist of a given type. | |
#define | llist_for_each_continue_rcu(pos, head) |
Iterate over an rcu-protected llist, continuing after existing point. | |
#define | HLIST_HEAD_INIT { .first = NULL } |
#define | HLIST_HEAD(name) |
#define | INIT_HLIST_HEAD(ptr) |
#define | READ_ONCE(x) |
#define | WRITE_ONCE(a, b) |
#define | hlist_entry(ptr, type, member) |
#define | hlist_for_each(pos, head) |
#define | hlist_for_each_safe(pos, n, head) |
#define | hlist_entry_safe(ptr, type, member) |
#define | hlist_for_each_entry(pos, head, member) |
iterate over list of given type. | |
#define | hlist_for_each_entry_continue(pos, member) |
iterate over a hlist continuing after current point. | |
#define | hlist_for_each_entry_from(pos, member) |
iterate over a hlist continuing from current point. | |
#define | hlist_for_each_entry_safe(pos, n, head, member) |
hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry. |
Functions | |
static void | prefetch (const void *x) |
static void | __llist_add (struct llist_head *_new, struct llist_head *prev, struct llist_head *next) |
static void | llist_add (struct llist_head *_new, struct llist_head *head) |
Add a new entry into a linked list (at head). | |
static void | llist_add_tail (struct llist_head *_new, struct llist_head *head) |
Add a new entry into a linked list (at tail). | |
static void | __llist_del (struct llist_head *prev, struct llist_head *next) |
static void | llist_del (struct llist_head *entry) |
Delete a single entry from a linked list. | |
static void | llist_del_init (struct llist_head *entry) |
Delete a single entry from a linked list and reinitialize it. | |
static void | llist_move (struct llist_head *llist, struct llist_head *head) |
Delete from one llist and add as another's head. | |
static void | llist_move_tail (struct llist_head *llist, struct llist_head *head) |
Delete from one llist and add as another's tail. | |
static int | llist_empty (const struct llist_head *head) |
Test whether a linked list is empty. | |
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 linked lists. | |
static void | llist_splice_init (struct llist_head *llist, struct llist_head *head) |
Join two llists and reinitialise the emptied llist. | |
static unsigned int | llist_count (const struct llist_head *head) |
Count number of llist items by iterating. | |
static void | INIT_HLIST_NODE (struct hlist_node *h) |
static int | hlist_unhashed (const struct hlist_node *h) |
Has node been removed from list and reinitialized? | |
static int | hlist_unhashed_lockless (const struct hlist_node *h) |
Version of hlist_unhashed for lockless use. | |
static int | hlist_empty (const struct hlist_head *h) |
Is the specified hlist_head structure an empty hlist? | |
static void | __hlist_del (struct hlist_node *n) |
static void | hlist_del (struct hlist_node *n) |
Delete the specified hlist_node from its list. | |
static void | hlist_del_init (struct hlist_node *n) |
Delete the specified hlist_node from its list and initialize. | |
static void | hlist_add_head (struct hlist_node *n, struct hlist_head *h) |
add a new entry at the beginning of the hlist. | |
static void | hlist_add_before (struct hlist_node *n, struct hlist_node *next) |
add a new entry before the one specified. | |
static void | hlist_add_behind (struct hlist_node *n, struct hlist_node *prev) |
add a new entry after the one specified | |
static void | hlist_add_fake (struct hlist_node *n) |
create a fake hlist consisting of a single headless node. | |
static bool | hlist_fake (struct hlist_node *h) |
Is this node a fake hlist? | |
static bool | hlist_is_singular_node (struct hlist_node *n, struct hlist_head *h) |
is node the only element of the specified hlist? | |
static void | hlist_move_list (struct hlist_head *old, struct hlist_head *_new) |
Move an hlist. |
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.