OSDN Git Service

Add VMState support for arrays of structs
authorJuan Quintela <quintela@redhat.com>
Thu, 20 Aug 2009 17:42:30 +0000 (19:42 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Fri, 28 Aug 2009 01:30:21 +0000 (20:30 -0500)
This patch add supports for arrays of structs

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/hw.h

diff --git a/hw/hw.h b/hw/hw.h
index 2ee307e..98afd22 100644 (file)
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -361,6 +361,17 @@ extern const VMStateInfo vmstate_info_timer;
             + type_check(_type,typeof_field(_state, _field))         \
 }
 
+#define VMSTATE_STRUCT_ARRAY(_field, _state, _num, _version, _vmsd, _type) { \
+    .name       = (stringify(_field)),                               \
+    .num        = (_num),                                            \
+    .version_id = (_version),                                        \
+    .vmsd       = &(_vmsd),                                          \
+    .size       = sizeof(_type),                                     \
+    .flags      = VMS_STRUCT|VMS_ARRAY,                              \
+    .offset     = offsetof(_state, _field)                           \
+        + type_check_array(_type,typeof_field(_state, _field),_num)  \
+}
+
 /* _f : field name
    _n : num of elements
    _s : struct state name