Skip to content

Commit

Permalink
include/qemu/osdep.h: Don't include qapi/error.h
Browse files Browse the repository at this point in the history
Commit 57cb38b included qapi/error.h into qemu/osdep.h to get the
Error typedef.  Since then, we've moved to include qemu/osdep.h
everywhere.  Its file comment explains: "To avoid getting into
possible circular include dependencies, this file should not include
any other QEMU headers, with the exceptions of config-host.h,
compiler.h, os-posix.h and os-win32.h, all of which are doing a
similar job to this file and are under similar constraints."
qapi/error.h doesn't do a similar job, and it doesn't adhere to
similar constraints: it includes qapi-types.h.  That's in excess of
100KiB of crap most .c files don't actually need.

Add the typedef to qemu/typedefs.h, and include that instead of
qapi/error.h.  Include qapi/error.h in .c files that need it and don't
get it now.  Include qapi-types.h in qom/object.h for uint16List.

Update scripts/clean-includes accordingly.  Update it further to match
reality: replace config.h by config-target.h, add sysemu/os-posix.h,
sysemu/os-win32.h.  Update the list of includes in the qemu/osdep.h
comment quoted above similarly.

This reduces the number of objects depending on qapi/error.h from "all
of them" to less than a third.  Unfortunately, the number depending on
qapi-types.h shrinks only a little.  More work is needed for that one.

Signed-off-by: Markus Armbruster <[email protected]>
[Fix compilation without the spice devel packages. - Paolo]
Signed-off-by: Paolo Bonzini <[email protected]>
  • Loading branch information
Markus Armbruster authored and bonzini committed Mar 22, 2016
1 parent 4829e03 commit da34e65
Show file tree
Hide file tree
Showing 392 changed files with 399 additions and 15 deletions.
1 change: 1 addition & 0 deletions async.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "block/aio.h"
#include "block/thread-pool.h"
Expand Down
1 change: 1 addition & 0 deletions backends/baum.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* THE SOFTWARE.
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "sysemu/char.h"
#include "qemu/timer.h"
Expand Down
1 change: 1 addition & 0 deletions backends/hostmem-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* See the COPYING file in the top-level directory.
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "sysemu/hostmem.h"
#include "sysemu/sysemu.h"
Expand Down
1 change: 1 addition & 0 deletions backends/hostmem-ram.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
#include "sysemu/hostmem.h"
#include "qapi/error.h"
#include "qom/object_interfaces.h"

#define TYPE_MEMORY_BACKEND_RAM "memory-backend-ram"
Expand Down
1 change: 1 addition & 0 deletions backends/hostmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "qemu/osdep.h"
#include "sysemu/hostmem.h"
#include "hw/boards.h"
#include "qapi/error.h"
#include "qapi/visitor.h"
#include "qapi-types.h"
#include "qapi-visit.h"
Expand Down
1 change: 1 addition & 0 deletions backends/rng-egd.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "qemu/osdep.h"
#include "sysemu/rng.h"
#include "sysemu/char.h"
#include "qapi/error.h"
#include "qapi/qmp/qerror.h"
#include "hw/qdev.h" /* just for DEFINE_PROP_CHR */

Expand Down
1 change: 1 addition & 0 deletions backends/rng-random.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "qemu/osdep.h"
#include "sysemu/rng-random.h"
#include "sysemu/rng.h"
#include "qapi/error.h"
#include "qapi/qmp/qerror.h"
#include "qemu/main-loop.h"

Expand Down
1 change: 1 addition & 0 deletions backends/rng.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include "qemu/osdep.h"
#include "sysemu/rng.h"
#include "qapi/error.h"
#include "qapi/qmp/qerror.h"
#include "qom/object_interfaces.h"

Expand Down
1 change: 1 addition & 0 deletions backends/tpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "qemu/osdep.h"
#include "sysemu/tpm_backend.h"
#include "qapi/error.h"
#include "qapi/qmp/qerror.h"
#include "sysemu/tpm.h"
#include "qemu/thread.h"
Expand Down
1 change: 1 addition & 0 deletions block/backup.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "block/block.h"
#include "block/block_int.h"
#include "block/blockjob.h"
#include "qapi/error.h"
#include "qapi/qmp/qerror.h"
#include "qemu/ratelimit.h"
#include "sysemu/block-backend.h"
Expand Down
1 change: 1 addition & 0 deletions block/blkdebug.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "qemu/config-file.h"
#include "block/block_int.h"
Expand Down
1 change: 1 addition & 0 deletions block/blkverify.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/sockets.h" /* for EINPROGRESS on Windows */
#include "block/block_int.h"
#include "qapi/qmp/qdict.h"
Expand Down
1 change: 1 addition & 0 deletions block/bochs.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* THE SOFTWARE.
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "block/block_int.h"
#include "qemu/module.h"
Expand Down
1 change: 1 addition & 0 deletions block/cloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* THE SOFTWARE.
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "block/block_int.h"
#include "qemu/module.h"
Expand Down
1 change: 1 addition & 0 deletions block/commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "trace.h"
#include "block/block_int.h"
#include "block/blockjob.h"
#include "qapi/error.h"
#include "qapi/qmp/qerror.h"
#include "qemu/ratelimit.h"
#include "sysemu/block-backend.h"
Expand Down
1 change: 1 addition & 0 deletions block/curl.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* THE SOFTWARE.
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "qemu/error-report.h"
#include "block/block_int.h"
Expand Down
2 changes: 1 addition & 1 deletion block/dirty-bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* THE SOFTWARE.
*/
#include "qemu/osdep.h"
#include "config-host.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "trace.h"
#include "block/block_int.h"
Expand Down
1 change: 1 addition & 0 deletions block/dmg.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* THE SOFTWARE.
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "block/block_int.h"
#include "qemu/bswap.h"
Expand Down
1 change: 1 addition & 0 deletions block/gluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "qemu/osdep.h"
#include <glusterfs/api/glfs.h>
#include "block/block_int.h"
#include "qapi/error.h"
#include "qemu/uri.h"

typedef struct GlusterAIOCB {
Expand Down
1 change: 1 addition & 0 deletions block/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "block/blockjob.h"
#include "block/block_int.h"
#include "block/throttle-groups.h"
#include "qapi/error.h"
#include "qemu/error-report.h"

#define NOT_DONE 0x7fffffff /* used while emulated sync operation in progress */
Expand Down
1 change: 1 addition & 0 deletions block/mirror.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "block/blockjob.h"
#include "block/block_int.h"
#include "sysemu/block-backend.h"
#include "qapi/error.h"
#include "qapi/qmp/qerror.h"
#include "qemu/ratelimit.h"
#include "qemu/bitmap.h"
Expand Down
1 change: 1 addition & 0 deletions block/nbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include "qemu/osdep.h"
#include "block/nbd-client.h"
#include "qapi/error.h"
#include "qemu/uri.h"
#include "block/block_int.h"
#include "qemu/module.h"
Expand Down
1 change: 1 addition & 0 deletions block/null.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "block/block_int.h"

#define NULL_OPT_LATENCY "latency-ns"
Expand Down
1 change: 1 addition & 0 deletions block/parallels.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* THE SOFTWARE.
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "block/block_int.h"
#include "sysemu/block-backend.h"
Expand Down
1 change: 1 addition & 0 deletions block/qcow.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* THE SOFTWARE.
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "block/block_int.h"
#include "sysemu/block-backend.h"
Expand Down
1 change: 1 addition & 0 deletions block/qcow2-cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "qemu/osdep.h"
#include <zlib.h>

#include "qapi/error.h"
#include "qemu-common.h"
#include "block/block_int.h"
#include "block/qcow2.h"
Expand Down
1 change: 1 addition & 0 deletions block/qcow2-refcount.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "block/block_int.h"
#include "block/qcow2.h"
Expand Down
1 change: 1 addition & 0 deletions block/qcow2-snapshot.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "block/block_int.h"
#include "block/qcow2.h"
Expand Down
1 change: 1 addition & 0 deletions block/qed.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/timer.h"
#include "trace.h"
#include "qed.h"
Expand Down
1 change: 1 addition & 0 deletions block/raw-posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* THE SOFTWARE.
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "qemu/error-report.h"
#include "qemu/timer.h"
Expand Down
1 change: 1 addition & 0 deletions block/raw-win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* THE SOFTWARE.
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "qemu/timer.h"
#include "block/block_int.h"
Expand Down
1 change: 1 addition & 0 deletions block/raw_bsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include "qemu/osdep.h"
#include "block/block_int.h"
#include "qapi/error.h"
#include "qemu/option.h"

static QemuOptsList raw_create_opts = {
Expand Down
1 change: 1 addition & 0 deletions block/rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include "qemu/osdep.h"

#include "qapi/error.h"
#include "qemu-common.h"
#include "qemu/error-report.h"
#include "block/block_int.h"
Expand Down
1 change: 1 addition & 0 deletions block/sheepdog.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "qemu/uri.h"
#include "qemu/error-report.h"
Expand Down
1 change: 1 addition & 0 deletions block/snapshot.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "qemu/osdep.h"
#include "block/snapshot.h"
#include "block/block_int.h"
#include "qapi/error.h"
#include "qapi/qmp/qerror.h"

QemuOptsList internal_snapshot_opts = {
Expand Down
1 change: 1 addition & 0 deletions block/ssh.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <libssh2_sftp.h>

#include "block/block_int.h"
#include "qapi/error.h"
#include "qemu/error-report.h"
#include "qemu/sockets.h"
#include "qemu/uri.h"
Expand Down
1 change: 1 addition & 0 deletions block/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "trace.h"
#include "block/block_int.h"
#include "block/blockjob.h"
#include "qapi/error.h"
#include "qapi/qmp/qerror.h"
#include "qemu/ratelimit.h"
#include "sysemu/block-backend.h"
Expand Down
1 change: 1 addition & 0 deletions block/vdi.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
*/

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "block/block_int.h"
#include "sysemu/block-backend.h"
Expand Down
1 change: 1 addition & 0 deletions block/vhdx-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "block/block_int.h"
#include "qemu/error-report.h"
Expand Down
1 change: 1 addition & 0 deletions block/vhdx.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "block/block_int.h"
#include "sysemu/block-backend.h"
Expand Down
1 change: 1 addition & 0 deletions block/vmdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "block/block_int.h"
#include "sysemu/block-backend.h"
Expand Down
1 change: 1 addition & 0 deletions block/vpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* THE SOFTWARE.
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"
#include "block/block_int.h"
#include "sysemu/block-backend.h"
Expand Down
1 change: 1 addition & 0 deletions block/vvfat.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/
#include "qemu/osdep.h"
#include <dirent.h>
#include "qapi/error.h"
#include "qemu-common.h"
#include "block/block_int.h"
#include "qemu/module.h"
Expand Down
1 change: 1 addition & 0 deletions bootdevice.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "sysemu/sysemu.h"
#include "qapi/visitor.h"
#include "qemu/error-report.h"
Expand Down
1 change: 1 addition & 0 deletions contrib/ivshmem-server/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu-common.h"

#include "ivshmem-server.h"
Expand Down
1 change: 1 addition & 0 deletions crypto/block-luks.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

#include "qemu/osdep.h"
#include "qapi/error.h"

#include "crypto/block-luks.h"

Expand Down
1 change: 1 addition & 0 deletions crypto/block-qcow.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/

#include "qemu/osdep.h"
#include "qapi/error.h"

#include "crypto/block-qcow.h"
#include "crypto/secret.h"
Expand Down
1 change: 1 addition & 0 deletions crypto/block.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "crypto/blockpriv.h"
#include "crypto/block-qcow.h"
#include "crypto/block-luks.h"
Expand Down
1 change: 1 addition & 0 deletions crypto/cipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

#include "qemu/osdep.h"
#include "qapi/error.h"
#include "crypto/cipher.h"


Expand Down
Loading

0 comments on commit da34e65

Please sign in to comment.