aboutsummaryrefslogtreecommitdiff
path: root/vmstate.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-10-15 11:55:53 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-10-15 11:55:54 +0100
commit32d9c5613e3cbb5d90daa3a1c629fb389e749d03 (patch)
tree9a93c3a76f7ef0832a1467a766e1ddb17ae87168 /vmstate.c
parent88e6599669a2f8c9ec5b8baa62178bc3dfc340ae (diff)
parent5b0e9dd46fbda5152566a4a26fd96bc0d0452bf7 (diff)
downloadqemu-32d9c5613e3cbb5d90daa3a1c629fb389e749d03.zip
qemu-32d9c5613e3cbb5d90daa3a1c629fb389e749d03.tar.gz
qemu-32d9c5613e3cbb5d90daa3a1c629fb389e749d03.tar.bz2
Merge remote-tracking branch 'remotes/juanquintela/tags/migration/20141015' into staging
migration/next for 20141015 # gpg: Signature made Wed 15 Oct 2014 09:21:54 BST using RSA key ID 5872D723 # gpg: Can't check signature: public key not found * remotes/juanquintela/tags/migration/20141015: migration: catch unknown flag combinations in ram_load qemu-file: Move stdio implementation to qemu-file-stdio.c qemu-file: Move unix and socket implementations to qemu-file-unix.c qemu-file: Use qemu_file_is_writable() on stdio_fclose() qemu-file: Make qemu_file_is_writable() non-static qemu-file: Add copyright header to qemu-file.c vmstate: Allow dynamic allocation for VBUFFER during migration block/migration: Disable cache invalidate for incoming migration Tests: QEMUSizedBuffer/QEMUBuffer QEMUSizedBuffer based QEMUFile Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'vmstate.c')
-rw-r--r--vmstate.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/vmstate.c b/vmstate.c
index ef2f87b..3dde574 100644
--- a/vmstate.c
+++ b/vmstate.c
@@ -49,9 +49,16 @@ static void *vmstate_base_addr(void *opaque, VMStateField *field, bool alloc)
if (field->flags & VMS_POINTER) {
if (alloc && (field->flags & VMS_ALLOC)) {
- int n_elems = vmstate_n_elems(opaque, field);
- if (n_elems) {
- gsize size = n_elems * field->size;
+ gsize size = 0;
+ if (field->flags & VMS_VBUFFER) {
+ size = vmstate_size(opaque, field);
+ } else {
+ int n_elems = vmstate_n_elems(opaque, field);
+ if (n_elems) {
+ size = n_elems * field->size;
+ }
+ }
+ if (size) {
*((void **)base_addr + field->start) = g_malloc(size);
}
}