Lines Matching refs: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()
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()
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()
227 struct list_head *head) in list_move_tail() argument
230 list_add_tail(list, head); in list_move_tail()
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()
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()
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()
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()
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()
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()
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()
354 struct list_head *head) in list_rotate_to_front() argument
361 list_move_tail(head, list); in list_rotate_to_front()
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()
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()
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()
462 struct list_head *head) in list_splice() argument
465 __list_splice(list, head, head->next); in list_splice()
474 struct list_head *head) in list_splice_tail() argument
477 __list_splice(list, head->prev, head); in list_splice_tail()
488 struct list_head *head) in list_splice_init() argument
491 __list_splice(list, head, head->next); in list_splice_init()
505 struct list_head *head) in list_splice_tail_init() argument
508 __list_splice(list, head->prev, head); in list_splice_tail_init()
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))
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))
605 #define list_for_each(pos, head) \ argument
606 for (pos = (head)->next; !list_is_head(pos, (head)); pos = pos->next)
613 #define list_for_each_rcu(pos, head) \ argument
614 for (pos = rcu_dereference((head)->next); \
615 !list_is_head(pos, (head)); \
625 #define list_for_each_continue(pos, head) \ argument
626 for (pos = pos->next; !list_is_head(pos, (head)); pos = pos->next)
633 #define list_for_each_prev(pos, head) \ argument
634 for (pos = (head)->prev; !list_is_head(pos, (head)); pos = pos->prev)
642 #define list_for_each_safe(pos, n, head) \ argument
643 for (pos = (head)->next, n = pos->next; \
644 !list_is_head(pos, (head)); \
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)); \
664 #define list_entry_is_head(pos, head, member) \ argument
665 (&pos->member == (head))
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); \
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); \
697 #define list_prepare_entry(pos, head, member) \ argument
698 ((pos) ? : list_entry(head, typeof(*pos), member))
709 #define list_for_each_entry_continue(pos, head, member) \ argument
711 !list_entry_is_head(pos, head, member); \
723 #define list_for_each_entry_continue_reverse(pos, head, member) \ argument
725 !list_entry_is_head(pos, head, member); \
736 #define list_for_each_entry_from(pos, head, member) \ argument
737 for (; !list_entry_is_head(pos, head, member); \
749 #define list_for_each_entry_from_reverse(pos, head, member) \ argument
750 for (; !list_entry_is_head(pos, head, member); \
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); \
776 #define list_for_each_entry_safe_continue(pos, n, head, member) \ argument
779 !list_entry_is_head(pos, head, member); \
792 #define list_for_each_entry_safe_from(pos, n, head, member) \ argument
794 !list_entry_is_head(pos, head, member); \
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); \
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; }); \
1038 #define hlist_for_each_entry(pos, head, member) \ argument
1039 for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
1069 #define hlist_for_each_entry_safe(pos, n, head, member) \ argument
1070 for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\