diff options
Diffstat (limited to 'libglusterfs/src/list.h')
-rw-r--r-- | libglusterfs/src/list.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libglusterfs/src/list.h b/libglusterfs/src/list.h index 35fccdf25a5..7f3712b51b4 100644 --- a/libglusterfs/src/list.h +++ b/libglusterfs/src/list.h @@ -175,4 +175,16 @@ list_append_init (struct list_head *list, struct list_head *head) &pos->member != (head); \ pos = n, n = list_entry(n->member.next, typeof(*n), member)) +#define list_for_each_entry_reverse(pos, head, member) \ + for (pos = list_entry((head)->prev, typeof(*pos), member); \ + &pos->member != (head); \ + pos = list_entry(pos->member.prev, typeof(*pos), member)) + + +#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 /* _LLIST_H */ |