[PATCH 3/12] FS-Cache: Add list_for_each_entry_safe_reverse()
From: David Howells (dhowells_at_redhat.com)
Date: 11/14/05
- Previous message: David Howells: "[PATCH 4/12] FS-Cache: Permit pre-allocation of radix-tree nodes"
- In reply to: David Howells: "[PATCH 0/12] FS-Cache: Generic filesystem caching facility"
- Next in thread: David Howells: "[PATCH 10/12] FS-Cache: Make kAFS use FS-Cache"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 14 Nov 2005 21:54:38 GMT To: torvalds@osdl.org, akpm@osdl.org
The attached patch adds list_for_each_entry_safe_reverse() to linux/list.h
Signed-Off-By: David Howells <dhowells@redhat.com>
--- warthog>diffstat -p1 list-foreach-saferev-2614mm2.diff include/linux/list.h | 14 ++++++++++++++ 1 files changed, 14 insertions(+) diff -uNrp linux-2.6.14-mm2/include/linux/list.h linux-2.6.14-mm2-cachefs/include/linux/list.h --- linux-2.6.14-mm2/include/linux/list.h 2005-11-14 16:17:58.000000000 +0000 +++ linux-2.6.14-mm2-cachefs/include/linux/list.h 2005-11-14 16:23:38.000000000 +0000 @@ -450,6 +450,20 @@ static inline void list_splice_init(stru pos = n, n = list_entry(n->member.next, typeof(*n), member)) /** + * list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against + * removal of list entry + * @pos: the type * to use as a loop counter. + * @n: another type * to use as temporary storage + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry_safe_reverse(pos, n, head, member) \ + for (pos = list_entry((head)->prev, typeof(*pos), member), \ + n = list_entry(pos->member.prev, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.prev, typeof(*n), member)) + +/** * list_for_each_rcu - iterate over an rcu-protected list * @pos: the &struct list_head to use as a loop counter. * @head: the head for your list. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Previous message: David Howells: "[PATCH 4/12] FS-Cache: Permit pre-allocation of radix-tree nodes"
- In reply to: David Howells: "[PATCH 0/12] FS-Cache: Generic filesystem caching facility"
- Next in thread: David Howells: "[PATCH 10/12] FS-Cache: Make kAFS use FS-Cache"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|