summaryrefslogtreecommitdiff
path: root/hw/hw.h
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2009-10-16 12:53:07 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-27 12:28:50 -0500
commit844b236a1fce4080f4fe34423ccc1882244eea0f (patch)
tree82192988dac41a4be6d3cb9fe321e3adde06df6a /hw/hw.h
parent646bef19a5c99ea5de8abf80edaa6f51a131ff65 (diff)
downloadqemu-844b236a1fce4080f4fe34423ccc1882244eea0f.zip
vmstate: factor vmstate_offset_buffer
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, 7 insertions, 6 deletions
diff --git a/hw/hw.h b/hw/hw.h
index 05c14ec9db..84ed93adb6 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -350,6 +350,10 @@ extern const VMStateInfo vmstate_info_buffer;
(offsetof(_state, _field) + \
type_check_array(_type, typeof_field(_state, _field), _num))
+#define vmstate_offset_buffer(_state, _field) \
+ vmstate_offset_array(_state, _field, uint8_t, \
+ sizeof(typeof_field(_state, _field)))
+
#define VMSTATE_SINGLE(_field, _state, _version, _info, _type) { \
.name = (stringify(_field)), \
.version_id = (_version), \
@@ -460,8 +464,7 @@ extern const VMStateInfo vmstate_info_buffer;
.size = sizeof(typeof_field(_state,_field)), \
.info = &vmstate_info_buffer, \
.flags = VMS_BUFFER, \
- .offset = offsetof(_state, _field) \
- + type_check_array(uint8_t,typeof_field(_state, _field),sizeof(typeof_field(_state,_field))) \
+ .offset = vmstate_offset_buffer(_state, _field), \
}
#define VMSTATE_STATIC_BUFFER_TEST(_field, _state, _test) { \
@@ -479,8 +482,7 @@ extern const VMStateInfo vmstate_info_buffer;
.size = (_size), \
.info = &vmstate_info_buffer, \
.flags = VMS_BUFFER, \
- .offset = offsetof(_state, _field) \
- + type_check_array(uint8_t,typeof_field(_state, _field),sizeof(typeof_field(_state,_field))) \
+ .offset = vmstate_offset_buffer(_state, _field), \
}
#define VMSTATE_BUFFER_START_MIDDLE(_field, _state, start) { \
@@ -488,8 +490,7 @@ extern const VMStateInfo vmstate_info_buffer;
.size = sizeof(typeof_field(_state,_field)) - start, \
.info = &vmstate_info_buffer, \
.flags = VMS_BUFFER, \
- .offset = offsetof(_state, _field) + start \
- + type_check_array(uint8_t,typeof_field(_state, _field),sizeof(typeof_field(_state,_field))) \
+ .offset = vmstate_offset_buffer(_state, _field) + start, \
}
extern const VMStateDescription vmstate_pci_device;