Patchwork [V3,2/4] vmstate.h: introduce VMSTATE_STRUCT_ARRAY_POINTER_TEST_V

login
register
mail settings
Submitter Mitsyanko Igor
Date April 24, 2012, 6:36 p.m.
Message ID <1335292579-19400-3-git-send-email-i.mitsyanko@samsung.com>
Download mbox | patch
Permalink /patch/154740/
State New
Headers show

Comments

Mitsyanko Igor - April 24, 2012, 6:36 p.m.
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.mitsyanko@samsung.com>
---
 vmstate.h |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

Patch

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), \