summaryrefslogtreecommitdiffstats
path: root/include/migration/vmstate.h
diff options
context:
space:
mode:
authorAlexey Kardashevskiy2016-06-01 10:57:32 +0200
committerDavid Gibson2016-06-07 02:17:45 +0200
commit705124ea6dca3ebfa13afddac9ce9475caf981a6 (patch)
tree4949467977519c56d16f8899a9b08b191be29899 /include/migration/vmstate.h
parentkvm: API to obtain max supported mem slots (diff)
downloadqemu-705124ea6dca3ebfa13afddac9ce9475caf981a6.tar.gz
qemu-705124ea6dca3ebfa13afddac9ce9475caf981a6.tar.xz
qemu-705124ea6dca3ebfa13afddac9ce9475caf981a6.zip
vmstate: Define VARRAY with VMS_ALLOC
This allows dynamic allocation for migrating arrays. Already existing VMSTATE_VARRAY_UINT32 requires an array to be pre-allocated, however there are cases when the size is not known in advance and there is no real need to enforce it. This defines another variant of VMSTATE_VARRAY_UINT32 with WMS_ALLOC flag which tells the receiving side to allocate memory for the array before receiving the data. The first user of it is a dynamic DMA window which existence and size are totally dynamic. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'include/migration/vmstate.h')
-rw-r--r--include/migration/vmstate.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index 30ecc441de..6c65811aee 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -386,6 +386,16 @@ extern const VMStateInfo vmstate_info_bitmap;
.offset = vmstate_offset_pointer(_state, _field, _type), \
}
+#define VMSTATE_VARRAY_UINT32_ALLOC(_field, _state, _field_num, _version, _info, _type) {\
+ .name = (stringify(_field)), \
+ .version_id = (_version), \
+ .num_offset = vmstate_offset_value(_state, _field_num, uint32_t),\
+ .info = &(_info), \
+ .size = sizeof(_type), \
+ .flags = VMS_VARRAY_UINT32|VMS_POINTER|VMS_ALLOC, \
+ .offset = vmstate_offset_pointer(_state, _field, _type), \
+}
+
#define VMSTATE_VARRAY_UINT16_UNSAFE(_field, _state, _field_num, _version, _info, _type) {\
.name = (stringify(_field)), \
.version_id = (_version), \