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_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_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)
 

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 30 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 37 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: myson.h:18

Initialise a list head.

Parameters
listList head

Definition at line 45 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: myson.h:18
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

Check a list entry or list head is valid.

Parameters
listList entry or head

Definition at line 55 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 69 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 93 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 119 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 136 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 149 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 163 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:136
union aes_table_entry entry[256]
Table entries, indexed by S(N)
Definition: aes.c:26

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 185 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 )
union aes_table_entry entry[256]
Table entries, indexed by S(N)
Definition: aes.c:26

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 220 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 )
union aes_table_entry entry[256]
Table entries, indexed by S(N)
Definition: aes.c:26

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 250 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 )
union aes_table_entry entry[256]
Table entries, indexed by S(N)
Definition: aes.c:26

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 278 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 )
union aes_table_entry entry[256]
Table entries, indexed by S(N)
Definition: aes.c:26

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 299 of file list.h.

◆ list_entry

#define list_entry (   list,
  type,
  member 
)
Value:
( { \
list_check ( (list) ); \
container_of ( list, type, member ); } )
uint8_t type
Type.
Definition: ena.h:16

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 321 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 ) )
uint8_t type
Type.
Definition: ena.h:16
#define list_empty(list)
Test whether a list is empty.
Definition: list.h:136
#define list_entry(list, type, member)
Get the container of a list entry.
Definition: list.h:321
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

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 333 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 ) )
uint8_t type
Type.
Definition: ena.h:16
#define list_empty(list)
Test whether a list is empty.
Definition: list.h:136
#define list_entry(list, type, member)
Get the container of a list entry.
Definition: list.h:321
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

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 346 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 ); } )
uint32_t next
Next descriptor address.
Definition: myson.h:18
uint8_t head
Head number.
Definition: int13.h:34
#define list_entry(list, type, member)
Get the container of a list entry.
Definition: list.h:321
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

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 359 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
#define list_entry(list, type, member)
Get the container of a list entry.
Definition: list.h:321
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

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 373 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 387 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 398 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 )
uint32_t next
Next descriptor address.
Definition: myson.h:18
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:55

Iterate over a list.

Parameters
posIterator
headList head

Definition at line 407 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 ) )
uint32_t next
Next descriptor address.
Definition: myson.h:18
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:55
#define list_entry(list, type, member)
Get the container of a list entry.
Definition: list.h:321

Iterate over entries in a list.

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

Definition at line 420 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:55
#define list_entry(list, type, member)
Get the container of a list entry.
Definition: list.h:321

Iterate over entries in a list in reverse order.

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

Definition at line 433 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 ) )
uint32_t next
Next descriptor address.
Definition: myson.h:18
uint8_t head
Head number.
Definition: int13.h:34
uint8_t * tmp
Definition: entropy.h:156
#define list_check(list)
Check a list entry or list head is valid.
Definition: list.h:55
#define list_entry(list, type, member)
Get the container of a list entry.
Definition: list.h:321

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 447 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:55
#define list_entry(list, type, member)
Get the container of a list entry.
Definition: list.h:321

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 462 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:55
#define list_entry(list, type, member)
Get the container of a list entry.
Definition: list.h:321

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 475 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
union aes_table_entry entry[256]
Table entries, indexed by S(N)
Definition: aes.c:26

Test if list contains a specified entry.

Parameters
entryEntry
headList head
Return values
presentList contains specified entry

Definition at line 488 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 512 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:512
union aes_table_entry entry[256]
Table entries, indexed by S(N)
Definition: aes.c:26

Check list contains a specified entry.

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

Definition at line 522 of file list.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ inline_list_add()

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

Definition at line 75 of file list.h.

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

References head, next, list_head::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 34 of file list.c.

34  {
35  inline_list_add ( new, head );
36 }
static void inline_list_add(struct list_head *new, struct list_head *head)
Definition: list.h:75
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 99 of file list.h.

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

References head, next, list_head::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 38 of file list.c.

38  {
39  inline_list_add_tail ( new, head );
40 }
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:99

References head, and inline_list_add_tail().

◆ inline_list_del()

static void inline_list_del ( struct list_head list)
inlinestatic

Definition at line 123 of file list.h.

123  {
124  struct list_head *next = (list)->next;
125  struct list_head *prev = (list)->prev;
126  next->prev = prev;
127  prev->next = next;
128 }
uint32_t next
Next descriptor address.
Definition: myson.h:18
struct list_head * next
Next list entry.
Definition: list.h:20
A doubly-linked list entry (or list head)
Definition: list.h:18
struct list_head * prev
Previous list entry.
Definition: list.h:22

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

Referenced by extern_list_del().

◆ extern_list_del()

void extern_list_del ( struct list_head list)

Definition at line 42 of file list.c.

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

References inline_list_del().

◆ inline_list_empty()

static int inline_list_empty ( const struct list_head list)
inlinestatic

Definition at line 139 of file list.h.

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

References list_head::next.

Referenced by extern_list_empty().

◆ extern_list_empty()

int extern_list_empty ( const struct list_head list)

Definition at line 46 of file list.c.

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

References inline_list_empty().

◆ inline_list_is_singular()

static int inline_list_is_singular ( const struct list_head list)
inlinestatic

Definition at line 152 of file list.h.

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

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 50 of file list.c.

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

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 167 of file list.h.

168  {
169  return ( list->next == head );
170 }
struct list_head * next
Next list entry.
Definition: list.h:20
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 54 of file list.c.

55  {
56  return inline_list_is_last ( list, head );
57 }
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:167

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 192 of file list.h.

194  {
195  struct list_head *first = entry->next;
196 
197  if ( list != entry ) {
198  new->next = list->next;
199  new->next->prev = new;
200  new->prev = entry;
201  new->prev->next = new;
202  list->next = first;
203  list->next->prev = list;
204  }
205 }
struct list_head * next
Next list entry.
Definition: list.h:20
A doubly-linked list entry (or list head)
Definition: list.h:18
union aes_table_entry entry[256]
Table entries, indexed by S(N)
Definition: aes.c:26
struct list_head * prev
Previous list entry.
Definition: list.h:22
uint32_t first
Length to skip in first segment.
Definition: pccrc.h:23

References entry, 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 59 of file list.c.

61  {
62  inline_list_cut_position ( new, list, entry );
63 }
static void inline_list_cut_position(struct list_head *new, struct list_head *list, struct list_head *entry)
Definition: list.h:192
union aes_table_entry entry[256]
Table entries, indexed by S(N)
Definition: aes.c:26

References entry, and 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 225 of file list.h.

226  {
227  struct list_head *first = list->next;
228  struct list_head *last = list->prev;
229 
230  if ( ! list_empty ( list ) ) {
231  last->next = entry->next;
232  last->next->prev = last;
233  first->prev = entry;
234  first->prev->next = first;
235  }
236 }
struct list_head * next
Next list entry.
Definition: list.h:20
A doubly-linked list entry (or list head)
Definition: list.h:18
#define list_empty(list)
Test whether a list is empty.
Definition: list.h:136
union aes_table_entry entry[256]
Table entries, indexed by S(N)
Definition: aes.c:26
uint32_t last
Length to read in last segment, or zero.
Definition: pccrc.h:30
struct list_head * prev
Previous list entry.
Definition: list.h:22
uint32_t first
Length to skip in first segment.
Definition: pccrc.h:23

References entry, first, last, 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 65 of file list.c.

66  {
67  inline_list_splice ( list, entry );
68 }
static void inline_list_splice(const struct list_head *list, struct list_head *entry)
Definition: list.h:225
union aes_table_entry entry[256]
Table entries, indexed by S(N)
Definition: aes.c:26

References entry, and 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 255 of file list.h.

256  {
257  struct list_head *first = list->next;
258  struct list_head *last = list->prev;
259 
260  if ( ! list_empty ( list ) ) {
261  first->prev = entry->prev;
262  first->prev->next = first;
263  last->next = entry;
264  last->next->prev = last;
265  }
266 }
struct list_head * next
Next list entry.
Definition: list.h:20
A doubly-linked list entry (or list head)
Definition: list.h:18
#define list_empty(list)
Test whether a list is empty.
Definition: list.h:136
union aes_table_entry entry[256]
Table entries, indexed by S(N)
Definition: aes.c:26
uint32_t last
Length to read in last segment, or zero.
Definition: pccrc.h:30
struct list_head * prev
Previous list entry.
Definition: list.h:22
uint32_t first
Length to skip in first segment.
Definition: pccrc.h:23

References entry, first, last, 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 70 of file list.c.

71  {
73 }
static void inline_list_splice_tail(const struct list_head *list, struct list_head *entry)
Definition: list.h:255
union aes_table_entry entry[256]
Table entries, indexed by S(N)
Definition: aes.c:26

References entry, and 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 283 of file list.h.

284  {
285  list_splice ( list, entry );
286  INIT_LIST_HEAD ( list );
287 }
union aes_table_entry entry[256]
Table entries, indexed by S(N)
Definition: aes.c:26
#define INIT_LIST_HEAD(list)
Initialise a list head.
Definition: list.h:45
#define list_splice(list, entry)
Move all entries from one list into another list.
Definition: list.h:220

References entry, 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 75 of file list.c.

76  {
78 }
static void inline_list_splice_init(struct list_head *list, struct list_head *entry)
Definition: list.h:283
union aes_table_entry entry[256]
Table entries, indexed by S(N)
Definition: aes.c:26

References entry, and 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 305 of file list.h.

306  {
307  list_splice_tail ( list, entry );
308  INIT_LIST_HEAD ( list );
309 }
union aes_table_entry entry[256]
Table entries, indexed by S(N)
Definition: aes.c:26
#define list_splice_tail(list, entry)
Move all entries from one list into another list.
Definition: list.h:250
#define INIT_LIST_HEAD(list)
Initialise a list head.
Definition: list.h:45

References entry, 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 80 of file list.c.

81  {
83 }
union aes_table_entry entry[256]
Table entries, indexed by S(N)
Definition: aes.c:26
static void inline_list_splice_tail_init(struct list_head *list, struct list_head *entry)
Definition: list.h:305

References entry, and 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 492 of file list.h.

493  {
494  struct list_head *tmp;
495 
496  list_for_each ( tmp, head ) {
497  if ( tmp == entry )
498  return 1;
499  }
500  return 0;
501 }
#define list_for_each(pos, head)
Iterate over a list.
Definition: list.h:407
uint8_t head
Head number.
Definition: int13.h:34
A doubly-linked list entry (or list head)
Definition: list.h:18
union aes_table_entry entry[256]
Table entries, indexed by S(N)
Definition: aes.c:26
uint8_t * tmp
Definition: entropy.h:156

References entry, 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 85 of file list.c.

86  {
87  return inline_list_contains ( entry, head );
88 }
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:492
union aes_table_entry entry[256]
Table entries, indexed by S(N)
Definition: aes.c:26

References entry, head, and inline_list_contains().