OSDN Git Service

list: introduce list_for_each_continue()
authorPavel Begunkov <asml.silence@gmail.com>
Thu, 28 Nov 2019 21:11:54 +0000 (00:11 +0300)
committerJens Axboe <axboe@kernel.dk>
Thu, 19 Dec 2019 13:08:50 +0000 (06:08 -0700)
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>
include/linux/list.h

index 85c9255..3c391bb 100644 (file)
@@ -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.