diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2006-03-20 20:18:05 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-20 20:18:05 -0500 |
commit | d8dcffee860d6b63996923b10f07c91d3d6c2fab (patch) | |
tree | a4b73c0d435b329f8522c380b22d9d4204a03f97 /include/linux/list.h | |
parent | 9b07ef5ddaced1e822b1a1fb1da088eb15c45cb4 (diff) |
[LIST]: Introduce list_for_each_entry_safe_from
For iterate over list of given type from existing point safe against removal of
list entry.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/list.h')
-rw-r--r-- | include/linux/list.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/list.h b/include/linux/list.h index 47208bd99f9e..beb6e48e116f 100644 --- a/include/linux/list.h +++ b/include/linux/list.h | |||
@@ -438,6 +438,19 @@ static inline void list_splice_init(struct list_head *list, | |||
438 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) | 438 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) |
439 | 439 | ||
440 | /** | 440 | /** |
441 | * list_for_each_entry_safe_from - iterate over list of given type | ||
442 | * from existing point safe against removal of list entry | ||
443 | * @pos: the type * to use as a loop counter. | ||
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 | #define list_for_each_entry_safe_from(pos, n, head, member) \ | ||
449 | for (n = list_entry(pos->member.next, typeof(*pos), member); \ | ||
450 | &pos->member != (head); \ | ||
451 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) | ||
452 | |||
453 | /** | ||
441 | * list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against | 454 | * list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against |
442 | * removal of list entry | 455 | * removal of list entry |
443 | * @pos: the type * to use as a loop counter. | 456 | * @pos: the type * to use as a loop counter. |