Lines Matching full:head
79 * @head: list head to add it after
81 * Insert a new entry after the specified head.
84 static inline void list_add(struct list_head *new, struct list_head *head) in list_add() argument
86 __list_add(new, head, head->next); in list_add()
93 * @head: list head to add it before
95 * Insert a new entry before the specified head.
98 static inline void list_add_tail(struct list_head *new, struct list_head *head) in list_add_tail() argument
100 __list_add(new, head->prev, head); in list_add_tail()
209 * list_move - delete from one list and add as another's head
211 * @head: the head that will precede our entry
213 static inline void list_move(struct list_head *list, struct list_head *head) in list_move() argument
216 list_add(list, head); in list_move()
222 * @head: the head that will follow our entry
225 struct list_head *head) in list_move_tail() argument
228 list_add_tail(list, head); in list_move_tail()
233 * @head: the head that will follow our entry
237 * Move all entries between @first and including @last before @head.
240 static inline void list_bulk_move_tail(struct list_head *head, in list_bulk_move_tail() argument
247 head->prev->next = first; in list_bulk_move_tail()
248 first->prev = head->prev; in list_bulk_move_tail()
250 last->next = head; in list_bulk_move_tail()
251 head->prev = last; in list_bulk_move_tail()
255 * list_is_first -- tests whether @list is the first entry in list @head
257 * @head: the head of the list
260 const struct list_head *head) in list_is_first() argument
262 return list->prev == head; in list_is_first()
266 * list_is_last - tests whether @list is the last entry in list @head
268 * @head: the head of the list
271 const struct list_head *head) in list_is_last() argument
273 return list->next == head; in list_is_last()
278 * @head: the list to test.
280 static inline int list_empty(const struct list_head *head) in list_empty() argument
282 return READ_ONCE(head->next) == head; in list_empty()
305 * @head: the list to test
316 static inline int list_empty_careful(const struct list_head *head) in list_empty_careful() argument
318 struct list_head *next = smp_load_acquire(&head->next); in list_empty_careful()
319 return (next == head) && (next == head->prev); in list_empty_careful()
324 * @head: the head of the list
326 static inline void list_rotate_left(struct list_head *head) in list_rotate_left() argument
330 if (!list_empty(head)) { in list_rotate_left()
331 first = head->next; in list_rotate_left()
332 list_move_tail(first, head); in list_rotate_left()
339 * @head: The head of the list.
344 struct list_head *head) in list_rotate_to_front() argument
347 * Deletes the list head from the list denoted by @head and in list_rotate_to_front()
351 list_move_tail(head, list); in list_rotate_to_front()
356 * @head: the list to test.
358 static inline int list_is_singular(const struct list_head *head) in list_is_singular() argument
360 return !list_empty(head) && (head->next == head->prev); in list_is_singular()
364 struct list_head *head, struct list_head *entry) in __list_cut_position() argument
367 list->next = head->next; in __list_cut_position()
371 head->next = new_first; in __list_cut_position()
372 new_first->prev = head; in __list_cut_position()
378 * @head: a list with entries
379 * @entry: an entry within head, could be the head itself
382 * This helper moves the initial part of @head, up to and
383 * including @entry, from @head to @list. You should
384 * pass on @entry an element you know is on @head. @list
390 struct list_head *head, struct list_head *entry) in list_cut_position() argument
392 if (list_empty(head)) in list_cut_position()
394 if (list_is_singular(head) && in list_cut_position()
395 (head->next != entry && head != entry)) in list_cut_position()
397 if (entry == head) in list_cut_position()
400 __list_cut_position(list, head, entry); in list_cut_position()
406 * @head: a list with entries
407 * @entry: an entry within head, could be the head itself
409 * This helper moves the initial part of @head, up to but
410 * excluding @entry, from @head to @list. You should pass
411 * in @entry an element you know is on @head. @list should
414 * If @entry == @head, all entries on @head are moved to
418 struct list_head *head, in list_cut_before() argument
421 if (head->next == entry) { in list_cut_before()
425 list->next = head->next; in list_cut_before()
429 head->next = entry; in list_cut_before()
430 entry->prev = head; in list_cut_before()
450 * @head: the place to add it in the first list.
453 struct list_head *head) in list_splice() argument
456 __list_splice(list, head, head->next); in list_splice()
462 * @head: the place to add it in the first list.
465 struct list_head *head) in list_splice_tail() argument
468 __list_splice(list, head->prev, head); in list_splice_tail()
474 * @head: the place to add it in the first list.
479 struct list_head *head) in list_splice_init() argument
482 __list_splice(list, head, head->next); in list_splice_init()
490 * @head: the place to add it in the first list.
496 struct list_head *head) in list_splice_tail_init() argument
499 __list_splice(list, head->prev, head); in list_splice_tail_init()
515 * @ptr: the list head to take the element from.
526 * @ptr: the list head to take the element from.
537 * @ptr: the list head to take the element from.
568 * @head: the head for your list.
570 #define list_for_each(pos, head) \ argument
571 for (pos = (head)->next; pos != (head); pos = pos->next)
576 * @head: the head for your list.
580 #define list_for_each_continue(pos, head) \ argument
581 for (pos = pos->next; pos != (head); pos = pos->next)
586 * @head: the head for your list.
588 #define list_for_each_prev(pos, head) \ argument
589 for (pos = (head)->prev; pos != (head); pos = pos->prev)
595 * @head: the head for your list.
597 #define list_for_each_safe(pos, n, head) \ argument
598 for (pos = (head)->next, n = pos->next; pos != (head); \
605 * @head: the head for your list.
607 #define list_for_each_prev_safe(pos, n, head) \ argument
608 for (pos = (head)->prev, n = pos->prev; \
609 pos != (head); \
613 * list_entry_is_head - test if the entry points to the head of the list
615 * @head: the head for your list.
618 #define list_entry_is_head(pos, head, member) \ argument
619 (&pos->member == (head))
624 * @head: the head for your list.
627 #define list_for_each_entry(pos, head, member) \ argument
628 for (pos = list_first_entry(head, typeof(*pos), member); \
629 !list_entry_is_head(pos, head, member); \
635 * @head: the head for your list.
638 #define list_for_each_entry_reverse(pos, head, member) \ argument
639 for (pos = list_last_entry(head, typeof(*pos), member); \
640 !list_entry_is_head(pos, head, member); \
646 * @head: the head of the list
651 #define list_prepare_entry(pos, head, member) \ argument
652 ((pos) ? : list_entry(head, typeof(*pos), member))
657 * @head: the head for your list.
663 #define list_for_each_entry_continue(pos, head, member) \ argument
665 !list_entry_is_head(pos, head, member); \
671 * @head: the head for your list.
677 #define list_for_each_entry_continue_reverse(pos, head, member) \ argument
679 !list_entry_is_head(pos, head, member); \
685 * @head: the head for your list.
690 #define list_for_each_entry_from(pos, head, member) \ argument
691 for (; !list_entry_is_head(pos, head, member); \
698 * @head: the head for your list.
703 #define list_for_each_entry_from_reverse(pos, head, member) \ argument
704 for (; !list_entry_is_head(pos, head, member); \
711 * @head: the head for your list.
714 #define list_for_each_entry_safe(pos, n, head, member) \ argument
715 for (pos = list_first_entry(head, typeof(*pos), member), \
717 !list_entry_is_head(pos, head, member); \
724 * @head: the head for your list.
730 #define list_for_each_entry_safe_continue(pos, n, head, member) \ argument
733 !list_entry_is_head(pos, head, member); \
740 * @head: the head for your list.
746 #define list_for_each_entry_safe_from(pos, n, head, member) \ argument
748 !list_entry_is_head(pos, head, member); \
755 * @head: the head for your list.
761 #define list_for_each_entry_safe_reverse(pos, n, head, member) \ argument
762 for (pos = list_last_entry(head, typeof(*pos), member), \
764 !list_entry_is_head(pos, head, member); \
783 * Double linked lists with a single pointer list head.
784 * Mostly useful for hash tables where the two pointer list head is
874 * @h: hlist head to add it after
876 * Insert a new entry after the specified head.
946 * Check whether the node is the only node of the head without
947 * accessing head, thus avoiding unnecessary cache misses.
960 * Move a list from one list head to another. Fixup the pprev
974 #define hlist_for_each(pos, head) \ argument
975 for (pos = (head)->first; pos ; pos = pos->next)
977 #define hlist_for_each_safe(pos, n, head) \ argument
978 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
989 * @head: the head for your list.
992 #define hlist_for_each_entry(pos, head, member) \ argument
993 for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
1020 * @head: the head for your list.
1023 #define hlist_for_each_entry_safe(pos, n, head, member) \ argument
1024 for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\