]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - include/linux/list.h
list: Split list_add() debug checking into separate function
[mirror_ubuntu-artful-kernel.git] / include / linux / list.h
1 #ifndef _LINUX_LIST_H
2 #define _LINUX_LIST_H
3
4 #include <linux/types.h>
5 #include <linux/stddef.h>
6 #include <linux/poison.h>
7 #include <linux/const.h>
8 #include <linux/kernel.h>
9
10 /*
11 * Simple doubly linked list implementation.
12 *
13 * Some of the internal functions ("__xxx") are useful when
14 * manipulating whole lists rather than single entries, as
15 * sometimes we already know the next/prev entries and we can
16 * generate better code by using them directly rather than
17 * using the generic single-entry routines.
18 */
19
20 #define LIST_HEAD_INIT(name) { &(name), &(name) }
21
22 #define LIST_HEAD(name) \
23 struct list_head name = LIST_HEAD_INIT(name)
24
25 static inline void INIT_LIST_HEAD(struct list_head *list)
26 {
27 WRITE_ONCE(list->next, list);
28 list->prev = list;
29 }
30
31 #ifdef CONFIG_DEBUG_LIST
32 extern bool __list_add_valid(struct list_head *new,
33 struct list_head *prev,
34 struct list_head *next);
35 #else
36 static inline bool __list_add_valid(struct list_head *new,
37 struct list_head *prev,
38 struct list_head *next)
39 {
40 return true;
41 }
42 #endif
43
44 /*
45 * Insert a new entry between two known consecutive entries.
46 *
47 * This is only for internal list manipulation where we know
48 * the prev/next entries already!
49 */
50 static inline void __list_add(struct list_head *new,
51 struct list_head *prev,
52 struct list_head *next)
53 {
54 if (!__list_add_valid(new, prev, next))
55 return;
56
57 next->prev = new;
58 new->next = next;
59 new->prev = prev;
60 WRITE_ONCE(prev->next, new);
61 }
62
63 /**
64 * list_add - add a new entry
65 * @new: new entry to be added
66 * @head: list head to add it after
67 *
68 * Insert a new entry after the specified head.
69 * This is good for implementing stacks.
70 */
71 static inline void list_add(struct list_head *new, struct list_head *head)
72 {
73 __list_add(new, head, head->next);
74 }
75
76
77 /**
78 * list_add_tail - add a new entry
79 * @new: new entry to be added
80 * @head: list head to add it before
81 *
82 * Insert a new entry before the specified head.
83 * This is useful for implementing queues.
84 */
85 static inline void list_add_tail(struct list_head *new, struct list_head *head)
86 {
87 __list_add(new, head->prev, head);
88 }
89
90 /*
91 * Delete a list entry by making the prev/next entries
92 * point to each other.
93 *
94 * This is only for internal list manipulation where we know
95 * the prev/next entries already!
96 */
97 static inline void __list_del(struct list_head * prev, struct list_head * next)
98 {
99 next->prev = prev;
100 WRITE_ONCE(prev->next, next);
101 }
102
103 /**
104 * list_del - deletes entry from list.
105 * @entry: the element to delete from the list.
106 * Note: list_empty() on entry does not return true after this, the entry is
107 * in an undefined state.
108 */
109 #ifndef CONFIG_DEBUG_LIST
110 static inline void __list_del_entry(struct list_head *entry)
111 {
112 __list_del(entry->prev, entry->next);
113 }
114
115 static inline void list_del(struct list_head *entry)
116 {
117 __list_del(entry->prev, entry->next);
118 entry->next = LIST_POISON1;
119 entry->prev = LIST_POISON2;
120 }
121 #else
122 extern void __list_del_entry(struct list_head *entry);
123 extern void list_del(struct list_head *entry);
124 #endif
125
126 /**
127 * list_replace - replace old entry by new one
128 * @old : the element to be replaced
129 * @new : the new element to insert
130 *
131 * If @old was empty, it will be overwritten.
132 */
133 static inline void list_replace(struct list_head *old,
134 struct list_head *new)
135 {
136 new->next = old->next;
137 new->next->prev = new;
138 new->prev = old->prev;
139 new->prev->next = new;
140 }
141
142 static inline void list_replace_init(struct list_head *old,
143 struct list_head *new)
144 {
145 list_replace(old, new);
146 INIT_LIST_HEAD(old);
147 }
148
149 /**
150 * list_del_init - deletes entry from list and reinitialize it.
151 * @entry: the element to delete from the list.
152 */
153 static inline void list_del_init(struct list_head *entry)
154 {
155 __list_del_entry(entry);
156 INIT_LIST_HEAD(entry);
157 }
158
159 /**
160 * list_move - delete from one list and add as another's head
161 * @list: the entry to move
162 * @head: the head that will precede our entry
163 */
164 static inline void list_move(struct list_head *list, struct list_head *head)
165 {
166 __list_del_entry(list);
167 list_add(list, head);
168 }
169
170 /**
171 * list_move_tail - delete from one list and add as another's tail
172 * @list: the entry to move
173 * @head: the head that will follow our entry
174 */
175 static inline void list_move_tail(struct list_head *list,
176 struct list_head *head)
177 {
178 __list_del_entry(list);
179 list_add_tail(list, head);
180 }
181
182 /**
183 * list_is_last - tests whether @list is the last entry in list @head
184 * @list: the entry to test
185 * @head: the head of the list
186 */
187 static inline int list_is_last(const struct list_head *list,
188 const struct list_head *head)
189 {
190 return list->next == head;
191 }
192
193 /**
194 * list_empty - tests whether a list is empty
195 * @head: the list to test.
196 */
197 static inline int list_empty(const struct list_head *head)
198 {
199 return READ_ONCE(head->next) == head;
200 }
201
202 /**
203 * list_empty_careful - tests whether a list is empty and not being modified
204 * @head: the list to test
205 *
206 * Description:
207 * tests whether a list is empty _and_ checks that no other CPU might be
208 * in the process of modifying either member (next or prev)
209 *
210 * NOTE: using list_empty_careful() without synchronization
211 * can only be safe if the only activity that can happen
212 * to the list entry is list_del_init(). Eg. it cannot be used
213 * if another CPU could re-list_add() it.
214 */
215 static inline int list_empty_careful(const struct list_head *head)
216 {
217 struct list_head *next = head->next;
218 return (next == head) && (next == head->prev);
219 }
220
221 /**
222 * list_rotate_left - rotate the list to the left
223 * @head: the head of the list
224 */
225 static inline void list_rotate_left(struct list_head *head)
226 {
227 struct list_head *first;
228
229 if (!list_empty(head)) {
230 first = head->next;
231 list_move_tail(first, head);
232 }
233 }
234
235 /**
236 * list_is_singular - tests whether a list has just one entry.
237 * @head: the list to test.
238 */
239 static inline int list_is_singular(const struct list_head *head)
240 {
241 return !list_empty(head) && (head->next == head->prev);
242 }
243
244 static inline void __list_cut_position(struct list_head *list,
245 struct list_head *head, struct list_head *entry)
246 {
247 struct list_head *new_first = entry->next;
248 list->next = head->next;
249 list->next->prev = list;
250 list->prev = entry;
251 entry->next = list;
252 head->next = new_first;
253 new_first->prev = head;
254 }
255
256 /**
257 * list_cut_position - cut a list into two
258 * @list: a new list to add all removed entries
259 * @head: a list with entries
260 * @entry: an entry within head, could be the head itself
261 * and if so we won't cut the list
262 *
263 * This helper moves the initial part of @head, up to and
264 * including @entry, from @head to @list. You should
265 * pass on @entry an element you know is on @head. @list
266 * should be an empty list or a list you do not care about
267 * losing its data.
268 *
269 */
270 static inline void list_cut_position(struct list_head *list,
271 struct list_head *head, struct list_head *entry)
272 {
273 if (list_empty(head))
274 return;
275 if (list_is_singular(head) &&
276 (head->next != entry && head != entry))
277 return;
278 if (entry == head)
279 INIT_LIST_HEAD(list);
280 else
281 __list_cut_position(list, head, entry);
282 }
283
284 static inline void __list_splice(const struct list_head *list,
285 struct list_head *prev,
286 struct list_head *next)
287 {
288 struct list_head *first = list->next;
289 struct list_head *last = list->prev;
290
291 first->prev = prev;
292 prev->next = first;
293
294 last->next = next;
295 next->prev = last;
296 }
297
298 /**
299 * list_splice - join two lists, this is designed for stacks
300 * @list: the new list to add.
301 * @head: the place to add it in the first list.
302 */
303 static inline void list_splice(const struct list_head *list,
304 struct list_head *head)
305 {
306 if (!list_empty(list))
307 __list_splice(list, head, head->next);
308 }
309
310 /**
311 * list_splice_tail - join two lists, each list being a queue
312 * @list: the new list to add.
313 * @head: the place to add it in the first list.
314 */
315 static inline void list_splice_tail(struct list_head *list,
316 struct list_head *head)
317 {
318 if (!list_empty(list))
319 __list_splice(list, head->prev, head);
320 }
321
322 /**
323 * list_splice_init - join two lists and reinitialise the emptied list.
324 * @list: the new list to add.
325 * @head: the place to add it in the first list.
326 *
327 * The list at @list is reinitialised
328 */
329 static inline void list_splice_init(struct list_head *list,
330 struct list_head *head)
331 {
332 if (!list_empty(list)) {
333 __list_splice(list, head, head->next);
334 INIT_LIST_HEAD(list);
335 }
336 }
337
338 /**
339 * list_splice_tail_init - join two lists and reinitialise the emptied list
340 * @list: the new list to add.
341 * @head: the place to add it in the first list.
342 *
343 * Each of the lists is a queue.
344 * The list at @list is reinitialised
345 */
346 static inline void list_splice_tail_init(struct list_head *list,
347 struct list_head *head)
348 {
349 if (!list_empty(list)) {
350 __list_splice(list, head->prev, head);
351 INIT_LIST_HEAD(list);
352 }
353 }
354
355 /**
356 * list_entry - get the struct for this entry
357 * @ptr: the &struct list_head pointer.
358 * @type: the type of the struct this is embedded in.
359 * @member: the name of the list_head within the struct.
360 */
361 #define list_entry(ptr, type, member) \
362 container_of(ptr, type, member)
363
364 /**
365 * list_first_entry - get the first element from a list
366 * @ptr: the list head to take the element from.
367 * @type: the type of the struct this is embedded in.
368 * @member: the name of the list_head within the struct.
369 *
370 * Note, that list is expected to be not empty.
371 */
372 #define list_first_entry(ptr, type, member) \
373 list_entry((ptr)->next, type, member)
374
375 /**
376 * list_last_entry - get the last element from a list
377 * @ptr: the list head to take the element from.
378 * @type: the type of the struct this is embedded in.
379 * @member: the name of the list_head within the struct.
380 *
381 * Note, that list is expected to be not empty.
382 */
383 #define list_last_entry(ptr, type, member) \
384 list_entry((ptr)->prev, type, member)
385
386 /**
387 * list_first_entry_or_null - get the first element from a list
388 * @ptr: the list head to take the element from.
389 * @type: the type of the struct this is embedded in.
390 * @member: the name of the list_head within the struct.
391 *
392 * Note that if the list is empty, it returns NULL.
393 */
394 #define list_first_entry_or_null(ptr, type, member) ({ \
395 struct list_head *head__ = (ptr); \
396 struct list_head *pos__ = READ_ONCE(head__->next); \
397 pos__ != head__ ? list_entry(pos__, type, member) : NULL; \
398 })
399
400 /**
401 * list_next_entry - get the next element in list
402 * @pos: the type * to cursor
403 * @member: the name of the list_head within the struct.
404 */
405 #define list_next_entry(pos, member) \
406 list_entry((pos)->member.next, typeof(*(pos)), member)
407
408 /**
409 * list_prev_entry - get the prev element in list
410 * @pos: the type * to cursor
411 * @member: the name of the list_head within the struct.
412 */
413 #define list_prev_entry(pos, member) \
414 list_entry((pos)->member.prev, typeof(*(pos)), member)
415
416 /**
417 * list_for_each - iterate over a list
418 * @pos: the &struct list_head to use as a loop cursor.
419 * @head: the head for your list.
420 */
421 #define list_for_each(pos, head) \
422 for (pos = (head)->next; pos != (head); pos = pos->next)
423
424 /**
425 * list_for_each_prev - iterate over a list backwards
426 * @pos: the &struct list_head to use as a loop cursor.
427 * @head: the head for your list.
428 */
429 #define list_for_each_prev(pos, head) \
430 for (pos = (head)->prev; pos != (head); pos = pos->prev)
431
432 /**
433 * list_for_each_safe - iterate over a list safe against removal of list entry
434 * @pos: the &struct list_head to use as a loop cursor.
435 * @n: another &struct list_head to use as temporary storage
436 * @head: the head for your list.
437 */
438 #define list_for_each_safe(pos, n, head) \
439 for (pos = (head)->next, n = pos->next; pos != (head); \
440 pos = n, n = pos->next)
441
442 /**
443 * list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry
444 * @pos: the &struct list_head to use as a loop cursor.
445 * @n: another &struct list_head to use as temporary storage
446 * @head: the head for your list.
447 */
448 #define list_for_each_prev_safe(pos, n, head) \
449 for (pos = (head)->prev, n = pos->prev; \
450 pos != (head); \
451 pos = n, n = pos->prev)
452
453 /**
454 * list_for_each_entry - iterate over list of given type
455 * @pos: the type * to use as a loop cursor.
456 * @head: the head for your list.
457 * @member: the name of the list_head within the struct.
458 */
459 #define list_for_each_entry(pos, head, member) \
460 for (pos = list_first_entry(head, typeof(*pos), member); \
461 &pos->member != (head); \
462 pos = list_next_entry(pos, member))
463
464 /**
465 * list_for_each_entry_reverse - iterate backwards over list of given type.
466 * @pos: the type * to use as a loop cursor.
467 * @head: the head for your list.
468 * @member: the name of the list_head within the struct.
469 */
470 #define list_for_each_entry_reverse(pos, head, member) \
471 for (pos = list_last_entry(head, typeof(*pos), member); \
472 &pos->member != (head); \
473 pos = list_prev_entry(pos, member))
474
475 /**
476 * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue()
477 * @pos: the type * to use as a start point
478 * @head: the head of the list
479 * @member: the name of the list_head within the struct.
480 *
481 * Prepares a pos entry for use as a start point in list_for_each_entry_continue().
482 */
483 #define list_prepare_entry(pos, head, member) \
484 ((pos) ? : list_entry(head, typeof(*pos), member))
485
486 /**
487 * list_for_each_entry_continue - continue iteration over list of given type
488 * @pos: the type * to use as a loop cursor.
489 * @head: the head for your list.
490 * @member: the name of the list_head within the struct.
491 *
492 * Continue to iterate over list of given type, continuing after
493 * the current position.
494 */
495 #define list_for_each_entry_continue(pos, head, member) \
496 for (pos = list_next_entry(pos, member); \
497 &pos->member != (head); \
498 pos = list_next_entry(pos, member))
499
500 /**
501 * list_for_each_entry_continue_reverse - iterate backwards from the given point
502 * @pos: the type * to use as a loop cursor.
503 * @head: the head for your list.
504 * @member: the name of the list_head within the struct.
505 *
506 * Start to iterate over list of given type backwards, continuing after
507 * the current position.
508 */
509 #define list_for_each_entry_continue_reverse(pos, head, member) \
510 for (pos = list_prev_entry(pos, member); \
511 &pos->member != (head); \
512 pos = list_prev_entry(pos, member))
513
514 /**
515 * list_for_each_entry_from - iterate over list of given type from the current point
516 * @pos: the type * to use as a loop cursor.
517 * @head: the head for your list.
518 * @member: the name of the list_head within the struct.
519 *
520 * Iterate over list of given type, continuing from current position.
521 */
522 #define list_for_each_entry_from(pos, head, member) \
523 for (; &pos->member != (head); \
524 pos = list_next_entry(pos, member))
525
526 /**
527 * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
528 * @pos: the type * to use as a loop cursor.
529 * @n: another type * to use as temporary storage
530 * @head: the head for your list.
531 * @member: the name of the list_head within the struct.
532 */
533 #define list_for_each_entry_safe(pos, n, head, member) \
534 for (pos = list_first_entry(head, typeof(*pos), member), \
535 n = list_next_entry(pos, member); \
536 &pos->member != (head); \
537 pos = n, n = list_next_entry(n, member))
538
539 /**
540 * list_for_each_entry_safe_continue - continue list iteration safe against removal
541 * @pos: the type * to use as a loop cursor.
542 * @n: another type * to use as temporary storage
543 * @head: the head for your list.
544 * @member: the name of the list_head within the struct.
545 *
546 * Iterate over list of given type, continuing after current point,
547 * safe against removal of list entry.
548 */
549 #define list_for_each_entry_safe_continue(pos, n, head, member) \
550 for (pos = list_next_entry(pos, member), \
551 n = list_next_entry(pos, member); \
552 &pos->member != (head); \
553 pos = n, n = list_next_entry(n, member))
554
555 /**
556 * list_for_each_entry_safe_from - iterate over list from current point safe against removal
557 * @pos: the type * to use as a loop cursor.
558 * @n: another type * to use as temporary storage
559 * @head: the head for your list.
560 * @member: the name of the list_head within the struct.
561 *
562 * Iterate over list of given type from current point, safe against
563 * removal of list entry.
564 */
565 #define list_for_each_entry_safe_from(pos, n, head, member) \
566 for (n = list_next_entry(pos, member); \
567 &pos->member != (head); \
568 pos = n, n = list_next_entry(n, member))
569
570 /**
571 * list_for_each_entry_safe_reverse - iterate backwards over list safe against removal
572 * @pos: the type * to use as a loop cursor.
573 * @n: another type * to use as temporary storage
574 * @head: the head for your list.
575 * @member: the name of the list_head within the struct.
576 *
577 * Iterate backwards over list of given type, safe against removal
578 * of list entry.
579 */
580 #define list_for_each_entry_safe_reverse(pos, n, head, member) \
581 for (pos = list_last_entry(head, typeof(*pos), member), \
582 n = list_prev_entry(pos, member); \
583 &pos->member != (head); \
584 pos = n, n = list_prev_entry(n, member))
585
586 /**
587 * list_safe_reset_next - reset a stale list_for_each_entry_safe loop
588 * @pos: the loop cursor used in the list_for_each_entry_safe loop
589 * @n: temporary storage used in list_for_each_entry_safe
590 * @member: the name of the list_head within the struct.
591 *
592 * list_safe_reset_next is not safe to use in general if the list may be
593 * modified concurrently (eg. the lock is dropped in the loop body). An
594 * exception to this is if the cursor element (pos) is pinned in the list,
595 * and list_safe_reset_next is called after re-taking the lock and before
596 * completing the current iteration of the loop body.
597 */
598 #define list_safe_reset_next(pos, n, member) \
599 n = list_next_entry(pos, member)
600
601 /*
602 * Double linked lists with a single pointer list head.
603 * Mostly useful for hash tables where the two pointer list head is
604 * too wasteful.
605 * You lose the ability to access the tail in O(1).
606 */
607
608 #define HLIST_HEAD_INIT { .first = NULL }
609 #define HLIST_HEAD(name) struct hlist_head name = { .first = NULL }
610 #define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL)
611 static inline void INIT_HLIST_NODE(struct hlist_node *h)
612 {
613 h->next = NULL;
614 h->pprev = NULL;
615 }
616
617 static inline int hlist_unhashed(const struct hlist_node *h)
618 {
619 return !h->pprev;
620 }
621
622 static inline int hlist_empty(const struct hlist_head *h)
623 {
624 return !READ_ONCE(h->first);
625 }
626
627 static inline void __hlist_del(struct hlist_node *n)
628 {
629 struct hlist_node *next = n->next;
630 struct hlist_node **pprev = n->pprev;
631
632 WRITE_ONCE(*pprev, next);
633 if (next)
634 next->pprev = pprev;
635 }
636
637 static inline void hlist_del(struct hlist_node *n)
638 {
639 __hlist_del(n);
640 n->next = LIST_POISON1;
641 n->pprev = LIST_POISON2;
642 }
643
644 static inline void hlist_del_init(struct hlist_node *n)
645 {
646 if (!hlist_unhashed(n)) {
647 __hlist_del(n);
648 INIT_HLIST_NODE(n);
649 }
650 }
651
652 static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
653 {
654 struct hlist_node *first = h->first;
655 n->next = first;
656 if (first)
657 first->pprev = &n->next;
658 WRITE_ONCE(h->first, n);
659 n->pprev = &h->first;
660 }
661
662 /* next must be != NULL */
663 static inline void hlist_add_before(struct hlist_node *n,
664 struct hlist_node *next)
665 {
666 n->pprev = next->pprev;
667 n->next = next;
668 next->pprev = &n->next;
669 WRITE_ONCE(*(n->pprev), n);
670 }
671
672 static inline void hlist_add_behind(struct hlist_node *n,
673 struct hlist_node *prev)
674 {
675 n->next = prev->next;
676 WRITE_ONCE(prev->next, n);
677 n->pprev = &prev->next;
678
679 if (n->next)
680 n->next->pprev = &n->next;
681 }
682
683 /* after that we'll appear to be on some hlist and hlist_del will work */
684 static inline void hlist_add_fake(struct hlist_node *n)
685 {
686 n->pprev = &n->next;
687 }
688
689 static inline bool hlist_fake(struct hlist_node *h)
690 {
691 return h->pprev == &h->next;
692 }
693
694 /*
695 * Check whether the node is the only node of the head without
696 * accessing head:
697 */
698 static inline bool
699 hlist_is_singular_node(struct hlist_node *n, struct hlist_head *h)
700 {
701 return !n->next && n->pprev == &h->first;
702 }
703
704 /*
705 * Move a list from one list head to another. Fixup the pprev
706 * reference of the first entry if it exists.
707 */
708 static inline void hlist_move_list(struct hlist_head *old,
709 struct hlist_head *new)
710 {
711 new->first = old->first;
712 if (new->first)
713 new->first->pprev = &new->first;
714 old->first = NULL;
715 }
716
717 #define hlist_entry(ptr, type, member) container_of(ptr,type,member)
718
719 #define hlist_for_each(pos, head) \
720 for (pos = (head)->first; pos ; pos = pos->next)
721
722 #define hlist_for_each_safe(pos, n, head) \
723 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
724 pos = n)
725
726 #define hlist_entry_safe(ptr, type, member) \
727 ({ typeof(ptr) ____ptr = (ptr); \
728 ____ptr ? hlist_entry(____ptr, type, member) : NULL; \
729 })
730
731 /**
732 * hlist_for_each_entry - iterate over list of given type
733 * @pos: the type * to use as a loop cursor.
734 * @head: the head for your list.
735 * @member: the name of the hlist_node within the struct.
736 */
737 #define hlist_for_each_entry(pos, head, member) \
738 for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
739 pos; \
740 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
741
742 /**
743 * hlist_for_each_entry_continue - iterate over a hlist continuing after current point
744 * @pos: the type * to use as a loop cursor.
745 * @member: the name of the hlist_node within the struct.
746 */
747 #define hlist_for_each_entry_continue(pos, member) \
748 for (pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member);\
749 pos; \
750 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
751
752 /**
753 * hlist_for_each_entry_from - iterate over a hlist continuing from current point
754 * @pos: the type * to use as a loop cursor.
755 * @member: the name of the hlist_node within the struct.
756 */
757 #define hlist_for_each_entry_from(pos, member) \
758 for (; pos; \
759 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
760
761 /**
762 * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
763 * @pos: the type * to use as a loop cursor.
764 * @n: another &struct hlist_node to use as temporary storage
765 * @head: the head for your list.
766 * @member: the name of the hlist_node within the struct.
767 */
768 #define hlist_for_each_entry_safe(pos, n, head, member) \
769 for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\
770 pos && ({ n = pos->member.next; 1; }); \
771 pos = hlist_entry_safe(n, typeof(*pos), member))
772
773 #endif