|
| From: | Anthony Liguori |
| Subject: | Re: [Qemu-devel] [PATCH 03/11] vmstate: for vmstate types that reuse the same field, make sure name is unique |
| Date: | Tue, 22 Mar 2011 21:29:23 -0500 |
| User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.14) Gecko/20110223 Lightning/1.0b2 Thunderbird/3.1.8 |
On 03/22/2011 07:16 PM, Anthony Liguori wrote:
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__), \
Why this does generate a unique name, it does not generate a stable name. We need to add a name argument to this macro and all its derivatives. I'll update tomorrow.
If the test suite fails saying you added a new field labelled "unusedXXXX", this is why.
Regards, Anthony Liguori
.field_exists = (_test), \
.version_id = (_version), \
.size = (_size), \
| [Prev in Thread] | Current Thread | [Next in Thread] |