Lines Matching full:list
12 * Simple doubly linked list implementation.
28 * @list: list_head structure to be initialized.
30 * Initializes the list_head to point to itself. If it is a list header,
31 * the result is an empty list.
33 static inline void INIT_LIST_HEAD(struct list_head *list) in INIT_LIST_HEAD() argument
35 WRITE_ONCE(list->next, list); in INIT_LIST_HEAD()
36 list->prev = list; in INIT_LIST_HEAD()
60 * This is only for internal list manipulation where we know
79 * @head: list head to add it after
93 * @head: list head to add it before
104 * Delete a list entry by making the prev/next entries
107 * This is only for internal list manipulation where we know
117 * Delete a list entry and clear the 'prev' pointer.
119 * This is a special-purpose list clearing method used in the networking code
139 * list_del - deletes entry from list.
140 * @entry: the element to delete from the list.
199 * list_del_init - deletes entry from list and reinitialize it.
200 * @entry: the element to delete from the list.
209 * list_move - delete from one list and add as another's head
210 * @list: the entry to move
213 static inline void list_move(struct list_head *list, struct list_head *head) in list_move() argument
215 __list_del_entry(list); in list_move()
216 list_add(list, head); in list_move()
220 * list_move_tail - delete from one list and add as another's tail
221 * @list: the entry to move
224 static inline void list_move_tail(struct list_head *list, in list_move_tail() argument
227 __list_del_entry(list); in list_move_tail()
228 list_add_tail(list, head); in list_move_tail()
232 * list_bulk_move_tail - move a subsection of a list to its tail
238 * All three entries must belong to the same linked list.
255 * list_is_first -- tests whether @list is the first entry in list @head
256 * @list: the entry to test
257 * @head: the head of the list
259 static inline int list_is_first(const struct list_head *list, 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
267 * @list: the entry to test
268 * @head: the head of the list
270 static inline int list_is_last(const struct list_head *list, in list_is_last() argument
273 return list->next == head; in list_is_last()
277 * list_empty - tests whether a list is empty
278 * @head: the list to test.
286 * list_del_init_careful - deletes entry from list and reinitialize it.
287 * @entry: the element to delete from the list.
304 * list_empty_careful - tests whether a list is empty and not being modified
305 * @head: the list to test
308 * tests whether a list is empty _and_ checks that no other CPU might be
313 * to the list entry is list_del_init(). Eg. it cannot be used
323 * list_rotate_left - rotate the list to the left
324 * @head: the head of the list
337 * list_rotate_to_front() - Rotate list to specific item.
338 * @list: The desired new front of the list.
339 * @head: The head of the list.
341 * Rotates list so that @list becomes the new front of the list.
343 static inline void list_rotate_to_front(struct list_head *list, in list_rotate_to_front() argument
347 * Deletes the list head from the list denoted by @head and in list_rotate_to_front()
348 * places it as the tail of @list, this effectively rotates the in list_rotate_to_front()
349 * list so that @list is at the front. in list_rotate_to_front()
351 list_move_tail(head, list); in list_rotate_to_front()
355 * list_is_singular - tests whether a list has just one entry.
356 * @head: the list to test.
363 static inline void __list_cut_position(struct list_head *list, in __list_cut_position() argument
367 list->next = head->next; in __list_cut_position()
368 list->next->prev = list; in __list_cut_position()
369 list->prev = entry; in __list_cut_position()
370 entry->next = list; in __list_cut_position()
376 * list_cut_position - cut a list into two
377 * @list: a new list to add all removed entries
378 * @head: a list with entries
380 * and if so we won't cut the list
383 * including @entry, from @head to @list. You should
384 * pass on @entry an element you know is on @head. @list
385 * should be an empty list or a list you do not care about
389 static inline void list_cut_position(struct list_head *list, in list_cut_position() argument
398 INIT_LIST_HEAD(list); in list_cut_position()
400 __list_cut_position(list, head, entry); in list_cut_position()
404 * list_cut_before - cut a list into two, before given entry
405 * @list: a new list to add all removed entries
406 * @head: a list with entries
410 * excluding @entry, from @head to @list. You should pass
411 * in @entry an element you know is on @head. @list should
412 * be an empty list or a list you do not care about losing
415 * @list.
417 static inline void list_cut_before(struct list_head *list, in list_cut_before() argument
422 INIT_LIST_HEAD(list); in list_cut_before()
425 list->next = head->next; in list_cut_before()
426 list->next->prev = list; in list_cut_before()
427 list->prev = entry->prev; in list_cut_before()
428 list->prev->next = list; in list_cut_before()
433 static inline void __list_splice(const struct list_head *list, in __list_splice() argument
437 struct list_head *first = list->next; in __list_splice()
438 struct list_head *last = list->prev; in __list_splice()
449 * @list: the new list to add.
450 * @head: the place to add it in the first list.
452 static inline void list_splice(const struct list_head *list, in list_splice() argument
455 if (!list_empty(list)) in list_splice()
456 __list_splice(list, head, head->next); in list_splice()
460 * list_splice_tail - join two lists, each list being a queue
461 * @list: the new list to add.
462 * @head: the place to add it in the first list.
464 static inline void list_splice_tail(struct list_head *list, in list_splice_tail() argument
467 if (!list_empty(list)) in list_splice_tail()
468 __list_splice(list, head->prev, head); in list_splice_tail()
472 * list_splice_init - join two lists and reinitialise the emptied list.
473 * @list: the new list to add.
474 * @head: the place to add it in the first list.
476 * The list at @list is reinitialised
478 static inline void list_splice_init(struct list_head *list, in list_splice_init() argument
481 if (!list_empty(list)) { in list_splice_init()
482 __list_splice(list, head, head->next); in list_splice_init()
483 INIT_LIST_HEAD(list); in list_splice_init()
488 * list_splice_tail_init - join two lists and reinitialise the emptied list
489 * @list: the new list to add.
490 * @head: the place to add it in the first list.
493 * The list at @list is reinitialised
495 static inline void list_splice_tail_init(struct list_head *list, in list_splice_tail_init() argument
498 if (!list_empty(list)) { in list_splice_tail_init()
499 __list_splice(list, head->prev, head); in list_splice_tail_init()
500 INIT_LIST_HEAD(list); in list_splice_tail_init()
514 * list_first_entry - get the first element from a list
515 * @ptr: the list head to take the element from.
519 * Note, that list is expected to be not empty.
525 * list_last_entry - get the last element from a list
526 * @ptr: the list head to take the element from.
530 * Note, that list is expected to be not empty.
536 * list_first_entry_or_null - get the first element from a list
537 * @ptr: the list head to take the element from.
541 * Note that if the list is empty, it returns NULL.
550 * list_next_entry - get the next element in list
558 * list_prev_entry - get the prev element in list
566 * list_for_each - iterate over a list
568 * @head: the head for your list.
574 * list_for_each_continue - continue iteration over a list
576 * @head: the head for your list.
578 * Continue to iterate over a list, continuing after the current position.
584 * list_for_each_prev - iterate over a list backwards
586 * @head: the head for your list.
592 * list_for_each_safe - iterate over a list safe against removal of list entry
595 * @head: the head for your list.
602 * list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry
605 * @head: the head for your list.
613 * list_entry_is_head - test if the entry points to the head of the list
615 * @head: the head for your list.
622 * list_for_each_entry - iterate over list of given type
624 * @head: the head for your list.
633 * list_for_each_entry_reverse - iterate backwards over list of given type.
635 * @head: the head for your list.
646 * @head: the head of the list
655 * list_for_each_entry_continue - continue iteration over list of given type
657 * @head: the head for your list.
660 * Continue to iterate over list of given type, continuing after
671 * @head: the head for your list.
674 * Start to iterate over list of given type backwards, continuing after
683 * list_for_each_entry_from - iterate over list of given type from the current point
685 * @head: the head for your list.
688 * Iterate over list of given type, continuing from current position.
695 * list_for_each_entry_from_reverse - iterate backwards over list of given type
698 * @head: the head for your list.
701 * Iterate backwards over list of given type, continuing from current position.
708 * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
711 * @head: the head for your list.
721 * list_for_each_entry_safe_continue - continue list iteration safe against removal
724 * @head: the head for your list.
727 * Iterate over list of given type, continuing after current point,
728 * safe against removal of list entry.
737 * list_for_each_entry_safe_from - iterate over list from current point safe against removal
740 * @head: the head for your list.
743 * Iterate over list of given type from current point, safe against
744 * removal of list entry.
752 * list_for_each_entry_safe_reverse - iterate backwards over list safe against removal
755 * @head: the head for your list.
758 * Iterate backwards over list of given type, safe against removal
759 * of list entry.
773 * list_safe_reset_next is not safe to use in general if the list may be
775 * exception to this is if the cursor element (pos) is pinned in the list,
783 * Double linked lists with a single pointer list head.
784 * Mostly useful for hash tables where the two pointer list head is
799 * hlist_unhashed - Has node been removed from list and reinitialized?
844 * hlist_del - Delete the specified hlist_node from its list
858 * hlist_del_init - Delete the specified hlist_node from its list and initialize
921 * @n: Node to make a fake list out of
925 * in cases where there is no list.
944 * @h: Header for potentially singular list.
957 * @old: hlist_head for old list.
958 * @new: hlist_head for new list.
960 * Move a list from one list head to another. Fixup the pprev
987 * hlist_for_each_entry - iterate over list of given type
989 * @head: the head for your list.
1017 * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
1020 * @head: the head for your list.