linux_list.h revision 8ba9c0c5d4425ee8c2b0e363aa55d5877371cd1d
1#ifndef _LINUX_LIST_H 2#define _LINUX_LIST_H 3 4#include <stddef.h> 5 6#undef offsetof 7#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) 8 9/** 10 * container_of - cast a member of a structure out to the containing structure 11 * 12 * @ptr: the pointer to the member. 13 * @type: the type of the container struct this is embedded in. 14 * @member: the name of the member within the struct. 15 * 16 */ 17#define container_of(ptr, type, member) ({ \ 18 typeof( ((type *)0)->member ) *__mptr = (ptr); \ 19 (type *)( (char *)__mptr - offsetof(type,member) );}) 20 21/* 22 * Check at compile time that something is of a particular type. 23 * Always evaluates to 1 so you may use it easily in comparisons. 24 */ 25#define typecheck(type,x) \ 26({ type __dummy; \ 27 typeof(x) __dummy2; \ 28 (void)(&__dummy == &__dummy2); \ 29 1; \ 30}) 31 32#define prefetch(x) 1 33 34/* empty define to make this work in userspace -HW */ 35#ifndef smp_wmb 36#define smp_wmb() 37#endif 38 39/* 40 * These are non-NULL pointers that will result in page faults 41 * under normal circumstances, used to verify that nobody uses 42 * non-initialized list entries. 43 */ 44#define LIST_POISON1 ((void *) 0x00100100) 45#define LIST_POISON2 ((void *) 0x00200200) 46 47/* 48 * Simple doubly linked list implementation. 49 * 50 * Some of the internal functions ("__xxx") are useful when 51 * manipulating whole lists rather than single entries, as 52 * sometimes we already know the next/prev entries and we can 53 * generate better code by using them directly rather than 54 * using the generic single-entry routines. 55 */ 56 57struct list_head { 58 struct list_head *next, *prev; 59}; 60 61#define LIST_HEAD_INIT(name) { &(name), &(name) } 62 63#define LIST_HEAD(name) \ 64 struct list_head name = LIST_HEAD_INIT(name) 65 66#define INIT_LIST_HEAD(ptr) do { \ 67 (ptr)->next = (ptr); (ptr)->prev = (ptr); \ 68} while (0) 69 70/* 71 * Insert a new entry between two known consecutive entries. 72 * 73 * This is only for internal list manipulation where we know 74 * the prev/next entries already! 75 */ 76static inline void __list_add(struct list_head *new, 77 struct list_head *prev, 78 struct list_head *next) 79{ 80 next->prev = new; 81 new->next = next; 82 new->prev = prev; 83 prev->next = new; 84} 85 86/** 87 * list_add - add a new entry 88 * @new: new entry to be added 89 * @head: list head to add it after 90 * 91 * Insert a new entry after the specified head. 92 * This is good for implementing stacks. 93 */ 94static inline void list_add(struct list_head *new, struct list_head *head) 95{ 96 __list_add(new, head, head->next); 97} 98 99/** 100 * list_add_tail - add a new entry 101 * @new: new entry to be added 102 * @head: list head to add it before 103 * 104 * Insert a new entry before the specified head. 105 * This is useful for implementing queues. 106 */ 107static inline void list_add_tail(struct list_head *new, struct list_head *head) 108{ 109 __list_add(new, head->prev, head); 110} 111 112/* 113 * Insert a new entry between two known consecutive entries. 114 * 115 * This is only for internal list manipulation where we know 116 * the prev/next entries already! 117 */ 118static inline void __list_add_rcu(struct list_head * new, 119 struct list_head * prev, struct list_head * next) 120{ 121 new->next = next; 122 new->prev = prev; 123 smp_wmb(); 124 next->prev = new; 125 prev->next = new; 126} 127 128/** 129 * list_add_rcu - add a new entry to rcu-protected list 130 * @new: new entry to be added 131 * @head: list head to add it after 132 * 133 * Insert a new entry after the specified head. 134 * This is good for implementing stacks. 135 * 136 * The caller must take whatever precautions are necessary 137 * (such as holding appropriate locks) to avoid racing 138 * with another list-mutation primitive, such as list_add_rcu() 139 * or list_del_rcu(), running on this same list. 140 * However, it is perfectly legal to run concurrently with 141 * the _rcu list-traversal primitives, such as 142 * list_for_each_entry_rcu(). 143 */ 144static inline void list_add_rcu(struct list_head *new, struct list_head *head) 145{ 146 __list_add_rcu(new, head, head->next); 147} 148 149/** 150 * list_add_tail_rcu - add a new entry to rcu-protected list 151 * @new: new entry to be added 152 * @head: list head to add it before 153 * 154 * Insert a new entry before the specified head. 155 * This is useful for implementing queues. 156 * 157 * The caller must take whatever precautions are necessary 158 * (such as holding appropriate locks) to avoid racing 159 * with another list-mutation primitive, such as list_add_tail_rcu() 160 * or list_del_rcu(), running on this same list. 161 * However, it is perfectly legal to run concurrently with 162 * the _rcu list-traversal primitives, such as 163 * list_for_each_entry_rcu(). 164 */ 165static inline void list_add_tail_rcu(struct list_head *new, 166 struct list_head *head) 167{ 168 __list_add_rcu(new, head->prev, head); 169} 170 171/* 172 * Delete a list entry by making the prev/next entries 173 * point to each other. 174 * 175 * This is only for internal list manipulation where we know 176 * the prev/next entries already! 177 */ 178static inline void __list_del(struct list_head * prev, struct list_head * next) 179{ 180 next->prev = prev; 181 prev->next = next; 182} 183 184/** 185 * list_del - deletes entry from list. 186 * @entry: the element to delete from the list. 187 * Note: list_empty on entry does not return true after this, the entry is 188 * in an undefined state. 189 */ 190static inline void list_del(struct list_head *entry) 191{ 192 __list_del(entry->prev, entry->next); 193 entry->next = LIST_POISON1; 194 entry->prev = LIST_POISON2; 195} 196 197/** 198 * list_del_rcu - deletes entry from list without re-initialization 199 * @entry: the element to delete from the list. 200 * 201 * Note: list_empty on entry does not return true after this, 202 * the entry is in an undefined state. It is useful for RCU based 203 * lockfree traversal. 204 * 205 * In particular, it means that we can not poison the forward 206 * pointers that may still be used for walking the list. 207 * 208 * The caller must take whatever precautions are necessary 209 * (such as holding appropriate locks) to avoid racing 210 * with another list-mutation primitive, such as list_del_rcu() 211 * or list_add_rcu(), running on this same list. 212 * However, it is perfectly legal to run concurrently with 213 * the _rcu list-traversal primitives, such as 214 * list_for_each_entry_rcu(). 215 * 216 * Note that the caller is not permitted to immediately free 217 * the newly deleted entry. Instead, either synchronize_kernel() 218 * or call_rcu() must be used to defer freeing until an RCU 219 * grace period has elapsed. 220 */ 221static inline void list_del_rcu(struct list_head *entry) 222{ 223 __list_del(entry->prev, entry->next); 224 entry->prev = LIST_POISON2; 225} 226 227/** 228 * list_del_init - deletes entry from list and reinitialize it. 229 * @entry: the element to delete from the list. 230 */ 231static inline void list_del_init(struct list_head *entry) 232{ 233 __list_del(entry->prev, entry->next); 234 INIT_LIST_HEAD(entry); 235} 236 237/** 238 * list_move - delete from one list and add as another's head 239 * @list: the entry to move 240 * @head: the head that will precede our entry 241 */ 242static inline void list_move(struct list_head *list, struct list_head *head) 243{ 244 __list_del(list->prev, list->next); 245 list_add(list, head); 246} 247 248/** 249 * list_move_tail - delete from one list and add as another's tail 250 * @list: the entry to move 251 * @head: the head that will follow our entry 252 */ 253static inline void list_move_tail(struct list_head *list, 254 struct list_head *head) 255{ 256 __list_del(list->prev, list->next); 257 list_add_tail(list, head); 258} 259 260/** 261 * list_empty - tests whether a list is empty 262 * @head: the list to test. 263 */ 264static inline int list_empty(const struct list_head *head) 265{ 266 return head->next == head; 267} 268 269/** 270 * list_empty_careful - tests whether a list is 271 * empty _and_ checks that no other CPU might be 272 * in the process of still modifying either member 273 * 274 * NOTE: using list_empty_careful() without synchronization 275 * can only be safe if the only activity that can happen 276 * to the list entry is list_del_init(). Eg. it cannot be used 277 * if another CPU could re-list_add() it. 278 * 279 * @head: the list to test. 280 */ 281static inline int list_empty_careful(const struct list_head *head) 282{ 283 struct list_head *next = head->next; 284 return (next == head) && (next == head->prev); 285} 286 287static inline void __list_splice(struct list_head *list, 288 struct list_head *head) 289{ 290 struct list_head *first = list->next; 291 struct list_head *last = list->prev; 292 struct list_head *at = head->next; 293 294 first->prev = head; 295 head->next = first; 296 297 last->next = at; 298 at->prev = last; 299} 300 301/** 302 * list_splice - join two lists 303 * @list: the new list to add. 304 * @head: the place to add it in the first list. 305 */ 306static inline void list_splice(struct list_head *list, struct list_head *head) 307{ 308 if (!list_empty(list)) 309 __list_splice(list, head); 310} 311 312/** 313 * list_splice_init - join two lists and reinitialise the emptied list. 314 * @list: the new list to add. 315 * @head: the place to add it in the first list. 316 * 317 * The list at @list is reinitialised 318 */ 319static inline void list_splice_init(struct list_head *list, 320 struct list_head *head) 321{ 322 if (!list_empty(list)) { 323 __list_splice(list, head); 324 INIT_LIST_HEAD(list); 325 } 326} 327 328/** 329 * list_entry - get the struct for this entry 330 * @ptr: the &struct list_head pointer. 331 * @type: the type of the struct this is embedded in. 332 * @member: the name of the list_struct within the struct. 333 */ 334#define list_entry(ptr, type, member) \ 335 container_of(ptr, type, member) 336 337/** 338 * list_for_each - iterate over a list 339 * @pos: the &struct list_head to use as a loop counter. 340 * @head: the head for your list. 341 */ 342#define list_for_each(pos, head) \ 343 for (pos = (head)->next, prefetch(pos->next); pos != (head); \ 344 pos = pos->next, prefetch(pos->next)) 345 346/** 347 * __list_for_each - iterate over a list 348 * @pos: the &struct list_head to use as a loop counter. 349 * @head: the head for your list. 350 * 351 * This variant differs from list_for_each() in that it's the 352 * simplest possible list iteration code, no prefetching is done. 353 * Use this for code that knows the list to be very short (empty 354 * or 1 entry) most of the time. 355 */ 356#define __list_for_each(pos, head) \ 357 for (pos = (head)->next; pos != (head); pos = pos->next) 358 359/** 360 * list_for_each_prev - iterate over a list backwards 361 * @pos: the &struct list_head to use as a loop counter. 362 * @head: the head for your list. 363 */ 364#define list_for_each_prev(pos, head) \ 365 for (pos = (head)->prev, prefetch(pos->prev); pos != (head); \ 366 pos = pos->prev, prefetch(pos->prev)) 367 368/** 369 * list_for_each_safe - iterate over a list safe against removal of list entry 370 * @pos: the &struct list_head to use as a loop counter. 371 * @n: another &struct list_head to use as temporary storage 372 * @head: the head for your list. 373 */ 374#define list_for_each_safe(pos, n, head) \ 375 for (pos = (head)->next, n = pos->next; pos != (head); \ 376 pos = n, n = pos->next) 377 378/** 379 * list_for_each_entry - iterate over list of given type 380 * @pos: the type * to use as a loop counter. 381 * @head: the head for your list. 382 * @member: the name of the list_struct within the struct. 383 */ 384#define list_for_each_entry(pos, head, member) \ 385 for (pos = list_entry((head)->next, typeof(*pos), member), \ 386 prefetch(pos->member.next); \ 387 &pos->member != (head); \ 388 pos = list_entry(pos->member.next, typeof(*pos), member), \ 389 prefetch(pos->member.next)) 390 391/** 392 * list_for_each_entry_reverse - iterate backwards over list of given type. 393 * @pos: the type * to use as a loop counter. 394 * @head: the head for your list. 395 * @member: the name of the list_struct within the struct. 396 */ 397#define list_for_each_entry_reverse(pos, head, member) \ 398 for (pos = list_entry((head)->prev, typeof(*pos), member), \ 399 prefetch(pos->member.prev); \ 400 &pos->member != (head); \ 401 pos = list_entry(pos->member.prev, typeof(*pos), member), \ 402 prefetch(pos->member.prev)) 403 404/** 405 * list_prepare_entry - prepare a pos entry for use as a start point in 406 * list_for_each_entry_continue 407 * @pos: the type * to use as a start point 408 * @head: the head of the list 409 * @member: the name of the list_struct within the struct. 410 */ 411#define list_prepare_entry(pos, head, member) \ 412 ((pos) ? : list_entry(head, typeof(*pos), member)) 413 414/** 415 * list_for_each_entry_continue - iterate over list of given type 416 * continuing after existing point 417 * @pos: the type * to use as a loop counter. 418 * @head: the head for your list. 419 * @member: the name of the list_struct within the struct. 420 */ 421#define list_for_each_entry_continue(pos, head, member) \ 422 for (pos = list_entry(pos->member.next, typeof(*pos), member), \ 423 prefetch(pos->member.next); \ 424 &pos->member != (head); \ 425 pos = list_entry(pos->member.next, typeof(*pos), member), \ 426 prefetch(pos->member.next)) 427 428/** 429 * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry 430 * @pos: the type * to use as a loop counter. 431 * @n: another type * to use as temporary storage 432 * @head: the head for your list. 433 * @member: the name of the list_struct within the struct. 434 */ 435#define list_for_each_entry_safe(pos, n, head, member) \ 436 for (pos = list_entry((head)->next, typeof(*pos), member), \ 437 n = list_entry(pos->member.next, typeof(*pos), member); \ 438 &pos->member != (head); \ 439 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 440 441/** 442 * list_for_each_rcu - iterate over an rcu-protected list 443 * @pos: the &struct list_head to use as a loop counter. 444 * @head: the head for your list. 445 * 446 * This list-traversal primitive may safely run concurrently with 447 * the _rcu list-mutation primitives such as list_add_rcu() 448 * as long as the traversal is guarded by rcu_read_lock(). 449 */ 450#define list_for_each_rcu(pos, head) \ 451 for (pos = (head)->next, prefetch(pos->next); pos != (head); \ 452 pos = pos->next, ({ smp_read_barrier_depends(); 0;}), prefetch(pos->next)) 453 454#define __list_for_each_rcu(pos, head) \ 455 for (pos = (head)->next; pos != (head); \ 456 pos = pos->next, ({ smp_read_barrier_depends(); 0;})) 457 458/** 459 * list_for_each_safe_rcu - iterate over an rcu-protected list safe 460 * against removal of list entry 461 * @pos: the &struct list_head to use as a loop counter. 462 * @n: another &struct list_head to use as temporary storage 463 * @head: the head for your list. 464 * 465 * This list-traversal primitive may safely run concurrently with 466 * the _rcu list-mutation primitives such as list_add_rcu() 467 * as long as the traversal is guarded by rcu_read_lock(). 468 */ 469#define list_for_each_safe_rcu(pos, n, head) \ 470 for (pos = (head)->next, n = pos->next; pos != (head); \ 471 pos = n, ({ smp_read_barrier_depends(); 0;}), n = pos->next) 472 473/** 474 * list_for_each_entry_rcu - iterate over rcu list of given type 475 * @pos: the type * to use as a loop counter. 476 * @head: the head for your list. 477 * @member: the name of the list_struct within the struct. 478 * 479 * This list-traversal primitive may safely run concurrently with 480 * the _rcu list-mutation primitives such as list_add_rcu() 481 * as long as the traversal is guarded by rcu_read_lock(). 482 */ 483#define list_for_each_entry_rcu(pos, head, member) \ 484 for (pos = list_entry((head)->next, typeof(*pos), member), \ 485 prefetch(pos->member.next); \ 486 &pos->member != (head); \ 487 pos = list_entry(pos->member.next, typeof(*pos), member), \ 488 ({ smp_read_barrier_depends(); 0;}), \ 489 prefetch(pos->member.next)) 490 491 492/** 493 * list_for_each_continue_rcu - iterate over an rcu-protected list 494 * continuing after existing point. 495 * @pos: the &struct list_head to use as a loop counter. 496 * @head: the head for your list. 497 * 498 * This list-traversal primitive may safely run concurrently with 499 * the _rcu list-mutation primitives such as list_add_rcu() 500 * as long as the traversal is guarded by rcu_read_lock(). 501 */ 502#define list_for_each_continue_rcu(pos, head) \ 503 for ((pos) = (pos)->next, prefetch((pos)->next); (pos) != (head); \ 504 (pos) = (pos)->next, ({ smp_read_barrier_depends(); 0;}), prefetch((pos)->next)) 505 506/* 507 * Double linked lists with a single pointer list head. 508 * Mostly useful for hash tables where the two pointer list head is 509 * too wasteful. 510 * You lose the ability to access the tail in O(1). 511 */ 512 513struct hlist_head { 514 struct hlist_node *first; 515}; 516 517struct hlist_node { 518 struct hlist_node *next, **pprev; 519}; 520 521#define HLIST_HEAD_INIT { .first = NULL } 522#define HLIST_HEAD(name) struct hlist_head name = { .first = NULL } 523#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL) 524#define INIT_HLIST_NODE(ptr) ((ptr)->next = NULL, (ptr)->pprev = NULL) 525 526static inline int hlist_unhashed(const struct hlist_node *h) 527{ 528 return !h->pprev; 529} 530 531static inline int hlist_empty(const struct hlist_head *h) 532{ 533 return !h->first; 534} 535 536static inline void __hlist_del(struct hlist_node *n) 537{ 538 struct hlist_node *next = n->next; 539 struct hlist_node **pprev = n->pprev; 540 *pprev = next; 541 if (next) 542 next->pprev = pprev; 543} 544 545static inline void hlist_del(struct hlist_node *n) 546{ 547 __hlist_del(n); 548 n->next = LIST_POISON1; 549 n->pprev = LIST_POISON2; 550} 551 552/** 553 * hlist_del_rcu - deletes entry from hash list without re-initialization 554 * @n: the element to delete from the hash list. 555 * 556 * Note: list_unhashed() on entry does not return true after this, 557 * the entry is in an undefined state. It is useful for RCU based 558 * lockfree traversal. 559 * 560 * In particular, it means that we can not poison the forward 561 * pointers that may still be used for walking the hash list. 562 * 563 * The caller must take whatever precautions are necessary 564 * (such as holding appropriate locks) to avoid racing 565 * with another list-mutation primitive, such as hlist_add_head_rcu() 566 * or hlist_del_rcu(), running on this same list. 567 * However, it is perfectly legal to run concurrently with 568 * the _rcu list-traversal primitives, such as 569 * hlist_for_each_entry(). 570 */ 571static inline void hlist_del_rcu(struct hlist_node *n) 572{ 573 __hlist_del(n); 574 n->pprev = LIST_POISON2; 575} 576 577static inline void hlist_del_init(struct hlist_node *n) 578{ 579 if (n->pprev) { 580 __hlist_del(n); 581 INIT_HLIST_NODE(n); 582 } 583} 584 585#define hlist_del_rcu_init hlist_del_init 586 587static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) 588{ 589 struct hlist_node *first = h->first; 590 n->next = first; 591 if (first) 592 first->pprev = &n->next; 593 h->first = n; 594 n->pprev = &h->first; 595} 596 597 598/** 599 * hlist_add_head_rcu - adds the specified element to the specified hlist, 600 * while permitting racing traversals. 601 * @n: the element to add to the hash list. 602 * @h: the list to add to. 603 * 604 * The caller must take whatever precautions are necessary 605 * (such as holding appropriate locks) to avoid racing 606 * with another list-mutation primitive, such as hlist_add_head_rcu() 607 * or hlist_del_rcu(), running on this same list. 608 * However, it is perfectly legal to run concurrently with 609 * the _rcu list-traversal primitives, such as 610 * hlist_for_each_entry(), but only if smp_read_barrier_depends() 611 * is used to prevent memory-consistency problems on Alpha CPUs. 612 * Regardless of the type of CPU, the list-traversal primitive 613 * must be guarded by rcu_read_lock(). 614 * 615 * OK, so why don't we have an hlist_for_each_entry_rcu()??? 616 */ 617static inline void hlist_add_head_rcu(struct hlist_node *n, 618 struct hlist_head *h) 619{ 620 struct hlist_node *first = h->first; 621 n->next = first; 622 n->pprev = &h->first; 623 smp_wmb(); 624 if (first) 625 first->pprev = &n->next; 626 h->first = n; 627} 628 629/* next must be != NULL */ 630static inline void hlist_add_before(struct hlist_node *n, 631 struct hlist_node *next) 632{ 633 n->pprev = next->pprev; 634 n->next = next; 635 next->pprev = &n->next; 636 *(n->pprev) = n; 637} 638 639static inline void hlist_add_after(struct hlist_node *n, 640 struct hlist_node *next) 641{ 642 next->next = n->next; 643 n->next = next; 644 next->pprev = &n->next; 645 646 if(next->next) 647 next->next->pprev = &next->next; 648} 649 650#define hlist_entry(ptr, type, member) container_of(ptr,type,member) 651 652#define hlist_for_each(pos, head) \ 653 for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \ 654 pos = pos->next) 655 656#define hlist_for_each_safe(pos, n, head) \ 657 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \ 658 pos = n) 659 660/** 661 * hlist_for_each_entry - iterate over list of given type 662 * @tpos: the type * to use as a loop counter. 663 * @pos: the &struct hlist_node to use as a loop counter. 664 * @head: the head for your list. 665 * @member: the name of the hlist_node within the struct. 666 */ 667#define hlist_for_each_entry(tpos, pos, head, member) \ 668 for (pos = (head)->first; \ 669 pos && ({ prefetch(pos->next); 1;}) && \ 670 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 671 pos = pos->next) 672 673/** 674 * hlist_for_each_entry_continue - iterate over a hlist continuing after existing point 675 * @tpos: the type * to use as a loop counter. 676 * @pos: the &struct hlist_node to use as a loop counter. 677 * @member: the name of the hlist_node within the struct. 678 */ 679#define hlist_for_each_entry_continue(tpos, pos, member) \ 680 for (pos = (pos)->next; \ 681 pos && ({ prefetch(pos->next); 1;}) && \ 682 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 683 pos = pos->next) 684 685/** 686 * hlist_for_each_entry_from - iterate over a hlist continuing from existing point 687 * @tpos: the type * to use as a loop counter. 688 * @pos: the &struct hlist_node to use as a loop counter. 689 * @member: the name of the hlist_node within the struct. 690 */ 691#define hlist_for_each_entry_from(tpos, pos, member) \ 692 for (; pos && ({ prefetch(pos->next); 1;}) && \ 693 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 694 pos = pos->next) 695 696/** 697 * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry 698 * @tpos: the type * to use as a loop counter. 699 * @pos: the &struct hlist_node to use as a loop counter. 700 * @n: another &struct hlist_node to use as temporary storage 701 * @head: the head for your list. 702 * @member: the name of the hlist_node within the struct. 703 */ 704#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \ 705 for (pos = (head)->first; \ 706 pos && ({ n = pos->next; 1; }) && \ 707 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 708 pos = n) 709 710/** 711 * hlist_for_each_entry_rcu - iterate over rcu list of given type 712 * @pos: the type * to use as a loop counter. 713 * @pos: the &struct hlist_node to use as a loop counter. 714 * @head: the head for your list. 715 * @member: the name of the hlist_node within the struct. 716 * 717 * This list-traversal primitive may safely run concurrently with 718 * the _rcu list-mutation primitives such as hlist_add_rcu() 719 * as long as the traversal is guarded by rcu_read_lock(). 720 */ 721#define hlist_for_each_entry_rcu(tpos, pos, head, member) \ 722 for (pos = (head)->first; \ 723 pos && ({ prefetch(pos->next); 1;}) && \ 724 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 725 pos = pos->next, ({ smp_read_barrier_depends(); 0; }) ) 726 727#endif 728