[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 16/25] vmstate: Introduce the concept of sub-arrays
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 16/25] vmstate: Introduce the concept of sub-arrays |
Date: |
Mon, 19 Oct 2009 20:43:01 +0200 |
VMSTATE_SUB_ARRAY(..., start, num, ...) saves the num elems starting at
position start of the array
Signed-off-by: Juan Quintela <address@hidden>
---
hw/hw.h | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/hw/hw.h b/hw/hw.h
index d3bf0a7..b98f0c9 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -352,6 +352,9 @@ extern const VMStateInfo vmstate_info_unused_buffer;
(offsetof(_state, _field) + \
type_check_array(_type, typeof_field(_state, _field), _num))
+#define vmstate_offset_sub_array(_state, _field, _type, _start) \
+ (offsetof(_state, _field[_start]))
+
#define vmstate_offset_buffer(_state, _field) \
vmstate_offset_array(_state, _field, uint8_t, \
sizeof(typeof_field(_state, _field)))
@@ -395,6 +398,16 @@ extern const VMStateInfo vmstate_info_unused_buffer;
.offset = vmstate_offset_array(_state, _field, _type, _num),\
}
+#define VMSTATE_SUB_ARRAY(_field, _state, _start, _num, _version, _info,
_type) { \
+ .name = (stringify(_field)), \
+ .version_id = (_version), \
+ .num = (_num), \
+ .info = &(_info), \
+ .size = sizeof(_type), \
+ .flags = VMS_ARRAY, \
+ .offset = vmstate_offset_sub_array(_state, _field, _type, _start), \
+}
+
#define VMSTATE_VARRAY_INT32(_field, _state, _field_num, _version, _info,
_type) {\
.name = (stringify(_field)), \
.version_id = (_version), \
@@ -614,6 +627,12 @@ extern const VMStateDescription vmstate_i2c_slave;
#define VMSTATE_INT32_ARRAY(_f, _s, _n) \
VMSTATE_INT32_ARRAY_V(_f, _s, _n, 0)
+#define VMSTATE_UINT32_SUB_ARRAY(_f, _s, _start, _num) \
+ VMSTATE_SUB_ARRAY(_f, _s, _start, _num, 0, vmstate_info_uint32, uint32_t)
+
+#define VMSTATE_UINT32_ARRAY(_f, _s, _n) \
+ VMSTATE_UINT32_ARRAY_V(_f, _s, _n, 0)
+
#define VMSTATE_BUFFER_V(_f, _s, _v) \
VMSTATE_STATIC_BUFFER(_f, _s, _v, 0, sizeof(typeof_field(_s, _f)))
--
1.6.2.5
- [Qemu-devel] [PATCH 07/25] vmstate: factor vmstate_offset_value, (continued)
- [Qemu-devel] [PATCH 07/25] vmstate: factor vmstate_offset_value, Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 08/25] vmstate: factor vmstate_offset_pointer, Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 09/25] vmstate: factor vmstate_offset_array, Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 10/25] vmstate: factor vmstate_offset_buffer, Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 11/25] vmstate: factor VMSTATE_*BUFFER* definitions, Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 12/25] vmstate: Unfold VMSTATE_INT32_VARRAY() only use and remove it, Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 13/25] vmstate: add VMS_VARRAY_UINT16_UNSAFE (varrays with uint16 indexes), Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 15/25] vmstate: Add VMSTATE_BUFFER_UNUSED, Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 17/25] rtl8139: port TallyCounters to vmstate, Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 14/25] vmstate: Add version arg to VMSTATE_SINGLE_TEST(), Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 16/25] vmstate: Introduce the concept of sub-arrays,
Juan Quintela <=
- [Qemu-devel] [PATCH 19/25] eeprom93xx: port to vmstate, Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 21/25] pcnet: port to vmstate, Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 18/25] rtl8139: port to vmstate, Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 22/25] ne2000: port to vmstate, Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 20/25] eepro100: port to vmstate, Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 24/25] e1000: unfold mac_regarraystosave array, Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 23/25] e1000: unfold mac_reg_tosave array, Juan Quintela, 2009/10/19
- [Qemu-devel] [PATCH 25/25] e1000: port to vmstate, Juan Quintela, 2009/10/19
- Re: [Qemu-devel] [PATCH 00/25] VMState cleanups and conversion of network drivers, Jamie Lokier, 2009/10/19