summaryrefslogtreecommitdiff
path: root/include/linux/list.h
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2019-11-29 00:11:54 +0300
committerJens Axboe <axboe@kernel.dk>2019-12-19 06:08:50 -0700
commit28ca0d6d39ab1d01c86762c82a585b7cedd2920c (patch)
tree0ad7e73cbc0309758457dbde28012373e1633516 /include/linux/list.h
parent7d30a621028a22a9e8fbae5c5d8dc455869e4999 (diff)
list: introduce list_for_each_continue()
As other *continue() helpers, this continues iteration from a given position. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/list.h')
-rw-r--r--include/linux/list.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/list.h b/include/linux/list.h
index 85c92555e31f..3c391bbd03c3 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -539,6 +539,16 @@ static inline void list_splice_tail_init(struct list_head *list,
for (pos = (head)->next; pos != (head); pos = pos->next)
/**
+ * list_for_each_continue - continue iteration over a list
+ * @pos: the &struct list_head to use as a loop cursor.
+ * @head: the head for your list.
+ *
+ * Continue to iterate over a list, continuing after the current position.
+ */
+#define list_for_each_continue(pos, head) \
+ for (pos = pos->next; pos != (head); pos = pos->next)
+
+/**
* list_for_each_prev - iterate over a list backwards
* @pos: the &struct list_head to use as a loop cursor.
* @head: the head for your list.