Whamcloud - gitweb
b=3119
[fs/lustre-release.git] / lustre / kernel_patches / patches / listman-2.4.21-chaos.patch
1 Index: linux-2.4.21-chaos/include/linux/list.h
2 ===================================================================
3 --- linux-2.4.21-chaos.orig/include/linux/list.h        2003-12-05 16:54:33.000000000 +0300
4 +++ linux-2.4.21-chaos/include/linux/list.h     2003-12-12 16:08:20.000000000 +0300
5 @@ -241,6 +241,21 @@
6              pos = list_entry(pos->member.next, typeof(*pos), member),  \
7                      prefetch(pos->member.next))
8  
9 +#ifndef list_for_each_entry_safe
10 +/**
11 + * list_for_each_entry_safe  -       iterate over list of given type safe against removal of list entry
12 + * @pos:        the type * to use as a loop counter.
13 + * @n:          another type * to use as temporary storage
14 + * @head:       the head for your list.
15 + * @member:     the name of the list_struct within the struct.
16 + */
17 +#define list_for_each_entry_safe(pos, n, head, member)                 \
18 +        for (pos = list_entry((head)->next, typeof(*pos), member),     \
19 +               n = list_entry(pos->member.next, typeof(*pos), member); \
20 +            &pos->member != (head);                                    \
21 +            pos = n, n = list_entry(n->member.next, typeof(*n), member))
22 +#endif
23 +
24  #define list_first(head)      (((head)->next != (head)) ? (head)->next: (struct list_head *) 0)
25  
26  #endif /* __KERNEL__ || _LVM_H_INCLUDE */