Skip to contentSkip to conversation

QAPI patches for 2018-03-01

GIT PULL Eric Blake 2 participants 9 messages Mar 2, 2018

Subsystems (5)
lore
Share & tools
lore

Eric Blake

author
#0 lore raw

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
author
#1 lore raw

[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
index d214529547d..3c1abf27005 100644
@@ -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
index 92d29fd5710..1c9fff3aefe 100644
@@ -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
author
#2 lore raw

[Qemu-devel] [PULL v2 23/30] qapi: Generate separate .h, .c for each module

In reply to Eric Blake

From: 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
index 494ae382794..b12fcd5d8ff 100644
@@ -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
index 46757db771d..a43bccb1902 100644
@@ -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
index 069ec3715d7..077e0fde4f4 100644
@@ -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
index 81ab3abb309..1e0b990f356 100644
@@ -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
author
#3 lore raw

[Qemu-arm] [PULL v2 25/30] qapi: Empty out qapi-schema.json

In reply to Eric Blake

From: 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]>

[eblake: rebase to master]
---
 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
index b12fcd5d8ff..26ed98e0300 100644
@@ -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
index 5dc7a13c726..149627b5890 100644
@@ -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

include/hw/qdev-properties.h +2 -1
index 40c2c8acb1a..b2ad8e9faa9 100644

Lines of this file are not shown. View the raw message.

include/monitor/monitor.h +1 -1
index 50f7cea057d..d1024d4bdc3 100644

Lines of this file are not shown. View the raw message.

include/sysemu/arch_init.h +1 -1
index d40d882e383..cecd494159d 100644

Lines of this file are not shown. View the raw message.

include/sysemu/balloon.h +1 -1
index af49e19c787..66543ae8f4b 100644

Lines of this file are not shown. View the raw message.

include/sysemu/dump.h +1 -1
index 2424e314255..d824bc0941a 100644

Lines of this file are not shown. View the raw message.

include/sysemu/hostmem.h +1 -1
index e1efaf04ac7..47bc9846aca 100644

Lines of this file are not shown. View the raw message.

include/sysemu/replay.h +2 -1
index fb533ed9b6a..c0204e641c3 100644

Lines of this file are not shown. View the raw message.

vl.c +3 -1
index 24d855a373c..cdba3a39975 100644

Lines of this file are not shown. View the raw message.

arch_init.c +1 -1
index 4c36f2b076d..46d03f550da 100644

Lines of this file are not shown. View the raw message.

balloon.c +1 -1
index d8dd6fe7738..6bf0a968137 100644

Lines of this file are not shown. View the raw message.

block/iscsi.c +1 -1
index 421983dd6ff..d2b320ea41e 100644

Lines of this file are not shown. View the raw message.

cpus.c +1 -1
index ac5b21ef076..4f5f88edba9 100644

Lines of this file are not shown. View the raw message.

dump.c +2 -2
index 7b13baa4136..097e60b2b36 100644

Lines of this file are not shown. View the raw message.

hmp.c +9 -1
index cc35a787f94..8ea227dac4e 100644

Lines of this file are not shown. View the raw message.

hw/acpi/core.c +1 -1
index 5d4ce925dcd..b8d39012cda 100644

Lines of this file are not shown. View the raw message.

hw/acpi/cpu.c +1 -1
index a233fe17cf2..5ae595ecbe6 100644

Lines of this file are not shown. View the raw message.

hw/acpi/memory_hotplug.c +1 -1
index ea958a0e997..0ff1712c4cd 100644

Lines of this file are not shown. View the raw message.

hw/acpi/vmgenid.c +1 -1
index f25eafc0eca..d78b579a201 100644

Lines of this file are not shown. View the raw message.

hw/core/qdev.c +1 -1
index 7ed1f431f02..7635cf55fd0 100644

Lines of this file are not shown. View the raw message.

hw/i386/xen/xen-hvm.c +1 -1
index bfdbe555801..f24b7d4923b 100644

Lines of this file are not shown. View the raw message.

hw/ipmi/ipmi.c +1 -1
index adbbf6e4a63..9be281fd879 100644

Lines of this file are not shown. View the raw message.

hw/pci/pci-stub.c +1 -1
index 74ce7316da1..b941a0e842e 100644

Lines of this file are not shown. View the raw message.

hw/pci/pci.c +1 -1
index e006b6ac715..2174c254ebf 100644

Lines of this file are not shown. View the raw message.

hw/ppc/spapr_rtc.c +1 -1
index cfdb274bfdf..a37360537e0 100644

Lines of this file are not shown. View the raw message.

hw/s390x/s390-skeys.c +1 -1
index bdb6c18a0f9..76241c240e1 100644

Lines of this file are not shown. View the raw message.

hw/timer/mc146818rtc.c +2 -2
index 9d93a16e0fc..6f1f723b1f0 100644

Lines of this file are not shown. View the raw message.

hw/virtio/virtio-balloon.c +1 -1
index 48224493a0c..f456cea2e71 100644

Lines of this file are not shown. View the raw message.

hw/watchdog/watchdog.c +1 -1
index c7843d5748a..6e8ba061d8e 100644

Lines of this file are not shown. View the raw message.

iothread.c +1 -1
index 4b9bbde4cdc..2ec5a3bffea 100644

Lines of this file are not shown. View the raw message.

migration/savevm.c +2 -1
index 8e6d8724524..358c5b51e2f 100644

Lines of this file are not shown. View the raw message.

numa.c +2 -2
index 7e0e789b02d..5d7529c1d90 100644

Lines of this file are not shown. View the raw message.

qdev-monitor.c +1 -1
index 846238175f3..b8f6bc3f7ed 100644

Lines of this file are not shown. View the raw message.

qmp.c +3 -1
index 793f6f33230..a8d4eba973e 100644

Lines of this file are not shown. View the raw message.

stubs/uuid.c +1 -1
index a880de8d61d..a802e9836bc 100644

Lines of this file are not shown. View the raw message.

stubs/vmgenid.c +1 -1
index 3c8fe55bdf3..568e42b0648 100644

Lines of this file are not shown. View the raw message.

stubs/xen-hvm.c +1 -1
index 3ca6c51b212..0067bcc6db7 100644

Lines of this file are not shown. View the raw message.

target/arm/monitor.c +2 -1
index 299cb80ae7d..4cdd2676ddc 100644

Lines of this file are not shown. View the raw message.

target/i386/cpu.c +2 -2
index b5e431e769d..2c04645ceac 100644

Lines of this file are not shown. View the raw message.

target/s390x/cpu.c +2 -1
index 627002b2256..c2b775f4eb2 100644

Lines of this file are not shown. View the raw message.

target/s390x/sigp.c +1 -1
index 92b2830940c..aff1530c82b 100644

Lines of this file are not shown. View the raw message.

tests/qmp-test.c +2 -1
index 580848307ad..22445d9ec25 100644

Lines of this file are not shown. View the raw message.

tests/test-qobject-input-visitor.c +1 -1
index 3900be26101..d3a56bd0712 100644

Lines of this file are not shown. View the raw message.

tests/test-visitor-serialization.c +0 -1
index dd7e51d4f5d..438c18a0d64 100644

Lines of this file are not shown. View the raw message.

ui/gtk.c +1 -1
index ab646b70e17..0750262ca8f 100644

Lines of this file are not shown. View the raw message.

util/qemu-config.c +1 -1
index 10cae120cca..c651c4826e7 100644

Lines of this file are not shown. View the raw message.

.gitignore +4 -0
index 42c57998fd5..7f162e862fe 100644

Lines of this file are not shown. View the 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.

author
#4 lore raw

[Qemu-devel] [PULL v2 24/30] Include less of the generated modular QAPI headers

In reply to Eric Blake

From: 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
index ecff296c11a..9e57508446e 100644
@@ -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
index a43bccb1902..953449171b3 100644
@@ -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
index 1e0b990f356..5ad67084911 100644
@@ -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
index 59826b11625..2a3c502cf6d 100644
@@ -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
index 9b678e72634..de09966643d 100644
@@ -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
index 77da4c2f321..0823239f413 100644
@@ -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
index 19b3ab9cb5e..fac401ba3e6 100644
@@ -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
index e3f4bbf51dc..09efec609f6 100644
@@ -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
index fc500030038..631290dac94 100644
@@ -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
index a381dc3df86..ebf1e0ba048 100644
@@ -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
index 984fb8243f0..bce2d4c8e46 100644
@@ -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
index ca3267f3dfd..077ac7bea0e 100644
@@ -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
index 5e889059896..aa3c97a2ffa 100644
@@ -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
index 07a963e7940..edd0e132366 100644
@@ -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
index ad47d88be77..6b011e1dbc6 100644
@@ -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
index f532d10e355..d4f4dfffab9 100644
@@ -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
index 68a0c904eaf..3b813c7f7d6 100644
@@ -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
index f8d9f5b231c..f6ff32e7e2f 100644
@@ -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
index 1d61a351086..40c2c8acb1a 100644
@@ -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
index 2f69c08c13f..1a162185cc6 100644
@@ -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
index 50ace162059..2fe48ad3535 100644
@@ -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
index ad91ef23819..4c37218dcc1 100644
@@ -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
index d307de8350e..fd22dd30345 100644
@@ -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
index ad64ad8e682..50f7cea057d 100644
@@ -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
index 0c4a2ea6c90..435acd6f82c 100644
@@ -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
index 3fc48e4f51a..727643032cf 100644
@@ -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
index b119d3daa99..5b665ee38c6 100644
@@ -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
index c2115a6a4aa..bcb86a79f5e 100644
@@ -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
index 38ac68845cc..a2964fbf254 100644
@@ -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
index 8889bcb1ecf..e88d4c37abe 100644
@@ -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
index 03d45f44f87..abeb886d93c 100644
@@ -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
index aff88fa16f6..dc6d4956a81 100644
@@ -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
index dc73d59660c..5b5c016d8fa 100644
@@ -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
index c14bcfe8c60..2424e314255 100644
@@ -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
index d5ab0b99c61..e1efaf04ac7 100644
@@ -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
index dc8ae7b6b11..fb533ed9b6a 100644
@@ -13,6 +13,7 @@
  */
 
 #include "sysemu.h"
+#include "qapi-types.h"
 
 /* replay clock kinds */
 enum ReplayClockKind {
include/sysemu/sysemu.h +1 -0
index 77bb3da5828..bfbef9e69ca 100644
@@ -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
index 32b753d4f3e..9ae1ab6da3b 100644
@@ -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
index 677ace39457..a08d16380d7 100644
@@ -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
index f29bacd6255..e0d81f1144b 100644
@@ -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
index ceb22b8eef7..16395ab8f28 100644
@@ -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
index 82cf926b170..08c5d2ded14 100644
@@ -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
index f3a227b4fcc..53f0021c518 100644
@@ -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
index ae6888f74ae..9f931d52d61 100644
@@ -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
index ece6ca6133e..8faefe005f8 100644
@@ -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
index 1ca062f3321..7b29def77de 100644
@@ -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
index 3018433706e..24d855a373c 100644
@@ -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
index d0dff1a463b..f35be377efa 100644
@@ -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
index 8aa04120323..74fc04a3621 100644
@@ -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
index 628910f6382..c205320a50b 100644
@@ -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
index 0266ac990b3..94ffbb6a60b 100644
@@ -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
index 3df66947c5a..aeac482e7bb 100644
@@ -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
index ef81a9f53ba..683f486060c 100644
@@ -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
index 6576a73d6eb..bbdb4fadad0 100644
@@ -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
index 1fdeb1ef2fd..4c9923d262b 100644
@@ -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
index fd79c0ebaaf..3dd098b74f8 100644
@@ -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
index 19f1c344252..14333c18aac 100644
@@ -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
index ac02b10fe03..215223053bb 100644
@@ -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
index b63addcf948..b11d4c5e862 100644
@@ -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
index f26bcb5eee4..36cc0430c32 100644
@@ -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
index db3de0fa6d3..1d48fc20774 100644
@@ -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
index 3a5479bdad9..65a84739edc 100644
@@ -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
index 3fb1ca803c5..1fbfd3a2c40 100644
@@ -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
index 3f52f29f751..801d29d8496 100644
@@ -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
index e5f870e4d21..392db78b13d 100644
@@ -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
index 679afaa4fd5..87832e27920 100644
@@ -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
index bdd6cff5f64..22f65971a1d 100644
@@ -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
index c9a4da55163..5d7b079ef03 100644
@@ -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
index af678264f6e..ac5b21ef076 100644
@@ -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
index ae86bfbadeb..cc35a787f94 100644
@@ -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
index b50b3ca772c..5d4ce925dcd 100644
@@ -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
index b0269c857fd..b91e2b6d7ef 100644
@@ -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
index 57ad5012a70..79384a2b0a2 100644
@@ -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
index 4be5d4ee524..679a8248884 100644
@@ -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
index 5d445839e89..5e2bbcdaced 100644
@@ -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
index 55e69d66fe6..94cfd40ef2c 100644
@@ -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
index 61e677f92ff..acb656b6725 100644
@@ -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
index 94c1e480aed..0d60513c01b 100644
@@ -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
index a2a76c2a746..c02cbefece8 100644
@@ -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
index 4b3c9847db7..27b17c890f8 100644
@@ -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
index 9339df2d093..60046720a56 100644
@@ -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
index 369d40b3782..188744e17d5 100644
@@ -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
index 4bb939d3d11..0ec5fa4cfe4 100644
@@ -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
index b787aee13bc..f187a72c101 100644
@@ -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
index a495fe07f4a..211df3191c9 100644
@@ -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
index 98a5dd6689e..c7843d5748a 100644
@@ -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
index 563e297357c..8359b6683ac 100644
@@ -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
index c072d121c3a..8c924071c41 100644
@@ -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
index 891785cb631..0ae0c412212 100644
@@ -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
index 245a46d59de..4381067ed4c 100644
@@ -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
index 0aa596f8678..e345d0cc7e8 100644
@@ -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
index 5e33e5cc790..3b6c077964b 100644
@@ -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
index 76e03fdb140..23b2d2c4cc6 100644
@@ -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
index 9ce96aaa354..7c487629f92 100644
@@ -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
index bd78e25d127..3a61cf21e8c 100644
@@ -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
index 6201494ceb8..62dad2d773c 100644
@@ -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
index 7d429252586..547c4991105 100644
@@ -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
index cb455125069..98f36010495 100644
@@ -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
index 56edc152181..40bf7aa7d15 100644
@@ -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
index 5dcee4683ce..81b4f7ac482 100644
@@ -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
index 43d9aa0946d..2f76e1f36d5 100644
@@ -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
index 3ab1536bf75..6ee8b5f8dbf 100644
@@ -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
index c18aac1c739..6729bc85172 100644
@@ -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
index 656aaea2cd0..f570896dc16 100644
@@ -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
index 5a7a9c4cfbd..92b2830940c 100644
@@ -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
index b3586209113..b3a77af0855 100644
@@ -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
index 80123413438..5fbe7e551f7 100644
@@ -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
index d11b10bed86..2db03a09b21 100644
@@ -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
index ccd35cd840a..756086c79fb 100644
@@ -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
index e22931a3961..6a1f49916ee 100644
@@ -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
index 92b37ccb902..e5d4db1d973 100644
@@ -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
index 8bef0fb0383..51b1019252c 100644
@@ -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
index e449172fe90..ae8921a201c 100644
@@ -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
index d19f86c7f41..a25e408cf03 100644
@@ -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
index fbbef69f627..7f13e8a338c 100644
@@ -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
#5 lore raw
In reply to Eric Blake
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.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)

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

author
#6 lore raw
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-v2

for 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
index 077e0fde4f4..aed32646c00 100644
@@ -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
#7 lore raw
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 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?

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.json has no events, so qapi/qapi-events-transaction.c being 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
index 077e0fde4f4..aed32646c00 100644
@@ -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

author
#8 lore raw
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.json has no events, so qapi/qapi-events-transaction.c being 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