aboutsummaryrefslogtreecommitdiff
path: root/tests/test-qmp-output-visitor.c
diff options
context:
space:
mode:
authorMichael Roth <mdroth@linux.vnet.ibm.com>2013-05-26 22:20:58 -0500
committerLuiz Capitulino <lcapitulino@redhat.com>2013-05-30 09:08:38 -0400
commita678e26cbe89f7a27cbce794c2c2784571ee9d21 (patch)
tree2cd61bcd9acd3f775beb2a2034866c0e6cbb8ba7 /tests/test-qmp-output-visitor.c
parent87d23f78aa79b72da022afda358bbc8a8509ca70 (diff)
downloadqemu-a678e26cbe89f7a27cbce794c2c2784571ee9d21.zip
qemu-a678e26cbe89f7a27cbce794c2c2784571ee9d21.tar.gz
qemu-a678e26cbe89f7a27cbce794c2c2784571ee9d21.tar.bz2
qapi: pad GenericList value fields to 64 bits
With the introduction of native list types, we now have types such as int64List where the 'value' field is not a pointer, but the actual 64-bit value. On 32-bit architectures, this can lead to situations where 'next' field offset in GenericList does not correspond to the 'next' field in the types that we cast to GenericList when using the visit_next_list() interface, causing issues when we attempt to traverse linked list structures of these types. To fix this, pad the 'value' field of GenericList and other schema-defined/native *List types out to 64-bits. This is less memory-efficient for 32-bit architectures, but allows us to continue to rely on list-handling interfaces that target GenericList to simply visitor implementations. In the future we can improve efficiency by defaulting to using native C array backends to handle list of non-pointer types, which would be more memory efficient in itself and allow us to roll back this change. Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'tests/test-qmp-output-visitor.c')
-rw-r--r--tests/test-qmp-output-visitor.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/test-qmp-output-visitor.c b/tests/test-qmp-output-visitor.c
index 0942a41..b2fa9a7 100644
--- a/tests/test-qmp-output-visitor.c
+++ b/tests/test-qmp-output-visitor.c
@@ -295,7 +295,10 @@ static void test_visitor_out_struct_errors(TestOutputVisitorData *data,
typedef struct TestStructList
{
- TestStruct *value;
+ union {
+ TestStruct *value;
+ uint64_t padding;
+ };
struct TestStructList *next;
} TestStructList;