aboutsummaryrefslogtreecommitdiff
path: root/hw/hw.h
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2009-10-16 12:41:15 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-27 12:28:50 -0500
commit646bef19a5c99ea5de8abf80edaa6f51a131ff65 (patch)
tree732ef8d07b7306ae13adf15add7cb233426517a3 /hw/hw.h
parentvmstate: factor vmstate_offset_pointer (diff)
downloadqemu-kvm-646bef19a5c99ea5de8abf80edaa6f51a131ff65.tar.gz
qemu-kvm-646bef19a5c99ea5de8abf80edaa6f51a131ff65.tar.bz2
qemu-kvm-646bef19a5c99ea5de8abf80edaa6f51a131ff65.zip
vmstate: factor vmstate_offset_array
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.h19
1 files changed, 9 insertions, 10 deletions
diff --git a/hw/hw.h b/hw/hw.h
index 224b5e5a1..05c14ec9d 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -346,6 +346,10 @@ extern const VMStateInfo vmstate_info_buffer;
(offsetof(_state, _field) + \
type_check_pointer(_type, typeof_field(_state, _field)))
+#define vmstate_offset_array(_state, _field, _type, _num) \
+ (offsetof(_state, _field) + \
+ type_check_array(_type, typeof_field(_state, _field), _num))
+
#define VMSTATE_SINGLE(_field, _state, _version, _info, _type) { \
.name = (stringify(_field)), \
.version_id = (_version), \
@@ -380,8 +384,7 @@ extern const VMStateInfo vmstate_info_buffer;
.info = &(_info), \
.size = sizeof(_type), \
.flags = VMS_ARRAY, \
- .offset = offsetof(_state, _field) \
- + type_check_array(_type,typeof_field(_state, _field),_num) \
+ .offset = vmstate_offset_array(_state, _field, _type, _num), \
}
#define VMSTATE_ARRAY_TEST(_field, _state, _num, _test, _info, _type) {\
@@ -391,8 +394,7 @@ extern const VMStateInfo vmstate_info_buffer;
.info = &(_info), \
.size = sizeof(_type), \
.flags = VMS_ARRAY, \
- .offset = offsetof(_state, _field) \
- + type_check_array(_type,typeof_field(_state, _field),_num) \
+ .offset = vmstate_offset_array(_state, _field, _type, _num),\
}
#define VMSTATE_VARRAY_INT32(_field, _state, _field_num, _version, _info, _type) {\
@@ -429,8 +431,7 @@ extern const VMStateInfo vmstate_info_buffer;
.info = &(_info), \
.size = sizeof(_type), \
.flags = VMS_ARRAY|VMS_ARRAY_OF_POINTER, \
- .offset = offsetof(_state, _field) \
- + type_check_array(_type,typeof_field(_state, _field),_num) \
+ .offset = vmstate_offset_array(_state, _field, _type, _num), \
}
#define VMSTATE_STRUCT_ARRAY(_field, _state, _num, _version, _vmsd, _type) { \
@@ -440,8 +441,7 @@ extern const VMStateInfo vmstate_info_buffer;
.vmsd = &(_vmsd), \
.size = sizeof(_type), \
.flags = VMS_STRUCT|VMS_ARRAY, \
- .offset = offsetof(_state, _field) \
- + type_check_array(_type,typeof_field(_state, _field),_num) \
+ .offset = vmstate_offset_array(_state, _field, _type, _num), \
}
#define VMSTATE_STRUCT_ARRAY_SIZE_UINT8(_field, _state, _field__num, _version, _vmsd, _type) { \
@@ -451,8 +451,7 @@ extern const VMStateInfo vmstate_info_buffer;
.vmsd = &(_vmsd), \
.size = sizeof(_type), \
.flags = VMS_STRUCT|VMS_ARRAY, \
- .offset = offsetof(_state, _field) \
- + type_check_array(_type,typeof_field(_state, _field),_num) \
+ .offset = vmstate_offset_array(_state, _field, _type, _num), \
}
#define VMSTATE_STATIC_BUFFER(_field, _state, _version) { \