Lines Matching refs:head

55  * @head: list head to add it after
57 * Insert a new entry after the specified head.
60 static inline void list_add(struct list_head *new, struct list_head *head)
62 __list_add(new, head, head->next);
69 * @head: list head to add it before
71 * Insert a new entry before the specified head.
74 static inline void list_add_tail(struct list_head *new, struct list_head *head)
76 __list_add(new, head->prev, head);
149 * list_move - delete from one list and add as another's head
151 * @head: the head that will precede our entry
153 static inline void list_move(struct list_head *list, struct list_head *head)
156 list_add(list, head);
162 * @head: the head that will follow our entry
165 struct list_head *head)
168 list_add_tail(list, head);
172 * list_is_last - tests whether @list is the last entry in list @head
174 * @head: the head of the list
177 const struct list_head *head)
179 return list->next == head;
184 * @head: the list to test.
186 static inline int list_empty(const struct list_head *head)
188 return head->next == head;
193 * @head: the list to test
204 static inline int list_empty_careful(const struct list_head *head)
206 struct list_head *next = head->next;
207 return (next == head) && (next == head->prev);
212 * @head: the head of the list
214 static inline void list_rotate_left(struct list_head *head)
218 if (!list_empty(head)) {
219 first = head->next;
220 list_move_tail(first, head);
226 * @head: the list to test.
228 static inline int list_is_singular(const struct list_head *head)
230 return !list_empty(head) && (head->next == head->prev);
234 struct list_head *head, struct list_head *entry)
237 list->next = head->next;
241 head->next = new_first;
242 new_first->prev = head;
248 * @head: a list with entries
249 * @entry: an entry within head, could be the head itself
252 * This helper moves the initial part of @head, up to and
253 * including @entry, from @head to @list. You should
254 * pass on @entry an element you know is on @head. @list
260 struct list_head *head, struct list_head *entry)
262 if (list_empty(head))
264 if (list_is_singular(head) &&
265 (head->next != entry && head != entry))
267 if (entry == head)
270 __list_cut_position(list, head, entry);
290 * @head: the place to add it in the first list.
293 struct list_head *head)
296 __list_splice(list, head, head->next);
302 * @head: the place to add it in the first list.
305 struct list_head *head)
308 __list_splice(list, head->prev, head);
314 * @head: the place to add it in the first list.
319 struct list_head *head)
322 __list_splice(list, head, head->next);
330 * @head: the place to add it in the first list.
336 struct list_head *head)
339 __list_splice(list, head->prev, head);
355 * @ptr: the list head to take the element from.
366 * @ptr: the list head to take the element from.
378 * @head: the head for your list.
380 #define list_for_each(pos, head) \
381 for (pos = (head)->next; pos != (head); pos = pos->next)
386 * @head: the head for your list.
388 #define list_for_each_prev(pos, head) \
389 for (pos = (head)->prev; pos != (head); pos = pos->prev)
395 * @head: the head for your list.
397 #define list_for_each_safe(pos, n, head) \
398 for (pos = (head)->next, n = pos->next; pos != (head); \
405 * @head: the head for your list.
407 #define list_for_each_prev_safe(pos, n, head) \
408 for (pos = (head)->prev, n = pos->prev; \
409 pos != (head); \
415 * @head: the head for your list.
418 #define list_for_each_entry(pos, head, member) \
419 for (pos = list_entry((head)->next, typeof(*pos), member); \
420 &pos->member != (head); \
426 * @head: the head for your list.
429 #define list_for_each_entry_reverse(pos, head, member) \
430 for (pos = list_entry((head)->prev, typeof(*pos), member); \
431 &pos->member != (head); \
437 * @head: the head of the list
442 #define list_prepare_entry(pos, head, member) \
443 ((pos) ? : list_entry(head, typeof(*pos), member))
448 * @head: the head for your list.
454 #define list_for_each_entry_continue(pos, head, member) \
456 &pos->member != (head); \
462 * @head: the head for your list.
468 #define list_for_each_entry_continue_reverse(pos, head, member) \
470 &pos->member != (head); \
476 * @head: the head for your list.
481 #define list_for_each_entry_from(pos, head, member) \
482 for (; &pos->member != (head); \
489 * @head: the head for your list.
492 #define list_for_each_entry_safe(pos, n, head, member) \
493 for (pos = list_entry((head)->next, typeof(*pos), member), \
495 &pos->member != (head); \
502 * @head: the head for your list.
508 #define list_for_each_entry_safe_continue(pos, n, head, member) \
511 &pos->member != (head); \
518 * @head: the head for your list.
524 #define list_for_each_entry_safe_from(pos, n, head, member) \
526 &pos->member != (head); \
533 * @head: the head for your list.
539 #define list_for_each_entry_safe_reverse(pos, n, head, member) \
540 for (pos = list_entry((head)->prev, typeof(*pos), member), \
542 &pos->member != (head); \
561 * Double linked lists with a single pointer list head.
562 * Mostly useful for hash tables where the two pointer list head is
648 * Move a list from one list head to another. Fixup the pprev
662 #define hlist_for_each(pos, head) \
663 for (pos = (head)->first; pos ; pos = pos->next)
665 #define hlist_for_each_safe(pos, n, head) \
666 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
677 * @head: the head for your list.
680 #define hlist_for_each_entry(pos, head, member) \
681 for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
708 * @head: the head for your list.
711 #define hlist_for_each_entry_safe(pos, n, head, member) \
712 for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\