diff options
Diffstat (limited to 'include/linux/list.h')
-rw-r--r-- | include/linux/list.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/list.h b/include/linux/list.h index 47208bd99f9e..67258b47e9ca 100644 --- a/include/linux/list.h +++ b/include/linux/list.h | |||
@@ -411,6 +411,17 @@ static inline void list_splice_init(struct list_head *list, | |||
411 | pos = list_entry(pos->member.next, typeof(*pos), member)) | 411 | pos = list_entry(pos->member.next, typeof(*pos), member)) |
412 | 412 | ||
413 | /** | 413 | /** |
414 | * list_for_each_entry_from - iterate over list of given type | ||
415 | * continuing from existing point | ||
416 | * @pos: the type * to use as a loop counter. | ||
417 | * @head: the head for your list. | ||
418 | * @member: the name of the list_struct within the struct. | ||
419 | */ | ||
420 | #define list_for_each_entry_from(pos, head, member) \ | ||
421 | for (; prefetch(pos->member.next), &pos->member != (head); \ | ||
422 | pos = list_entry(pos->member.next, typeof(*pos), member)) | ||
423 | |||
424 | /** | ||
414 | * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry | 425 | * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry |
415 | * @pos: the type * to use as a loop counter. | 426 | * @pos: the type * to use as a loop counter. |
416 | * @n: another type * to use as temporary storage | 427 | * @n: another type * to use as temporary storage |
@@ -438,6 +449,19 @@ static inline void list_splice_init(struct list_head *list, | |||
438 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) | 449 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) |
439 | 450 | ||
440 | /** | 451 | /** |
452 | * list_for_each_entry_safe_from - iterate over list of given type | ||
453 | * from existing point safe against removal of list entry | ||
454 | * @pos: the type * to use as a loop counter. | ||
455 | * @n: another type * to use as temporary storage | ||
456 | * @head: the head for your list. | ||
457 | * @member: the name of the list_struct within the struct. | ||
458 | */ | ||
459 | #define list_for_each_entry_safe_from(pos, n, head, member) \ | ||
460 | for (n = list_entry(pos->member.next, typeof(*pos), member); \ | ||
461 | &pos->member != (head); \ | ||
462 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) | ||
463 | |||
464 | /** | ||
441 | * list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against | 465 | * list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against |
442 | * removal of list entry | 466 | * removal of list entry |
443 | * @pos: the type * to use as a loop counter. | 467 | * @pos: the type * to use as a loop counter. |