[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 1/4] queue: add QSIMPLEQ_PREPEND()
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 1/4] queue: add QSIMPLEQ_PREPEND() |
Date: |
Tue, 27 Mar 2018 15:41:21 +0100 |
QSIMPLEQ_CONCAT(a, b) joins a = a + b. The new QSIMPLEQ_PREPEND(a, b)
API joins a = b + a.
Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
include/qemu/queue.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/qemu/queue.h b/include/qemu/queue.h
index aa270d2b38..59fd1203a1 100644
--- a/include/qemu/queue.h
+++ b/include/qemu/queue.h
@@ -324,6 +324,14 @@ struct {
\
} \
} while (/*CONSTCOND*/0)
+#define QSIMPLEQ_PREPEND(head1, head2) do { \
+ if (!QSIMPLEQ_EMPTY((head2))) { \
+ *(head2)->sqh_last = (head1)->sqh_first; \
+ (head1)->sqh_first = (head2)->sqh_first; \
+ QSIMPLEQ_INIT((head2)); \
+ } \
+} while (/*CONSTCOND*/0)
+
#define QSIMPLEQ_LAST(head, type, field) \
(QSIMPLEQ_EMPTY((head)) ? \
NULL : \
--
2.14.3
- [Qemu-devel] [PULL 0/4] Block patches, Stefan Hajnoczi, 2018/03/27
- [Qemu-devel] [PULL 1/4] queue: add QSIMPLEQ_PREPEND(),
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 2/4] coroutine: avoid co_queue_wakeup recursion, Stefan Hajnoczi, 2018/03/27
- [Qemu-devel] [PULL 3/4] coroutine: add test-aio coroutine queue chaining test case, Stefan Hajnoczi, 2018/03/27
- [Qemu-devel] [PULL 4/4] MAINTAINERS: add include/block/aio-wait.h, Stefan Hajnoczi, 2018/03/27
- Re: [Qemu-devel] [PULL 0/4] Block patches, Peter Maydell, 2018/03/27
- Re: [Qemu-devel] [PULL 0/4] Block patches, no-reply, 2018/03/31