Lines Matching full:head
162 * @head: list head to add it after
164 * Insert a new entry after the specified 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()
176 * @head: list head to add it before
178 * Insert a new entry before the specified head.
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()
292 * list_move - delete from one list and add as another's head
294 * @head: the head that will precede our entry
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()
305 * @head: the head that will follow our entry
308 struct list_head *head) in list_move_tail() argument
311 list_add_tail(list, head); in list_move_tail()
316 * @head: the head that will follow our entry
320 * Move all entries between @first and including @last before @head.
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()
338 * list_is_first -- tests whether @list is the first entry in list @head
340 * @head: the head of the list
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()
348 * list_is_last - tests whether @list is the last entry in list @head
350 * @head: the head of the list
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()
358 * list_is_head - tests whether @list is the list @head
360 * @head: the head of the list
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()
369 * @head: the list to test.
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()
396 * @head: the list to test
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()
415 * @head: the head of the list
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()
430 * @head: The head of the list.
435 struct list_head *head) in list_rotate_to_front() argument
438 * Deletes the list head from the list denoted by @head and in list_rotate_to_front()
442 list_move_tail(head, list); in list_rotate_to_front()
447 * @head: the list to test.
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()
469 * @head: a list with entries
470 * @entry: an entry within head, could be the head itself
473 * This helper moves the initial part of @head, up to and
474 * including @entry, from @head to @list. You should
475 * pass on @entry an element you know is on @head. @list
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()
496 * @head: a list with entries
497 * @entry: an entry within head, could be the head itself
499 * This helper moves the initial part of @head, up to but
500 * excluding @entry, from @head to @list. You should pass
501 * in @entry an element you know is on @head. @list should
504 * If @entry == @head, all entries on @head are moved to
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()
540 * @head: the place to add it in the first list.
543 struct list_head *head) in list_splice() argument
546 __list_splice(list, head, head->next); in list_splice()
552 * @head: the place to add it in the first list.
555 struct list_head *head) in list_splice_tail() argument
558 __list_splice(list, head->prev, head); in list_splice_tail()
564 * @head: the place to add it in the first list.
569 struct list_head *head) in list_splice_init() argument
572 __list_splice(list, head, head->next); in list_splice_init()
580 * @head: the place to add it in the first list.
586 struct list_head *head) in list_splice_tail_init() argument
589 __list_splice(list, head->prev, head); in list_splice_tail_init()
605 * @ptr: the list head to take the element from.
616 * @ptr: the list head to take the element from.
627 * @ptr: the list head to take the element from.
650 * @head: the list head to take the element from.
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))
671 * @head: the list head to take the element from.
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))
684 * @head: the head for your list.
686 #define list_for_each(pos, head) \ argument
687 for (pos = (head)->next; !list_is_head(pos, (head)); pos = pos->next)
692 * @head: the head for your list.
694 #define list_for_each_reverse(pos, head) \ argument
695 for (pos = (head)->prev; pos != (head); pos = pos->prev)
700 * @head: the head for your list.
702 #define list_for_each_rcu(pos, head) \ argument
703 for (pos = rcu_dereference((head)->next); \
704 !list_is_head(pos, (head)); \
710 * @head: the head for your list.
714 #define list_for_each_continue(pos, head) \ argument
715 for (pos = pos->next; !list_is_head(pos, (head)); pos = pos->next)
720 * @head: the head for your list.
722 #define list_for_each_prev(pos, head) \ argument
723 for (pos = (head)->prev; !list_is_head(pos, (head)); pos = pos->prev)
729 * @head: the head for your list.
731 #define list_for_each_safe(pos, n, head) \ argument
732 for (pos = (head)->next, n = pos->next; \
733 !list_is_head(pos, (head)); \
740 * @head: the head for your list.
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)); \
749 * @head: the head for your list.
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()
763 * list_entry_is_head - test if the entry points to the head of the list
765 * @head: the head for your list.
768 #define list_entry_is_head(pos, head, member) \ argument
769 (&pos->member == (head))
774 * @head: the head for your list.
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); \
785 * @head: the head for your list.
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); \
796 * @head: the head of the list
801 #define list_prepare_entry(pos, head, member) \ argument
802 ((pos) ? : list_entry(head, typeof(*pos), member))
807 * @head: the head for your list.
813 #define list_for_each_entry_continue(pos, head, member) \ argument
815 !list_entry_is_head(pos, head, member); \
821 * @head: the head for your list.
827 #define list_for_each_entry_continue_reverse(pos, head, member) \ argument
829 !list_entry_is_head(pos, head, member); \
835 * @head: the head for your list.
840 #define list_for_each_entry_from(pos, head, member) \ argument
841 for (; !list_entry_is_head(pos, head, member); \
848 * @head: the head for your list.
853 #define list_for_each_entry_from_reverse(pos, head, member) \ argument
854 for (; !list_entry_is_head(pos, head, member); \
861 * @head: the head for your list.
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); \
874 * @head: the head for your list.
880 #define list_for_each_entry_safe_continue(pos, n, head, member) \ argument
883 !list_entry_is_head(pos, head, member); \
890 * @head: the head for your list.
896 #define list_for_each_entry_safe_from(pos, n, head, member) \ argument
898 !list_entry_is_head(pos, head, member); \
905 * @head: the head for your list.
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); \
933 * Double linked lists with a single pointer list head.
934 * Mostly useful for hash tables where the two pointer list head is
1024 * @h: hlist head to add it after
1026 * Insert a new entry after the specified head.
1096 * Check whether the node is the only node of the head without
1097 * accessing head, thus avoiding unnecessary cache misses.
1110 * Move a list from one list head to another. Fixup the pprev
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; }); \
1159 * @head: the head for your list.
1162 #define hlist_for_each_entry(pos, head, member) \ argument
1163 for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
1190 * @head: the head for your list.
1193 #define hlist_for_each_entry_safe(pos, n, head, member) \ argument
1194 for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\