list.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. #ifndef _LINUX_LIST_H
  2. #define _LINUX_LIST_H
  3. #include <linux/stddef.h>
  4. #include <linux/poison.h>
  5. #include <linux/prefetch.h>
  6. #include <asm/system.h>
  7. /*
  8. * Simple doubly linked list implementation.
  9. *
  10. * Some of the internal functions ("__xxx") are useful when
  11. * manipulating whole lists rather than single entries, as
  12. * sometimes we already know the next/prev entries and we can
  13. * generate better code by using them directly rather than
  14. * using the generic single-entry routines.
  15. */
  16. struct list_head {
  17. struct list_head *next, *prev;
  18. };
  19. #define LIST_HEAD_INIT(name) { &(name), &(name) }
  20. #define LIST_HEAD(name) \
  21. struct list_head name = LIST_HEAD_INIT(name)
  22. static inline void INIT_LIST_HEAD(struct list_head *list)
  23. {
  24. list->next = list;
  25. list->prev = list;
  26. }
  27. /*
  28. * Insert a new entry between two known consecutive entries.
  29. *
  30. * This is only for internal list manipulation where we know
  31. * the prev/next entries already!
  32. */
  33. #ifndef CONFIG_DEBUG_LIST
  34. static inline void __list_add(struct list_head *new,
  35. struct list_head *prev,
  36. struct list_head *next)
  37. {
  38. next->prev = new;
  39. new->next = next;
  40. new->prev = prev;
  41. prev->next = new;
  42. }
  43. #else
  44. extern void __list_add(struct list_head *new,
  45. struct list_head *prev,
  46. struct list_head *next);
  47. #endif
  48. /**
  49. * list_add - add a new entry
  50. * @new: new entry to be added
  51. * @head: list head to add it after
  52. *
  53. * Insert a new entry after the specified head.
  54. * This is good for implementing stacks.
  55. */
  56. static inline void list_add(struct list_head *new, struct list_head *head)
  57. {
  58. __list_add(new, head, head->next);
  59. }
  60. /**
  61. * list_add_tail - add a new entry
  62. * @new: new entry to be added
  63. * @head: list head to add it before
  64. *
  65. * Insert a new entry before the specified head.
  66. * This is useful for implementing queues.
  67. */
  68. static inline void list_add_tail(struct list_head *new, struct list_head *head)
  69. {
  70. __list_add(new, head->prev, head);
  71. }
  72. /*
  73. * Delete a list entry by making the prev/next entries
  74. * point to each other.
  75. *
  76. * This is only for internal list manipulation where we know
  77. * the prev/next entries already!
  78. */
  79. static inline void __list_del(struct list_head * prev, struct list_head * next)
  80. {
  81. next->prev = prev;
  82. prev->next = next;
  83. }
  84. /**
  85. * list_del - deletes entry from list.
  86. * @entry: the element to delete from the list.
  87. * Note: list_empty() on entry does not return true after this, the entry is
  88. * in an undefined state.
  89. */
  90. #ifndef CONFIG_DEBUG_LIST
  91. static inline void list_del(struct list_head *entry)
  92. {
  93. __list_del(entry->prev, entry->next);
  94. entry->next = LIST_POISON1;
  95. entry->prev = LIST_POISON2;
  96. }
  97. #else
  98. extern void list_del(struct list_head *entry);
  99. #endif
  100. /**
  101. * list_replace - replace old entry by new one
  102. * @old : the element to be replaced
  103. * @new : the new element to insert
  104. *
  105. * If @old was empty, it will be overwritten.
  106. */
  107. static inline void list_replace(struct list_head *old,
  108. struct list_head *new)
  109. {
  110. new->next = old->next;
  111. new->next->prev = new;
  112. new->prev = old->prev;
  113. new->prev->next = new;
  114. }
  115. static inline void list_replace_init(struct list_head *old,
  116. struct list_head *new)
  117. {
  118. list_replace(old, new);
  119. INIT_LIST_HEAD(old);
  120. }
  121. /**
  122. * list_del_init - deletes entry from list and reinitialize it.
  123. * @entry: the element to delete from the list.
  124. */
  125. static inline void list_del_init(struct list_head *entry)
  126. {
  127. __list_del(entry->prev, entry->next);
  128. INIT_LIST_HEAD(entry);
  129. }
  130. /**
  131. * list_move - delete from one list and add as another's head
  132. * @list: the entry to move
  133. * @head: the head that will precede our entry
  134. */
  135. static inline void list_move(struct list_head *list, struct list_head *head)
  136. {
  137. __list_del(list->prev, list->next);
  138. list_add(list, head);
  139. }
  140. /**
  141. * list_move_tail - delete from one list and add as another's tail
  142. * @list: the entry to move
  143. * @head: the head that will follow our entry
  144. */
  145. static inline void list_move_tail(struct list_head *list,
  146. struct list_head *head)
  147. {
  148. __list_del(list->prev, list->next);
  149. list_add_tail(list, head);
  150. }
  151. /**
  152. * list_is_last - tests whether @list is the last entry in list @head
  153. * @list: the entry to test
  154. * @head: the head of the list
  155. */
  156. static inline int list_is_last(const struct list_head *list,
  157. const struct list_head *head)
  158. {
  159. return list->next == head;
  160. }
  161. /**
  162. * list_empty - tests whether a list is empty
  163. * @head: the list to test.
  164. */
  165. static inline int list_empty(const struct list_head *head)
  166. {
  167. return head->next == head;
  168. }
  169. /**
  170. * list_empty_careful - tests whether a list is empty and not being modified
  171. * @head: the list to test
  172. *
  173. * Description:
  174. * tests whether a list is empty _and_ checks that no other CPU might be
  175. * in the process of modifying either member (next or prev)
  176. *
  177. * NOTE: using list_empty_careful() without synchronization
  178. * can only be safe if the only activity that can happen
  179. * to the list entry is list_del_init(). Eg. it cannot be used
  180. * if another CPU could re-list_add() it.
  181. */
  182. static inline int list_empty_careful(const struct list_head *head)
  183. {
  184. struct list_head *next = head->next;
  185. return (next == head) && (next == head->prev);
  186. }
  187. /**
  188. * list_is_singular - tests whether a list has just one entry.
  189. * @head: the list to test.
  190. */
  191. static inline int list_is_singular(const struct list_head *head)
  192. {
  193. return !list_empty(head) && (head->next == head->prev);
  194. }
  195. static inline void __list_cut_position(struct list_head *list,
  196. struct list_head *head, struct list_head *entry)
  197. {
  198. struct list_head *new_first = entry->next;
  199. list->next = head->next;
  200. list->next->prev = list;
  201. list->prev = entry;
  202. entry->next = list;
  203. head->next = new_first;
  204. new_first->prev = head;
  205. }
  206. /**
  207. * list_cut_position - cut a list into two
  208. * @list: a new list to add all removed entries
  209. * @head: a list with entries
  210. * @entry: an entry within head, could be the head itself
  211. * and if so we won't cut the list
  212. *
  213. * This helper moves the initial part of @head, up to and
  214. * including @entry, from @head to @list. You should
  215. * pass on @entry an element you know is on @head. @list
  216. * should be an empty list or a list you do not care about
  217. * losing its data.
  218. *
  219. */
  220. static inline void list_cut_position(struct list_head *list,
  221. struct list_head *head, struct list_head *entry)
  222. {
  223. if (list_empty(head))
  224. return;
  225. if (list_is_singular(head) &&
  226. (head->next != entry && head != entry))
  227. return;
  228. if (entry == head)
  229. INIT_LIST_HEAD(list);
  230. else
  231. __list_cut_position(list, head, entry);
  232. }
  233. static inline void __list_splice(const struct list_head *list,
  234. struct list_head *prev,
  235. struct list_head *next)
  236. {
  237. struct list_head *first = list->next;
  238. struct list_head *last = list->prev;
  239. first->prev = prev;
  240. prev->next = first;
  241. last->next = next;
  242. next->prev = last;
  243. }
  244. /**
  245. * list_splice - join two lists, this is designed for stacks
  246. * @list: the new list to add.
  247. * @head: the place to add it in the first list.
  248. */
  249. static inline void list_splice(const struct list_head *list,
  250. struct list_head *head)
  251. {
  252. if (!list_empty(list))
  253. __list_splice(list, head, head->next);
  254. }
  255. /**
  256. * list_splice_tail - join two lists, each list being a queue
  257. * @list: the new list to add.
  258. * @head: the place to add it in the first list.
  259. */
  260. static inline void list_splice_tail(struct list_head *list,
  261. struct list_head *head)
  262. {
  263. if (!list_empty(list))
  264. __list_splice(list, head->prev, head);
  265. }
  266. /**
  267. * list_splice_init - join two lists and reinitialise the emptied list.
  268. * @list: the new list to add.
  269. * @head: the place to add it in the first list.
  270. *
  271. * The list at @list is reinitialised
  272. */
  273. static inline void list_splice_init(struct list_head *list,
  274. struct list_head *head)
  275. {
  276. if (!list_empty(list)) {
  277. __list_splice(list, head, head->next);
  278. INIT_LIST_HEAD(list);
  279. }
  280. }
  281. /**
  282. * list_splice_tail_init - join two lists, each list being a queue, and
  283. * reinitialise the emptied list.
  284. * @list: the new list to add.
  285. * @head: the place to add it in the first list.
  286. *
  287. * The list at @list is reinitialised
  288. */
  289. static inline void list_splice_tail_init(struct list_head *list,
  290. struct list_head *head)
  291. {
  292. if (!list_empty(list)) {
  293. __list_splice(list, head->prev, head);
  294. INIT_LIST_HEAD(list);
  295. }
  296. }
  297. /**
  298. * list_entry - get the struct for this entry
  299. * @ptr: the &struct list_head pointer.
  300. * @type: the type of the struct this is embedded in.
  301. * @member: the name of the list_struct within the struct.
  302. */
  303. #define list_entry(ptr, type, member) \
  304. container_of(ptr, type, member)
  305. /**
  306. * list_first_entry - get the first element from a list
  307. * @ptr: the list head to take the element from.
  308. * @type: the type of the struct this is embedded in.
  309. * @member: the name of the list_struct within the struct.
  310. *
  311. * Note, that list is expected to be not empty.
  312. */
  313. #define list_first_entry(ptr, type, member) \
  314. list_entry((ptr)->next, type, member)
  315. /**
  316. * list_for_each - iterate over a list
  317. * @pos: the &struct list_head to use as a loop cursor.
  318. * @head: the head for your list.
  319. */
  320. #define list_for_each(pos, head) \
  321. for (pos = (head)->next; prefetch(pos->next), pos != (head); \
  322. pos = pos->next)
  323. /**
  324. * __list_for_each - iterate over a list
  325. * @pos: the &struct list_head to use as a loop cursor.
  326. * @head: the head for your list.
  327. *
  328. * This variant differs from list_for_each() in that it's the
  329. * simplest possible list iteration code, no prefetching is done.
  330. * Use this for code that knows the list to be very short (empty
  331. * or 1 entry) most of the time.
  332. */
  333. #define __list_for_each(pos, head) \
  334. for (pos = (head)->next; pos != (head); pos = pos->next)
  335. /**
  336. * list_for_each_prev - iterate over a list backwards
  337. * @pos: the &struct list_head to use as a loop cursor.
  338. * @head: the head for your list.
  339. */
  340. #define list_for_each_prev(pos, head) \
  341. for (pos = (head)->prev; prefetch(pos->prev), pos != (head); \
  342. pos = pos->prev)
  343. /**
  344. * list_for_each_safe - iterate over a list safe against removal of list entry
  345. * @pos: the &struct list_head to use as a loop cursor.
  346. * @n: another &struct list_head to use as temporary storage
  347. * @head: the head for your list.
  348. */
  349. #define list_for_each_safe(pos, n, head) \
  350. for (pos = (head)->next, n = pos->next; pos != (head); \
  351. pos = n, n = pos->next)
  352. /**
  353. * list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry
  354. * @pos: the &struct list_head to use as a loop cursor.
  355. * @n: another &struct list_head to use as temporary storage
  356. * @head: the head for your list.
  357. */
  358. #define list_for_each_prev_safe(pos, n, head) \
  359. for (pos = (head)->prev, n = pos->prev; \
  360. prefetch(pos->prev), pos != (head); \
  361. pos = n, n = pos->prev)
  362. /**
  363. * list_for_each_entry - iterate over list of given type
  364. * @pos: the type * to use as a loop cursor.
  365. * @head: the head for your list.
  366. * @member: the name of the list_struct within the struct.
  367. */
  368. #define list_for_each_entry(pos, head, member) \
  369. for (pos = list_entry((head)->next, typeof(*pos), member); \
  370. prefetch(pos->member.next), &pos->member != (head); \
  371. pos = list_entry(pos->member.next, typeof(*pos), member))
  372. /**
  373. * list_for_each_entry_reverse - iterate backwards over list of given type.
  374. * @pos: the type * to use as a loop cursor.
  375. * @head: the head for your list.
  376. * @member: the name of the list_struct within the struct.
  377. */
  378. #define list_for_each_entry_reverse(pos, head, member) \
  379. for (pos = list_entry((head)->prev, typeof(*pos), member); \
  380. prefetch(pos->member.prev), &pos->member != (head); \
  381. pos = list_entry(pos->member.prev, typeof(*pos), member))
  382. /**
  383. * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue()
  384. * @pos: the type * to use as a start point
  385. * @head: the head of the list
  386. * @member: the name of the list_struct within the struct.
  387. *
  388. * Prepares a pos entry for use as a start point in list_for_each_entry_continue().
  389. */
  390. #define list_prepare_entry(pos, head, member) \
  391. ((pos) ? : list_entry(head, typeof(*pos), member))
  392. /**
  393. * list_for_each_entry_continue - continue iteration over list of given type
  394. * @pos: the type * to use as a loop cursor.
  395. * @head: the head for your list.
  396. * @member: the name of the list_struct within the struct.
  397. *
  398. * Continue to iterate over list of given type, continuing after
  399. * the current position.
  400. */
  401. #define list_for_each_entry_continue(pos, head, member) \
  402. for (pos = list_entry(pos->member.next, typeof(*pos), member); \
  403. prefetch(pos->member.next), &pos->member != (head); \
  404. pos = list_entry(pos->member.next, typeof(*pos), member))
  405. /**
  406. * list_for_each_entry_continue_reverse - iterate backwards from the given point
  407. * @pos: the type * to use as a loop cursor.
  408. * @head: the head for your list.
  409. * @member: the name of the list_struct within the struct.
  410. *
  411. * Start to iterate over list of given type backwards, continuing after
  412. * the current position.
  413. */
  414. #define list_for_each_entry_continue_reverse(pos, head, member) \
  415. for (pos = list_entry(pos->member.prev, typeof(*pos), member); \
  416. prefetch(pos->member.prev), &pos->member != (head); \
  417. pos = list_entry(pos->member.prev, typeof(*pos), member))
  418. /**
  419. * list_for_each_entry_from - iterate over list of given type from the current point
  420. * @pos: the type * to use as a loop cursor.
  421. * @head: the head for your list.
  422. * @member: the name of the list_struct within the struct.
  423. *
  424. * Iterate over list of given type, continuing from current position.
  425. */
  426. #define list_for_each_entry_from(pos, head, member) \
  427. for (; prefetch(pos->member.next), &pos->member != (head); \
  428. pos = list_entry(pos->member.next, typeof(*pos), member))
  429. /**
  430. * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
  431. * @pos: the type * to use as a loop cursor.
  432. * @n: another type * to use as temporary storage
  433. * @head: the head for your list.
  434. * @member: the name of the list_struct within the struct.
  435. */
  436. #define list_for_each_entry_safe(pos, n, head, member) \
  437. for (pos = list_entry((head)->next, typeof(*pos), member), \
  438. n = list_entry(pos->member.next, typeof(*pos), member); \
  439. &pos->member != (head); \
  440. pos = n, n = list_entry(n->member.next, typeof(*n), member))
  441. /**
  442. * list_for_each_entry_safe_continue
  443. * @pos: the type * to use as a loop cursor.
  444. * @n: another type * to use as temporary storage
  445. * @head: the head for your list.
  446. * @member: the name of the list_struct within the struct.
  447. *
  448. * Iterate over list of given type, continuing after current point,
  449. * safe against removal of list entry.
  450. */
  451. #define list_for_each_entry_safe_continue(pos, n, head, member) \
  452. for (pos = list_entry(pos->member.next, typeof(*pos), member), \
  453. n = list_entry(pos->member.next, typeof(*pos), member); \
  454. &pos->member != (head); \
  455. pos = n, n = list_entry(n->member.next, typeof(*n), member))
  456. /**
  457. * list_for_each_entry_safe_from
  458. * @pos: the type * to use as a loop cursor.
  459. * @n: another type * to use as temporary storage
  460. * @head: the head for your list.
  461. * @member: the name of the list_struct within the struct.
  462. *
  463. * Iterate over list of given type from current point, safe against
  464. * removal of list entry.
  465. */
  466. #define list_for_each_entry_safe_from(pos, n, head, member) \
  467. for (n = list_entry(pos->member.next, typeof(*pos), member); \
  468. &pos->member != (head); \
  469. pos = n, n = list_entry(n->member.next, typeof(*n), member))
  470. /**
  471. * list_for_each_entry_safe_reverse
  472. * @pos: the type * to use as a loop cursor.
  473. * @n: another type * to use as temporary storage
  474. * @head: the head for your list.
  475. * @member: the name of the list_struct within the struct.
  476. *
  477. * Iterate backwards over list of given type, safe against removal
  478. * of list entry.
  479. */
  480. #define list_for_each_entry_safe_reverse(pos, n, head, member) \
  481. for (pos = list_entry((head)->prev, typeof(*pos), member), \
  482. n = list_entry(pos->member.prev, typeof(*pos), member); \
  483. &pos->member != (head); \
  484. pos = n, n = list_entry(n->member.prev, typeof(*n), member))
  485. /*
  486. * Double linked lists with a single pointer list head.
  487. * Mostly useful for hash tables where the two pointer list head is
  488. * too wasteful.
  489. * You lose the ability to access the tail in O(1).
  490. */
  491. struct hlist_head {
  492. struct hlist_node *first;
  493. };
  494. struct hlist_node {
  495. struct hlist_node *next, **pprev;
  496. };
  497. #define HLIST_HEAD_INIT { .first = NULL }
  498. #define HLIST_HEAD(name) struct hlist_head name = { .first = NULL }
  499. #define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL)
  500. static inline void INIT_HLIST_NODE(struct hlist_node *h)
  501. {
  502. h->next = NULL;
  503. h->pprev = NULL;
  504. }
  505. static inline int hlist_unhashed(const struct hlist_node *h)
  506. {
  507. return !h->pprev;
  508. }
  509. static inline int hlist_empty(const struct hlist_head *h)
  510. {
  511. return !h->first;
  512. }
  513. static inline void __hlist_del(struct hlist_node *n)
  514. {
  515. struct hlist_node *next = n->next;
  516. struct hlist_node **pprev = n->pprev;
  517. *pprev = next;
  518. if (next)
  519. next->pprev = pprev;
  520. }
  521. static inline void hlist_del(struct hlist_node *n)
  522. {
  523. __hlist_del(n);
  524. n->next = LIST_POISON1;
  525. n->pprev = LIST_POISON2;
  526. }
  527. static inline void hlist_del_init(struct hlist_node *n)
  528. {
  529. if (!hlist_unhashed(n)) {
  530. __hlist_del(n);
  531. INIT_HLIST_NODE(n);
  532. }
  533. }
  534. static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h)
  535. {
  536. struct hlist_node *first = h->first;
  537. n->next = first;
  538. if (first)
  539. first->pprev = &n->next;
  540. h->first = n;
  541. n->pprev = &h->first;
  542. }
  543. /* next must be != NULL */
  544. static inline void hlist_add_before(struct hlist_node *n,
  545. struct hlist_node *next)
  546. {
  547. n->pprev = next->pprev;
  548. n->next = next;
  549. next->pprev = &n->next;
  550. *(n->pprev) = n;
  551. }
  552. static inline void hlist_add_after(struct hlist_node *n,
  553. struct hlist_node *next)
  554. {
  555. next->next = n->next;
  556. n->next = next;
  557. next->pprev = &n->next;
  558. if(next->next)
  559. next->next->pprev = &next->next;
  560. }
  561. #define hlist_entry(ptr, type, member) container_of(ptr,type,member)
  562. #define hlist_for_each(pos, head) \
  563. for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \
  564. pos = pos->next)
  565. #define hlist_for_each_safe(pos, n, head) \
  566. for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
  567. pos = n)
  568. /**
  569. * hlist_for_each_entry - iterate over list of given type
  570. * @tpos: the type * to use as a loop cursor.
  571. * @pos: the &struct hlist_node to use as a loop cursor.
  572. * @head: the head for your list.
  573. * @member: the name of the hlist_node within the struct.
  574. */
  575. #define hlist_for_each_entry(tpos, pos, head, member) \
  576. for (pos = (head)->first; \
  577. pos && ({ prefetch(pos->next); 1;}) && \
  578. ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
  579. pos = pos->next)
  580. /**
  581. * hlist_for_each_entry_continue - iterate over a hlist continuing after current point
  582. * @tpos: the type * to use as a loop cursor.
  583. * @pos: the &struct hlist_node to use as a loop cursor.
  584. * @member: the name of the hlist_node within the struct.
  585. */
  586. #define hlist_for_each_entry_continue(tpos, pos, member) \
  587. for (pos = (pos)->next; \
  588. pos && ({ prefetch(pos->next); 1;}) && \
  589. ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
  590. pos = pos->next)
  591. /**
  592. * hlist_for_each_entry_from - iterate over a hlist continuing from current point
  593. * @tpos: the type * to use as a loop cursor.
  594. * @pos: the &struct hlist_node to use as a loop cursor.
  595. * @member: the name of the hlist_node within the struct.
  596. */
  597. #define hlist_for_each_entry_from(tpos, pos, member) \
  598. for (; pos && ({ prefetch(pos->next); 1;}) && \
  599. ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
  600. pos = pos->next)
  601. /**
  602. * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
  603. * @tpos: the type * to use as a loop cursor.
  604. * @pos: the &struct hlist_node to use as a loop cursor.
  605. * @n: another &struct hlist_node to use as temporary storage
  606. * @head: the head for your list.
  607. * @member: the name of the hlist_node within the struct.
  608. */
  609. #define hlist_for_each_entry_safe(tpos, pos, n, head, member) \
  610. for (pos = (head)->first; \
  611. pos && ({ n = pos->next; 1; }) && \
  612. ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \
  613. pos = n)
  614. #endif