X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;ds=sidebyside;f=list.h;h=486b9170e0001d59c68b3ec34d7f6b33356df76f;hb=f269333700038603703ec79c909d514bee731faf;hp=0080c80c32df511a14ee25d099c32a5e3beddd19;hpb=2ed89c59f0efcd0a2763f47c7d3455663241e623;p=paraslash.git diff --git a/list.h b/list.h index 0080c80c..486b9170 100644 --- a/list.h +++ b/list.h @@ -56,14 +56,15 @@ static inline void __list_add(struct list_head *new, } /** - * list_add - add a new entry - * @new: new entry to be added - * @head: list head to add it after + * add a new entry + * + * \param new: new entry to be added + * \param head: list head to add it after * * Insert a new entry after the specified head. * This is good for implementing stacks. */ -static inline void list_add(struct list_head *new, struct list_head *head) +static inline void para_list_add(struct list_head *new, struct list_head *head) { __list_add(new, head, head->next); } @@ -115,7 +116,7 @@ static inline void list_del(struct list_head *entry) static inline void list_move(struct list_head *list, struct list_head *head) { __list_del(list->prev, list->next); - list_add(list, head); + para_list_add(list, head); } /** @@ -169,4 +170,18 @@ static inline int list_empty(const struct list_head *head) 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 + * @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_reverse(pos, n, head, member) \ + for (pos = list_entry((head)->prev, typeof(*pos), member), \ + n = list_entry(pos->member.prev, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.prev, typeof(*n), member)) + #endif /* _LIST_H */