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_rcu(pos, head) \ argument
695 for (pos = rcu_dereference((head)->next); \
696 !list_is_head(pos, (head)); \
702 * @head: the head for your list.
706 #define list_for_each_continue(pos, head) \ argument
707 for (pos = pos->next; !list_is_head(pos, (head)); pos = pos->next)
712 * @head: the head for your list.
714 #define list_for_each_prev(pos, head) \ argument
715 for (pos = (head)->prev; !list_is_head(pos, (head)); pos = pos->prev)
721 * @head: the head for your list.
723 #define list_for_each_safe(pos, n, head) \ argument
724 for (pos = (head)->next, n = pos->next; \
725 !list_is_head(pos, (head)); \
732 * @head: the head for your list.
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)); \
741 * @head: the head for your list.
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()
755 * list_entry_is_head - test if the entry points to the head of the list
757 * @head: the head for your list.
760 #define list_entry_is_head(pos, head, member) \ argument
761 list_is_head(&pos->member, (head))
766 * @head: the head for your list.
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); \
777 * @head: the head for your list.
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); \
788 * @head: the head of the list
793 #define list_prepare_entry(pos, head, member) \ argument
794 ((pos) ? : list_entry(head, typeof(*pos), member))
799 * @head: the head for your list.
805 #define list_for_each_entry_continue(pos, head, member) \ argument
807 !list_entry_is_head(pos, head, member); \
813 * @head: the head for your list.
819 #define list_for_each_entry_continue_reverse(pos, head, member) \ argument
821 !list_entry_is_head(pos, head, member); \
827 * @head: the head for your list.
832 #define list_for_each_entry_from(pos, head, member) \ argument
833 for (; !list_entry_is_head(pos, head, member); \
840 * @head: the head for your list.
845 #define list_for_each_entry_from_reverse(pos, head, member) \ argument
846 for (; !list_entry_is_head(pos, head, member); \
853 * @head: the head for your list.
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); \
866 * @head: the head for your list.
872 #define list_for_each_entry_safe_continue(pos, n, head, member) \ argument
875 !list_entry_is_head(pos, head, member); \
882 * @head: the head for your list.
888 #define list_for_each_entry_safe_from(pos, n, head, member) \ argument
890 !list_entry_is_head(pos, head, member); \
897 * @head: the head for your list.
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); \
925 * Double linked lists with a single pointer list head.
926 * Mostly useful for hash tables where the two pointer list head is
1016 * @h: hlist head to add it after
1018 * Insert a new entry after the specified head.
1088 * Check whether the node is the only node of the head without
1089 * accessing head, thus avoiding unnecessary cache misses.
1102 * Move a list from one list head to another. Fixup the pprev
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; }); \
1151 * @head: the head for your list.
1154 #define hlist_for_each_entry(pos, head, member) \ argument
1155 for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
1182 * @head: the head for your list.
1185 #define hlist_for_each_entry_safe(pos, n, head, member) \ argument
1186 for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\
1192 * @head: the head for your hlist.
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()