30 #define LIST_HEAD_INIT( list ) { &(list), &(list) } 37 #define LIST_HEAD( list ) \ 38 struct list_head list = LIST_HEAD_INIT ( list ) 45 #define INIT_LIST_HEAD( list ) do { \ 46 (list)->next = (list); \ 47 (list)->prev = (list); \ 55 #define list_check( list ) ( { \ 56 assert ( (list) != NULL ); \ 57 assert ( (list)->prev != NULL ); \ 58 assert ( (list)->next != NULL ); \ 59 assert ( (list)->next->prev == (list) ); \ 60 assert ( (list)->prev->next == (list) ); \ 69 #define list_add( new, head ) do { \ 70 list_check ( (head) ); \ 71 extern_list_add ( (new), (head) ); \ 72 list_check ( (head) ); \ 73 list_check ( (new) ); \ 93 #define list_add_tail( new, head ) do { \ 94 list_check ( (head) ); \ 95 extern_list_add_tail ( (new), (head) ); \ 96 list_check ( (head) ); \ 97 list_check ( (new) ); \ 119 #define list_del( list ) do { \ 120 list_check ( (list) ); \ 121 inline_list_del ( (list) ); \ 136 #define list_empty( list ) ( { \ 137 list_check ( (list) ); \ 138 inline_list_empty ( (list) ); } ) 140 return ( list->
next == list );
149 #define list_is_singular( list ) ( { \ 150 list_check ( (list) ); \ 151 inline_list_is_singular ( (list) ); } ) 163 #define list_is_last( list, head ) ( { \ 164 list_check ( (list) ); \ 165 list_check ( (head) ); \ 166 inline_list_is_last ( (list), (head) ); } ) 185 #define list_cut_position( new, list, entry ) do { \ 186 list_check ( (new) ); \ 187 assert ( list_empty ( (new) ) ); \ 188 list_check ( (list) ); \ 189 list_check ( (entry) ); \ 190 extern_list_cut_position ( (new), (list), (entry) ); \ 197 if ( list != entry ) {
220 #define list_splice( list, entry ) do { \ 221 list_check ( (list) ); \ 222 list_check ( (entry) ); \ 223 extern_list_splice ( (list), (entry) ); \ 250 #define list_splice_tail( list, entry ) do { \ 251 list_check ( (list) ); \ 252 list_check ( (entry) ); \ 253 extern_list_splice_tail ( (list), (entry) ); \ 278 #define list_splice_init( list, entry ) do { \ 279 list_check ( (list) ); \ 280 list_check ( (entry) ); \ 281 extern_list_splice_init ( (list), (entry) ); \ 299 #define list_splice_tail_init( list, entry ) do { \ 300 list_check ( (list) ); \ 301 list_check ( (entry) ); \ 302 extern_list_splice_tail_init ( (list), (entry) ); \ 321 #define list_entry( list, type, member ) ( { \ 322 list_check ( (list) ); \ 323 container_of ( list, type, member ); } ) 333 #define list_first_entry( list, type, member ) \ 334 ( list_empty ( (list) ) ? \ 336 list_entry ( (list)->next, type, member ) ) 346 #define list_last_entry( list, type, member ) \ 347 ( list_empty ( (list) ) ? \ 349 list_entry ( (list)->prev, type, member ) ) 359 #define list_next_entry( pos, head, member ) ( { \ 360 typeof (pos) next = list_entry ( (pos)->member.next, \ 363 ( ( &next->member == (head) ) ? NULL : next ); } ) 373 #define list_prev_entry( pos, head, member ) ( { \ 374 typeof (pos) prev = list_entry ( (pos)->member.prev, \ 377 ( ( &prev->member == (head) ) ? NULL : prev ); } ) 387 #define list_is_first_entry( entry, head, member ) \ 388 ( (head)->next == &(entry)->member ) 398 #define list_is_last_entry( entry, head, member ) \ 399 ( (head)->prev == &(entry)->member ) 409 #define list_is_head_entry( entry, head, member ) \ 410 ( (head) == &(entry)->member ) 418 #define list_for_each( pos, head ) \ 419 for ( list_check ( (head) ), \ 420 pos = (head)->next; \ 431 #define list_for_each_entry( pos, head, member ) \ 432 for ( list_check ( (head) ), \ 433 pos = list_entry ( (head)->next, typeof ( *pos ), member ); \ 434 &pos->member != (head); \ 435 pos = list_entry ( pos->member.next, typeof ( *pos ), member ) ) 444 #define list_for_each_entry_reverse( pos, head, member ) \ 445 for ( list_check ( (head) ), \ 446 pos = list_entry ( (head)->prev, typeof ( *pos ), member ); \ 447 &pos->member != (head); \ 448 pos = list_entry ( pos->member.prev, typeof ( *pos ), member ) ) 458 #define list_for_each_entry_safe( pos, tmp, head, member ) \ 459 for ( list_check ( (head) ), \ 460 pos = list_entry ( (head)->next, typeof ( *pos ), member ), \ 461 tmp = list_entry ( pos->member.next, typeof ( *tmp ), member ); \ 462 &pos->member != (head); \ 464 tmp = list_entry ( tmp->member.next, typeof ( *tmp ), member ) ) 473 #define list_for_each_entry_continue( pos, head, member ) \ 474 for ( list_check ( (head) ), \ 475 pos = list_entry ( pos->member.next, typeof ( *pos ), member ); \ 476 &pos->member != (head); \ 477 pos = list_entry ( pos->member.next, typeof ( *pos ), member ) ) 486 #define list_for_each_entry_continue_reverse( pos, head, member ) \ 487 for ( list_check ( (head) ), \ 488 pos = list_entry ( pos->member.prev, typeof ( *pos ), member ); \ 489 &pos->member != (head); \ 490 pos = list_entry ( pos->member.prev, typeof ( *pos ), member ) ) 500 #define list_for_each_entry_safe_continue( pos, tmp, head, member ) \ 501 for ( list_check ( (head) ), \ 502 pos = list_entry ( pos->member.next, typeof ( *pos ), member ), \ 503 tmp = list_entry ( pos->member.next, typeof ( *tmp ), member ); \ 504 &pos->member != (head); \ 506 tmp = list_entry ( tmp->member.next, typeof ( *tmp ), member ) ) 515 #define list_contains( entry, head ) ( { \ 516 list_check ( (head) ); \ 517 list_check ( (entry) ); \ 518 extern_list_contains ( (entry), (head) ); } ) 539 #define list_contains_entry( entry, head, member ) \ 540 list_contains ( &(entry)->member, (head) ) 549 #define list_check_contains_entry( entry, head, member ) do { \ 550 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)
uint32_t next
Next descriptor address.
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)
#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)