iPXE
Data Structures | Macros | Functions
list.h File Reference

Linked lists. More...

#include <stddef.h>
#include <assert.h>

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)
 
 FILE_SECBOOT (PERMITTED)
 
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)
 

Detailed Description

Linked lists.

This linked list handling code is based on the Linux kernel's list.h.

Definition in file list.h.

Macro Definition Documentation

◆ LIST_HEAD_INIT

#define LIST_HEAD_INIT (   list)    { &(list), &(list) }

Initialise a static list head.

Parameters
listList head

Definition at line 31 of file list.h.

◆ LIST_HEAD

#define LIST_HEAD (   list)    struct list_head list = LIST_HEAD_INIT ( list )

Declare a static list head.

Parameters
listList head

Definition at line 38 of file list.h.

◆ INIT_LIST_HEAD

#define INIT_LIST_HEAD (   list)
Value:
do { \
(list)->next = (list); \
(list)->prev = (list); \
} while ( 0 )
uint32_t next
Next descriptor address.
Definition: dwmac.h:22

Initialise a list head.

Parameters
listList head

Definition at line 46 of file list.h.

◆ list_check

#define list_check (   list)
Value:
( { \
assert ( (list) != NULL ); \
assert ( (list)->prev != NULL ); \
assert ( (list)->next != NULL ); \
assert ( (list)->next->prev == (list) ); \
assert ( (list)->prev->next == (list) ); \
} )
uint32_t next
Next descriptor address.
Definition: dwmac.h:22
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322

Check a list entry or list head is valid.

Parameters
listList entry or head

Definition at line 56 of file list.h.

◆ list_add

#define list_add (   new,
  head 
)
Value:
do { \
list_check ( (head) ); \
extern_list_add ( (new), (head) ); \
list_check ( (head) ); \
list_check ( (new) ); \
} while ( 0 )
uint8_t head
Head number.
Definition: int13.h:34

Add a new entry to the head of a list.

Parameters
newNew entry to be added
headList head, or entry after which to add the new entry

Definition at line 70 of file list.h.

◆ list_add_tail

#define list_add_tail (   new,
  head 
)
Value:
do { \
list_check ( (head) ); \
extern_list_add_tail ( (new), (head) ); \
list_check ( (head) ); \
list_check ( (new) ); \
} while ( 0 )
uint8_t head
Head number.
Definition: int13.h:34

Add a new entry to the tail of a list.

Parameters
newNew entry to be added
headList head, or entry before which to add the new entry

Definition at line 94 of file list.h.

◆ list_del

#define list_del (   list)
Value:
do { \
list_check ( (list) ); \
inline_list_del ( (list) ); \
} while ( 0 )

Delete an entry from a list.

Parameters
listList entry

Note that list_empty() on entry does not return true after this; the entry is in an undefined state.

Definition at line 120 of file list.h.

◆ list_empty

#define list_empty (   list)
Value:
( { \
list_check ( (list) ); \
inline_list_empty ( (list) ); } )

Test whether a list is empty.

Parameters
listList head

Definition at line 137 of file list.h.

◆ list_is_singular

#define list_is_singular (   list)
Value:
( { \
list_check ( (list) ); \
inline_list_is_singular ( (list) ); } )

Test whether a list has just one entry.

Parameters
listList to test

Definition at line 150 of file list.h.

◆ list_is_last

#define list_is_last (   list,
  head 
)
Value:
( { \
list_check ( (list) ); \
list_check ( (head) ); \
inline_list_is_last ( (list), (head) ); } )
uint8_t head
Head number.
Definition: int13.h:34

Test whether an entry is the last entry in list.

Parameters
listList entry to test
headList head

Definition at line 164 of file list.h.

◆ list_cut_position

#define list_cut_position (   new,
  list,
  entry 
)
Value:
do { \
list_check ( (new) ); \
assert ( list_empty ( (new) ) ); \
list_check ( (list) ); \
list_check ( (entry) ); \
extern_list_cut_position ( (new), (list), (entry) ); \
} while ( 0 )
#define list_empty(list)
Test whether a list is empty.
Definition: list.h:137

Cut a list into two.

Parameters
newA new list to contain all removed entries
listAn existing list
entryAn 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.

Definition at line 186 of file list.h.

◆ list_splice

#define list_splice (   list,
  entry 
)
Value:
do { \
list_check ( (list) ); \
list_check ( (entry) ); \
extern_list_splice ( (list), (entry) ); \
} while ( 0 )

Move all entries from one list into another list.

Parameters
listList of entries to add
entryEntry 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.

Definition at line 221 of file list.h.

◆ list_splice_tail

#define list_splice_tail (   list,
  entry 
)
Value:
do { \
list_check ( (list) ); \
list_check ( (entry) ); \
extern_list_splice_tail ( (list), (entry) ); \
} while ( 0 )

Move all entries from one list into another list.

Parameters
listList of entries to add
entryEntry 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.

Definition at line 251 of file list.h.

◆ list_splice_init

#define list_splice_init (   list,
  entry 
)
Value:
do { \
list_check ( (list) ); \
list_check ( (entry) ); \
extern_list_splice_init ( (list), (entry) ); \
} while ( 0 )

Move all entries from one list into another list and reinitialise empty list.

Parameters
listList of entries to add
entryEntry after which to add the new entries

All entries from list are inserted after entry.

Definition at line 279 of file list.h.

◆ list_splice_tail_init

#define list_splice_tail_init (   list,
  entry 
)
Value:
do { \
list_check ( (list) ); \
list_check ( (entry) ); \
extern_list_splice_tail_init ( (list), (entry) ); \
} while ( 0 )

Move all entries from one list into another list and reinitialise empty list.

Parameters
listList of entries to add
entryEntry before which to add the new entries

All entries from list are inserted before entry.

Definition at line 300 of file list.h.

◆ list_entry

#define list_entry (   list,
  type,
  member 
)
Value:
( { \
list_check ( (list) ); \
container_of ( list, type, member ); } )
uint32_t type
Operating system type.
Definition: ena.h:12

Get the container of a list entry.

Parameters
listList entry
typeContaining type
memberName of list field within containing type
Return values
containerContaining object

Definition at line 322 of file list.h.

◆ list_first_entry

#define list_first_entry (   list,
  type,
  member 
)
Value:
( list_empty ( (list) ) ? \
( type * ) NULL : \
list_entry ( (list)->next, type, member ) )
uint32_t type
Operating system type.
Definition: ena.h:12
#define list_empty(list)
Test whether a list is empty.
Definition: list.h:137
#define list_entry(list, type, member)
Get the container of a list entry.
Definition: list.h:322
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322

Get the container of the first entry in a list.

Parameters
listList head
typeContaining type
memberName of list field within containing type
Return values
firstFirst list entry, or NULL

Definition at line 334 of file list.h.

◆ list_last_entry

#define list_last_entry (   list,
  type,
  member 
)
Value:
( list_empty ( (list) ) ? \
( type * ) NULL : \
list_entry ( (list)->prev, type, member ) )
uint32_t type
Operating system type.
Definition: ena.h:12
#define list_empty(list)
Test whether a list is empty.
Definition: list.h:137
#define list_entry(list, type, member)
Get the container of a list entry.
Definition: list.h:322
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322

Get the container of the last entry in a list.

Parameters
listList head
typeContaining type
memberName of list field within containing type
Return values
firstFirst list entry, or NULL

Definition at line 347 of file list.h.

◆ list_next_entry

#define list_next_entry (   pos,
  head,
  member 
)
Value:
( { \
typeof (pos) next = list_entry ( (pos)->member.next, \
typeof ( *(pos) ), \
member ); \
( ( &next->member == (head) ) ? NULL : next ); } )
uint8_t head
Head number.
Definition: int13.h:34
uint32_t next
Next descriptor address.
Definition: dwmac.h:22
typeof(acpi_finder=acpi_find)
ACPI table finder.
Definition: acpi.c:48
#define list_entry(list, type, member)
Get the container of a list entry.
Definition: list.h:322
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322

Get the container of the next entry in a list.

Parameters
posCurrent list entry
headList head
memberName of list field within iterator's type
Return values
nextNext list entry, or NULL at end of list

Definition at line 360 of file list.h.

◆ list_prev_entry

#define list_prev_entry (   pos,
  head,
  member 
)
Value:
( { \
typeof (pos) prev = list_entry ( (pos)->member.prev, \
typeof ( *(pos) ), \
member ); \
( ( &prev->member == (head) ) ? NULL : prev ); } )
uint8_t head
Head number.
Definition: int13.h:34
typeof(acpi_finder=acpi_find)
ACPI table finder.
Definition: acpi.c:48
#define list_entry(list, type, member)
Get the container of a list entry.
Definition: list.h:322
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322

Get the container of the previous entry in a list.

Parameters
posCurrent list entry
headList head
memberName of list field within iterator's type
Return values
nextNext list entry, or NULL at end of list

Definition at line 374 of file list.h.

◆ list_is_first_entry

#define list_is_first_entry (   entry,
  head,
  member 
)    ( (head)->next == &(entry)->member )

Test if entry is first in a list.

Parameters
entryList entry
headList head
memberName of list field within iterator's type
Return values
is_firstEntry is first in the list

Definition at line 388 of file list.h.

◆ list_is_last_entry

#define list_is_last_entry (   entry,
  head,
  member 
)    ( (head)->prev == &(entry)->member )

Test if entry is last in a list.

Parameters
entryList entry
headList head
memberName of list field within iterator's type
Return values
is_lastEntry is last in the list

Definition at line 399 of file list.h.

◆ list_is_head_entry

#define list_is_head_entry (   entry,
  head,
  member 
)    ( (head) == &(entry)->member )

Test if entry is the list head.

Parameters
entryList entry
headList head
memberName of list field within iterator's type
Return values
is_headEntry is the list head

Definition at line 410 of file list.h.

◆ list_for_each

#define list_for_each (   pos,
  head 
)
Value:
for ( list_check ( (head) ), \
pos = (head)->next; \
pos != (head); \
pos = (pos)->next )
uint8_t head
Head number.
Definition: int13.h:34
uint32_t next
Next descriptor address.
Definition: dwmac.h:22
#define list_check(list)
Check a list entry or list head is valid.
Definition: list.h:56

Iterate over a list.

Parameters
posIterator
headList head

Definition at line 419 of file list.h.

◆ list_for_each_entry

#define list_for_each_entry (   pos,
  head,
  member 
)
Value:
for ( list_check ( (head) ), \
pos = list_entry ( (head)->next, typeof ( *pos ), member ); \
&pos->member != (head); \
pos = list_entry ( pos->member.next, typeof ( *pos ), member ) )
uint8_t head
Head number.
Definition: int13.h:34
uint32_t next
Next descriptor address.
Definition: dwmac.h:22
#define list_check(list)
Check a list entry or list head is valid.
Definition: list.h:56
typeof(acpi_finder=acpi_find)
ACPI table finder.
Definition: acpi.c:48
#define list_entry(list, type, member)
Get the container of a list entry.
Definition: list.h:322

Iterate over entries in a list.

Parameters
posIterator
headList head
memberName of list field within iterator's type

Definition at line 432 of file list.h.

◆ list_for_each_entry_reverse

#define list_for_each_entry_reverse (   pos,
  head,
  member 
)
Value:
for ( list_check ( (head) ), \
pos = list_entry ( (head)->prev, typeof ( *pos ), member ); \
&pos->member != (head); \
pos = list_entry ( pos->member.prev, typeof ( *pos ), member ) )
uint8_t head
Head number.
Definition: int13.h:34
#define list_check(list)
Check a list entry or list head is valid.
Definition: list.h:56
typeof(acpi_finder=acpi_find)
ACPI table finder.
Definition: acpi.c:48
#define list_entry(list, type, member)
Get the container of a list entry.
Definition: list.h:322

Iterate over entries in a list in reverse order.

Parameters
posIterator
headList head
memberName of list field within iterator's type

Definition at line 445 of file list.h.

◆ list_for_each_entry_safe

#define list_for_each_entry_safe (   pos,
  tmp,
  head,
  member 
)
Value:
for ( list_check ( (head) ), \
pos = list_entry ( (head)->next, typeof ( *pos ), member ), \
tmp = list_entry ( pos->member.next, typeof ( *tmp ), member ); \
&pos->member != (head); \
pos = tmp, \
tmp = list_entry ( tmp->member.next, typeof ( *tmp ), member ) )
uint8_t head
Head number.
Definition: int13.h:34
unsigned long tmp
Definition: linux_pci.h:65
uint32_t next
Next descriptor address.
Definition: dwmac.h:22
#define list_check(list)
Check a list entry or list head is valid.
Definition: list.h:56
typeof(acpi_finder=acpi_find)
ACPI table finder.
Definition: acpi.c:48
#define list_entry(list, type, member)
Get the container of a list entry.
Definition: list.h:322

Iterate over entries in a list, safe against deletion of the current entry.

Parameters
posIterator
tmpTemporary value (of same type as iterator)
headList head
memberName of list field within iterator's type

Definition at line 459 of file list.h.

◆ list_for_each_entry_continue

#define list_for_each_entry_continue (   pos,
  head,
  member 
)
Value:
for ( list_check ( (head) ), \
pos = list_entry ( pos->member.next, typeof ( *pos ), member ); \
&pos->member != (head); \
pos = list_entry ( pos->member.next, typeof ( *pos ), member ) )
uint8_t head
Head number.
Definition: int13.h:34
#define list_check(list)
Check a list entry or list head is valid.
Definition: list.h:56
typeof(acpi_finder=acpi_find)
ACPI table finder.
Definition: acpi.c:48
#define list_entry(list, type, member)
Get the container of a list entry.
Definition: list.h:322

Iterate over entries in a list, starting after current position.

Parameters
posIterator
headList head
memberName of list field within iterator's type

Definition at line 474 of file list.h.

◆ list_for_each_entry_continue_reverse

#define list_for_each_entry_continue_reverse (   pos,
  head,
  member 
)
Value:
for ( list_check ( (head) ), \
pos = list_entry ( pos->member.prev, typeof ( *pos ), member ); \
&pos->member != (head); \
pos = list_entry ( pos->member.prev, typeof ( *pos ), member ) )
uint8_t head
Head number.
Definition: int13.h:34
#define list_check(list)
Check a list entry or list head is valid.
Definition: list.h:56
typeof(acpi_finder=acpi_find)
ACPI table finder.
Definition: acpi.c:48
#define list_entry(list, type, member)
Get the container of a list entry.
Definition: list.h:322

Iterate over entries in a list in reverse, starting after current position.

Parameters
posIterator
headList head
memberName of list field within iterator's type

Definition at line 487 of file list.h.

◆ list_for_each_entry_safe_continue

#define list_for_each_entry_safe_continue (   pos,
  tmp,
  head,
  member 
)
Value:
for ( list_check ( (head) ), \
pos = list_entry ( pos->member.next, typeof ( *pos ), member ), \
tmp = list_entry ( pos->member.next, typeof ( *tmp ), member ); \
&pos->member != (head); \
pos = tmp, \
tmp = list_entry ( tmp->member.next, typeof ( *tmp ), member ) )
uint8_t head
Head number.
Definition: int13.h:34
unsigned long tmp
Definition: linux_pci.h:65
#define list_check(list)
Check a list entry or list head is valid.
Definition: list.h:56
typeof(acpi_finder=acpi_find)
ACPI table finder.
Definition: acpi.c:48
#define list_entry(list, type, member)
Get the container of a list entry.
Definition: list.h:322

Iterate over subsequent entries in a list, safe against deletion.

Parameters
posIterator
tmpTemporary value (of same type as iterator)
headList head
memberName of list field within iterator's type

Definition at line 501 of file list.h.

◆ list_contains

#define list_contains (   entry,
  head 
)
Value:
( { \
list_check ( (head) ); \
list_check ( (entry) ); \
extern_list_contains ( (entry), (head) ); } )
uint8_t head
Head number.
Definition: int13.h:34

Test if list contains a specified entry.

Parameters
entryEntry
headList head
Return values
presentList contains specified entry

Definition at line 516 of file list.h.

◆ list_contains_entry

#define list_contains_entry (   entry,
  head,
  member 
)    list_contains ( &(entry)->member, (head) )

Test if list contains a specified entry.

Parameters
entryEntry
headList head
Return values
presentList contains specified entry

Definition at line 540 of file list.h.

◆ list_check_contains_entry

#define list_check_contains_entry (   entry,
  head,
  member 
)
Value:
do { \
assert ( list_contains_entry ( (entry), (head), member ) ); \
} while ( 0 )
uint8_t head
Head number.
Definition: int13.h:34
#define list_contains_entry(entry, head, member)
Test if list contains a specified entry.
Definition: list.h:540

Check list contains a specified entry.

Parameters
entryEntry
headList head
memberName of list field within iterator's type

Definition at line 550 of file list.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED  )

◆ inline_list_add()

static void inline_list_add ( struct list_head new,
struct list_head head 
)
inlinestatic

Definition at line 76 of file list.h.

77  {
78  struct list_head *prev = head;
79  struct list_head *next = head->next;
80  next->prev = (new);
81  (new)->next = next;
82  (new)->prev = prev;
83  prev->next = (new);
84 }
struct list_head * next
Next list entry.
Definition: list.h:21
uint8_t head
Head number.
Definition: int13.h:34
A doubly-linked list entry (or list head)
Definition: list.h:19
uint32_t next
Next descriptor address.
Definition: dwmac.h:22
struct list_head * prev
Previous list entry.
Definition: list.h:23

References head, list_head::next, next, and list_head::prev.

Referenced by extern_list_add().

◆ extern_list_add()

void extern_list_add ( struct list_head new,
struct list_head head 
)

Definition at line 35 of file list.c.

35  {
36  inline_list_add ( new, head );
37 }
static void inline_list_add(struct list_head *new, struct list_head *head)
Definition: list.h:76
uint8_t head
Head number.
Definition: int13.h:34

References head, and inline_list_add().

◆ inline_list_add_tail()

static void inline_list_add_tail ( struct list_head new,
struct list_head head 
)
inlinestatic

Definition at line 100 of file list.h.

101  {
102  struct list_head *prev = head->prev;
103  struct list_head *next = head;
104  next->prev = (new);
105  (new)->next = next;
106  (new)->prev = prev;
107  prev->next = (new);
108 }
struct list_head * next
Next list entry.
Definition: list.h:21
uint8_t head
Head number.
Definition: int13.h:34
A doubly-linked list entry (or list head)
Definition: list.h:19
uint32_t next
Next descriptor address.
Definition: dwmac.h:22
struct list_head * prev
Previous list entry.
Definition: list.h:23

References head, list_head::next, next, and list_head::prev.

Referenced by extern_list_add_tail().

◆ extern_list_add_tail()

void extern_list_add_tail ( struct list_head new,
struct list_head head 
)

Definition at line 39 of file list.c.

39  {
40  inline_list_add_tail ( new, head );
41 }
uint8_t head
Head number.
Definition: int13.h:34
static void inline_list_add_tail(struct list_head *new, struct list_head *head)
Definition: list.h:100

References head, and inline_list_add_tail().

◆ inline_list_del()

static void inline_list_del ( struct list_head list)
inlinestatic

Definition at line 124 of file list.h.

124  {
125  struct list_head *next = (list)->next;
126  struct list_head *prev = (list)->prev;
127  next->prev = prev;
128  prev->next = next;
129 }
struct list_head * next
Next list entry.
Definition: list.h:21
A doubly-linked list entry (or list head)
Definition: list.h:19
uint32_t next
Next descriptor address.
Definition: dwmac.h:22
struct list_head * prev
Previous list entry.
Definition: list.h:23

References list_head::next, next, and list_head::prev.

Referenced by extern_list_del().

◆ extern_list_del()

void extern_list_del ( struct list_head list)

Definition at line 43 of file list.c.

43  {
44  inline_list_del ( list );
45 }
static void inline_list_del(struct list_head *list)
Definition: list.h:124

References inline_list_del().

◆ inline_list_empty()

static int inline_list_empty ( const struct list_head list)
inlinestatic

Definition at line 140 of file list.h.

140  {
141  return ( list->next == list );
142 }
struct list_head * next
Next list entry.
Definition: list.h:21

References list_head::next.

Referenced by extern_list_empty().

◆ extern_list_empty()

int extern_list_empty ( const struct list_head list)

Definition at line 47 of file list.c.

47  {
48  return inline_list_empty ( list );
49 }
static int inline_list_empty(const struct list_head *list)
Definition: list.h:140

References inline_list_empty().

◆ inline_list_is_singular()

static int inline_list_is_singular ( const struct list_head list)
inlinestatic

Definition at line 153 of file list.h.

153  {
154  return ( ( ! list_empty ( list ) ) && ( list->next == list->prev ) );
155 }
struct list_head * next
Next list entry.
Definition: list.h:21
#define list_empty(list)
Test whether a list is empty.
Definition: list.h:137
struct list_head * prev
Previous list entry.
Definition: list.h:23

References list_empty, list_head::next, and list_head::prev.

Referenced by extern_list_is_singular().

◆ extern_list_is_singular()

int extern_list_is_singular ( const struct list_head list)

Definition at line 51 of file list.c.

51  {
52  return inline_list_is_singular ( list );
53 }
static int inline_list_is_singular(const struct list_head *list)
Definition: list.h:153

References inline_list_is_singular().

◆ inline_list_is_last()

static int inline_list_is_last ( const struct list_head list,
const struct list_head head 
)
inlinestatic

Definition at line 168 of file list.h.

169  {
170  return ( list->next == head );
171 }
struct list_head * next
Next list entry.
Definition: list.h:21
uint8_t head
Head number.
Definition: int13.h:34

References head, and list_head::next.

Referenced by extern_list_is_last().

◆ extern_list_is_last()

int extern_list_is_last ( const struct list_head list,
const struct list_head head 
)

Definition at line 55 of file list.c.

56  {
57  return inline_list_is_last ( list, head );
58 }
uint8_t head
Head number.
Definition: int13.h:34
static int inline_list_is_last(const struct list_head *list, const struct list_head *head)
Definition: list.h:168

References head, and inline_list_is_last().

◆ inline_list_cut_position()

static void inline_list_cut_position ( struct list_head new,
struct list_head list,
struct list_head entry 
)
inlinestatic

Definition at line 193 of file list.h.

195  {
196  struct list_head *first = entry->next;
197 
198  if ( list != entry ) {
199  new->next = list->next;
200  new->next->prev = new;
201  new->prev = entry;
202  new->prev->next = new;
203  list->next = first;
204  list->next->prev = list;
205  }
206 }
struct list_head * next
Next list entry.
Definition: list.h:21
uint32_t first
First block in range.
Definition: pccrr.h:15
A doubly-linked list entry (or list head)
Definition: list.h:19
struct list_head * prev
Previous list entry.
Definition: list.h:23

References first, list_head::next, and list_head::prev.

Referenced by extern_list_cut_position().

◆ extern_list_cut_position()

void extern_list_cut_position ( struct list_head new,
struct list_head list,
struct list_head entry 
)

Definition at line 60 of file list.c.

62  {
63  inline_list_cut_position ( new, list, entry );
64 }
static void inline_list_cut_position(struct list_head *new, struct list_head *list, struct list_head *entry)
Definition: list.h:193

References inline_list_cut_position().

◆ inline_list_splice()

static void inline_list_splice ( const struct list_head list,
struct list_head entry 
)
inlinestatic

Definition at line 226 of file list.h.

227  {
228  struct list_head *first = list->next;
229  struct list_head *last = list->prev;
230 
231  if ( ! list_empty ( list ) ) {
232  last->next = entry->next;
233  last->next->prev = last;
234  first->prev = entry;
235  first->prev->next = first;
236  }
237 }
struct list_head * next
Next list entry.
Definition: list.h:21
uint32_t first
First block in range.
Definition: pccrr.h:15
A doubly-linked list entry (or list head)
Definition: list.h:19
#define list_empty(list)
Test whether a list is empty.
Definition: list.h:137
struct list_head * prev
Previous list entry.
Definition: list.h:23

References first, list_empty, list_head::next, and list_head::prev.

Referenced by extern_list_splice().

◆ extern_list_splice()

void extern_list_splice ( const struct list_head list,
struct list_head entry 
)

Definition at line 66 of file list.c.

67  {
68  inline_list_splice ( list, entry );
69 }
static void inline_list_splice(const struct list_head *list, struct list_head *entry)
Definition: list.h:226

References inline_list_splice().

◆ inline_list_splice_tail()

static void inline_list_splice_tail ( const struct list_head list,
struct list_head entry 
)
inlinestatic

Definition at line 256 of file list.h.

257  {
258  struct list_head *first = list->next;
259  struct list_head *last = list->prev;
260 
261  if ( ! list_empty ( list ) ) {
262  first->prev = entry->prev;
263  first->prev->next = first;
264  last->next = entry;
265  last->next->prev = last;
266  }
267 }
struct list_head * next
Next list entry.
Definition: list.h:21
uint32_t first
First block in range.
Definition: pccrr.h:15
A doubly-linked list entry (or list head)
Definition: list.h:19
#define list_empty(list)
Test whether a list is empty.
Definition: list.h:137
struct list_head * prev
Previous list entry.
Definition: list.h:23

References first, list_empty, list_head::next, and list_head::prev.

Referenced by extern_list_splice_tail().

◆ extern_list_splice_tail()

void extern_list_splice_tail ( const struct list_head list,
struct list_head entry 
)

Definition at line 71 of file list.c.

72  {
73  inline_list_splice_tail ( list, entry );
74 }
static void inline_list_splice_tail(const struct list_head *list, struct list_head *entry)
Definition: list.h:256

References inline_list_splice_tail().

◆ inline_list_splice_init()

static void inline_list_splice_init ( struct list_head list,
struct list_head entry 
)
inlinestatic

Definition at line 284 of file list.h.

285  {
286  list_splice ( list, entry );
287  INIT_LIST_HEAD ( list );
288 }
#define INIT_LIST_HEAD(list)
Initialise a list head.
Definition: list.h:46
#define list_splice(list, entry)
Move all entries from one list into another list.
Definition: list.h:221

References INIT_LIST_HEAD, and list_splice.

Referenced by extern_list_splice_init().

◆ extern_list_splice_init()

void extern_list_splice_init ( struct list_head list,
struct list_head entry 
)

Definition at line 76 of file list.c.

77  {
78  inline_list_splice_init ( list, entry );
79 }
static void inline_list_splice_init(struct list_head *list, struct list_head *entry)
Definition: list.h:284

References inline_list_splice_init().

◆ inline_list_splice_tail_init()

static void inline_list_splice_tail_init ( struct list_head list,
struct list_head entry 
)
inlinestatic

Definition at line 306 of file list.h.

307  {
308  list_splice_tail ( list, entry );
309  INIT_LIST_HEAD ( list );
310 }
#define list_splice_tail(list, entry)
Move all entries from one list into another list.
Definition: list.h:251
#define INIT_LIST_HEAD(list)
Initialise a list head.
Definition: list.h:46

References INIT_LIST_HEAD, and list_splice_tail.

Referenced by extern_list_splice_tail_init().

◆ extern_list_splice_tail_init()

void extern_list_splice_tail_init ( struct list_head list,
struct list_head entry 
)

Definition at line 81 of file list.c.

82  {
83  inline_list_splice_tail_init ( list, entry );
84 }
static void inline_list_splice_tail_init(struct list_head *list, struct list_head *entry)
Definition: list.h:306

References inline_list_splice_tail_init().

◆ inline_list_contains()

static int inline_list_contains ( struct list_head entry,
struct list_head head 
)
inlinestatic

Definition at line 520 of file list.h.

521  {
522  struct list_head *tmp;
523 
524  list_for_each ( tmp, head ) {
525  if ( tmp == entry )
526  return 1;
527  }
528  return 0;
529 }
#define list_for_each(pos, head)
Iterate over a list.
Definition: list.h:419
uint8_t head
Head number.
Definition: int13.h:34
A doubly-linked list entry (or list head)
Definition: list.h:19
unsigned long tmp
Definition: linux_pci.h:65

References head, list_for_each, and tmp.

Referenced by extern_list_contains().

◆ extern_list_contains()

int extern_list_contains ( struct list_head entry,
struct list_head head 
)

Definition at line 86 of file list.c.

87  {
88  return inline_list_contains ( entry, head );
89 }
uint8_t head
Head number.
Definition: int13.h:34
static int inline_list_contains(struct list_head *entry, struct list_head *head)
Definition: list.h:520

References head, and inline_list_contains().