Rev 5270 | Rev 6934 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5270 | Rev 6082 | ||
---|---|---|---|
Line 202... | Line 202... | ||
202 | * to the list entry is list_del_init(). Eg. it cannot be used |
202 | * to the list entry is list_del_init(). Eg. it cannot be used |
203 | * if another CPU could re-list_add() it. |
203 | * if another CPU could re-list_add() it. |
204 | */ |
204 | */ |
205 | static inline int list_empty_careful(const struct list_head *head) |
205 | static inline int list_empty_careful(const struct list_head *head) |
206 | { |
206 | { |
207 | struct list_head *next = head->next; |
207 | struct list_head *next = head->next; |
208 | return (next == head) && (next == head->prev); |
208 | return (next == head) && (next == head->prev); |
209 | } |
209 | } |
Line 210... | Line 210... | ||
210 | 210 | ||
211 | /** |
211 | /** |
Line 443... | Line 443... | ||
443 | * @head: the head for your list. |
443 | * @head: the head for your list. |
444 | * @member: the name of the list_head within the struct. |
444 | * @member: the name of the list_head within the struct. |
445 | */ |
445 | */ |
446 | #define list_for_each_entry(pos, head, member) \ |
446 | #define list_for_each_entry(pos, head, member) \ |
447 | for (pos = list_first_entry(head, typeof(*pos), member); \ |
447 | for (pos = list_first_entry(head, typeof(*pos), member); \ |
448 | &pos->member != (head); \ |
448 | &pos->member != (head); \ |
449 | pos = list_next_entry(pos, member)) |
449 | pos = list_next_entry(pos, member)) |
Line 450... | Line 450... | ||
450 | 450 | ||
451 | /** |
451 | /** |
452 | * list_for_each_entry_reverse - iterate backwards over list of given type. |
452 | * list_for_each_entry_reverse - iterate backwards over list of given type. |
453 | * @pos: the type * to use as a loop cursor. |
453 | * @pos: the type * to use as a loop cursor. |
454 | * @head: the head for your list. |
454 | * @head: the head for your list. |
455 | * @member: the name of the list_head within the struct. |
455 | * @member: the name of the list_head within the struct. |
456 | */ |
456 | */ |
457 | #define list_for_each_entry_reverse(pos, head, member) \ |
457 | #define list_for_each_entry_reverse(pos, head, member) \ |
458 | for (pos = list_last_entry(head, typeof(*pos), member); \ |
458 | for (pos = list_last_entry(head, typeof(*pos), member); \ |
459 | &pos->member != (head); \ |
459 | &pos->member != (head); \ |
Line 460... | Line 460... | ||
460 | pos = list_prev_entry(pos, member)) |
460 | pos = list_prev_entry(pos, member)) |
461 | 461 | ||
462 | /** |
462 | /** |
Line 479... | Line 479... | ||
479 | * Continue to iterate over list of given type, continuing after |
479 | * Continue to iterate over list of given type, continuing after |
480 | * the current position. |
480 | * the current position. |
481 | */ |
481 | */ |
482 | #define list_for_each_entry_continue(pos, head, member) \ |
482 | #define list_for_each_entry_continue(pos, head, member) \ |
483 | for (pos = list_next_entry(pos, member); \ |
483 | for (pos = list_next_entry(pos, member); \ |
484 | &pos->member != (head); \ |
484 | &pos->member != (head); \ |
485 | pos = list_next_entry(pos, member)) |
485 | pos = list_next_entry(pos, member)) |
Line 486... | Line 486... | ||
486 | 486 | ||
487 | /** |
487 | /** |
488 | * list_for_each_entry_continue_reverse - iterate backwards from the given point |
488 | * list_for_each_entry_continue_reverse - iterate backwards from the given point |
Line 493... | Line 493... | ||
493 | * Start to iterate over list of given type backwards, continuing after |
493 | * Start to iterate over list of given type backwards, continuing after |
494 | * the current position. |
494 | * the current position. |
495 | */ |
495 | */ |
496 | #define list_for_each_entry_continue_reverse(pos, head, member) \ |
496 | #define list_for_each_entry_continue_reverse(pos, head, member) \ |
497 | for (pos = list_prev_entry(pos, member); \ |
497 | for (pos = list_prev_entry(pos, member); \ |
498 | &pos->member != (head); \ |
498 | &pos->member != (head); \ |
499 | pos = list_prev_entry(pos, member)) |
499 | pos = list_prev_entry(pos, member)) |
Line 500... | Line 500... | ||
500 | 500 | ||
501 | /** |
501 | /** |
502 | * list_for_each_entry_from - iterate over list of given type from the current point |
502 | * list_for_each_entry_from - iterate over list of given type from the current point |
Line 505... | Line 505... | ||
505 | * @member: the name of the list_head within the struct. |
505 | * @member: the name of the list_head within the struct. |
506 | * |
506 | * |
507 | * Iterate over list of given type, continuing from current position. |
507 | * Iterate over list of given type, continuing from current position. |
508 | */ |
508 | */ |
509 | #define list_for_each_entry_from(pos, head, member) \ |
509 | #define list_for_each_entry_from(pos, head, member) \ |
510 | for (; &pos->member != (head); \ |
510 | for (; &pos->member != (head); \ |
511 | pos = list_next_entry(pos, member)) |
511 | pos = list_next_entry(pos, member)) |
Line 512... | Line 512... | ||
512 | 512 | ||
513 | /** |
513 | /** |
514 | * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry |
514 | * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry |
Line 670... | Line 670... | ||
670 | static inline void hlist_add_fake(struct hlist_node *n) |
670 | static inline void hlist_add_fake(struct hlist_node *n) |
671 | { |
671 | { |
672 | n->pprev = &n->next; |
672 | n->pprev = &n->next; |
673 | } |
673 | } |
Line -... | Line 674... | ||
- | 674 | ||
- | 675 | static inline bool hlist_fake(struct hlist_node *h) |
|
- | 676 | { |
|
- | 677 | return h->pprev == &h->next; |
|
- | 678 | } |
|
674 | 679 | ||
675 | /* |
680 | /* |
676 | * Move a list from one list head to another. Fixup the pprev |
681 | * Move a list from one list head to another. Fixup the pprev |
677 | * reference of the first entry if it exists. |
682 | * reference of the first entry if it exists. |
678 | */ |
683 | */ |