Lines Matching +full:entry +full:- +full:name

1 /* SPDX-License-Identifier: GPL-2.0 */
13 * container_of - cast a member of a structure out to the containing structure
16 * @member: the name of the member within the struct.
21 _Static_assert(__same_type(*(ptr), ((type *)0)->member) || \
24 ((type *)(__mptr - offsetof(type, member))); })
36 * using the generic single-entry routines.
39 #define LIST_HEAD_INIT(name) { &(name), &(name) } argument
41 #define LIST_HEAD(name) \ argument
42 struct list_head name = LIST_HEAD_INIT(name)
45 * INIT_LIST_HEAD - Initialize a list_head structure
53 list->next = list; in INIT_LIST_HEAD()
54 list->prev = list; in INIT_LIST_HEAD()
58 * Insert a new entry between two known consecutive entries.
67 next->prev = new; in __list_add()
68 new->next = next; in __list_add()
69 new->prev = prev; in __list_add()
70 prev->next = new; in __list_add()
74 * list_add - add a new entry
75 * @new: new entry to be added
78 * Insert a new entry after the specified head.
83 __list_add(new, head, head->next); in list_add()
87 * list_add_tail - add a new entry
88 * @new: new entry to be added
91 * Insert a new entry before the specified head.
96 __list_add(new, head->prev, head); in list_add_tail()
100 * Delete a list entry by making the prev/next entries
108 next->prev = prev; in __list_del()
109 prev->next = next; in __list_del()
112 static inline void __list_del_entry(struct list_head *entry) in __list_del_entry() argument
114 __list_del(entry->prev, entry->next); in __list_del_entry()
118 * list_del - deletes entry from list.
119 * @entry: the element to delete from the list.
120 * Note: list_empty() on entry does not return true after this, the entry is
123 static inline void list_del(struct list_head *entry) in list_del() argument
125 __list_del_entry(entry); in list_del()
126 entry->next = LIST_POISON1; in list_del()
127 entry->prev = LIST_POISON2; in list_del()
131 * list_replace - replace old entry by new one
140 new->next = old->next; in list_replace()
141 new->next->prev = new; in list_replace()
142 new->prev = old->prev; in list_replace()
143 new->prev->next = new; in list_replace()
147 * list_replace_init - replace old entry by new one and initialize the old one
161 * list_move - delete from one list and add as another's head
162 * @list: the entry to move
163 * @head: the head that will precede our entry
172 * list_move_tail - delete from one list and add as another's tail
173 * @list: the entry to move
174 * @head: the head that will follow our entry
184 * list_is_first -- tests whether @list is the first entry in list @head
185 * @list: the entry to test
190 return list->prev == head; in list_is_first()
194 * list_is_last - tests whether @list is the last entry in list @head
195 * @list: the entry to test
200 return list->next == head; in list_is_last()
204 * list_is_head - tests whether @list is the list @head
205 * @list: the entry to test
214 * list_empty - tests whether a list is empty
219 return head->next == head; in list_empty()
223 * list_entry - get the struct for this entry
226 * @member: the name of the list_head within the struct.
232 * list_first_entry - get the first element from a list
235 * @member: the name of the list_head within the struct.
240 list_entry((ptr)->next, type, member)
243 * list_last_entry - get the last element from a list
246 * @member: the name of the list_head within the struct.
251 list_entry((ptr)->prev, type, member)
254 * list_next_entry - get the next element in list
256 * @member: the name of the list_head within the struct.
259 list_entry((pos)->member.next, typeof(*(pos)), member)
262 * list_prev_entry - get the prev element in list
264 * @member: the name of the list_head within the struct.
267 list_entry((pos)->member.prev, typeof(*(pos)), member)
270 * list_entry_is_head - test if the entry points to the head of the list
273 * @member: the name of the list_head within the struct.
276 (&pos->member == (head))
279 * list_for_each_entry - iterate over list of given type
282 * @member: the name of the list_head within the struct.
290 * list_for_each_entry_reverse - iterate backwards over list of given type.
293 * @member: the name of the list_head within the struct.
301 * list_for_each_entry_safe - iterate over list of given type. Safe against removal of list entry
305 * @member: the name of the list_head within the struct.
321 #define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL)
324 h->next = NULL; in INIT_HLIST_NODE()
325 h->pprev = NULL; in INIT_HLIST_NODE()
329 * hlist_unhashed - Has node been removed from list and reinitialized?
338 return !h->pprev; in hlist_unhashed()
343 struct hlist_node *next = n->next; in __hlist_del()
344 struct hlist_node **pprev = n->pprev; in __hlist_del()
348 next->pprev = pprev; in __hlist_del()
352 * hlist_del - Delete the specified hlist_node from its list
361 n->next = LIST_POISON1; in hlist_del()
362 n->pprev = LIST_POISON2; in hlist_del()
366 * hlist_del_init - Delete the specified hlist_node from its list and initialize
380 * hlist_add_head - add a new entry at the beginning of the hlist
381 * @n: new entry to be added
384 * Insert a new entry after the specified head.
389 struct hlist_node *first = h->first; in hlist_add_head()
391 n->next = first; in hlist_add_head()
393 first->pprev = &n->next; in hlist_add_head()
394 h->first = n; in hlist_add_head()
395 n->pprev = &h->first; in hlist_add_head()
406 * hlist_for_each_entry - iterate over list of given type
409 * @member: the name of the hlist_node within the struct.
412 for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
414 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
417 * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
421 * @member: the name of the hlist_node within the struct.
424 for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\
425 pos && ({ n = pos->member.next; 1; }); \