[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/9] vmstate: add UINT32 VARRAYS
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 3/9] vmstate: add UINT32 VARRAYS |
Date: |
Thu, 10 Mar 2011 12:33:50 +0100 |
Signed-off-by: Juan Quintela <address@hidden>
---
hw/hw.h | 11 +++++++++++
savevm.c | 2 ++
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/hw/hw.h b/hw/hw.h
index 40c6396..6e78fa9 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -299,6 +299,7 @@ enum VMStateFlags {
VMS_VBUFFER = 0x100, /* Buffer with size in int32_t field */
VMS_MULTIPLY = 0x200, /* multiply "size" field by field_size */
VMS_VARRAY_UINT8 = 0x400, /* Array with size in uint8_t field*/
+ VMS_VARRAY_UINT32 = 0x800, /* Array with size in uint32_t field*/
};
typedef struct {
@@ -438,6 +439,16 @@ extern const VMStateInfo vmstate_info_unused_buffer;
.offset = vmstate_offset_pointer(_state, _field, _type), \
}
+#define VMSTATE_VARRAY_UINT32(_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, \
+ .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), \
diff --git a/savevm.c b/savevm.c
index 4db036b..60d2f2a 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1329,6 +1329,8 @@ int vmstate_load_state(QEMUFile *f, const
VMStateDescription *vmsd,
n_elems = field->num;
} else if (field->flags & VMS_VARRAY_INT32) {
n_elems = *(int32_t *)(opaque+field->num_offset);
+ } else if (field->flags & VMS_VARRAY_UINT32) {
+ n_elems = *(uint32_t *)(opaque+field->num_offset);
} else if (field->flags & VMS_VARRAY_UINT16) {
n_elems = *(uint16_t *)(opaque+field->num_offset);
} else if (field->flags & VMS_VARRAY_UINT8) {
--
1.7.4
- [Qemu-devel] [PATCH 0/9] VMState infrastructure, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 1/9] vmstate: add VMSTATE_UINT32_EQUAL, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 3/9] vmstate: add UINT32 VARRAYS,
Juan Quintela <=
- [Qemu-devel] [PATCH 5/9] vmstate: add VMSTATE_INT64_ARRAY, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 4/9] vmstate: add VMSTATE_STRUCT_VARRAY_INT32, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 6/9] vmstate: add VMSTATE_STRUCT_VARRAY_UINT32, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 8/9] vmstate: be able to store/save a pci device from a pointer, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 9/9] vmstate: move timers to use test instead of version, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 7/9] vmstate: Add a way to send a partial array, Juan Quintela, 2011/03/10
- Re: [Qemu-devel] [PATCH 0/9] VMState infrastructure, Anthony Liguori, 2011/03/10
- Re: [Qemu-devel] [PATCH 0/9] VMState infrastructure, Anthony Liguori, 2011/03/10