It could be used to save/load array of structs with statically known length
pointed by device state member.

Signed-off-by: Igor Mitsyanko <i.mitsya...@samsung.com>
---
 vmstate.h |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/vmstate.h b/vmstate.h
index 82d97ae..69e8ac1 100644
--- a/vmstate.h
+++ b/vmstate.h
@@ -323,6 +323,20 @@ extern const VMStateInfo vmstate_info_unused_buffer;
     .offset     = vmstate_offset_pointer(_state, _field, _type),     \
 }
 
+#define VMSTATE_STRUCT_ARRAY_POINTER_TEST_V(_field, _state, _num, _version, 
_test, _vmsd, _type) { \
+    .name       = (stringify(_field)),                               \
+    .version_id = (_version),                                        \
+    .field_exists = (_test),                                         \
+    .size       = sizeof(_type),                                     \
+    .num        = (_num),                                            \
+    .vmsd       = &(_vmsd),                                          \
+    .flags      = VMS_POINTER | VMS_STRUCT | VMS_ARRAY,              \
+    .offset     = vmstate_offset_pointer(_state, _field, _type),     \
+}
+
+#define VMSTATE_STRUCT_ARRAY_POINTER(_field, _state, _num, _vmsd, _type)  \
+    VMSTATE_STRUCT_ARRAY_POINTER_TEST_V(_field, _state, _num, 0, NULL, _vmsd, 
_type)
+
 #define VMSTATE_STRUCT_VARRAY_INT32(_field, _state, _field_num, _version, 
_vmsd, _type) { \
     .name       = (stringify(_field)),                               \
     .num_offset = vmstate_offset_value(_state, _field_num, int32_t), \
-- 
1.7.4.1


Reply via email to