iPXE
|
Linked lists. More...
Go to the source code of this file.
Data Structures | |
struct | list_head |
A doubly-linked list entry (or list head) More... | |
Macros | |
#define | LIST_HEAD_INIT(list) { &(list), &(list) } |
Initialise a static list head. More... | |
#define | LIST_HEAD(list) struct list_head list = LIST_HEAD_INIT ( list ) |
Declare a static list head. More... | |
#define | INIT_LIST_HEAD(list) |
Initialise a list head. More... | |
#define | list_check(list) |
Check a list entry or list head is valid. More... | |
#define | list_add(new, head) |
Add a new entry to the head of a list. More... | |
#define | list_add_tail(new, head) |
Add a new entry to the tail of a list. More... | |
#define | list_del(list) |
Delete an entry from a list. More... | |
#define | list_empty(list) |
Test whether a list is empty. More... | |
#define | list_is_singular(list) |
Test whether a list has just one entry. More... | |
#define | list_is_last(list, head) |
Test whether an entry is the last entry in list. More... | |
#define | list_cut_position(new, list, entry) |
Cut a list into two. More... | |
#define | list_splice(list, entry) |
Move all entries from one list into another list. More... | |
#define | list_splice_tail(list, entry) |
Move all entries from one list into another list. More... | |
#define | list_splice_init(list, entry) |
Move all entries from one list into another list and reinitialise empty list. More... | |
#define | list_splice_tail_init(list, entry) |
Move all entries from one list into another list and reinitialise empty list. More... | |
#define | list_entry(list, type, member) |
Get the container of a list entry. More... | |
#define | list_first_entry(list, type, member) |
Get the container of the first entry in a list. More... | |
#define | list_last_entry(list, type, member) |
Get the container of the last entry in a list. More... | |
#define | list_next_entry(pos, head, member) |
Get the container of the next entry in a list. More... | |
#define | list_prev_entry(pos, head, member) |
Get the container of the previous entry in a list. More... | |
#define | list_is_first_entry(entry, head, member) ( (head)->next == &(entry)->member ) |
Test if entry is first in a list. More... | |
#define | list_is_last_entry(entry, head, member) ( (head)->prev == &(entry)->member ) |
Test if entry is last in a list. More... | |
#define | list_is_head_entry(entry, head, member) ( (head) == &(entry)->member ) |
Test if entry is the list head. More... | |
#define | list_for_each(pos, head) |
Iterate over a list. More... | |
#define | list_for_each_entry(pos, head, member) |
Iterate over entries in a list. More... | |
#define | list_for_each_entry_reverse(pos, head, member) |
Iterate over entries in a list in reverse order. More... | |
#define | list_for_each_entry_safe(pos, tmp, head, member) |
Iterate over entries in a list, safe against deletion of the current entry. More... | |
#define | list_for_each_entry_continue(pos, head, member) |
Iterate over entries in a list, starting after current position. More... | |
#define | list_for_each_entry_continue_reverse(pos, head, member) |
Iterate over entries in a list in reverse, starting after current position. More... | |
#define | list_for_each_entry_safe_continue(pos, tmp, head, member) |
Iterate over subsequent entries in a list, safe against deletion. More... | |
#define | list_contains(entry, head) |
Test if list contains a specified entry. More... | |
#define | list_contains_entry(entry, head, member) list_contains ( &(entry)->member, (head) ) |
Test if list contains a specified entry. More... | |
#define | list_check_contains_entry(entry, head, member) |
Check list contains a specified entry. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static void | inline_list_add (struct list_head *new, struct list_head *head) |
void | extern_list_add (struct list_head *new, struct list_head *head) |
static void | inline_list_add_tail (struct list_head *new, struct list_head *head) |
void | extern_list_add_tail (struct list_head *new, struct list_head *head) |
static void | inline_list_del (struct list_head *list) |
void | extern_list_del (struct list_head *list) |
static int | inline_list_empty (const struct list_head *list) |
int | extern_list_empty (const struct list_head *list) |
static int | inline_list_is_singular (const struct list_head *list) |
int | extern_list_is_singular (const struct list_head *list) |
static int | inline_list_is_last (const struct list_head *list, const struct list_head *head) |
int | extern_list_is_last (const struct list_head *list, const struct list_head *head) |
static void | inline_list_cut_position (struct list_head *new, struct list_head *list, struct list_head *entry) |
void | extern_list_cut_position (struct list_head *new, struct list_head *list, struct list_head *entry) |
static void | inline_list_splice (const struct list_head *list, struct list_head *entry) |
void | extern_list_splice (const struct list_head *list, struct list_head *entry) |
static void | inline_list_splice_tail (const struct list_head *list, struct list_head *entry) |
void | extern_list_splice_tail (const struct list_head *list, struct list_head *entry) |
static void | inline_list_splice_init (struct list_head *list, struct list_head *entry) |
void | extern_list_splice_init (struct list_head *list, struct list_head *entry) |
static void | inline_list_splice_tail_init (struct list_head *list, struct list_head *entry) |
void | extern_list_splice_tail_init (struct list_head *list, struct list_head *entry) |
static int | inline_list_contains (struct list_head *entry, struct list_head *head) |
int | extern_list_contains (struct list_head *entry, struct list_head *head) |
Linked lists.
This linked list handling code is based on the Linux kernel's list.h.
Definition in file list.h.
#define LIST_HEAD_INIT | ( | list | ) | { &(list), &(list) } |
#define LIST_HEAD | ( | list | ) | struct list_head list = LIST_HEAD_INIT ( list ) |
#define INIT_LIST_HEAD | ( | list | ) |
Initialise a list head.
list | List head |
#define list_check | ( | list | ) |
#define list_add | ( | new, | |
head | |||
) |
#define list_add_tail | ( | new, | |
head | |||
) |
#define list_del | ( | list | ) |
Delete an entry from a list.
list | List entry |
Note that list_empty() on entry does not return true after this; the entry is in an undefined state.
#define list_empty | ( | list | ) |
#define list_is_singular | ( | list | ) |
#define list_is_last | ( | list, | |
head | |||
) |
#define list_cut_position | ( | new, | |
list, | |||
entry | |||
) |
Cut a list into two.
new | A new list to contain all removed entries |
list | An existing list |
entry | An entry within the existing list |
All entries from list
up to and including entry
are moved to new
, which should be an empty list. entry
may be equal to list
, in which case no entries are moved.
#define list_splice | ( | list, | |
entry | |||
) |
Move all entries from one list into another list.
list | List of entries to add |
entry | Entry after which to add the new entries |
All entries from list
are inserted after entry
. Note that list
is left in an undefined state; use list_splice_init()
if you want list
to become an empty list.
#define list_splice_tail | ( | list, | |
entry | |||
) |
Move all entries from one list into another list.
list | List of entries to add |
entry | Entry before which to add the new entries |
All entries from list
are inserted before entry
. Note that list
is left in an undefined state; use list_splice_tail_init()
if you want list
to become an empty list.
#define list_splice_init | ( | list, | |
entry | |||
) |
Move all entries from one list into another list and reinitialise empty list.
list | List of entries to add |
entry | Entry after which to add the new entries |
All entries from list
are inserted after entry
.
#define list_splice_tail_init | ( | list, | |
entry | |||
) |
Move all entries from one list into another list and reinitialise empty list.
list | List of entries to add |
entry | Entry before which to add the new entries |
All entries from list
are inserted before entry
.
#define list_entry | ( | list, | |
type, | |||
member | |||
) |
Get the container of a list entry.
list | List entry |
type | Containing type |
member | Name of list field within containing type |
container | Containing object |
#define list_first_entry | ( | list, | |
type, | |||
member | |||
) |
Get the container of the first entry in a list.
list | List head |
type | Containing type |
member | Name of list field within containing type |
first | First list entry, or NULL |
#define list_last_entry | ( | list, | |
type, | |||
member | |||
) |
Get the container of the last entry in a list.
list | List head |
type | Containing type |
member | Name of list field within containing type |
first | First list entry, or NULL |
#define list_next_entry | ( | pos, | |
head, | |||
member | |||
) |
Get the container of the next entry in a list.
pos | Current list entry |
head | List head |
member | Name of list field within iterator's type |
next | Next list entry, or NULL at end of list |
#define list_prev_entry | ( | pos, | |
head, | |||
member | |||
) |
Get the container of the previous entry in a list.
pos | Current list entry |
head | List head |
member | Name of list field within iterator's type |
next | Next list entry, or NULL at end of list |
#define list_for_each | ( | pos, | |
head | |||
) |
#define list_for_each_entry | ( | pos, | |
head, | |||
member | |||
) |
Iterate over entries in a list.
pos | Iterator |
head | List head |
member | Name of list field within iterator's type |
#define list_for_each_entry_reverse | ( | pos, | |
head, | |||
member | |||
) |
Iterate over entries in a list in reverse order.
pos | Iterator |
head | List head |
member | Name of list field within iterator's type |
Iterate over entries in a list, safe against deletion of the current entry.
pos | Iterator |
tmp | Temporary value (of same type as iterator) |
head | List head |
member | Name of list field within iterator's type |
#define list_for_each_entry_continue | ( | pos, | |
head, | |||
member | |||
) |
Iterate over entries in a list, starting after current position.
pos | Iterator |
head | List head |
member | Name of list field within iterator's type |
#define list_for_each_entry_continue_reverse | ( | pos, | |
head, | |||
member | |||
) |
Iterate over entries in a list in reverse, starting after current position.
pos | Iterator |
head | List head |
member | Name of list field within iterator's type |
Iterate over subsequent entries in a list, safe against deletion.
pos | Iterator |
tmp | Temporary value (of same type as iterator) |
head | List head |
member | Name of list field within iterator's type |
#define list_contains | ( | entry, | |
head | |||
) |
#define list_contains_entry | ( | entry, | |
head, | |||
member | |||
) | list_contains ( &(entry)->member, (head) ) |
#define list_check_contains_entry | ( | entry, | |
head, | |||
member | |||
) |
Check list contains a specified entry.
entry | Entry |
head | List head |
member | Name of list field within iterator's type |
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
Definition at line 75 of file list.h.
References head, next, list_head::next, and list_head::prev.
Referenced by extern_list_add().
Definition at line 34 of file list.c.
References head, and inline_list_add().
Definition at line 99 of file list.h.
References head, next, list_head::next, and list_head::prev.
Referenced by extern_list_add_tail().
Definition at line 38 of file list.c.
References head, and inline_list_add_tail().
|
inlinestatic |
Definition at line 123 of file list.h.
References next, list_head::next, and list_head::prev.
Referenced by extern_list_del().
void extern_list_del | ( | struct list_head * | list | ) |
|
inlinestatic |
Definition at line 139 of file list.h.
References list_head::next.
Referenced by extern_list_empty().
int extern_list_empty | ( | const struct list_head * | list | ) |
|
inlinestatic |
Definition at line 152 of file list.h.
References list_empty, list_head::next, and list_head::prev.
Referenced by extern_list_is_singular().
int extern_list_is_singular | ( | const struct list_head * | list | ) |
Definition at line 50 of file list.c.
References inline_list_is_singular().
|
inlinestatic |
Definition at line 167 of file list.h.
References head, and list_head::next.
Referenced by extern_list_is_last().
Definition at line 54 of file list.c.
References head, and inline_list_is_last().
|
inlinestatic |
Definition at line 192 of file list.h.
References first, list_head::next, and list_head::prev.
Referenced by extern_list_cut_position().
void extern_list_cut_position | ( | struct list_head * | new, |
struct list_head * | list, | ||
struct list_head * | entry | ||
) |
Definition at line 59 of file list.c.
References inline_list_cut_position().
|
inlinestatic |
Definition at line 225 of file list.h.
References first, list_empty, list_head::next, and list_head::prev.
Referenced by extern_list_splice().
Definition at line 65 of file list.c.
References inline_list_splice().
|
inlinestatic |
Definition at line 255 of file list.h.
References first, list_empty, list_head::next, and list_head::prev.
Referenced by extern_list_splice_tail().
Definition at line 70 of file list.c.
References inline_list_splice_tail().
|
inlinestatic |
Definition at line 283 of file list.h.
References INIT_LIST_HEAD, and list_splice.
Referenced by extern_list_splice_init().
Definition at line 75 of file list.c.
References inline_list_splice_init().
|
inlinestatic |
Definition at line 305 of file list.h.
References INIT_LIST_HEAD, and list_splice_tail.
Referenced by extern_list_splice_tail_init().
Definition at line 80 of file list.c.
References inline_list_splice_tail_init().
Definition at line 519 of file list.h.
References head, list_for_each, and tmp.
Referenced by extern_list_contains().
Definition at line 85 of file list.c.
References head, and inline_list_contains().