Lines Matching refs:head
167 static inline void list_add(struct list_head *new, struct list_head *head) in list_add() argument
169 __list_add(new, head, head->next); in list_add()
181 static inline void list_add_tail(struct list_head *new, struct list_head *head) in list_add_tail() argument
183 __list_add(new, head->prev, head); in list_add_tail()
296 static inline void list_move(struct list_head *list, struct list_head *head) in list_move() argument
299 list_add(list, head); in list_move()
308 struct list_head *head) in list_move_tail() argument
311 list_add_tail(list, head); in list_move_tail()
323 static inline void list_bulk_move_tail(struct list_head *head, in list_bulk_move_tail() argument
330 head->prev->next = first; in list_bulk_move_tail()
331 first->prev = head->prev; in list_bulk_move_tail()
333 last->next = head; in list_bulk_move_tail()
334 head->prev = last; in list_bulk_move_tail()
342 static inline int list_is_first(const struct list_head *list, const struct list_head *head) in list_is_first() argument
344 return list->prev == head; in list_is_first()
352 static inline int list_is_last(const struct list_head *list, const struct list_head *head) in list_is_last() argument
354 return list->next == head; in list_is_last()
362 static inline int list_is_head(const struct list_head *list, const struct list_head *head) in list_is_head() argument
364 return list == head; in list_is_head()
371 static inline int list_empty(const struct list_head *head) in list_empty() argument
373 return READ_ONCE(head->next) == head; in list_empty()
407 static inline int list_empty_careful(const struct list_head *head) in list_empty_careful() argument
409 struct list_head *next = smp_load_acquire(&head->next); in list_empty_careful()
410 return list_is_head(next, head) && (next == READ_ONCE(head->prev)); in list_empty_careful()
417 static inline void list_rotate_left(struct list_head *head) in list_rotate_left() argument
421 if (!list_empty(head)) { in list_rotate_left()
422 first = head->next; in list_rotate_left()
423 list_move_tail(first, head); in list_rotate_left()
435 struct list_head *head) in list_rotate_to_front() argument
442 list_move_tail(head, list); in list_rotate_to_front()
449 static inline int list_is_singular(const struct list_head *head) in list_is_singular() argument
451 return !list_empty(head) && (head->next == head->prev); in list_is_singular()
455 struct list_head *head, struct list_head *entry) in __list_cut_position() argument
458 list->next = head->next; in __list_cut_position()
462 head->next = new_first; in __list_cut_position()
463 new_first->prev = head; in __list_cut_position()
481 struct list_head *head, struct list_head *entry) in list_cut_position() argument
483 if (list_empty(head)) in list_cut_position()
485 if (list_is_singular(head) && !list_is_head(entry, head) && (entry != head->next)) in list_cut_position()
487 if (list_is_head(entry, head)) in list_cut_position()
490 __list_cut_position(list, head, entry); in list_cut_position()
508 struct list_head *head, in list_cut_before() argument
511 if (head->next == entry) { in list_cut_before()
515 list->next = head->next; in list_cut_before()
519 head->next = entry; in list_cut_before()
520 entry->prev = head; in list_cut_before()
543 struct list_head *head) in list_splice() argument
546 __list_splice(list, head, head->next); in list_splice()
555 struct list_head *head) in list_splice_tail() argument
558 __list_splice(list, head->prev, head); in list_splice_tail()
569 struct list_head *head) in list_splice_init() argument
572 __list_splice(list, head, head->next); in list_splice_init()
586 struct list_head *head) in list_splice_tail_init() argument
589 __list_splice(list, head->prev, head); in list_splice_tail_init()
656 #define list_next_entry_circular(pos, head, member) \ argument
657 (list_is_last(&(pos)->member, head) ? \
658 list_first_entry(head, typeof(*(pos)), member) : list_next_entry(pos, member))
677 #define list_prev_entry_circular(pos, head, member) \ argument
678 (list_is_first(&(pos)->member, head) ? \
679 list_last_entry(head, typeof(*(pos)), member) : list_prev_entry(pos, member))
686 #define list_for_each(pos, head) \ argument
687 for (pos = (head)->next; !list_is_head(pos, (head)); pos = pos->next)
694 #define list_for_each_reverse(pos, head) \ argument
695 for (pos = (head)->prev; pos != (head); pos = pos->prev)
702 #define list_for_each_rcu(pos, head) \ argument
703 for (pos = rcu_dereference((head)->next); \
704 !list_is_head(pos, (head)); \
714 #define list_for_each_continue(pos, head) \ argument
715 for (pos = pos->next; !list_is_head(pos, (head)); pos = pos->next)
722 #define list_for_each_prev(pos, head) \ argument
723 for (pos = (head)->prev; !list_is_head(pos, (head)); pos = pos->prev)
731 #define list_for_each_safe(pos, n, head) \ argument
732 for (pos = (head)->next, n = pos->next; \
733 !list_is_head(pos, (head)); \
742 #define list_for_each_prev_safe(pos, n, head) \ argument
743 for (pos = (head)->prev, n = pos->prev; \
744 !list_is_head(pos, (head)); \
751 static inline size_t list_count_nodes(struct list_head *head) in list_count_nodes() argument
756 list_for_each(pos, head) in list_count_nodes()
768 #define list_entry_is_head(pos, head, member) \ argument
769 list_is_head(&pos->member, (head))
777 #define list_for_each_entry(pos, head, member) \ argument
778 for (pos = list_first_entry(head, typeof(*pos), member); \
779 !list_entry_is_head(pos, head, member); \
788 #define list_for_each_entry_reverse(pos, head, member) \ argument
789 for (pos = list_last_entry(head, typeof(*pos), member); \
790 !list_entry_is_head(pos, head, member); \
801 #define list_prepare_entry(pos, head, member) \ argument
802 ((pos) ? : list_entry(head, typeof(*pos), member))
813 #define list_for_each_entry_continue(pos, head, member) \ argument
815 !list_entry_is_head(pos, head, member); \
827 #define list_for_each_entry_continue_reverse(pos, head, member) \ argument
829 !list_entry_is_head(pos, head, member); \
840 #define list_for_each_entry_from(pos, head, member) \ argument
841 for (; !list_entry_is_head(pos, head, member); \
853 #define list_for_each_entry_from_reverse(pos, head, member) \ argument
854 for (; !list_entry_is_head(pos, head, member); \
864 #define list_for_each_entry_safe(pos, n, head, member) \ argument
865 for (pos = list_first_entry(head, typeof(*pos), member), \
867 !list_entry_is_head(pos, head, member); \
880 #define list_for_each_entry_safe_continue(pos, n, head, member) \ argument
883 !list_entry_is_head(pos, head, member); \
896 #define list_for_each_entry_safe_from(pos, n, head, member) \ argument
898 !list_entry_is_head(pos, head, member); \
911 #define list_for_each_entry_safe_reverse(pos, n, head, member) \ argument
912 for (pos = list_last_entry(head, typeof(*pos), member), \
914 !list_entry_is_head(pos, head, member); \
1144 #define hlist_for_each(pos, head) \ argument
1145 for (pos = (head)->first; pos ; pos = pos->next)
1147 #define hlist_for_each_safe(pos, n, head) \ argument
1148 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
1162 #define hlist_for_each_entry(pos, head, member) \ argument
1163 for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
1193 #define hlist_for_each_entry_safe(pos, n, head, member) \ argument
1194 for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\
1202 static inline size_t hlist_count_nodes(struct hlist_head *head) in hlist_count_nodes() argument
1207 hlist_for_each(pos, head) in hlist_count_nodes()