Whamcloud - gitweb
34772574be78bc569b1d1969837d3a1c618f63aa
[fs/lustre-release.git] / lustre / kernel_patches / patches / listman-2.4.18.patch
1 Index: linux-2.4.18-chaos/include/linux/list.h
2 ===================================================================
3 --- linux-2.4.18-chaos.orig/include/linux/list.h        2003-11-23 00:07:05.000000000 +0300
4 +++ linux-2.4.18-chaos/include/linux/list.h     2003-12-10 22:05:23.000000000 +0300
5 @@ -173,6 +173,29 @@
6         for (pos = (head)->prev, prefetch(pos->prev); pos != (head); \
7                 pos = pos->prev, prefetch(pos->prev))
8                 
9 +/**
10 + * list_for_each_entry -       iterate over list of given type
11 + * @pos:       the type * to use as a loop counter.
12 + * @head:      the head for your list.
13 + * @member:    the name of the list_struct within the struct.
14 + */
15 +#define list_for_each_entry(pos, head, member)                         \
16 +       for (pos = list_entry((head)->next, typeof(*pos), member),      \
17 +                    prefetch(pos->member.next);                        \
18 +            &pos->member != (head);                                    \
19 +            pos = list_entry(pos->member.next, typeof(*pos), member),  \
20 +                    prefetch(pos->member.next))
21 +
22 +/* 2.5 uses hlists for some things, like the d_hash.  we'll treat them
23 + * as 2.5 and let macros drop back.. */
24 +#define hlist_entry                     list_entry
25 +#define hlist_head                      list_head
26 +#define hlist_node                      list_head
27 +#define HLIST_HEAD                      LIST_HEAD
28 +#define INIT_HLIST_HEAD                 INIT_LIST_HEAD
29 +#define hlist_del_init                  list_del_init
30 +#define hlist_add_head                  list_add
31 +#define hlist_for_each_safe             list_for_each_safe
32  
33  #endif /* __KERNEL__ || _LVM_H_INCLUDE */
34