31 #define LIST_HEAD_INIT( list ) { &(list), &(list) } 38 #define LIST_HEAD( list ) \ 39 struct list_head list = LIST_HEAD_INIT ( list ) 46 #define INIT_LIST_HEAD( list ) do { \ 47 (list)->next = (list); \ 48 (list)->prev = (list); \ 56 #define list_check( list ) ( { \ 57 assert ( (list) != NULL ); \ 58 assert ( (list)->prev != NULL ); \ 59 assert ( (list)->next != NULL ); \ 60 assert ( (list)->next->prev == (list) ); \ 61 assert ( (list)->prev->next == (list) ); \ 70 #define list_add( new, head ) do { \ 71 list_check ( (head) ); \ 72 extern_list_add ( (new), (head) ); \ 73 list_check ( (head) ); \ 74 list_check ( (new) ); \ 94 #define list_add_tail( new, head ) do { \ 95 list_check ( (head) ); \ 96 extern_list_add_tail ( (new), (head) ); \ 97 list_check ( (head) ); \ 98 list_check ( (new) ); \ 120 #define list_del( list ) do { \ 121 list_check ( (list) ); \ 122 inline_list_del ( (list) ); \ 137 #define list_empty( list ) ( { \ 138 list_check ( (list) ); \ 139 inline_list_empty ( (list) ); } ) 141 return ( list->
next == list );
150 #define list_is_singular( list ) ( { \ 151 list_check ( (list) ); \ 152 inline_list_is_singular ( (list) ); } ) 164 #define list_is_last( list, head ) ( { \ 165 list_check ( (list) ); \ 166 list_check ( (head) ); \ 167 inline_list_is_last ( (list), (head) ); } ) 186 #define list_cut_position( new, list, entry ) do { \ 187 list_check ( (new) ); \ 188 assert ( list_empty ( (new) ) ); \ 189 list_check ( (list) ); \ 190 list_check ( (entry) ); \ 191 extern_list_cut_position ( (new), (list), (entry) ); \ 198 if ( list != entry ) {
221 #define list_splice( list, entry ) do { \ 222 list_check ( (list) ); \ 223 list_check ( (entry) ); \ 224 extern_list_splice ( (list), (entry) ); \ 251 #define list_splice_tail( list, entry ) do { \ 252 list_check ( (list) ); \ 253 list_check ( (entry) ); \ 254 extern_list_splice_tail ( (list), (entry) ); \ 279 #define list_splice_init( list, entry ) do { \ 280 list_check ( (list) ); \ 281 list_check ( (entry) ); \ 282 extern_list_splice_init ( (list), (entry) ); \ 300 #define list_splice_tail_init( list, entry ) do { \ 301 list_check ( (list) ); \ 302 list_check ( (entry) ); \ 303 extern_list_splice_tail_init ( (list), (entry) ); \ 322 #define list_entry( list, type, member ) ( { \ 323 list_check ( (list) ); \ 324 container_of ( list, type, member ); } ) 334 #define list_first_entry( list, type, member ) \ 335 ( list_empty ( (list) ) ? \ 337 list_entry ( (list)->next, type, member ) ) 347 #define list_last_entry( list, type, member ) \ 348 ( list_empty ( (list) ) ? \ 350 list_entry ( (list)->prev, type, member ) ) 360 #define list_next_entry( pos, head, member ) ( { \ 361 typeof (pos) next = list_entry ( (pos)->member.next, \ 364 ( ( &next->member == (head) ) ? NULL : next ); } ) 374 #define list_prev_entry( pos, head, member ) ( { \ 375 typeof (pos) prev = list_entry ( (pos)->member.prev, \ 378 ( ( &prev->member == (head) ) ? NULL : prev ); } ) 388 #define list_is_first_entry( entry, head, member ) \ 389 ( (head)->next == &(entry)->member ) 399 #define list_is_last_entry( entry, head, member ) \ 400 ( (head)->prev == &(entry)->member ) 410 #define list_is_head_entry( entry, head, member ) \ 411 ( (head) == &(entry)->member ) 419 #define list_for_each( pos, head ) \ 420 for ( list_check ( (head) ), \ 421 pos = (head)->next; \ 432 #define list_for_each_entry( pos, head, member ) \ 433 for ( list_check ( (head) ), \ 434 pos = list_entry ( (head)->next, typeof ( *pos ), member ); \ 435 &pos->member != (head); \ 436 pos = list_entry ( pos->member.next, typeof ( *pos ), member ) ) 445 #define list_for_each_entry_reverse( pos, head, member ) \ 446 for ( list_check ( (head) ), \ 447 pos = list_entry ( (head)->prev, typeof ( *pos ), member ); \ 448 &pos->member != (head); \ 449 pos = list_entry ( pos->member.prev, typeof ( *pos ), member ) ) 459 #define list_for_each_entry_safe( pos, tmp, head, member ) \ 460 for ( list_check ( (head) ), \ 461 pos = list_entry ( (head)->next, typeof ( *pos ), member ), \ 462 tmp = list_entry ( pos->member.next, typeof ( *tmp ), member ); \ 463 &pos->member != (head); \ 465 tmp = list_entry ( tmp->member.next, typeof ( *tmp ), member ) ) 474 #define list_for_each_entry_continue( pos, head, member ) \ 475 for ( list_check ( (head) ), \ 476 pos = list_entry ( pos->member.next, typeof ( *pos ), member ); \ 477 &pos->member != (head); \ 478 pos = list_entry ( pos->member.next, typeof ( *pos ), member ) ) 487 #define list_for_each_entry_continue_reverse( pos, head, member ) \ 488 for ( list_check ( (head) ), \ 489 pos = list_entry ( pos->member.prev, typeof ( *pos ), member ); \ 490 &pos->member != (head); \ 491 pos = list_entry ( pos->member.prev, typeof ( *pos ), member ) ) 501 #define list_for_each_entry_safe_continue( pos, tmp, head, member ) \ 502 for ( list_check ( (head) ), \ 503 pos = list_entry ( pos->member.next, typeof ( *pos ), member ), \ 504 tmp = list_entry ( pos->member.next, typeof ( *tmp ), member ); \ 505 &pos->member != (head); \ 507 tmp = list_entry ( tmp->member.next, typeof ( *tmp ), member ) ) 516 #define list_contains( entry, head ) ( { \ 517 list_check ( (head) ); \ 518 list_check ( (entry) ); \ 519 extern_list_contains ( (entry), (head) ); } ) 540 #define list_contains_entry( entry, head, member ) \ 541 list_contains ( &(entry)->member, (head) ) 550 #define list_check_contains_entry( entry, head, member ) do { \ 551 assert ( list_contains_entry ( (entry), (head), member ) ); \ static int inline_list_empty(const struct list_head *list)
static void inline_list_splice_init(struct list_head *list, struct list_head *entry)
static void inline_list_add(struct list_head *new, struct list_head *head)
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)
struct list_head * next
Next list entry.
uint32_t first
First block in range.
static void inline_list_splice_tail(const struct list_head *list, struct list_head *entry)
int extern_list_is_last(const struct list_head *list, const struct list_head *head)
#define list_for_each(pos, head)
Iterate over a list.
A doubly-linked list entry (or list head)
#define list_empty(list)
Test whether a list is empty.
static int inline_list_contains(struct list_head *entry, struct list_head *head)
static void inline_list_cut_position(struct list_head *new, struct list_head *list, struct list_head *entry)
static void inline_list_del(struct list_head *list)
void extern_list_del(struct list_head *list)
void extern_list_splice_tail(const struct list_head *list, struct list_head *entry)
#define list_splice_tail(list, entry)
Move all entries from one list into another list.
int extern_list_is_singular(const struct list_head *list)
int extern_list_empty(const struct list_head *list)
void extern_list_add(struct list_head *new, struct list_head *head)
uint32_t next
Next descriptor address.
#define INIT_LIST_HEAD(list)
Initialise a list head.
struct list_head * prev
Previous list entry.
void extern_list_splice_tail_init(struct list_head *list, struct list_head *entry)
static int inline_list_is_singular(const struct list_head *list)
#define list_splice(list, entry)
Move all entries from one list into another list.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
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)
static int inline_list_is_last(const struct list_head *list, const struct list_head *head)
int extern_list_contains(struct list_head *entry, struct list_head *head)
void extern_list_cut_position(struct list_head *new, struct list_head *list, struct list_head *entry)
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)