qemu-patch-raspberry4/scripts
Eric Blake 32bafa8fdd qapi: Don't special-case simple union wrappers
Simple unions were carrying a special case that hid their 'data'
QMP member from the resulting C struct, via the hack method
QAPISchemaObjectTypeVariant.simple_union_type().  But by using
the work we started by unboxing flat union and alternate
branches, coupled with the ability to visit the members of an
implicit type, we can now expose the simple union's implicit
type in qapi-types.h:

| struct q_obj_ImageInfoSpecificQCow2_wrapper {
|     ImageInfoSpecificQCow2 *data;
| };
|
| struct q_obj_ImageInfoSpecificVmdk_wrapper {
|     ImageInfoSpecificVmdk *data;
| };
...
| struct ImageInfoSpecific {
|     ImageInfoSpecificKind type;
|     union { /* union tag is @type */
|         void *data;
|-        ImageInfoSpecificQCow2 *qcow2;
|-        ImageInfoSpecificVmdk *vmdk;
|+        q_obj_ImageInfoSpecificQCow2_wrapper qcow2;
|+        q_obj_ImageInfoSpecificVmdk_wrapper vmdk;
|     } u;
| };

Doing this removes asymmetry between QAPI's QMP side and its
C side (both sides now expose 'data'), and means that the
treatment of a simple union as sugar for a flat union is now
equivalent in both languages (previously the two approaches used
a different layer of dereferencing, where the simple union could
be converted to a flat union with equivalent C layout but
different {} on the wire, or to an equivalent QMP wire form
but with different C representation).  Using the implicit type
also lets us get rid of the simple_union_type() hack.

Of course, now all clients of simple unions have to adjust from
using su->u.member to using su->u.member.data; while this touches
a number of files in the tree, some earlier cleanup patches
helped minimize the change to the initialization of a temporary
variable rather than every single member access.  The generated
qapi-visit.c code is also affected by the layout change:

|@@ -7393,10 +7393,10 @@ void visit_type_ImageInfoSpecific_member
|     }
|     switch (obj->type) {
|     case IMAGE_INFO_SPECIFIC_KIND_QCOW2:
|-        visit_type_ImageInfoSpecificQCow2(v, "data", &obj->u.qcow2, &err);
|+        visit_type_q_obj_ImageInfoSpecificQCow2_wrapper_members(v, &obj->u.qcow2, &err);
|         break;
|     case IMAGE_INFO_SPECIFIC_KIND_VMDK:
|-        visit_type_ImageInfoSpecificVmdk(v, "data", &obj->u.vmdk, &err);
|+        visit_type_q_obj_ImageInfoSpecificVmdk_wrapper_members(v, &obj->u.vmdk, &err);
|         break;
|     default:
|         abort();

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1458254921-17042-13-git-send-email-eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
2016-03-18 10:29:26 +01:00
..
kvm scripts/kvm/kvm_stat: Fix missing right parantheses and ".format(...)" 2016-02-22 18:40:22 +01:00
qemu-guest-agent qemu-ga: sample fsfreeze hooks 2013-01-08 16:38:12 -06:00
qemugdb scripts/gdb: Fix a python exception in mtree.py 2015-12-22 16:01:08 +08:00
qmp qmp-shell: fix pretty printing of JSON responses 2016-03-04 17:16:32 +01:00
tracetool trace: Add a proper API to manage auto-generated events from the 'tcg' property 2016-03-01 13:34:38 +00:00
analyse-9p-simpletrace.py scripts/analyse-9p-simpletrace.py: Add symbolic names for 9p operations. 2011-12-21 12:37:23 +05:30
analyze-migration.py migration: fix analyze-migration.py script 2015-11-04 13:40:13 +01:00
check-qerror.sh qerror: add check-qerror.sh to verify alphabetical order 2012-01-18 10:23:39 -02:00
checkpatch.pl checkpatch: Eliminate false positive in case of space before square bracket in a definition 2016-02-15 20:02:09 +01:00
clean-includes include/config.h: Remove 2016-03-16 12:48:11 +00:00
cleanup-trace-events.pl cleanup-trace-events.pl: Tighten search for trace event call 2014-09-26 09:34:38 +01:00
cocci-macro-file.h add macro file for coccinelle 2015-09-09 15:34:55 +02:00
coverity-model.c coverity: Model g_memdup() 2015-12-17 17:33:49 +01:00
create_config io: add QIOChannelSocket class 2015-12-18 12:18:31 +00:00
disas-objdump.pl disas-objdump: Pass --adjust-vma to objdump 2013-08-24 07:26:45 +02:00
dump-guest-memory.py memory: Drop MemoryRegion.ram_addr 2016-03-07 13:26:29 +01:00
extract-vsssdk-headers Add a script to extract VSS SDK headers on POSIX system 2013-09-09 14:17:56 -05:00
feature_to_c.sh scripts/feature_to_c.sh: Include qemu/osdep.h rather than config.h 2016-02-16 14:29:27 +00:00
get_maintainer.pl get_maintainer.pl: fall back to git if only lists are found 2016-02-09 17:07:55 +01:00
gtester-cat test makefile overhaul 2012-03-30 08:14:11 -05:00
hxtool vl.c: In qemu -h output, only print options for the arch we are running as 2011-12-19 10:27:33 -06:00
make-release make-release: Record SeaBIOS version 2014-03-31 15:02:04 +01:00
make_device_config.sh build: pass .d file name to scripts/make_device_config.sh, fix makefile target 2015-03-18 12:07:25 +01:00
ordereddict.py qapi: Clean up qapi.py per pep8 2015-10-12 18:44:54 +02:00
qapi-commands.py qapi-commands: Inline single-use helpers of gen_marshal() 2016-03-18 10:29:26 +01:00
qapi-event.py qapi-event: Utilize implicit struct visits 2016-03-18 10:29:25 +01:00
qapi-introspect.py qapi: Clean up includes in generated files 2016-02-16 14:29:27 +00:00
qapi-types.py qapi: Don't special-case simple union wrappers 2016-03-18 10:29:26 +01:00
qapi-visit.py qapi: Don't special-case simple union wrappers 2016-03-18 10:29:26 +01:00
qapi.py qapi: Don't special-case simple union wrappers 2016-03-18 10:29:26 +01:00
qemu-binfmt-conf.sh scripts/qemu-binfmt-conf.sh: Add AArch64 registration 2014-03-17 16:31:53 +00:00
qemu-gdb.py gdb command: qemu handlers 2015-10-29 17:59:27 +00:00
qtest.py qtest: Add scripts/qtest.py 2015-02-16 15:07:18 +00:00
refresh-pxe-roms.sh roms: rewrite scripts/refresh-pxe-roms.sh 2013-09-30 09:44:35 +02:00
shaderinclude.pl opengl: add shader build infrastructure 2015-05-05 09:03:32 +02:00
signrom.py signrom: Rewrite as python script 2012-04-16 15:41:20 +02:00
simpletrace.py simpletrace: add simpletrace.py --no-header option 2014-08-12 14:26:11 +01:00
switch-timer-api misc: Fix case Qemu -> QEMU 2014-02-15 16:10:25 +04:00
texi2pod.pl scripts/text2pod.pl: Escape left brace 2015-11-02 14:50:27 +01:00
tracetool.py Revert "tracetool: use Python 2.4-compatible exception handling syntax" 2016-02-08 17:29:54 +01:00
update-linux-headers.sh update-linux-headers.sh: Fake types.h doesn't need to include anything 2016-03-16 12:48:11 +00:00
vmstate-static-checker.py static checker: e1000-82540em got aliased to e1000 2016-02-05 19:09:50 +05:30