aboutsummaryrefslogtreecommitdiff
path: root/hw/hw.h
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2009-10-16 13:05:14 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-27 12:28:50 -0500
commitb2e15099761ea483b9b2a1d1019efb79579a8302 (patch)
treeab0e7e00f639d6c6f33a32f54fab17028f1ea645 /hw/hw.h
parent844b236a1fce4080f4fe34423ccc1882244eea0f (diff)
vmstate: factor VMSTATE_*BUFFER* definitions
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.h47
1 files changed, 14 insertions, 33 deletions
diff --git a/hw/hw.h b/hw/hw.h
index 84ed93adb6..2a9d0bd421 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -458,39 +458,14 @@ extern const VMStateInfo vmstate_info_buffer;
.offset = vmstate_offset_array(_state, _field, _type, _num), \
}
-#define VMSTATE_STATIC_BUFFER(_field, _state, _version) { \
- .name = (stringify(_field)), \
- .version_id = (_version), \
- .size = sizeof(typeof_field(_state,_field)), \
- .info = &vmstate_info_buffer, \
- .flags = VMS_BUFFER, \
- .offset = vmstate_offset_buffer(_state, _field), \
-}
-
-#define VMSTATE_STATIC_BUFFER_TEST(_field, _state, _test) { \
+#define VMSTATE_STATIC_BUFFER(_field, _state, _version, _test, _start, _size) { \
.name = (stringify(_field)), \
+ .version_id = (_version), \
.field_exists = (_test), \
- .size = sizeof(typeof_field(_state,_field)), \
+ .size = (_size - _start), \
.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))) \
-}
-
-#define VMSTATE_PARTIAL_BUFFER(_field, _state, _size) { \
- .name = (stringify(_field)), \
- .size = (_size), \
- .info = &vmstate_info_buffer, \
- .flags = VMS_BUFFER, \
- .offset = vmstate_offset_buffer(_state, _field), \
-}
-
-#define VMSTATE_BUFFER_START_MIDDLE(_field, _state, start) { \
- .name = (stringify(_field)), \
- .size = sizeof(typeof_field(_state,_field)) - start, \
- .info = &vmstate_info_buffer, \
- .flags = VMS_BUFFER, \
- .offset = vmstate_offset_buffer(_state, _field) + start, \
+ .offset = vmstate_offset_buffer(_state, _field) + _start, \
}
extern const VMStateDescription vmstate_pci_device;
@@ -632,13 +607,19 @@ extern const VMStateDescription vmstate_i2c_slave;
VMSTATE_INT32_VARRAY_V(_f, _s, _f_n, 0)
#define VMSTATE_BUFFER_V(_f, _s, _v) \
- VMSTATE_STATIC_BUFFER(_f, _s, _v)
+ VMSTATE_STATIC_BUFFER(_f, _s, _v, NULL, 0, sizeof(typeof_field(_s, _f)))
#define VMSTATE_BUFFER(_f, _s) \
- VMSTATE_STATIC_BUFFER(_f, _s, 0)
+ VMSTATE_BUFFER_V(_f, _s, 0)
+
+#define VMSTATE_PARTIAL_BUFFER(_f, _s, _size) \
+ VMSTATE_STATIC_BUFFER(_f, _s, 0, NULL, 0, _size)
+
+#define VMSTATE_BUFFER_START_MIDDLE(_f, _s, _start) \
+ VMSTATE_STATIC_BUFFER(_f, _s, 0, NULL, _start, sizeof(typeof_field(_s, _f)))
-#define VMSTATE_BUFFER_TEST(_f, _s, _t) \
- VMSTATE_STATIC_BUFFER_TEST(_f, _s, _t)
+#define VMSTATE_BUFFER_TEST(_f, _s, _test) \
+ VMSTATE_STATIC_BUFFER(_f, _s, 0, _test, 0, sizeof(typeof_field(_s, _f)))
#ifdef NEED_CPU_H
#if TARGET_LONG_BITS == 64