aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2006-01-09 23:51:31 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-10 11:01:24 -0500
commit0ad42352c01788e41a33336577fdd270d8de55bb (patch)
treec7597bbb7d3f5f6fd3a9c359c0b882d0d8ad8bd8
parente329113ca437e44ec399b7ffe114ed36e84ccf5e (diff)
[PATCH] Add list_for_each_entry_safe_reverse()
Add list_for_each_entry_safe_reverse() to linux/list.h This is needed by unmerged cachefs and be an as-yet-unreviewed device_shutdown() fix. Signed-off-by: David Howells <dhowells@redhat.com> Cc: Patrick Mochel <mochel@digitalimplant.org> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--include/linux/list.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/list.h b/include/linux/list.h
index 8e3388284530..945daa1f13dd 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -436,6 +436,20 @@ static inline void list_splice_init(struct list_head *list,
436 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 436 pos = n, n = list_entry(n->member.next, typeof(*n), member))
437 437
438/** 438/**
439 * list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against
440 * removal of list entry
441 * @pos: the type * to use as a loop counter.
442 * @n: another type * to use as temporary storage
443 * @head: the head for your list.
444 * @member: the name of the list_struct within the struct.
445 */
446#define list_for_each_entry_safe_reverse(pos, n, head, member) \
447 for (pos = list_entry((head)->prev, typeof(*pos), member), \
448 n = list_entry(pos->member.prev, typeof(*pos), member); \
449 &pos->member != (head); \
450 pos = n, n = list_entry(n->member.prev, typeof(*n), member))
451
452/**
439 * list_for_each_rcu - iterate over an rcu-protected list 453 * list_for_each_rcu - iterate over an rcu-protected list
440 * @pos: the &struct list_head to use as a loop counter. 454 * @pos: the &struct list_head to use as a loop counter.
441 * @head: the head for your list. 455 * @head: the head for your list.