Skip to content
Snippets Groups Projects
Commit 83edd0ef authored by Jinshan Xiong's avatar Jinshan Xiong
Browse files

b=16073
r=nikita

Fixup list_for_each_entry_safe_from since prior kernels don't have this macro.
parent 8c0c6c2e
No related branches found
No related tags found
No related merge requests found
...@@ -229,21 +229,6 @@ static inline void list_splice_init(struct list_head *list, ...@@ -229,21 +229,6 @@ static inline void list_splice_init(struct list_head *list,
for (pos = (head)->next, n = pos->next; pos != (head); \ for (pos = (head)->next, n = pos->next; pos != (head); \
pos = n, n = pos->next) 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. * Double linked lists with a single pointer list head.
* Mostly useful for hash tables where the two pointer list head is * 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, ...@@ -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)) pos = n, n = list_entry(n->member.next, typeof(*n), member))
#endif /* list_for_each_entry_safe */ #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__ */ #endif /* __LIBCFS_LUSTRE_LIST_H__ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment