From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, vsementsov@virtuozzo.com, armbru@redhat.com,
qemu-devel@nongnu.org, mreitz@redhat.com, den@openvz.org
Subject: [PATCH 1/7] qemu/queue: add some useful QLIST_ and QTAILQ_ macros
Date: Fri, 29 Jan 2021 19:50:24 +0300 [thread overview]
Message-ID: <20210129165030.640169-2-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20210129165030.640169-1-vsementsov@virtuozzo.com>
Add QLIST_FOREACH_FUNC_SAFE(), QTAILQ_FOREACH_FUNC_SAFE() and
QTAILQ_POP_HEAD(), to be used in following commit.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
include/qemu/queue.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/include/qemu/queue.h b/include/qemu/queue.h
index e029e7bf66..03e1fce85f 100644
--- a/include/qemu/queue.h
+++ b/include/qemu/queue.h
@@ -173,6 +173,13 @@ struct { \
(var) && ((next_var) = ((var)->field.le_next), 1); \
(var) = (next_var))
+#define QLIST_FOREACH_FUNC_SAFE(head, field, func) do { \
+ typeof(*QLIST_FIRST(head)) *qffs_var, *qffs_next_var; \
+ QLIST_FOREACH_SAFE(qffs_var, (head), field, qffs_next_var) { \
+ (func)(qffs_var); \
+ } \
+} while (/*CONSTCOND*/0)
+
/*
* List access methods.
*/
@@ -490,6 +497,13 @@ union { \
(var) && ((prev_var) = QTAILQ_PREV(var, field), 1); \
(var) = (prev_var))
+#define QTAILQ_FOREACH_FUNC_SAFE(head, field, func) do { \
+ typeof(*QTAILQ_FIRST(head)) *qffs_var, *qffs_next_var; \
+ QTAILQ_FOREACH_SAFE(qffs_var, (head), field, qffs_next_var) { \
+ (func)(qffs_var); \
+ } \
+} while (/*CONSTCOND*/0)
+
/*
* Tail queue access methods.
*/
--
2.29.2
next prev parent reply other threads:[~2021-01-29 17:23 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-29 16:50 [PATCH 0/7] qcow2: compressed write cache Vladimir Sementsov-Ogievskiy
2021-01-29 16:50 ` Vladimir Sementsov-Ogievskiy [this message]
2021-02-01 8:29 ` [PATCH 1/7] qemu/queue: add some useful QLIST_ and QTAILQ_ macros Markus Armbruster
2021-02-01 8:34 ` Vladimir Sementsov-Ogievskiy
2021-02-10 17:07 ` Max Reitz
2021-01-29 16:50 ` [PATCH 2/7] block/qcow2: introduce cache for compressed writes Vladimir Sementsov-Ogievskiy
2021-02-10 17:07 ` Max Reitz
2021-02-11 12:49 ` Vladimir Sementsov-Ogievskiy
2021-02-18 15:04 ` Max Reitz
2021-01-29 16:50 ` [PATCH 3/7] block/qcow2: use compressed write cache Vladimir Sementsov-Ogievskiy
2021-02-10 17:11 ` Max Reitz
2021-02-11 12:53 ` Vladimir Sementsov-Ogievskiy
2021-02-18 16:02 ` Max Reitz
2021-01-29 16:50 ` [PATCH 4/7] simplebench: bench_one(): add slow_limit argument Vladimir Sementsov-Ogievskiy
2021-01-29 16:50 ` [PATCH 5/7] simplebench: bench_one(): support count=1 Vladimir Sementsov-Ogievskiy
2021-01-29 16:50 ` [PATCH 6/7] simplebench/bench-backup: add --compressed option Vladimir Sementsov-Ogievskiy
2021-01-29 16:50 ` [PATCH 7/7] simplebench/bench-backup: add target-cache argument Vladimir Sementsov-Ogievskiy
2021-01-29 17:30 ` [PATCH 0/7] qcow2: compressed write cache no-reply
2021-02-01 8:24 ` Vladimir Sementsov-Ogievskiy
2021-02-09 13:25 ` Max Reitz
2021-02-09 14:10 ` Vladimir Sementsov-Ogievskiy
2021-02-09 14:47 ` Max Reitz
2021-02-09 16:39 ` Vladimir Sementsov-Ogievskiy
2021-02-09 18:36 ` Vladimir Sementsov-Ogievskiy
2021-02-09 18:41 ` Denis V. Lunev
2021-02-09 18:51 ` Vladimir Sementsov-Ogievskiy
2021-02-10 10:00 ` Max Reitz
2021-02-10 10:10 ` Vladimir Sementsov-Ogievskiy
2021-02-09 16:52 ` Denis V. Lunev
2021-02-10 10:00 ` Max Reitz
2021-02-10 12:35 ` Kevin Wolf
2021-02-10 14:35 ` Vladimir Sementsov-Ogievskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210129165030.640169-2-vsementsov@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=armbru@redhat.com \
--cc=den@openvz.org \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).