Skip to contentSkip to conversation

Modularize generated QAPI code

PATCH In review Markus Armbruster 6 participants 110 messages Feb 11, 2018 – Apr 13, 2018 Page 2 of 2

Subsystems (5)
lore
Share & tools
lore
#80 lore raw

Re: [Qemu-devel] [PATCH v2 23/29] Include less of the generated modular QAPI headers

In reply to Eric Blake
Quoted 18 lines · Eric Blake
Quoted 8 lines · Markus Armbruster

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.

Quoted 8 lines

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.

---
  backends/cryptodev.c             |  1 -
  backends/hostmem.c               |  3 ++-
Quoted 4 lines

How did you determine which shards to include where? Remove all shards, try compiling, and see what fails, then add back in the right includes? Or was it scripted somehow? (Trying to figure out, in case I have to rebase this patch)

Remove the monolithic include, fix compilation failures in my "everything" and my mingw configuration. Additionally, verify headers don't regress with an embarrassingly crude script (appended).

By "regress" I mean headers need more headers to be included first than before. Ideally, *no* headers need to be included first, but we aren't there (yet?).

Quoted 7 lines
Quoted 7 lines

+++ b/block/crypto.c

block/crypto.c +1 -0
@@ -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"
Quoted 8 lines

block/crypto.c line 30

Quoted 3 lines
block/crypto.c +0 -1
  #include "qapi/qobject-input-visitor.h"
-#include "qapi-visit.h"
  #include "qapi/error.h"

Any rhyme or reason to the resulting include order that I should be looking for (we aren't alphabetical in general, but if your changes were trying to honor a particular pattern among the few affected lines, that's useful to know).

Sane headers can be include in any order. Ours are almost sane, which prevents me from wholesale sorting. I still try to keep things locally sorted. Feel free not to bother :)

Quoted 35 lines

Review line 31

Quoted 1 line
(quoted diff) +1 -0
+++ b/scripts/qapi/commands.py

The non-mechanical portion of the patch :)

Quoted 18 lines
scripts/qapi/commands.py +5 -3
@@ -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"

scripts/qapi/commands.py class QAPISchemaGenCommandVisitor(QAPISchemaModularCVisitor): · line 265

Quoted 10 lines
scripts/qapi/commands.py +3 -3
    ''',
-                             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))

Makes sense.

Quoted 3 lines

The compiler will catch anything we did wrong.

Thanks!

#!/bin/sh
git-log -1 --oneline | cat

make -C bld qapi-types.h

cat >t.c <<EOF
#include "qemu/osdep.h"
#ifdef H
#include H
#endif
EOF

x=
for d in target/*
do

    t=${d#target/}
    bt=`ls -d bld/$t*-softmmu 2>/dev/null | head -n 1`
    [ "$bt" ] || continue
    h=`git-ls-files include/hw/$t`
    x="$x|include/hw/$t"
    cd $bt
    for i in $h
    do
	echo "= $i ="
	gcc -I/home/armbru/work/qemu/tcg -I/home/armbru/work/qemu/tcg/$t -I/home/armbru/work/qemu/tcg/i386 -I/home/armbru/work/qemu/linux-headers -I/home/armbru/work/qemu/bld/linux-headers -I. -I/home/armbru/work/qemu -I/home/armbru/work/qemu/include -I/home/armbru/work/qemu -I. -I/usr/include/pixman-1   -DHAS_LIBSSH2_SFTP_FSYNC -fPIE -DPIE -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common  -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong  -I/usr/include/p11-kit-1     -I/usr/include/libpng16  -I/usr/include/spice-server -I/usr/include/cacard -I/usr/include/nss3 -I/usr/include/nspr4 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/spice-1  -I/usr/include/cacard -I/usr/include/nss3 -I/usr/include/nspr4  -I/usr/include/libusb-1.0    -I../linux-headers -I.. -I/home/armbru/work/qemu/$d -DNEED_CPU_H -I/home/armbru/work/qemu/include -MMD -MP -MT t.o -MF ./t.d -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include  -g   -c -o t.o /home/armbru/work/qemu/t.c -H -DH='"'$i'"'
    done
    cd - >/dev/null

done

x=${x#|}
h=git-ls-files include | egrep -v "$x"
cd bld
for i in $h
do
echo "= $i ="
gcc -I/home/armbru/work/qemu/tcg -I/home/armbru/work/qemu/tcg/i386 -I/home/armbru/work/qemu/linux-headers -I/home/armbru/work/qemu/bld/linux-headers -I. -I/home/armbru/work/qemu -I/home/armbru/work/qemu/include -I/home/armbru/work/qemu -I. -I/usr/include/pixman-1 -DHAS_LIBSSH2_SFTP_FSYNC -fPIE -DPIE -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/include/p11-kit-1 -I/usr/include/libpng16 -I/usr/include/spice-server -I/usr/include/cacard -I/usr/include/nss3 -I/usr/include/nspr4 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/spice-1 -I/usr/include/cacard -I/usr/include/nss3 -I/usr/include/nspr4 -I/usr/include/libusb-1.0 -I/home/armbru/work/qemu/tests -MMD -MP -MT t.o -MF ./t.d -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -g -c -o t.o /home/armbru/work/qemu/t.c -H -DH='"'$i'"'
done
exit 0

Reviewed-by Marc-André Lureau on v2 23/29
#81 lore raw

Re: [Qemu-devel] [PATCH v2 23/29] Include less of the generated modular QAPI headers

In reply to Markus Armbruster
Quoted 8 lines · Markus Armbruster

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.

Quoted 5 lines

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.

Quoted 1,781 lines
---
 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 +-
 crypto/cipherpriv.h              |  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 +-
 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/qapi/visitor.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/input.h               |  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/migration.h            |  1 +
 migration/ram.c                  |  2 +-
 migration/ram.h                  |  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/tap_int.h                    |  2 +-
 net/vhost-user.c                 |  2 +-
 qemu-img.c                       |  2 +-
 qom/object.c                     |  2 +-
 qom/object_interfaces.c          |  1 -
 replay/replay-input.c            |  1 +
 replication.h                    |  1 +
 scripts/qapi/commands.py         | 14 ++++++++------
 scripts/qapi/events.py           | 10 ++++++----
 scripts/qapi/types.py            |  8 +++++---
 scripts/qapi/visit.py            | 10 ++++++----
 stubs/tpm.c                      |  3 ++-
 target/s390x/kvm.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 +-
 ui/vnc.h                         |  1 +
 util/qemu-sockets.c              |  2 +-
 vl.c                             |  4 ++--
 113 files changed, 133 insertions(+), 109 deletions(-)
backends/cryptodev.c +0 -1
index d0dff1a463..f35be377ef 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 81d14554a7..0afaf7160a 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 05a484b4b8..0b2784f322 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 0266ac990b..94ffbb6a60 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 70e3691cd8..c87abd5250 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 411eeb42a7..6c0e766b6f 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 6576a73d6e..bbdb4fadad 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 1fdeb1ef2f..4c9923d262 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 9245deac19..2fc58415bb 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 19f1c34425..14333c18aa 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 af125a2c8d..4c20fcda04 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 b63addcf94..b11d4c5e86 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 f26bcb5eee..36cc0430c3 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 db3de0fa6d..1d48fc2077 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 3a5479bdad..65a84739ed 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 bdbdeae7e4..85e011191b 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 3f52f29f75..801d29d849 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 e5f870e4d2..392db78b13 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 679afaa4fd..87832e2792 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 bdd6cff5f6..22f65971a1 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 c9a4da5516..5d7b079ef0 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 f298b659f4..ddb7f9b811 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"
crypto/cipherpriv.h +1 -1
index 77da4c2f32..0823239f41 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;
 
hmp.c +1 -1
index 7870d6a300..a49f4c126e 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 b50b3ca772..5d4ce925dc 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 b0269c857f..b91e2b6d7e 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 57ad5012a7..79384a2b0a 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 4be5d4ee52..679a824888 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 cdc1163dc6..f35075bff6 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 55e69d66fe..94cfd40ef2 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 61e677f92f..acb656b672 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 94c1e480ae..0d60513c01 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 a2a76c2a74..c02cbefece 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 4b3c9847db..27b17c890f 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 9339df2d09..60046720a5 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 369d40b378..188744e17d 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 4bb939d3d1..0ec5fa4cfe 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 b787aee13b..f187a72c10 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 a495fe07f4..211df3191c 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 98a5dd6689..c7843d5748 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"
include/block/block.h +1 -1
index 24ef816960..a1936996db 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 3da8486ab1..1454be358d 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 fc50003003..631290dac9 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 a381dc3df8..ebf1e0ba04 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 984fb8243f..bce2d4c8e4 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 ca3267f3df..077ac7bea0 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 5e88905989..aa3c97a2ff 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 07a963e794..edd0e13236 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 ad47d88be7..6b011e1dbc 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 f532d10e35..d4f4dfffab 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 68a0c904ea..3b813c7f7d 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 f8d9f5b231..f6ff32e7e2 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 1d61a35108..40c2c8acb1 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 2f69c08c13..1a162185cc 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 50ace16205..2fe48ad353 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 ad91ef2381..4c37218dcc 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 d307de8350..fd22dd3034 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 ad64ad8e68..50f7cea057 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 0c4a2ea6c9..435acd6f82 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 3fc48e4f51..727643032c 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 b119d3daa9..5b665ee38c 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 c2115a6a4a..bcb86a79f5 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 38ac68845c..a2964fbf25 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/qapi/visitor.h +1 -1
index ecff296c11..9e57508446 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
include/qemu/sockets.h +1 -1
index 8889bcb1ec..e88d4c37ab 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 03d45f44f8..abeb886d93 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 aff88fa16f..dc6d4956a8 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 dc73d59660..5b5c016d8f 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 c14bcfe8c6..2424e31425 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 621a3f9d42..6424f96df9 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 dc8ae7b6b1..fb533ed9b6 100644
@@ -13,6 +13,7 @@
  */
 
 #include "sysemu.h"
+#include "qapi-types.h"
 
 /* replay clock kinds */
 enum ReplayClockKind {
include/sysemu/sysemu.h +1 -0
index 77bb3da582..bfbef9e69c 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 32b753d4f3..9ae1ab6da3 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 677ace3945..a08d16380d 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/input.h +1 -1
index ceb22b8eef..16395ab8f2 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)
io/channel-socket.c +1 -0
index 563e297357..8359b6683a 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 c072d121c3..8c924071c4 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 891785cb63..0ae0c41221 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 245a46d59d..4381067ed4 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 86d69120a6..d26c5999de 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/migration.h +1 -0
index 848f638a20..e2f18256c9 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.c +1 -1
index 8333d8e35e..1b30305faf 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"
migration/ram.h +1 -1
index f3a227b4fc..53f0021c51 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/colo-compare.c +0 -1
index 76e03fdb14..23b2d2c4cc 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 9ce96aaa35..7c487629f9 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 bd78e25d12..3a61cf21e8 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 6201494ceb..62dad2d773 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 7d42925258..547c499110 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/tap_int.h +1 -1
index ae6888f74a..9f931d52d6 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);
net/vhost-user.c +1 -1
index cb45512506..98f3601049 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 56edc15218..40bf7aa7d1 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 5dcee4683c..81b4f7ac48 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 43d9aa0946..2f76e1f36d 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 3ab1536bf7..6ee8b5f8db 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)
 {
replication.h +1 -0
index ece6ca6133..8faefe005f 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;
scripts/qapi/commands.py +8 -6
index a43bccb190..953449171b 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 1e0b990f35..5ad6708491 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 59826b1162..2a3c502cf6 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 9b678e7263..de09966643 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))
stubs/tpm.c +2 -1
index c18aac1c73..6729bc8517 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 0301e9d519..00db81f438 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"
tests/test-char.c +1 -1
index b358620911..b3a77af085 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 8012341343..5fbe7e551f 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 d11b10bed8..2db03a09b2 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 ccd35cd840..756086c79f 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 36584d039e..a789b8c408 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 92b37ccb90..e5d4db1d97 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 8bef0fb038..51b1019252 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 e449172fe9..ae8921a201 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 c715bae1cf..d6329c8bd5 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"
ui/vnc.h +1 -0
index 1ca062f332..7b29def77d 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"
util/qemu-sockets.c +1 -1
index fbbef69f62..7f13e8a338 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
vl.c +2 -3
index 21878496ec..4e8287c507 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"
 
--

2.13.6

#82 lore raw

PATCH v2 24/29 qapi: Empty out qapi-schema.json

In reply to Markus Armbruster

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 not possible everywhere, except:

* monitor.c needs qmp-command.h to get qmp_init_marshall()

* 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.

---
 .gitignore                         |    4 +
 Makefile                           |    9 +
 Makefile.objs                      |    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 +-
 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 +-
 iothread.c                         |    2 +-
 migration/savevm.c                 |    3 +-
 numa.c                             |    4 +-
 qapi-schema.json                   | 3098 +-----------------------------------
 qapi/misc.json                     | 3090 +++++++++++++++++++++++++++++++++++
 qapi/run-state.json                |   10 +
 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 +-
 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 +-
 vl.c                               |    4 +-
 49 files changed, 3181 insertions(+), 3144 deletions(-)
 create mode 100644 qapi/misc.json
.gitignore +4 -0
index 42c57998fd..7f162e862f 100644
@@ -38,6 +38,7 @@
 /qapi/qapi-commands-crypto.[ch]
 /qapi/qapi-commands-introspect.[ch]
 /qapi/qapi-commands-migration.[ch]
+/qapi/qapi-commands-misc.[ch]
 /qapi/qapi-commands-net.[ch]
 /qapi/qapi-commands-rocker.[ch]
 /qapi/qapi-commands-run-state.[ch]
@@ -53,6 +54,7 @@
 /qapi/qapi-events-crypto.[ch]
 /qapi/qapi-events-introspect.[ch]
 /qapi/qapi-events-migration.[ch]
+/qapi/qapi-events-misc.[ch]
 /qapi/qapi-events-net.[ch]
 /qapi/qapi-events-rocker.[ch]
 /qapi/qapi-events-run-state.[ch]
@@ -68,6 +70,7 @@
 /qapi/qapi-types-crypto.[ch]
 /qapi/qapi-types-introspect.[ch]
 /qapi/qapi-types-migration.[ch]
+/qapi/qapi-types-misc.[ch]
 /qapi/qapi-types-net.[ch]
 /qapi/qapi-types-rocker.[ch]
 /qapi/qapi-types-run-state.[ch]
@@ -84,6 +87,7 @@
 /qapi/qapi-visit-crypto.[ch]
 /qapi/qapi-visit-introspect.[ch]
 /qapi/qapi-visit-migration.[ch]
+/qapi/qapi-visit-misc.[ch]
 /qapi/qapi-visit-net.[ch]
 /qapi/qapi-visit-rocker.[ch]
 /qapi/qapi-visit-run-state.[ch]
Makefile +9 -0
index ac9a7627a2..50eb194877 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
@@ -574,6 +578,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 \
@@ -592,6 +597,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 \
@@ -609,6 +615,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 \
@@ -625,6 +632,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 \
@@ -641,6 +649,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 7a55d45669..a7986bbf0b 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
arch_init.c +1 -1
index 4c36f2b076..46d03f550d 100644
@@ -28,9 +28,9 @@
 #include "sysemu/arch_init.h"
 #include "hw/pci/pci.h"
 #include "hw/audio/soundhw.h"
+#include "qapi/qapi-commands-misc.h"
 #include "qemu/config-file.h"
 #include "qemu/error-report.h"
-#include "qmp-commands.h"
 #include "hw/acpi/acpi.h"
 #include "qemu/help_option.h"
 
balloon.c +1 -1
index d8dd6fe773..6bf0a96813 100644
@@ -30,8 +30,8 @@
 #include "sysemu/kvm.h"
 #include "sysemu/balloon.h"
 #include "trace-root.h"
-#include "qmp-commands.h"
 #include "qapi/error.h"
+#include "qapi/qapi-commands-misc.h"
 #include "qapi/qmp/qerror.h"
 
 static QEMUBalloonEvent *balloon_event_fn;
block/iscsi.c +1 -1
index 9f99ae5e07..c727bfa788 100644
@@ -37,8 +37,8 @@
 #include "qemu/iov.h"
 #include "qemu/option.h"
 #include "qemu/uuid.h"
-#include "qmp-commands.h"
 #include "qapi/error.h"
+#include "qapi/qapi-commands-misc.h"
 #include "qapi/qmp/qdict.h"
 #include "qapi/qmp/qstring.h"
 #include "crypto/secret.h"
cpus.c +1 -1
index ddb7f9b811..a4c08ba6e2 100644
@@ -27,6 +27,7 @@
 #include "cpu.h"
 #include "monitor/monitor.h"
 #include "qapi/error.h"
+#include "qapi/qapi-commands-misc.h"
 #include "qapi/qapi-events-run-state.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/error-report.h"
@@ -39,7 +40,6 @@
 #include "sysemu/hax.h"
 #include "sysemu/hvf.h"
 #include "sysemu/whpx.h"
-#include "qmp-commands.h"
 #include "exec/exec-all.h"
 
 #include "qemu/thread.h"
dump.c +2 -2
index 7b13baa413..097e60b2b3 100644
@@ -23,9 +23,9 @@
 #include "sysemu/memory_mapping.h"
 #include "sysemu/cpus.h"
 #include "qapi/error.h"
+#include "qapi/qapi-commands-misc.h"
+#include "qapi/qapi-events-misc.h"
 #include "qapi/qmp/qerror.h"
-#include "qmp-commands.h"
-#include "qapi-event.h"
 #include "qemu/error-report.h"
 #include "hw/misc/vmcoreinfo.h"
 
hmp.c +9 -1
index a49f4c126e..c86946866b 100644
@@ -23,13 +23,21 @@
 #include "qemu/config-file.h"
 #include "qemu/option.h"
 #include "qemu/timer.h"
-#include "qmp-commands.h"
 #include "qemu/sockets.h"
 #include "monitor/monitor.h"
 #include "monitor/qdev.h"
 #include "qapi/error.h"
 #include "qapi/opts-visitor.h"
 #include "qapi-builtin-visit.h"
+#include "qapi/qapi-commands-block.h"
+#include "qapi/qapi-commands-char.h"
+#include "qapi/qapi-commands-migration.h"
+#include "qapi/qapi-commands-misc.h"
+#include "qapi/qapi-commands-net.h"
+#include "qapi/qapi-commands-rocker.h"
+#include "qapi/qapi-commands-run-state.h"
+#include "qapi/qapi-commands-tpm.h"
+#include "qapi/qapi-commands-ui.h"
 #include "qapi/qmp/qdict.h"
 #include "qapi/qmp/qerror.h"
 #include "qapi/string-input-visitor.h"
hw/acpi/core.c +1 -1
index 5d4ce925dc..b8d39012cd 100644
@@ -28,7 +28,7 @@
 #include "qapi/error.h"
 #include "qapi/opts-visitor.h"
 #include "qapi/qapi-events-run-state.h"
-#include "qapi-visit.h"
+#include "qapi/qapi-visit-misc.h"
 #include "qemu/error-report.h"
 #include "qemu/option.h"
 
hw/acpi/cpu.c +1 -1
index a233fe17cf..5ae595ecbe 100644
@@ -2,7 +2,7 @@
 #include "hw/boards.h"
 #include "hw/acpi/cpu.h"
 #include "qapi/error.h"
-#include "qapi-event.h"
+#include "qapi/qapi-events-misc.h"
 #include "trace.h"
 #include "sysemu/numa.h"
 
hw/acpi/memory_hotplug.c +1 -1
index ea958a0e99..0ff1712c4c 100644
@@ -5,8 +5,8 @@
 #include "hw/boards.h"
 #include "hw/qdev-core.h"
 #include "trace.h"
-#include "qapi-event.h"
 #include "qapi/error.h"
+#include "qapi/qapi-events-misc.h"
 
 #define MEMORY_SLOTS_NUMBER          "MDNR"
 #define MEMORY_HOTPLUG_IO_REGION     "HPMR"
hw/acpi/vmgenid.c +1 -1
index f25eafc0ec..d78b579a20 100644
@@ -12,7 +12,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "qmp-commands.h"
+#include "qapi/qapi-commands-misc.h"
 #include "hw/acpi/acpi.h"
 #include "hw/acpi/aml-build.h"
 #include "hw/acpi/vmgenid.h"
hw/core/qdev.c +1 -1
index 7ed1f431f0..7635cf55fd 100644
@@ -29,6 +29,7 @@
 #include "hw/qdev.h"
 #include "sysemu/sysemu.h"
 #include "qapi/error.h"
+#include "qapi/qapi-events-misc.h"
 #include "qapi/qmp/qerror.h"
 #include "qapi/visitor.h"
 #include "qemu/error-report.h"
@@ -36,7 +37,6 @@
 #include "hw/hotplug.h"
 #include "hw/boards.h"
 #include "hw/sysbus.h"
-#include "qapi-event.h"
 
 bool qdev_hotplug = false;
 static bool qdev_hot_added = false;
hw/i386/xen/xen-hvm.c +1 -1
index bfdbe55580..f24b7d4923 100644
@@ -16,8 +16,8 @@
 #include "hw/i386/apic-msidef.h"
 #include "hw/xen/xen_common.h"
 #include "hw/xen/xen_backend.h"
-#include "qmp-commands.h"
 #include "qapi/error.h"
+#include "qapi/qapi-commands-misc.h"
 #include "qemu/error-report.h"
 #include "qemu/range.h"
 #include "sysemu/xen-mapcache.h"
hw/ipmi/ipmi.c +1 -1
index adbbf6e4a6..9be281fd87 100644
@@ -26,9 +26,9 @@
 #include "hw/hw.h"
 #include "hw/ipmi/ipmi.h"
 #include "sysemu/sysemu.h"
-#include "qmp-commands.h"
 #include "qom/object_interfaces.h"
 #include "qapi/error.h"
+#include "qapi/qapi-commands-misc.h"
 #include "qapi/visitor.h"
 
 static uint32_t ipmi_current_uuid = 1;
hw/pci/pci-stub.c +1 -1
index 74ce7316da..b941a0e842 100644
@@ -22,9 +22,9 @@
 #include "sysemu/sysemu.h"
 #include "monitor/monitor.h"
 #include "qapi/error.h"
+#include "qapi/qapi-commands-misc.h"
 #include "qapi/qmp/qerror.h"
 #include "hw/pci/pci.h"
-#include "qmp-commands.h"
 #include "hw/pci/msi.h"
 
 bool msi_nonbroken;
hw/pci/pci.c +1 -1
index 239f73d711..7b9745ca77 100644
@@ -34,7 +34,6 @@
 #include "hw/loader.h"
 #include "qemu/error-report.h"
 #include "qemu/range.h"
-#include "qmp-commands.h"
 #include "trace.h"
 #include "hw/pci/msi.h"
 #include "hw/pci/msix.h"
@@ -42,6 +41,7 @@
 #include "hw/hotplug.h"
 #include "hw/boards.h"
 #include "qapi/error.h"
+#include "qapi/qapi-commands-misc.h"
 #include "qemu/cutils.h"
 
 //#define DEBUG_PCI
hw/ppc/spapr_rtc.c +1 -1
index cfdb274bfd..a37360537e 100644
@@ -30,8 +30,8 @@
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
 #include "hw/ppc/spapr.h"
-#include "qapi-event.h"
 #include "qapi/error.h"
+#include "qapi/qapi-events-misc.h"
 #include "qemu/cutils.h"
 
 void spapr_rtc_read(sPAPRRTCState *rtc, struct tm *tm, uint32_t *ns)
hw/s390x/s390-skeys.c +1 -1
index bdb6c18a0f..76241c240e 100644
@@ -11,9 +11,9 @@
 
 #include "qemu/osdep.h"
 #include "hw/boards.h"
-#include "qmp-commands.h"
 #include "hw/s390x/storage-keys.h"
 #include "qapi/error.h"
+#include "qapi/qapi-commands-misc.h"
 #include "qapi/qmp/qdict.h"
 #include "qemu/error-report.h"
 #include "sysemu/kvm.h"
hw/timer/mc146818rtc.c +2 -2
index 9d93a16e0f..6f1f723b1f 100644
@@ -31,9 +31,9 @@
 #include "sysemu/replay.h"
 #include "hw/timer/mc146818rtc.h"
 #include "qapi/error.h"
+#include "qapi/qapi-commands-misc.h"
+#include "qapi/qapi-events-misc.h"
 #include "qapi/visitor.h"
-#include "qapi-event.h"
-#include "qmp-commands.h"
 
 #ifdef TARGET_I386
 #include "hw/i386/apic.h"
hw/virtio/virtio-balloon.c +1 -1
index e05df206fc..5d98902831 100644
@@ -24,8 +24,8 @@
 #include "sysemu/kvm.h"
 #include "exec/address-spaces.h"
 #include "qapi/error.h"
+#include "qapi/qapi-events-misc.h"
 #include "qapi/visitor.h"
-#include "qapi-event.h"
 #include "trace.h"
 #include "qemu/error-report.h"
 
hw/watchdog/watchdog.c +1 -1
index c7843d5748..6e8ba061d8 100644
@@ -24,12 +24,12 @@
 #include "qemu/config-file.h"
 #include "qemu/queue.h"
 #include "qapi/error.h"
+#include "qapi/qapi-commands-run-state.h"
 #include "qapi/qapi-events-run-state.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/watchdog.h"
 #include "hw/nmi.h"
 #include "qemu/help_option.h"
-#include "qmp-commands.h"
 
 static WatchdogAction watchdog_action = WATCHDOG_ACTION_RESET;
 static QLIST_HEAD(watchdog_list, WatchdogTimerModel) watchdog_list;
include/hw/qdev-properties.h +2 -1
index 40c2c8acb1..b2ad8e9faa 100644
@@ -1,7 +1,8 @@
 #ifndef QEMU_QDEV_PROPERTIES_H
 #define QEMU_QDEV_PROPERTIES_H
 
-#include "qapi-types.h"
+#include "qapi/qapi-types-block.h"
+#include "qapi/qapi-types-misc.h"
 #include "hw/qdev-core.h"
 
 /*** qdev-properties.c ***/
include/monitor/monitor.h +1 -1
index 50f7cea057..d1024d4bdc 100644
@@ -3,7 +3,7 @@
 
 #include "qemu-common.h"
 #include "block/block.h"
-#include "qapi-types.h"
+#include "qapi/qapi-types-misc.h"
 #include "qemu/readline.h"
 
 extern Monitor *cur_mon;
include/sysemu/arch_init.h +1 -1
index d40d882e38..cecd494159 100644
@@ -1,7 +1,7 @@
 #ifndef QEMU_ARCH_INIT_H
 #define QEMU_ARCH_INIT_H
 
-#include "qapi-types.h"
+#include "qapi/qapi-types-misc.h"
 
 enum {
     QEMU_ARCH_ALL = -1,
include/sysemu/balloon.h +1 -1
index af49e19c78..66543ae8f4 100644
@@ -14,7 +14,7 @@
 #ifndef QEMU_BALLOON_H
 #define QEMU_BALLOON_H
 
-#include "qapi-types.h"
+#include "qapi/qapi-types-misc.h"
 
 typedef void (QEMUBalloonEvent)(void *opaque, ram_addr_t target);
 typedef void (QEMUBalloonStatus)(void *opaque, BalloonInfo *info);
include/sysemu/dump.h +1 -1
index 2424e31425..d824bc0941 100644
@@ -14,7 +14,7 @@
 #ifndef DUMP_H
 #define DUMP_H
 
-#include "qapi-types.h"
+#include "qapi/qapi-types-misc.h"
 
 #define MAKEDUMPFILE_SIGNATURE      "makedumpfile"
 #define MAX_SIZE_MDF_HEADER         (4096) /* max size of makedumpfile_header */
include/sysemu/hostmem.h +1 -1
index 6424f96df9..dc3ac3d301 100644
@@ -14,7 +14,7 @@
 #define SYSEMU_HOSTMEM_H
 
 #include "sysemu/sysemu.h" /* for MAX_NODES */
-#include "qapi-types.h"
+#include "qapi/qapi-types-misc.h"
 #include "qom/object.h"
 #include "exec/memory.h"
 #include "qemu/bitmap.h"
include/sysemu/replay.h +2 -1
index fb533ed9b6..c0204e641c 100644
@@ -13,7 +13,8 @@
  */
 
 #include "sysemu.h"
-#include "qapi-types.h"
+#include "qapi/qapi-types-misc.h"
+#include "qapi/qapi-types-ui.h"
 
 /* replay clock kinds */
 enum ReplayClockKind {
iothread.c +1 -1
index 4b9bbde4cd..2ec5a3bffe 100644
@@ -18,8 +18,8 @@
 #include "block/aio.h"
 #include "block/block.h"
 #include "sysemu/iothread.h"
-#include "qmp-commands.h"
 #include "qapi/error.h"
+#include "qapi/qapi-commands-misc.h"
 #include "qemu/error-report.h"
 #include "qemu/rcu.h"
 #include "qemu/main-loop.h"
migration/savevm.c +2 -1
index 3f611c02e8..0d42de293d 100644
@@ -41,12 +41,13 @@
 #include "savevm.h"
 #include "postcopy-ram.h"
 #include "qapi/error.h"
+#include "qapi/qapi-commands-migration.h"
+#include "qapi/qapi-commands-misc.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/error-report.h"
 #include "sysemu/cpus.h"
 #include "exec/memory.h"
 #include "exec/target_page.h"
-#include "qmp-commands.h"
 #include "trace.h"
 #include "qemu/iov.h"
 #include "block/snapshot.h"
numa.c +2 -2
index 7e0e789b02..5d7529c1d9 100644
@@ -29,12 +29,12 @@
 #include "qemu/bitmap.h"
 #include "qom/cpu.h"
 #include "qemu/error-report.h"
-#include "qapi-visit.h"
 #include "qapi/error.h"
 #include "qapi/opts-visitor.h"
+#include "qapi/qapi-commands-misc.h"
+#include "qapi/qapi-visit-misc.h"
 #include "hw/boards.h"
 #include "sysemu/hostmem.h"
-#include "qmp-commands.h"
 #include "hw/mem/pc-dimm.h"
 #include "qemu/option.h"
 #include "qemu/config-file.h"
qapi-schema.json +1 -3097

2,569 lines not on this page · raw message

qapi/misc.json new file +3090 -0

3,090 lines not on this page · raw message

qapi/run-state.json +10 -0
index bca46a8785..a27c3c2a93 100644

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

qdev-monitor.c +1 -1
index 846238175f..b8f6bc3f7e 100644

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

qmp.c +3 -1
index 793f6f3323..a8d4eba973 100644

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

stubs/uuid.c +1 -1
index a880de8d61..a802e9836b 100644

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

stubs/vmgenid.c +1 -1
index 3c8fe55bdf..568e42b064 100644

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

stubs/xen-hvm.c +1 -1
index 3ca6c51b21..0067bcc6db 100644

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

target/arm/monitor.c +2 -1
index 299cb80ae7..4cdd2676dd 100644

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

target/i386/cpu.c +2 -2
index b5e431e769..2c04645cea 100644

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

tests/qmp-test.c +2 -1
index 908f9b981f..8c1a997da4 100644

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

tests/test-qobject-input-visitor.c +1 -1
index 3900be2610..d3a56bd071 100644

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

tests/test-visitor-serialization.c +0 -1
index dd7e51d4f5..438c18a0d6 100644

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

ui/gtk.c +1 -1
index 1537751afa..a82494d605 100644

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

util/qemu-config.c +1 -1
index 10cae120cc..c651c4826e 100644

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

vl.c +3 -1
index 4e8287c507..4c8fb37bee 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 · 1 line
2.13.6

Part of the diff is not shown here. View the raw message.

#83 lore raw

Re: [Qemu-devel] [PATCH v2 24/29] qapi: Empty out qapi-schema.json

Quoted 10 lines · Markus Armbruster

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 not possible everywhere, except:

Odd wording, did you mean one of:

It's possible everywhere, except:
It's almost possible everywhere, except:

Quoted 2 lines

* monitor.c needs qmp-command.h to get qmp_init_marshall()

s/marshall/marshal/

Quoted 8 lines

* 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.

Getting better :)

Quoted 28 lines
---
  .gitignore                         |    4 +
  Makefile                           |    9 +
  Makefile.objs                      |    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 +-
  include/hw/qdev-properties.h       |    3 +-
  include/monitor/monitor.h          |    2 +-
Quoted 8 lines
  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 +-
  iothread.c                         |    2 +-
  migration/savevm.c                 |    3 +-
  numa.c                             |    4 +-

Mostly mechanical,

Quoted 2 lines
  qapi-schema.json                   | 3098 +-----------------------------------
  qapi/misc.json                     | 3090 +++++++++++++++++++++++++++++++++++

A huge move of content (git won't flag it as a rename, though ;(

But why is the new file smaller than what was removed from the old file?
Let's see...[1]

Quoted 15 lines
  qapi/run-state.json                |   10 +
  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 +-
  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 +-
  vl.c                               |    4 +-
  49 files changed, 3181 insertions(+), 3144 deletions(-)
Quoted 1 line

create mode 100644 qapi/misc.json

Huge email, but reviewing is not too hard.

.gitignore line 41

Quoted 10 lines
.gitignore +1 -0
index 42c57998fd..7f162e862f 100644
@@ -38,6 +38,7 @@
  /qapi/qapi-commands-crypto.[ch]
  /qapi/qapi-commands-introspect.[ch]
  /qapi/qapi-commands-migration.[ch]
+/qapi/qapi-commands-misc.[ch]

If my comments on the earlier patch result in a glob here, you wouldn't need these changes.

Quoted 11 lines
Makefile +1 -0
@@ -99,6 +99,7 @@ GENERATED_FILES += qapi/qapi-types-common.h qapi/qapi-types-common.c
  GENERATED_FILES += qapi/qapi-types-crypto.h qapi/qapi-types-crypto.c
  GENERATED_FILES += qapi/qapi-types-introspect.h qapi/qapi-types-introspect.c
  GENERATED_FILES += qapi/qapi-types-migration.h qapi/qapi-types-migration.c
+GENERATED_FILES += qapi/qapi-types-misc.h qapi/qapi-types-misc.c
  GENERATED_FILES += qapi/qapi-types-net.h qapi/qapi-types-net.c
  GENERATED_FILES += qapi/qapi-types-rocker.h qapi/qapi-types-rocker.c
  GENERATED_FILES += qapi/qapi-types-run-state.h qapi/qapi-types-run-state.c

Makefile GENERATED_FILES += qapi/qapi-visit-common.h qapi/qapi-visit-common.c · line 120

Quoted 4 lines
Makefile +1 -0
@@ -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

And again, my comments about using intermediate variables and make text substitution would result in less duplication here.

Makefile util-obj-y += qapi/qapi-types-common.o · line 14

Quoted 6 lines
Makefile +2 -0
+++ b/Makefile.objs
@@ -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

and possibly here too.

Quoted 11 lines
Makefile +1 -1
+++ b/hmp.c
@@ -23,13 +23,21 @@
  #include "qemu/config-file.h"
  #include "qemu/option.h"
  #include "qemu/timer.h"
-#include "qmp-commands.h"
  #include "qemu/sockets.h"
  #include "monitor/monitor.h"
  #include "monitor/qdev.h"
  #include "qapi/error.h"
  #include "qapi/opts-visitor.h"

Makefile line 40

Quoted 10 lines
Makefile +9 -0
  #include "qapi-builtin-visit.h"
+#include "qapi/qapi-commands-block.h"
+#include "qapi/qapi-commands-char.h"
+#include "qapi/qapi-commands-migration.h"
+#include "qapi/qapi-commands-misc.h"
+#include "qapi/qapi-commands-net.h"
+#include "qapi/qapi-commands-rocker.h"
+#include "qapi/qapi-commands-run-state.h"
+#include "qapi/qapi-commands-tpm.h"
+#include "qapi/qapi-commands-ui.h"

Well, not every file gets a smaller list of includes ;)

Quoted 4 lines
Makefile +1 -0
+++ b/qapi-schema.json
@@ -92,3100 +92,4 @@
  { 'include': 'qapi/transaction.json' }
  { 'include': 'qapi/trace.json' }

Makefile

Quoted 10 lines
Makefile +1 -7
  { 'include': 'qapi/introspect.json' }
-
-##
-# = Miscellanea
-##
 
-# Since: 2.11
-##
-{ 'command': 'watchdog-set-action', 'data' : {'action': 'WatchdogAction'} }
+{ 'include': 'qapi/misc.json' }

[1] Conflict magnet. We'd better be prepared for some rebasing to get this patch series through. See what the last item is here...

qapi/misc.json line 3

Quoted 9 lines
qapi/misc.json new file +3 -0
new file mode 100644
index 0000000000..225631bf7d
@@ -0,0 +1,3090 @@
+# -*- Mode: Python -*-
+#
+

Should we be thinking about copyright/license statements in the QAPI submodule files? But that's a topic for another series.

qapi/run-state.json

Quoted 4 lines
qapi/misc.json new file +3 -0
+# Since: 2.9
+##
+{ 'command': 'query-vm-generation-id', 'returns': 'GuidInfo' }
qapi/run-state.json +0 -0

[1] ...and oops - you already hit one of those conflicts. watchdog-set-action disappeared in the move. Or did it? [2]

Quoted 7 lines

index bca46a8785..a27c3c2a93 100644

qapi/run-state.json +0 -0
@@ -283,6 +283,16 @@
    'data': [ 'reset', 'shutdown', 'poweroff', 'pause', 'debug', 'none',
              'inject-nmi' ] }
 

qapi/run-state.json line 295

Quoted 10 lines
qapi/run-state.json +10 -0
+
+##
+# @watchdog-set-action:
+#
+# Set watchdog action
+#
+# Since: 2.11
+##
+{ 'command': 'watchdog-set-action', 'data' : {'action': 'WatchdogAction'} }
+

[2] Oh, you MOVED it to a different file. Let's fix that separately, so that THIS patch can be just 1-1 file motion, not 1-N (making rebasing easier).

qdev-monitor.c

Quoted 6 lines
qapi/run-state.json +0 -0
  ##
  # @GUEST_PANICKED:
  #
qdev-monitor.c +0 -1
index 846238175f..b8f6bc3f7e 100644
--- a/qdev-monitor.c

Looks reasonable, but not quite ready for my R-b until v3.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#84 lore raw

Re: [Qemu-devel] [PATCH v2 24/29] qapi: Empty out qapi-schema.json

Quoted 10 lines · Eric Blake
Quoted 9 lines · Markus Armbruster

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.

Quoted 6 lines
Quoted 1 line

It's not possible everywhere, except:

Odd wording, did you mean one of:

It's possible everywhere, except:
It's almost possible everywhere, except:

The former.

Quoted 3 lines
Quoted 1 line

* monitor.c needs qmp-command.h to get qmp_init_marshall()

s/marshall/marshal/

Yes.

Quoted 195 lines
Quoted 7 lines

* 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.

Getting better :)

Quoted 28 lines
---
  .gitignore                         |    4 +
  Makefile                           |    9 +
  Makefile.objs                      |    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 +-
  include/hw/qdev-properties.h       |    3 +-
  include/monitor/monitor.h          |    2 +-
Quoted 8 lines
  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 +-
  iothread.c                         |    2 +-
  migration/savevm.c                 |    3 +-
  numa.c                             |    4 +-

Mostly mechanical,

Quoted 2 lines
  qapi-schema.json                   | 3098 +-----------------------------------
  qapi/misc.json                     | 3090 +++++++++++++++++++++++++++++++++++

A huge move of content (git won't flag it as a rename, though ;(

But why is the new file smaller than what was removed from the old file? Let's see...[1]

Quoted 15 lines
  qapi/run-state.json                |   10 +
  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 +-
  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 +-
  vl.c                               |    4 +-
  49 files changed, 3181 insertions(+), 3144 deletions(-)
Quoted 1 line

create mode 100644 qapi/misc.json

Huge email, but reviewing is not too hard.

.gitignore line 41

Quoted 10 lines
.gitignore +1 -0
index 42c57998fd..7f162e862f 100644
@@ -38,6 +38,7 @@
  /qapi/qapi-commands-crypto.[ch]
  /qapi/qapi-commands-introspect.[ch]
  /qapi/qapi-commands-migration.[ch]
+/qapi/qapi-commands-misc.[ch]

If my comments on the earlier patch result in a glob here, you wouldn't need these changes.

Quoted 11 lines
Makefile +1 -0
@@ -99,6 +99,7 @@ GENERATED_FILES += qapi/qapi-types-common.h qapi/qapi-types-common.c
  GENERATED_FILES += qapi/qapi-types-crypto.h qapi/qapi-types-crypto.c
  GENERATED_FILES += qapi/qapi-types-introspect.h qapi/qapi-types-introspect.c
  GENERATED_FILES += qapi/qapi-types-migration.h qapi/qapi-types-migration.c
+GENERATED_FILES += qapi/qapi-types-misc.h qapi/qapi-types-misc.c
  GENERATED_FILES += qapi/qapi-types-net.h qapi/qapi-types-net.c
  GENERATED_FILES += qapi/qapi-types-rocker.h qapi/qapi-types-rocker.c
  GENERATED_FILES += qapi/qapi-types-run-state.h qapi/qapi-types-run-state.c

Makefile GENERATED_FILES += qapi/qapi-visit-common.h qapi/qapi-visit-common.c · line 120

Quoted 4 lines
Makefile +1 -0
@@ -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

And again, my comments about using intermediate variables and make text substitution would result in less duplication here.

Makefile util-obj-y += qapi/qapi-types-common.o · line 14

Quoted 6 lines
Makefile +2 -0
+++ b/Makefile.objs
@@ -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

and possibly here too.

Quoted 11 lines
Makefile +1 -1
+++ b/hmp.c
@@ -23,13 +23,21 @@
  #include "qemu/config-file.h"
  #include "qemu/option.h"
  #include "qemu/timer.h"
-#include "qmp-commands.h"
  #include "qemu/sockets.h"
  #include "monitor/monitor.h"
  #include "monitor/qdev.h"
  #include "qapi/error.h"
  #include "qapi/opts-visitor.h"

Makefile line 40

Quoted 10 lines
Makefile +9 -0
  #include "qapi-builtin-visit.h"
+#include "qapi/qapi-commands-block.h"
+#include "qapi/qapi-commands-char.h"
+#include "qapi/qapi-commands-migration.h"
+#include "qapi/qapi-commands-misc.h"
+#include "qapi/qapi-commands-net.h"
+#include "qapi/qapi-commands-rocker.h"
+#include "qapi/qapi-commands-run-state.h"
+#include "qapi/qapi-commands-tpm.h"
+#include "qapi/qapi-commands-ui.h"

Well, not every file gets a smaller list of includes ;)

Quoted 4 lines
Makefile +1 -0
+++ b/qapi-schema.json
@@ -92,3100 +92,4 @@
  { 'include': 'qapi/transaction.json' }
  { 'include': 'qapi/trace.json' }

Makefile

Quoted 10 lines
Makefile +1 -7
  { 'include': 'qapi/introspect.json' }
-
-##
-# = Miscellanea
-##
 
-# Since: 2.11
-##
-{ 'command': 'watchdog-set-action', 'data' : {'action': 'WatchdogAction'} }
+{ 'include': 'qapi/misc.json' }

[1] Conflict magnet. We'd better be prepared for some rebasing to get this patch series through. See what the last item is here...

qapi/misc.json line 3

Quoted 9 lines
qapi/misc.json new file +3 -0
new file mode 100644
index 0000000000..225631bf7d
@@ -0,0 +1,3090 @@
+# -*- Mode: Python -*-
+#
+

Should we be thinking about copyright/license statements in the QAPI submodule files? But that's a topic for another series.

qapi/run-state.json

Quoted 4 lines
qapi/misc.json new file +3 -0
+# Since: 2.9
+##
+{ 'command': 'query-vm-generation-id', 'returns': 'GuidInfo' }
qapi/run-state.json +0 -0

[1] ...and oops - you already hit one of those conflicts. watchdog-set-action disappeared in the move. Or did it?
[2]

Quoted 12 lines

index bca46a8785..a27c3c2a93 100644

qapi/run-state.json +5 -0
@@ -283,6 +283,16 @@
    'data': [ 'reset', 'shutdown', 'poweroff', 'pause', 'debug', 'none',
              'inject-nmi' ] }
  +
+##
+# @watchdog-set-action:
+#
+# Set watchdog action
+#
Quoted 8 lines

qapi/run-state.json line 295

Quoted 4 lines
qapi/run-state.json +4 -0
+# Since: 2.11
+##
+{ 'command': 'watchdog-set-action', 'data' : {'action': 'WatchdogAction'} }
+

[2] Oh, you MOVED it to a different file. Let's fix that separately, so that THIS patch can be just 1-1 file motion, not 1-N (making rebasing easier).

Okay.

Quoted 8 lines

qdev-monitor.c

Quoted 6 lines
qapi/run-state.json +0 -0
  ##
  # @GUEST_PANICKED:
  #
qdev-monitor.c +0 -1
index 846238175f..b8f6bc3f7e 100644
--- a/qdev-monitor.c

Looks reasonable, but not quite ready for my R-b until v3.

#85 lore raw

PATCH v2 25/29 docs/devel/writing-qmp-commands: Update for modular QAPI

In reply to Markus Armbruster

With modular code generation, putting stuff right into qapi-schema.json is a bad idea. Update writing-qmp-commands.txt accordingly.

---
 docs/devel/writing-qmp-commands.txt | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
docs/devel/writing-qmp-commands.txt +7 -7
index 4f5b24c0c4..776b3b41ca 100644
@@ -15,8 +15,8 @@ start with docs/interop/qmp-intro.txt.
 Generally speaking, the following steps should be taken in order to write a
 new QMP command.
 
-1. Write the command's and type(s) specification in the QAPI schema file
-   (qapi-schema.json in the root source directory)
+1. Define the command and any types it needs in the appropriate QAPI
+   schema module.
 
 2. Write the QMP command itself, which is a regular C function. Preferably,
    the command should be exported by some QEMU subsystem. But it can also be
@@ -88,8 +88,9 @@ command carries some meaningful action in QEMU but here it will just print
 Our command will be called "hello-world". It takes no arguments, nor does it
 return any data.
 
-The first step is to add the following line to the bottom of the
-qapi-schema.json file:
+The first step is defining the command in the appropriate QAPI schema
+module.  We pick module qapi/misc.json, and add the following line at
+the bottom:
 
 { 'command': 'hello-world' }
 
@@ -245,7 +246,7 @@ This is very important. No QMP command will be accepted in QEMU without proper
 documentation.
 
 There are many examples of such documentation in the schema file already, but
-here goes "hello-world"'s new entry for the qapi-schema.json file:
+here goes "hello-world"'s new entry for qapi/misc.json:
 
 ##
 # @hello-world
@@ -425,8 +426,7 @@ There are a number of things to be noticed:
    allocated by the implementation. This is so because the QAPI also generates
    a function to free its types and it cannot distinguish between dynamically
    or statically allocated strings
-6. You have to include the "qmp-commands.h" header file in qemu-timer.c,
-   otherwise qemu won't build
+6. You have to include "qapi/qmp-commands-misc.h" in qemu-timer.c
 
 Time to test the new command. Build qemu, run it as described in the "Testing"
 section and try this:
Signature · 1 line
2.13.6
Reviewed-by on v2 25/29
#86 lore raw

Re: [Qemu-devel] [PATCH v2 25/29] docs/devel/writing-qmp-commands: Update for modular QAPI

Quoted 9 lines · Markus Armbruster

With modular code generation, putting stuff right into qapi-schema.json is a bad idea. Update writing-qmp-commands.txt accordingly.

---
  docs/devel/writing-qmp-commands.txt | 14 +++++++-------
  1 file changed, 7 insertions(+), 7 deletions(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
Reviewed-by Marc-André Lureau on v2 25/29
#87 lore raw

Re: [Qemu-devel] [PATCH v2 25/29] docs/devel/writing-qmp-commands: Update for modular QAPI

In reply to Markus Armbruster
Quoted 5 lines · Markus Armbruster

With modular code generation, putting stuff right into qapi-schema.json is a bad idea. Update writing-qmp-commands.txt accordingly.

Quoted 53 lines
---
 docs/devel/writing-qmp-commands.txt | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
docs/devel/writing-qmp-commands.txt +7 -8
index 4f5b24c0c4..776b3b41ca 100644
@@ -15,8 +15,8 @@ start with docs/interop/qmp-intro.txt.
 Generally speaking, the following steps should be taken in order to write a
 new QMP command.
 
-1. Write the command's and type(s) specification in the QAPI schema file
-   (qapi-schema.json in the root source directory)
+1. Define the command and any types it needs in the appropriate QAPI
+   schema module.
 
 2. Write the QMP command itself, which is a regular C function. Preferably,
    the command should be exported by some QEMU subsystem. But it can also be
@@ -88,8 +88,9 @@ command carries some meaningful action in QEMU but here it will just print
 Our command will be called "hello-world". It takes no arguments, nor does it
 return any data.
 
-The first step is to add the following line to the bottom of the
-qapi-schema.json file:
+The first step is defining the command in the appropriate QAPI schema
+module.  We pick module qapi/misc.json, and add the following line at
+the bottom:
 
 { 'command': 'hello-world' }
 
@@ -245,7 +246,7 @@ This is very important. No QMP command will be accepted in QEMU without proper
 documentation.
 
 There are many examples of such documentation in the schema file already, but
-here goes "hello-world"'s new entry for the qapi-schema.json file:
+here goes "hello-world"'s new entry for qapi/misc.json:
 
 ##
 # @hello-world
@@ -425,8 +426,7 @@ There are a number of things to be noticed:
    allocated by the implementation. This is so because the QAPI also generates
    a function to free its types and it cannot distinguish between dynamically
    or statically allocated strings
-6. You have to include the "qmp-commands.h" header file in qemu-timer.c,
-   otherwise qemu won't build
+6. You have to include "qapi/qmp-commands-misc.h" in qemu-timer.c
 
 Time to test the new command. Build qemu, run it as described in the "Testing"
 section and try this:
--

2.13.6

Reviewed-by on v2 25/29
#88 lore raw

Re: [Qemu-devel] [PATCH v2 25/29] docs/devel/writing-qmp-commands: Update for modular QAPI

In reply to Markus Armbruster

Quoting Markus Armbruster (2018-02-11 03:36:03)

Quoted 5 lines

With modular code generation, putting stuff right into qapi-schema.json is a bad idea. Update writing-qmp-commands.txt accordingly.

Quoted 53 lines
---
 docs/devel/writing-qmp-commands.txt | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
docs/devel/writing-qmp-commands.txt +7 -7
index 4f5b24c0c4..776b3b41ca 100644
@@ -15,8 +15,8 @@ start with docs/interop/qmp-intro.txt.
 Generally speaking, the following steps should be taken in order to write a
 new QMP command.
 
-1. Write the command's and type(s) specification in the QAPI schema file
-   (qapi-schema.json in the root source directory)
+1. Define the command and any types it needs in the appropriate QAPI
+   schema module.
 
 2. Write the QMP command itself, which is a regular C function. Preferably,
    the command should be exported by some QEMU subsystem. But it can also be
@@ -88,8 +88,9 @@ command carries some meaningful action in QEMU but here it will just print
 Our command will be called "hello-world". It takes no arguments, nor does it
 return any data.
 
-The first step is to add the following line to the bottom of the
-qapi-schema.json file:
+The first step is defining the command in the appropriate QAPI schema
+module.  We pick module qapi/misc.json, and add the following line at
+the bottom:
 
 { 'command': 'hello-world' }
 
@@ -245,7 +246,7 @@ This is very important. No QMP command will be accepted in QEMU without proper
 documentation.
 
 There are many examples of such documentation in the schema file already, but
-here goes "hello-world"'s new entry for the qapi-schema.json file:
+here goes "hello-world"'s new entry for qapi/misc.json:
 
 ##
 # @hello-world
@@ -425,8 +426,7 @@ There are a number of things to be noticed:
    allocated by the implementation. This is so because the QAPI also generates
    a function to free its types and it cannot distinguish between dynamically
    or statically allocated strings
-6. You have to include the "qmp-commands.h" header file in qemu-timer.c,
-   otherwise qemu won't build
+6. You have to include "qapi/qmp-commands-misc.h" in qemu-timer.c
 
 Time to test the new command. Build qemu, run it as described in the "Testing"
 section and try this:
Signature · 1 line
2.13.6
#89 lore raw

PATCH v2 26/29 docs: Correct outdated information on QAPI

In reply to Markus Armbruster

* Fix guidance on error classes

* Point to generated documentation

* Drop plea for documentation, because the QAPI code generator enforces it since commit 3313b6124b

* Minor tweaks here and there

---
 docs/devel/writing-qmp-commands.txt | 25 +++++++++----------------
 docs/interop/qmp-intro.txt          |  3 ++-
 2 files changed, 11 insertions(+), 17 deletions(-)
docs/devel/writing-qmp-commands.txt +9 -16
index 776b3b41ca..50385eff27 100644
@@ -36,9 +36,9 @@ very simple and get more complex as we progress.
 For all the examples in the next sections, the test setup is the same and is
 shown here.
 
-First, QEMU should be started as:
+First, QEMU should be started like this:
 
-# /path/to/your/source/qemu [...] \
+# qemu-system-TARGET [...] \
     -chardev socket,id=qmp,port=4444,host=localhost,server \
     -mon chardev=qmp,mode=control,pretty=on
 
@@ -179,7 +179,7 @@ described in the "Testing" section and then send two commands:
     }
 }
 
-You should see "Hello, world" and "we love qemu" in the terminal running qemu,
+You should see "Hello, world" and "We love qemu" in the terminal running qemu,
 if you don't see these strings, then something went wrong.
 
 === Errors ===
@@ -221,30 +221,23 @@ The QMP server's response should be:
     }
 }
 
-As a general rule, all QMP errors should use ERROR_CLASS_GENERIC_ERROR
-(done by default when using error_setg()). There are two exceptions to
-this rule:
+Note that error_setg() produces a "GenericError" class.  In general,
+all QMP errors should have that error class.  There are two exceptions
+to this rule:
 
- 1. A non-generic ErrorClass value exists* for the failure you want to report
-    (eg. DeviceNotFound)
+ 1. To support a management application's need to recognize a specific
+    error for special handling
 
- 2. Management applications have to take special action on the failure you
-    want to report, hence you have to add a new ErrorClass value so that they
-    can check for it
+ 2. Backward compatibility
 
 If the failure you want to report falls into one of the two cases above,
 use error_set() with a second argument of an ErrorClass value.
 
- * All existing ErrorClass values are defined in the qapi-schema.json file
-
 === Command Documentation ===
 
 There's only one step missing to make "hello-world"'s implementation complete,
 and that's its documentation in the schema file.
 
-This is very important. No QMP command will be accepted in QEMU without proper
-documentation.
-
 There are many examples of such documentation in the schema file already, but
 here goes "hello-world"'s new entry for qapi/misc.json:
 
docs/interop/qmp-intro.txt +2 -1
index adbc94abb1..430fe1b747 100644
@@ -78,7 +78,8 @@ Escape character is '^]'.
     }
 }
 
-Please, refer to the qapi-schema.json file for a complete command reference.
+Please refer to docs/interop/qemu-qmp-ref.* for a complete command
+reference, generated from qapi-schema.json.
 
 QMP wiki page
 -------------
Signature · 1 line
2.13.6
Reviewed-by on v2 26/29
#90 lore raw

Re: [Qemu-devel] [PATCH v2 26/29] docs: Correct outdated information on QAPI

Quoted 7 lines · Markus Armbruster

* Fix guidance on error classes

* Point to generated documentation

* Drop plea for documentation, because the QAPI code generator enforces it since commit 3313b6124b

Quoted 8 lines

* Minor tweaks here and there

---
  docs/devel/writing-qmp-commands.txt | 25 +++++++++----------------
  docs/interop/qmp-intro.txt          |  3 ++-
  2 files changed, 11 insertions(+), 17 deletions(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
Reviewed-by Marc-André Lureau on v2 26/29
#91 lore raw

Re: [Qemu-devel] [PATCH v2 26/29] docs: Correct outdated information on QAPI

In reply to Markus Armbruster
Quoted 10 lines · Markus Armbruster

* Fix guidance on error classes

* Point to generated documentation

* Drop plea for documentation, because the QAPI code generator enforces it since commit 3313b6124b

* Minor tweaks here and there

looks good to me,

Quoted 84 lines
---
 docs/devel/writing-qmp-commands.txt | 25 +++++++++----------------
 docs/interop/qmp-intro.txt          |  3 ++-
 2 files changed, 11 insertions(+), 17 deletions(-)
docs/devel/writing-qmp-commands.txt +9 -16
index 776b3b41ca..50385eff27 100644
@@ -36,9 +36,9 @@ very simple and get more complex as we progress.
 For all the examples in the next sections, the test setup is the same and is
 shown here.
 
-First, QEMU should be started as:
+First, QEMU should be started like this:
 
-# /path/to/your/source/qemu [...] \
+# qemu-system-TARGET [...] \
     -chardev socket,id=qmp,port=4444,host=localhost,server \
     -mon chardev=qmp,mode=control,pretty=on
 
@@ -179,7 +179,7 @@ described in the "Testing" section and then send two commands:
     }
 }
 
-You should see "Hello, world" and "we love qemu" in the terminal running qemu,
+You should see "Hello, world" and "We love qemu" in the terminal running qemu,
 if you don't see these strings, then something went wrong.
 
 === Errors ===
@@ -221,30 +221,23 @@ The QMP server's response should be:
     }
 }
 
-As a general rule, all QMP errors should use ERROR_CLASS_GENERIC_ERROR
-(done by default when using error_setg()). There are two exceptions to
-this rule:
+Note that error_setg() produces a "GenericError" class.  In general,
+all QMP errors should have that error class.  There are two exceptions
+to this rule:
 
- 1. A non-generic ErrorClass value exists* for the failure you want to report
-    (eg. DeviceNotFound)
+ 1. To support a management application's need to recognize a specific
+    error for special handling
 
- 2. Management applications have to take special action on the failure you
-    want to report, hence you have to add a new ErrorClass value so that they
-    can check for it
+ 2. Backward compatibility
 
 If the failure you want to report falls into one of the two cases above,
 use error_set() with a second argument of an ErrorClass value.
 
- * All existing ErrorClass values are defined in the qapi-schema.json file
-
 === Command Documentation ===
 
 There's only one step missing to make "hello-world"'s implementation complete,
 and that's its documentation in the schema file.
 
-This is very important. No QMP command will be accepted in QEMU without proper
-documentation.
-
 There are many examples of such documentation in the schema file already, but
 here goes "hello-world"'s new entry for qapi/misc.json:
 
docs/interop/qmp-intro.txt +2 -2
index adbc94abb1..430fe1b747 100644
@@ -78,7 +78,8 @@ Escape character is '^]'.
     }
 }
 
-Please, refer to the qapi-schema.json file for a complete command reference.
+Please refer to docs/interop/qemu-qmp-ref.* for a complete command
+reference, generated from qapi-schema.json.
 
 QMP wiki page
 -------------
--

2.13.6

Reviewed-by on v2 26/29
#92 lore raw

Re: [Qemu-devel] [PATCH v2 26/29] docs: Correct outdated information on QAPI

In reply to Markus Armbruster

Quoting Markus Armbruster (2018-02-11 03:36:04)

Quoted 10 lines

* Fix guidance on error classes

* Point to generated documentation

* Drop plea for documentation, because the QAPI code generator enforces it since commit 3313b6124b

* Minor tweaks here and there

Quoted 84 lines
---
 docs/devel/writing-qmp-commands.txt | 25 +++++++++----------------
 docs/interop/qmp-intro.txt          |  3 ++-
 2 files changed, 11 insertions(+), 17 deletions(-)
docs/devel/writing-qmp-commands.txt +9 -16
index 776b3b41ca..50385eff27 100644
@@ -36,9 +36,9 @@ very simple and get more complex as we progress.
 For all the examples in the next sections, the test setup is the same and is
 shown here.
 
-First, QEMU should be started as:
+First, QEMU should be started like this:
 
-# /path/to/your/source/qemu [...] \
+# qemu-system-TARGET [...] \
     -chardev socket,id=qmp,port=4444,host=localhost,server \
     -mon chardev=qmp,mode=control,pretty=on
 
@@ -179,7 +179,7 @@ described in the "Testing" section and then send two commands:
     }
 }
 
-You should see "Hello, world" and "we love qemu" in the terminal running qemu,
+You should see "Hello, world" and "We love qemu" in the terminal running qemu,
 if you don't see these strings, then something went wrong.
 
 === Errors ===
@@ -221,30 +221,23 @@ The QMP server's response should be:
     }
 }
 
-As a general rule, all QMP errors should use ERROR_CLASS_GENERIC_ERROR
-(done by default when using error_setg()). There are two exceptions to
-this rule:
+Note that error_setg() produces a "GenericError" class.  In general,
+all QMP errors should have that error class.  There are two exceptions
+to this rule:
 
- 1. A non-generic ErrorClass value exists* for the failure you want to report
-    (eg. DeviceNotFound)
+ 1. To support a management application's need to recognize a specific
+    error for special handling
 
- 2. Management applications have to take special action on the failure you
-    want to report, hence you have to add a new ErrorClass value so that they
-    can check for it
+ 2. Backward compatibility
 
 If the failure you want to report falls into one of the two cases above,
 use error_set() with a second argument of an ErrorClass value.
 
- * All existing ErrorClass values are defined in the qapi-schema.json file
-
 === Command Documentation ===
 
 There's only one step missing to make "hello-world"'s implementation complete,
 and that's its documentation in the schema file.
 
-This is very important. No QMP command will be accepted in QEMU without proper
-documentation.
-
 There are many examples of such documentation in the schema file already, but
 here goes "hello-world"'s new entry for qapi/misc.json:
 
docs/interop/qmp-intro.txt +2 -1
index adbc94abb1..430fe1b747 100644
@@ -78,7 +78,8 @@ Escape character is '^]'.
     }
 }
 
-Please, refer to the qapi-schema.json file for a complete command reference.
+Please refer to docs/interop/qemu-qmp-ref.* for a complete command
+reference, generated from qapi-schema.json.
 
 QMP wiki page
 -------------
Signature · 1 line
2.13.6
#93 lore raw

PATCH v2 27/29 qapi: Move qapi-schema.json to qapi/, rename generated files

In reply to Markus Armbruster

Move qapi-schema.json to qapi/, so it's next to its modules, and all files get generated to qapi/, not just the ones generated for modules.

Consistently name the generated files qapi-MODULE.EXT:
qmp-commands.[ch] become qapi-commands.[ch], qapi-event.[ch] become qapi-events.[ch], and qmp-introspect.[ch] become qapi-introspect.[ch]. This gets rid of the temporary hacks in scripts/qapi/commands.py and scripts/qapi/events.py.

---
 .gitignore                                | 16 ++++++------
 Makefile                                  | 42 +++++++++++++++----------------
 Makefile.objs                             | 21 ++++++++--------
 backends/hostmem.c                        |  2 +-
 docs/devel/qapi-code-gen.txt              | 30 +++++++++++-----------
 docs/devel/writing-qmp-commands.txt       |  2 +-
 docs/interop/qmp-intro.txt                |  2 +-
 hmp.c                                     |  2 +-
 include/qapi/qmp/qobject.h                |  2 +-
 include/qapi/visitor.h                    |  2 +-
 include/qom/object.h                      |  2 +-
 monitor.c                                 |  6 ++---
 net/filter-buffer.c                       |  2 +-
 qapi/misc.json                            |  4 +--
 qapi-schema.json => qapi/qapi-schema.json | 32 +++++++++++------------
 qga/Makefile.objs                         |  2 +-
 qga/commands-posix.c                      |  2 +-
 qga/commands-win32.c                      |  2 +-
 qga/commands.c                            |  2 +-
 qga/main.c                                |  2 +-
 qom/object.c                              |  2 +-
 scripts/qapi/commands.py                  |  7 ------
 scripts/qapi/events.py                    |  9 +------
 scripts/qapi/introspect.py                |  4 +--
 scripts/qapi/types.py                     |  6 ++---
 scripts/qapi/visit.py                     |  6 ++---
 tests/.gitignore                          |  6 ++---
 tests/Makefile.include                    | 14 +++++------
 tests/test-qmp-cmds.c                     |  2 +-
 tests/test-qmp-event.c                    |  2 +-
 tests/test-qobject-input-visitor.c        |  6 ++---
 tpm.c                                     |  1 -
 ui/cocoa.m                                |  2 +-
 ui/vnc.c                                  |  2 +-
 34 files changed, 116 insertions(+), 130 deletions(-)
 rename qapi-schema.json => qapi/qapi-schema.json (85%)
.gitignore +8 -8
index 7f162e862f..dabfe6bea8 100644
@@ -29,8 +29,8 @@
 /qga/qapi-generated
 /qapi-generated
 /qapi-gen-timestamp
-/qapi-builtin-types.[ch]
-/qapi-builtin-visit.[ch]
+/qapi/qapi-builtin-types.[ch]
+/qapi/qapi-builtin-visit.[ch]
 /qapi/qapi-commands-block-core.[ch]
 /qapi/qapi-commands-block.[ch]
 /qapi/qapi-commands-char.[ch]
@@ -47,6 +47,7 @@
 /qapi/qapi-commands-trace.[ch]
 /qapi/qapi-commands-transaction.[ch]
 /qapi/qapi-commands-ui.[ch]
+/qapi/qapi-commands.[ch]
 /qapi/qapi-events-block-core.[ch]
 /qapi/qapi-events-block.[ch]
 /qapi/qapi-events-char.[ch]
@@ -63,6 +64,8 @@
 /qapi/qapi-events-trace.[ch]
 /qapi/qapi-events-transaction.[ch]
 /qapi/qapi-events-ui.[ch]
+/qapi/qapi-events.[ch]
+/qapi/qapi-introspect.[ch]
 /qapi/qapi-types-block-core.[ch]
 /qapi/qapi-types-block.[ch]
 /qapi/qapi-types-char.[ch]
@@ -79,7 +82,7 @@
 /qapi/qapi-types-trace.[ch]
 /qapi/qapi-types-transaction.[ch]
 /qapi/qapi-types-ui.[ch]
-/qapi-types.[ch]
+/qapi/qapi-types.[ch]
 /qapi/qapi-visit-block-core.[ch]
 /qapi/qapi-visit-block.[ch]
 /qapi/qapi-visit-char.[ch]
@@ -96,11 +99,8 @@
 /qapi/qapi-visit-trace.[ch]
 /qapi/qapi-visit-transaction.[ch]
 /qapi/qapi-visit-ui.[ch]
-/qapi-visit.[ch]
-/qapi-event.[ch]
-/qapi-doc.texi
-/qmp-commands.[ch]
-/qmp-introspect.[ch]
+/qapi/qapi-visit.[ch]
+/qapi/qapi-doc.texi
 /qemu-doc.html
 /qemu-doc.info
 /qemu-doc.txt
Makefile +21 -21

126 lines not on this page · raw message

Makefile.objs +11 -10
index a7986bbf0b..9aa1024c34 100644
@@ -2,8 +2,8 @@
 # Common libraries for tools and emulators
 stub-obj-y = stubs/ crypto/
 util-obj-y = util/ qobject/ qapi/
-util-obj-y += qapi-builtin-types.o
-util-obj-y += qapi-types.o
+util-obj-y += qapi/qapi-builtin-types.o
+util-obj-y += qapi/qapi-types.o
 util-obj-y += qapi/qapi-types-block-core.o
 util-obj-y += qapi/qapi-types-block.o
 util-obj-y += qapi/qapi-types-char.o
@@ -20,8 +20,8 @@ util-obj-y += qapi/qapi-types-tpm.o
 util-obj-y += qapi/qapi-types-trace.o
 util-obj-y += qapi/qapi-types-transaction.o
 util-obj-y += qapi/qapi-types-ui.o
-util-obj-y += qapi-builtin-visit.o
-util-obj-y += qapi-visit.o
+util-obj-y += qapi/qapi-builtin-visit.o
+util-obj-y += qapi/qapi-visit.o
 util-obj-y += qapi/qapi-visit-block-core.o
 util-obj-y += qapi/qapi-visit-block.o
 util-obj-y += qapi/qapi-visit-char.o
@@ -38,7 +38,7 @@ util-obj-y += qapi/qapi-visit-tpm.o
 util-obj-y += qapi/qapi-visit-trace.o
 util-obj-y += qapi/qapi-visit-transaction.o
 util-obj-y += qapi/qapi-visit-ui.o
-util-obj-y += qapi-event.o
+util-obj-y += qapi/qapi-events.o
 util-obj-y += qapi/qapi-events-block-core.o
 util-obj-y += qapi/qapi-events-block.o
 util-obj-y += qapi/qapi-events-char.o
@@ -55,7 +55,7 @@ util-obj-y += qapi/qapi-events-tpm.o
 util-obj-y += qapi/qapi-events-trace.o
 util-obj-y += qapi/qapi-events-transaction.o
 util-obj-y += qapi/qapi-events-ui.o
-util-obj-y += qmp-introspect.o
+util-obj-y += qapi/qapi-introspect.o
 
 chardev-obj-y = chardev/
 
@@ -131,7 +131,7 @@ common-obj-$(CONFIG_FDT) += device_tree.o
 ######################################################################
 # qapi
 
-common-obj-y += qmp-commands.o
+common-obj-y += qapi/qapi-commands.o
 common-obj-y += qapi/qapi-commands-block-core.o
 common-obj-y += qapi/qapi-commands-block.o
 common-obj-y += qapi/qapi-commands-char.o
@@ -148,7 +148,7 @@ common-obj-y += qapi/qapi-commands-tpm.o
 common-obj-y += qapi/qapi-commands-trace.o
 common-obj-y += qapi/qapi-commands-transaction.o
 common-obj-y += qapi/qapi-commands-ui.o
-common-obj-y += qmp-introspect.o
+common-obj-y += qapi/qapi-introspect.o
 common-obj-y += qmp.o hmp.o
 endif
 
@@ -171,8 +171,9 @@ target-obj-y += trace/
 ######################################################################
 # guest agent
 
-# FIXME: a few definitions from qapi-types.o/qapi-visit.o are needed
-# by libqemuutil.a.  These should be moved to a separate .json schema.
+# FIXME: a few definitions from qapi/qapi-types.o and
+# qapi/qapi-visit.o are needed by libqemuutil.a.  These should be
+# extracted into a QAPI schema module, or perhaps a separate schema.
 qga-obj-y = qga/
 qga-vss-dll-obj-y = qga/
 
backends/hostmem.c +1 -1
index 0afaf7160a..1292a9da1e 100644
@@ -14,7 +14,7 @@
 #include "sysemu/hostmem.h"
 #include "hw/boards.h"
 #include "qapi/error.h"
-#include "qapi-builtin-visit.h"
+#include "qapi/qapi-builtin-visit.h"
 #include "qapi/visitor.h"
 #include "qemu/config-file.h"
 #include "qom/object_interfaces.h"
docs/devel/qapi-code-gen.txt +15 -15
index ba1dc73298..0c4fc342fe 100644
@@ -647,7 +647,7 @@ name an event 'MAX', since the generator also produces a C enumeration
 of all event names with a generated _MAX value at the end.  When
 'data' is also specified, additional info will be included in the
 event, with similar semantics to a 'struct' expression.  Finally there
-will be C API generated in qapi-event.h; when called by QEMU code, a
+will be C API generated in qapi-events.h; when called by QEMU code, a
 message with timestamp will be emitted on the wire.
 
 An example event is:
@@ -1147,15 +1147,15 @@ declares qmp_COMMAND() that the user must implement.
 
 The following files are generated:
 
-$(prefix)qmp-commands.c: Command marshal/dispatch functions for each
-                         QMP command defined in the schema
+$(prefix)qapi-commands.c: Command marshal/dispatch functions for each
+                          QMP command defined in the schema
 
-$(prefix)qmp-commands.h: Function prototypes for the QMP commands
-                         specified in the schema
+$(prefix)qapi-commands.h: Function prototypes for the QMP commands
+                          specified in the schema
 
 Example:
 
-    $ cat qapi-generated/example-qmp-commands.h
+    $ cat qapi-generated/example-qapi-commands.h
 [Uninteresting stuff omitted...]
 
     #ifndef EXAMPLE_QMP_COMMANDS_H
@@ -1170,7 +1170,7 @@ Example:
     void qmp_marshal_my_command(QDict *args, QObject **ret, Error **errp);
 
     #endif
-    $ cat qapi-generated/example-qmp-commands.c
+    $ cat qapi-generated/example-qapi-commands.c
 [Uninteresting stuff omitted...]
 
     static void qmp_marshal_output_UserDefOne(UserDefOne *ret_in, QObject **ret_out, Error **errp)
@@ -1243,14 +1243,14 @@ qapi_event_send_EVENT().
 
 The following files are created:
 
-$(prefix)qapi-event.h - Function prototypes for each event type, plus an
+$(prefix)qapi-events.h - Function prototypes for each event type, plus an
                         enumeration of all event names
 
-$(prefix)qapi-event.c - Implementation of functions to send an event
+$(prefix)qapi-events.c - Implementation of functions to send an event
 
 Example:
 
-    $ cat qapi-generated/example-qapi-event.h
+    $ cat qapi-generated/example-qapi-events.h
 [Uninteresting stuff omitted...]
 
     #ifndef EXAMPLE_QAPI_EVENT_H
@@ -1273,7 +1273,7 @@ Example:
     extern const char *const example_QAPIEvent_lookup[];
 
     #endif
-    $ cat qapi-generated/example-qapi-event.c
+    $ cat qapi-generated/example-qapi-events.c
 [Uninteresting stuff omitted...]
 
     void qapi_event_send_my_event(Error **errp)
@@ -1305,14 +1305,14 @@ Example:
 
 The following files are created:
 
-$(prefix)qmp-introspect.c - Defines a string holding a JSON
+$(prefix)qapi-introspect.c - Defines a string holding a JSON
                             description of the schema
 
-$(prefix)qmp-introspect.h - Declares the above string
+$(prefix)qapi-introspect.h - Declares the above string
 
 Example:
 
-    $ cat qapi-generated/example-qmp-introspect.h
+    $ cat qapi-generated/example-qapi-introspect.h
 [Uninteresting stuff omitted...]
 
     #ifndef EXAMPLE_QMP_INTROSPECT_H
@@ -1321,7 +1321,7 @@ Example:
     extern const char example_qmp_schema_json[];
 
     #endif
-    $ cat qapi-generated/example-qmp-introspect.c
+    $ cat qapi-generated/example-qapi-introspect.c
 [Uninteresting stuff omitted...]
 
     const char example_qmp_schema_json[] = "["
docs/devel/writing-qmp-commands.txt +1 -1
index 50385eff27..9dfc62bf5a 100644
@@ -419,7 +419,7 @@ There are a number of things to be noticed:
    allocated by the implementation. This is so because the QAPI also generates
    a function to free its types and it cannot distinguish between dynamically
    or statically allocated strings
-6. You have to include "qapi/qmp-commands-misc.h" in qemu-timer.c
+6. You have to include "qapi/qapi-commands-misc.h" in qemu-timer.c
 
 Time to test the new command. Build qemu, run it as described in the "Testing"
 section and try this:
docs/interop/qmp-intro.txt +1 -1
index 430fe1b747..900d69d612 100644
@@ -79,7 +79,7 @@ Escape character is '^]'.
 }
 
 Please refer to docs/interop/qemu-qmp-ref.* for a complete command
-reference, generated from qapi-schema.json.
+reference, generated from qapi/qapi-schema.json.
 
 QMP wiki page
 -------------
hmp.c +1 -1
index c86946866b..1f31de3217 100644
@@ -28,7 +28,7 @@
 #include "monitor/qdev.h"
 #include "qapi/error.h"
 #include "qapi/opts-visitor.h"
-#include "qapi-builtin-visit.h"
+#include "qapi/qapi-builtin-visit.h"
 #include "qapi/qapi-commands-block.h"
 #include "qapi/qapi-commands-char.h"
 #include "qapi/qapi-commands-migration.h"
include/qapi/qmp/qobject.h +1 -1
index a2964fbf25..012439a2e3 100644
@@ -32,7 +32,7 @@
 #ifndef QOBJECT_H
 #define QOBJECT_H
 
-#include "qapi-builtin-types.h"
+#include "qapi/qapi-builtin-types.h"
 
 struct QObject {
     QType type;
include/qapi/visitor.h +1 -1
index 9e57508446..5b2ed3f202 100644
@@ -15,7 +15,7 @@
 #ifndef QAPI_VISITOR_H
 #define QAPI_VISITOR_H
 
-#include "qapi-builtin-types.h"
+#include "qapi/qapi-builtin-types.h"
 
 /*
  * The QAPI schema defines both a set of C data types, and a QMP wire
include/qom/object.h +1 -1
index 5b5c016d8f..30db296af4 100644
@@ -14,7 +14,7 @@
 #ifndef QEMU_OBJECT_H
 #define QEMU_OBJECT_H
 
-#include "qapi-builtin-types.h"
+#include "qapi/qapi-builtin-types.h"
 #include "qemu/queue.h"
 
 struct TypeImpl;
monitor.c +3 -3
index df670f3e15..d0e8d350fd 100644
@@ -69,14 +69,14 @@
 #include "exec/exec-all.h"
 #include "qemu/log.h"
 #include "qemu/option.h"
-#include "qmp-commands.h"
 #include "hmp.h"
 #include "qemu/thread.h"
 #include "block/qapi.h"
+#include "qapi/qapi-commands.h"
+#include "qapi/qapi-events.h"
 #include "qapi/error.h"
 #include "qapi/qmp-event.h"
-#include "qapi-event.h"
-#include "qmp-introspect.h"
+#include "qapi/qapi-introspect.h"
 #include "sysemu/qtest.h"
 #include "sysemu/cpus.h"
 #include "qemu/cutils.h"
net/filter-buffer.c +1 -1
index 7c487629f9..f7265c50a8 100644
@@ -13,7 +13,7 @@
 #include "qemu-common.h"
 #include "qemu/timer.h"
 #include "qemu/iov.h"
-#include "qapi-builtin-visit.h"
+#include "qapi/qapi-builtin-visit.h"
 #include "qapi/qmp/qerror.h"
 #include "qom/object.h"
 
qapi/misc.json +2 -2
index 225631bf7d..506f2b9371 100644
@@ -1618,7 +1618,7 @@
 #
 # Emitted when background dump has completed
 #
-# @result: DumpQueryResult type described in qapi-schema.json.
+# @result: final dump status
 #
 # @error: human-readable error string that provides
 #         hint on why dump failed. Only presents on failure. The
@@ -2833,7 +2833,7 @@
 #
 # Emitted when guest executes ACPI _OST method.
 #
-# @info: ACPIOSTInfo type as described in qapi-schema.json
+# @info: OSPM Status Indication
 #
 # Since: 2.1
 #
qapi/qapi-schema.json renamed from qapi-schema.json +16 -16
similarity index 85%
rename from qapi-schema.json
rename to qapi/qapi-schema.json
index 689d06c530..25bce78352 100644
@@ -76,20 +76,20 @@
 # included sub-schemas inserted at the first include directive
 # (subsequent include directives have no effect).  To get a sane and
 # stable order, it's best to include each sub-schema just once, or
-# include it first in qapi-schema.json.
+# include it first right here.
 
-{ 'include': 'qapi/common.json' }
-{ 'include': 'qapi/sockets.json' }
-{ 'include': 'qapi/run-state.json' }
-{ 'include': 'qapi/crypto.json' }
-{ 'include': 'qapi/block.json' }
-{ 'include': 'qapi/char.json' }
-{ 'include': 'qapi/net.json' }
-{ 'include': 'qapi/rocker.json' }
-{ 'include': 'qapi/tpm.json' }
-{ 'include': 'qapi/ui.json' }
-{ 'include': 'qapi/migration.json' }
-{ 'include': 'qapi/transaction.json' }
-{ 'include': 'qapi/trace.json' }
-{ 'include': 'qapi/introspect.json' }
-{ 'include': 'qapi/misc.json' }
+{ 'include': 'common.json' }
+{ 'include': 'sockets.json' }
+{ 'include': 'run-state.json' }
+{ 'include': 'crypto.json' }
+{ 'include': 'block.json' }
+{ 'include': 'char.json' }
+{ 'include': 'net.json' }
+{ 'include': 'rocker.json' }
+{ 'include': 'tpm.json' }
+{ 'include': 'ui.json' }
+{ 'include': 'migration.json' }
+{ 'include': 'transaction.json' }
+{ 'include': 'trace.json' }
+{ 'include': 'introspect.json' }
+{ 'include': 'misc.json' }
qga/Makefile.objs +1 -1
index 6151378ae4..ed08c5917c 100644
@@ -3,6 +3,6 @@ qga-obj-$(CONFIG_POSIX) += commands-posix.o channel-posix.o
 qga-obj-$(CONFIG_WIN32) += commands-win32.o channel-win32.o service-win32.o
 qga-obj-$(CONFIG_WIN32) += vss-win32.o
 qga-obj-y += qapi-generated/qga-qapi-types.o qapi-generated/qga-qapi-visit.o
-qga-obj-y += qapi-generated/qga-qmp-commands.o
+qga-obj-y += qapi-generated/qga-qapi-commands.o
 
 qga-vss-dll-obj-$(CONFIG_QGA_VSS) += vss-win32/
qga/commands-posix.c +1 -1
index 88807f3c78..417a50ce5f 100644
@@ -17,7 +17,7 @@
 #include <sys/wait.h>
 #include <dirent.h>
 #include "qga/guest-agent-core.h"
-#include "qga-qmp-commands.h"
+#include "qga-qapi-commands.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/queue.h"
qga/commands-win32.c +1 -1
index bedae32957..2d48394748 100644
@@ -34,7 +34,7 @@
 
 #include "qga/guest-agent-core.h"
 #include "qga/vss-win32.h"
-#include "qga-qmp-commands.h"
+#include "qga-qapi-commands.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/queue.h"
qga/commands.c +1 -1
index 6d710dbb20..a64b34ccab 100644
@@ -12,7 +12,7 @@
 
 #include "qemu/osdep.h"
 #include "qga/guest-agent-core.h"
-#include "qga-qmp-commands.h"
+#include "qga-qapi-commands.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/base64.h"
qga/main.c +1 -1
index cb434d8c46..f9c83050c5 100644
@@ -25,7 +25,7 @@
 #include "qapi/qmp/qstring.h"
 #include "qga/guest-agent-core.h"
 #include "qemu/module.h"
-#include "qga-qmp-commands.h"
+#include "qga-qapi-commands.h"
 #include "qapi/qmp/qerror.h"
 #include "qapi/error.h"
 #include "qga/channel.h"
qom/object.c +1 -1
index 81b4f7ac48..f70a75c308 100644
@@ -18,7 +18,7 @@
 #include "qapi/visitor.h"
 #include "qapi/string-input-visitor.h"
 #include "qapi/string-output-visitor.h"
-#include "qapi-builtin-visit.h"
+#include "qapi/qapi-builtin-visit.h"
 #include "qapi/qmp/qerror.h"
 #include "trace.h"
 
scripts/qapi/commands.py +0 -7
index 953449171b..21a7e0dbe6 100644
@@ -232,13 +232,6 @@ class QAPISchemaGenCommandVisitor(QAPISchemaModularCVisitor):
         self._regy = ''
         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()
         commands = self._module_basename('qapi-commands', name)
scripts/qapi/events.py +1 -8
index 5ad6708491..3dc523cf39 100644
@@ -157,20 +157,13 @@ class QAPISchemaGenEventVisitor(QAPISchemaModularCVisitor):
         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):
         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-events.h"
 #include "%(visit)s.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qdict.h"
scripts/qapi/introspect.py +2 -2
index f571cc134c..f66c397fb0 100644
@@ -44,7 +44,7 @@ class QAPISchemaGenIntrospectVisitor(QAPISchemaMonolithicCVisitor):
 
     def __init__(self, prefix, unmask):
         QAPISchemaMonolithicCVisitor.__init__(
-            self, prefix, 'qmp-introspect',
+            self, prefix, 'qapi-introspect',
             ' * QAPI/QMP schema introspection', __doc__)
         self._unmask = unmask
         self._schema = None
@@ -53,7 +53,7 @@ class QAPISchemaGenIntrospectVisitor(QAPISchemaMonolithicCVisitor):
         self._name_map = {}
         self._genc.add(mcgen('''
 #include "qemu/osdep.h"
-#include "%(prefix)sqmp-introspect.h"
+#include "%(prefix)sqapi-introspect.h"
 
 ''',
                              prefix=prefix))
scripts/qapi/types.py +3 -3
index 2a3c502cf6..64d9c0fb37 100644
@@ -177,8 +177,8 @@ class QAPISchemaGenTypeVisitor(QAPISchemaModularCVisitor):
         self._genc.preamble_add(mcgen('''
 #include "qemu/osdep.h"
 #include "qapi/dealloc-visitor.h"
-#include "qapi-builtin-types.h"
-#include "qapi-builtin-visit.h"
+#include "qapi/qapi-builtin-types.h"
+#include "qapi/qapi-builtin-visit.h"
 '''))
         self._genh.preamble_add(mcgen('''
 #include "qapi/util.h"
@@ -195,7 +195,7 @@ class QAPISchemaGenTypeVisitor(QAPISchemaModularCVisitor):
 ''',
                                       types=types, visit=visit))
         self._genh.preamble_add(mcgen('''
-#include "qapi-builtin-types.h"
+#include "qapi/qapi-builtin-types.h"
 '''))
 
     def visit_begin(self, schema):
scripts/qapi/visit.py +3 -3
index de09966643..5d72d8936c 100644
@@ -274,11 +274,11 @@ class QAPISchemaGenVisitVisitor(QAPISchemaModularCVisitor):
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "qapi/error.h"
-#include "qapi-builtin-visit.h"
+#include "qapi/qapi-builtin-visit.h"
 '''))
         self._genh.preamble_add(mcgen('''
 #include "qapi/visitor.h"
-#include "qapi-builtin-types.h"
+#include "qapi/qapi-builtin-types.h"
 
 ''',
                                       prefix=prefix))
@@ -295,7 +295,7 @@ class QAPISchemaGenVisitVisitor(QAPISchemaModularCVisitor):
 ''',
                                       visit=visit, prefix=self._prefix))
         self._genh.preamble_add(mcgen('''
-#include "qapi-builtin-visit.h"
+#include "qapi/qapi-builtin-visit.h"
 #include "%(types)s.h"
 
 ''',
tests/.gitignore +3 -3
index 2629cfc2f9..18e58b2183 100644
@@ -60,7 +60,8 @@ test-keyval
 test-logging
 test-mul64
 test-opts-visitor
-test-qapi-event.[ch]
+test-qapi-commands.[ch]
+test-qapi-events.[ch]
 test-qapi-types.[ch]
 test-qapi-util
 test-qapi-visit.[ch]
@@ -71,11 +72,10 @@ test-qga
 test-qht
 test-qht-par
 test-qmp-cmds
-test-qmp-commands.[ch]
 test-qmp-event
 test-qobject-input-strict
 test-qobject-input-visitor
-test-qmp-introspect.[ch]
+test-qapi-introspect.[ch]
 test-qobject-output-visitor
 test-rcu-list
 test-replication
tests/Makefile.include +7 -7
index 9a21ed7ee9..d71adf3996 100644
@@ -566,8 +566,8 @@ qapi-schema += unknown-expr-key.json
 check-qapi-schema-y := $(addprefix tests/qapi-schema/, $(qapi-schema))
 
 GENERATED_FILES += tests/test-qapi-types.h tests/test-qapi-visit.h \
-	tests/test-qmp-commands.h tests/test-qapi-event.h \
-	tests/test-qmp-introspect.h
+	tests/test-qapi-commands.h tests/test-qapi-events.h \
+	tests/test-qapi-introspect.h
 
 test-obj-y = tests/check-qnum.o tests/check-qstring.o tests/check-qdict.o \
 	tests/check-qlist.o tests/check-qnull.o tests/check-qobject.o \
@@ -592,7 +592,7 @@ QEMU_CFLAGS += -I$(SRC_PATH)/tests
 test-util-obj-y = libqemuutil.a
 test-qom-obj-y = $(qom-obj-y) $(test-util-obj-y)
 test-qapi-obj-y = tests/test-qapi-visit.o tests/test-qapi-types.o \
-	tests/test-qapi-event.o tests/test-qmp-introspect.o \
+	tests/test-qapi-events.o tests/test-qapi-introspect.o \
 	$(test-qom-obj-y)
 benchmark-crypto-obj-y = $(crypto-obj-y) $(test-qom-obj-y)
 test-crypto-obj-y = $(crypto-obj-y) $(test-qom-obj-y)
@@ -656,9 +656,9 @@ tests/test-replication$(EXESUF): tests/test-replication.o $(test-util-obj-y) \
 
 tests/test-qapi-types.c tests/test-qapi-types.h \
 tests/test-qapi-visit.c tests/test-qapi-visit.h \
-tests/test-qmp-commands.h tests/test-qmp-commands.c \
-tests/test-qapi-event.c tests/test-qapi-event.h \
-tests/test-qmp-introspect.c tests/test-qmp-introspect.h: \
+tests/test-qapi-commands.h tests/test-qapi-commands.c \
+tests/test-qapi-events.c tests/test-qapi-events.h \
+tests/test-qapi-introspect.c tests/test-qapi-introspect.h: \
 tests/test-qapi-gen-timestamp ;
 tests/test-qapi-gen-timestamp: $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(qapi-py)
 	$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
@@ -679,7 +679,7 @@ tests/test-qmp-event$(EXESUF): tests/test-qmp-event.o $(test-qapi-obj-y)
 tests/test-qobject-output-visitor$(EXESUF): tests/test-qobject-output-visitor.o $(test-qapi-obj-y)
 tests/test-clone-visitor$(EXESUF): tests/test-clone-visitor.o $(test-qapi-obj-y)
 tests/test-qobject-input-visitor$(EXESUF): tests/test-qobject-input-visitor.o $(test-qapi-obj-y)
-tests/test-qmp-cmds$(EXESUF): tests/test-qmp-cmds.o tests/test-qmp-commands.o $(test-qapi-obj-y)
+tests/test-qmp-cmds$(EXESUF): tests/test-qmp-cmds.o tests/test-qapi-commands.o $(test-qapi-obj-y)
 tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(test-qapi-obj-y)
 tests/test-opts-visitor$(EXESUF): tests/test-opts-visitor.o $(test-qapi-obj-y)
 
tests/test-qmp-cmds.c +1 -1
index 24660d0868..5b1cee6912 100644
@@ -3,12 +3,12 @@
 #include "qapi/qmp/qdict.h"
 #include "qapi/qmp/qnum.h"
 #include "qapi/qmp/qstring.h"
-#include "test-qmp-commands.h"
 #include "qapi/error.h"
 #include "qemu/module.h"
 #include "qapi/qobject-input-visitor.h"
 #include "tests/test-qapi-types.h"
 #include "tests/test-qapi-visit.h"
+#include "test-qapi-commands.h"
 
 static QmpCommandList qmp_commands;
 
tests/test-qmp-event.c +1 -1
index 5fbe7e551f..31f35b3e66 100644
@@ -14,13 +14,13 @@
 #include "qemu/osdep.h"
 
 #include "qemu-common.h"
-#include "test-qapi-event.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qbool.h"
 #include "qapi/qmp/qdict.h"
 #include "qapi/qmp/qnum.h"
 #include "qapi/qmp/qstring.h"
 #include "qapi/qmp-event.h"
+#include "test-qapi-events.h"
 
 typedef struct TestEventData {
     QDict *expect;
tests/test-qobject-input-visitor.c +3 -3
index d3a56bd071..79b1a8cb17 100644
@@ -24,8 +24,8 @@
 #include "qapi/qmp/qnum.h"
 #include "qapi/qmp/qstring.h"
 #include "qapi/qmp/qjson.h"
-#include "test-qmp-introspect.h"
-#include "qmp-introspect.h"
+#include "test-qapi-introspect.h"
+#include "qapi/qapi-introspect.h"
 
 typedef struct TestInputVisitorData {
     QObject *obj;
@@ -1376,7 +1376,7 @@ int main(int argc, char **argv)
                            NULL, test_visitor_in_fail_alternate);
     input_visitor_test_add("/visitor/input/fail/union-native-list",
                            NULL, test_visitor_in_fail_union_native_list);
-    input_visitor_test_add("/visitor/input/qmp-introspect",
+    input_visitor_test_add("/visitor/input/qapi-introspect",
                            NULL, test_visitor_in_qmp_introspect);
 
     g_test_run();
tpm.c +0 -1
index 2db03a09b2..ac580e6d47 100644
@@ -182,7 +182,6 @@ int tpm_config_parse(QemuOptsList *opts_list, const char *optarg)
 
 /*
  * Walk the list of active TPM backends and collect information about them
- * following the schema description in qapi-schema.json.
  */
 TPMInfoList *qmp_query_tpm(Error **errp)
 {
ui/cocoa.m +1 -1
index 51db47cd71..de6af6fbb9 100644
@@ -32,7 +32,7 @@
 #include "ui/input.h"
 #include "sysemu/sysemu.h"
 #include "qapi/error.h"
-#include "qmp-commands.h"
+#include "qapi/qapi-commands.h"
 #include "sysemu/blockdev.h"
 #include "qemu-version.h"
 #include <Carbon/Carbon.h>
ui/vnc.c +1 -1
index d6329c8bd5..20cd9bb63d 100644
@@ -35,10 +35,10 @@
 #include "qemu/timer.h"
 #include "qemu/acl.h"
 #include "qemu/config-file.h"
+#include "qapi/qapi-events.h"
 #include "qapi/error.h"
 #include "qapi/qapi-commands-ui.h"
 #include "ui/input.h"
-#include "qapi-event.h"
 #include "crypto/hash.h"
 #include "crypto/tlscredsanon.h"
 #include "crypto/tlscredsx509.h"
Signature · 1 line
2.13.6
Reviewed-by on v2 27/29
#94 lore raw

Re: [Qemu-devel] [PATCH v2 27/29] qapi: Move qapi-schema.json to qapi/, rename generated files

Quoted 8 lines · Markus Armbruster

Move qapi-schema.json to qapi/, so it's next to its modules, and all files get generated to qapi/, not just the ones generated for modules.

Consistently name the generated files qapi-MODULE.EXT:
qmp-commands.[ch] become qapi-commands.[ch], qapi-event.[ch] become qapi-events.[ch], and qmp-introspect.[ch] become qapi-introspect.[ch]. This gets rid of the temporary hacks in scripts/qapi/commands.py and scripts/qapi/events.py.

Ah, so my parallel series that proposed naming the file qapi/qmp-schema.qapi gets interesting, with your patch favoring the qapi- naming everywhere. I'll have to think about how much (or little) of my series to rebase on top of this (I like my notion of renaming to the .qapi suffix, though, as we really are using files that aren't JSON, but only resemble it).

.gitignore line 33

Quoted 13 lines

---

+++ b/.gitignore

.gitignore +2 -2
@@ -29,8 +29,8 @@
  /qga/qapi-generated
  /qapi-generated
  /qapi-gen-timestamp
-/qapi-builtin-types.[ch]
-/qapi-builtin-visit.[ch]
+/qapi/qapi-builtin-types.[ch]
+/qapi/qapi-builtin-visit.[ch]

Might be some interesting churn if you like my idea of using globs for easier maintenance of this file.

tpm.c int tpm_config_parse(QemuOptsList *opts_list, const char *optarg) · line 185

Quoted 7 lines
tpm.c +1 -1
+++ b/tpm.c
@@ -182,7 +182,6 @@ int tpm_config_parse(QemuOptsList *opts_list, const char *optarg)
 
  /*
   * Walk the list of active TPM backends and collect information about them
- * following the schema description in qapi-schema.json.
   */

Should the overall comment keep the trailing '.'?

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#95 lore raw

Re: [Qemu-devel] [PATCH v2 27/29] qapi: Move qapi-schema.json to qapi/, rename generated files

Quoted 34 lines · Eric Blake
Quoted 8 lines · Markus Armbruster

Move qapi-schema.json to qapi/, so it's next to its modules, and all files get generated to qapi/, not just the ones generated for modules.

Consistently name the generated files qapi-MODULE.EXT:
qmp-commands.[ch] become qapi-commands.[ch], qapi-event.[ch] become qapi-events.[ch], and qmp-introspect.[ch] become qapi-introspect.[ch]. This gets rid of the temporary hacks in scripts/qapi/commands.py and scripts/qapi/events.py.

Ah, so my parallel series that proposed naming the file qapi/qmp-schema.qapi gets interesting, with your patch favoring the qapi- naming everywhere. I'll have to think about how much (or little) of my series to rebase on top of this (I like my notion of renaming to the .qapi suffix, though, as we really are using files that aren't JSON, but only resemble it).

.gitignore line 33

Quoted 13 lines

---

+++ b/.gitignore

.gitignore +2 -2
@@ -29,8 +29,8 @@
  /qga/qapi-generated
  /qapi-generated
  /qapi-gen-timestamp
-/qapi-builtin-types.[ch]
-/qapi-builtin-visit.[ch]
+/qapi/qapi-builtin-types.[ch]
+/qapi/qapi-builtin-visit.[ch]

Might be some interesting churn if you like my idea of using globs for easier maintenance of this file.

Quoted 8 lines

tpm.c int tpm_config_parse(QemuOptsList *opts_list, const char *optarg) · line 184

Quoted 6 lines
tpm.c +1 -1
+++ b/tpm.c
@@ -182,7 +182,6 @@ int tpm_config_parse(QemuOptsList *opts_list, const char *optarg)
    /*
   * Walk the list of active TPM backends and collect information about them
- * following the schema description in qapi-schema.json.
   */

Should the overall comment keep the trailing '.'?

I'm fine either way.

Quoted 1 line

Thanks!

Reviewed-by Marc-André Lureau on v2 27/29
#96 lore raw

Re: [Qemu-devel] [PATCH v2 27/29] qapi: Move qapi-schema.json to qapi/, rename generated files

In reply to Markus Armbruster
Quoted 10 lines · Markus Armbruster

Move qapi-schema.json to qapi/, so it's next to its modules, and all files get generated to qapi/, not just the ones generated for modules.

Consistently name the generated files qapi-MODULE.EXT:
qmp-commands.[ch] become qapi-commands.[ch], qapi-event.[ch] become qapi-events.[ch], and qmp-introspect.[ch] become qapi-introspect.[ch]. This gets rid of the temporary hacks in scripts/qapi/commands.py and scripts/qapi/events.py.

Quoted 971 lines
---
 .gitignore                                | 16 ++++++------
 Makefile                                  | 42 +++++++++++++++----------------
 Makefile.objs                             | 21 ++++++++--------
 backends/hostmem.c                        |  2 +-
 docs/devel/qapi-code-gen.txt              | 30 +++++++++++-----------
 docs/devel/writing-qmp-commands.txt       |  2 +-
 docs/interop/qmp-intro.txt                |  2 +-
 hmp.c                                     |  2 +-
 include/qapi/qmp/qobject.h                |  2 +-
 include/qapi/visitor.h                    |  2 +-
 include/qom/object.h                      |  2 +-
 monitor.c                                 |  6 ++---
 net/filter-buffer.c                       |  2 +-
 qapi/misc.json                            |  4 +--
 qapi-schema.json => qapi/qapi-schema.json | 32 +++++++++++------------
 qga/Makefile.objs                         |  2 +-
 qga/commands-posix.c                      |  2 +-
 qga/commands-win32.c                      |  2 +-
 qga/commands.c                            |  2 +-
 qga/main.c                                |  2 +-
 qom/object.c                              |  2 +-
 scripts/qapi/commands.py                  |  7 ------
 scripts/qapi/events.py                    |  9 +------
 scripts/qapi/introspect.py                |  4 +--
 scripts/qapi/types.py                     |  6 ++---
 scripts/qapi/visit.py                     |  6 ++---
 tests/.gitignore                          |  6 ++---
 tests/Makefile.include                    | 14 +++++------
 tests/test-qmp-cmds.c                     |  2 +-
 tests/test-qmp-event.c                    |  2 +-
 tests/test-qobject-input-visitor.c        |  6 ++---
 tpm.c                                     |  1 -
 ui/cocoa.m                                |  2 +-
 ui/vnc.c                                  |  2 +-
 34 files changed, 116 insertions(+), 130 deletions(-)
 rename qapi-schema.json => qapi/qapi-schema.json (85%)
.gitignore +8 -8
index 7f162e862f..dabfe6bea8 100644
@@ -29,8 +29,8 @@
 /qga/qapi-generated
 /qapi-generated
 /qapi-gen-timestamp
-/qapi-builtin-types.[ch]
-/qapi-builtin-visit.[ch]
+/qapi/qapi-builtin-types.[ch]
+/qapi/qapi-builtin-visit.[ch]
 /qapi/qapi-commands-block-core.[ch]
 /qapi/qapi-commands-block.[ch]
 /qapi/qapi-commands-char.[ch]
@@ -47,6 +47,7 @@
 /qapi/qapi-commands-trace.[ch]
 /qapi/qapi-commands-transaction.[ch]
 /qapi/qapi-commands-ui.[ch]
+/qapi/qapi-commands.[ch]
 /qapi/qapi-events-block-core.[ch]
 /qapi/qapi-events-block.[ch]
 /qapi/qapi-events-char.[ch]
@@ -63,6 +64,8 @@
 /qapi/qapi-events-trace.[ch]
 /qapi/qapi-events-transaction.[ch]
 /qapi/qapi-events-ui.[ch]
+/qapi/qapi-events.[ch]
+/qapi/qapi-introspect.[ch]
 /qapi/qapi-types-block-core.[ch]
 /qapi/qapi-types-block.[ch]
 /qapi/qapi-types-char.[ch]
@@ -79,7 +82,7 @@
 /qapi/qapi-types-trace.[ch]
 /qapi/qapi-types-transaction.[ch]
 /qapi/qapi-types-ui.[ch]
-/qapi-types.[ch]
+/qapi/qapi-types.[ch]
 /qapi/qapi-visit-block-core.[ch]
 /qapi/qapi-visit-block.[ch]
 /qapi/qapi-visit-char.[ch]
@@ -96,11 +99,8 @@
 /qapi/qapi-visit-trace.[ch]
 /qapi/qapi-visit-transaction.[ch]
 /qapi/qapi-visit-ui.[ch]
-/qapi-visit.[ch]
-/qapi-event.[ch]
-/qapi-doc.texi
-/qmp-commands.[ch]
-/qmp-introspect.[ch]
+/qapi/qapi-visit.[ch]
+/qapi/qapi-doc.texi
 /qemu-doc.html
 /qemu-doc.info
 /qemu-doc.txt
Makefile +21 -21
index 50eb194877..84411ee6ab 100644
@@ -90,8 +90,8 @@ endif
 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-builtin-types.h qapi/qapi-builtin-types.c
+GENERATED_FILES += qapi/qapi-types.h qapi/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
@@ -108,8 +108,8 @@ 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-builtin-visit.h qapi/qapi-builtin-visit.c
+GENERATED_FILES += qapi/qapi-visit.h qapi/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
@@ -126,7 +126,7 @@ 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.h qapi/qapi-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
@@ -143,7 +143,7 @@ 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.h qapi/qapi-events.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
@@ -160,8 +160,8 @@ 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
+GENERATED_FILES += qapi/qapi-introspect.c qapi/qapi-introspect.h
+GENERATED_FILES += qapi/qapi-doc.texi
 
 GENERATED_FILES += trace/generated-tcg-tracers.h
 
@@ -563,7 +563,7 @@ $(SRC_PATH)/scripts/qapi-gen.py
 
 qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h \
 qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h \
-qga/qapi-generated/qga-qmp-commands.h qga/qapi-generated/qga-qmp-commands.c \
+qga/qapi-generated/qga-qapi-commands.h qga/qapi-generated/qga-qapi-commands.c \
 qga/qapi-generated/qga-qapi-doc.texi: \
 qga/qapi-generated/qapi-gen-timestamp ;
 qga/qapi-generated/qapi-gen-timestamp: $(SRC_PATH)/qga/qapi-schema.json $(qapi-py)
@@ -572,7 +572,7 @@ qga/qapi-generated/qapi-gen-timestamp: $(SRC_PATH)/qga/qapi-schema.json $(qapi-p
                "GEN","$(@:%-timestamp=%)")
        @>$@
 
-qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json \
+qapi-modules = $(SRC_PATH)/qapi/qapi-schema.json $(SRC_PATH)/qapi/common.json \
                $(SRC_PATH)/qapi/block.json $(SRC_PATH)/qapi/block-core.json \
                $(SRC_PATH)/qapi/char.json \
                $(SRC_PATH)/qapi/crypto.json \
@@ -588,8 +588,8 @@ qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json \
                $(SRC_PATH)/qapi/transaction.json \
                $(SRC_PATH)/qapi/ui.json
 
-qapi-builtin-types.c qapi-builtin-types.h \
-qapi-types.c qapi-types.h \
+qapi/qapi-builtin-types.c qapi/qapi-builtin-types.h \
+qapi/qapi-types.c qapi/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 \
@@ -606,8 +606,8 @@ 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-builtin-visit.c qapi/qapi-builtin-visit.h \
+qapi/qapi-visit.c qapi/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 \
@@ -624,7 +624,7 @@ 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.h qapi/qapi-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 \
@@ -641,7 +641,7 @@ 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.c qapi/qapi-events.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 \
@@ -658,16 +658,16 @@ 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/qapi-introspect.h qapi/qapi-introspect.c \
+qapi/qapi-doc.texi: \
 qapi-gen-timestamp ;
 qapi-gen-timestamp: $(qapi-modules) $(qapi-py)
        $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-gen.py \
-               -o "." -b $<, \
+               -o "qapi" -b $<, \
                "GEN","$(@:%-timestamp=%)")
        @>$@
 
-QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h)
+QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qapi-commands.h)
 $(qga-obj-y): $(QGALIB_GEN)
 
 qemu-ga$(EXESUF): $(qga-obj-y) $(COMMON_LDADDS)
@@ -934,7 +934,7 @@ qemu-monitor-info.texi: $(SRC_PATH)/hmp-commands-info.hx $(SRC_PATH)/scripts/hxt
 qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
        $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
 
-docs/interop/qemu-qmp-qapi.texi: qapi-doc.texi
+docs/interop/qemu-qmp-qapi.texi: qapi/qapi-doc.texi
        @cp -p $< $@
 
 docs/interop/qemu-ga-qapi.texi: qga/qapi-generated/qga-qapi-doc.texi
Makefile.objs +11 -10
index a7986bbf0b..9aa1024c34 100644
@@ -2,8 +2,8 @@
 # Common libraries for tools and emulators
 stub-obj-y = stubs/ crypto/
 util-obj-y = util/ qobject/ qapi/
-util-obj-y += qapi-builtin-types.o
-util-obj-y += qapi-types.o
+util-obj-y += qapi/qapi-builtin-types.o
+util-obj-y += qapi/qapi-types.o
 util-obj-y += qapi/qapi-types-block-core.o
 util-obj-y += qapi/qapi-types-block.o
 util-obj-y += qapi/qapi-types-char.o
@@ -20,8 +20,8 @@ util-obj-y += qapi/qapi-types-tpm.o
 util-obj-y += qapi/qapi-types-trace.o
 util-obj-y += qapi/qapi-types-transaction.o
 util-obj-y += qapi/qapi-types-ui.o
-util-obj-y += qapi-builtin-visit.o
-util-obj-y += qapi-visit.o
+util-obj-y += qapi/qapi-builtin-visit.o
+util-obj-y += qapi/qapi-visit.o
 util-obj-y += qapi/qapi-visit-block-core.o
 util-obj-y += qapi/qapi-visit-block.o
 util-obj-y += qapi/qapi-visit-char.o
@@ -38,7 +38,7 @@ util-obj-y += qapi/qapi-visit-tpm.o
 util-obj-y += qapi/qapi-visit-trace.o
 util-obj-y += qapi/qapi-visit-transaction.o
 util-obj-y += qapi/qapi-visit-ui.o
-util-obj-y += qapi-event.o
+util-obj-y += qapi/qapi-events.o
 util-obj-y += qapi/qapi-events-block-core.o
 util-obj-y += qapi/qapi-events-block.o
 util-obj-y += qapi/qapi-events-char.o
@@ -55,7 +55,7 @@ util-obj-y += qapi/qapi-events-tpm.o
 util-obj-y += qapi/qapi-events-trace.o
 util-obj-y += qapi/qapi-events-transaction.o
 util-obj-y += qapi/qapi-events-ui.o
-util-obj-y += qmp-introspect.o
+util-obj-y += qapi/qapi-introspect.o
 
 chardev-obj-y = chardev/
 
@@ -131,7 +131,7 @@ common-obj-$(CONFIG_FDT) += device_tree.o
 ######################################################################
 # qapi
 
-common-obj-y += qmp-commands.o
+common-obj-y += qapi/qapi-commands.o
 common-obj-y += qapi/qapi-commands-block-core.o
 common-obj-y += qapi/qapi-commands-block.o
 common-obj-y += qapi/qapi-commands-char.o
@@ -148,7 +148,7 @@ common-obj-y += qapi/qapi-commands-tpm.o
 common-obj-y += qapi/qapi-commands-trace.o
 common-obj-y += qapi/qapi-commands-transaction.o
 common-obj-y += qapi/qapi-commands-ui.o
-common-obj-y += qmp-introspect.o
+common-obj-y += qapi/qapi-introspect.o
 common-obj-y += qmp.o hmp.o
 endif
 
@@ -171,8 +171,9 @@ target-obj-y += trace/
 ######################################################################
 # guest agent
 
-# FIXME: a few definitions from qapi-types.o/qapi-visit.o are needed
-# by libqemuutil.a.  These should be moved to a separate .json schema.
+# FIXME: a few definitions from qapi/qapi-types.o and
+# qapi/qapi-visit.o are needed by libqemuutil.a.  These should be
+# extracted into a QAPI schema module, or perhaps a separate schema.
 qga-obj-y = qga/
 qga-vss-dll-obj-y = qga/
 
backends/hostmem.c +1 -1
index 0afaf7160a..1292a9da1e 100644
@@ -14,7 +14,7 @@
 #include "sysemu/hostmem.h"
 #include "hw/boards.h"
 #include "qapi/error.h"
-#include "qapi-builtin-visit.h"
+#include "qapi/qapi-builtin-visit.h"
 #include "qapi/visitor.h"
 #include "qemu/config-file.h"
 #include "qom/object_interfaces.h"
docs/devel/qapi-code-gen.txt +15 -15
index ba1dc73298..0c4fc342fe 100644
@@ -647,7 +647,7 @@ name an event 'MAX', since the generator also produces a C enumeration
 of all event names with a generated _MAX value at the end.  When
 'data' is also specified, additional info will be included in the
 event, with similar semantics to a 'struct' expression.  Finally there
-will be C API generated in qapi-event.h; when called by QEMU code, a
+will be C API generated in qapi-events.h; when called by QEMU code, a
 message with timestamp will be emitted on the wire.
 
 An example event is:
@@ -1147,15 +1147,15 @@ declares qmp_COMMAND() that the user must implement.
 
 The following files are generated:
 
-$(prefix)qmp-commands.c: Command marshal/dispatch functions for each
-                         QMP command defined in the schema
+$(prefix)qapi-commands.c: Command marshal/dispatch functions for each
+                          QMP command defined in the schema
 
-$(prefix)qmp-commands.h: Function prototypes for the QMP commands
-                         specified in the schema
+$(prefix)qapi-commands.h: Function prototypes for the QMP commands
+                          specified in the schema
 
 Example:
 
-    $ cat qapi-generated/example-qmp-commands.h
+    $ cat qapi-generated/example-qapi-commands.h
 [Uninteresting stuff omitted...]
 
     #ifndef EXAMPLE_QMP_COMMANDS_H
@@ -1170,7 +1170,7 @@ Example:
     void qmp_marshal_my_command(QDict *args, QObject **ret, Error **errp);
 
     #endif
-    $ cat qapi-generated/example-qmp-commands.c
+    $ cat qapi-generated/example-qapi-commands.c
 [Uninteresting stuff omitted...]
 
     static void qmp_marshal_output_UserDefOne(UserDefOne *ret_in, QObject **ret_out, Error **errp)
@@ -1243,14 +1243,14 @@ qapi_event_send_EVENT().
 
 The following files are created:
 
-$(prefix)qapi-event.h - Function prototypes for each event type, plus an
+$(prefix)qapi-events.h - Function prototypes for each event type, plus an
                         enumeration of all event names
 
-$(prefix)qapi-event.c - Implementation of functions to send an event
+$(prefix)qapi-events.c - Implementation of functions to send an event
 
 Example:
 
-    $ cat qapi-generated/example-qapi-event.h
+    $ cat qapi-generated/example-qapi-events.h
 [Uninteresting stuff omitted...]
 
     #ifndef EXAMPLE_QAPI_EVENT_H
@@ -1273,7 +1273,7 @@ Example:
     extern const char *const example_QAPIEvent_lookup[];
 
     #endif
-    $ cat qapi-generated/example-qapi-event.c
+    $ cat qapi-generated/example-qapi-events.c
 [Uninteresting stuff omitted...]
 
     void qapi_event_send_my_event(Error **errp)
@@ -1305,14 +1305,14 @@ Example:
 
 The following files are created:
 
-$(prefix)qmp-introspect.c - Defines a string holding a JSON
+$(prefix)qapi-introspect.c - Defines a string holding a JSON
                             description of the schema
 
-$(prefix)qmp-introspect.h - Declares the above string
+$(prefix)qapi-introspect.h - Declares the above string
 
 Example:
 
-    $ cat qapi-generated/example-qmp-introspect.h
+    $ cat qapi-generated/example-qapi-introspect.h
 [Uninteresting stuff omitted...]
 
     #ifndef EXAMPLE_QMP_INTROSPECT_H
@@ -1321,7 +1321,7 @@ Example:
     extern const char example_qmp_schema_json[];
 
     #endif
-    $ cat qapi-generated/example-qmp-introspect.c
+    $ cat qapi-generated/example-qapi-introspect.c
 [Uninteresting stuff omitted...]
 
     const char example_qmp_schema_json[] = "["
docs/devel/writing-qmp-commands.txt +1 -1
index 50385eff27..9dfc62bf5a 100644
@@ -419,7 +419,7 @@ There are a number of things to be noticed:
    allocated by the implementation. This is so because the QAPI also generates
    a function to free its types and it cannot distinguish between dynamically
    or statically allocated strings
-6. You have to include "qapi/qmp-commands-misc.h" in qemu-timer.c
+6. You have to include "qapi/qapi-commands-misc.h" in qemu-timer.c
 
 Time to test the new command. Build qemu, run it as described in the "Testing"
 section and try this:
docs/interop/qmp-intro.txt +1 -1
index 430fe1b747..900d69d612 100644
@@ -79,7 +79,7 @@ Escape character is '^]'.
 }
 
 Please refer to docs/interop/qemu-qmp-ref.* for a complete command
-reference, generated from qapi-schema.json.
+reference, generated from qapi/qapi-schema.json.
 
 QMP wiki page
 -------------
hmp.c +1 -1
index c86946866b..1f31de3217 100644
@@ -28,7 +28,7 @@
 #include "monitor/qdev.h"
 #include "qapi/error.h"
 #include "qapi/opts-visitor.h"
-#include "qapi-builtin-visit.h"
+#include "qapi/qapi-builtin-visit.h"
 #include "qapi/qapi-commands-block.h"
 #include "qapi/qapi-commands-char.h"
 #include "qapi/qapi-commands-migration.h"
include/qapi/qmp/qobject.h +1 -1
index a2964fbf25..012439a2e3 100644
@@ -32,7 +32,7 @@
 #ifndef QOBJECT_H
 #define QOBJECT_H
 
-#include "qapi-builtin-types.h"
+#include "qapi/qapi-builtin-types.h"
 
 struct QObject {
     QType type;
include/qapi/visitor.h +1 -1
index 9e57508446..5b2ed3f202 100644
@@ -15,7 +15,7 @@
 #ifndef QAPI_VISITOR_H
 #define QAPI_VISITOR_H
 
-#include "qapi-builtin-types.h"
+#include "qapi/qapi-builtin-types.h"
 
 /*
  * The QAPI schema defines both a set of C data types, and a QMP wire
include/qom/object.h +1 -1
index 5b5c016d8f..30db296af4 100644
@@ -14,7 +14,7 @@
 #ifndef QEMU_OBJECT_H
 #define QEMU_OBJECT_H
 
-#include "qapi-builtin-types.h"
+#include "qapi/qapi-builtin-types.h"
 #include "qemu/queue.h"
 
 struct TypeImpl;
monitor.c +3 -3
index df670f3e15..d0e8d350fd 100644
@@ -69,14 +69,14 @@
 #include "exec/exec-all.h"
 #include "qemu/log.h"
 #include "qemu/option.h"
-#include "qmp-commands.h"
 #include "hmp.h"
 #include "qemu/thread.h"
 #include "block/qapi.h"
+#include "qapi/qapi-commands.h"
+#include "qapi/qapi-events.h"
 #include "qapi/error.h"
 #include "qapi/qmp-event.h"
-#include "qapi-event.h"
-#include "qmp-introspect.h"
+#include "qapi/qapi-introspect.h"
 #include "sysemu/qtest.h"
 #include "sysemu/cpus.h"
 #include "qemu/cutils.h"
net/filter-buffer.c +1 -1
index 7c487629f9..f7265c50a8 100644
@@ -13,7 +13,7 @@
 #include "qemu-common.h"
 #include "qemu/timer.h"
 #include "qemu/iov.h"
-#include "qapi-builtin-visit.h"
+#include "qapi/qapi-builtin-visit.h"
 #include "qapi/qmp/qerror.h"
 #include "qom/object.h"
 
qapi/misc.json +2 -2
index 225631bf7d..506f2b9371 100644
@@ -1618,7 +1618,7 @@
 #
 # Emitted when background dump has completed
 #
-# @result: DumpQueryResult type described in qapi-schema.json.
+# @result: final dump status
 #
 # @error: human-readable error string that provides
 #         hint on why dump failed. Only presents on failure. The
@@ -2833,7 +2833,7 @@
 #
 # Emitted when guest executes ACPI _OST method.
 #
-# @info: ACPIOSTInfo type as described in qapi-schema.json
+# @info: OSPM Status Indication
 #
 # Since: 2.1
 #
qapi/qapi-schema.json renamed from qapi-schema.json +16 -16
similarity index 85%
rename from qapi-schema.json
rename to qapi/qapi-schema.json
index 689d06c530..25bce78352 100644
@@ -76,20 +76,20 @@
 # included sub-schemas inserted at the first include directive
 # (subsequent include directives have no effect).  To get a sane and
 # stable order, it's best to include each sub-schema just once, or
-# include it first in qapi-schema.json.
+# include it first right here.
 
-{ 'include': 'qapi/common.json' }
-{ 'include': 'qapi/sockets.json' }
-{ 'include': 'qapi/run-state.json' }
-{ 'include': 'qapi/crypto.json' }
-{ 'include': 'qapi/block.json' }
-{ 'include': 'qapi/char.json' }
-{ 'include': 'qapi/net.json' }
-{ 'include': 'qapi/rocker.json' }
-{ 'include': 'qapi/tpm.json' }
-{ 'include': 'qapi/ui.json' }
-{ 'include': 'qapi/migration.json' }
-{ 'include': 'qapi/transaction.json' }
-{ 'include': 'qapi/trace.json' }
-{ 'include': 'qapi/introspect.json' }
-{ 'include': 'qapi/misc.json' }
+{ 'include': 'common.json' }
+{ 'include': 'sockets.json' }
+{ 'include': 'run-state.json' }
+{ 'include': 'crypto.json' }
+{ 'include': 'block.json' }
+{ 'include': 'char.json' }
+{ 'include': 'net.json' }
+{ 'include': 'rocker.json' }
+{ 'include': 'tpm.json' }
+{ 'include': 'ui.json' }
+{ 'include': 'migration.json' }
+{ 'include': 'transaction.json' }
+{ 'include': 'trace.json' }
+{ 'include': 'introspect.json' }
+{ 'include': 'misc.json' }
qga/Makefile.objs +1 -1
index 6151378ae4..ed08c5917c 100644
@@ -3,6 +3,6 @@ qga-obj-$(CONFIG_POSIX) += commands-posix.o channel-posix.o
 qga-obj-$(CONFIG_WIN32) += commands-win32.o channel-win32.o service-win32.o
 qga-obj-$(CONFIG_WIN32) += vss-win32.o
 qga-obj-y += qapi-generated/qga-qapi-types.o qapi-generated/qga-qapi-visit.o
-qga-obj-y += qapi-generated/qga-qmp-commands.o
+qga-obj-y += qapi-generated/qga-qapi-commands.o
 
 qga-vss-dll-obj-$(CONFIG_QGA_VSS) += vss-win32/
qga/commands-posix.c +1 -1
index 88807f3c78..417a50ce5f 100644
@@ -17,7 +17,7 @@
 #include <sys/wait.h>
 #include <dirent.h>
 #include "qga/guest-agent-core.h"
-#include "qga-qmp-commands.h"
+#include "qga-qapi-commands.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/queue.h"
qga/commands-win32.c +1 -1
index bedae32957..2d48394748 100644
@@ -34,7 +34,7 @@
 
 #include "qga/guest-agent-core.h"
 #include "qga/vss-win32.h"
-#include "qga-qmp-commands.h"
+#include "qga-qapi-commands.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/queue.h"
qga/commands.c +1 -1
index 6d710dbb20..a64b34ccab 100644
@@ -12,7 +12,7 @@
 
 #include "qemu/osdep.h"
 #include "qga/guest-agent-core.h"
-#include "qga-qmp-commands.h"
+#include "qga-qapi-commands.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/base64.h"
qga/main.c +1 -1
index cb434d8c46..f9c83050c5 100644
@@ -25,7 +25,7 @@
 #include "qapi/qmp/qstring.h"
 #include "qga/guest-agent-core.h"
 #include "qemu/module.h"
-#include "qga-qmp-commands.h"
+#include "qga-qapi-commands.h"
 #include "qapi/qmp/qerror.h"
 #include "qapi/error.h"
 #include "qga/channel.h"
qom/object.c +1 -1
index 81b4f7ac48..f70a75c308 100644
@@ -18,7 +18,7 @@
 #include "qapi/visitor.h"
 #include "qapi/string-input-visitor.h"
 #include "qapi/string-output-visitor.h"
-#include "qapi-builtin-visit.h"
+#include "qapi/qapi-builtin-visit.h"
 #include "qapi/qmp/qerror.h"
 #include "trace.h"
 
scripts/qapi/commands.py +0 -7
index 953449171b..21a7e0dbe6 100644
@@ -232,13 +232,6 @@ class QAPISchemaGenCommandVisitor(QAPISchemaModularCVisitor):
         self._regy = ''
         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()
         commands = self._module_basename('qapi-commands', name)
scripts/qapi/events.py +1 -8
index 5ad6708491..3dc523cf39 100644
@@ -157,20 +157,13 @@ class QAPISchemaGenEventVisitor(QAPISchemaModularCVisitor):
         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):
         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-events.h"
 #include "%(visit)s.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qdict.h"
scripts/qapi/introspect.py +2 -2
index f571cc134c..f66c397fb0 100644
@@ -44,7 +44,7 @@ class QAPISchemaGenIntrospectVisitor(QAPISchemaMonolithicCVisitor):
 
     def __init__(self, prefix, unmask):
         QAPISchemaMonolithicCVisitor.__init__(
-            self, prefix, 'qmp-introspect',
+            self, prefix, 'qapi-introspect',
             ' * QAPI/QMP schema introspection', __doc__)
         self._unmask = unmask
         self._schema = None
@@ -53,7 +53,7 @@ class QAPISchemaGenIntrospectVisitor(QAPISchemaMonolithicCVisitor):
         self._name_map = {}
         self._genc.add(mcgen('''
 #include "qemu/osdep.h"
-#include "%(prefix)sqmp-introspect.h"
+#include "%(prefix)sqapi-introspect.h"
 
 ''',
                              prefix=prefix))
scripts/qapi/types.py +3 -3
index 2a3c502cf6..64d9c0fb37 100644
@@ -177,8 +177,8 @@ class QAPISchemaGenTypeVisitor(QAPISchemaModularCVisitor):
         self._genc.preamble_add(mcgen('''
 #include "qemu/osdep.h"
 #include "qapi/dealloc-visitor.h"
-#include "qapi-builtin-types.h"
-#include "qapi-builtin-visit.h"
+#include "qapi/qapi-builtin-types.h"
+#include "qapi/qapi-builtin-visit.h"
 '''))
         self._genh.preamble_add(mcgen('''
 #include "qapi/util.h"
@@ -195,7 +195,7 @@ class QAPISchemaGenTypeVisitor(QAPISchemaModularCVisitor):
 ''',
                                       types=types, visit=visit))
         self._genh.preamble_add(mcgen('''
-#include "qapi-builtin-types.h"
+#include "qapi/qapi-builtin-types.h"
 '''))
 
     def visit_begin(self, schema):
scripts/qapi/visit.py +3 -3
index de09966643..5d72d8936c 100644
@@ -274,11 +274,11 @@ class QAPISchemaGenVisitVisitor(QAPISchemaModularCVisitor):
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "qapi/error.h"
-#include "qapi-builtin-visit.h"
+#include "qapi/qapi-builtin-visit.h"
 '''))
         self._genh.preamble_add(mcgen('''
 #include "qapi/visitor.h"
-#include "qapi-builtin-types.h"
+#include "qapi/qapi-builtin-types.h"
 
 ''',
                                       prefix=prefix))
@@ -295,7 +295,7 @@ class QAPISchemaGenVisitVisitor(QAPISchemaModularCVisitor):
 ''',
                                       visit=visit, prefix=self._prefix))
         self._genh.preamble_add(mcgen('''
-#include "qapi-builtin-visit.h"
+#include "qapi/qapi-builtin-visit.h"
 #include "%(types)s.h"
 
 ''',
tests/.gitignore +3 -3
index 2629cfc2f9..18e58b2183 100644
@@ -60,7 +60,8 @@ test-keyval
 test-logging
 test-mul64
 test-opts-visitor
-test-qapi-event.[ch]
+test-qapi-commands.[ch]
+test-qapi-events.[ch]
 test-qapi-types.[ch]
 test-qapi-util
 test-qapi-visit.[ch]
@@ -71,11 +72,10 @@ test-qga
 test-qht
 test-qht-par
 test-qmp-cmds
-test-qmp-commands.[ch]
 test-qmp-event
 test-qobject-input-strict
 test-qobject-input-visitor
-test-qmp-introspect.[ch]
+test-qapi-introspect.[ch]
 test-qobject-output-visitor
 test-rcu-list
 test-replication
tests/Makefile.include +7 -7
index 9a21ed7ee9..d71adf3996 100644
@@ -566,8 +566,8 @@ qapi-schema += unknown-expr-key.json
 check-qapi-schema-y := $(addprefix tests/qapi-schema/, $(qapi-schema))
 
 GENERATED_FILES += tests/test-qapi-types.h tests/test-qapi-visit.h \
-       tests/test-qmp-commands.h tests/test-qapi-event.h \
-       tests/test-qmp-introspect.h
+       tests/test-qapi-commands.h tests/test-qapi-events.h \
+       tests/test-qapi-introspect.h
 
 test-obj-y = tests/check-qnum.o tests/check-qstring.o tests/check-qdict.o \
        tests/check-qlist.o tests/check-qnull.o tests/check-qobject.o \
@@ -592,7 +592,7 @@ QEMU_CFLAGS += -I$(SRC_PATH)/tests
 test-util-obj-y = libqemuutil.a
 test-qom-obj-y = $(qom-obj-y) $(test-util-obj-y)
 test-qapi-obj-y = tests/test-qapi-visit.o tests/test-qapi-types.o \
-       tests/test-qapi-event.o tests/test-qmp-introspect.o \
+       tests/test-qapi-events.o tests/test-qapi-introspect.o \
        $(test-qom-obj-y)
 benchmark-crypto-obj-y = $(crypto-obj-y) $(test-qom-obj-y)
 test-crypto-obj-y = $(crypto-obj-y) $(test-qom-obj-y)
@@ -656,9 +656,9 @@ tests/test-replication$(EXESUF): tests/test-replication.o $(test-util-obj-y) \
 
 tests/test-qapi-types.c tests/test-qapi-types.h \
 tests/test-qapi-visit.c tests/test-qapi-visit.h \
-tests/test-qmp-commands.h tests/test-qmp-commands.c \
-tests/test-qapi-event.c tests/test-qapi-event.h \
-tests/test-qmp-introspect.c tests/test-qmp-introspect.h: \
+tests/test-qapi-commands.h tests/test-qapi-commands.c \
+tests/test-qapi-events.c tests/test-qapi-events.h \
+tests/test-qapi-introspect.c tests/test-qapi-introspect.h: \
 tests/test-qapi-gen-timestamp ;
 tests/test-qapi-gen-timestamp: $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(qapi-py)
        $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
@@ -679,7 +679,7 @@ tests/test-qmp-event$(EXESUF): tests/test-qmp-event.o $(test-qapi-obj-y)
 tests/test-qobject-output-visitor$(EXESUF): tests/test-qobject-output-visitor.o $(test-qapi-obj-y)
 tests/test-clone-visitor$(EXESUF): tests/test-clone-visitor.o $(test-qapi-obj-y)
 tests/test-qobject-input-visitor$(EXESUF): tests/test-qobject-input-visitor.o $(test-qapi-obj-y)
-tests/test-qmp-cmds$(EXESUF): tests/test-qmp-cmds.o tests/test-qmp-commands.o $(test-qapi-obj-y)
+tests/test-qmp-cmds$(EXESUF): tests/test-qmp-cmds.o tests/test-qapi-commands.o $(test-qapi-obj-y)
 tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(test-qapi-obj-y)
 tests/test-opts-visitor$(EXESUF): tests/test-opts-visitor.o $(test-qapi-obj-y)
 
tests/test-qmp-cmds.c +1 -1
index 24660d0868..5b1cee6912 100644
@@ -3,12 +3,12 @@
 #include "qapi/qmp/qdict.h"
 #include "qapi/qmp/qnum.h"
 #include "qapi/qmp/qstring.h"
-#include "test-qmp-commands.h"
 #include "qapi/error.h"
 #include "qemu/module.h"
 #include "qapi/qobject-input-visitor.h"
 #include "tests/test-qapi-types.h"
 #include "tests/test-qapi-visit.h"
+#include "test-qapi-commands.h"
 
 static QmpCommandList qmp_commands;
 
tests/test-qmp-event.c +1 -1
index 5fbe7e551f..31f35b3e66 100644
@@ -14,13 +14,13 @@
 #include "qemu/osdep.h"
 
 #include "qemu-common.h"
-#include "test-qapi-event.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qbool.h"
 #include "qapi/qmp/qdict.h"
 #include "qapi/qmp/qnum.h"
 #include "qapi/qmp/qstring.h"
 #include "qapi/qmp-event.h"
+#include "test-qapi-events.h"
 
 typedef struct TestEventData {
     QDict *expect;
tests/test-qobject-input-visitor.c +3 -3
index d3a56bd071..79b1a8cb17 100644
@@ -24,8 +24,8 @@
 #include "qapi/qmp/qnum.h"
 #include "qapi/qmp/qstring.h"
 #include "qapi/qmp/qjson.h"
-#include "test-qmp-introspect.h"
-#include "qmp-introspect.h"
+#include "test-qapi-introspect.h"
+#include "qapi/qapi-introspect.h"
 
 typedef struct TestInputVisitorData {
     QObject *obj;
@@ -1376,7 +1376,7 @@ int main(int argc, char **argv)
                            NULL, test_visitor_in_fail_alternate);
     input_visitor_test_add("/visitor/input/fail/union-native-list",
                            NULL, test_visitor_in_fail_union_native_list);
-    input_visitor_test_add("/visitor/input/qmp-introspect",
+    input_visitor_test_add("/visitor/input/qapi-introspect",
                            NULL, test_visitor_in_qmp_introspect);
 
     g_test_run();
tpm.c +0 -1
index 2db03a09b2..ac580e6d47 100644
@@ -182,7 +182,6 @@ int tpm_config_parse(QemuOptsList *opts_list, const char *optarg)
 
 /*
  * Walk the list of active TPM backends and collect information about them
- * following the schema description in qapi-schema.json.
  */
 TPMInfoList *qmp_query_tpm(Error **errp)
 {
ui/cocoa.m +1 -1
index 51db47cd71..de6af6fbb9 100644
@@ -32,7 +32,7 @@
 #include "ui/input.h"
 #include "sysemu/sysemu.h"
 #include "qapi/error.h"
-#include "qmp-commands.h"
+#include "qapi/qapi-commands.h"
 #include "sysemu/blockdev.h"
 #include "qemu-version.h"
 #include <Carbon/Carbon.h>
ui/vnc.c +1 -2
index d6329c8bd5..20cd9bb63d 100644
@@ -35,10 +35,10 @@
 #include "qemu/timer.h"
 #include "qemu/acl.h"
 #include "qemu/config-file.h"
+#include "qapi/qapi-events.h"
 #include "qapi/error.h"
 #include "qapi/qapi-commands-ui.h"
 #include "ui/input.h"
-#include "qapi-event.h"
 #include "crypto/hash.h"
 #include "crypto/tlscredsanon.h"
 #include "crypto/tlscredsx509.h"
--

2.13.6

Reviewed-by on v2 27/29
#97 lore raw

Re: [Qemu-devel] [PATCH v2 27/29] qapi: Move qapi-schema.json to qapi/, rename generated files

In reply to Markus Armbruster

Quoting Markus Armbruster (2018-02-11 03:36:05)

Quoted 10 lines

Move qapi-schema.json to qapi/, so it's next to its modules, and all files get generated to qapi/, not just the ones generated for modules.

Consistently name the generated files qapi-MODULE.EXT:
qmp-commands.[ch] become qapi-commands.[ch], qapi-event.[ch] become qapi-events.[ch], and qmp-introspect.[ch] become qapi-introspect.[ch]. This gets rid of the temporary hacks in scripts/qapi/commands.py and scripts/qapi/events.py.

Quoted 972 lines
---
 .gitignore                                | 16 ++++++------
 Makefile                                  | 42 +++++++++++++++----------------
 Makefile.objs                             | 21 ++++++++--------
 backends/hostmem.c                        |  2 +-
 docs/devel/qapi-code-gen.txt              | 30 +++++++++++-----------
 docs/devel/writing-qmp-commands.txt       |  2 +-
 docs/interop/qmp-intro.txt                |  2 +-
 hmp.c                                     |  2 +-
 include/qapi/qmp/qobject.h                |  2 +-
 include/qapi/visitor.h                    |  2 +-
 include/qom/object.h                      |  2 +-
 monitor.c                                 |  6 ++---
 net/filter-buffer.c                       |  2 +-
 qapi/misc.json                            |  4 +--
 qapi-schema.json => qapi/qapi-schema.json | 32 +++++++++++------------
 qga/Makefile.objs                         |  2 +-
 qga/commands-posix.c                      |  2 +-
 qga/commands-win32.c                      |  2 +-
 qga/commands.c                            |  2 +-
 qga/main.c                                |  2 +-
 qom/object.c                              |  2 +-
 scripts/qapi/commands.py                  |  7 ------
 scripts/qapi/events.py                    |  9 +------
 scripts/qapi/introspect.py                |  4 +--
 scripts/qapi/types.py                     |  6 ++---
 scripts/qapi/visit.py                     |  6 ++---
 tests/.gitignore                          |  6 ++---
 tests/Makefile.include                    | 14 +++++------
 tests/test-qmp-cmds.c                     |  2 +-
 tests/test-qmp-event.c                    |  2 +-
 tests/test-qobject-input-visitor.c        |  6 ++---
 tpm.c                                     |  1 -
 ui/cocoa.m                                |  2 +-
 ui/vnc.c                                  |  2 +-
 34 files changed, 116 insertions(+), 130 deletions(-)
 rename qapi-schema.json => qapi/qapi-schema.json (85%)
.gitignore +8 -8
index 7f162e862f..dabfe6bea8 100644
@@ -29,8 +29,8 @@
 /qga/qapi-generated
 /qapi-generated
 /qapi-gen-timestamp
-/qapi-builtin-types.[ch]
-/qapi-builtin-visit.[ch]
+/qapi/qapi-builtin-types.[ch]
+/qapi/qapi-builtin-visit.[ch]
 /qapi/qapi-commands-block-core.[ch]
 /qapi/qapi-commands-block.[ch]
 /qapi/qapi-commands-char.[ch]
@@ -47,6 +47,7 @@
 /qapi/qapi-commands-trace.[ch]
 /qapi/qapi-commands-transaction.[ch]
 /qapi/qapi-commands-ui.[ch]
+/qapi/qapi-commands.[ch]
 /qapi/qapi-events-block-core.[ch]
 /qapi/qapi-events-block.[ch]
 /qapi/qapi-events-char.[ch]
@@ -63,6 +64,8 @@
 /qapi/qapi-events-trace.[ch]
 /qapi/qapi-events-transaction.[ch]
 /qapi/qapi-events-ui.[ch]
+/qapi/qapi-events.[ch]
+/qapi/qapi-introspect.[ch]
 /qapi/qapi-types-block-core.[ch]
 /qapi/qapi-types-block.[ch]
 /qapi/qapi-types-char.[ch]
@@ -79,7 +82,7 @@
 /qapi/qapi-types-trace.[ch]
 /qapi/qapi-types-transaction.[ch]
 /qapi/qapi-types-ui.[ch]
-/qapi-types.[ch]
+/qapi/qapi-types.[ch]
 /qapi/qapi-visit-block-core.[ch]
 /qapi/qapi-visit-block.[ch]
 /qapi/qapi-visit-char.[ch]
@@ -96,11 +99,8 @@
 /qapi/qapi-visit-trace.[ch]
 /qapi/qapi-visit-transaction.[ch]
 /qapi/qapi-visit-ui.[ch]
-/qapi-visit.[ch]
-/qapi-event.[ch]
-/qapi-doc.texi
-/qmp-commands.[ch]
-/qmp-introspect.[ch]
+/qapi/qapi-visit.[ch]
+/qapi/qapi-doc.texi
 /qemu-doc.html
 /qemu-doc.info
 /qemu-doc.txt
Makefile +21 -21
index 50eb194877..84411ee6ab 100644
@@ -90,8 +90,8 @@ endif
 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-builtin-types.h qapi/qapi-builtin-types.c
+GENERATED_FILES += qapi/qapi-types.h qapi/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
@@ -108,8 +108,8 @@ 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-builtin-visit.h qapi/qapi-builtin-visit.c
+GENERATED_FILES += qapi/qapi-visit.h qapi/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
@@ -126,7 +126,7 @@ 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.h qapi/qapi-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
@@ -143,7 +143,7 @@ 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.h qapi/qapi-events.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
@@ -160,8 +160,8 @@ 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
+GENERATED_FILES += qapi/qapi-introspect.c qapi/qapi-introspect.h
+GENERATED_FILES += qapi/qapi-doc.texi
 
 GENERATED_FILES += trace/generated-tcg-tracers.h
 
@@ -563,7 +563,7 @@ $(SRC_PATH)/scripts/qapi-gen.py
 
 qga/qapi-generated/qga-qapi-types.c qga/qapi-generated/qga-qapi-types.h \
 qga/qapi-generated/qga-qapi-visit.c qga/qapi-generated/qga-qapi-visit.h \
-qga/qapi-generated/qga-qmp-commands.h qga/qapi-generated/qga-qmp-commands.c \
+qga/qapi-generated/qga-qapi-commands.h qga/qapi-generated/qga-qapi-commands.c \
 qga/qapi-generated/qga-qapi-doc.texi: \
 qga/qapi-generated/qapi-gen-timestamp ;
 qga/qapi-generated/qapi-gen-timestamp: $(SRC_PATH)/qga/qapi-schema.json $(qapi-py)
@@ -572,7 +572,7 @@ qga/qapi-generated/qapi-gen-timestamp: $(SRC_PATH)/qga/qapi-schema.json $(qapi-p
                "GEN","$(@:%-timestamp=%)")
        @>$@
 
-qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json \
+qapi-modules = $(SRC_PATH)/qapi/qapi-schema.json $(SRC_PATH)/qapi/common.json \
                $(SRC_PATH)/qapi/block.json $(SRC_PATH)/qapi/block-core.json \
                $(SRC_PATH)/qapi/char.json \
                $(SRC_PATH)/qapi/crypto.json \
@@ -588,8 +588,8 @@ qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json \
                $(SRC_PATH)/qapi/transaction.json \
                $(SRC_PATH)/qapi/ui.json
 
-qapi-builtin-types.c qapi-builtin-types.h \
-qapi-types.c qapi-types.h \
+qapi/qapi-builtin-types.c qapi/qapi-builtin-types.h \
+qapi/qapi-types.c qapi/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 \
@@ -606,8 +606,8 @@ 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-builtin-visit.c qapi/qapi-builtin-visit.h \
+qapi/qapi-visit.c qapi/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 \
@@ -624,7 +624,7 @@ 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.h qapi/qapi-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 \
@@ -641,7 +641,7 @@ 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.c qapi/qapi-events.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 \
@@ -658,16 +658,16 @@ 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/qapi-introspect.h qapi/qapi-introspect.c \
+qapi/qapi-doc.texi: \
 qapi-gen-timestamp ;
 qapi-gen-timestamp: $(qapi-modules) $(qapi-py)
        $(call quiet-command,$(PYTHON_UTF8) $(SRC_PATH)/scripts/qapi-gen.py \
-               -o "." -b $<, \
+               -o "qapi" -b $<, \
                "GEN","$(@:%-timestamp=%)")
        @>$@
 
-QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h)
+QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qapi-commands.h)
 $(qga-obj-y): $(QGALIB_GEN)
 
 qemu-ga$(EXESUF): $(qga-obj-y) $(COMMON_LDADDS)
@@ -934,7 +934,7 @@ qemu-monitor-info.texi: $(SRC_PATH)/hmp-commands-info.hx $(SRC_PATH)/scripts/hxt
 qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx $(SRC_PATH)/scripts/hxtool
        $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"GEN","$@")
 
-docs/interop/qemu-qmp-qapi.texi: qapi-doc.texi
+docs/interop/qemu-qmp-qapi.texi: qapi/qapi-doc.texi
        @cp -p $< $@
 
 docs/interop/qemu-ga-qapi.texi: qga/qapi-generated/qga-qapi-doc.texi
Makefile.objs +11 -10
index a7986bbf0b..9aa1024c34 100644
@@ -2,8 +2,8 @@
 # Common libraries for tools and emulators
 stub-obj-y = stubs/ crypto/
 util-obj-y = util/ qobject/ qapi/
-util-obj-y += qapi-builtin-types.o
-util-obj-y += qapi-types.o
+util-obj-y += qapi/qapi-builtin-types.o
+util-obj-y += qapi/qapi-types.o
 util-obj-y += qapi/qapi-types-block-core.o
 util-obj-y += qapi/qapi-types-block.o
 util-obj-y += qapi/qapi-types-char.o
@@ -20,8 +20,8 @@ util-obj-y += qapi/qapi-types-tpm.o
 util-obj-y += qapi/qapi-types-trace.o
 util-obj-y += qapi/qapi-types-transaction.o
 util-obj-y += qapi/qapi-types-ui.o
-util-obj-y += qapi-builtin-visit.o
-util-obj-y += qapi-visit.o
+util-obj-y += qapi/qapi-builtin-visit.o
+util-obj-y += qapi/qapi-visit.o
 util-obj-y += qapi/qapi-visit-block-core.o
 util-obj-y += qapi/qapi-visit-block.o
 util-obj-y += qapi/qapi-visit-char.o
@@ -38,7 +38,7 @@ util-obj-y += qapi/qapi-visit-tpm.o
 util-obj-y += qapi/qapi-visit-trace.o
 util-obj-y += qapi/qapi-visit-transaction.o
 util-obj-y += qapi/qapi-visit-ui.o
-util-obj-y += qapi-event.o
+util-obj-y += qapi/qapi-events.o
 util-obj-y += qapi/qapi-events-block-core.o
 util-obj-y += qapi/qapi-events-block.o
 util-obj-y += qapi/qapi-events-char.o
@@ -55,7 +55,7 @@ util-obj-y += qapi/qapi-events-tpm.o
 util-obj-y += qapi/qapi-events-trace.o
 util-obj-y += qapi/qapi-events-transaction.o
 util-obj-y += qapi/qapi-events-ui.o
-util-obj-y += qmp-introspect.o
+util-obj-y += qapi/qapi-introspect.o
 
 chardev-obj-y = chardev/
 
@@ -131,7 +131,7 @@ common-obj-$(CONFIG_FDT) += device_tree.o
 ######################################################################
 # qapi
 
-common-obj-y += qmp-commands.o
+common-obj-y += qapi/qapi-commands.o
 common-obj-y += qapi/qapi-commands-block-core.o
 common-obj-y += qapi/qapi-commands-block.o
 common-obj-y += qapi/qapi-commands-char.o
@@ -148,7 +148,7 @@ common-obj-y += qapi/qapi-commands-tpm.o
 common-obj-y += qapi/qapi-commands-trace.o
 common-obj-y += qapi/qapi-commands-transaction.o
 common-obj-y += qapi/qapi-commands-ui.o
-common-obj-y += qmp-introspect.o
+common-obj-y += qapi/qapi-introspect.o
 common-obj-y += qmp.o hmp.o
 endif
 
@@ -171,8 +171,9 @@ target-obj-y += trace/
 ######################################################################
 # guest agent
 
-# FIXME: a few definitions from qapi-types.o/qapi-visit.o are needed
-# by libqemuutil.a.  These should be moved to a separate .json schema.
+# FIXME: a few definitions from qapi/qapi-types.o and
+# qapi/qapi-visit.o are needed by libqemuutil.a.  These should be
+# extracted into a QAPI schema module, or perhaps a separate schema.
 qga-obj-y = qga/
 qga-vss-dll-obj-y = qga/
 
backends/hostmem.c +1 -1
index 0afaf7160a..1292a9da1e 100644
@@ -14,7 +14,7 @@
 #include "sysemu/hostmem.h"
 #include "hw/boards.h"
 #include "qapi/error.h"
-#include "qapi-builtin-visit.h"
+#include "qapi/qapi-builtin-visit.h"
 #include "qapi/visitor.h"
 #include "qemu/config-file.h"
 #include "qom/object_interfaces.h"
docs/devel/qapi-code-gen.txt +15 -15
index ba1dc73298..0c4fc342fe 100644
@@ -647,7 +647,7 @@ name an event 'MAX', since the generator also produces a C enumeration
 of all event names with a generated _MAX value at the end.  When
 'data' is also specified, additional info will be included in the
 event, with similar semantics to a 'struct' expression.  Finally there
-will be C API generated in qapi-event.h; when called by QEMU code, a
+will be C API generated in qapi-events.h; when called by QEMU code, a
 message with timestamp will be emitted on the wire.
 
 An example event is:
@@ -1147,15 +1147,15 @@ declares qmp_COMMAND() that the user must implement.
 
 The following files are generated:
 
-$(prefix)qmp-commands.c: Command marshal/dispatch functions for each
-                         QMP command defined in the schema
+$(prefix)qapi-commands.c: Command marshal/dispatch functions for each
+                          QMP command defined in the schema
 
-$(prefix)qmp-commands.h: Function prototypes for the QMP commands
-                         specified in the schema
+$(prefix)qapi-commands.h: Function prototypes for the QMP commands
+                          specified in the schema
 
 Example:
 
-    $ cat qapi-generated/example-qmp-commands.h
+    $ cat qapi-generated/example-qapi-commands.h
 [Uninteresting stuff omitted...]
 
     #ifndef EXAMPLE_QMP_COMMANDS_H
@@ -1170,7 +1170,7 @@ Example:
     void qmp_marshal_my_command(QDict *args, QObject **ret, Error **errp);
 
     #endif
-    $ cat qapi-generated/example-qmp-commands.c
+    $ cat qapi-generated/example-qapi-commands.c
 [Uninteresting stuff omitted...]
 
     static void qmp_marshal_output_UserDefOne(UserDefOne *ret_in, QObject **ret_out, Error **errp)
@@ -1243,14 +1243,14 @@ qapi_event_send_EVENT().
 
 The following files are created:
 
-$(prefix)qapi-event.h - Function prototypes for each event type, plus an
+$(prefix)qapi-events.h - Function prototypes for each event type, plus an
                         enumeration of all event names
 
-$(prefix)qapi-event.c - Implementation of functions to send an event
+$(prefix)qapi-events.c - Implementation of functions to send an event
 
 Example:
 
-    $ cat qapi-generated/example-qapi-event.h
+    $ cat qapi-generated/example-qapi-events.h
 [Uninteresting stuff omitted...]
 
     #ifndef EXAMPLE_QAPI_EVENT_H
@@ -1273,7 +1273,7 @@ Example:
     extern const char *const example_QAPIEvent_lookup[];
 
     #endif
-    $ cat qapi-generated/example-qapi-event.c
+    $ cat qapi-generated/example-qapi-events.c
 [Uninteresting stuff omitted...]
 
     void qapi_event_send_my_event(Error **errp)
@@ -1305,14 +1305,14 @@ Example:
 
 The following files are created:
 
-$(prefix)qmp-introspect.c - Defines a string holding a JSON
+$(prefix)qapi-introspect.c - Defines a string holding a JSON
                             description of the schema
 
-$(prefix)qmp-introspect.h - Declares the above string
+$(prefix)qapi-introspect.h - Declares the above string
 
 Example:
 
-    $ cat qapi-generated/example-qmp-introspect.h
+    $ cat qapi-generated/example-qapi-introspect.h
 [Uninteresting stuff omitted...]
 
     #ifndef EXAMPLE_QMP_INTROSPECT_H
@@ -1321,7 +1321,7 @@ Example:
     extern const char example_qmp_schema_json[];
 
     #endif
-    $ cat qapi-generated/example-qmp-introspect.c
+    $ cat qapi-generated/example-qapi-introspect.c
 [Uninteresting stuff omitted...]
 
     const char example_qmp_schema_json[] = "["
docs/devel/writing-qmp-commands.txt +1 -1
index 50385eff27..9dfc62bf5a 100644
@@ -419,7 +419,7 @@ There are a number of things to be noticed:
    allocated by the implementation. This is so because the QAPI also generates
    a function to free its types and it cannot distinguish between dynamically
    or statically allocated strings
-6. You have to include "qapi/qmp-commands-misc.h" in qemu-timer.c
+6. You have to include "qapi/qapi-commands-misc.h" in qemu-timer.c
 
 Time to test the new command. Build qemu, run it as described in the "Testing"
 section and try this:
docs/interop/qmp-intro.txt +1 -1
index 430fe1b747..900d69d612 100644
@@ -79,7 +79,7 @@ Escape character is '^]'.
 }
 
 Please refer to docs/interop/qemu-qmp-ref.* for a complete command
-reference, generated from qapi-schema.json.
+reference, generated from qapi/qapi-schema.json.
 
 QMP wiki page
 -------------
hmp.c +1 -1
index c86946866b..1f31de3217 100644
@@ -28,7 +28,7 @@
 #include "monitor/qdev.h"
 #include "qapi/error.h"
 #include "qapi/opts-visitor.h"
-#include "qapi-builtin-visit.h"
+#include "qapi/qapi-builtin-visit.h"
 #include "qapi/qapi-commands-block.h"
 #include "qapi/qapi-commands-char.h"
 #include "qapi/qapi-commands-migration.h"
include/qapi/qmp/qobject.h +1 -1
index a2964fbf25..012439a2e3 100644
@@ -32,7 +32,7 @@
 #ifndef QOBJECT_H
 #define QOBJECT_H
 
-#include "qapi-builtin-types.h"
+#include "qapi/qapi-builtin-types.h"
 
 struct QObject {
     QType type;
include/qapi/visitor.h +1 -1
index 9e57508446..5b2ed3f202 100644
@@ -15,7 +15,7 @@
 #ifndef QAPI_VISITOR_H
 #define QAPI_VISITOR_H
 
-#include "qapi-builtin-types.h"
+#include "qapi/qapi-builtin-types.h"
 
 /*
  * The QAPI schema defines both a set of C data types, and a QMP wire
include/qom/object.h +1 -1
index 5b5c016d8f..30db296af4 100644
@@ -14,7 +14,7 @@
 #ifndef QEMU_OBJECT_H
 #define QEMU_OBJECT_H
 
-#include "qapi-builtin-types.h"
+#include "qapi/qapi-builtin-types.h"
 #include "qemu/queue.h"
 
 struct TypeImpl;
monitor.c +3 -3
index df670f3e15..d0e8d350fd 100644
@@ -69,14 +69,14 @@
 #include "exec/exec-all.h"
 #include "qemu/log.h"
 #include "qemu/option.h"
-#include "qmp-commands.h"
 #include "hmp.h"
 #include "qemu/thread.h"
 #include "block/qapi.h"
+#include "qapi/qapi-commands.h"
+#include "qapi/qapi-events.h"
 #include "qapi/error.h"
 #include "qapi/qmp-event.h"
-#include "qapi-event.h"
-#include "qmp-introspect.h"
+#include "qapi/qapi-introspect.h"
 #include "sysemu/qtest.h"
 #include "sysemu/cpus.h"
 #include "qemu/cutils.h"
net/filter-buffer.c +1 -1
index 7c487629f9..f7265c50a8 100644
@@ -13,7 +13,7 @@
 #include "qemu-common.h"
 #include "qemu/timer.h"
 #include "qemu/iov.h"
-#include "qapi-builtin-visit.h"
+#include "qapi/qapi-builtin-visit.h"
 #include "qapi/qmp/qerror.h"
 #include "qom/object.h"
 
qapi/misc.json +2 -2
index 225631bf7d..506f2b9371 100644
@@ -1618,7 +1618,7 @@
 #
 # Emitted when background dump has completed
 #
-# @result: DumpQueryResult type described in qapi-schema.json.
+# @result: final dump status
 #
 # @error: human-readable error string that provides
 #         hint on why dump failed. Only presents on failure. The
@@ -2833,7 +2833,7 @@
 #
 # Emitted when guest executes ACPI _OST method.
 #
-# @info: ACPIOSTInfo type as described in qapi-schema.json
+# @info: OSPM Status Indication
 #
 # Since: 2.1
 #
qapi/qapi-schema.json renamed from qapi-schema.json +16 -16
similarity index 85%
rename from qapi-schema.json
rename to qapi/qapi-schema.json
index 689d06c530..25bce78352 100644
@@ -76,20 +76,20 @@
 # included sub-schemas inserted at the first include directive
 # (subsequent include directives have no effect).  To get a sane and
 # stable order, it's best to include each sub-schema just once, or
-# include it first in qapi-schema.json.
+# include it first right here.
 
-{ 'include': 'qapi/common.json' }
-{ 'include': 'qapi/sockets.json' }
-{ 'include': 'qapi/run-state.json' }
-{ 'include': 'qapi/crypto.json' }
-{ 'include': 'qapi/block.json' }
-{ 'include': 'qapi/char.json' }
-{ 'include': 'qapi/net.json' }
-{ 'include': 'qapi/rocker.json' }
-{ 'include': 'qapi/tpm.json' }
-{ 'include': 'qapi/ui.json' }
-{ 'include': 'qapi/migration.json' }
-{ 'include': 'qapi/transaction.json' }
-{ 'include': 'qapi/trace.json' }
-{ 'include': 'qapi/introspect.json' }
-{ 'include': 'qapi/misc.json' }
+{ 'include': 'common.json' }
+{ 'include': 'sockets.json' }
+{ 'include': 'run-state.json' }
+{ 'include': 'crypto.json' }
+{ 'include': 'block.json' }
+{ 'include': 'char.json' }
+{ 'include': 'net.json' }
+{ 'include': 'rocker.json' }
+{ 'include': 'tpm.json' }
+{ 'include': 'ui.json' }
+{ 'include': 'migration.json' }
+{ 'include': 'transaction.json' }
+{ 'include': 'trace.json' }
+{ 'include': 'introspect.json' }
+{ 'include': 'misc.json' }
qga/Makefile.objs +1 -1
index 6151378ae4..ed08c5917c 100644
@@ -3,6 +3,6 @@ qga-obj-$(CONFIG_POSIX) += commands-posix.o channel-posix.o
 qga-obj-$(CONFIG_WIN32) += commands-win32.o channel-win32.o service-win32.o
 qga-obj-$(CONFIG_WIN32) += vss-win32.o
 qga-obj-y += qapi-generated/qga-qapi-types.o qapi-generated/qga-qapi-visit.o
-qga-obj-y += qapi-generated/qga-qmp-commands.o
+qga-obj-y += qapi-generated/qga-qapi-commands.o
 
 qga-vss-dll-obj-$(CONFIG_QGA_VSS) += vss-win32/
qga/commands-posix.c +1 -1
index 88807f3c78..417a50ce5f 100644
@@ -17,7 +17,7 @@
 #include <sys/wait.h>
 #include <dirent.h>
 #include "qga/guest-agent-core.h"
-#include "qga-qmp-commands.h"
+#include "qga-qapi-commands.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/queue.h"
qga/commands-win32.c +1 -1
index bedae32957..2d48394748 100644
@@ -34,7 +34,7 @@
 
 #include "qga/guest-agent-core.h"
 #include "qga/vss-win32.h"
-#include "qga-qmp-commands.h"
+#include "qga-qapi-commands.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/queue.h"
qga/commands.c +1 -1
index 6d710dbb20..a64b34ccab 100644
@@ -12,7 +12,7 @@
 
 #include "qemu/osdep.h"
 #include "qga/guest-agent-core.h"
-#include "qga-qmp-commands.h"
+#include "qga-qapi-commands.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qerror.h"
 #include "qemu/base64.h"
qga/main.c +1 -1
index cb434d8c46..f9c83050c5 100644
@@ -25,7 +25,7 @@
 #include "qapi/qmp/qstring.h"
 #include "qga/guest-agent-core.h"
 #include "qemu/module.h"
-#include "qga-qmp-commands.h"
+#include "qga-qapi-commands.h"
 #include "qapi/qmp/qerror.h"
 #include "qapi/error.h"
 #include "qga/channel.h"
qom/object.c +1 -1
index 81b4f7ac48..f70a75c308 100644
@@ -18,7 +18,7 @@
 #include "qapi/visitor.h"
 #include "qapi/string-input-visitor.h"
 #include "qapi/string-output-visitor.h"
-#include "qapi-builtin-visit.h"
+#include "qapi/qapi-builtin-visit.h"
 #include "qapi/qmp/qerror.h"
 #include "trace.h"
 
scripts/qapi/commands.py +0 -7
index 953449171b..21a7e0dbe6 100644
@@ -232,13 +232,6 @@ class QAPISchemaGenCommandVisitor(QAPISchemaModularCVisitor):
         self._regy = ''
         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()
         commands = self._module_basename('qapi-commands', name)
scripts/qapi/events.py +1 -8
index 5ad6708491..3dc523cf39 100644
@@ -157,20 +157,13 @@ class QAPISchemaGenEventVisitor(QAPISchemaModularCVisitor):
         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):
         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-events.h"
 #include "%(visit)s.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qdict.h"
scripts/qapi/introspect.py +2 -2
index f571cc134c..f66c397fb0 100644
@@ -44,7 +44,7 @@ class QAPISchemaGenIntrospectVisitor(QAPISchemaMonolithicCVisitor):
 
     def __init__(self, prefix, unmask):
         QAPISchemaMonolithicCVisitor.__init__(
-            self, prefix, 'qmp-introspect',
+            self, prefix, 'qapi-introspect',
             ' * QAPI/QMP schema introspection', __doc__)
         self._unmask = unmask
         self._schema = None
@@ -53,7 +53,7 @@ class QAPISchemaGenIntrospectVisitor(QAPISchemaMonolithicCVisitor):
         self._name_map = {}
         self._genc.add(mcgen('''
 #include "qemu/osdep.h"
-#include "%(prefix)sqmp-introspect.h"
+#include "%(prefix)sqapi-introspect.h"
 
 ''',
                              prefix=prefix))
scripts/qapi/types.py +3 -3
index 2a3c502cf6..64d9c0fb37 100644
@@ -177,8 +177,8 @@ class QAPISchemaGenTypeVisitor(QAPISchemaModularCVisitor):
         self._genc.preamble_add(mcgen('''
 #include "qemu/osdep.h"
 #include "qapi/dealloc-visitor.h"
-#include "qapi-builtin-types.h"
-#include "qapi-builtin-visit.h"
+#include "qapi/qapi-builtin-types.h"
+#include "qapi/qapi-builtin-visit.h"
 '''))
         self._genh.preamble_add(mcgen('''
 #include "qapi/util.h"
@@ -195,7 +195,7 @@ class QAPISchemaGenTypeVisitor(QAPISchemaModularCVisitor):
 ''',
                                       types=types, visit=visit))
         self._genh.preamble_add(mcgen('''
-#include "qapi-builtin-types.h"
+#include "qapi/qapi-builtin-types.h"
 '''))
 
     def visit_begin(self, schema):
scripts/qapi/visit.py +3 -3
index de09966643..5d72d8936c 100644
@@ -274,11 +274,11 @@ class QAPISchemaGenVisitVisitor(QAPISchemaModularCVisitor):
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "qapi/error.h"
-#include "qapi-builtin-visit.h"
+#include "qapi/qapi-builtin-visit.h"
 '''))
         self._genh.preamble_add(mcgen('''
 #include "qapi/visitor.h"
-#include "qapi-builtin-types.h"
+#include "qapi/qapi-builtin-types.h"
 
 ''',
                                       prefix=prefix))
@@ -295,7 +295,7 @@ class QAPISchemaGenVisitVisitor(QAPISchemaModularCVisitor):
 ''',
                                       visit=visit, prefix=self._prefix))
         self._genh.preamble_add(mcgen('''
-#include "qapi-builtin-visit.h"
+#include "qapi/qapi-builtin-visit.h"
 #include "%(types)s.h"
 
 ''',
tests/.gitignore +3 -3
index 2629cfc2f9..18e58b2183 100644
@@ -60,7 +60,8 @@ test-keyval
 test-logging
 test-mul64
 test-opts-visitor
-test-qapi-event.[ch]
+test-qapi-commands.[ch]
+test-qapi-events.[ch]
 test-qapi-types.[ch]
 test-qapi-util
 test-qapi-visit.[ch]
@@ -71,11 +72,10 @@ test-qga
 test-qht
 test-qht-par
 test-qmp-cmds
-test-qmp-commands.[ch]
 test-qmp-event
 test-qobject-input-strict
 test-qobject-input-visitor
-test-qmp-introspect.[ch]
+test-qapi-introspect.[ch]
 test-qobject-output-visitor
 test-rcu-list
 test-replication
tests/Makefile.include +7 -7
index 9a21ed7ee9..d71adf3996 100644
@@ -566,8 +566,8 @@ qapi-schema += unknown-expr-key.json
 check-qapi-schema-y := $(addprefix tests/qapi-schema/, $(qapi-schema))
 
 GENERATED_FILES += tests/test-qapi-types.h tests/test-qapi-visit.h \
-       tests/test-qmp-commands.h tests/test-qapi-event.h \
-       tests/test-qmp-introspect.h
+       tests/test-qapi-commands.h tests/test-qapi-events.h \
+       tests/test-qapi-introspect.h
 
 test-obj-y = tests/check-qnum.o tests/check-qstring.o tests/check-qdict.o \
        tests/check-qlist.o tests/check-qnull.o tests/check-qobject.o \
@@ -592,7 +592,7 @@ QEMU_CFLAGS += -I$(SRC_PATH)/tests
 test-util-obj-y = libqemuutil.a
 test-qom-obj-y = $(qom-obj-y) $(test-util-obj-y)
 test-qapi-obj-y = tests/test-qapi-visit.o tests/test-qapi-types.o \
-       tests/test-qapi-event.o tests/test-qmp-introspect.o \
+       tests/test-qapi-events.o tests/test-qapi-introspect.o \
        $(test-qom-obj-y)
 benchmark-crypto-obj-y = $(crypto-obj-y) $(test-qom-obj-y)
 test-crypto-obj-y = $(crypto-obj-y) $(test-qom-obj-y)
@@ -656,9 +656,9 @@ tests/test-replication$(EXESUF): tests/test-replication.o $(test-util-obj-y) \
 
 tests/test-qapi-types.c tests/test-qapi-types.h \
 tests/test-qapi-visit.c tests/test-qapi-visit.h \
-tests/test-qmp-commands.h tests/test-qmp-commands.c \
-tests/test-qapi-event.c tests/test-qapi-event.h \
-tests/test-qmp-introspect.c tests/test-qmp-introspect.h: \
+tests/test-qapi-commands.h tests/test-qapi-commands.c \
+tests/test-qapi-events.c tests/test-qapi-events.h \
+tests/test-qapi-introspect.c tests/test-qapi-introspect.h: \
 tests/test-qapi-gen-timestamp ;
 tests/test-qapi-gen-timestamp: $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(qapi-py)
        $(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/qapi-gen.py \
@@ -679,7 +679,7 @@ tests/test-qmp-event$(EXESUF): tests/test-qmp-event.o $(test-qapi-obj-y)
 tests/test-qobject-output-visitor$(EXESUF): tests/test-qobject-output-visitor.o $(test-qapi-obj-y)
 tests/test-clone-visitor$(EXESUF): tests/test-clone-visitor.o $(test-qapi-obj-y)
 tests/test-qobject-input-visitor$(EXESUF): tests/test-qobject-input-visitor.o $(test-qapi-obj-y)
-tests/test-qmp-cmds$(EXESUF): tests/test-qmp-cmds.o tests/test-qmp-commands.o $(test-qapi-obj-y)
+tests/test-qmp-cmds$(EXESUF): tests/test-qmp-cmds.o tests/test-qapi-commands.o $(test-qapi-obj-y)
 tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(test-qapi-obj-y)
 tests/test-opts-visitor$(EXESUF): tests/test-opts-visitor.o $(test-qapi-obj-y)
 
tests/test-qmp-cmds.c +1 -1
index 24660d0868..5b1cee6912 100644
@@ -3,12 +3,12 @@
 #include "qapi/qmp/qdict.h"
 #include "qapi/qmp/qnum.h"
 #include "qapi/qmp/qstring.h"
-#include "test-qmp-commands.h"
 #include "qapi/error.h"
 #include "qemu/module.h"
 #include "qapi/qobject-input-visitor.h"
 #include "tests/test-qapi-types.h"
 #include "tests/test-qapi-visit.h"
+#include "test-qapi-commands.h"
 
 static QmpCommandList qmp_commands;
 
tests/test-qmp-event.c +1 -1
index 5fbe7e551f..31f35b3e66 100644
@@ -14,13 +14,13 @@
 #include "qemu/osdep.h"
 
 #include "qemu-common.h"
-#include "test-qapi-event.h"
 #include "qapi/error.h"
 #include "qapi/qmp/qbool.h"
 #include "qapi/qmp/qdict.h"
 #include "qapi/qmp/qnum.h"
 #include "qapi/qmp/qstring.h"
 #include "qapi/qmp-event.h"
+#include "test-qapi-events.h"
 
 typedef struct TestEventData {
     QDict *expect;
tests/test-qobject-input-visitor.c +3 -3
index d3a56bd071..79b1a8cb17 100644
@@ -24,8 +24,8 @@
 #include "qapi/qmp/qnum.h"
 #include "qapi/qmp/qstring.h"
 #include "qapi/qmp/qjson.h"
-#include "test-qmp-introspect.h"
-#include "qmp-introspect.h"
+#include "test-qapi-introspect.h"
+#include "qapi/qapi-introspect.h"
 
 typedef struct TestInputVisitorData {
     QObject *obj;
@@ -1376,7 +1376,7 @@ int main(int argc, char **argv)
                            NULL, test_visitor_in_fail_alternate);
     input_visitor_test_add("/visitor/input/fail/union-native-list",
                            NULL, test_visitor_in_fail_union_native_list);
-    input_visitor_test_add("/visitor/input/qmp-introspect",
+    input_visitor_test_add("/visitor/input/qapi-introspect",
                            NULL, test_visitor_in_qmp_introspect);
 
     g_test_run();
tpm.c +0 -1
index 2db03a09b2..ac580e6d47 100644
@@ -182,7 +182,6 @@ int tpm_config_parse(QemuOptsList *opts_list, const char *optarg)
 
 /*
  * Walk the list of active TPM backends and collect information about them
- * following the schema description in qapi-schema.json.
  */
 TPMInfoList *qmp_query_tpm(Error **errp)
 {
ui/cocoa.m +1 -1
index 51db47cd71..de6af6fbb9 100644
@@ -32,7 +32,7 @@
 #include "ui/input.h"
 #include "sysemu/sysemu.h"
 #include "qapi/error.h"
-#include "qmp-commands.h"
+#include "qapi/qapi-commands.h"
 #include "sysemu/blockdev.h"
 #include "qemu-version.h"
 #include <Carbon/Carbon.h>
ui/vnc.c +1 -1
index d6329c8bd5..20cd9bb63d 100644
@@ -35,10 +35,10 @@
 #include "qemu/timer.h"
 #include "qemu/acl.h"
 #include "qemu/config-file.h"
+#include "qapi/qapi-events.h"
 #include "qapi/error.h"
 #include "qapi/qapi-commands-ui.h"
 #include "ui/input.h"
-#include "qapi-event.h"
 #include "crypto/hash.h"
 #include "crypto/tlscredsanon.h"
 #include "crypto/tlscredsx509.h"
Signature · 1 line
2.13.6
#98 lore raw

PATCH v2 28/29 Fix up dangling references to qmp-commands.* in comment and doc

In reply to Markus Armbruster

Fix up the reference to qmp-commands.hx in qmp.c. Missed in commit 5032a16d1d.

Fix up the reference to qmp-commands.txt in docs/xen-save-devices-state.txt. Missed in commit 4d8bb958fa.

---
 docs/xen-save-devices-state.txt |  3 +--
 qmp.c                           | 14 +++++++-------
 2 files changed, 8 insertions(+), 9 deletions(-)
docs/xen-save-devices-state.txt +1 -2
index a72ecc8081..1912ecad25 100644
@@ -8,8 +8,7 @@ These operations are normally used with migration (see migration.txt),
 however it is also possible to save the state of all devices to file,
 without saving the RAM or the block devices of the VM.
 
-This operation is called "xen-save-devices-state" (see
-qmp-commands.txt)
+The save operation is available as QMP command xen-save-devices-state.
 
 
 The binary format used in the file is the following:
qmp.c +7 -7
index a8d4eba973..ba82e1df9f 100644
@@ -147,13 +147,13 @@ VncInfo2List *qmp_query_vnc_servers(Error **errp)
 
 #ifndef CONFIG_SPICE
 /*
- * qmp-commands.hx ensures that QMP command query-spice exists only
- * #ifdef CONFIG_SPICE.  Necessary for an accurate query-commands
- * result.  However, the QAPI schema is blissfully unaware of that,
- * and the QAPI code generator happily generates a dead
- * qmp_marshal_query_spice() that calls qmp_query_spice().  Provide it
- * one, or else linking fails.  FIXME Educate the QAPI schema on
- * CONFIG_SPICE.
+ * qmp_unregister_commands_hack() ensures that QMP command query-spice
+ * exists only #ifdef CONFIG_SPICE.  Necessary for an accurate
+ * query-commands result.  However, the QAPI schema is blissfully
+ * unaware of that, and the QAPI code generator happily generates a
+ * dead qmp_marshal_query_spice() that calls qmp_query_spice().
+ * Provide it one, or else linking fails.  FIXME Educate the QAPI
+ * schema on CONFIG_SPICE.
  */
 SpiceInfo *qmp_query_spice(Error **errp)
 {
Signature · 1 line
2.13.6
Reviewed-by on v2 28/29
#99 lore raw

Re: [Qemu-devel] [PATCH v2 28/29] Fix up dangling references to qmp-commands.* in comment and doc

Quoted 17 lines · Markus Armbruster

Fix up the reference to qmp-commands.hx in qmp.c. Missed in commit 5032a16d1d.

Fix up the reference to qmp-commands.txt in docs/xen-save-devices-state.txt. Missed in commit 4d8bb958fa.

---
  docs/xen-save-devices-state.txt |  3 +--
  qmp.c                           | 14 +++++++-------
  2 files changed, 8 insertions(+), 9 deletions(-)
docs/xen-save-devices-state.txt +0 -0
index a72ecc8081..1912ecad25 100644

docs/xen-save-devices-state.txt These operations are normally used with migration (see migration.txt), · line 11

Quoted 6 lines
docs/xen-save-devices-state.txt +1 -2
@@ -8,8 +8,7 @@ These operations are normally used with migration (see migration.txt),
  however it is also possible to save the state of all devices to file,
  without saving the RAM or the block devices of the VM.
 
-This operation is called "xen-save-devices-state" (see
-qmp-commands.txt)
+The save operation is available as QMP command xen-save-devices-state.

I like the fact that you made the reword more generic (in case we rename things again, one less place to edit).

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
Reviewed-by Marc-André Lureau on v2 28/29
#100 lore raw

Re: [Qemu-devel] [PATCH v2 28/29] Fix up dangling references to qmp-commands.* in comment and doc

In reply to Markus Armbruster
Quoted 39 lines · Markus Armbruster

Fix up the reference to qmp-commands.hx in qmp.c. Missed in commit 5032a16d1d.

Fix up the reference to qmp-commands.txt in docs/xen-save-devices-state.txt. Missed in commit 4d8bb958fa.

---
 docs/xen-save-devices-state.txt |  3 +--
 qmp.c                           | 14 +++++++-------
 2 files changed, 8 insertions(+), 9 deletions(-)
docs/xen-save-devices-state.txt +1 -2
index a72ecc8081..1912ecad25 100644
@@ -8,8 +8,7 @@ These operations are normally used with migration (see migration.txt),
 however it is also possible to save the state of all devices to file,
 without saving the RAM or the block devices of the VM.
 
-This operation is called "xen-save-devices-state" (see
-qmp-commands.txt)
+The save operation is available as QMP command xen-save-devices-state.
 
 
 The binary format used in the file is the following:
qmp.c +0 -5
index a8d4eba973..ba82e1df9f 100644
@@ -147,13 +147,13 @@ VncInfo2List *qmp_query_vnc_servers(Error **errp)
 
 #ifndef CONFIG_SPICE
 /*
- * qmp-commands.hx ensures that QMP command query-spice exists only
- * #ifdef CONFIG_SPICE.  Necessary for an accurate query-commands
- * result.  However, the QAPI schema is blissfully unaware of that,
- * and the QAPI code generator happily generates a dead
- * qmp_marshal_query_spice() that calls qmp_query_spice().  Provide it

qmp.c VncInfo2List *qmp_query_vnc_servers(Error **errp) · line 157

Quoted 10 lines
qmp.c +7 -2
- * one, or else linking fails.  FIXME Educate the QAPI schema on
- * CONFIG_SPICE.
+ * qmp_unregister_commands_hack() ensures that QMP command query-spice
+ * exists only #ifdef CONFIG_SPICE.  Necessary for an accurate
+ * query-commands result.  However, the QAPI schema is blissfully
+ * unaware of that, and the QAPI code generator happily generates a
+ * dead qmp_marshal_query_spice() that calls qmp_query_spice().
+ * Provide it one, or else linking fails.  FIXME Educate the QAPI
+ * schema on CONFIG_SPICE.
  */

I hope this comment will go away soon,

Quoted 5 lines
qmp.c +0 -1
 SpiceInfo *qmp_query_spice(Error **errp)
 {
--

2.13.6

Reviewed-by on v2 28/29
#101 lore raw

Re: [Qemu-devel] [PATCH v2 28/29] Fix up dangling references to qmp-commands.* in comment and doc

In reply to Markus Armbruster

Quoting Markus Armbruster (2018-02-11 03:36:06)

Quoted 7 lines

Fix up the reference to qmp-commands.hx in qmp.c. Missed in commit 5032a16d1d.

Fix up the reference to qmp-commands.txt in docs/xen-save-devices-state.txt. Missed in commit 4d8bb958fa.

Quoted 47 lines
---
 docs/xen-save-devices-state.txt |  3 +--
 qmp.c                           | 14 +++++++-------
 2 files changed, 8 insertions(+), 9 deletions(-)
docs/xen-save-devices-state.txt +1 -2
index a72ecc8081..1912ecad25 100644
@@ -8,8 +8,7 @@ These operations are normally used with migration (see migration.txt),
 however it is also possible to save the state of all devices to file,
 without saving the RAM or the block devices of the VM.
 
-This operation is called "xen-save-devices-state" (see
-qmp-commands.txt)
+The save operation is available as QMP command xen-save-devices-state.
 
 
 The binary format used in the file is the following:
qmp.c +7 -7
index a8d4eba973..ba82e1df9f 100644
@@ -147,13 +147,13 @@ VncInfo2List *qmp_query_vnc_servers(Error **errp)
 
 #ifndef CONFIG_SPICE
 /*
- * qmp-commands.hx ensures that QMP command query-spice exists only
- * #ifdef CONFIG_SPICE.  Necessary for an accurate query-commands
- * result.  However, the QAPI schema is blissfully unaware of that,
- * and the QAPI code generator happily generates a dead
- * qmp_marshal_query_spice() that calls qmp_query_spice().  Provide it
- * one, or else linking fails.  FIXME Educate the QAPI schema on
- * CONFIG_SPICE.
+ * qmp_unregister_commands_hack() ensures that QMP command query-spice
+ * exists only #ifdef CONFIG_SPICE.  Necessary for an accurate
+ * query-commands result.  However, the QAPI schema is blissfully
+ * unaware of that, and the QAPI code generator happily generates a
+ * dead qmp_marshal_query_spice() that calls qmp_query_spice().
+ * Provide it one, or else linking fails.  FIXME Educate the QAPI
+ * schema on CONFIG_SPICE.
  */
 SpiceInfo *qmp_query_spice(Error **errp)
 {
Signature · 1 line
2.13.6
#102 lore raw

PATCH v2 29/29 qapi: Don't create useless directory qapi-generated

In reply to Markus Armbruster

We used to generate first test and later QGA QAPI code into qapi-generated/. Commit b93b63f574 moved the test code to tests/. Commit 54c2e50205 moved the QGA code to qga/qapi-generated/. The directory has been unused since.

---
 .gitignore | 1 -
 Makefile   | 1 -
 configure  | 1 -
 3 files changed, 3 deletions(-)
.gitignore +0 -1
index dabfe6bea8..4055e12ee8 100644
@@ -27,7 +27,6 @@
 /libuser
 /linux-headers/asm
 /qga/qapi-generated
-/qapi-generated
 /qapi-gen-timestamp
 /qapi/qapi-builtin-types.[ch]
 /qapi/qapi-builtin-visit.[ch]
Makefile +0 -1
index 84411ee6ab..7eb1ede6f4 100644
@@ -726,7 +726,6 @@ clean:
 	rm -f trace/generated-tracers-dtrace.h*
 	rm -f $(foreach f,$(GENERATED_FILES),$(f) $(f)-timestamp)
 	rm -f qapi-gen-timestamp
-	rm -rf qapi-generated
 	rm -rf qga/qapi-generated
 	for d in $(ALL_SUBDIRS); do \
 	if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
configure +0 -1
index 62562f08cf..f564a1639e 100755
@@ -7015,7 +7015,6 @@ DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-sche
 DIRS="$DIRS docs docs/interop fsdev scsi"
 DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
 DIRS="$DIRS roms/seabios roms/vgabios"
-DIRS="$DIRS qapi-generated"
 FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
 FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
 FILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
Signature · 1 line
2.13.6
Reviewed-by on v2 29/29
#103 lore raw

Re: [Qemu-devel] [PATCH v2 29/29] qapi: Don't create useless directory qapi-generated

Quoted 11 lines · Markus Armbruster

We used to generate first test and later QGA QAPI code into qapi-generated/. Commit b93b63f574 moved the test code to tests/. Commit 54c2e50205 moved the QGA code to qga/qapi-generated/. The directory has been unused since.

---
  .gitignore | 1 -
  Makefile   | 1 -
  configure  | 1 -
  3 files changed, 3 deletions(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
Reviewed-by Marc-André Lureau on v2 29/29
#104 lore raw

Re: [Qemu-devel] [PATCH v2 29/29] qapi: Don't create useless directory qapi-generated

In reply to Markus Armbruster
Quoted 6 lines · Markus Armbruster

We used to generate first test and later QGA QAPI code into qapi-generated/. Commit b93b63f574 moved the test code to tests/. Commit 54c2e50205 moved the QGA code to qga/qapi-generated/. The directory has been unused since.

good catch,

Quoted 45 lines
---
 .gitignore | 1 -
 Makefile   | 1 -
 configure  | 1 -
 3 files changed, 3 deletions(-)
.gitignore +0 -1
index dabfe6bea8..4055e12ee8 100644
@@ -27,7 +27,6 @@
 /libuser
 /linux-headers/asm
 /qga/qapi-generated
-/qapi-generated
 /qapi-gen-timestamp
 /qapi/qapi-builtin-types.[ch]
 /qapi/qapi-builtin-visit.[ch]
Makefile +0 -1
index 84411ee6ab..7eb1ede6f4 100644
@@ -726,7 +726,6 @@ clean:
        rm -f trace/generated-tracers-dtrace.h*
        rm -f $(foreach f,$(GENERATED_FILES),$(f) $(f)-timestamp)
        rm -f qapi-gen-timestamp
-       rm -rf qapi-generated
        rm -rf qga/qapi-generated
        for d in $(ALL_SUBDIRS); do \
        if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
configure +0 -2
index 62562f08cf..f564a1639e 100755
@@ -7015,7 +7015,6 @@ DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-sche
 DIRS="$DIRS docs docs/interop fsdev scsi"
 DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
 DIRS="$DIRS roms/seabios roms/vgabios"
-DIRS="$DIRS qapi-generated"
 FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
 FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
 FILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
--

2.13.6

Reviewed-by on v2 29/29
#105 lore raw

Re: [Qemu-devel] [PATCH v2 29/29] qapi: Don't create useless directory qapi-generated

In reply to Markus Armbruster

Quoting Markus Armbruster (2018-02-11 03:36:07)

Quoted 6 lines

We used to generate first test and later QGA QAPI code into qapi-generated/. Commit b93b63f574 moved the test code to tests/. Commit 54c2e50205 moved the QGA code to qga/qapi-generated/. The directory has been unused since.

Quoted 45 lines
---
 .gitignore | 1 -
 Makefile   | 1 -
 configure  | 1 -
 3 files changed, 3 deletions(-)
.gitignore +0 -1
index dabfe6bea8..4055e12ee8 100644
@@ -27,7 +27,6 @@
 /libuser
 /linux-headers/asm
 /qga/qapi-generated
-/qapi-generated
 /qapi-gen-timestamp
 /qapi/qapi-builtin-types.[ch]
 /qapi/qapi-builtin-visit.[ch]
Makefile +0 -1
index 84411ee6ab..7eb1ede6f4 100644
@@ -726,7 +726,6 @@ clean:
        rm -f trace/generated-tracers-dtrace.h*
        rm -f $(foreach f,$(GENERATED_FILES),$(f) $(f)-timestamp)
        rm -f qapi-gen-timestamp
-       rm -rf qapi-generated
        rm -rf qga/qapi-generated
        for d in $(ALL_SUBDIRS); do \
        if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
configure +0 -1
index 62562f08cf..f564a1639e 100755
@@ -7015,7 +7015,6 @@ DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-sche
 DIRS="$DIRS docs docs/interop fsdev scsi"
 DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
 DIRS="$DIRS roms/seabios roms/vgabios"
-DIRS="$DIRS qapi-generated"
 FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
 FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
 FILES="$FILES tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile"
Signature · 1 line
2.13.6
#106 lore raw
In reply to Markus Armbruster
This series failed docker-mingw@fedora build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally.

Hi,

This series failed docker-mingw@fedora build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally.

Type: series
Message-id: [email protected]
Subject: [Qemu-devel] [PATCH v2 00/29] Modularize generated QAPI code

=== TEST SCRIPT BEGIN ===
#!/bin/bash
set -e
git submodule update --init dtc
# Let docker tests dump environment info
export SHOW_ENV=1
export J=8
time make docker-test-mingw@fedora
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
88c36fed50 qapi: Don't create useless directory qapi-generated 8695c58a23 Fix up dangling references to qmp-commands.* in comment and doc cb0173d2de qapi: Move qapi-schema.json to qapi/, rename generated files 0163832937 docs: Correct outdated information on QAPI
0e8593c3cc docs/devel/writing-qmp-commands: Update for modular QAPI 610c107fba qapi: Empty out qapi-schema.json
978b56117d Include less of the generated modular QAPI headers b9fbec1f14 qapi: Generate separate .h, .c for each module 349f60fd78 qapi/common: Fix guardname() for funny filenames 7d0c330c11 qapi/types qapi/visit: Generate built-in stuff into separate files 6be749acd0 qapi: Make code-generating visitors use QAPIGen more 26fb1118b1 qapi: Rename generated qmp-marshal.c to qmp-commands.c 3373ff0b73 qapi: Record 'include' directives in intermediate representation 992e298bed qapi: Generate in source order
27ec87b85b qapi: Record 'include' directives in parse tree 704eb94f85 qapi: Concentrate QAPISchemaParser.exprs updates in .__init__() 679e456092 qapi: Lift error reporting from QAPISchema.__init__() to callers b6747d37d3 qapi/common: Eliminate QAPISchema.exprs
12c8bc8c3c qapi: Improve include file name reporting in error messages 15d87d797d qapi: Touch generated files only when they change c1fb7b93d8 qapi-gen: Convert from getopt to argparse
8174e1f7f9 qapi-gen: New common driver for code and doc generators 76b229359e qapi: Turn generators into modules
e9687814c8 qapi: Reduce use of global variables in generators some df03d3d345 qapi: New classes QAPIGenC, QAPIGenH, QAPIGenDoc 8dcb95864b qapi: Rename variable holding the QAPISchemaGenFOOVisitor 176807c729 qapi: Generate up-to-date copyright notice
57f04f7bcd qapi: Streamline boilerplate comment generation dc8f4505cb Include qapi/qmp/qerror.h exactly where needed

=== OUTPUT BEGIN ===
Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc'
Cloning into '/var/tmp/patchew-tester-tmp-7cnnoaxn/src/dtc'...
Submodule path 'dtc': checked out 'e54388015af1fb4bf04d0bca99caba1074d9cc42'
BUILD fedora
GEN /var/tmp/patchew-tester-tmp-7cnnoaxn/src/docker-src.2018-02-11-05.15.21.19660/qemu.tar
Cloning into '/var/tmp/patchew-tester-tmp-7cnnoaxn/src/docker-src.2018-02-11-05.15.21.19660/qemu.tar.vroot'... done.
Your branch is up-to-date with 'origin/test'.
Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc'
Cloning into '/var/tmp/patchew-tester-tmp-7cnnoaxn/src/docker-src.2018-02-11-05.15.21.19660/qemu.tar.vroot/dtc'... Submodule path 'dtc': checked out 'e54388015af1fb4bf04d0bca99caba1074d9cc42'
Submodule 'ui/keycodemapdb' (git://git.qemu.org/keycodemapdb.git) registered for path 'ui/keycodemapdb' Cloning into '/var/tmp/patchew-tester-tmp-7cnnoaxn/src/docker-src.2018-02-11-05.15.21.19660/qemu.tar.vroot/ui/keycodemapdb'... Submodule path 'ui/keycodemapdb': checked out '6b3d716e2b6472eb7189d3220552280ef3d832ce'
COPY RUNNER
RUN test-mingw in qemu:fedora
Packages installed:
PyYAML-3.12-5.fc27.x86_64
SDL-devel-1.2.15-29.fc27.x86_64
bc-1.07.1-3.fc27.x86_64
bison-3.0.4-8.fc27.x86_64
bzip2-1.0.6-24.fc27.x86_64
ccache-3.3.5-1.fc27.x86_64
clang-5.0.1-1.fc27.x86_64
findutils-4.6.0-14.fc27.x86_64
flex-2.6.1-5.fc27.x86_64
gcc-7.3.1-2.fc27.x86_64
gcc-c++-7.3.1-2.fc27.x86_64
gettext-0.19.8.1-12.fc27.x86_64
git-2.14.3-2.fc27.x86_64
glib2-devel-2.54.3-2.fc27.x86_64
hostname-3.18-4.fc27.x86_64
libaio-devel-0.3.110-9.fc27.x86_64
libasan-7.3.1-2.fc27.x86_64
libfdt-devel-1.4.6-1.fc27.x86_64
libubsan-7.3.1-2.fc27.x86_64
make-4.2.1-4.fc27.x86_64
mingw32-SDL-1.2.15-9.fc27.noarch
mingw32-bzip2-1.0.6-9.fc27.noarch
mingw32-curl-7.54.1-2.fc27.noarch
mingw32-glib2-2.54.1-1.fc27.noarch
mingw32-gmp-6.1.2-2.fc27.noarch
mingw32-gnutls-3.5.13-2.fc27.noarch
mingw32-gtk2-2.24.31-4.fc27.noarch
mingw32-gtk3-3.22.16-1.fc27.noarch
mingw32-libjpeg-turbo-1.5.1-3.fc27.noarch
mingw32-libpng-1.6.29-2.fc27.noarch
mingw32-libssh2-1.8.0-3.fc27.noarch
mingw32-libtasn1-4.13-1.fc27.noarch
mingw32-nettle-3.3-3.fc27.noarch
mingw32-pixman-0.34.0-3.fc27.noarch
mingw32-pkg-config-0.28-9.fc27.x86_64
mingw64-SDL-1.2.15-9.fc27.noarch
mingw64-bzip2-1.0.6-9.fc27.noarch
mingw64-curl-7.54.1-2.fc27.noarch
mingw64-glib2-2.54.1-1.fc27.noarch
mingw64-gmp-6.1.2-2.fc27.noarch
mingw64-gnutls-3.5.13-2.fc27.noarch
mingw64-gtk2-2.24.31-4.fc27.noarch
mingw64-gtk3-3.22.16-1.fc27.noarch
mingw64-libjpeg-turbo-1.5.1-3.fc27.noarch
mingw64-libpng-1.6.29-2.fc27.noarch
mingw64-libssh2-1.8.0-3.fc27.noarch
mingw64-libtasn1-4.13-1.fc27.noarch
mingw64-nettle-3.3-3.fc27.noarch
mingw64-pixman-0.34.0-3.fc27.noarch
mingw64-pkg-config-0.28-9.fc27.x86_64
nettle-devel-3.4-1.fc27.x86_64
perl-5.26.1-402.fc27.x86_64
pixman-devel-0.34.0-4.fc27.x86_64
python3-3.6.2-13.fc27.x86_64
sparse-0.5.1-2.fc27.x86_64
tar-1.29-7.fc27.x86_64
which-2.21-4.fc27.x86_64
zlib-devel-1.2.11-4.fc27.x86_64

Environment variables:
TARGET_LIST=
PACKAGES=ccache gettext git tar PyYAML sparse flex bison python3 bzip2 hostname glib2-devel pixman-devel zlib-devel SDL-devel libfdt-devel gcc gcc-c++ clang make perl which bc findutils libaio-devel nettle-devel libasan libubsan mingw32-pixman mingw32-glib2 mingw32-gmp mingw32-SDL mingw32-pkg-config mingw32-gtk2 mingw32-gtk3 mingw32-gnutls mingw32-nettle mingw32-libtasn1 mingw32-libjpeg-turbo mingw32-libpng mingw32-curl mingw32-libssh2 mingw32-bzip2 mingw64-pixman mingw64-glib2 mingw64-gmp mingw64-SDL mingw64-pkg-config mingw64-gtk2 mingw64-gtk3 mingw64-gnutls mingw64-nettle mingw64-libtasn1 mingw64-libjpeg-turbo mingw64-libpng mingw64-curl mingw64-libssh2 mingw64-bzip2
J=8
V=
HOSTNAME=8e24a3c7cddb
DEBUG=
SHOW_ENV=1
PWD=/
HOME=/root
CCACHE_DIR=/var/tmp/ccache
DISTTAG=f27container
QEMU_CONFIGURE_OPTS=--python=/usr/bin/python3
FGC=f27
TEST_DIR=/tmp/qemu-test
SHLVL=1
FEATURES=mingw clang pyyaml asan dtc PATH=/usr/lib/ccache:/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin MAKEFLAGS= -j8
EXTRA_CONFIGURE_OPTS=
_=/usr/bin/env

Configure options:
--enable-werror --target-list=x86_64-softmmu,aarch64-softmmu --prefix=/tmp/qemu-test/install --python=/usr/bin/python3 --cross-prefix=x86_64-w64-mingw32- --enable-trace-backends=simple --enable-gnutls --enable-nettle --enable-curl --enable-vnc --enable-bzip2 --enable-guest-agent --with-sdlabi=1.2 --with-gtkabi=2.0

Install prefix    /tmp/qemu-test/install
BIOS directory    /tmp/qemu-test/install
firmware path     /tmp/qemu-test/install/share/qemu-firmware
binary directory  /tmp/qemu-test/install

library directory /tmp/qemu-test/install/lib
module directory /tmp/qemu-test/install/lib
libexec directory /tmp/qemu-test/install/libexec
include directory /tmp/qemu-test/install/include
config directory /tmp/qemu-test/install
local state directory queried at runtime

Windows SDK       no
Source path       /tmp/qemu-test/src
GIT binary        git
GIT submodules    
C compiler        x86_64-w64-mingw32-gcc
Host C compiler   cc
C++ compiler      x86_64-w64-mingw32-g++
Objective-C compiler clang
ARFLAGS           rv
CFLAGS            -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g 
QEMU_CFLAGS       -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/pixman-1  -I$(SRC_PATH)/dtc/libfdt -Werror -DHAS_LIBSSH2_SFTP_FSYNC -mms-bitfields -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/glib-2.0 -I/usr/x86_64-w64-mingw32/sys-root/mingw/lib/glib-2.0/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include  -m64 -mcx16 -mthreads -D__USE_MINGW_ANSI_STDIO=1 -DWIN32_LEAN_AND_MEAN -DWINVER=0x501 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common -fwrapv  -Wexpansion-to-defined -Wendif-labels -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-strong -I/usr/x86_64-w64-mingw32/sys-root/mingw/include -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/p11-kit-1 -I/usr/x86_64-w64-mingw32/sys-root/mingw/include  -I/usr/x86_64-w64-mingw32/sys-root/mingw/include   -I/usr/x86_64-w64-mingw32/sys-root/mingw/include/libpng16 
LDFLAGS           -Wl,--nxcompat -Wl,--no-seh -Wl,--dynamicbase -Wl,--warn-common -m64 -g 
make              make
install           install
python            /usr/bin/python3 -B
smbd              /usr/sbin/smbd
module support    no
host CPU          x86_64
host big endian   no
target list       x86_64-softmmu aarch64-softmmu
gprof enabled     no
sparse enabled    no
strip binaries    yes
profiler          no
static build      no
SDL support       yes (1.2.15)
GTK support       yes (2.24.31)
GTK GL support    no
VTE support       no 
TLS priority      NORMAL
GNUTLS support    yes
GNUTLS rnd        yes
libgcrypt         no
libgcrypt kdf     no
nettle            yes (3.3)
nettle kdf        yes
libtasn1          yes
curses support    no
virgl support     no
curl support      yes
mingw32 support   yes
Audio drivers     dsound

Block whitelist (rw)
Block whitelist (ro)
VirtFS support no
Multipath support no

VNC support       yes
VNC SASL support  no
VNC JPEG support  yes
VNC PNG support   yes
xen support       no
brlapi support    no
bluez  support    no
Documentation     no
PIE               no
vde support       no
netmap support    no
Linux AIO support no
ATTR/XATTR support no
Install blobs     yes
KVM support       no
HAX support       yes
HVF support       no
WHPX support      no
TCG support       yes
TCG debug enabled no
TCG interpreter   no
malloc trim support no
RDMA support      no
fdt support       yes
preadv support    no
fdatasync         no
madvise           no
posix_madvise     no

libcap-ng support no
vhost-net support no
vhost-scsi support no
vhost-vsock support no
vhost-user support no
Trace backends simple
Trace output file trace-<pid>

spice support     no 
rbd support       no
xfsctl support    no
smartcard support no
libusb            no
usb net redir     no
OpenGL support    no
OpenGL dmabufs    no
libiscsi support  no
libnfs support    no

build guest agent yes
QGA VSS support no
QGA w32 disk info yes
QGA MSI support no
seccomp support no
coroutine backend win32
coroutine pool yes
debug stack usage no
crypto afalg no
GlusterFS support no

gcov              gcov
gcov enabled      no
TPM support       yes
libssh2 support   yes
TPM passthrough   no
TPM emulator      no
QOM debugging     yes
Live block migration yes
lzo support       no
snappy support    no
bzip2 support     yes
NUMA host support no
libxml2           no
tcmalloc support  no
jemalloc support  no

avx2 optimization yes
replication support yes
VxHS block device no
capstone no

WARNING: Use of GTK 2.0 is deprecated and will be removed in
WARNING: future releases. Please switch to using GTK 3.0

WARNING: Use of SDL 1.2 is deprecated and will be removed in
WARNING: future releases. Please switch to using SDL 2.0

  GEN     config-host.h
  GEN     x86_64-softmmu/config-devices.mak.tmp
  GEN     aarch64-softmmu/config-devices.mak.tmp
  GEN     qemu-options.def
  GEN     qapi-gen
  GEN     trace/generated-tcg-tracers.h
  GEN     trace/generated-helpers-wrappers.h
  GEN     trace/generated-helpers.h
  GEN     x86_64-softmmu/config-devices.mak
  GEN     trace/generated-helpers.c
  GEN     aarch64-softmmu/config-devices.mak
  GEN     module_block.h
  GEN     ui/input-keymap-atset1-to-qcode.c
  GEN     ui/input-keymap-linux-to-qcode.c
  GEN     ui/input-keymap-qcode-to-atset1.c
  GEN     ui/input-keymap-qcode-to-atset2.c
  GEN     ui/input-keymap-qcode-to-atset3.c

Traceback (most recent call last):
File "/tmp/qemu-test/src/scripts/qapi-gen.py", line 11, in <module>
from qapi.common import QAPIError, QAPISchema
File "/tmp/qemu-test/src/scripts/qapi/common.py", line 2002

    fd = os.open(pathname, os.O_RDWR | os.O_CREAT, 0666)
                                                      ^

SyntaxError: invalid token
GEN ui/input-keymap-qcode-to-linux.c
make: *** [Makefile:665: qapi-gen-timestamp] Error 1
make: *** Waiting for unfinished jobs.... Traceback (most recent call last):
File "./tests/docker/docker.py", line 407, in <module>

    sys.exit(main())

File "./tests/docker/docker.py", line 404, in main
return args.cmdobj.run(args, argv)
File "./tests/docker/docker.py", line 261, in run
return Docker().run(argv, args.keep, quiet=args.quiet)
File "./tests/docker/docker.py", line 229, in run
quiet=quiet)
File "./tests/docker/docker.py", line 147, in _do_check
return subprocess.check_call(self._command + cmd, **kwargs)
File "/usr/lib64/python2.7/subprocess.py", line 186, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['docker', 'run', '--label', 'com.qemu.instance.uuid=7c5f6f3e0f1411e8af5c52540069c830', '-u', '0', '--security-opt', 'seccomp=unconfined', '--rm', '--net=none', '-e', 'TARGET_LIST=', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=8', '-e', 'DEBUG=', '-e', 'SHOW_ENV=1', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/root/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-7cnnoaxn/src/docker-src.2018-02-11-05.15.21.19660:/var/tmp/qemu:z,ro', 'qemu:fedora', '/var/tmp/qemu/run', 'test-mingw']' returned non-zero exit status 2 make[1]: *** [tests/docker/Makefile.include:129: docker-run] Error 1
make: *** [tests/docker/Makefile.include:163: docker-run-test-mingw@fedora] Error 2

real 1m0.694s
user 0m4.526s
sys 0m3.165s
=== OUTPUT END ===

Test command exited with code: 2

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]

#107 lore raw

PATCH v2 1/1 watchdog: Consolidate QAPI into single file

In reply to Markus Armbruster

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.

---

Based on my review of 24/29, I'm inserting this patch right before rebasing that one onto master.

 qapi-schema.json    | 9 ---------
 qapi/run-state.json | 9 +++++++++
 2 files changed, 9 insertions(+), 9 deletions(-)
qapi-schema.json +0 -9
index 05cc58e121e..93912e804ab 100644
@@ -3180,12 +3180,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 bca46a8785f..3924357fef4 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
#108 lore raw

Re: [Qemu-devel] [PATCH v2 23.5/29] watchdog: Consolidate QAPI into single file

Quoted 3 lines · Eric Blake

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.

I'm adding:

The command was written prior to commit 0e201d34 creating the latter file, even though it was merged after.

Quoted 49 lines

---

Based on my review of 24/29, I'm inserting this patch right before rebasing that one onto master.

  qapi-schema.json    | 9 ---------
  qapi/run-state.json | 9 +++++++++
  2 files changed, 9 insertions(+), 9 deletions(-)
qapi-schema.json +0 -9
index 05cc58e121e..93912e804ab 100644
@@ -3180,12 +3180,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 bca46a8785f..3924357fef4 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 · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#109 lore raw
In reply to Markus Armbruster
Quoted 31 lines · Markus Armbruster

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.

This series' basic idea is to split up generated headers to mirror the schema's modular structure: one header per module. That way, you can include just what you need.

The compile-time improvements can be massive. Before this series, any QAPI schema change recompiles some 4800 out of 5100 objects in my "build everything" tree. Afterwards, adding a type to qapi/migration.json recompiles a bit over 100, and a documentation change no longer recompiles anything.

Related: Marc-André's 'unit' pragma proposal. That's a different way to split off parts of the generated code, motivated by the desire to use poisoned identifiers such as TARGET_I386. I noted in my review of v3 that I "can either accept it, or come up with a better solution." This is my attempt at a better solution. It's a bit more ambitious, and thus more useful (I hope). The pragma has one theoretical advantage, though: you can modularize the generated output in different ways than the input. The patches using don't do that, however.

Quoted 1 line
  186 files changed, 1556 insertions(+), 1352 deletions(-)

I've posted a staging version of this at:

http://repo.or.cz/qemu/ericb.git qapi

Barring any last-minute comments, or a need to rebase for other branches going in, I'll submit a pull request later today.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org