diff options
Diffstat (limited to 'include/linux/list.h')
| -rw-r--r-- | include/linux/list.h | 169 |
1 files changed, 105 insertions, 64 deletions
diff --git a/include/linux/list.h b/include/linux/list.h index a02642e4710a..a9c90287c0ff 100644 --- a/include/linux/list.h +++ b/include/linux/list.h | |||
| @@ -4,18 +4,11 @@ | |||
| 4 | #ifdef __KERNEL__ | 4 | #ifdef __KERNEL__ |
| 5 | 5 | ||
| 6 | #include <linux/stddef.h> | 6 | #include <linux/stddef.h> |
| 7 | #include <linux/poison.h> | ||
| 7 | #include <linux/prefetch.h> | 8 | #include <linux/prefetch.h> |
| 8 | #include <asm/system.h> | 9 | #include <asm/system.h> |
| 9 | 10 | ||
| 10 | /* | 11 | /* |
| 11 | * These are non-NULL pointers that will result in page faults | ||
| 12 | * under normal circumstances, used to verify that nobody uses | ||
| 13 | * non-initialized list entries. | ||
| 14 | */ | ||
| 15 | #define LIST_POISON1 ((void *) 0x00100100) | ||
| 16 | #define LIST_POISON2 ((void *) 0x00200200) | ||
| 17 | |||
| 18 | /* | ||
| 19 | * Simple doubly linked list implementation. | 12 | * Simple doubly linked list implementation. |
| 20 | * | 13 | * |
| 21 | * Some of the internal functions ("__xxx") are useful when | 14 | * Some of the internal functions ("__xxx") are useful when |
| @@ -46,6 +39,7 @@ static inline void INIT_LIST_HEAD(struct list_head *list) | |||
| 46 | * This is only for internal list manipulation where we know | 39 | * This is only for internal list manipulation where we know |
| 47 | * the prev/next entries already! | 40 | * the prev/next entries already! |
| 48 | */ | 41 | */ |
| 42 | #ifndef CONFIG_DEBUG_LIST | ||
| 49 | static inline void __list_add(struct list_head *new, | 43 | static inline void __list_add(struct list_head *new, |
| 50 | struct list_head *prev, | 44 | struct list_head *prev, |
| 51 | struct list_head *next) | 45 | struct list_head *next) |
| @@ -55,6 +49,11 @@ static inline void __list_add(struct list_head *new, | |||
| 55 | new->prev = prev; | 49 | new->prev = prev; |
| 56 | prev->next = new; | 50 | prev->next = new; |
| 57 | } | 51 | } |
| 52 | #else | ||
| 53 | extern void __list_add(struct list_head *new, | ||
| 54 | struct list_head *prev, | ||
| 55 | struct list_head *next); | ||
| 56 | #endif | ||
| 58 | 57 | ||
| 59 | /** | 58 | /** |
| 60 | * list_add - add a new entry | 59 | * list_add - add a new entry |
| @@ -64,10 +63,15 @@ static inline void __list_add(struct list_head *new, | |||
| 64 | * Insert a new entry after the specified head. | 63 | * Insert a new entry after the specified head. |
| 65 | * This is good for implementing stacks. | 64 | * This is good for implementing stacks. |
| 66 | */ | 65 | */ |
| 66 | #ifndef CONFIG_DEBUG_LIST | ||
| 67 | static inline void list_add(struct list_head *new, struct list_head *head) | 67 | static inline void list_add(struct list_head *new, struct list_head *head) |
| 68 | { | 68 | { |
| 69 | __list_add(new, head, head->next); | 69 | __list_add(new, head, head->next); |
| 70 | } | 70 | } |
| 71 | #else | ||
| 72 | extern void list_add(struct list_head *new, struct list_head *head); | ||
| 73 | #endif | ||
| 74 | |||
| 71 | 75 | ||
| 72 | /** | 76 | /** |
| 73 | * list_add_tail - add a new entry | 77 | * list_add_tail - add a new entry |
| @@ -160,12 +164,16 @@ static inline void __list_del(struct list_head * prev, struct list_head * next) | |||
| 160 | * Note: list_empty on entry does not return true after this, the entry is | 164 | * Note: list_empty on entry does not return true after this, the entry is |
| 161 | * in an undefined state. | 165 | * in an undefined state. |
| 162 | */ | 166 | */ |
| 167 | #ifndef CONFIG_DEBUG_LIST | ||
| 163 | static inline void list_del(struct list_head *entry) | 168 | static inline void list_del(struct list_head *entry) |
| 164 | { | 169 | { |
| 165 | __list_del(entry->prev, entry->next); | 170 | __list_del(entry->prev, entry->next); |
| 166 | entry->next = LIST_POISON1; | 171 | entry->next = LIST_POISON1; |
| 167 | entry->prev = LIST_POISON2; | 172 | entry->prev = LIST_POISON2; |
| 168 | } | 173 | } |
| 174 | #else | ||
| 175 | extern void list_del(struct list_head *entry); | ||
| 176 | #endif | ||
| 169 | 177 | ||
| 170 | /** | 178 | /** |
| 171 | * list_del_rcu - deletes entry from list without re-initialization | 179 | * list_del_rcu - deletes entry from list without re-initialization |
| @@ -272,6 +280,17 @@ static inline void list_move_tail(struct list_head *list, | |||
| 272 | } | 280 | } |
| 273 | 281 | ||
| 274 | /** | 282 | /** |
| 283 | * list_is_last - tests whether @list is the last entry in list @head | ||
| 284 | * @list: the entry to test | ||
| 285 | * @head: the head of the list | ||
| 286 | */ | ||
| 287 | static inline int list_is_last(const struct list_head *list, | ||
| 288 | const struct list_head *head) | ||
| 289 | { | ||
| 290 | return list->next == head; | ||
| 291 | } | ||
| 292 | |||
| 293 | /** | ||
| 275 | * list_empty - tests whether a list is empty | 294 | * list_empty - tests whether a list is empty |
| 276 | * @head: the list to test. | 295 | * @head: the list to test. |
| 277 | */ | 296 | */ |
| @@ -281,16 +300,17 @@ static inline int list_empty(const struct list_head *head) | |||
| 281 | } | 300 | } |
| 282 | 301 | ||
| 283 | /** | 302 | /** |
| 284 | * list_empty_careful - tests whether a list is | 303 | * list_empty_careful - tests whether a list is empty and not being modified |
| 285 | * empty _and_ checks that no other CPU might be | 304 | * @head: the list to test |
| 286 | * in the process of still modifying either member | 305 | * |
| 306 | * Description: | ||
| 307 | * tests whether a list is empty _and_ checks that no other CPU might be | ||
| 308 | * in the process of modifying either member (next or prev) | ||
| 287 | * | 309 | * |
| 288 | * NOTE: using list_empty_careful() without synchronization | 310 | * NOTE: using list_empty_careful() without synchronization |
| 289 | * can only be safe if the only activity that can happen | 311 | * can only be safe if the only activity that can happen |
| 290 | * to the list entry is list_del_init(). Eg. it cannot be used | 312 | * to the list entry is list_del_init(). Eg. it cannot be used |
| 291 | * if another CPU could re-list_add() it. | 313 | * if another CPU could re-list_add() it. |
| 292 | * | ||
| 293 | * @head: the list to test. | ||
| 294 | */ | 314 | */ |
| 295 | static inline int list_empty_careful(const struct list_head *head) | 315 | static inline int list_empty_careful(const struct list_head *head) |
| 296 | { | 316 | { |
| @@ -350,7 +370,7 @@ static inline void list_splice_init(struct list_head *list, | |||
| 350 | 370 | ||
| 351 | /** | 371 | /** |
| 352 | * list_for_each - iterate over a list | 372 | * list_for_each - iterate over a list |
| 353 | * @pos: the &struct list_head to use as a loop counter. | 373 | * @pos: the &struct list_head to use as a loop cursor. |
| 354 | * @head: the head for your list. | 374 | * @head: the head for your list. |
| 355 | */ | 375 | */ |
| 356 | #define list_for_each(pos, head) \ | 376 | #define list_for_each(pos, head) \ |
| @@ -359,7 +379,7 @@ static inline void list_splice_init(struct list_head *list, | |||
| 359 | 379 | ||
| 360 | /** | 380 | /** |
| 361 | * __list_for_each - iterate over a list | 381 | * __list_for_each - iterate over a list |
| 362 | * @pos: the &struct list_head to use as a loop counter. | 382 | * @pos: the &struct list_head to use as a loop cursor. |
| 363 | * @head: the head for your list. | 383 | * @head: the head for your list. |
| 364 | * | 384 | * |
| 365 | * This variant differs from list_for_each() in that it's the | 385 | * This variant differs from list_for_each() in that it's the |
| @@ -372,7 +392,7 @@ static inline void list_splice_init(struct list_head *list, | |||
| 372 | 392 | ||
| 373 | /** | 393 | /** |
| 374 | * list_for_each_prev - iterate over a list backwards | 394 | * list_for_each_prev - iterate over a list backwards |
| 375 | * @pos: the &struct list_head to use as a loop counter. | 395 | * @pos: the &struct list_head to use as a loop cursor. |
| 376 | * @head: the head for your list. | 396 | * @head: the head for your list. |
| 377 | */ | 397 | */ |
| 378 | #define list_for_each_prev(pos, head) \ | 398 | #define list_for_each_prev(pos, head) \ |
| @@ -380,8 +400,8 @@ static inline void list_splice_init(struct list_head *list, | |||
| 380 | pos = pos->prev) | 400 | pos = pos->prev) |
| 381 | 401 | ||
| 382 | /** | 402 | /** |
| 383 | * list_for_each_safe - iterate over a list safe against removal of list entry | 403 | * list_for_each_safe - iterate over a list safe against removal of list entry |
| 384 | * @pos: the &struct list_head to use as a loop counter. | 404 | * @pos: the &struct list_head to use as a loop cursor. |
| 385 | * @n: another &struct list_head to use as temporary storage | 405 | * @n: another &struct list_head to use as temporary storage |
| 386 | * @head: the head for your list. | 406 | * @head: the head for your list. |
| 387 | */ | 407 | */ |
| @@ -391,7 +411,7 @@ static inline void list_splice_init(struct list_head *list, | |||
| 391 | 411 | ||
| 392 | /** | 412 | /** |
| 393 | * list_for_each_entry - iterate over list of given type | 413 | * list_for_each_entry - iterate over list of given type |
| 394 | * @pos: the type * to use as a loop counter. | 414 | * @pos: the type * to use as a loop cursor. |
| 395 | * @head: the head for your list. | 415 | * @head: the head for your list. |
| 396 | * @member: the name of the list_struct within the struct. | 416 | * @member: the name of the list_struct within the struct. |
| 397 | */ | 417 | */ |
| @@ -402,7 +422,7 @@ static inline void list_splice_init(struct list_head *list, | |||
| 402 | 422 | ||
| 403 | /** | 423 | /** |
| 404 | * list_for_each_entry_reverse - iterate backwards over list of given type. | 424 | * list_for_each_entry_reverse - iterate backwards over list of given type. |
| 405 | * @pos: the type * to use as a loop counter. | 425 | * @pos: the type * to use as a loop cursor. |
| 406 | * @head: the head for your list. | 426 | * @head: the head for your list. |
| 407 | * @member: the name of the list_struct within the struct. | 427 | * @member: the name of the list_struct within the struct. |
| 408 | */ | 428 | */ |
| @@ -412,21 +432,24 @@ static inline void list_splice_init(struct list_head *list, | |||
| 412 | pos = list_entry(pos->member.prev, typeof(*pos), member)) | 432 | pos = list_entry(pos->member.prev, typeof(*pos), member)) |
| 413 | 433 | ||
| 414 | /** | 434 | /** |
| 415 | * list_prepare_entry - prepare a pos entry for use as a start point in | 435 | * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue |
| 416 | * list_for_each_entry_continue | ||
| 417 | * @pos: the type * to use as a start point | 436 | * @pos: the type * to use as a start point |
| 418 | * @head: the head of the list | 437 | * @head: the head of the list |
| 419 | * @member: the name of the list_struct within the struct. | 438 | * @member: the name of the list_struct within the struct. |
| 439 | * | ||
| 440 | * Prepares a pos entry for use as a start point in list_for_each_entry_continue. | ||
| 420 | */ | 441 | */ |
| 421 | #define list_prepare_entry(pos, head, member) \ | 442 | #define list_prepare_entry(pos, head, member) \ |
| 422 | ((pos) ? : list_entry(head, typeof(*pos), member)) | 443 | ((pos) ? : list_entry(head, typeof(*pos), member)) |
| 423 | 444 | ||
| 424 | /** | 445 | /** |
| 425 | * list_for_each_entry_continue - iterate over list of given type | 446 | * list_for_each_entry_continue - continue iteration over list of given type |
| 426 | * continuing after existing point | 447 | * @pos: the type * to use as a loop cursor. |
| 427 | * @pos: the type * to use as a loop counter. | ||
| 428 | * @head: the head for your list. | 448 | * @head: the head for your list. |
| 429 | * @member: the name of the list_struct within the struct. | 449 | * @member: the name of the list_struct within the struct. |
| 450 | * | ||
| 451 | * Continue to iterate over list of given type, continuing after | ||
| 452 | * the current position. | ||
| 430 | */ | 453 | */ |
| 431 | #define list_for_each_entry_continue(pos, head, member) \ | 454 | #define list_for_each_entry_continue(pos, head, member) \ |
| 432 | for (pos = list_entry(pos->member.next, typeof(*pos), member); \ | 455 | for (pos = list_entry(pos->member.next, typeof(*pos), member); \ |
| @@ -434,11 +457,12 @@ static inline void list_splice_init(struct list_head *list, | |||
| 434 | pos = list_entry(pos->member.next, typeof(*pos), member)) | 457 | pos = list_entry(pos->member.next, typeof(*pos), member)) |
| 435 | 458 | ||
| 436 | /** | 459 | /** |
| 437 | * list_for_each_entry_from - iterate over list of given type | 460 | * list_for_each_entry_from - iterate over list of given type from the current point |
| 438 | * continuing from existing point | 461 | * @pos: the type * to use as a loop cursor. |
| 439 | * @pos: the type * to use as a loop counter. | ||
| 440 | * @head: the head for your list. | 462 | * @head: the head for your list. |
| 441 | * @member: the name of the list_struct within the struct. | 463 | * @member: the name of the list_struct within the struct. |
| 464 | * | ||
| 465 | * Iterate over list of given type, continuing from current position. | ||
| 442 | */ | 466 | */ |
| 443 | #define list_for_each_entry_from(pos, head, member) \ | 467 | #define list_for_each_entry_from(pos, head, member) \ |
| 444 | for (; prefetch(pos->member.next), &pos->member != (head); \ | 468 | for (; prefetch(pos->member.next), &pos->member != (head); \ |
| @@ -446,7 +470,7 @@ static inline void list_splice_init(struct list_head *list, | |||
| 446 | 470 | ||
| 447 | /** | 471 | /** |
| 448 | * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry | 472 | * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry |
| 449 | * @pos: the type * to use as a loop counter. | 473 | * @pos: the type * to use as a loop cursor. |
| 450 | * @n: another type * to use as temporary storage | 474 | * @n: another type * to use as temporary storage |
| 451 | * @head: the head for your list. | 475 | * @head: the head for your list. |
| 452 | * @member: the name of the list_struct within the struct. | 476 | * @member: the name of the list_struct within the struct. |
| @@ -458,12 +482,14 @@ static inline void list_splice_init(struct list_head *list, | |||
| 458 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) | 482 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) |
| 459 | 483 | ||
| 460 | /** | 484 | /** |
| 461 | * list_for_each_entry_safe_continue - iterate over list of given type | 485 | * list_for_each_entry_safe_continue |
| 462 | * continuing after existing point safe against removal of list entry | 486 | * @pos: the type * to use as a loop cursor. |
| 463 | * @pos: the type * to use as a loop counter. | ||
| 464 | * @n: another type * to use as temporary storage | 487 | * @n: another type * to use as temporary storage |
| 465 | * @head: the head for your list. | 488 | * @head: the head for your list. |
| 466 | * @member: the name of the list_struct within the struct. | 489 | * @member: the name of the list_struct within the struct. |
| 490 | * | ||
| 491 | * Iterate over list of given type, continuing after current point, | ||
| 492 | * safe against removal of list entry. | ||
| 467 | */ | 493 | */ |
| 468 | #define list_for_each_entry_safe_continue(pos, n, head, member) \ | 494 | #define list_for_each_entry_safe_continue(pos, n, head, member) \ |
| 469 | for (pos = list_entry(pos->member.next, typeof(*pos), member), \ | 495 | for (pos = list_entry(pos->member.next, typeof(*pos), member), \ |
| @@ -472,12 +498,14 @@ static inline void list_splice_init(struct list_head *list, | |||
| 472 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) | 498 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) |
| 473 | 499 | ||
| 474 | /** | 500 | /** |
| 475 | * list_for_each_entry_safe_from - iterate over list of given type | 501 | * list_for_each_entry_safe_from |
| 476 | * from existing point safe against removal of list entry | 502 | * @pos: the type * to use as a loop cursor. |
| 477 | * @pos: the type * to use as a loop counter. | ||
| 478 | * @n: another type * to use as temporary storage | 503 | * @n: another type * to use as temporary storage |
| 479 | * @head: the head for your list. | 504 | * @head: the head for your list. |
| 480 | * @member: the name of the list_struct within the struct. | 505 | * @member: the name of the list_struct within the struct. |
| 506 | * | ||
| 507 | * Iterate over list of given type from current point, safe against | ||
| 508 | * removal of list entry. | ||
| 481 | */ | 509 | */ |
| 482 | #define list_for_each_entry_safe_from(pos, n, head, member) \ | 510 | #define list_for_each_entry_safe_from(pos, n, head, member) \ |
| 483 | for (n = list_entry(pos->member.next, typeof(*pos), member); \ | 511 | for (n = list_entry(pos->member.next, typeof(*pos), member); \ |
| @@ -485,12 +513,14 @@ static inline void list_splice_init(struct list_head *list, | |||
| 485 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) | 513 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) |
| 486 | 514 | ||
| 487 | /** | 515 | /** |
| 488 | * list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against | 516 | * list_for_each_entry_safe_reverse |
| 489 | * removal of list entry | 517 | * @pos: the type * to use as a loop cursor. |
| 490 | * @pos: the type * to use as a loop counter. | ||
| 491 | * @n: another type * to use as temporary storage | 518 | * @n: another type * to use as temporary storage |
| 492 | * @head: the head for your list. | 519 | * @head: the head for your list. |
| 493 | * @member: the name of the list_struct within the struct. | 520 | * @member: the name of the list_struct within the struct. |
| 521 | * | ||
| 522 | * Iterate backwards over list of given type, safe against removal | ||
| 523 | * of list entry. | ||
| 494 | */ | 524 | */ |
| 495 | #define list_for_each_entry_safe_reverse(pos, n, head, member) \ | 525 | #define list_for_each_entry_safe_reverse(pos, n, head, member) \ |
| 496 | for (pos = list_entry((head)->prev, typeof(*pos), member), \ | 526 | for (pos = list_entry((head)->prev, typeof(*pos), member), \ |
| @@ -500,7 +530,7 @@ static inline void list_splice_init(struct list_head *list, | |||
| 500 | 530 | ||
| 501 | /** | 531 | /** |
| 502 | * list_for_each_rcu - iterate over an rcu-protected list | 532 | * list_for_each_rcu - iterate over an rcu-protected list |
| 503 | * @pos: the &struct list_head to use as a loop counter. | 533 | * @pos: the &struct list_head to use as a loop cursor. |
| 504 | * @head: the head for your list. | 534 | * @head: the head for your list. |
| 505 | * | 535 | * |
| 506 | * This list-traversal primitive may safely run concurrently with | 536 | * This list-traversal primitive may safely run concurrently with |
| @@ -518,12 +548,13 @@ static inline void list_splice_init(struct list_head *list, | |||
| 518 | pos = pos->next) | 548 | pos = pos->next) |
| 519 | 549 | ||
| 520 | /** | 550 | /** |
| 521 | * list_for_each_safe_rcu - iterate over an rcu-protected list safe | 551 | * list_for_each_safe_rcu |
| 522 | * against removal of list entry | 552 | * @pos: the &struct list_head to use as a loop cursor. |
| 523 | * @pos: the &struct list_head to use as a loop counter. | ||
| 524 | * @n: another &struct list_head to use as temporary storage | 553 | * @n: another &struct list_head to use as temporary storage |
| 525 | * @head: the head for your list. | 554 | * @head: the head for your list. |
| 526 | * | 555 | * |
| 556 | * Iterate over an rcu-protected list, safe against removal of list entry. | ||
| 557 | * | ||
| 527 | * This list-traversal primitive may safely run concurrently with | 558 | * This list-traversal primitive may safely run concurrently with |
| 528 | * the _rcu list-mutation primitives such as list_add_rcu() | 559 | * the _rcu list-mutation primitives such as list_add_rcu() |
| 529 | * as long as the traversal is guarded by rcu_read_lock(). | 560 | * as long as the traversal is guarded by rcu_read_lock(). |
| @@ -535,7 +566,7 @@ static inline void list_splice_init(struct list_head *list, | |||
| 535 | 566 | ||
| 536 | /** | 567 | /** |
| 537 | * list_for_each_entry_rcu - iterate over rcu list of given type | 568 | * list_for_each_entry_rcu - iterate over rcu list of given type |
| 538 | * @pos: the type * to use as a loop counter. | 569 | * @pos: the type * to use as a loop cursor. |
| 539 | * @head: the head for your list. | 570 | * @head: the head for your list. |
| 540 | * @member: the name of the list_struct within the struct. | 571 | * @member: the name of the list_struct within the struct. |
| 541 | * | 572 | * |
| @@ -551,11 +582,12 @@ static inline void list_splice_init(struct list_head *list, | |||
| 551 | 582 | ||
| 552 | 583 | ||
| 553 | /** | 584 | /** |
| 554 | * list_for_each_continue_rcu - iterate over an rcu-protected list | 585 | * list_for_each_continue_rcu |
| 555 | * continuing after existing point. | 586 | * @pos: the &struct list_head to use as a loop cursor. |
| 556 | * @pos: the &struct list_head to use as a loop counter. | ||
| 557 | * @head: the head for your list. | 587 | * @head: the head for your list. |
| 558 | * | 588 | * |
| 589 | * Iterate over an rcu-protected list, continuing after current point. | ||
| 590 | * | ||
| 559 | * This list-traversal primitive may safely run concurrently with | 591 | * This list-traversal primitive may safely run concurrently with |
| 560 | * the _rcu list-mutation primitives such as list_add_rcu() | 592 | * the _rcu list-mutation primitives such as list_add_rcu() |
| 561 | * as long as the traversal is guarded by rcu_read_lock(). | 593 | * as long as the traversal is guarded by rcu_read_lock(). |
| @@ -681,11 +713,14 @@ static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) | |||
| 681 | 713 | ||
| 682 | 714 | ||
| 683 | /** | 715 | /** |
| 684 | * hlist_add_head_rcu - adds the specified element to the specified hlist, | 716 | * hlist_add_head_rcu |
| 685 | * while permitting racing traversals. | ||
| 686 | * @n: the element to add to the hash list. | 717 | * @n: the element to add to the hash list. |
| 687 | * @h: the list to add to. | 718 | * @h: the list to add to. |
| 688 | * | 719 | * |
| 720 | * Description: | ||
| 721 | * Adds the specified element to the specified hlist, | ||
| 722 | * while permitting racing traversals. | ||
| 723 | * | ||
| 689 | * The caller must take whatever precautions are necessary | 724 | * The caller must take whatever precautions are necessary |
| 690 | * (such as holding appropriate locks) to avoid racing | 725 | * (such as holding appropriate locks) to avoid racing |
| 691 | * with another list-mutation primitive, such as hlist_add_head_rcu() | 726 | * with another list-mutation primitive, such as hlist_add_head_rcu() |
| @@ -730,11 +765,14 @@ static inline void hlist_add_after(struct hlist_node *n, | |||
| 730 | } | 765 | } |
| 731 | 766 | ||
| 732 | /** | 767 | /** |
| 733 | * hlist_add_before_rcu - adds the specified element to the specified hlist | 768 | * hlist_add_before_rcu |
| 734 | * before the specified node while permitting racing traversals. | ||
| 735 | * @n: the new element to add to the hash list. | 769 | * @n: the new element to add to the hash list. |
| 736 | * @next: the existing element to add the new element before. | 770 | * @next: the existing element to add the new element before. |
| 737 | * | 771 | * |
| 772 | * Description: | ||
| 773 | * Adds the specified element to the specified hlist | ||
| 774 | * before the specified node while permitting racing traversals. | ||
| 775 | * | ||
| 738 | * The caller must take whatever precautions are necessary | 776 | * The caller must take whatever precautions are necessary |
| 739 | * (such as holding appropriate locks) to avoid racing | 777 | * (such as holding appropriate locks) to avoid racing |
| 740 | * with another list-mutation primitive, such as hlist_add_head_rcu() | 778 | * with another list-mutation primitive, such as hlist_add_head_rcu() |
| @@ -755,11 +793,14 @@ static inline void hlist_add_before_rcu(struct hlist_node *n, | |||
| 755 | } | 793 | } |
| 756 | 794 | ||
| 757 | /** | 795 | /** |
| 758 | * hlist_add_after_rcu - adds the specified element to the specified hlist | 796 | * hlist_add_after_rcu |
| 759 | * after the specified node while permitting racing traversals. | ||
| 760 | * @prev: the existing element to add the new element after. | 797 | * @prev: the existing element to add the new element after. |
| 761 | * @n: the new element to add to the hash list. | 798 | * @n: the new element to add to the hash list. |
| 762 | * | 799 | * |
| 800 | * Description: | ||
| 801 | * Adds the specified element to the specified hlist | ||
| 802 | * after the specified node while permitting racing traversals. | ||
| 803 | * | ||
| 763 | * The caller must take whatever precautions are necessary | 804 | * The caller must take whatever precautions are necessary |
| 764 | * (such as holding appropriate locks) to avoid racing | 805 | * (such as holding appropriate locks) to avoid racing |
| 765 | * with another list-mutation primitive, such as hlist_add_head_rcu() | 806 | * with another list-mutation primitive, such as hlist_add_head_rcu() |
| @@ -792,8 +833,8 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev, | |||
| 792 | 833 | ||
| 793 | /** | 834 | /** |
| 794 | * hlist_for_each_entry - iterate over list of given type | 835 | * hlist_for_each_entry - iterate over list of given type |
| 795 | * @tpos: the type * to use as a loop counter. | 836 | * @tpos: the type * to use as a loop cursor. |
| 796 | * @pos: the &struct hlist_node to use as a loop counter. | 837 | * @pos: the &struct hlist_node to use as a loop cursor. |
| 797 | * @head: the head for your list. | 838 | * @head: the head for your list. |
| 798 | * @member: the name of the hlist_node within the struct. | 839 | * @member: the name of the hlist_node within the struct. |
| 799 | */ | 840 | */ |
| @@ -804,9 +845,9 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev, | |||
| 804 | pos = pos->next) | 845 | pos = pos->next) |
| 805 | 846 | ||
| 806 | /** | 847 | /** |
| 807 | * hlist_for_each_entry_continue - iterate over a hlist continuing after existing point | 848 | * hlist_for_each_entry_continue - iterate over a hlist continuing after current point |
| 808 | * @tpos: the type * to use as a loop counter. | 849 | * @tpos: the type * to use as a loop cursor. |
| 809 | * @pos: the &struct hlist_node to use as a loop counter. | 850 | * @pos: the &struct hlist_node to use as a loop cursor. |
| 810 | * @member: the name of the hlist_node within the struct. | 851 | * @member: the name of the hlist_node within the struct. |
| 811 | */ | 852 | */ |
| 812 | #define hlist_for_each_entry_continue(tpos, pos, member) \ | 853 | #define hlist_for_each_entry_continue(tpos, pos, member) \ |
| @@ -816,9 +857,9 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev, | |||
| 816 | pos = pos->next) | 857 | pos = pos->next) |
| 817 | 858 | ||
| 818 | /** | 859 | /** |
| 819 | * hlist_for_each_entry_from - iterate over a hlist continuing from existing point | 860 | * hlist_for_each_entry_from - iterate over a hlist continuing from current point |
| 820 | * @tpos: the type * to use as a loop counter. | 861 | * @tpos: the type * to use as a loop cursor. |
| 821 | * @pos: the &struct hlist_node to use as a loop counter. | 862 | * @pos: the &struct hlist_node to use as a loop cursor. |
| 822 | * @member: the name of the hlist_node within the struct. | 863 | * @member: the name of the hlist_node within the struct. |
| 823 | */ | 864 | */ |
| 824 | #define hlist_for_each_entry_from(tpos, pos, member) \ | 865 | #define hlist_for_each_entry_from(tpos, pos, member) \ |
| @@ -828,8 +869,8 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev, | |||
| 828 | 869 | ||
| 829 | /** | 870 | /** |
| 830 | * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry | 871 | * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry |
| 831 | * @tpos: the type * to use as a loop counter. | 872 | * @tpos: the type * to use as a loop cursor. |
| 832 | * @pos: the &struct hlist_node to use as a loop counter. | 873 | * @pos: the &struct hlist_node to use as a loop cursor. |
| 833 | * @n: another &struct hlist_node to use as temporary storage | 874 | * @n: another &struct hlist_node to use as temporary storage |
| 834 | * @head: the head for your list. | 875 | * @head: the head for your list. |
| 835 | * @member: the name of the hlist_node within the struct. | 876 | * @member: the name of the hlist_node within the struct. |
| @@ -842,8 +883,8 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev, | |||
| 842 | 883 | ||
| 843 | /** | 884 | /** |
| 844 | * hlist_for_each_entry_rcu - iterate over rcu list of given type | 885 | * hlist_for_each_entry_rcu - iterate over rcu list of given type |
| 845 | * @tpos: the type * to use as a loop counter. | 886 | * @tpos: the type * to use as a loop cursor. |
| 846 | * @pos: the &struct hlist_node to use as a loop counter. | 887 | * @pos: the &struct hlist_node to use as a loop cursor. |
| 847 | * @head: the head for your list. | 888 | * @head: the head for your list. |
| 848 | * @member: the name of the hlist_node within the struct. | 889 | * @member: the name of the hlist_node within the struct. |
| 849 | * | 890 | * |
