Whamcloud - gitweb
- list_for_each_entry() added
authoralex <alex>
Wed, 10 Dec 2003 19:10:15 +0000 (19:10 +0000)
committeralex <alex>
Wed, 10 Dec 2003 19:10:15 +0000 (19:10 +0000)
lustre/kernel_patches/patches/listman-2.4.18.patch

index 37535c0..3477257 100644 (file)
@@ -1,11 +1,24 @@
 Index: linux-2.4.18-chaos/include/linux/list.h
 ===================================================================
---- linux-2.4.18-chaos.orig/include/linux/list.h       2003-10-22 13:43:39.000000000 +0400
-+++ linux-2.4.18-chaos/include/linux/list.h    2003-10-22 13:44:17.000000000 +0400
-@@ -173,6 +173,16 @@
+--- linux-2.4.18-chaos.orig/include/linux/list.h       2003-11-23 00:07:05.000000000 +0300
++++ linux-2.4.18-chaos/include/linux/list.h    2003-12-10 22:05:23.000000000 +0300
+@@ -173,6 +173,29 @@
        for (pos = (head)->prev, prefetch(pos->prev); pos != (head); \
                pos = pos->prev, prefetch(pos->prev))
                
++/**
++ * 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))
++
 +/* 2.5 uses hlists for some things, like the d_hash.  we'll treat them
 + * as 2.5 and let macros drop back.. */
 +#define hlist_entry                     list_entry