diff options
author | 2009-10-28 11:39:59 +0000 | |
---|---|---|
committer | 2009-10-28 11:39:59 +0000 | |
commit | 51df62225ded6893e7151e33d1ec7a928fe2c1cb (patch) | |
tree | 1253e326ae37b53930871372dd7b53c1320ac574 /savevm.c | |
parent | Merge commit '844e78ef9c6102cc3e33e4aa00efc8abdf0d8dde' into upstream-merge (diff) | |
parent | posix-aio-compat: Split out posix_aio_process_queue (diff) | |
download | qemu-kvm-51df62225ded6893e7151e33d1ec7a928fe2c1cb.tar.gz qemu-kvm-51df62225ded6893e7151e33d1ec7a928fe2c1cb.tar.bz2 qemu-kvm-51df62225ded6893e7151e33d1ec7a928fe2c1cb.zip |
Merge commit '59c7b155aa6e1cbfe8a92e2322ea59ab31965c10' into upstream-merge
* commit '59c7b155aa6e1cbfe8a92e2322ea59ab31965c10': (81 commits)
posix-aio-compat: Split out posix_aio_process_queue
monitor: Convert do_closefd() to QObject
monitor: Convert do_getfd() to QObject
monitor: Convert do_eject() to QObject
monitor: Convert do_pci_device_hot_remove() to QObject
monitor: Convert do_migrate_cancel() to QObject
monitor: Convert do_migrate_set_speed() to QObject
monitor: Convert do_migrate() to QObject
monitor: Convert do_physical_memory_save() to QObject
monitor: Convert do_memory_save() to QObject
lsi_scsi: port to vmstate
vmstate: Add VMSTATE_BUFFER_UNSAFE
vmware_vga: port to vmstate
vmware_vga: the support to change dinamically depth is not there
vmware_vga: scratch is really an array of uint32_t
vmware_vga: remove !EMBED_STDVGA code
vmware_vga: qemu_malloc() returns void *
vmware_vga: Remove uselss casts from void *
vmware_vga: Pass pci_vmsga_state_t arg no VGACommonState
vga: remove unused vga_common_save/load
...
Conflicts:
posix-aio-compat.c
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Diffstat (limited to 'savevm.c')
-rw-r--r-- | savevm.c | 54 |
1 files changed, 49 insertions, 5 deletions
@@ -900,11 +900,31 @@ static int get_uint8_equal(QEMUFile *f, void *pv, size_t size) } const VMStateInfo vmstate_info_uint8_equal = { - .name = "int32 equal", + .name = "uint8 equal", .get = get_uint8_equal, .put = put_uint8, }; +/* 16 bit unsigned int int. See that the received value is the same than the one + in the field */ + +static int get_uint16_equal(QEMUFile *f, void *pv, size_t size) +{ + uint16_t *v = pv; + uint16_t v2; + qemu_get_be16s(f, &v2); + + if (*v == v2) + return 0; + return -EINVAL; +} + +const VMStateInfo vmstate_info_uint16_equal = { + .name = "uint16 equal", + .get = get_uint16_equal, + .put = put_uint16, +}; + /* timers */ static int get_timer(QEMUFile *f, void *pv, size_t size) @@ -947,6 +967,26 @@ const VMStateInfo vmstate_info_buffer = { .put = put_buffer, }; +/* unused buffers: space that was used for some fields that are + not usefull anymore */ + +static int get_unused_buffer(QEMUFile *f, void *pv, size_t size) +{ + qemu_fseek(f, size, SEEK_CUR); + return 0; +} + +static void put_unused_buffer(QEMUFile *f, void *pv, size_t size) +{ + qemu_fseek(f, size, SEEK_CUR); +} + +const VMStateInfo vmstate_info_unused_buffer = { + .name = "unused_buffer", + .get = get_unused_buffer, + .put = put_unused_buffer, +}; + typedef struct SaveStateEntry { QTAILQ_ENTRY(SaveStateEntry) entry; char idstr[256]; @@ -1101,8 +1141,10 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd, if (field->flags & VMS_ARRAY) { n_elems = field->num; - } else if (field->flags & VMS_VARRAY) { - n_elems = *(size_t *)(opaque+field->num_offset); + } else if (field->flags & VMS_VARRAY_INT32) { + n_elems = *(int32_t *)(opaque+field->num_offset); + } else if (field->flags & VMS_VARRAY_UINT16) { + n_elems = *(uint16_t *)(opaque+field->num_offset); } if (field->flags & VMS_POINTER) { base_addr = *(void **)base_addr; @@ -1148,8 +1190,10 @@ void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd, if (field->flags & VMS_ARRAY) { n_elems = field->num; - } else if (field->flags & VMS_VARRAY) { - n_elems = *(size_t *)(opaque+field->num_offset); + } else if (field->flags & VMS_VARRAY_INT32) { + n_elems = *(int32_t *)(opaque+field->num_offset); + } else if (field->flags & VMS_VARRAY_UINT16) { + n_elems = *(uint16_t *)(opaque+field->num_offset); } if (field->flags & VMS_POINTER) { base_addr = *(void **)base_addr; |