From: Marc-André Lureau <marcandre.lur...@redhat.com>

Add a macro to declare a VMState field which contains an array of struct
with a specific version.

Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com>
---
 include/migration/vmstate.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 294d2d8486..eaff3c8ff2 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -634,6 +634,18 @@ extern const VMStateInfo vmstate_info_qlist;
     .offset     = vmstate_offset_varray(_state, _field, _type),      \
 }
 
+#define VMSTATE_VSTRUCT_TEST_VARRAY_UINT32(_field, _state, _test, _field_num, 
_version, _vmsd, _type, _struct_version) { \
+    .name       = (stringify(_field)),                               \
+    .version_id = (_version),                                        \
+    .struct_version_id = (_struct_version),                          \
+    .field_exists = (_test),                                         \
+    .num_offset = vmstate_offset_value(_state, _field_num, uint32_t), \
+    .vmsd       = &(_vmsd),                                          \
+    .size       = sizeof(_type),                                     \
+    .flags      = VMS_VSTRUCT|VMS_VARRAY_UINT32,                      \
+    .offset     = vmstate_offset_varray(_state, _field, _type),      \
+}
+
 #define VMSTATE_STRUCT_VARRAY_ALLOC(_field, _state, _field_num, _version, 
_vmsd, _type) {\
     .name       = (stringify(_field)),                               \
     .version_id = (_version),                                        \
-- 
2.41.0.28.gd7d8841f67


Reply via email to