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_rcu(pos, head) \ argument
695 for (pos = rcu_dereference((head)->next); \
696 !list_is_head(pos, (head)); \
706 #define list_for_each_continue(pos, head) \ argument
707 for (pos = pos->next; !list_is_head(pos, (head)); pos = pos->next)
714 #define list_for_each_prev(pos, head) \ argument
715 for (pos = (head)->prev; !list_is_head(pos, (head)); pos = pos->prev)
723 #define list_for_each_safe(pos, n, head) \ argument
724 for (pos = (head)->next, n = pos->next; \
725 !list_is_head(pos, (head)); \
734 #define list_for_each_prev_safe(pos, n, head) \ argument
735 for (pos = (head)->prev, n = pos->prev; \
736 !list_is_head(pos, (head)); \
743 static inline size_t list_count_nodes(struct list_head *head) in list_count_nodes() argument
748 list_for_each(pos, head) in list_count_nodes()
760 #define list_entry_is_head(pos, head, member) \ argument
761 list_is_head(&pos->member, (head))
769 #define list_for_each_entry(pos, head, member) \ argument
770 for (pos = list_first_entry(head, typeof(*pos), member); \
771 !list_entry_is_head(pos, head, member); \
780 #define list_for_each_entry_reverse(pos, head, member) \ argument
781 for (pos = list_last_entry(head, typeof(*pos), member); \
782 !list_entry_is_head(pos, head, member); \
793 #define list_prepare_entry(pos, head, member) \ argument
794 ((pos) ? : list_entry(head, typeof(*pos), member))
805 #define list_for_each_entry_continue(pos, head, member) \ argument
807 !list_entry_is_head(pos, head, member); \
819 #define list_for_each_entry_continue_reverse(pos, head, member) \ argument
821 !list_entry_is_head(pos, head, member); \
832 #define list_for_each_entry_from(pos, head, member) \ argument
833 for (; !list_entry_is_head(pos, head, member); \
845 #define list_for_each_entry_from_reverse(pos, head, member) \ argument
846 for (; !list_entry_is_head(pos, head, member); \
856 #define list_for_each_entry_safe(pos, n, head, member) \ argument
857 for (pos = list_first_entry(head, typeof(*pos), member), \
859 !list_entry_is_head(pos, head, member); \
872 #define list_for_each_entry_safe_continue(pos, n, head, member) \ argument
875 !list_entry_is_head(pos, head, member); \
888 #define list_for_each_entry_safe_from(pos, n, head, member) \ argument
890 !list_entry_is_head(pos, head, member); \
903 #define list_for_each_entry_safe_reverse(pos, n, head, member) \ argument
904 for (pos = list_last_entry(head, typeof(*pos), member), \
906 !list_entry_is_head(pos, head, member); \
1136 #define hlist_for_each(pos, head) \ argument
1137 for (pos = (head)->first; pos ; pos = pos->next)
1139 #define hlist_for_each_safe(pos, n, head) \ argument
1140 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
1154 #define hlist_for_each_entry(pos, head, member) \ argument
1155 for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
1185 #define hlist_for_each_entry_safe(pos, n, head, member) \ argument
1186 for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\
1194 static inline size_t hlist_count_nodes(struct hlist_head *head) in hlist_count_nodes() argument
1199 hlist_for_each(pos, head) in hlist_count_nodes()