[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 2/6] migration/vmstate: Introduce VMSTATE_WITH_TMP_TEST() and
From: |
David Hildenbrand |
Subject: |
[PATCH v3 2/6] migration/vmstate: Introduce VMSTATE_WITH_TMP_TEST() and VMSTATE_BITMAP_TEST() |
Date: |
Thu, 22 Dec 2022 12:02:11 +0100 |
We'll make use of both next in the context of virtio-mem.
Signed-off-by: David Hildenbrand <david@redhat.com>
---
include/migration/vmstate.h | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 79eb2409a2..73ad1ae0eb 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -712,8 +712,9 @@ extern const VMStateInfo vmstate_info_qlist;
* '_state' type
* That the pointer is right at the start of _tmp_type.
*/
-#define VMSTATE_WITH_TMP(_state, _tmp_type, _vmsd) { \
+#define VMSTATE_WITH_TMP_TEST(_state, _test, _tmp_type, _vmsd) { \
.name = "tmp", \
+ .field_exists = (_test), \
.size = sizeof(_tmp_type) + \
QEMU_BUILD_BUG_ON_ZERO(offsetof(_tmp_type, parent) != 0) +
\
type_check_pointer(_state, \
@@ -722,6 +723,9 @@ extern const VMStateInfo vmstate_info_qlist;
.info = &vmstate_info_tmp, \
}
+#define VMSTATE_WITH_TMP(_state, _tmp_type, _vmsd) \
+ VMSTATE_WITH_TMP_TEST(_state, NULL, _tmp_type, _vmsd)
+
#define VMSTATE_UNUSED_BUFFER(_test, _version, _size) { \
.name = "unused", \
.field_exists = (_test), \
@@ -745,8 +749,9 @@ extern const VMStateInfo vmstate_info_qlist;
/* _field_size should be a int32_t field in the _state struct giving the
* size of the bitmap _field in bits.
*/
-#define VMSTATE_BITMAP(_field, _state, _version, _field_size) { \
+#define VMSTATE_BITMAP_TEST(_field, _state, _test, _version, _field_size) { \
.name = (stringify(_field)), \
+ .field_exists = (_test), \
.version_id = (_version), \
.size_offset = vmstate_offset_value(_state, _field_size, int32_t),\
.info = &vmstate_info_bitmap, \
@@ -754,6 +759,9 @@ extern const VMStateInfo vmstate_info_qlist;
.offset = offsetof(_state, _field), \
}
+#define VMSTATE_BITMAP(_field, _state, _version, _field_size) \
+ VMSTATE_BITMAP_TEST(_field, _state, NULL, _version, _field_size)
+
/* For migrating a QTAILQ.
* Target QTAILQ needs be properly initialized.
* _type: type of QTAILQ element
--
2.38.1
- [PATCH v3 0/6] virtio-mem: Handle preallocation with migration, David Hildenbrand, 2022/12/22
- [PATCH v3 1/6] migration: Allow immutable device state to be migrated early (i.e., before RAM), David Hildenbrand, 2022/12/22
- [PATCH v3 3/6] migration: Factor out checks for advised and listening incomming postcopy, David Hildenbrand, 2022/12/22
- [PATCH v3 2/6] migration/vmstate: Introduce VMSTATE_WITH_TMP_TEST() and VMSTATE_BITMAP_TEST(),
David Hildenbrand <=
- [PATCH v3 4/6] virtio-mem: Fail if a memory backend with "prealloc=on" is specified, David Hildenbrand, 2022/12/22
- [PATCH v3 5/6] virtio-mem: Migrate bitmap, size and sanity checks early, David Hildenbrand, 2022/12/22
- [PATCH v3 6/6] virtio-mem: Proper support for preallocation with migration, David Hildenbrand, 2022/12/22