summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/linux/list.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/list.h b/include/linux/list.h
index 3bc81f885ce1..913c93c44286 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -211,6 +211,19 @@ static inline void list_splice_init(list_t *list, list_t *head)
for (pos = (head)->next, n = pos->next; pos != (head); \
pos = n, n = pos->next)
+/**
+ * list_for_each_entry - iterate over list of given type
+ * @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(pos, head, member) \
+ for (pos = list_entry((head)->next, typeof(*pos), member), \
+ prefetch(pos->member.next); \
+ &pos->member != (head); \
+ pos = list_entry(pos->member.next, typeof(*pos), member), \
+ prefetch(pos->member.next))
+
#endif /* __KERNEL__ || _LVM_H_INCLUDE */
#endif