diff options
| author | Arnaldo Carvalho de Melo <acme@conectiva.com.br> | 2003-05-04 18:57:30 -0300 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@conectiva.com.br> | 2003-05-04 18:57:30 -0300 |
| commit | 277110dca3410778a25cf301487a6a7376dc8c7d (patch) | |
| tree | 2bc09ce98afc82b91dcd004dcfd2c27b1c8085ec /include | |
| parent | 4c45b3bf981cbac8639cd444e9ee130db71f2871 (diff) | |
o list.h: implement list_for_each_entry_safe
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/list.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/list.h b/include/linux/list.h index 11b8674c14ff..a6dea8afd99d 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -297,6 +297,19 @@ static inline void list_splice_init(struct list_head *list, prefetch(pos->member.next)) /** + * list_for_each_entry_safe - iterate over list of given type 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(pos, n, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member), \ + 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_rcu - iterate over an rcu-protected list * @pos: the &struct list_head to use as a loop counter. * @head: the head for your list. |
