diff options
| author | Arnaldo Carvalho de Melo <acme@conectiva.com.br> | 2003-06-15 11:16:25 -0300 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@conectiva.com.br> | 2003-06-15 11:16:25 -0300 |
| commit | 4010ac6bf084192a0e2562150facdcc2476f6712 (patch) | |
| tree | f3b0cd5b95e8a8789e50ffe56109641e1062683b /include/linux/list.h | |
| parent | aae1760a589df2117879f0b36e098f271735f4b5 (diff) | |
o list.h: implement hlist_for_each_entry_{from,continue}
Diffstat (limited to 'include/linux/list.h')
| -rw-r--r-- | include/linux/list.h | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/include/linux/list.h b/include/linux/list.h index ff4109f01a72..b0ce7a7c0e7a 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -380,7 +380,7 @@ static inline void list_splice_init(struct list_head *list, /** * list_for_each_continue_rcu - iterate over an rcu-protected list - * continuing from existing point. + * continuing after existing point. * @pos: the &struct list_head to use as a loop counter. * @head: the head for your list. */ @@ -522,6 +522,30 @@ static __inline__ void hlist_add_after(struct hlist_node *n, pos && ({ prefetch(pos->next); 1;}) && \ ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ pos = pos->next) + +/** + * hlist_for_each_entry_continue - iterate over a hlist continuing after existing point + * @tpos: the type * to use as a loop counter. + * @pos: the &struct hlist_node to use as a loop counter. + * @member: the name of the hlist_node within the struct. + */ +#define hlist_for_each_entry_continue(tpos, pos, member) \ + for (pos = (pos)->next; \ + pos && ({ prefetch(pos->next); 1;}) && \ + ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + pos = pos->next) + +/** + * hlist_for_each_entry_from - iterate over a hlist continuing from existing point + * @tpos: the type * to use as a loop counter. + * @pos: the &struct hlist_node to use as a loop counter. + * @member: the name of the hlist_node within the struct. + */ +#define hlist_for_each_entry_from(tpos, pos, member) \ + for (; pos && ({ prefetch(pos->next); 1;}) && \ + ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + pos = pos->next) + /** * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry * @tpos: the type * to use as a loop counter. |
