[LIST]: Introduce list_for_each_entry_from
authorArnaldo Carvalho de Melo <acme@mandriva.com>
Tue, 21 Mar 2006 01:19:17 +0000 (17:19 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Mar 2006 01:19:17 +0000 (17:19 -0800)
For iterating over list of given type continuing from existing point.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/list.h

index beb6e48e116ff5e0cef22f2109ace0d5335bc63d..67258b47e9ca138e7a639a0a8745dad878164b42 100644 (file)
@@ -410,6 +410,17 @@ static inline void list_splice_init(struct list_head *list,
             prefetch(pos->member.next), &pos->member != (head);        \
             pos = list_entry(pos->member.next, 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.
+ * @head:      the head for your list.
+ * @member:    the name of the list_struct within the struct.
+ */
+#define list_for_each_entry_from(pos, head, member)                    \
+       for (; prefetch(pos->member.next), &pos->member != (head);      \
+            pos = list_entry(pos->member.next, 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.