Skip to contentSkip to conversation

vmstate: add VMSTATE_ macro for pointer to array of structures

Qemu-devel Dmitry Eremin-Solenikov 1 participant 1 message Jan 22, 2011

lore
Share & tools
lore
#0 lore raw

While working on cleaning up pxa2xx_timer, I stumbled upon storing array of structures, which is referenced via a pointer. Thus I had to add this macro.

---
 hw/hw.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
hw/hw.h +10 -0
index 163a683..acdeb6a 100644
@@ -456,6 +456,16 @@ extern const VMStateInfo vmstate_info_unused_buffer;
     .offset       = vmstate_offset_value(_state, _field, _type),     \
 }
 
+#define VMSTATE_STRUCT_POINTER_ARRAY_TEST(_field, _state, _num, _test, _vmsd, _type) { \
+    .name         = (stringify(_field)),                             \
+    .field_exists = (_test),                                         \
+    .num          = (_num),                                          \
+    .vmsd         = &(_vmsd),                                        \
+    .size         = sizeof(_type),                                   \
+    .flags        = VMS_STRUCT|VMS_POINTER|VMS_ARRAY,                \
+    .offset       = vmstate_offset_pointer(_state, _field, _type),     \
+}
+
 #define VMSTATE_STRUCT_POINTER_TEST(_field, _state, _test, _vmsd, _type) { \
     .name         = (stringify(_field)),                             \
     .field_exists = (_test),                                         \
Signature · 1 line
1.7.2.3