It's time to expose QMP 'netdev_add' through introspection, and to add boxed commands/events so that we can drastically reduce the number of C parameters needed to implement a command that matches a large QAPI type.
Prerequistes: Markus' qapi-next branch (including my clone visitor) available as a tag at: git fetch git://repo.or.cz/qemu/ericb.git qapi-cleanupv8f or as part of my qapi branch: git fetch git://repo.or.cz/qemu/ericb.git qapi v7 was here: https://lists.gnu.org/archive/html/qemu-devel/2016-05/msg03569.html Since then, I've addressed a lot of Markus' comments: - drop 1/15 - split out a couple of patches - wording tweaks, more justifications in some commit messages - rebase to master - allow boxed alternates, in addition to boxed unions - forbid empty anonymous branches for now 001/16:[----] [--] 'net: use Netdev instead of NetClientOptions in client init' 002/16:[----] [--] 'qapi: Require all branches of flat union enum to be covered' 003/16:[----] [--] 'qapi: Hide tag_name data member of variants' 004/16:[0006] [FC] 'qapi: Add type.is_empty() helper' 005/16:[down] 'qapi: Drop useless gen_err_check()' 006/16:[down] 'qapi-event: Simplify visit of non-implicit data' 007/16:[0028] [FC] 'qapi: Plumb in 'box' to qapi generator lower levels' 008/16:[0121] [FC] 'qapi: Implement boxed types for commands/events' 009/16:[0002] [FC] 'block: Simplify block_set_io_throttle' 010/16:[0023] [FC] 'block: Simplify drive-mirror' 011/16:[0026] [FC] 'qapi-event: Reduce chance of collision with event data' 012/16:[0042] [FC] 'qapi: Change Netdev into a flat union' 013/16:[----] [--] 'net: Use correct type for bool flag' 014/16:[0008] [FC] 'net: Complete qapi-fication of netdev_add' 015/16:[0037] [FC] 'qapi: Allow anonymous branch types in flat union' 016/16:[----] [--] 'schema: Drop pointless empty type CpuInfoOther' Other patches on my QAPI queue: - posted, but needs another respin and might not make 2.7: JSON output visitor - not posted, and therefore most likely not 2.7 material: anything we need to do to make 'blockdev-add' work smoothly (we may want to allow a flat union with a default value for its discriminator, and/or add a way to express mutually-exclusive members in a qapi dict) Other potential general QAPI patches, but not necessarily that I will write: - Marc-Andre's cleanups - convert more clients to use boxed commands - get rid of has_FOO when FOO is pointer - support default values (and get rid of has_FOO when FOO has default) - QAPI-fy device_add - ??? Eric Blake (15): qapi: Require all branches of flat union enum to be covered qapi: Hide tag_name data member of variants qapi: Add type.is_empty() helper qapi: Drop useless gen_err_check() qapi-event: Simplify visit of non-implicit data qapi: Plumb in 'box' to qapi generator lower levels qapi: Implement boxed types for commands/events block: Simplify block_set_io_throttle block: Simplify drive-mirror qapi-event: Reduce chance of collision with event data qapi: Change Netdev into a flat union net: Use correct type for bool flag net: Complete qapi-fication of netdev_add qapi: Allow anonymous branch types in flat union schema: Drop pointless empty type CpuInfoOther Kővágó, Zoltán (1): net: use Netdev instead of NetClientOptions in client init qapi-schema.json | 76 +++++---- qapi/block-core.json | 40 ++++- scripts/qapi.py | 153 ++++++++++++----- scripts/qapi-commands.py | 31 ++-- scripts/qapi-event.py | 71 +++++--- scripts/qapi-introspect.py | 4 +- scripts/qapi-types.py | 2 +- scripts/qapi-visit.py | 22 ++- include/net/net.h | 8 +- net/clients.h | 20 +-- blockdev.c | 187 ++++++++------------- hmp.c | 72 +++----- hw/arm/musicpal.c | 2 +- hw/core/qdev-properties-system.c | 2 +- hw/net/allwinner_emac.c | 2 +- hw/net/cadence_gem.c | 2 +- hw/net/dp8393x.c | 2 +- hw/net/e1000.c | 2 +- hw/net/e1000e.c | 2 +- hw/net/eepro100.c | 2 +- hw/net/etraxfs_eth.c | 2 +- hw/net/fsl_etsec/etsec.c | 2 +- hw/net/imx_fec.c | 2 +- hw/net/lan9118.c | 2 +- hw/net/lance.c | 2 +- hw/net/mcf_fec.c | 2 +- hw/net/milkymist-minimac2.c | 2 +- hw/net/mipsnet.c | 2 +- hw/net/ne2000-isa.c | 2 +- hw/net/ne2000.c | 2 +- hw/net/opencores_eth.c | 2 +- hw/net/pcnet-pci.c | 2 +- hw/net/rocker/rocker_fp.c | 2 +- hw/net/rtl8139.c | 2 +- hw/net/smc91c111.c | 2 +- hw/net/spapr_llan.c | 2 +- hw/net/stellaris_enet.c | 2 +- hw/net/vhost_net.c | 20 +-- hw/net/virtio-net.c | 10 +- hw/net/vmxnet3.c | 2 +- hw/net/xen_nic.c | 2 +- hw/net/xgmac.c | 2 +- hw/net/xilinx_axienet.c | 2 +- hw/net/xilinx_ethlite.c | 2 +- hw/usb/dev-network.c | 4 +- monitor.c | 14 +- net/dump.c | 8 +- net/filter.c | 2 +- net/hub.c | 24 +-- net/l2tpv3.c | 8 +- net/net.c | 164 +++++++++++------- net/netmap.c | 6 +- net/slirp.c | 8 +- net/socket.c | 10 +- net/tap-win32.c | 8 +- net/tap.c | 28 +-- net/vde.c | 8 +- net/vhost-user.c | 22 +-- tests/test-qmp-commands.c | 8 + docs/qapi-code-gen.txt | 27 ++- qmp-commands.hx | 2 +- tests/Makefile.include | 7 + tests/qapi-schema/args-bad-box.err | 1 + tests/qapi-schema/args-bad-box.exit | 1 + tests/qapi-schema/args-bad-box.json | 2 + tests/qapi-schema/args-bad-box.out | 0 tests/qapi-schema/args-box-anon.err | 1 + tests/qapi-schema/args-box-anon.exit | 1 + tests/qapi-schema/args-box-anon.json | 2 + tests/qapi-schema/args-box-anon.out | 0 tests/qapi-schema/args-box-empty.err | 1 + tests/qapi-schema/args-box-empty.exit | 1 + tests/qapi-schema/args-box-empty.json | 3 + tests/qapi-schema/args-box-empty.out | 0 tests/qapi-schema/args-box-string.err | 1 + tests/qapi-schema/args-box-string.exit | 1 + tests/qapi-schema/args-box-string.json | 2 + tests/qapi-schema/args-box-string.out | 0 tests/qapi-schema/args-union.err | 2 +- tests/qapi-schema/args-union.json | 3 +- tests/qapi-schema/event-box-empty.err | 1 + tests/qapi-schema/event-box-empty.exit | 1 + tests/qapi-schema/event-box-empty.json | 2 + tests/qapi-schema/event-box-empty.out | 0 tests/qapi-schema/event-case.out | 1 + tests/qapi-schema/flat-union-incomplete-branch.err | 1 + .../qapi-schema/flat-union-incomplete-branch.exit | 1 + .../qapi-schema/flat-union-incomplete-branch.json | 9 + tests/qapi-schema/flat-union-incomplete-branch.out | 0 tests/qapi-schema/flat-union-inline.err | 2 +- tests/qapi-schema/flat-union-inline.json | 5 +- tests/qapi-schema/ident-with-escape.out | 2 +- tests/qapi-schema/indented-expr.out | 4 +- tests/qapi-schema/qapi-schema-test.json | 12 +- tests/qapi-schema/qapi-schema-test.out | 44 ++++- tests/qapi-schema/test-qapi.py | 11 +- tests/qapi-schema/union-inline.err | 1 + tests/qapi-schema/union-inline.exit | 1 + tests/qapi-schema/union-inline.json | 4 + tests/qapi-schema/union-inline.out | 0 100 files changed, 732 insertions(+), 526 deletions(-) create mode 100644 tests/qapi-schema/args-bad-box.err create mode 100644 tests/qapi-schema/args-bad-box.exit create mode 100644 tests/qapi-schema/args-bad-box.json create mode 100644 tests/qapi-schema/args-bad-box.out create mode 100644 tests/qapi-schema/args-box-anon.err create mode 100644 tests/qapi-schema/args-box-anon.exit create mode 100644 tests/qapi-schema/args-box-anon.json create mode 100644 tests/qapi-schema/args-box-anon.out create mode 100644 tests/qapi-schema/args-box-empty.err create mode 100644 tests/qapi-schema/args-box-empty.exit create mode 100644 tests/qapi-schema/args-box-empty.json create mode 100644 tests/qapi-schema/args-box-empty.out create mode 100644 tests/qapi-schema/args-box-string.err create mode 100644 tests/qapi-schema/args-box-string.exit create mode 100644 tests/qapi-schema/args-box-string.json create mode 100644 tests/qapi-schema/args-box-string.out create mode 100644 tests/qapi-schema/event-box-empty.err create mode 100644 tests/qapi-schema/event-box-empty.exit create mode 100644 tests/qapi-schema/event-box-empty.json create mode 100644 tests/qapi-schema/event-box-empty.out create mode 100644 tests/qapi-schema/flat-union-incomplete-branch.err create mode 100644 tests/qapi-schema/flat-union-incomplete-branch.exit create mode 100644 tests/qapi-schema/flat-union-incomplete-branch.json create mode 100644 tests/qapi-schema/flat-union-incomplete-branch.out create mode 100644 tests/qapi-schema/union-inline.err create mode 100644 tests/qapi-schema/union-inline.exit create mode 100644 tests/qapi-schema/union-inline.json create mode 100644 tests/qapi-schema/union-inline.out -- 2.5.5