qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 03/11] vmstate: for vmstate types that reuse the sam


From: Anthony Liguori
Subject: [Qemu-devel] [PATCH 03/11] vmstate: for vmstate types that reuse the same field, make sure name is unique
Date: Tue, 22 Mar 2011 19:16:08 -0500

For a schema to work, we need to make sure that each field name is unique.  We
have a number of derivative types today that reuse the base name.  This patch
fixes this.

Signed-off-by: Anthony Liguori <address@hidden>
---
 hw/hw.h |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/hw/hw.h b/hw/hw.h
index 81bbd7a..9a9012f 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -390,6 +390,16 @@ extern const VMStateInfo vmstate_info_unused_buffer;
     .offset       = vmstate_offset_value(_state, _field, _type),     \
 }
 
+#define VMSTATE_SINGLE_TEST_HACK(_field, _state, _test, _version, _info, 
_type) { \
+    .name         = (stringify(_field) "-hack"),                     \
+    .version_id   = (_version),                                      \
+    .field_exists = (_test),                                         \
+    .size         = sizeof(_type),                                   \
+    .info         = &(_info),                                        \
+    .flags        = VMS_SINGLE,                                      \
+    .offset       = vmstate_offset_value(_state, _field, _type),     \
+}
+
 #define VMSTATE_POINTER(_field, _state, _version, _info, _type) {    \
     .name       = (stringify(_field)),                               \
     .version_id = (_version),                                        \
@@ -419,7 +429,7 @@ extern const VMStateInfo vmstate_info_unused_buffer;
 }
 
 #define VMSTATE_ARRAY_TEST(_field, _state, _num, _test, _info, _type) {\
-    .name         = (stringify(_field)),                              \
+    .name         = (stringify(_field) "-" stringify(_test)),         \
     .field_exists = (_test),                                          \
     .num          = (_num),                                           \
     .info         = &(_info),                                         \
@@ -429,7 +439,7 @@ extern const VMStateInfo vmstate_info_unused_buffer;
 }
 
 #define VMSTATE_SUB_ARRAY(_field, _state, _start, _num, _version, _info, 
_type) { \
-    .name       = (stringify(_field)),                               \
+    .name       = (stringify(_field) "[" stringify(_start) "]"),      \
     .version_id = (_version),                                        \
     .num        = (_num),                                            \
     .info       = &(_info),                                          \
@@ -621,7 +631,7 @@ extern const VMStateInfo vmstate_info_unused_buffer;
 }
 
 #define VMSTATE_UNUSED_BUFFER(_test, _version, _size) {              \
-    .name         = "unused",                                        \
+    .name         = "unused" stringify(__LINE__),                    \
     .field_exists = (_test),                                         \
     .version_id   = (_version),                                      \
     .size         = (_size),                                         \
-- 
1.7.0.4




reply via email to

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