QAPI patches for 2018-03-01
Subsystems (5)
The following changes since commit 0dc8ae5e8e693737dfe65ba02d0c6eccb58a9c67:
Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20180301-v2' into staging (2018-03-01 17:08:16 +0000)
are available in the Git repository at:
git://repo.or.cz/qemu/ericb.git tags/pull-qapi-2018-03-01-v2
for you to fetch changes up to 76b2baeed38089c19f69c7117b8eaa64b0e7d227:
qapi: Don't create useless directory qapi-generated (2018-03-01 19:16:40 -0600)
v2: fix rebase on top of s390x work so that build is successful (if I do it right, I'm sending just the changed patches)
Again, this series will be a conflict magnet due to content motion from qapi-schema.json to qapi/misc.json; hopefully, the level of rebasing required is not too painful
----------------------------------------------------------------
qapi patches for 2018-03-01
- Markus Armbruster: Modularize generated QAPI code
----------------------------------------------------------------
Eric Blake (1):
watchdog: Consolidate QAPI into single file
Markus Armbruster (29):
Include qapi/qmp/qerror.h exactly where needed
qapi: Streamline boilerplate comment generation
qapi: Generate up-to-date copyright notice
qapi: Rename variable holding the QAPISchemaGenFOOVisitor
qapi: New classes QAPIGenC, QAPIGenH, QAPIGenDoc
qapi: Reduce use of global variables in generators some
qapi: Turn generators into modules
qapi-gen: New common driver for code and doc generators
qapi-gen: Convert from getopt to argparse
qapi: Touch generated files only when they change
qapi: Improve include file name reporting in error messages qapi/common: Eliminate QAPISchema.exprs
qapi: Lift error reporting from QAPISchema.__init__() to callers
qapi: Concentrate QAPISchemaParser.exprs updates in .__init__()
qapi: Record 'include' directives in parse tree
qapi: Generate in source order
qapi: Record 'include' directives in intermediate representation
qapi: Rename generated qmp-marshal.c to qmp-commands.c
qapi: Make code-generating visitors use QAPIGen more qapi/types qapi/visit: Generate built-in stuff into separate files qapi/common: Fix guardname() for funny filenames
qapi: Generate separate .h, .c for each module
Include less of the generated modular QAPI headers
qapi: Empty out qapi-schema.json docs/devel/writing-qmp-commands: Update for modular QAPI
docs: Correct outdated information on QAPI
qapi: Move qapi-schema.json to qapi/, rename generated files Fix up dangling references to qmp-commands.* in comment and doc
qapi: Don't create useless directory qapi-generated
docs/devel/qapi-code-gen.txt | 124 ++++---
docs/devel/writing-qmp-commands.txt | 39 +--
docs/interop/qmp-intro.txt | 3 +-
docs/xen-save-devices-state.txt | 3 +-
tests/qapi-schema/doc-good.texi | 3 +-
configure | 1 -
Makefile | 233 ++++++++++----
Makefile.objs | 80 ++++-
qapi-schema.json => qapi/misc.json | 105 +-----
qapi/qapi-schema.json | 95 ++++++
qapi/run-state.json | 9 +
include/qapi/visitor.h | 2 +-
scripts/qapi-gen.py | 57 ++++
scripts/qapi/__init__.py | 0
scripts/{qapi-commands.py => qapi/commands.py} | 155 ++++-----
scripts/{qapi.py => qapi/common.py} | 355 +++++++++++++--------
scripts/{qapi2texi.py => qapi/doc.py} | 92 +++---
scripts/{qapi-event.py => qapi/events.py} | 128 +++-----
scripts/{qapi-introspect.py => qapi/introspect.py} | 123 +++----
scripts/{qapi-types.py => qapi/types.py} | 185 ++++-------
scripts/{qapi-visit.py => qapi/visit.py} | 189 ++++-------
crypto/cipherpriv.h | 2 +-
include/block/block.h | 2 +-
include/block/dirty-bitmap.h | 2 +-
include/block/nbd.h | 2 +-
include/chardev/char.h | 1 +
include/crypto/cipher.h | 2 +-
include/crypto/hash.h | 2 +-
include/crypto/hmac.h | 2 +-
include/crypto/secret.h | 1 +
include/crypto/tlscreds.h | 1 +
include/hw/block/block.h | 2 +-
include/hw/block/fdc.h | 2 +-
include/hw/ppc/spapr_drc.h | 1 +
include/hw/qdev-properties.h | 2 +
include/io/dns-resolver.h | 1 +
include/migration/colo.h | 2 +-
include/migration/failover.h | 2 +-
include/migration/global_state.h | 1 +
include/monitor/monitor.h | 1 +
include/net/filter.h | 1 +
include/net/net.h | 2 +-
include/qapi/clone-visitor.h | 1 -
include/qapi/error.h | 2 +-
include/qapi/qmp/qobject.h | 2 +-
include/qemu/sockets.h | 2 +-
include/qemu/throttle.h | 2 +-
include/qom/cpu.h | 1 +
include/qom/object.h | 2 +-
include/sysemu/arch_init.h | 2 +-
include/sysemu/balloon.h | 2 +-
include/sysemu/dump.h | 2 +
include/sysemu/hostmem.h | 1 +
include/sysemu/replay.h | 2 +
include/sysemu/sysemu.h | 1 +
include/sysemu/tpm.h | 1 +
include/sysemu/watchdog.h | 2 +-
include/ui/console.h | 1 +
include/ui/input.h | 2 +-
migration/migration.h | 1 +
migration/ram.h | 2 +-
net/tap_int.h | 2 +-
replication.h | 1 +
ui/vnc.h | 1 +
vl.c | 8 +-
arch_init.c | 2 +-
backends/cryptodev.c | 1 -
backends/hostmem.c | 3 +-
balloon.c | 2 +-
block.c | 2 -
block/block-backend.c | 2 +-
block/crypto.c | 2 +-
block/iscsi.c | 2 +-
block/nbd.c | 2 +-
block/nfs.c | 2 +-
block/qapi.c | 4 +-
block/qcow2.c | 4 +-
block/quorum.c | 2 +-
block/sheepdog.c | 2 +-
block/ssh.c | 2 +-
block/throttle-groups.c | 2 +-
block/write-threshold.c | 4 +-
blockdev-nbd.c | 2 +-
blockdev.c | 5 +-
blockjob.c | 2 +-
chardev/char-fe.c | 2 +-
chardev/char-ringbuf.c | 2 +-
chardev/char-socket.c | 1 +
chardev/char.c | 4 +-
cpus.c | 4 +-
dump.c | 4 +-
hmp.c | 12 +-
hw/acpi/core.c | 4 +-
hw/acpi/cpu.c | 2 +-
hw/acpi/memory_hotplug.c | 2 +-
hw/acpi/vmgenid.c | 2 +-
hw/block/block.c | 1 +
hw/block/hd-geometry.c | 1 +
hw/char/virtio-console.c | 2 +-
hw/core/machine.c | 2 +-
hw/core/qdev.c | 2 +-
hw/i386/pc.c | 2 +-
hw/i386/xen/xen-hvm.c | 2 +-
hw/ipmi/ipmi.c | 2 +-
hw/mem/nvdimm.c | 1 -
hw/net/rocker/qmp-norocker.c | 2 +-
hw/net/rocker/rocker.c | 2 +-
hw/net/rocker/rocker_fp.c | 2 +-
hw/net/rocker/rocker_of_dpa.c | 2 +-
hw/net/virtio-net.c | 2 +-
hw/pci/pci-stub.c | 2 +-
hw/pci/pci.c | 2 +-
hw/ppc/spapr_rtas.c | 1 -
hw/ppc/spapr_rtc.c | 2 +-
hw/s390x/s390-skeys.c | 2 +-
hw/timer/mc146818rtc.c | 4 +-
hw/tpm/tpm_emulator.c | 1 +
hw/tpm/tpm_passthrough.c | 1 +
hw/virtio/virtio-balloon.c | 2 +-
hw/watchdog/watchdog.c | 4 +-
io/channel-socket.c | 1 +
io/dns-resolver.c | 1 +
iothread.c | 2 +-
migration/colo-failover.c | 2 +-
migration/colo.c | 2 +-
migration/migration.c | 4 +-
migration/ram.c | 2 +-
migration/savevm.c | 3 +-
monitor.c | 8 +-
net/colo-compare.c | 1 -
net/filter-buffer.c | 2 +-
net/filter-mirror.c | 1 -
net/filter-rewriter.c | 1 -
net/net.c | 4 +-
net/vhost-user.c | 2 +-
numa.c | 4 +-
qdev-monitor.c | 2 +-
qemu-img.c | 2 +-
qga/commands-posix.c | 2 +-
qga/commands-win32.c | 2 +-
qga/commands.c | 2 +-
qga/main.c | 2 +-
qmp.c | 18 +-
qom/object.c | 2 +-
qom/object_interfaces.c | 2 +-
replay/replay-input.c | 1 +
stubs/tpm.c | 3 +-
stubs/uuid.c | 2 +-
stubs/vmgenid.c | 2 +-
stubs/xen-hvm.c | 2 +-
target/arm/monitor.c | 3 +-
target/i386/cpu.c | 4 +-
target/s390x/cpu.c | 3 +-
target/s390x/kvm.c | 1 -
target/s390x/sigp.c | 1 +
tests/qmp-test.c | 3 +-
tests/test-char.c | 2 +-
tests/{test-qmp-commands.c => test-qmp-cmds.c} | 2 +-
tests/test-qmp-event.c | 3 +-
tests/test-qobject-input-visitor.c | 8 +-
tests/test-visitor-serialization.c | 1 -
tpm.c | 5 +-
trace/qmp.c | 2 +-
ui/console.c | 2 +-
ui/gtk.c | 2 +-
ui/input-legacy.c | 2 +-
ui/input.c | 2 +-
ui/spice-core.c | 4 +-
ui/vnc.c | 4 +-
util/qemu-config.c | 2 +-
util/qemu-sockets.c | 2 +-
.gitignore | 80 ++++-
qga/Makefile.objs | 2 +-
tests/.gitignore | 9 +-
tests/Makefile.include | 70 ++--
tests/qapi-schema/comments.out | 3 +-
tests/qapi-schema/doc-bad-section.out | 5 +-
tests/qapi-schema/doc-good.out | 33 +-
tests/qapi-schema/empty.out | 2 +-
tests/qapi-schema/event-case.out | 3 +-
tests/qapi-schema/ident-with-escape.out | 7 +-
tests/qapi-schema/include-no-file.err | 2 +-
tests/qapi-schema/include-relpath.out | 7 +-
tests/qapi-schema/include-repetition.out | 12 +-
tests/qapi-schema/include-simple.out | 5 +-
tests/qapi-schema/indented-expr.out | 3 +-
tests/qapi-schema/qapi-schema-test.out | 321 +++++++++----------
tests/qapi-schema/test-qapi.py | 19 +-
ui/cocoa.m | 2 +-
189 files changed, 1563 insertions(+), 1356 deletions(-)
rename qapi-schema.json => qapi/misc.json (95%)
create mode 100644 qapi/qapi-schema.json
create mode 100755 scripts/qapi-gen.py
create mode 100644 scripts/qapi/__init__.py
rename scripts/{qapi-commands.py => qapi/commands.py} (67%)
rename scripts/{qapi.py => qapi/common.py} (90%)
rename scripts/{qapi2texi.py => qapi/doc.py} (78%)
mode change 100755 => 100644
rename scripts/{qapi-event.py => qapi/events.py} (61%)
rename scripts/{qapi-introspect.py => qapi/introspect.py} (71%)
rename scripts/{qapi-types.py => qapi/types.py} (53%)
rename scripts/{qapi-visit.py => qapi/visit.py} (64%)
rename tests/{test-qmp-commands.c => test-qmp-cmds.c} (99%)Signature · 1 line
2.14.3
[Qemu-devel] [PULL v2 22/30] watchdog: Consolidate QAPI into single file
Commit f0df84c6 added watchdog-set-action in the main qapi-schema.json, but it belongs better in qapi/run-state.json alongside the definition of WatchdogAction. The command was written prior to commit 0e201d34 creating the latter file, even though it was merged after.
Message-Id: <[email protected]>
--- qapi-schema.json | 9 --------- qapi/run-state.json | 9 +++++++++ 2 files changed, 9 insertions(+), 9 deletions(-)
qapi-schema.json +0 -9
@@ -3291,12 +3291,3 @@ # Since: 2.9 ## { 'command': 'query-vm-generation-id', 'returns': 'GuidInfo' } - -## -# @watchdog-set-action: -# -# Set watchdog action -# -# Since: 2.11 -## -{ 'command': 'watchdog-set-action', 'data' : {'action': 'WatchdogAction'} }
qapi/run-state.json +9 -0
@@ -283,6 +283,15 @@ 'data': [ 'reset', 'shutdown', 'poweroff', 'pause', 'debug', 'none', 'inject-nmi' ] } +## +# @watchdog-set-action: +# +# Set watchdog action +# +# Since: 2.11 +## +{ 'command': 'watchdog-set-action', 'data' : {'action': 'WatchdogAction'} } + ## # @GUEST_PANICKED: #
Signature · 1 line
2.14.3
[Qemu-devel] [PULL v2 23/30] qapi: Generate separate .h, .c for each module
In reply to Eric BlakeFrom: Markus Armbruster <[email protected]>
Our qapi-schema.json is composed of modules connected by include directives, but the generated code is monolithic all the same: one qapi-types.h with all the types, one qapi-visit.h with all the visitors, and so forth. These monolithic headers get included all over the place. In my "build everything" tree, adding a QAPI type recompiles about 4800 out of 5100 objects.
We wouldn't write such monolithic headers by hand. It stands to reason that we shouldn't generate them, either.
Split up generated qapi-types.h to mirror the schema's modular
structure: one header per module. Name the main module's header qapi-types.h, and sub-module D/B.json's header D/qapi-types-B.h.
Mirror the schema's includes in the headers, so that qapi-types.h gets you everything exactly as before. If you need less, you can include one or more of the sub-module headers. To be exploited shortly.
Split up qapi-types.c, qapi-visit.h, qapi-visit.c, qmp-commands.h, qmp-commands.c, qapi-event.h, qapi-event.c the same way. qmp-introspect.h, qmp-introspect.c and qapi.texi remain monolithic.
The split of qmp-commands.c duplicates static helper function qmp_marshal_output_str() in qapi-commands-char.c and qapi-commands-misc.c. This happens when commands returning the same type occur in multiple modules. Not worth avoiding.
Since I'm going to rename qapi-event.[ch] to qapi-events.[ch], and qmp-commands.[ch] to qapi-commands.[ch], name the shards that way already, to reduce churn. This requires temporary hacks in commands.py and events.py. They'll go away with the rename.
Message-Id: <[email protected]>
--- Makefile | 120 +++++++++++++++++++++++++++++++++++++++++++++++ Makefile.objs | 65 ++++++++++++++++++++++++- scripts/qapi/commands.py | 35 +++++++++----- scripts/qapi/common.py | 21 +++++++-- scripts/qapi/events.py | 19 ++++++-- .gitignore | 60 ++++++++++++++++++++++++ 6 files changed, 300 insertions(+), 20 deletions(-)
Makefile +120 -0
@@ -92,10 +92,70 @@ include $(SRC_PATH)/rules.mak GENERATED_FILES = qemu-version.h config-host.h qemu-options.def GENERATED_FILES += qapi-builtin-types.h qapi-builtin-types.c GENERATED_FILES += qapi-types.h qapi-types.c +GENERATED_FILES += qapi/qapi-types-block-core.h qapi/qapi-types-block-core.c +GENERATED_FILES += qapi/qapi-types-block.h qapi/qapi-types-block.c +GENERATED_FILES += qapi/qapi-types-char.h qapi/qapi-types-char.c +GENERATED_FILES += qapi/qapi-types-common.h qapi/qapi-types-common.c +GENERATED_FILES += qapi/qapi-types-crypto.h qapi/qapi-types-crypto.c +GENERATED_FILES += qapi/qapi-types-introspect.h qapi/qapi-types-introspect.c +GENERATED_FILES += qapi/qapi-types-migration.h qapi/qapi-types-migration.c +GENERATED_FILES += qapi/qapi-types-net.h qapi/qapi-types-net.c +GENERATED_FILES += qapi/qapi-types-rocker.h qapi/qapi-types-rocker.c +GENERATED_FILES += qapi/qapi-types-run-state.h qapi/qapi-types-run-state.c +GENERATED_FILES += qapi/qapi-types-sockets.h qapi/qapi-types-sockets.c +GENERATED_FILES += qapi/qapi-types-tpm.h qapi/qapi-types-tpm.c +GENERATED_FILES += qapi/qapi-types-trace.h qapi/qapi-types-trace.c +GENERATED_FILES += qapi/qapi-types-transaction.h qapi/qapi-types-transaction.c +GENERATED_FILES += qapi/qapi-types-ui.h qapi/qapi-types-ui.c GENERATED_FILES += qapi-builtin-visit.h qapi-builtin-visit.c GENERATED_FILES += qapi-visit.h qapi-visit.c +GENERATED_FILES += qapi/qapi-visit-block-core.h qapi/qapi-visit-block-core.c +GENERATED_FILES += qapi/qapi-visit-block.h qapi/qapi-visit-block.c +GENERATED_FILES += qapi/qapi-visit-char.h qapi/qapi-visit-char.c +GENERATED_FILES += qapi/qapi-visit-common.h qapi/qapi-visit-common.c +GENERATED_FILES += qapi/qapi-visit-crypto.h qapi/qapi-visit-crypto.c +GENERATED_FILES += qapi/qapi-visit-introspect.h qapi/qapi-visit-introspect.c +GENERATED_FILES += qapi/qapi-visit-migration.h qapi/qapi-visit-migration.c +GENERATED_FILES += qapi/qapi-visit-net.h qapi/qapi-visit-net.c +GENERATED_FILES += qapi/qapi-visit-rocker.h qapi/qapi-visit-rocker.c +GENERATED_FILES += qapi/qapi-visit-run-state.h qapi/qapi-visit-run-state.c +GENERATED_FILES += qapi/qapi-visit-sockets.h qapi/qapi-visit-sockets.c +GENERATED_FILES += qapi/qapi-visit-tpm.h qapi/qapi-visit-tpm.c +GENERATED_FILES += qapi/qapi-visit-trace.h qapi/qapi-visit-trace.c +GENERATED_FILES += qapi/qapi-visit-transaction.h qapi/qapi-visit-transaction.c +GENERATED_FILES += qapi/qapi-visit-ui.h qapi/qapi-visit-ui.c GENERATED_FILES += qmp-commands.h qmp-commands.c +GENERATED_FILES += qapi/qapi-commands-block-core.h qapi/qapi-commands-block-core.c +GENERATED_FILES += qapi/qapi-commands-block.h qapi/qapi-commands-block.c +GENERATED_FILES += qapi/qapi-commands-char.h qapi/qapi-commands-char.c +GENERATED_FILES += qapi/qapi-commands-common.h qapi/qapi-commands-common.c +GENERATED_FILES += qapi/qapi-commands-crypto.h qapi/qapi-commands-crypto.c +GENERATED_FILES += qapi/qapi-commands-introspect.h qapi/qapi-commands-introspect.c +GENERATED_FILES += qapi/qapi-commands-migration.h qapi/qapi-commands-migration.c +GENERATED_FILES += qapi/qapi-commands-net.h qapi/qapi-commands-net.c +GENERATED_FILES += qapi/qapi-commands-rocker.h qapi/qapi-commands-rocker.c +GENERATED_FILES += qapi/qapi-commands-run-state.h qapi/qapi-commands-run-state.c +GENERATED_FILES += qapi/qapi-commands-sockets.h qapi/qapi-commands-sockets.c +GENERATED_FILES += qapi/qapi-commands-tpm.h qapi/qapi-commands-tpm.c +GENERATED_FILES += qapi/qapi-commands-trace.h qapi/qapi-commands-trace.c +GENERATED_FILES += qapi/qapi-commands-transaction.h qapi/qapi-commands-transaction.c +GENERATED_FILES += qapi/qapi-commands-ui.h qapi/qapi-commands-ui.c GENERATED_FILES += qapi-event.h qapi-event.c +GENERATED_FILES += qapi/qapi-events-block-core.h qapi/qapi-events-block-core.c +GENERATED_FILES += qapi/qapi-events-block.h qapi/qapi-events-block.c +GENERATED_FILES += qapi/qapi-events-char.h qapi/qapi-events-char.c +GENERATED_FILES += qapi/qapi-events-common.h qapi/qapi-events-common.c +GENERATED_FILES += qapi/qapi-events-crypto.h qapi/qapi-events-crypto.c +GENERATED_FILES += qapi/qapi-events-introspect.h qapi/qapi-events-introspect.c +GENERATED_FILES += qapi/qapi-events-migration.h qapi/qapi-events-migration.c +GENERATED_FILES += qapi/qapi-events-net.h qapi/qapi-events-net.c +GENERATED_FILES += qapi/qapi-events-rocker.h qapi/qapi-events-rocker.c +GENERATED_FILES += qapi/qapi-events-run-state.h qapi/qapi-events-run-state.c +GENERATED_FILES += qapi/qapi-events-sockets.h qapi/qapi-events-sockets.c +GENERATED_FILES += qapi/qapi-events-tpm.h qapi/qapi-events-tpm.c +GENERATED_FILES += qapi/qapi-events-trace.h qapi/qapi-events-trace.c +GENERATED_FILES += qapi/qapi-events-transaction.h qapi/qapi-events-transaction.c +GENERATED_FILES += qapi/qapi-events-ui.h qapi/qapi-events-ui.c GENERATED_FILES += qmp-introspect.c qmp-introspect.h GENERATED_FILES += qapi-doc.texi
@@ -524,10 +584,70 @@ qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json \ qapi-builtin-types.c qapi-builtin-types.h \ qapi-types.c qapi-types.h \ +qapi/qapi-types-block-core.c qapi/qapi-types-block-core.h \ +qapi/qapi-types-block.c qapi/qapi-types-block.h \ +qapi/qapi-types-char.c qapi/qapi-types-char.h \ +qapi/qapi-types-common.c qapi/qapi-types-common.h \ +qapi/qapi-types-crypto.c qapi/qapi-types-crypto.h \ +qapi/qapi-types-introspect.c qapi/qapi-types-introspect.h \ +qapi/qapi-types-migration.c qapi/qapi-types-migration.h \ +qapi/qapi-types-net.c qapi/qapi-types-net.h \ +qapi/qapi-types-rocker.c qapi/qapi-types-rocker.h \ +qapi/qapi-types-run-state.c qapi/qapi-types-run-state.h \ +qapi/qapi-types-sockets.c qapi/qapi-types-sockets.h \ +qapi/qapi-types-tpm.c qapi/qapi-types-tpm.h \ +qapi/qapi-types-trace.c qapi/qapi-types-trace.h \ +qapi/qapi-types-transaction.c qapi/qapi-types-transaction.h \ +qapi/qapi-types-ui.c qapi/qapi-types-ui.h \ qapi-builtin-visit.c qapi-builtin-visit.h \ qapi-visit.c qapi-visit.h \ +qapi/qapi-visit-block-core.c qapi/qapi-visit-block-core.h \ +qapi/qapi-visit-block.c qapi/qapi-visit-block.h \ +qapi/qapi-visit-char.c qapi/qapi-visit-char.h \ +qapi/qapi-visit-common.c qapi/qapi-visit-common.h \ +qapi/qapi-visit-crypto.c qapi/qapi-visit-crypto.h \ +qapi/qapi-visit-introspect.c qapi/qapi-visit-introspect.h \ +qapi/qapi-visit-migration.c qapi/qapi-visit-migration.h \ +qapi/qapi-visit-net.c qapi/qapi-visit-net.h \ +qapi/qapi-visit-rocker.c qapi/qapi-visit-rocker.h \ +qapi/qapi-visit-run-state.c qapi/qapi-visit-run-state.h \ +qapi/qapi-visit-sockets.c qapi/qapi-visit-sockets.h \ +qapi/qapi-visit-tpm.c qapi/qapi-visit-tpm.h \ +qapi/qapi-visit-trace.c qapi/qapi-visit-trace.h \ +qapi/qapi-visit-transaction.c qapi/qapi-visit-transaction.h \ +qapi/qapi-visit-ui.c qapi/qapi-visit-ui.h \ qmp-commands.h qmp-commands.c \ +qapi/qapi-commands-block-core.c qapi/qapi-commands-block-core.h \ +qapi/qapi-commands-block.c qapi/qapi-commands-block.h \ +qapi/qapi-commands-char.c qapi/qapi-commands-char.h \ +qapi/qapi-commands-common.c qapi/qapi-commands-common.h \ +qapi/qapi-commands-crypto.c qapi/qapi-commands-crypto.h \ +qapi/qapi-commands-introspect.c qapi/qapi-commands-introspect.h \ +qapi/qapi-commands-migration.c qapi/qapi-commands-migration.h \ +qapi/qapi-commands-net.c qapi/qapi-commands-net.h \ +qapi/qapi-commands-rocker.c qapi/qapi-commands-rocker.h \ +qapi/qapi-commands-run-state.c qapi/qapi-commands-run-state.h \ +qapi/qapi-commands-sockets.c qapi/qapi-commands-sockets.h \ +qapi/qapi-commands-tpm.c qapi/qapi-commands-tpm.h \ +qapi/qapi-commands-trace.c qapi/qapi-commands-trace.h \ +qapi/qapi-commands-transaction.c qapi/qapi-commands-transaction.h \ +qapi/qapi-commands-ui.c qapi/qapi-commands-ui.h \ qapi-event.c qapi-event.h \ +qapi/qapi-events-block-core.c qapi/qapi-events-block-core.h \ +qapi/qapi-events-block.c qapi/qapi-events-block.h \ +qapi/qapi-events-char.c qapi/qapi-events-char.h \ +qapi/qapi-events-common.c qapi/qapi-events-common.h \ +qapi/qapi-events-crypto.c qapi/qapi-events-crypto.h \ +qapi/qapi-events-introspect.c qapi/qapi-events-introspect.h \ +qapi/qapi-events-migration.c qapi/qapi-events-migration.h \ +qapi/qapi-events-net.c qapi/qapi-events-net.h \ +qapi/qapi-events-rocker.c qapi/qapi-events-rocker.h \ +qapi/qapi-events-run-state.c qapi/qapi-events-run-state.h \ +qapi/qapi-events-sockets.c qapi/qapi-events-sockets.h \ +qapi/qapi-events-tpm.c qapi/qapi-events-tpm.h \ +qapi/qapi-events-trace.c qapi/qapi-events-trace.h \ +qapi/qapi-events-transaction.c qapi/qapi-events-transaction.h \ +qapi/qapi-events-ui.c qapi/qapi-events-ui.h \ qmp-introspect.h qmp-introspect.c \ qapi-doc.texi: \ qapi-gen-timestamp ;
Makefile.objs +64 -1
78 lines not on this page · raw message
scripts/qapi/commands.py +24 -11
@@ -223,14 +223,24 @@ void %(c_prefix)sqmp_init_marshal(QmpCommandList *cmds) return ret -class QAPISchemaGenCommandVisitor(QAPISchemaMonolithicCVisitor): +class QAPISchemaGenCommandVisitor(QAPISchemaModularCVisitor): def __init__(self, prefix): - QAPISchemaMonolithicCVisitor.__init__( - self, prefix, 'qmp-commands', + QAPISchemaModularCVisitor.__init__( + self, prefix, 'qapi-commands', ' * Schema-defined QAPI/QMP commands', __doc__) self._regy = '' - self._visited_ret_types = set() + self._visited_ret_types = {} + + # Temporary HACK: + def _module_basename(self, what, name): + basename = QAPISchemaModularCVisitor._module_basename(self, what, name) + if name == self._main_module: + return re.sub(r'qapi-commands', 'qmp-commands', basename) + return basename + + def _begin_module(self, name): + self._visited_ret_types[self._genc] = set() self._genc.add(mcgen(''' #include "qemu/osdep.h" #include "qemu-common.h"
@@ -246,26 +256,29 @@ class QAPISchemaGenCommandVisitor(QAPISchemaMonolithicCVisitor): #include "%(prefix)sqmp-commands.h" ''', - prefix=prefix)) + prefix=self._prefix)) self._genh.add(mcgen(''' #include "%(prefix)sqapi-types.h" #include "qapi/qmp/dispatch.h" -void %(c_prefix)sqmp_init_marshal(QmpCommandList *cmds); ''', - prefix=prefix, - c_prefix=c_name(prefix, protect=False))) + prefix=self._prefix)) def visit_end(self): - self._genc.add(gen_registry(self._regy, self._prefix)) + (genc, genh) = self._module[self._main_module] + genh.add(mcgen(''' +void %(c_prefix)sqmp_init_marshal(QmpCommandList *cmds); +''', + c_prefix=c_name(self._prefix, protect=False))) + genc.add(gen_registry(self._regy, self._prefix)) def visit_command(self, name, info, arg_type, ret_type, gen, success_response, boxed): if not gen: return self._genh.add(gen_command_decl(name, arg_type, boxed, ret_type)) - if ret_type and ret_type not in self._visited_ret_types: - self._visited_ret_types.add(ret_type) + if ret_type and ret_type not in self._visited_ret_types[self._genc]: + self._visited_ret_types[self._genc].add(ret_type) self._genc.add(gen_marshal_output(ret_type)) self._genh.add(gen_marshal_decl(name)) self._genc.add(gen_marshal(name, arg_type, boxed, ret_type))
scripts/qapi/common.py +18 -3
@@ -2073,13 +2073,20 @@ class QAPISchemaModularCVisitor(QAPISchemaVisitor): self._blurb = blurb self._pydoc = pydoc self._module = {} + self._main_module = None def _module_basename(self, what, name): if name is None: return re.sub(r'-', '-builtin-', what) - return self._prefix + what + basename = os.path.join(os.path.dirname(name), + self._prefix + what) + if name == self._main_module: + return basename + return basename + '-' + os.path.splitext(os.path.basename(name))[0] def _add_module(self, name, blurb): + if self._main_module is None and name is not None: + self._main_module = name genc = QAPIGenC(blurb, self._pydoc) genh = QAPIGenH(blurb, self._pydoc) self._module[name] = (genc, genh)
@@ -2088,7 +2095,7 @@ class QAPISchemaModularCVisitor(QAPISchemaVisitor): def _set_module(self, name): self._genc, self._genh = self._module[name] - def write(self, output_dir, opt_builtins): + def write(self, output_dir, opt_builtins=False): for name in self._module: if name is None and not opt_builtins: continue
@@ -2101,7 +2108,15 @@ class QAPISchemaModularCVisitor(QAPISchemaVisitor): pass def visit_module(self, name): - if len(self._module) != 1: + if name in self._module: + self._set_module(name) return self._add_module(name, self._blurb) self._begin_module(name) + + def visit_include(self, name, info): + basename = self._module_basename(self._what, name) + self._genh.preamble_add(mcgen(''' +#include "%(basename)s.h" +''', + basename=basename))
scripts/qapi/events.py +14 -5
@@ -148,14 +148,23 @@ out: return ret -class QAPISchemaGenEventVisitor(QAPISchemaMonolithicCVisitor): +class QAPISchemaGenEventVisitor(QAPISchemaModularCVisitor): def __init__(self, prefix): - QAPISchemaMonolithicCVisitor.__init__( - self, prefix, 'qapi-event', + QAPISchemaModularCVisitor.__init__( + self, prefix, 'qapi-events', ' * Schema-defined QAPI/QMP events', __doc__) self._enum_name = c_name(prefix + 'QAPIEvent', protect=False) self._event_names = [] + + # Temporary HACK: + def _module_basename(self, what, name): + basename = QAPISchemaModularCVisitor._module_basename(self, what, name) + if name == self._main_module: + return re.sub(r'qapi-events', 'qapi-event', basename) + return basename + + def _begin_module(self, name): self._genc.add(mcgen(''' #include "qemu/osdep.h" #include "qemu-common.h"
@@ -167,13 +176,13 @@ class QAPISchemaGenEventVisitor(QAPISchemaMonolithicCVisitor): #include "qapi/qmp-event.h" ''', - prefix=prefix)) + prefix=self._prefix)) self._genh.add(mcgen(''' #include "qapi/util.h" #include "%(prefix)sqapi-types.h" ''', - prefix=prefix)) + prefix=self._prefix)) def visit_end(self): self._genh.add(gen_enum(self._enum_name, self._event_names))
.gitignore +60 -0
67 lines not on this page · raw message
Signature · 1 line
2.14.3
[Qemu-arm] [PULL v2 25/30] qapi: Empty out qapi-schema.json
In reply to Eric BlakeFrom: Markus Armbruster <[email protected]>
The previous commit improved compile time by including less of the generated QAPI headers. This is impossible for stuff defined directly in qapi-schema.json, because that ends up in headers that that pull in everything.
Move everything but include directives from qapi-schema.json to new sub-module qapi/misc.json, then include just the "misc" shard where possible.
It's possible everywhere, except:
* monitor.c needs qmp-command.h to get qmp_init_marshal()
* monitor.c, ui/vnc.c and the generated qapi-event-FOO.c need qapi-event.h to get enum QAPIEvent
Perhaps we'll get rid of those some other day.
Adding a type to qapi/migration.json now recompiles some 120 instead of 2300 out of 5100 objects.
Message-Id: <[email protected]>
--- Makefile | 9 + Makefile.objs | 4 + qapi-schema.json | 3200 +---------------------------------- qapi/misc.json | 3201 ++++++++++++++++++++++++++++++++++++ include/hw/qdev-properties.h | 3 +- include/monitor/monitor.h | 2 +- include/sysemu/arch_init.h | 2 +- include/sysemu/balloon.h | 2 +- include/sysemu/dump.h | 2 +- include/sysemu/hostmem.h | 2 +- include/sysemu/replay.h | 3 +- vl.c | 4 +- arch_init.c | 2 +- balloon.c | 2 +- block/iscsi.c | 2 +- cpus.c | 2 +- dump.c | 4 +- hmp.c | 10 +- hw/acpi/core.c | 2 +- hw/acpi/cpu.c | 2 +- hw/acpi/memory_hotplug.c | 2 +- hw/acpi/vmgenid.c | 2 +- hw/core/qdev.c | 2 +- hw/i386/xen/xen-hvm.c | 2 +- hw/ipmi/ipmi.c | 2 +- hw/pci/pci-stub.c | 2 +- hw/pci/pci.c | 2 +- hw/ppc/spapr_rtc.c | 2 +- hw/s390x/s390-skeys.c | 2 +- hw/timer/mc146818rtc.c | 4 +- hw/virtio/virtio-balloon.c | 2 +- hw/watchdog/watchdog.c | 2 +- iothread.c | 2 +- migration/savevm.c | 3 +- numa.c | 4 +- qdev-monitor.c | 2 +- qmp.c | 4 +- stubs/uuid.c | 2 +- stubs/vmgenid.c | 2 +- stubs/xen-hvm.c | 2 +- target/arm/monitor.c | 3 +- target/i386/cpu.c | 4 +- target/s390x/cpu.c | 3 +- target/s390x/sigp.c | 2 +- tests/qmp-test.c | 3 +- tests/test-qobject-input-visitor.c | 2 +- tests/test-visitor-serialization.c | 1 - ui/gtk.c | 2 +- util/qemu-config.c | 2 +- .gitignore | 4 + 50 files changed, 3285 insertions(+), 3248 deletions(-) create mode 100644 qapi/misc.json
Makefile +9 -0
@@ -99,6 +99,7 @@ GENERATED_FILES += qapi/qapi-types-common.h qapi/qapi-types-common.c GENERATED_FILES += qapi/qapi-types-crypto.h qapi/qapi-types-crypto.c GENERATED_FILES += qapi/qapi-types-introspect.h qapi/qapi-types-introspect.c GENERATED_FILES += qapi/qapi-types-migration.h qapi/qapi-types-migration.c +GENERATED_FILES += qapi/qapi-types-misc.h qapi/qapi-types-misc.c GENERATED_FILES += qapi/qapi-types-net.h qapi/qapi-types-net.c GENERATED_FILES += qapi/qapi-types-rocker.h qapi/qapi-types-rocker.c GENERATED_FILES += qapi/qapi-types-run-state.h qapi/qapi-types-run-state.c
@@ -116,6 +117,7 @@ GENERATED_FILES += qapi/qapi-visit-common.h qapi/qapi-visit-common.c GENERATED_FILES += qapi/qapi-visit-crypto.h qapi/qapi-visit-crypto.c GENERATED_FILES += qapi/qapi-visit-introspect.h qapi/qapi-visit-introspect.c GENERATED_FILES += qapi/qapi-visit-migration.h qapi/qapi-visit-migration.c +GENERATED_FILES += qapi/qapi-visit-misc.h qapi/qapi-visit-misc.c GENERATED_FILES += qapi/qapi-visit-net.h qapi/qapi-visit-net.c GENERATED_FILES += qapi/qapi-visit-rocker.h qapi/qapi-visit-rocker.c GENERATED_FILES += qapi/qapi-visit-run-state.h qapi/qapi-visit-run-state.c
@@ -132,6 +134,7 @@ GENERATED_FILES += qapi/qapi-commands-common.h qapi/qapi-commands-common.c GENERATED_FILES += qapi/qapi-commands-crypto.h qapi/qapi-commands-crypto.c GENERATED_FILES += qapi/qapi-commands-introspect.h qapi/qapi-commands-introspect.c GENERATED_FILES += qapi/qapi-commands-migration.h qapi/qapi-commands-migration.c +GENERATED_FILES += qapi/qapi-commands-misc.h qapi/qapi-commands-misc.c GENERATED_FILES += qapi/qapi-commands-net.h qapi/qapi-commands-net.c GENERATED_FILES += qapi/qapi-commands-rocker.h qapi/qapi-commands-rocker.c GENERATED_FILES += qapi/qapi-commands-run-state.h qapi/qapi-commands-run-state.c
@@ -148,6 +151,7 @@ GENERATED_FILES += qapi/qapi-events-common.h qapi/qapi-events-common.c GENERATED_FILES += qapi/qapi-events-crypto.h qapi/qapi-events-crypto.c GENERATED_FILES += qapi/qapi-events-introspect.h qapi/qapi-events-introspect.c GENERATED_FILES += qapi/qapi-events-migration.h qapi/qapi-events-migration.c +GENERATED_FILES += qapi/qapi-events-misc.h qapi/qapi-events-misc.c GENERATED_FILES += qapi/qapi-events-net.h qapi/qapi-events-net.c GENERATED_FILES += qapi/qapi-events-rocker.h qapi/qapi-events-rocker.c GENERATED_FILES += qapi/qapi-events-run-state.h qapi/qapi-events-run-state.c
@@ -573,6 +577,7 @@ qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json \ $(SRC_PATH)/qapi/crypto.json \ $(SRC_PATH)/qapi/introspect.json \ $(SRC_PATH)/qapi/migration.json \ + $(SRC_PATH)/qapi/misc.json \ $(SRC_PATH)/qapi/net.json \ $(SRC_PATH)/qapi/rocker.json \ $(SRC_PATH)/qapi/run-state.json \
@@ -591,6 +596,7 @@ qapi/qapi-types-common.c qapi/qapi-types-common.h \ qapi/qapi-types-crypto.c qapi/qapi-types-crypto.h \ qapi/qapi-types-introspect.c qapi/qapi-types-introspect.h \ qapi/qapi-types-migration.c qapi/qapi-types-migration.h \ +qapi/qapi-types-misc.c qapi/qapi-types-misc.h \ qapi/qapi-types-net.c qapi/qapi-types-net.h \ qapi/qapi-types-rocker.c qapi/qapi-types-rocker.h \ qapi/qapi-types-run-state.c qapi/qapi-types-run-state.h \
@@ -608,6 +614,7 @@ qapi/qapi-visit-common.c qapi/qapi-visit-common.h \ qapi/qapi-visit-crypto.c qapi/qapi-visit-crypto.h \ qapi/qapi-visit-introspect.c qapi/qapi-visit-introspect.h \ qapi/qapi-visit-migration.c qapi/qapi-visit-migration.h \ +qapi/qapi-visit-misc.c qapi/qapi-visit-misc.h \ qapi/qapi-visit-net.c qapi/qapi-visit-net.h \ qapi/qapi-visit-rocker.c qapi/qapi-visit-rocker.h \ qapi/qapi-visit-run-state.c qapi/qapi-visit-run-state.h \
@@ -624,6 +631,7 @@ qapi/qapi-commands-common.c qapi/qapi-commands-common.h \ qapi/qapi-commands-crypto.c qapi/qapi-commands-crypto.h \ qapi/qapi-commands-introspect.c qapi/qapi-commands-introspect.h \ qapi/qapi-commands-migration.c qapi/qapi-commands-migration.h \ +qapi/qapi-commands-misc.c qapi/qapi-commands-misc.h \ qapi/qapi-commands-net.c qapi/qapi-commands-net.h \ qapi/qapi-commands-rocker.c qapi/qapi-commands-rocker.h \ qapi/qapi-commands-run-state.c qapi/qapi-commands-run-state.h \
@@ -640,6 +648,7 @@ qapi/qapi-events-common.c qapi/qapi-events-common.h \ qapi/qapi-events-crypto.c qapi/qapi-events-crypto.h \ qapi/qapi-events-introspect.c qapi/qapi-events-introspect.h \ qapi/qapi-events-migration.c qapi/qapi-events-migration.h \ +qapi/qapi-events-misc.c qapi/qapi-events-misc.h \ qapi/qapi-events-net.c qapi/qapi-events-net.h \ qapi/qapi-events-rocker.c qapi/qapi-events-rocker.h \ qapi/qapi-events-run-state.c qapi/qapi-events-run-state.h \
Makefile.objs +4 -0
@@ -11,6 +11,7 @@ util-obj-y += qapi/qapi-types-common.o util-obj-y += qapi/qapi-types-crypto.o util-obj-y += qapi/qapi-types-introspect.o util-obj-y += qapi/qapi-types-migration.o +util-obj-y += qapi/qapi-types-misc.o util-obj-y += qapi/qapi-types-net.o util-obj-y += qapi/qapi-types-rocker.o util-obj-y += qapi/qapi-types-run-state.o
@@ -28,6 +29,7 @@ util-obj-y += qapi/qapi-visit-common.o util-obj-y += qapi/qapi-visit-crypto.o util-obj-y += qapi/qapi-visit-introspect.o util-obj-y += qapi/qapi-visit-migration.o +util-obj-y += qapi/qapi-visit-misc.o util-obj-y += qapi/qapi-visit-net.o util-obj-y += qapi/qapi-visit-rocker.o util-obj-y += qapi/qapi-visit-run-state.o
@@ -44,6 +46,7 @@ util-obj-y += qapi/qapi-events-common.o util-obj-y += qapi/qapi-events-crypto.o util-obj-y += qapi/qapi-events-introspect.o util-obj-y += qapi/qapi-events-migration.o +util-obj-y += qapi/qapi-events-misc.o util-obj-y += qapi/qapi-events-net.o util-obj-y += qapi/qapi-events-rocker.o util-obj-y += qapi/qapi-events-run-state.o
@@ -136,6 +139,7 @@ common-obj-y += qapi/qapi-commands-common.o common-obj-y += qapi/qapi-commands-crypto.o common-obj-y += qapi/qapi-commands-introspect.o common-obj-y += qapi/qapi-commands-migration.o +common-obj-y += qapi/qapi-commands-misc.o common-obj-y += qapi/qapi-commands-net.o common-obj-y += qapi/qapi-commands-rocker.o common-obj-y += qapi/qapi-commands-run-state.o
qapi-schema.json +1 -3199
2,909 lines not on this page · raw message
qapi/misc.json new file +3201 -0
3,201 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 7 lines
2.14.3 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Part of the diff is not shown here. View the raw message.
[Qemu-devel] [PULL v2 24/30] Include less of the generated modular QAPI headers
In reply to Eric BlakeFrom: Markus Armbruster <[email protected]>
In my "build everything" tree, a change to the types in qapi-schema.json triggers a recompile of about 4800 out of 5100 objects.
The previous commit split up qmp-commands.h, qmp-event.h, qmp-visit.h, qapi-types.h. Each of these headers still includes all its shards. Reduce compile time by including just the shards we actually need.
To illustrate the benefits: adding a type to qapi/migration.json now recompiles some 2300 instead of 4800 objects. The next commit will improve it further.
Message-Id: <[email protected]>
--- include/qapi/visitor.h | 2 +- scripts/qapi/commands.py | 14 ++++++++------ scripts/qapi/events.py | 10 ++++++---- scripts/qapi/types.py | 8 +++++--- scripts/qapi/visit.py | 10 ++++++---- crypto/cipherpriv.h | 2 +- include/block/block.h | 2 +- include/block/dirty-bitmap.h | 2 +- include/block/nbd.h | 2 +- include/chardev/char.h | 1 + include/crypto/cipher.h | 2 +- include/crypto/hash.h | 2 +- include/crypto/hmac.h | 2 +- include/crypto/secret.h | 1 + include/crypto/tlscreds.h | 1 + include/hw/block/block.h | 2 +- include/hw/block/fdc.h | 2 +- include/hw/ppc/spapr_drc.h | 1 + include/hw/qdev-properties.h | 1 + include/io/dns-resolver.h | 1 + include/migration/colo.h | 2 +- include/migration/failover.h | 2 +- include/migration/global_state.h | 1 + include/monitor/monitor.h | 1 + include/net/filter.h | 1 + include/net/net.h | 2 +- include/qapi/clone-visitor.h | 1 - include/qapi/error.h | 2 +- include/qapi/qmp/qobject.h | 2 +- include/qemu/sockets.h | 2 +- include/qemu/throttle.h | 2 +- include/qom/cpu.h | 1 + include/qom/object.h | 2 +- include/sysemu/dump.h | 2 ++ include/sysemu/hostmem.h | 1 + include/sysemu/replay.h | 1 + include/sysemu/sysemu.h | 1 + include/sysemu/tpm.h | 1 + include/sysemu/watchdog.h | 2 +- include/ui/console.h | 1 + include/ui/input.h | 2 +- migration/migration.h | 1 + migration/ram.h | 2 +- net/tap_int.h | 2 +- replication.h | 1 + ui/vnc.h | 1 + vl.c | 4 ++-- backends/cryptodev.c | 1 - backends/hostmem.c | 3 ++- block.c | 1 - block/block-backend.c | 2 +- block/crypto.c | 2 +- block/nbd.c | 2 +- block/nfs.c | 2 +- block/qapi.c | 4 ++-- block/qcow2.c | 3 +-- block/quorum.c | 2 +- block/sheepdog.c | 2 +- block/ssh.c | 2 +- block/throttle-groups.c | 2 +- block/write-threshold.c | 4 ++-- blockdev-nbd.c | 2 +- blockdev.c | 5 +++-- blockjob.c | 2 +- chardev/char-fe.c | 1 - chardev/char-ringbuf.c | 2 +- chardev/char-socket.c | 1 + chardev/char.c | 3 +-- cpus.c | 2 +- hmp.c | 2 +- hw/acpi/core.c | 2 +- hw/block/block.c | 1 + hw/block/hd-geometry.c | 1 + hw/char/virtio-console.c | 2 +- hw/core/machine.c | 2 +- hw/i386/pc.c | 2 +- hw/mem/nvdimm.c | 1 - hw/net/rocker/qmp-norocker.c | 2 +- hw/net/rocker/rocker.c | 2 +- hw/net/rocker/rocker_fp.c | 2 +- hw/net/rocker/rocker_of_dpa.c | 2 +- hw/net/virtio-net.c | 2 +- hw/ppc/spapr_rtas.c | 1 - hw/tpm/tpm_emulator.c | 1 + hw/tpm/tpm_passthrough.c | 1 + hw/watchdog/watchdog.c | 2 +- io/channel-socket.c | 1 + io/dns-resolver.c | 1 + migration/colo-failover.c | 2 +- migration/colo.c | 2 +- migration/migration.c | 4 ++-- migration/ram.c | 2 +- net/colo-compare.c | 1 - net/filter-buffer.c | 2 +- net/filter-mirror.c | 1 - net/filter-rewriter.c | 1 - net/net.c | 4 ++-- net/vhost-user.c | 2 +- qemu-img.c | 2 +- qom/object.c | 2 +- qom/object_interfaces.c | 1 - replay/replay-input.c | 1 + stubs/tpm.c | 3 ++- target/s390x/kvm.c | 1 - target/s390x/sigp.c | 1 + tests/test-char.c | 2 +- tests/test-qmp-event.c | 1 - tpm.c | 2 +- trace/qmp.c | 2 +- ui/console.c | 2 +- ui/input-legacy.c | 2 +- ui/input.c | 2 +- ui/spice-core.c | 4 ++-- ui/vnc.c | 2 +- util/qemu-sockets.c | 2 +- 115 files changed, 135 insertions(+), 109 deletions(-)
include/qapi/visitor.h +1 -1
@@ -15,7 +15,7 @@#ifndef QAPI_VISITOR_H #define QAPI_VISITOR_H -#include "qapi-types.h" +#include "qapi-builtin-types.h" /* * The QAPI schema defines both a set of C data types, and a QMP wire
scripts/qapi/commands.py +8 -6
@@ -241,6 +241,9 @@ class QAPISchemaGenCommandVisitor(QAPISchemaModularCVisitor): def _begin_module(self, name): self._visited_ret_types[self._genc] = set() + commands = self._module_basename('qapi-commands', name) + types = self._module_basename('qapi-types', name) + visit = self._module_basename('qapi-visit', name) self._genc.add(mcgen(''' #include "qemu/osdep.h" #include "qemu-common.h"
@@ -251,18 +254,17 @@ class QAPISchemaGenCommandVisitor(QAPISchemaModularCVisitor): #include "qapi/qobject-input-visitor.h" #include "qapi/dealloc-visitor.h" #include "qapi/error.h" -#include "%(prefix)sqapi-types.h" -#include "%(prefix)sqapi-visit.h" -#include "%(prefix)sqmp-commands.h" +#include "%(visit)s.h" +#include "%(commands)s.h" ''', - prefix=self._prefix)) + commands=commands, visit=visit)) self._genh.add(mcgen(''' -#include "%(prefix)sqapi-types.h" +#include "%(types)s.h" #include "qapi/qmp/dispatch.h" ''', - prefix=self._prefix)) + types=types)) def visit_end(self): (genc, genh) = self._module[self._main_module]
scripts/qapi/events.py +6 -4
@@ -165,24 +165,26 @@ class QAPISchemaGenEventVisitor(QAPISchemaModularCVisitor): return basename def _begin_module(self, name): + types = self._module_basename('qapi-types', name) + visit = self._module_basename('qapi-visit', name) self._genc.add(mcgen(''' #include "qemu/osdep.h" #include "qemu-common.h" #include "%(prefix)sqapi-event.h" -#include "%(prefix)sqapi-visit.h" +#include "%(visit)s.h" #include "qapi/error.h" #include "qapi/qmp/qdict.h" #include "qapi/qobject-output-visitor.h" #include "qapi/qmp-event.h" ''', - prefix=self._prefix)) + visit=visit, prefix=self._prefix)) self._genh.add(mcgen(''' #include "qapi/util.h" -#include "%(prefix)sqapi-types.h" +#include "%(types)s.h" ''', - prefix=self._prefix)) + types=types)) def visit_end(self): self._genh.add(gen_enum(self._enum_name, self._event_names))
scripts/qapi/types.py +5 -3
@@ -185,13 +185,15 @@ class QAPISchemaGenTypeVisitor(QAPISchemaModularCVisitor): ''')) def _begin_module(self, name): + types = self._module_basename('qapi-types', name) + visit = self._module_basename('qapi-visit', name) self._genc.preamble_add(mcgen(''' #include "qemu/osdep.h" #include "qapi/dealloc-visitor.h" -#include "%(prefix)sqapi-types.h" -#include "%(prefix)sqapi-visit.h" +#include "%(types)s.h" +#include "%(visit)s.h" ''', - prefix=self._prefix)) + types=types, visit=visit)) self._genh.preamble_add(mcgen(''' #include "qapi-builtin-types.h" '''))
scripts/qapi/visit.py +6 -4
@@ -284,20 +284,22 @@ class QAPISchemaGenVisitVisitor(QAPISchemaModularCVisitor): prefix=prefix)) def _begin_module(self, name): + types = self._module_basename('qapi-types', name) + visit = self._module_basename('qapi-visit', name) self._genc.preamble_add(mcgen(''' #include "qemu/osdep.h" #include "qemu-common.h" #include "qapi/error.h" #include "qapi/qmp/qerror.h" -#include "%(prefix)sqapi-visit.h" +#include "%(visit)s.h" ''', - prefix=self._prefix)) + visit=visit, prefix=self._prefix)) self._genh.preamble_add(mcgen(''' #include "qapi-builtin-visit.h" -#include "%(prefix)sqapi-types.h" +#include "%(types)s.h" ''', - prefix=self._prefix)) + types=types)) def visit_enum_type(self, name, info, values, prefix): self._genh.add(gen_visit_decl(name, scalar=True))
crypto/cipherpriv.h +1 -1
@@ -15,7 +15,7 @@#ifndef QCRYPTO_CIPHERPRIV_H #define QCRYPTO_CIPHERPRIV_H -#include "qapi-types.h" +#include "qapi/qapi-types-crypto.h" typedef struct QCryptoCipherDriver QCryptoCipherDriver ;
include/block/block.h +1 -1
@@ -2,7 +2,7 @@#define BLOCK_H #include "block/aio.h" -#include "qapi-types.h" +#include "qapi/qapi-types-block-core.h" #include "qemu/iov.h" #include "qemu/coroutine.h" #include "block/accounting.h"
include/block/dirty-bitmap.h +1 -1
@@ -2,7 +2,7 @@#define BLOCK_DIRTY_BITMAP_H #include "qemu-common.h" -#include "qapi-types.h" +#include "qapi/qapi-types-block-core.h" #include "qemu/hbitmap.h" BdrvDirtyBitmap *bdrv_create_dirty_bitmap(BlockDriverState *bs,
include/block/nbd.h +1 -1
@@ -20,7 +20,7 @@#ifndef NBD_H #define NBD_H - +#include "qapi/qapi-types-block.h" #include "io/channel-socket.h" #include "crypto/tlscreds.h"
include/chardev/char.h +1 -0
@@ -1,6 +1,7 @@#ifndef QEMU_CHAR_H #define QEMU_CHAR_H +#include "qapi/qapi-types-char.h" #include "qemu/main-loop.h" #include "qemu/bitmap.h" #include "qom/object.h"
include/crypto/cipher.h +1 -1
@@ -21,7 +21,7 @@#ifndef QCRYPTO_CIPHER_H #define QCRYPTO_CIPHER_H -#include "qapi-types.h" +#include "qapi/qapi-types-crypto.h" typedef struct QCryptoCipher QCryptoCipher ;
include/crypto/hash.h +1 -1
@@ -21,7 +21,7 @@#ifndef QCRYPTO_HASH_H #define QCRYPTO_HASH_H -#include "qapi-types.h" +#include "qapi/qapi-types-crypto.h" /* See also "QCryptoHashAlgorithm" defined in qapi/crypto.json */
include/crypto/hmac.h +1 -1
@@ -12,7 +12,7 @@#ifndef QCRYPTO_HMAC_H #define QCRYPTO_HMAC_H -#include "qapi-types.h" +#include "qapi/qapi-types-crypto.h" typedef struct QCryptoHmac QCryptoHmac ; struct QCryptoHmac {
include/crypto/secret.h +1 -0
@@ -21,6 +21,7 @@#ifndef QCRYPTO_SECRET_H #define QCRYPTO_SECRET_H +#include "qapi/qapi-types-crypto.h" #include "qom/object.h" #define TYPE_QCRYPTO_SECRET "secret"
include/crypto/tlscreds.h +1 -0
@@ -21,6 +21,7 @@#ifndef QCRYPTO_TLSCREDS_H #define QCRYPTO_TLSCREDS_H +#include "qapi/qapi-types-crypto.h" #include "qom/object.h" #ifdef CONFIG_GNUTLS
include/hw/block/block.h +1 -1
@@ -12,7 +12,7 @@#define HW_BLOCK_H #include "qemu-common.h" -#include "qapi-types.h" +#include "qapi/qapi-types-block-core.h" /* Configuration */
include/hw/block/fdc.h +1 -1
@@ -2,7 +2,7 @@#define HW_FDC_H #include "qemu-common.h" -#include "qapi-types.h" +#include "qapi/qapi-types-block.h" /* fdc.c */ #define MAX_FD 2
include/hw/ppc/spapr_drc.h +1 -0
@@ -14,6 +14,7 @@#define HW_SPAPR_DRC_H #include <libfdt.h> +#include "qapi/qapi-types-run-state.h" #include "qom/object.h" #include "sysemu/sysemu.h" #include "hw/qdev.h"
include/hw/qdev-properties.h +1 -0
@@ -1,6 +1,7 @@#ifndef QEMU_QDEV_PROPERTIES_H #define QEMU_QDEV_PROPERTIES_H +#include "qapi-types.h" #include "hw/qdev-core.h" /*** qdev-properties.c ***/
include/io/dns-resolver.h +1 -0
@@ -22,6 +22,7 @@#define QIO_DNS_RESOLVER_H #include "qemu-common.h" +#include "qapi/qapi-types-sockets.h" #include "qom/object.h" #include "io/task.h"
include/migration/colo.h +1 -1
@@ -14,7 +14,7 @@#define QEMU_COLO_H #include "qemu-common.h" -#include "qapi-types.h" +#include "qapi/qapi-types-migration.h" void colo_info_init (void );
include/migration/failover.h +1 -1
@@ -14,7 +14,7 @@#define QEMU_FAILOVER_H #include "qemu-common.h" -#include "qapi-types.h" +#include "qapi/qapi-types-migration.h" void failover_init_state (void ); FailoverStatus failover_set_state(FailoverStatus old_state,
include/migration/global_state.h +1 -0
@@ -13,6 +13,7 @@#ifndef QEMU_MIGRATION_GLOBAL_STATE_H #define QEMU_MIGRATION_GLOBAL_STATE_H +#include "qapi/qapi-types-run-state.h" #include "sysemu/sysemu.h" void register_global_state (void );
include/monitor/monitor.h +1 -0
@@ -3,6 +3,7 @@#include "qemu-common.h" #include "block/block.h" +#include "qapi-types.h" #include "qemu/readline.h" extern Monitor *cur_mon;
include/net/filter.h +1 -0
@@ -9,6 +9,7 @@#ifndef QEMU_NET_FILTER_H #define QEMU_NET_FILTER_H +#include "qapi/qapi-types-net.h" #include "qom/object.h" #include "qemu-common.h" #include "net/queue.h"
include/net/net.h +1 -1
@@ -2,7 +2,7 @@#define QEMU_NET_H #include "qemu/queue.h" -#include "qapi-types.h" +#include "qapi/qapi-types-net.h" #include "net/queue.h" #include "migration/vmstate.h"
include/qapi/clone-visitor.h +0 -1
@@ -12,7 +12,6 @@#define QAPI_CLONE_VISITOR_H #include "qapi/visitor.h" -#include "qapi-visit.h" /* * The clone visitor is for direct use only by the QAPI_CLONE() macro;
include/qapi/error.h +1 -1
@@ -115,7 +115,7 @@#ifndef ERROR_H #define ERROR_H -#include "qapi-types.h" +#include "qapi/qapi-types-common.h" /* * Overall category of an error.
include/qapi/qmp/qobject.h +1 -1
@@ -32,7 +32,7 @@ #ifndef QOBJECT_H #define QOBJECT_H -#include "qapi-types.h" +#include "qapi-builtin-types.h" struct QObject { QType type;
include/qemu/sockets.h +1 -1
@@ -9,7 +9,7 @@ int inet_aton(const char *cp, struct in_addr *ia);#endif /* !_WIN32 */ -#include "qapi-types.h" +#include "qapi/qapi-types-sockets.h" /* misc helpers */ int qemu_socket (int domain,int type,int protocol);
include/qemu/throttle.h +1 -1
@@ -26,7 +26,7 @@#define THROTTLE_H #include "qemu-common.h" -#include "qapi-types.h" +#include "qapi/qapi-types-block-core.h" #include "qemu/timer.h" #define THROTTLE_VALUE_MAX 1000000000000000LL
include/qom/cpu.h +1 -0
@@ -24,6 +24,7 @@#include "disas/bfd.h" #include "exec/hwaddr.h" #include "exec/memattrs.h" +#include "qapi/qapi-types-run-state.h" #include "qemu/bitmap.h" #include "qemu/queue.h" #include "qemu/thread.h"
include/qom/object.h +1 -1
@@ -14,7 +14,7 @@#ifndef QEMU_OBJECT_H #define QEMU_OBJECT_H -#include "qapi-types.h" +#include "qapi-builtin-types.h" #include "qemu/queue.h" struct TypeImpl ;
include/sysemu/dump.h +2 -0
@@ -14,6 +14,8 @@#ifndef DUMP_H #define DUMP_H +#include "qapi-types.h" +#define MAKEDUMPFILE_SIGNATURE "makedumpfile"#define MAX_SIZE_MDF_HEADER (4096)/* max size of makedumpfile_header */ #define TYPE_FLAT_HEADER (1)/* type of flattened format */
include/sysemu/hostmem.h +1 -0
@@ -14,6 +14,7 @@#define SYSEMU_HOSTMEM_H #include "sysemu/sysemu.h" /* for MAX_NODES */ +#include "qapi-types.h" #include "qom/object.h" #include "exec/memory.h" #include "qemu/bitmap.h"
include/sysemu/replay.h +1 -0
@@ -13,6 +13,7 @@*/ #include "sysemu.h" +#include "qapi-types.h" /* replay clock kinds */ enum ReplayClockKind {
include/sysemu/sysemu.h +1 -0
@@ -2,6 +2,7 @@#define SYSEMU_H /* Misc. things related to the system emulator. */ +#include "qapi/qapi-types-run-state.h" #include "qemu/queue.h" #include "qemu/timer.h" #include "qemu/notify.h"
include/sysemu/tpm.h +1 -0
@@ -12,6 +12,7 @@#ifndef QEMU_TPM_H #define QEMU_TPM_H +#include "qapi/qapi-types-tpm.h" #include "qom/object.h" int tpm_config_parse (QemuOptsList *opts_list,const char *optarg);
include/sysemu/watchdog.h +1 -1
@@ -23,7 +23,7 @@#define QEMU_WATCHDOG_H #include "qemu/queue.h" -#include "qapi-types.h" +#include "qapi/qapi-types-run-state.h" struct WatchdogTimerModel {QLIST_ENTRY (WatchdogTimerModel) entry;
include/ui/console.h +1 -0
@@ -5,6 +5,7 @@#include "qom/object.h" #include "qemu/notify.h" #include "qemu/error-report.h" +#include "qapi/qapi-types-ui.h" #ifdef CONFIG_OPENGL # include <epoxy/gl.h>
include/ui/input.h +1 -1
@@ -1,7 +1,7 @@#ifndef INPUT_H #define INPUT_H -#include "qapi-types.h" +#include "qapi/qapi-types-ui.h" #define INPUT_EVENT_MASK_KEY (1<<INPUT_EVENT_KIND_KEY)#define INPUT_EVENT_MASK_BTN (1<<INPUT_EVENT_KIND_BTN)
migration/migration.h +1 -0
@@ -15,6 +15,7 @@#define QEMU_MIGRATION_H #include "qemu-common.h" +#include "qapi/qapi-types-migration.h" #include "qemu/thread.h" #include "exec/cpu-common.h" #include "qemu/coroutine_int.h"
migration/ram.h +1 -1
@@ -30,7 +30,7 @@#define QEMU_MIGRATION_RAM_H #include "qemu-common.h" -#include "qapi-types.h" +#include "qapi/qapi-types-migration.h" #include "exec/cpu-common.h" extern MigrationStats ram_counters;
net/tap_int.h +1 -1
@@ -27,7 +27,7 @@#define NET_TAP_INT_H #include "qemu-common.h" -#include "qapi-types.h" +#include "qapi/qapi-types-net.h" int tap_open (char *ifname,int ifname_size,int *vnet_hdr,int vnet_hdr_required,int mq_required,Error **errp);
replication.h +1 -0
@@ -15,6 +15,7 @@#ifndef REPLICATION_H #define REPLICATION_H +#include "qapi/qapi-types-block-core.h" #include "qemu/queue.h" typedef struct ReplicationOps ReplicationOps ;
ui/vnc.h +1 -0
@@ -28,6 +28,7 @@#define QEMU_VNC_H #include "qemu-common.h" +#include "qapi/qapi-types-ui.h" #include "qemu/queue.h" #include "qemu/thread.h" #include "ui/console.h"
vl.c +2 -2
@@ -97,7 +97,6 @@ int main(int argc, char **argv)#include "sysemu/kvm.h" #include "sysemu/hax.h" #include "qapi/qobject-input-visitor.h" -#include "qapi-visit.h" #include "qemu/option.h" #include "qemu/config-file.h" #include "qemu-options.h"
@@ -122,10 +121,11 @@ int main(int argc, char **argv)#include "qapi/string-input-visitor.h" #include "qapi/opts-visitor.h" #include "qom/object_interfaces.h" -#include "qapi-event.h" #include "exec/semihost.h" #include "crypto/init.h" #include "sysemu/replay.h" +#include "qapi/qapi-events-run-state.h" +#include "qapi/qapi-visit-block-core.h" #include "qapi/qmp/qerror.h" #include "sysemu/iothread.h"
backends/cryptodev.c +0 -1
@@ -26,7 +26,6 @@#include "hw/boards.h" #include "qapi/error.h" #include "qapi/visitor.h" -#include "qapi-visit.h" #include "qemu/config-file.h" #include "qom/object_interfaces.h" #include "hw/virtio/virtio-crypto.h"
backends/hostmem.c +2 -1
@@ -9,12 +9,13 @@* This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" #include "sysemu/hostmem.h" #include "hw/boards.h" #include "qapi/error.h" +#include "qapi-builtin-visit.h" #include "qapi/visitor.h" -#include "qapi-visit.h" #include "qemu/config-file.h" #include "qom/object_interfaces.h"
block.c +0 -1
@@ -41,7 +41,6 @@#include "qemu/coroutine.h" #include "block/qapi.h" #include "qemu/timer.h" -#include "qapi-event.h" #include "qemu/cutils.h" #include "qemu/id.h"
block/block-backend.c +1 -1
@@ -17,8 +17,8 @@#include "block/throttle-groups.h" #include "sysemu/blockdev.h" #include "sysemu/sysemu.h" -#include "qapi-event.h" #include "qapi/error.h" +#include "qapi/qapi-events-block.h" #include "qemu/id.h" #include "qemu/option.h" #include "trace.h"
block/crypto.c +1 -1
@@ -24,9 +24,9 @@#include "sysemu/block-backend.h" #include "crypto/block.h" #include "qapi/opts-visitor.h" +#include "qapi/qapi-visit-crypto.h" #include "qapi/qmp/qdict.h" #include "qapi/qobject-input-visitor.h" -#include "qapi-visit.h" #include "qapi/error.h" #include "qemu/option.h" #include "block/crypto.h"
block/nbd.c +1 -1
@@ -33,7 +33,7 @@#include "block/block_int.h" #include "qemu/module.h" #include "qemu/option.h" -#include "qapi-visit.h" +#include "qapi/qapi-visit-sockets.h" #include "qapi/qobject-input-visitor.h" #include "qapi/qobject-output-visitor.h" #include "qapi/qmp/qdict.h"
block/nfs.c +1 -1
@@ -35,9 +35,9 @@#include "qemu/uri.h" #include "qemu/cutils.h" #include "sysemu/sysemu.h" +#include "qapi/qapi-visit-block-core.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qstring.h" -#include "qapi-visit.h" #include "qapi/qobject-input-visitor.h" #include "qapi/qobject-output-visitor.h" #include <nfsc/libnfs.h>
block/qapi.c +2 -2
@@ -27,10 +27,10 @@#include "block/block_int.h" #include "block/throttle-groups.h" #include "block/write-threshold.h" -#include "qmp-commands.h" -#include "qapi-visit.h" #include "qapi/error.h" +#include "qapi/qapi-commands-block-core.h" #include "qapi/qobject-output-visitor.h" +#include "qapi/qapi-visit-block-core.h" #include "qapi/qmp/qbool.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qlist.h"
block/qcow2.c +1 -2
@@ -30,15 +30,14 @@#include "block/qcow2.h" #include "qemu/error-report.h" #include "qapi/error.h" +#include "qapi/qapi-events-block-core.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qstring.h" -#include "qapi-event.h" #include "trace.h" #include "qemu/option_int.h" #include "qemu/cutils.h" #include "qemu/bswap.h" #include "qapi/opts-visitor.h" -#include "qapi-visit.h" #include "block/crypto.h" /*
block/quorum.c +1 -1
@@ -18,11 +18,11 @@#include "qemu/option.h" #include "block/block_int.h" #include "qapi/error.h" +#include "qapi/qapi-events-block.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qerror.h" #include "qapi/qmp/qlist.h" #include "qapi/qmp/qstring.h" -#include "qapi-event.h" #include "crypto/hash.h" #define HASH_LENGTH 32
block/sheepdog.c +1 -1
@@ -13,8 +13,8 @@*/ #include "qemu/osdep.h" -#include "qapi-visit.h" #include "qapi/error.h" +#include "qapi/qapi-visit-sockets.h" #include "qapi/qmp/qdict.h" #include "qapi/qobject-input-visitor.h" #include "qemu/uri.h"
block/ssh.c +1 -1
@@ -34,7 +34,7 @@#include "qemu/cutils.h" #include "qemu/sockets.h" #include "qemu/uri.h" -#include "qapi-visit.h" +#include "qapi/qapi-visit-sockets.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qstring.h" #include "qapi/qobject-input-visitor.h"
block/throttle-groups.c +1 -1
@@ -30,7 +30,7 @@#include "qemu/thread.h" #include "sysemu/qtest.h" #include "qapi/error.h" -#include "qapi-visit.h" +#include "qapi/qapi-visit-block-core.h" #include "qom/object.h" #include "qom/object_interfaces.h"
block/write-threshold.c +2 -2
@@ -15,9 +15,9 @@#include "qemu/coroutine.h" #include "block/write-threshold.h" #include "qemu/notify.h" -#include "qapi-event.h" #include "qapi/error.h" -#include "qmp-commands.h" +#include "qapi/qapi-commands-block-core.h" +#include "qapi/qapi-events-block-core.h" uint64_t bdrv_write_threshold_get (const BlockDriverState *bs) {
blockdev-nbd.c +1 -1
@@ -14,8 +14,8 @@#include "sysemu/block-backend.h" #include "hw/block/block.h" #include "qapi/error.h" +#include "qapi/qapi-commands-block.h" #include "sysemu/sysemu.h" -#include "qmp-commands.h" #include "block/nbd.h" #include "io/channel-socket.h" #include "io/net-listener.h"
blockdev.c +3 -2
@@ -40,10 +40,12 @@#include "qemu/error-report.h" #include "qemu/option.h" #include "qemu/config-file.h" +#include "qapi/qapi-commands-block.h" +#include "qapi/qapi-commands-transaction.h" +#include "qapi/qapi-visit-block-core.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qnum.h" #include "qapi/qmp/qstring.h" -#include "qapi-visit.h" #include "qapi/error.h" #include "qapi/qmp/qerror.h" #include "qapi/qmp/qlist.h"
@@ -51,7 +53,6 @@#include "sysemu/sysemu.h" #include "sysemu/iothread.h" #include "block/block_int.h" -#include "qmp-commands.h" #include "block/trace.h" #include "sysemu/arch_init.h" #include "sysemu/qtest.h"
blockjob.c +1 -1
@@ -30,11 +30,11 @@#include "block/block_int.h" #include "sysemu/block-backend.h" #include "qapi/error.h" +#include "qapi/qapi-events-block-core.h" #include "qapi/qmp/qerror.h" #include "qemu/coroutine.h" #include "qemu/id.h" #include "qemu/timer.h" -#include "qapi-event.h" /* Right now, this mutex is only needed to synchronize accesses to job->busy * and job->sleep_timer, such as concurrent calls to block_job_do_yield and
chardev/char-fe.c +0 -1
@@ -25,7 +25,6 @@#include "qemu/error-report.h" #include "qapi/error.h" #include "qapi/qmp/qerror.h" -#include "qapi-visit.h" #include "sysemu/replay.h" #include "chardev/char-fe.h"
chardev/char-ringbuf.c +1 -1
@@ -24,8 +24,8 @@#include "qemu/osdep.h" #include "chardev/char.h" -#include "qmp-commands.h" #include "qapi/error.h" +#include "qapi/qapi-commands-char.h" #include "qemu/base64.h" #include "qemu/option.h"
chardev/char-socket.c +1 -0
@@ -31,6 +31,7 @@#include "qemu/option.h" #include "qapi/error.h" #include "qapi/clone-visitor.h" +#include "qapi/qapi-visit-sockets.h" #include "chardev/char-io.h"
chardev/char.c +1 -2
@@ -29,9 +29,8 @@#include "qemu/config-file.h" #include "qemu/error-report.h" #include "chardev/char.h" -#include "qmp-commands.h" -#include "qapi-visit.h" #include "qapi/error.h" +#include "qapi/qapi-commands-char.h" #include "qapi/qmp/qerror.h" #include "sysemu/replay.h" #include "qemu/help_option.h"
cpus.c +1 -1
@@ -27,6 +27,7 @@#include "cpu.h" #include "monitor/monitor.h" #include "qapi/error.h" +#include "qapi/qapi-events-run-state.h" #include "qapi/qmp/qerror.h" #include "qemu/error-report.h" #include "sysemu/sysemu.h"
@@ -49,7 +50,6 @@#include "qemu/bitmap.h" #include "qemu/seqlock.h" #include "tcg.h" -#include "qapi-event.h" #include "hw/nmi.h" #include "sysemu/replay.h" #include "hw/boards.h"
hmp.c +1 -1
@@ -29,11 +29,11 @@#include "monitor/qdev.h" #include "qapi/error.h" #include "qapi/opts-visitor.h" +#include "qapi-builtin-visit.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qerror.h" #include "qapi/string-input-visitor.h" #include "qapi/string-output-visitor.h" -#include "qapi-visit.h" #include "qom/object_interfaces.h" #include "ui/console.h" #include "block/nbd.h"
hw/acpi/core.c +1 -1
@@ -27,8 +27,8 @@#include "qemu/config-file.h" #include "qapi/error.h" #include "qapi/opts-visitor.h" +#include "qapi/qapi-events-run-state.h" #include "qapi-visit.h" -#include "qapi-event.h" #include "qemu/error-report.h" #include "qemu/option.h"
hw/block/block.c +1 -0
@@ -12,6 +12,7 @@#include "sysemu/block-backend.h" #include "hw/block/block.h" #include "qapi/error.h" +#include "qapi/qapi-types-block.h" #include "qemu/error-report.h" void blkconf_serial (BlockConf *conf,char **serial)
hw/block/hd-geometry.c +1 -0
@@ -32,6 +32,7 @@#include "qemu/osdep.h" #include "sysemu/block-backend.h" +#include "qapi/qapi-types-block.h" #include "qemu/bswap.h" #include "hw/block/block.h" #include "trace.h"
hw/char/virtio-console.c +1 -1
@@ -15,8 +15,8 @@#include "qemu/error-report.h" #include "trace.h" #include "hw/virtio/virtio-serial.h" -#include "qapi-event.h" #include "qapi/error.h" +#include "qapi/qapi-events-char.h" #define TYPE_VIRTIO_CONSOLE_SERIAL_PORT "virtserialport"#define VIRTIO_CONSOLE (obj) \
hw/core/machine.c +1 -1
@@ -13,7 +13,7 @@#include "qemu/osdep.h" #include "hw/boards.h" #include "qapi/error.h" -#include "qapi-visit.h" +#include "qapi/qapi-visit-common.h" #include "qapi/visitor.h" #include "hw/sysbus.h" #include "sysemu/sysemu.h"
hw/i386/pc.c +1 -1
@@ -67,8 +67,8 @@#include "acpi-build.h" #include "hw/mem/pc-dimm.h" #include "qapi/error.h" +#include "qapi/qapi-visit-common.h" #include "qapi/visitor.h" -#include "qapi-visit.h" #include "qom/cpu.h" #include "hw/nmi.h" #include "hw/i386/intel_iommu.h"
hw/mem/nvdimm.c +0 -1
@@ -25,7 +25,6 @@#include "qemu/osdep.h" #include "qapi/error.h" #include "qapi/visitor.h" -#include "qapi-visit.h" #include "hw/mem/nvdimm.h" static void nvdimm_get_label_size(Object *obj, Visitor *v, const char *name,
hw/net/rocker/qmp-norocker.c +1 -1
@@ -17,8 +17,8 @@#include "qemu/osdep.h" #include "qemu-common.h" -#include "qmp-commands.h" #include "qapi/error.h" +#include "qapi/qapi-commands-rocker.h" #include "qapi/qmp/qerror.h" RockerSwitch *qmp_query_rocker (const char *name,Error **errp)
hw/net/rocker/rocker.c +1 -1
@@ -22,9 +22,9 @@#include "net/net.h" #include "net/eth.h" #include "qapi/error.h" +#include "qapi/qapi-commands-rocker.h" #include "qemu/iov.h" #include "qemu/bitops.h" -#include "qmp-commands.h" #include "rocker.h" #include "rocker_hw.h"
hw/net/rocker/rocker_fp.c +1 -1
@@ -16,7 +16,7 @@#include "qemu/osdep.h" #include "net/clients.h" - +#include "qapi/qapi-types-rocker.h" #include "rocker.h" #include "rocker_hw.h" #include "rocker_fp.h"
hw/net/rocker/rocker_of_dpa.c +1 -1
@@ -17,9 +17,9 @@#include "qemu/osdep.h" #include "net/eth.h" #include "qapi/error.h" +#include "qapi/qapi-commands-rocker.h" #include "qemu/iov.h" #include "qemu/timer.h" -#include "qmp-commands.h" #include "rocker.h" #include "rocker_hw.h"
hw/net/virtio-net.c +1 -1
@@ -23,7 +23,7 @@#include "net/vhost_net.h" #include "hw/virtio/virtio-bus.h" #include "qapi/error.h" -#include "qapi-event.h" +#include "qapi/qapi-events-net.h" #include "hw/virtio/virtio-access.h" #include "migration/misc.h"
hw/ppc/spapr_rtas.c +0 -1
@@ -38,7 +38,6 @@#include "hw/ppc/spapr_vio.h" #include "hw/ppc/spapr_rtas.h" #include "hw/ppc/ppc.h" -#include "qapi-event.h" #include "hw/boards.h" #include <libfdt.h>
hw/tpm/tpm_emulator.c +1 -0
@@ -38,6 +38,7 @@#include "migration/blocker.h" #include "qapi/error.h" #include "qapi/clone-visitor.h" +#include "qapi/qapi-visit-tpm.h" #include "chardev/char-fe.h" #define DEBUG_TPM 0
hw/tpm/tpm_passthrough.c +1 -0
@@ -30,6 +30,7 @@#include "tpm_int.h" #include "hw/hw.h" #include "qapi/clone-visitor.h" +#include "qapi/qapi-visit-tpm.h" #include "tpm_util.h" #define DEBUG_TPM 0
hw/watchdog/watchdog.c +1 -1
@@ -24,9 +24,9 @@#include "qemu/config-file.h" #include "qemu/queue.h" #include "qapi/error.h" +#include "qapi/qapi-events-run-state.h" #include "sysemu/sysemu.h" #include "sysemu/watchdog.h" -#include "qapi-event.h" #include "hw/nmi.h" #include "qemu/help_option.h" #include "qmp-commands.h"
io/channel-socket.c +1 -0
@@ -20,6 +20,7 @@#include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi/qapi-visit-sockets.h" #include "io/channel-socket.h" #include "io/channel-watch.h" #include "trace.h"
io/dns-resolver.c +1 -0
@@ -21,6 +21,7 @@#include "qemu/osdep.h" #include "io/dns-resolver.h" #include "qapi/clone-visitor.h" +#include "qapi/qapi-visit-sockets.h" #include "qemu/sockets.h" #include "qapi/error.h" #include "qemu/cutils.h"
migration/colo-failover.c +1 -1
@@ -15,8 +15,8 @@#include "migration/failover.h" #include "qemu/main-loop.h" #include "migration.h" -#include "qmp-commands.h" #include "qapi/error.h" +#include "qapi/qapi-commands-migration.h" #include "qapi/qmp/qerror.h" #include "qemu/error-report.h" #include "trace.h"
migration/colo.c +1 -1
@@ -13,6 +13,7 @@#include "qemu/osdep.h" #include "sysemu/sysemu.h" #include "qapi/error.h" +#include "qapi/qapi-commands-migration.h" #include "qemu-file-channel.h" #include "migration.h" #include "qemu-file.h"
@@ -24,7 +25,6 @@#include "qemu/error-report.h" #include "migration/failover.h" #include "replication.h" -#include "qmp-commands.h" static bool vmstate_loading;
migration/migration.c +2 -2
@@ -31,15 +31,15 @@#include "migration/vmstate.h" #include "block/block.h" #include "qapi/error.h" +#include "qapi/qapi-commands-migration.h" +#include "qapi/qapi-events-migration.h" #include "qapi/qmp/qerror.h" #include "qapi/qmp/qnull.h" #include "qemu/rcu.h" #include "block.h" #include "postcopy-ram.h" #include "qemu/thread.h" -#include "qmp-commands.h" #include "trace.h" -#include "qapi-event.h" #include "exec/target_page.h" #include "io/channel-buffer.h" #include "migration/colo.h"
migration/ram.c +1 -1
@@ -29,7 +29,6 @@#include "qemu/osdep.h" #include "cpu.h" #include <zlib.h> -#include "qapi-event.h" #include "qemu/cutils.h" #include "qemu/bitops.h" #include "qemu/bitmap.h"
@@ -44,6 +43,7 @@#include "migration/page_cache.h" #include "qemu/error-report.h" #include "qapi/error.h" +#include "qapi/qapi-events-migration.h" #include "qapi/qmp/qerror.h" #include "trace.h" #include "exec/ram_addr.h"
net/colo-compare.c +0 -1
@@ -25,7 +25,6 @@#include "net/queue.h" #include "chardev/char-fe.h" #include "qemu/sockets.h" -#include "qapi-visit.h" #include "net/colo.h" #include "sysemu/iothread.h"
net/filter-buffer.c +1 -1
@@ -13,8 +13,8 @@#include "qemu-common.h" #include "qemu/timer.h" #include "qemu/iov.h" +#include "qapi-builtin-visit.h" #include "qapi/qmp/qerror.h" -#include "qapi-visit.h" #include "qom/object.h" #define TYPE_FILTER_BUFFER "filter-buffer"
net/filter-mirror.c +0 -1
@@ -14,7 +14,6 @@#include "net/net.h" #include "qemu-common.h" #include "qapi/error.h" -#include "qapi-visit.h" #include "qom/object.h" #include "qemu/main-loop.h" #include "qemu/error-report.h"
net/filter-rewriter.c +0 -1
@@ -16,7 +16,6 @@#include "net/net.h" #include "qemu-common.h" #include "qemu/error-report.h" -#include "qapi-visit.h" #include "qom/object.h" #include "qemu/main-loop.h" #include "qemu/iov.h"
net/net.c +2 -2
@@ -33,18 +33,18 @@#include "monitor/monitor.h" #include "qemu/help_option.h" +#include "qapi/qapi-commands-net.h" +#include "qapi/qapi-visit-net.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qerror.h" #include "qemu/error-report.h" #include "qemu/sockets.h" #include "qemu/cutils.h" #include "qemu/config-file.h" -#include "qmp-commands.h" #include "hw/qdev.h" #include "qemu/iov.h" #include "qemu/main-loop.h" #include "qemu/option.h" -#include "qapi-visit.h" #include "qapi/error.h" #include "qapi/opts-visitor.h" #include "sysemu/sysemu.h"
net/vhost-user.c +1 -1
@@ -14,10 +14,10 @@#include "net/vhost-user.h" #include "chardev/char-fe.h" #include "qapi/error.h" +#include "qapi/qapi-commands-net.h" #include "qemu/config-file.h" #include "qemu/error-report.h" #include "qemu/option.h" -#include "qmp-commands.h" #include "trace.h" typedef struct VhostUserState {
qemu-img.c +1 -1
@@ -27,7 +27,7 @@#include "qemu-version.h" #include "qapi/error.h" -#include "qapi-visit.h" +#include "qapi/qapi-visit-block-core.h" #include "qapi/qobject-output-visitor.h" #include "qapi/qmp/qjson.h" #include "qapi/qmp/qdict.h"
qom/object.c +1 -1
@@ -16,9 +16,9 @@#include "qom/object_interfaces.h" #include "qemu/cutils.h" #include "qapi/visitor.h" -#include "qapi-visit.h" #include "qapi/string-input-visitor.h" #include "qapi/string-output-visitor.h" +#include "qapi-builtin-visit.h" #include "qapi/qmp/qerror.h" #include "trace.h"
qom/object_interfaces.c +0 -1
@@ -5,7 +5,6 @@#include "qom/object_interfaces.h" #include "qemu/module.h" #include "qemu/option.h" -#include "qapi-visit.h" #include "qapi/opts-visitor.h" #include "qemu/config-file.h"
replay/replay-input.c +1 -0
@@ -16,6 +16,7 @@#include "qemu/notify.h" #include "ui/input.h" #include "qapi/clone-visitor.h" +#include "qapi/qapi-visit-ui.h" void replay_save_input_event (InputEvent *evt) {
stubs/tpm.c +2 -1
@@ -4,9 +4,10 @@* This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ +#include "qemu/osdep.h" +#include "qapi/qapi-commands-tpm.h" #include "sysemu/tpm.h" -#include "qmp-commands.h" int tpm_init (void ) {
target/s390x/kvm.c +0 -1
@@ -41,7 +41,6 @@#include "exec/gdbstub.h" #include "exec/address-spaces.h" #include "trace.h" -#include "qapi-event.h" #include "hw/s390x/s390-pci-inst.h" #include "hw/s390x/s390-pci-bus.h" #include "hw/s390x/ipl.h"
target/s390x/sigp.c +1 -0
@@ -17,6 +17,7 @@#include "exec/exec-all.h" #include "sysemu/sysemu.h" #include "trace.h" +#include "qapi-types.h" QemuMutex qemu_sigp_mutex;
tests/test-char.c +1 -1
@@ -8,9 +8,9 @@#include "chardev/char-mux.h" #include "sysemu/sysemu.h" #include "qapi/error.h" +#include "qapi/qapi-commands-char.h" #include "qapi/qmp/qdict.h" #include "qom/qom-qobject.h" -#include "qmp-commands.h" static bool quit;
tests/test-qmp-event.c +0 -1
@@ -14,7 +14,6 @@#include "qemu/osdep.h" #include "qemu-common.h" -#include "test-qapi-visit.h" #include "test-qapi-event.h" #include "qapi/error.h" #include "qapi/qmp/qbool.h"
tpm.c +1 -1
@@ -15,12 +15,12 @@#include "qemu/osdep.h" #include "qapi/error.h" +#include "qapi/qapi-commands-tpm.h" #include "qapi/qmp/qerror.h" #include "sysemu/tpm_backend.h" #include "sysemu/tpm.h" #include "qemu/config-file.h" #include "qemu/error-report.h" -#include "qmp-commands.h" static QLIST_HEAD(, TPMBackend) tpm_backends =QLIST_HEAD_INITIALIZER (tpm_backends);
trace/qmp.c +1 -1
@@ -9,7 +9,7 @@#include "qemu/osdep.h" #include "qapi/error.h" -#include "qmp-commands.h" +#include "qapi/qapi-commands-trace.h" #include "trace/control.h"
ui/console.c +1 -1
@@ -26,9 +26,9 @@#include "ui/console.h" #include "hw/qdev-core.h" #include "qapi/error.h" +#include "qapi/qapi-commands-ui.h" #include "qemu/option.h" #include "qemu/timer.h" -#include "qmp-commands.h" #include "chardev/char-fe.h" #include "trace.h" #include "exec/memory.h"
ui/input-legacy.c +1 -1
@@ -23,9 +23,9 @@*/ #include "qemu/osdep.h" +#include "qapi/qapi-commands-ui.h" #include "sysemu/sysemu.h" #include "ui/console.h" -#include "qmp-commands.h" #include "ui/keymaps.h" #include "ui/input.h"
ui/input.c +1 -1
@@ -1,9 +1,9 @@#include "qemu/osdep.h" #include "sysemu/sysemu.h" #include "qapi/error.h" +#include "qapi/qapi-commands-ui.h" #include "qapi/qmp/qdict.h" #include "qemu/error-report.h" -#include "qmp-commands.h" #include "trace.h" #include "ui/input.h" #include "ui/console.h"
ui/spice-core.c +2 -2
@@ -28,14 +28,14 @@#include "qemu/queue.h" #include "qemu-x509.h" #include "qemu/sockets.h" -#include "qmp-commands.h" #include "qapi/error.h" +#include "qapi/qapi-commands-ui.h" +#include "qapi/qapi-events-ui.h" #include "qemu/notify.h" #include "qemu/option.h" #include "migration/misc.h" #include "hw/hw.h" #include "ui/spice-display.h" -#include "qapi-event.h" /* core bits */
ui/vnc.c +1 -1
@@ -36,7 +36,7 @@#include "qemu/acl.h" #include "qemu/config-file.h" #include "qapi/error.h" -#include "qmp-commands.h" +#include "qapi/qapi-commands-ui.h" #include "ui/input.h" #include "qapi-event.h" #include "crypto/hash.h"
util/qemu-sockets.c +1 -1
@@ -24,11 +24,11 @@#include "monitor/monitor.h" #include "qapi/clone-visitor.h" #include "qapi/error.h" +#include "qapi/qapi-visit-sockets.h" #include "qemu/sockets.h" #include "qemu/main-loop.h" #include "qapi/qobject-input-visitor.h" #include "qapi/qobject-output-visitor.h" -#include "qapi-visit.h" #include "qemu/cutils.h" #ifndef AI_ADDRCONFIG
Signature · 1 line
2.14.3
Quoted 15 lines · Eric Blake
The following changes since commit
0dc8ae5e8e693737dfe65ba02d0c6eccb58a9c67:Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20180301-v2' into staging (2018-03-01 17:08:16 +0000)
are available in the Git repository at:
git://repo.or.cz/qemu/ericb.gittags/pull-qapi-2018-03-01-v2for you to fetch changes up to
76b2baeed38089c19f69c7117b8eaa64b0e7d227:qapi: Don't create useless directory qapi-generated (2018-03-01 19:16:40 -0600)
v2: fix rebase on top of s390x work so that build is successful (if I do it right, I'm sending just the changed patches)
Quoted 9 lines
Again, this series will be a conflict magnet due to content motion from qapi-schema.json to
qapi/misc.json; hopefully, the level of rebasing required is not too painful----------------------------------------------------------------
qapi patches for 2018-03-01- Markus Armbruster: Modularize generated QAPI code
This produces a huge pile of warnings from my OSX toolchain.
When running ar on libqemuutil.a:
AR libqemuutil.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: libqemuutil.a(qapi-types.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: libqemuutil.a(qapi-visit.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: libqemuutil.a(qapi-events.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: libqemuutil.a(qapi-events-common.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: libqemuutil.a(qapi-events-crypto.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: libqemuutil.a(qapi-events-introspect.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: libqemuutil.a(qapi-events-rocker.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: libqemuutil.a(qapi-events-sockets.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: libqemuutil.a(qapi-events-tpm.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: libqemuutil.a(qapi-events-trace.o) has no symbols /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file: libqemuutil.a(qapi-events-transaction.o) has no symbols
On every link of a binary:
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm:
no name list
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm:
no name list
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm:
no name list
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm:
no name list
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm:
no name list
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm:
no name list
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm:
no name list
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm:
no name list
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm:
no name list
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm:
no name list
warning: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/nm:
no name list
I think these are related -- nm complains once for every .o file in the archive that doesn't have any symbols in it.
I had a look at the autogenerated .c files on my Linux build, and they seem to consist only of a bunch of #includes. Why are we not generating any code here?
thanks
-- PMM
Quoted 15 lines · Peter Maydell
Quoted 4 lines · Eric Blake
The following changes since commit
0dc8ae5e8e693737dfe65ba02d0c6eccb58a9c67:Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20180301-v2' into staging (2018-03-01 17:08:16 +0000)Quoted 8 lines
are available in the Git repository at:
git://repo.or.cz/qemu/ericb.git tags/pull-qapi-2018-03-01-v2for you to fetch changes up to
76b2baeed38089c19f69c7117b8eaa64b0e7d227:qapi: Don't create useless directory qapi-generated (2018-03-01 19:16:40 -0600)
Quoted 6 lines
This produces a huge pile of warnings from my OSX toolchain.
When running ar on libqemuutil.a:
AR libqemuutil.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file:libqemuutil.a(qapi-types.o)has no symbols
Part of this change was moving the location of the generated ./qapi-types.c to qapi/qapi-types.c. Could it be that you are doing an incremental build, rather than a clean build, and the compiler is picking up the stale version of the file rather than its new location?
Quoted 2 lines
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file:libqemuutil.a(qapi-visit.o)has no symbols
Same thing.
Quoted 2 lines
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file:libqemuutil.a(qapi-events.o)has no symbols
Here, we renamed ./qapi-event.c to qapi/qapi-events.c, so the fact that the compiler named the right file is promising, but the fact that the file has no symbols is not good.
Quoted 7 lines
I think these are related -- nm complains once for every .o file in the archive that doesn't have any symbols in it.
I had a look at the autogenerated .c files on my Linux build, and they seem to consist only of a bunch of #includes. Why are we not generating any code here?
I don't have easy access to an OSX machine. What version of python is in use? My first thought was that it could be a subtle bug due to differences in the python engine running the qapi generators.
But I just checked, and at least for qapi/qapi-types.c, the generated file IS just a list of includes; and in fact, it looks like all of the mentioned files are in that boat (for example, qapi/transaction.json has no events, so qapi/qapi-events-transaction.c being empty makes sense).
I know that some compilers are picky about that. Is a typedef enough to cause the compiler to have something to compile without warnings? If so, does this patch solve things? If it does, I'll squash it in the right place within the series and submit a v3 pull request.
scripts/qapi/common.py +7 -0
@@ -2035,6 +2035,13 @@ class QAPIGenC(QAPIGen): ''', blurb=self._blurb, copyright=self._copyright) + def _bottom(self, fname): + return mcgen(''' +/* Dummy typedef to prevent empty .o file */ +typedef int %(name)s; +''', + name=c_name(fname)) + class QAPIGenH(QAPIGenC):
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Quoted 6 lines · Eric Blake
Quoted 5 lines · Peter Maydell
This produces a huge pile of warnings from my OSX toolchain.
When running ar on libqemuutil.a:
AR libqemuutil.a
Quoted 8 lines
Quoted 2 lines
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file:libqemuutil.a(qapi-types.o)has no symbolsPart of this change was moving the location of the generated ./qapi-types.c to
qapi/qapi-types.c. Could it be that you are doing an incremental build, rather than a clean build, and the compiler is picking up the stale version of the file rather than its new location?
I am doing an incremental build, yes. That needs to work, not break...
Quoted 10 lines
Quoted 3 lines
I had a look at the autogenerated .c files on my Linux build, and they seem to consist only of a bunch of #includes. Why are we not generating any code here?
But I just checked, and at least for
qapi/qapi-types.c, the generated file IS just a list of includes; and in fact, it looks like all of the mentioned files are in that boat (for example,qapi/transaction.jsonhas no events, soqapi/qapi-events-transaction.cbeing empty makes sense).I know that some compilers are picky about that.
Yes, I think this is what is causing the problem.
Quoted 2 lines
Is a typedef enough to
cause the compiler to have something to compile without warnings?
Given that the warnings are coming from nm and ranlib, anything that doesn't actually cause a symbol to be put into the .o file isn't going to be enough I suspect.
Quoted 11 lines
If so,
does this patch solve things? If it does, I'll squash it in the right place within the series and submit a v3 pull request.scripts/qapi/common.py +0
-0@@ -2035,6 +2035,13 @@ class QAPIGenC(QAPIGen): ''', blurb=self._blurb, copyright=self._copyright)
scripts/qapi/common.py class QAPIGenC(QAPIGen): · line 2046
Quoted 10 lines
scripts/qapi/common.py +7
-0+ def _bottom(self, fname): + return mcgen(''' +/* Dummy typedef to prevent empty .o file */ +typedef int %(name)s; +''', + name=c_name(fname)) + class QAPIGenH(QAPIGenC):
I just tested this, and it isn't sufficient.
thanks
-- PMM
Quoted 11 lines · Peter Maydell
Quoted 10 lines · Eric Blake
Quoted 7 lines · Peter Maydell
This produces a huge pile of warnings from my OSX toolchain.
When running ar on libqemuutil.a:
AR libqemuutil.a/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib:
file:libqemuutil.a(qapi-types.o)has no symbols
Quoted 6 lines
Quoted 4 lines
Part of this change was moving the location of the generated ./qapi-types.c to
qapi/qapi-types.c. Could it be that you are doing an incremental build, rather than a clean build, and the compiler is picking up the stale version of the file rather than its new location?I am doing an incremental build, yes. That needs to work, not break...
And since it was warnings and you picked up qapi/qapi-events.c, it looks like it does work; phew.
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
I had a look at the autogenerated .c files on my Linux build, and they seem to consist only of a bunch of #includes. Why are we not generating any code here?
Quoted 8 lines
Quoted 6 lines
But I just checked, and at least for
qapi/qapi-types.c, the generated file IS just a list of includes; and in fact, it looks like all of the mentioned files are in that boat (for example,qapi/transaction.jsonhas no events, soqapi/qapi-events-transaction.cbeing empty makes sense).I know that some compilers are picky about that.
Yes, I think this is what is causing the problem.
Okay, we've narrowed in on root cause, and it's now just a matter of finding the magic formula to shut up the toolchain.
Quoted 7 lines
Quoted 3 lines
Is a typedef enough to
cause the compiler to have something to compile without warnings?Given that the warnings are coming from nm and ranlib, anything that doesn't actually cause a symbol to be put into the .o file isn't going to be enough I suspect.
As I mentioned on IRC, gnulib has used typedefs to prevent empty files before:
https://git.savannah.gnu.org/cgit/gnulib.git/commit/lib/binary-io.c?id=c5d07ce91a8ad51591154450442fa4376441fdfa
https://lists.gnu.org/archive/html/bug-gnulib/2015-10/msg00019.html
https://lists.gnu.org/archive/html/bug-gnulib/2004-07/msg00029.html
Quoted 11 lines
scripts/qapi/common.py class QAPIGenC(QAPIGen): · line 2046
Quoted 9 lines
scripts/qapi/common.py +7
-0+ def _bottom(self, fname): + return mcgen(''' +/* Dummy typedef to prevent empty .o file */ +typedef int %(name)s; +''', + name=c_name(fname)) + class QAPIGenH(QAPIGenC):I just tested this, and it isn't sufficient.
Oh well, we'll have to burn actual storage, then. My next try is:
static char dummy_%(name)s;
perhaps with an __attribute__((unused)); if that gets by without warnings on the toolchains I have available, it should hopefully be stronger than just the typedef and therefore enough for your toolchain. I'll submit v3 shortly.
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org