Skip to contentSkip to conversation

statistics infrastructure - prerequisite: list operation

PATCH In review Martin Peschke 1 participant 1 message Dec 14, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 3/6 statistics infrastructure - prerequisite: list operation

[patch 3/6] statistics infrastructure - prerequisite: list operation

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.

---

 list.h |   12 ++++++++++++
 1 files changed, 12 insertions(+)
include/linux/list.h +12 -0
diff -Nurp c/include/linux/list.h d/include/linux/list.h
@@ -409,6 +409,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_safe - iterate 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