In my "build everything" tree, a change to the types in
qapi-schema.json triggers a recompile of about 4500 out of 4800
objects.
The previous commit split up the generated qapi-types.h. Replace
includes of qapi-types.h (i.e. all types) by includes of parts where
possible.
To illustrate the benefits: adding a type to qapi/migration.json now
recompiles some 2300 instead of 4500 objects. The next commit will
improve it further.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
crypto/cipherpriv.h | 2 +-
hw/block/block.c | 1 +
hw/block/hd-geometry.c | 1 +
hw/net/rocker/rocker_fp.c | 2 +-
include/block/block.h | 2 +-
include/block/dirty-bitmap.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/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 +-
migration/migration.h | 1 +
migration/ram.h | 2 +-
net/tap_int.h | 2 +-
replication.h | 1 +
ui/vnc.h | 1 +
42 files changed, 43 insertions(+), 22 deletions(-)
diff --git a/crypto/cipherpriv.h b/crypto/cipherpriv.h
index 77da4c2f32..0823239f41 100644
--- a/crypto/cipherpriv.h
+++ b/crypto/cipherpriv.h
@@ -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;
diff --git a/hw/block/block.c b/hw/block/block.c
index b0269c857f..b91e2b6d7e 100644
--- a/hw/block/block.c
+++ b/hw/block/block.c
@@ -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)
diff --git a/hw/block/hd-geometry.c b/hw/block/hd-geometry.c
index 57ad5012a7..79384a2b0a 100644
--- a/hw/block/hd-geometry.c
+++ b/hw/block/hd-geometry.c
@@ -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"
diff --git a/hw/net/rocker/rocker_fp.c b/hw/net/rocker/rocker_fp.c
index 4b3c9847db..27b17c890f 100644
--- a/hw/net/rocker/rocker_fp.c
+++ b/hw/net/rocker/rocker_fp.c
@@ -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"
diff --git a/include/block/block.h b/include/block/block.h
index ae1517f32d..70b90cd767 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -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"
diff --git a/include/block/dirty-bitmap.h b/include/block/dirty-bitmap.h
index 3da8486ab1..1454be358d 100644
--- a/include/block/dirty-bitmap.h
+++ b/include/block/dirty-bitmap.h
@@ -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,
diff --git a/include/chardev/char.h b/include/chardev/char.h
index a381dc3df8..ebf1e0ba04 100644
--- a/include/chardev/char.h
+++ b/include/chardev/char.h
@@ -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"
diff --git a/include/crypto/cipher.h b/include/crypto/cipher.h
index 984fb8243f..bce2d4c8e4 100644
--- a/include/crypto/cipher.h
+++ b/include/crypto/cipher.h
@@ -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;
diff --git a/include/crypto/hash.h b/include/crypto/hash.h
index ca3267f3df..077ac7bea0 100644
--- a/include/crypto/hash.h
+++ b/include/crypto/hash.h
@@ -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 */
diff --git a/include/crypto/hmac.h b/include/crypto/hmac.h
index 5e88905989..aa3c97a2ff 100644
--- a/include/crypto/hmac.h
+++ b/include/crypto/hmac.h
@@ -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 {
diff --git a/include/crypto/secret.h b/include/crypto/secret.h
index 07a963e794..edd0e13236 100644
--- a/include/crypto/secret.h
+++ b/include/crypto/secret.h
@@ -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"
diff --git a/include/crypto/tlscreds.h b/include/crypto/tlscreds.h
index ad47d88be7..6b011e1dbc 100644
--- a/include/crypto/tlscreds.h
+++ b/include/crypto/tlscreds.h
@@ -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
diff --git a/include/hw/block/block.h b/include/hw/block/block.h
index f532d10e35..d4f4dfffab 100644
--- a/include/hw/block/block.h
+++ b/include/hw/block/block.h
@@ -12,7 +12,7 @@
#define HW_BLOCK_H
#include "qemu-common.h"
-#include "qapi-types.h"
+#include "qapi/qapi-types-block-core.h"
/* Configuration */
diff --git a/include/hw/block/fdc.h b/include/hw/block/fdc.h
index 68a0c904ea..3b813c7f7d 100644
--- a/include/hw/block/fdc.h
+++ b/include/hw/block/fdc.h
@@ -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
diff --git a/include/hw/ppc/spapr_drc.h b/include/hw/ppc/spapr_drc.h
index f8d9f5b231..f6ff32e7e2 100644
--- a/include/hw/ppc/spapr_drc.h
+++ b/include/hw/ppc/spapr_drc.h
@@ -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"
diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h
index 5bbfec634b..c5d1b1bd63 100644
--- a/include/hw/qdev-properties.h
+++ b/include/hw/qdev-properties.h
@@ -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 ***/
diff --git a/include/io/dns-resolver.h b/include/io/dns-resolver.h
index 2f69c08c13..1a162185cc 100644
--- a/include/io/dns-resolver.h
+++ b/include/io/dns-resolver.h
@@ -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"
diff --git a/include/migration/colo.h b/include/migration/colo.h
index 50ace16205..2fe48ad353 100644
--- a/include/migration/colo.h
+++ b/include/migration/colo.h
@@ -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);
diff --git a/include/migration/failover.h b/include/migration/failover.h
index ad91ef2381..4c37218dcc 100644
--- a/include/migration/failover.h
+++ b/include/migration/failover.h
@@ -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,
diff --git a/include/migration/global_state.h b/include/migration/global_state.h
index d307de8350..fd22dd3034 100644
--- a/include/migration/global_state.h
+++ b/include/migration/global_state.h
@@ -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);
diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
index ad64ad8e68..50f7cea057 100644
--- a/include/monitor/monitor.h
+++ b/include/monitor/monitor.h
@@ -3,6 +3,7 @@
#include "qemu-common.h"
#include "block/block.h"
+#include "qapi-types.h"
#include "qemu/readline.h"
extern Monitor *cur_mon;
diff --git a/include/net/filter.h b/include/net/filter.h
index 0c4a2ea6c9..435acd6f82 100644
--- a/include/net/filter.h
+++ b/include/net/filter.h
@@ -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"
diff --git a/include/net/net.h b/include/net/net.h
index 3fc48e4f51..727643032c 100644
--- a/include/net/net.h
+++ b/include/net/net.h
@@ -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"
diff --git a/include/qapi/error.h b/include/qapi/error.h
index 341b229066..36065da35d 100644
--- a/include/qapi/error.h
+++ b/include/qapi/error.h
@@ -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.
diff --git a/include/qapi/qmp/qobject.h b/include/qapi/qmp/qobject.h
index 38ac68845c..a2964fbf25 100644
--- a/include/qapi/qmp/qobject.h
+++ b/include/qapi/qmp/qobject.h
@@ -32,7 +32,7 @@
#ifndef QOBJECT_H
#define QOBJECT_H
-#include "qapi-types.h"
+#include "qapi-builtin-types.h"
struct QObject {
QType type;
diff --git a/include/qapi/visitor.h b/include/qapi/visitor.h
index ecff296c11..9e57508446 100644
--- a/include/qapi/visitor.h
+++ b/include/qapi/visitor.h
@@ -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
diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h
index 8889bcb1ec..e88d4c37ab 100644
--- a/include/qemu/sockets.h
+++ b/include/qemu/sockets.h
@@ -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);
diff --git a/include/qemu/throttle.h b/include/qemu/throttle.h
index 03d45f44f8..abeb886d93 100644
--- a/include/qemu/throttle.h
+++ b/include/qemu/throttle.h
@@ -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
diff --git a/include/qom/cpu.h b/include/qom/cpu.h
index aff88fa16f..dc6d4956a8 100644
--- a/include/qom/cpu.h
+++ b/include/qom/cpu.h
@@ -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"
diff --git a/include/qom/object.h b/include/qom/object.h
index dc73d59660..5b5c016d8f 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -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;
diff --git a/include/sysemu/dump.h b/include/sysemu/dump.h
index c14bcfe8c6..2424e31425 100644
--- a/include/sysemu/dump.h
+++ b/include/sysemu/dump.h
@@ -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 */
diff --git a/include/sysemu/hostmem.h b/include/sysemu/hostmem.h
index 621a3f9d42..6424f96df9 100644
--- a/include/sysemu/hostmem.h
+++ b/include/sysemu/hostmem.h
@@ -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"
diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h
index dc8ae7b6b1..fb533ed9b6 100644
--- a/include/sysemu/replay.h
+++ b/include/sysemu/replay.h
@@ -13,6 +13,7 @@
*/
#include "sysemu.h"
+#include "qapi-types.h"
/* replay clock kinds */
enum ReplayClockKind {
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 77bb3da582..bfbef9e69c 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -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"
diff --git a/include/sysemu/tpm.h b/include/sysemu/tpm.h
index 00be220248..20ac1b2993 100644
--- a/include/sysemu/tpm.h
+++ b/include/sysemu/tpm.h
@@ -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);
diff --git a/include/sysemu/watchdog.h b/include/sysemu/watchdog.h
index 677ace3945..a08d16380d 100644
--- a/include/sysemu/watchdog.h
+++ b/include/sysemu/watchdog.h
@@ -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;
diff --git a/include/ui/input.h b/include/ui/input.h
index 05aab2db5c..fc70f503fb 100644
--- a/include/ui/input.h
+++ b/include/ui/input.h
@@ -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)
diff --git a/migration/migration.h b/migration/migration.h
index 7e3dbed057..87503f03bc 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -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"
diff --git a/migration/ram.h b/migration/ram.h
index f3a227b4fc..53f0021c51 100644
--- a/migration/ram.h
+++ b/migration/ram.h
@@ -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;
diff --git a/net/tap_int.h b/net/tap_int.h
index ae6888f74a..9f931d52d6 100644
--- a/net/tap_int.h
+++ b/net/tap_int.h
@@ -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);
diff --git a/replication.h b/replication.h
index ece6ca6133..8faefe005f 100644
--- a/replication.h
+++ b/replication.h
@@ -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;
diff --git a/ui/vnc.h b/ui/vnc.h
index cfc3d0a570..da8495c0c8 100644
--- a/ui/vnc.h
+++ b/ui/vnc.h
@@ -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"
--
2.13.6
On Fri, Feb 2, 2018 at 2:03 PM, Markus Armbruster <armbru@redhat.com> wrote:
> In my "build everything" tree, a change to the types in
> qapi-schema.json triggers a recompile of about 4500 out of 4800
> objects.
>
> The previous commit split up the generated qapi-types.h. Replace
> includes of qapi-types.h (i.e. all types) by includes of parts where
> possible.
>
> To illustrate the benefits: adding a type to qapi/migration.json now
> recompiles some 2300 instead of 4500 objects. The next commit will
> improve it further.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
for the record, what was your methodology?
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> crypto/cipherpriv.h | 2 +-
> hw/block/block.c | 1 +
> hw/block/hd-geometry.c | 1 +
> hw/net/rocker/rocker_fp.c | 2 +-
> include/block/block.h | 2 +-
> include/block/dirty-bitmap.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/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 +-
> migration/migration.h | 1 +
> migration/ram.h | 2 +-
> net/tap_int.h | 2 +-
> replication.h | 1 +
> ui/vnc.h | 1 +
> 42 files changed, 43 insertions(+), 22 deletions(-)
>
> diff --git a/crypto/cipherpriv.h b/crypto/cipherpriv.h
> index 77da4c2f32..0823239f41 100644
> --- a/crypto/cipherpriv.h
> +++ b/crypto/cipherpriv.h
> @@ -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;
>
> diff --git a/hw/block/block.c b/hw/block/block.c
> index b0269c857f..b91e2b6d7e 100644
> --- a/hw/block/block.c
> +++ b/hw/block/block.c
> @@ -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)
> diff --git a/hw/block/hd-geometry.c b/hw/block/hd-geometry.c
> index 57ad5012a7..79384a2b0a 100644
> --- a/hw/block/hd-geometry.c
> +++ b/hw/block/hd-geometry.c
> @@ -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"
> diff --git a/hw/net/rocker/rocker_fp.c b/hw/net/rocker/rocker_fp.c
> index 4b3c9847db..27b17c890f 100644
> --- a/hw/net/rocker/rocker_fp.c
> +++ b/hw/net/rocker/rocker_fp.c
> @@ -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"
> diff --git a/include/block/block.h b/include/block/block.h
> index ae1517f32d..70b90cd767 100644
> --- a/include/block/block.h
> +++ b/include/block/block.h
> @@ -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"
> diff --git a/include/block/dirty-bitmap.h b/include/block/dirty-bitmap.h
> index 3da8486ab1..1454be358d 100644
> --- a/include/block/dirty-bitmap.h
> +++ b/include/block/dirty-bitmap.h
> @@ -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,
> diff --git a/include/chardev/char.h b/include/chardev/char.h
> index a381dc3df8..ebf1e0ba04 100644
> --- a/include/chardev/char.h
> +++ b/include/chardev/char.h
> @@ -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"
> diff --git a/include/crypto/cipher.h b/include/crypto/cipher.h
> index 984fb8243f..bce2d4c8e4 100644
> --- a/include/crypto/cipher.h
> +++ b/include/crypto/cipher.h
> @@ -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;
>
> diff --git a/include/crypto/hash.h b/include/crypto/hash.h
> index ca3267f3df..077ac7bea0 100644
> --- a/include/crypto/hash.h
> +++ b/include/crypto/hash.h
> @@ -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 */
>
> diff --git a/include/crypto/hmac.h b/include/crypto/hmac.h
> index 5e88905989..aa3c97a2ff 100644
> --- a/include/crypto/hmac.h
> +++ b/include/crypto/hmac.h
> @@ -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 {
> diff --git a/include/crypto/secret.h b/include/crypto/secret.h
> index 07a963e794..edd0e13236 100644
> --- a/include/crypto/secret.h
> +++ b/include/crypto/secret.h
> @@ -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"
> diff --git a/include/crypto/tlscreds.h b/include/crypto/tlscreds.h
> index ad47d88be7..6b011e1dbc 100644
> --- a/include/crypto/tlscreds.h
> +++ b/include/crypto/tlscreds.h
> @@ -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
> diff --git a/include/hw/block/block.h b/include/hw/block/block.h
> index f532d10e35..d4f4dfffab 100644
> --- a/include/hw/block/block.h
> +++ b/include/hw/block/block.h
> @@ -12,7 +12,7 @@
> #define HW_BLOCK_H
>
> #include "qemu-common.h"
> -#include "qapi-types.h"
> +#include "qapi/qapi-types-block-core.h"
>
> /* Configuration */
>
> diff --git a/include/hw/block/fdc.h b/include/hw/block/fdc.h
> index 68a0c904ea..3b813c7f7d 100644
> --- a/include/hw/block/fdc.h
> +++ b/include/hw/block/fdc.h
> @@ -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
> diff --git a/include/hw/ppc/spapr_drc.h b/include/hw/ppc/spapr_drc.h
> index f8d9f5b231..f6ff32e7e2 100644
> --- a/include/hw/ppc/spapr_drc.h
> +++ b/include/hw/ppc/spapr_drc.h
> @@ -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"
> diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h
> index 5bbfec634b..c5d1b1bd63 100644
> --- a/include/hw/qdev-properties.h
> +++ b/include/hw/qdev-properties.h
> @@ -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 ***/
> diff --git a/include/io/dns-resolver.h b/include/io/dns-resolver.h
> index 2f69c08c13..1a162185cc 100644
> --- a/include/io/dns-resolver.h
> +++ b/include/io/dns-resolver.h
> @@ -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"
>
> diff --git a/include/migration/colo.h b/include/migration/colo.h
> index 50ace16205..2fe48ad353 100644
> --- a/include/migration/colo.h
> +++ b/include/migration/colo.h
> @@ -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);
>
> diff --git a/include/migration/failover.h b/include/migration/failover.h
> index ad91ef2381..4c37218dcc 100644
> --- a/include/migration/failover.h
> +++ b/include/migration/failover.h
> @@ -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,
> diff --git a/include/migration/global_state.h b/include/migration/global_state.h
> index d307de8350..fd22dd3034 100644
> --- a/include/migration/global_state.h
> +++ b/include/migration/global_state.h
> @@ -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);
> diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
> index ad64ad8e68..50f7cea057 100644
> --- a/include/monitor/monitor.h
> +++ b/include/monitor/monitor.h
> @@ -3,6 +3,7 @@
>
> #include "qemu-common.h"
> #include "block/block.h"
> +#include "qapi-types.h"
> #include "qemu/readline.h"
>
> extern Monitor *cur_mon;
> diff --git a/include/net/filter.h b/include/net/filter.h
> index 0c4a2ea6c9..435acd6f82 100644
> --- a/include/net/filter.h
> +++ b/include/net/filter.h
> @@ -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"
> diff --git a/include/net/net.h b/include/net/net.h
> index 3fc48e4f51..727643032c 100644
> --- a/include/net/net.h
> +++ b/include/net/net.h
> @@ -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"
>
> diff --git a/include/qapi/error.h b/include/qapi/error.h
> index 341b229066..36065da35d 100644
> --- a/include/qapi/error.h
> +++ b/include/qapi/error.h
> @@ -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.
> diff --git a/include/qapi/qmp/qobject.h b/include/qapi/qmp/qobject.h
> index 38ac68845c..a2964fbf25 100644
> --- a/include/qapi/qmp/qobject.h
> +++ b/include/qapi/qmp/qobject.h
> @@ -32,7 +32,7 @@
> #ifndef QOBJECT_H
> #define QOBJECT_H
>
> -#include "qapi-types.h"
> +#include "qapi-builtin-types.h"
>
> struct QObject {
> QType type;
> diff --git a/include/qapi/visitor.h b/include/qapi/visitor.h
> index ecff296c11..9e57508446 100644
> --- a/include/qapi/visitor.h
> +++ b/include/qapi/visitor.h
> @@ -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
> diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h
> index 8889bcb1ec..e88d4c37ab 100644
> --- a/include/qemu/sockets.h
> +++ b/include/qemu/sockets.h
> @@ -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);
> diff --git a/include/qemu/throttle.h b/include/qemu/throttle.h
> index 03d45f44f8..abeb886d93 100644
> --- a/include/qemu/throttle.h
> +++ b/include/qemu/throttle.h
> @@ -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
> diff --git a/include/qom/cpu.h b/include/qom/cpu.h
> index aff88fa16f..dc6d4956a8 100644
> --- a/include/qom/cpu.h
> +++ b/include/qom/cpu.h
> @@ -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"
> diff --git a/include/qom/object.h b/include/qom/object.h
> index dc73d59660..5b5c016d8f 100644
> --- a/include/qom/object.h
> +++ b/include/qom/object.h
> @@ -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;
> diff --git a/include/sysemu/dump.h b/include/sysemu/dump.h
> index c14bcfe8c6..2424e31425 100644
> --- a/include/sysemu/dump.h
> +++ b/include/sysemu/dump.h
> @@ -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 */
> diff --git a/include/sysemu/hostmem.h b/include/sysemu/hostmem.h
> index 621a3f9d42..6424f96df9 100644
> --- a/include/sysemu/hostmem.h
> +++ b/include/sysemu/hostmem.h
> @@ -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"
> diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h
> index dc8ae7b6b1..fb533ed9b6 100644
> --- a/include/sysemu/replay.h
> +++ b/include/sysemu/replay.h
> @@ -13,6 +13,7 @@
> */
>
> #include "sysemu.h"
> +#include "qapi-types.h"
>
> /* replay clock kinds */
> enum ReplayClockKind {
> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
> index 77bb3da582..bfbef9e69c 100644
> --- a/include/sysemu/sysemu.h
> +++ b/include/sysemu/sysemu.h
> @@ -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"
> diff --git a/include/sysemu/tpm.h b/include/sysemu/tpm.h
> index 00be220248..20ac1b2993 100644
> --- a/include/sysemu/tpm.h
> +++ b/include/sysemu/tpm.h
> @@ -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);
> diff --git a/include/sysemu/watchdog.h b/include/sysemu/watchdog.h
> index 677ace3945..a08d16380d 100644
> --- a/include/sysemu/watchdog.h
> +++ b/include/sysemu/watchdog.h
> @@ -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;
> diff --git a/include/ui/input.h b/include/ui/input.h
> index 05aab2db5c..fc70f503fb 100644
> --- a/include/ui/input.h
> +++ b/include/ui/input.h
> @@ -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)
> diff --git a/migration/migration.h b/migration/migration.h
> index 7e3dbed057..87503f03bc 100644
> --- a/migration/migration.h
> +++ b/migration/migration.h
> @@ -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"
> diff --git a/migration/ram.h b/migration/ram.h
> index f3a227b4fc..53f0021c51 100644
> --- a/migration/ram.h
> +++ b/migration/ram.h
> @@ -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;
> diff --git a/net/tap_int.h b/net/tap_int.h
> index ae6888f74a..9f931d52d6 100644
> --- a/net/tap_int.h
> +++ b/net/tap_int.h
> @@ -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);
> diff --git a/replication.h b/replication.h
> index ece6ca6133..8faefe005f 100644
> --- a/replication.h
> +++ b/replication.h
> @@ -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;
> diff --git a/ui/vnc.h b/ui/vnc.h
> index cfc3d0a570..da8495c0c8 100644
> --- a/ui/vnc.h
> +++ b/ui/vnc.h
> @@ -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"
> --
> 2.13.6
>
Marc-Andre Lureau <mlureau@redhat.com> writes:
> On Fri, Feb 2, 2018 at 2:03 PM, Markus Armbruster <armbru@redhat.com> wrote:
>> In my "build everything" tree, a change to the types in
>> qapi-schema.json triggers a recompile of about 4500 out of 4800
>> objects.
>>
>> The previous commit split up the generated qapi-types.h. Replace
>> includes of qapi-types.h (i.e. all types) by includes of parts where
>> possible.
>>
>> To illustrate the benefits: adding a type to qapi/migration.json now
>> recompiles some 2300 instead of 4500 objects. The next commit will
>> improve it further.
>>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>
> for the record, what was your methodology?
I counted compiles like this:
$ make 2>&1 | awk '/^ [A-Z]/ { h[$1]++ } END { n = asorti(h, x); for (i = 1; i <=n; i++) print x[i], h[x[i]] }'
> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Thanks!
© 2016 - 2026 Red Hat, Inc.