This patch adds another list_for_each_* derivate. I can't work around it
because there is a list that I need to search both ways.
Signed-off-by: Martin Peschke <[email protected]>
---
list.h | 12 ++++++++++++
1 files changed, 12 insertions(+)
diff -Nurp a/include/linux/list.h b/include/linux/list.h
--- a/include/linux/list.h 2006-05-17 19:02:03.000000000 +0200
+++ b/include/linux/list.h 2006-05-17 19:05:41.000000000 +0200
@@ -411,6 +411,18 @@ static inline void list_splice_init(stru
pos = list_entry(pos->member.next, typeof(*pos), member))
/**
+ * list_for_each_entry_continue_reverse - iterate backwards over list
+ * of given type continuing before existing point
+ * @pos: the type * to use as a loop counter.
+ * @head: the head for your list.
+ * @member: the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_continue_reverse(pos, head, member) \
+ for (pos = list_entry(pos->member.prev, typeof(*pos), member); \
+ prefetch(pos->member.prev), &pos->member != (head); \
+ pos = list_entry(pos->member.prev, typeof(*pos), member))
+
+/**
* list_for_each_entry_from - iterate over list of given type
* continuing from existing point
* @pos: the type * to use as a loop counter.
On Wed, 17 May 2006 20:50:44 +0200 Martin Peschke wrote:
> This patch adds another list_for_each_* derivate. I can't work around it
> because there is a list that I need to search both ways.
>
> Signed-off-by: Martin Peschke <[email protected]>
> ---
>
> list.h | 12 ++++++++++++
> 1 files changed, 12 insertions(+)
>
> diff -Nurp a/include/linux/list.h b/include/linux/list.h
> --- a/include/linux/list.h 2006-05-17 19:02:03.000000000 +0200
> +++ b/include/linux/list.h 2006-05-17 19:05:41.000000000 +0200
> @@ -411,6 +411,18 @@ static inline void list_splice_init(stru
> pos = list_entry(pos->member.next, typeof(*pos), member))
>
> /**
> + * list_for_each_entry_continue_reverse - iterate backwards over list
> + * of given type continuing before existing point
kernel-doc function name and short description need to fit on one line.
(list.h has some other problems like that; I'll fix those up.)
> + * @pos: the type * to use as a loop counter.
> + * @head: the head for your list.
> + * @member: the name of the list_struct within the struct.
> + */
> +#define list_for_each_entry_continue_reverse(pos, head, member) \
> + for (pos = list_entry(pos->member.prev, typeof(*pos), member); \
> + prefetch(pos->member.prev), &pos->member != (head); \
> + pos = list_entry(pos->member.prev, typeof(*pos), member))
> +
> +/**
> * list_for_each_entry_from - iterate over list of given type
> * continuing from existing point
> * @pos: the type * to use as a loop counter.
---
~Randy