From 83edd0ef90d2049c310587baa1e4fc132d30e4a0 Mon Sep 17 00:00:00 2001 From: jxiong Date: Thu, 19 Jun 2008 10:41:05 +0000 Subject: [PATCH] b=16073 r=nikita Fixup list_for_each_entry_safe_from since prior kernels don't have this macro. --- lnet/include/libcfs/list.h | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/lnet/include/libcfs/list.h b/lnet/include/libcfs/list.h index 1ea1c01..ed03bd5 100644 --- a/lnet/include/libcfs/list.h +++ b/lnet/include/libcfs/list.h @@ -229,21 +229,6 @@ static inline void list_splice_init(struct list_head *list, for (pos = (head)->next, n = pos->next; pos != (head); \ pos = n, n = pos->next) -/** - * list_for_each_entry_safe_from - * @pos: the type * to use as a loop cursor. - * @n: another type * to use as temporary storage - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - * - * Iterate over list of given type from current point, safe against - * removal of list entry. - */ -#define list_for_each_entry_safe_from(pos, n, head, member) \ - for (n = list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) - /* * Double linked lists with a single pointer list head. * Mostly useful for hash tables where the two pointer list head is @@ -458,4 +443,21 @@ static inline void hlist_add_after(struct hlist_node *n, pos = n, n = list_entry(n->member.next, typeof(*n), member)) #endif /* list_for_each_entry_safe */ +#ifndef list_for_each_entry_safe_from +/** + * list_for_each_entry_safe_from + * @pos: the type * to use as a loop cursor. + * @n: another type * to use as temporary storage + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + * + * Iterate over list of given type from current point, safe against + * removal of list entry. + */ +#define list_for_each_entry_safe_from(pos, n, head, member) \ + for (n = list_entry(pos->member.next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.next, typeof(*n), member)) +#endif /* list_for_each_entry_safe_from */ + #endif /* __LIBCFS_LUSTRE_LIST_H__ */ -- 1.8.3.1