And re-implement list_for_each_rev in terms of list_for_each_rev_off
to avoid duplicating iteration logic.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
* printf("Name: %s\n", child->name);
*/
#define list_for_each_rev(h, i, member) \
* printf("Name: %s\n", child->name);
*/
#define list_for_each_rev(h, i, member) \
- for (i = container_of_var(list_debug(h, LIST_LOC)->n.prev, i, member); \
- &i->member != &(h)->n; \
- i = container_of_var(i->member.prev, i, member))
+ list_for_each_rev_off(h, i, list_off_var_(i, member))
/**
* list_for_each_safe - iterate through a list, maybe during deletion
/**
* list_for_each_safe - iterate through a list, maybe during deletion
#define list_for_each_off(h, i, off) \
list_for_each_off_dir_((h),(i),(off),next)
#define list_for_each_off(h, i, off) \
list_for_each_off_dir_((h),(i),(off),next)
+/**
+ * list_for_each_rev_off - iterate through a list of memory regions backwards
+ * @h: the list_head
+ * @i: the pointer to a memory region wich contains list node data.
+ * @off: offset(relative to @i) at which list node data resides.
+ *
+ * See list_for_each_off for details
+ */
+#define list_for_each_rev_off(h, i, off) \
+ list_for_each_off_dir_((h),(i),(off),prev)
+
/**
* list_for_each_safe_off - iterate through a list of memory regions, maybe
* during deletion
/**
* list_for_each_safe_off - iterate through a list of memory regions, maybe
* during deletion