summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/ipxe')
-rw-r--r--src/include/ipxe/list.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/include/ipxe/list.h b/src/include/ipxe/list.h
index 743a3e260..a40fb681e 100644
--- a/src/include/ipxe/list.h
+++ b/src/include/ipxe/list.h
@@ -163,6 +163,18 @@ static inline int list_empty ( const struct list_head *head ) {
pos = list_entry ( pos->member.next, typeof ( *pos ), member ) )
/**
+ * Iterate over entries in a list in reverse order
+ *
+ * @v pos The type * to use as a loop counter
+ * @v head The head for your list
+ * @v member The name of the list_struct within the struct
+ */
+#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 ) )
+
+/**
* Iterate over entries in a list, safe against deletion of entries
*
* @v pos The type * to use as a loop counter