From: Arnaldo Carvalho de Melo Date: Tue, 21 Mar 2006 01:18:05 +0000 (-0800) Subject: [LIST]: Introduce list_for_each_entry_safe_from X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=d8dcffee860d6b63996923b10f07c91d3d6c2fab;p=openwrt%2Fstaging%2Fblogic.git [LIST]: Introduce list_for_each_entry_safe_from For iterate over list of given type from existing point safe against removal of list entry. Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: David S. Miller --- diff --git a/include/linux/list.h b/include/linux/list.h index 47208bd99f9e..beb6e48e116f 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -437,6 +437,19 @@ static inline void list_splice_init(struct list_head *list, &pos->member != (head); \ pos = n, n = list_entry(n->member.next, typeof(*n), member)) +/** + * list_for_each_entry_safe_from - iterate over list of given type + * from existing point safe against removal of list entry + * @pos: the type * to use as a loop counter. + * @n: another type * to use as temporary storage + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#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)) + /** * list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against * removal of list entry