aboutsummaryrefslogtreecommitdiff
path: root/hw/hw.h
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2009-12-02 12:36:43 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2009-12-03 10:04:54 -0600
commit33599e2a6164b1c7a5b634be1c2e54b8f0fb91bd (patch)
treeba615fe8d01a46ac2522c045f9cc7eb77954090b /hw/hw.h
parentvmstate: remove usused VMSTATE_STRUCT_ARRAY_SIZE_UINT8 (diff)
downloadqemu-kvm-33599e2a6164b1c7a5b634be1c2e54b8f0fb91bd.tar.gz
qemu-kvm-33599e2a6164b1c7a5b634be1c2e54b8f0fb91bd.tar.bz2
qemu-kvm-33599e2a6164b1c7a5b634be1c2e54b8f0fb91bd.zip
vmstate: Add support for multiplying size for a constant
When the size that we want to transmit is in another field, but in an unit different that bytes Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/hw.h')
-rw-r--r--hw/hw.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/hw/hw.h b/hw/hw.h
index 41e13cc1d..5f3499196 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -295,6 +295,7 @@ enum VMStateFlags {
VMS_ARRAY_OF_POINTER = 0x040,
VMS_VARRAY_UINT16 = 0x080, /* Array with size in uint16_t field */
VMS_VBUFFER = 0x100, /* Buffer with size in int32_t field */
+ VMS_MULTIPLY = 0x200, /* multiply "size" field by field_size */
};
typedef struct {
@@ -485,6 +486,18 @@ extern const VMStateInfo vmstate_info_unused_buffer;
.offset = vmstate_offset_buffer(_state, _field) + _start, \
}
+#define VMSTATE_BUFFER_MULTIPLY(_field, _state, _version, _test, _start, _field_size, _multiply) { \
+ .name = (stringify(_field)), \
+ .version_id = (_version), \
+ .field_exists = (_test), \
+ .size_offset = vmstate_offset_value(_state, _field_size, uint32_t),\
+ .size = (_multiply), \
+ .info = &vmstate_info_buffer, \
+ .flags = VMS_VBUFFER|VMS_MULTIPLY, \
+ .offset = offsetof(_state, _field), \
+ .start = (_start), \
+}
+
#define VMSTATE_VBUFFER(_field, _state, _version, _test, _start, _field_size) { \
.name = (stringify(_field)), \
.version_id = (_version), \