qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH V3 2/4] vmstate.h: introduce VMSTATE_STRUCT_ARRAY_PO


From: Igor Mitsyanko
Subject: [Qemu-devel] [PATCH V3 2/4] vmstate.h: introduce VMSTATE_STRUCT_ARRAY_POINTER_TEST_V
Date: Tue, 24 Apr 2012 22:36:17 +0400

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

Signed-off-by: Igor Mitsyanko <address@hidden>
---
 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

[Prev in Thread] Current Thread [Next in Thread]