Lines Matching full:head

81  * @head: list head to add it after
83 * Insert a new entry after the specified head.
86 static inline void list_add(struct list_head *new, struct list_head *head) in list_add() argument
88 __list_add(new, head, head->next); in list_add()
95 * @head: list head to add it before
97 * Insert a new entry before the specified head.
100 static inline void list_add_tail(struct list_head *new, struct list_head *head) in list_add_tail() argument
102 __list_add(new, head->prev, head); in list_add_tail()
211 * list_move - delete from one list and add as another's head
213 * @head: the head that will precede our entry
215 static inline void list_move(struct list_head *list, struct list_head *head) in list_move() argument
218 list_add(list, head); in list_move()
224 * @head: the head that will follow our entry
227 struct list_head *head) in list_move_tail() argument
230 list_add_tail(list, head); in list_move_tail()
235 * @head: the head that will follow our entry
239 * Move all entries between @first and including @last before @head.
242 static inline void list_bulk_move_tail(struct list_head *head, in list_bulk_move_tail() argument
249 head->prev->next = first; in list_bulk_move_tail()
250 first->prev = head->prev; in list_bulk_move_tail()
252 last->next = head; in list_bulk_move_tail()
253 head->prev = last; in list_bulk_move_tail()
257 * list_is_first -- tests whether @list is the first entry in list @head
259 * @head: the head of the list
261 static inline int list_is_first(const struct list_head *list, const struct list_head *head) in list_is_first() argument
263 return list->prev == head; in list_is_first()
267 * list_is_last - tests whether @list is the last entry in list @head
269 * @head: the head of the list
271 static inline int list_is_last(const struct list_head *list, const struct list_head *head) in list_is_last() argument
273 return list->next == head; in list_is_last()
277 * list_is_head - tests whether @list is the list @head
279 * @head: the head of the list
281 static inline int list_is_head(const struct list_head *list, const struct list_head *head) in list_is_head() argument
283 return list == head; in list_is_head()
288 * @head: the list to test.
290 static inline int list_empty(const struct list_head *head) in list_empty() argument
292 return READ_ONCE(head->next) == head; in list_empty()
315 * @head: the list to test
326 static inline int list_empty_careful(const struct list_head *head) in list_empty_careful() argument
328 struct list_head *next = smp_load_acquire(&head->next); in list_empty_careful()
329 return list_is_head(next, head) && (next == READ_ONCE(head->prev)); in list_empty_careful()
334 * @head: the head of the list
336 static inline void list_rotate_left(struct list_head *head) in list_rotate_left() argument
340 if (!list_empty(head)) { in list_rotate_left()
341 first = head->next; in list_rotate_left()
342 list_move_tail(first, head); in list_rotate_left()
349 * @head: The head of the list.
354 struct list_head *head) in list_rotate_to_front() argument
357 * Deletes the list head from the list denoted by @head and in list_rotate_to_front()
361 list_move_tail(head, list); in list_rotate_to_front()
366 * @head: the list to test.
368 static inline int list_is_singular(const struct list_head *head) in list_is_singular() argument
370 return !list_empty(head) && (head->next == head->prev); in list_is_singular()
374 struct list_head *head, struct list_head *entry) in __list_cut_position() argument
377 list->next = head->next; in __list_cut_position()
381 head->next = new_first; in __list_cut_position()
382 new_first->prev = head; in __list_cut_position()
388 * @head: a list with entries
389 * @entry: an entry within head, could be the head itself
392 * This helper moves the initial part of @head, up to and
393 * including @entry, from @head to @list. You should
394 * pass on @entry an element you know is on @head. @list
400 struct list_head *head, struct list_head *entry) in list_cut_position() argument
402 if (list_empty(head)) in list_cut_position()
404 if (list_is_singular(head) && !list_is_head(entry, head) && (entry != head->next)) in list_cut_position()
406 if (list_is_head(entry, head)) in list_cut_position()
409 __list_cut_position(list, head, entry); in list_cut_position()
415 * @head: a list with entries
416 * @entry: an entry within head, could be the head itself
418 * This helper moves the initial part of @head, up to but
419 * excluding @entry, from @head to @list. You should pass
420 * in @entry an element you know is on @head. @list should
423 * If @entry == @head, all entries on @head are moved to
427 struct list_head *head, in list_cut_before() argument
430 if (head->next == entry) { in list_cut_before()
434 list->next = head->next; in list_cut_before()
438 head->next = entry; in list_cut_before()
439 entry->prev = head; in list_cut_before()
459 * @head: the place to add it in the first list.
462 struct list_head *head) in list_splice() argument
465 __list_splice(list, head, head->next); in list_splice()
471 * @head: the place to add it in the first list.
474 struct list_head *head) in list_splice_tail() argument
477 __list_splice(list, head->prev, head); in list_splice_tail()
483 * @head: the place to add it in the first list.
488 struct list_head *head) in list_splice_init() argument
491 __list_splice(list, head, head->next); in list_splice_init()
499 * @head: the place to add it in the first list.
505 struct list_head *head) in list_splice_tail_init() argument
508 __list_splice(list, head->prev, head); in list_splice_tail_init()
524 * @ptr: the list head to take the element from.
535 * @ptr: the list head to take the element from.
546 * @ptr: the list head to take the element from.
569 * @head: the list head to take the element from.
575 #define list_next_entry_circular(pos, head, member) \ argument
576 (list_is_last(&(pos)->member, head) ? \
577 list_first_entry(head, typeof(*(pos)), member) : list_next_entry(pos, member))
590 * @head: the list head to take the element from.
596 #define list_prev_entry_circular(pos, head, member) \ argument
597 (list_is_first(&(pos)->member, head) ? \
598 list_last_entry(head, typeof(*(pos)), member) : list_prev_entry(pos, member))
603 * @head: the head for your list.
605 #define list_for_each(pos, head) \ argument
606 for (pos = (head)->next; !list_is_head(pos, (head)); pos = pos->next)
611 * @head: the head for your list.
613 #define list_for_each_rcu(pos, head) \ argument
614 for (pos = rcu_dereference((head)->next); \
615 !list_is_head(pos, (head)); \
621 * @head: the head for your list.
625 #define list_for_each_continue(pos, head) \ argument
626 for (pos = pos->next; !list_is_head(pos, (head)); pos = pos->next)
631 * @head: the head for your list.
633 #define list_for_each_prev(pos, head) \ argument
634 for (pos = (head)->prev; !list_is_head(pos, (head)); pos = pos->prev)
640 * @head: the head for your list.
642 #define list_for_each_safe(pos, n, head) \ argument
643 for (pos = (head)->next, n = pos->next; \
644 !list_is_head(pos, (head)); \
651 * @head: the head for your list.
653 #define list_for_each_prev_safe(pos, n, head) \ argument
654 for (pos = (head)->prev, n = pos->prev; \
655 !list_is_head(pos, (head)); \
659 * list_entry_is_head - test if the entry points to the head of the list
661 * @head: the head for your list.
664 #define list_entry_is_head(pos, head, member) \ argument
665 (&pos->member == (head))
670 * @head: the head for your list.
673 #define list_for_each_entry(pos, head, member) \ argument
674 for (pos = list_first_entry(head, typeof(*pos), member); \
675 !list_entry_is_head(pos, head, member); \
681 * @head: the head for your list.
684 #define list_for_each_entry_reverse(pos, head, member) \ argument
685 for (pos = list_last_entry(head, typeof(*pos), member); \
686 !list_entry_is_head(pos, head, member); \
692 * @head: the head of the list
697 #define list_prepare_entry(pos, head, member) \ argument
698 ((pos) ? : list_entry(head, typeof(*pos), member))
703 * @head: the head for your list.
709 #define list_for_each_entry_continue(pos, head, member) \ argument
711 !list_entry_is_head(pos, head, member); \
717 * @head: the head for your list.
723 #define list_for_each_entry_continue_reverse(pos, head, member) \ argument
725 !list_entry_is_head(pos, head, member); \
731 * @head: the head for your list.
736 #define list_for_each_entry_from(pos, head, member) \ argument
737 for (; !list_entry_is_head(pos, head, member); \
744 * @head: the head for your list.
749 #define list_for_each_entry_from_reverse(pos, head, member) \ argument
750 for (; !list_entry_is_head(pos, head, member); \
757 * @head: the head for your list.
760 #define list_for_each_entry_safe(pos, n, head, member) \ argument
761 for (pos = list_first_entry(head, typeof(*pos), member), \
763 !list_entry_is_head(pos, head, member); \
770 * @head: the head for your list.
776 #define list_for_each_entry_safe_continue(pos, n, head, member) \ argument
779 !list_entry_is_head(pos, head, member); \
786 * @head: the head for your list.
792 #define list_for_each_entry_safe_from(pos, n, head, member) \ argument
794 !list_entry_is_head(pos, head, member); \
801 * @head: the head for your list.
807 #define list_for_each_entry_safe_reverse(pos, n, head, member) \ argument
808 for (pos = list_last_entry(head, typeof(*pos), member), \
810 !list_entry_is_head(pos, head, member); \
829 * Double linked lists with a single pointer list head.
830 * Mostly useful for hash tables where the two pointer list head is
920 * @h: hlist head to add it after
922 * Insert a new entry after the specified head.
992 * Check whether the node is the only node of the head without
993 * accessing head, thus avoiding unnecessary cache misses.
1006 * Move a list from one list head to another. Fixup the pprev
1020 #define hlist_for_each(pos, head) \ argument
1021 for (pos = (head)->first; pos ; pos = pos->next)
1023 #define hlist_for_each_safe(pos, n, head) \ argument
1024 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
1035 * @head: the head for your list.
1038 #define hlist_for_each_entry(pos, head, member) \ argument
1039 for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
1066 * @head: the head for your list.
1069 #define hlist_for_each_entry_safe(pos, n, head, member) \ argument
1070 for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\