summaryrefslogtreecommitdiffstats
path: root/include/migration/vmstate.h
diff options
context:
space:
mode:
authorDr. David Alan Gilbert <dgilbert@redhat.com>2016-01-06 12:23:38 +0000
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 19:28:22 -0600
commit46a9e4bf821cf12fb97e42bfe1c0e60b3e83ff98 (patch)
tree9286b3a1b1a727e5df5ebff0593dbe500d1376eb /include/migration/vmstate.h
parent268c736a2a6454fa97d91472431e5f5cbd87bd27 (diff)
downloadhqemu-46a9e4bf821cf12fb97e42bfe1c0e60b3e83ff98.zip
hqemu-46a9e4bf821cf12fb97e42bfe1c0e60b3e83ff98.tar.gz
Add VMSTATE_STRUCT_VARRAY_KNOWN
At the moment we have VMSTATE_STRUCT_ARRAY that requires the field is declared as an array of fixed size. We also have VMSTATE_STRUCT_VARRAY_UINT* that allows a field declared as a pointer, but requires that the length is a field member in the structure being loaded/saved. VMSTATE_STRUCT_VARRAY_KNOWN is for arrays defined as pointers yet we somehow know the length of. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Amit Shah <amit.shah@redhat.com>
Diffstat (limited to 'include/migration/vmstate.h')
-rw-r--r--include/migration/vmstate.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 7267e38..97d44d3 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -374,6 +374,19 @@ extern const VMStateInfo vmstate_info_bitmap;
.offset = vmstate_offset_array(_state, _field, _type, _num),\
}
+/* a variable length array (i.e. _type *_field) but we know the
+ * length
+ */
+#define VMSTATE_STRUCT_VARRAY_KNOWN(_field, _state, _num, _version, _vmsd, _type) { \
+ .name = (stringify(_field)), \
+ .num = (_num), \
+ .version_id = (_version), \
+ .vmsd = &(_vmsd), \
+ .size = sizeof(_type), \
+ .flags = VMS_STRUCT|VMS_ARRAY, \
+ .offset = offsetof(_state, _field), \
+}
+
#define VMSTATE_STRUCT_VARRAY_UINT8(_field, _state, _field_num, _version, _vmsd, _type) { \
.name = (stringify(_field)), \
.num_offset = vmstate_offset_value(_state, _field_num, uint8_t), \
OpenPOWER on IntegriCloud