aboutsummaryrefslogtreecommitdiff
path: root/src/include/ipxe
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2012-05-04 15:12:22 +0100
committerMichael Brown <mcb30@ipxe.org>2012-05-04 15:15:34 +0100
commitf91995f19373b2bba78703310691e1ad68ee1eec (patch)
treee0455d1fd2bc52bfe7aa50caae95f0b38d1d2e2a /src/include/ipxe
parent69fa29029c59ede576eda895fc208f88873a9d03 (diff)
downloadipxe-f91995f19373b2bba78703310691e1ad68ee1eec.zip
ipxe-f91995f19373b2bba78703310691e1ad68ee1eec.tar.gz
ipxe-f91995f19373b2bba78703310691e1ad68ee1eec.tar.bz2
[list] Add list_for_each_entry_continue() and _continue_reverse()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/ipxe')
-rw-r--r--src/include/ipxe/list.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/include/ipxe/list.h b/src/include/ipxe/list.h
index 231383d..4daf12b 100644
--- a/src/include/ipxe/list.h
+++ b/src/include/ipxe/list.h
@@ -379,6 +379,32 @@ static inline void list_splice_tail_init ( struct list_head *list,
tmp = list_entry ( tmp->member.next, typeof ( *tmp ), member ) )
/**
+ * Iterate over entries in a list, starting after current position
+ *
+ * @v pos Iterator
+ * @v head List head
+ * @v member Name of list field within iterator's type
+ */
+#define list_for_each_entry_continue( pos, head, member ) \
+ for ( list_check ( (head) ), \
+ pos = list_entry ( pos->member.next, typeof ( *pos ), member ); \
+ &pos->member != (head); \
+ pos = list_entry ( pos->member.next, typeof ( *pos ), member ) )
+
+/**
+ * Iterate over entries in a list in reverse, starting after current position
+ *
+ * @v pos Iterator
+ * @v head List head
+ * @v member Name of list field within iterator's type
+ */
+#define list_for_each_entry_continue_reverse( pos, head, member ) \
+ for ( list_check ( (head) ), \
+ pos = list_entry ( pos->member.prev, typeof ( *pos ), member ); \
+ &pos->member != (head); \
+ pos = list_entry ( pos->member.prev, typeof ( *pos ), member ) )
+
+/**
* Test if list contains a specified entry
*
* @v entry Entry