[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 22/25] queue.h: Add QLIST_FIX_HEAD_PTR()
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 22/25] queue.h: Add QLIST_FIX_HEAD_PTR() |
Date: |
Fri, 12 Jun 2015 18:23:31 +0200 |
If the head of a list has been moved to a different memory location, the
le_prev link in the first list entry has to be fixed up. Provide a macro
that implements this fixup.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
---
include/qemu/queue.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/include/qemu/queue.h b/include/qemu/queue.h
index f781aa2..a8d3cb8 100644
--- a/include/qemu/queue.h
+++ b/include/qemu/queue.h
@@ -117,6 +117,12 @@ struct {
\
} \
} while (/*CONSTCOND*/0)
+#define QLIST_FIX_HEAD_PTR(head, field) do { \
+ if ((head)->lh_first != NULL) { \
+ (head)->lh_first->field.le_prev = &(head)->lh_first; \
+ } \
+} while (/*CONSTCOND*/0)
+
#define QLIST_INSERT_AFTER(listelm, elm, field) do { \
if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \
(listelm)->field.le_next->field.le_prev = \
--
1.8.3.1
- [Qemu-devel] [PULL 10/25] block: Change bitmap truncate conditional to assertion, (continued)
- [Qemu-devel] [PULL 10/25] block: Change bitmap truncate conditional to assertion, Kevin Wolf, 2015/06/12
- [Qemu-devel] [PULL 11/25] block: driver should override flags in bdrv_open(), Kevin Wolf, 2015/06/12
- [Qemu-devel] [PULL 12/25] iotests: Add tests for overriding BDRV_O_PROTOCOL, Kevin Wolf, 2015/06/12
- [Qemu-devel] [PULL 13/25] qdict: Add qdict_array_entries(), Kevin Wolf, 2015/06/12
- [Qemu-devel] [PULL 15/25] check-qdict: Test cases for new functions, Kevin Wolf, 2015/06/12
- [Qemu-devel] [PULL 14/25] qdict: Add qdict_{set,copy}_default(), Kevin Wolf, 2015/06/12
- [Qemu-devel] [PULL 16/25] quorum: Use bdrv_open_image(), Kevin Wolf, 2015/06/12
- [Qemu-devel] [PULL 18/25] block: Use macro for cache option names, Kevin Wolf, 2015/06/12
- [Qemu-devel] [PULL 19/25] block: Use QemuOpts in bdrv_open_common(), Kevin Wolf, 2015/06/12
- [Qemu-devel] [PULL 21/25] block: Drain requests before swapping nodes in bdrv_swap(), Kevin Wolf, 2015/06/12
- [Qemu-devel] [PULL 22/25] queue.h: Add QLIST_FIX_HEAD_PTR(),
Kevin Wolf <=
- [Qemu-devel] [PULL 17/25] vmdk: Use bdrv_open_image(), Kevin Wolf, 2015/06/12
- [Qemu-devel] [PULL 23/25] block: Add list of children to BlockDriverState, Kevin Wolf, 2015/06/12
- [Qemu-devel] [PULL 20/25] block: Move flag inheritance to bdrv_open_inherit(), Kevin Wolf, 2015/06/12
- [Qemu-devel] [PULL 24/25] block: Add BlockDriverState.inherits_from, Kevin Wolf, 2015/06/12
- [Qemu-devel] [PULL 25/25] block: Fix reopen flag inheritance, Kevin Wolf, 2015/06/12
- Re: [Qemu-devel] [PULL 00/25] Block layer core and image format patches, Peter Maydell, 2015/06/15