include/block: Untangle inclusion loops

We have two inclusion loops:

       block/block.h
    -> block/block-global-state.h
    -> block/block-common.h
    -> block/blockjob.h
    -> block/block.h

       block/block.h
    -> block/block-io.h
    -> block/block-common.h
    -> block/blockjob.h
    -> block/block.h

I believe these go back to Emanuele's reorganization of the block API,
merged a few months ago in commit d7e2fe4aac.

Fortunately, breaking them is merely a matter of deleting unnecessary
includes from headers, and adding them back in places where they are
now missing.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20221221133551.3967339-2-armbru@redhat.com>
This commit is contained in:
Markus Armbruster 2022-12-21 14:35:49 +01:00
parent 4369560135
commit e2c1c34f13
83 changed files with 112 additions and 35 deletions

View File

@ -27,6 +27,7 @@
#include "block/trace.h"
#include "block/block_int.h"
#include "block/blockjob.h"
#include "block/dirty-bitmap.h"
#include "block/fuse.h"
#include "block/nbd.h"
#include "block/qdict.h"

View File

@ -26,6 +26,7 @@
*/
#include "qemu/osdep.h"
#include "block/block-io.h"
#include "block/block_int.h"
#include "qemu/job.h"
#include "qemu/main-loop.h"

View File

@ -20,6 +20,7 @@
#include "block/blockjob_int.h"
#include "block/block_backup.h"
#include "block/block-copy.h"
#include "block/dirty-bitmap.h"
#include "qapi/error.h"
#include "qapi/qmp/qerror.h"
#include "qemu/cutils.h"

View File

@ -27,6 +27,7 @@
#include "qapi/error.h"
#include "qemu/cutils.h"
#include "qemu/config-file.h"
#include "block/block-io.h"
#include "block/block_int.h"
#include "block/qdict.h"
#include "qemu/module.h"

View File

@ -12,6 +12,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/sockets.h" /* for EINPROGRESS on Windows */
#include "block/block-io.h"
#include "block/block_int.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qstring.h"

View File

@ -11,6 +11,7 @@
#include "qemu/osdep.h"
#include "qemu/module.h"
#include "block/block-io.h"
#include "block/block_int.h"
#include "sysemu/replay.h"
#include "qapi/error.h"

View File

@ -10,6 +10,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/sockets.h" /* for EINPROGRESS on Windows */
#include "block/block-io.h"
#include "block/block_int.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qstring.h"

View File

@ -17,10 +17,14 @@
#include "trace.h"
#include "qapi/error.h"
#include "block/block-copy.h"
#include "block/block_int-io.h"
#include "block/dirty-bitmap.h"
#include "block/reqlist.h"
#include "sysemu/block-backend.h"
#include "qemu/units.h"
#include "qemu/co-shared-resource.h"
#include "qemu/coroutine.h"
#include "qemu/ratelimit.h"
#include "block/aio_task.h"
#include "qemu/error-report.h"
#include "qemu/memalign.h"

View File

@ -24,6 +24,7 @@
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "block/block-io.h"
#include "block/block_int.h"
#include "qemu/module.h"
#include "qemu/bswap.h"

View File

@ -24,6 +24,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/error-report.h"
#include "block/block-io.h"
#include "block/block_int.h"
#include "qemu/module.h"
#include "qemu/bswap.h"

View File

@ -32,6 +32,7 @@
#include "block/block_int.h"
#include "block/qdict.h"
#include "block/block-copy.h"
#include "block/dirty-bitmap.h"
#include "block/copy-before-write.h"
#include "block/reqlist.h"

View File

@ -21,6 +21,7 @@
*/
#include "qemu/osdep.h"
#include "block/block-io.h"
#include "block/block_int.h"
#include "qemu/module.h"
#include "qapi/error.h"

View File

@ -27,6 +27,7 @@
#include "qemu/error-report.h"
#include "qemu/module.h"
#include "qemu/option.h"
#include "block/block-io.h"
#include "block/block_int.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qstring.h"

View File

@ -24,8 +24,10 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "trace.h"
#include "block/block-io.h"
#include "block/block_int.h"
#include "block/blockjob.h"
#include "block/dirty-bitmap.h"
#include "qemu/main-loop.h"
struct BdrvDirtyBitmap {

View File

@ -23,6 +23,7 @@
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "block/block-io.h"
#include "block/block_int.h"
#include "qemu/bswap.h"
#include "qemu/error-report.h"

View File

@ -21,12 +21,13 @@
#include "qemu/osdep.h"
#include "qemu/memalign.h"
#include "block/aio.h"
#include "block/block.h"
#include "block/block_int-common.h"
#include "block/export.h"
#include "block/fuse.h"
#include "block/qapi.h"
#include "qapi/error.h"
#include "qapi/qapi-commands-block.h"
#include "qemu/main-loop.h"
#include "sysemu/block-backend.h"
#include <fuse.h>

View File

@ -26,6 +26,7 @@
#include "qapi/error.h"
#include "qemu/cutils.h"
#include "qemu/error-report.h"
#include "block/block-io.h"
#include "block/block_int.h"
#include "qemu/module.h"
#include "qemu/option.h"

View File

@ -25,6 +25,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/cutils.h"
#include "block/block-io.h"
#include "block/block_int.h"
#include "qemu/module.h"
#include "qemu/option.h"

View File

@ -22,6 +22,7 @@
*/
#include "qemu/osdep.h"
#include "block/block-io.h"
#include "block/block_int.h"
#include "qemu/module.h"
#include "qapi/error.h"

View File

@ -11,6 +11,7 @@
#include "qemu/osdep.h"
#include "qemu/units.h"
#include <glusterfs/api/glfs.h>
#include "block/block-io.h"
#include "block/block_int.h"
#include "block/qdict.h"
#include "qapi/error.h"

View File

@ -30,6 +30,7 @@
#include "block/blockjob_int.h"
#include "block/block_int.h"
#include "block/coroutines.h"
#include "block/dirty-bitmap.h"
#include "block/write-threshold.h"
#include "qemu/cutils.h"
#include "qemu/memalign.h"

View File

@ -33,6 +33,7 @@
#include "qemu/error-report.h"
#include "qemu/bitops.h"
#include "qemu/bitmap.h"
#include "block/block-io.h"
#include "block/block_int.h"
#include "block/qdict.h"
#include "scsi/constants.h"

View File

@ -18,6 +18,7 @@
#include "trace.h"
#include "block/blockjob_int.h"
#include "block/block_int.h"
#include "block/dirty-bitmap.h"
#include "sysemu/block-backend.h"
#include "qapi/error.h"
#include "qapi/qmp/qerror.h"

View File

@ -32,7 +32,9 @@
#include "qemu/osdep.h"
#include "block/block-io.h"
#include "block/block_int.h"
#include "block/dirty-bitmap.h"
#include "qapi/qapi-commands-block.h"
#include "qapi/error.h"

View File

@ -30,6 +30,7 @@
#include "qemu/config-file.h"
#include "qemu/error-report.h"
#include "qapi/error.h"
#include "block/block-io.h"
#include "block/block_int.h"
#include "block/qdict.h"
#include "trace.h"

View File

@ -16,6 +16,7 @@
#include "qapi/qmp/qstring.h"
#include "qemu/module.h"
#include "qemu/option.h"
#include "block/block-io.h"
#include "block/block_int.h"
#include "sysemu/replay.h"

View File

@ -23,6 +23,7 @@
#include "qemu/option.h"
#include "qemu/memalign.h"
#include "qemu/vfio-helpers.h"
#include "block/block-io.h"
#include "block/block_int.h"
#include "sysemu/replay.h"
#include "trace.h"

View File

@ -25,7 +25,9 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "block/block-io.h"
#include "block/block_int.h"
#include "block/dirty-bitmap.h"
#include "parallels.h"
#include "crypto/hash.h"
#include "qemu/uuid.h"

View File

@ -30,6 +30,7 @@
#include "qemu/module.h"
#include "qemu/option.h"
#include "qemu/units.h"
#include "block/block-io.h"
#include "block/block_int.h"

View File

@ -32,6 +32,7 @@
#include "qemu/osdep.h"
#include "block/block_int.h"
#include "qapi/error.h"
#include "qapi/qapi-commands-block.h"
#include "qapi/qmp/qdict.h"

View File

@ -26,6 +26,7 @@
#include "qemu/cutils.h"
#include "block/qapi.h"
#include "block/block_int.h"
#include "block/dirty-bitmap.h"
#include "block/throttle-groups.h"
#include "block/write-threshold.h"
#include "qapi/error.h"

View File

@ -26,6 +26,8 @@
*/
#include "qemu/osdep.h"
#include "block/block-io.h"
#include "block/dirty-bitmap.h"
#include "qapi/error.h"
#include "qemu/cutils.h"

View File

@ -23,6 +23,7 @@
*/
#include "qemu/osdep.h"
#include "block/block-io.h"
#include "qemu/memalign.h"
#include "qcow2.h"
#include "trace.h"

View File

@ -25,6 +25,7 @@
#include "qemu/osdep.h"
#include <zlib.h>
#include "block/block-io.h"
#include "qapi/error.h"
#include "qcow2.h"
#include "qemu/bswap.h"

View File

@ -23,6 +23,7 @@
*/
#include "qemu/osdep.h"
#include "block/block-io.h"
#include "qapi/error.h"
#include "qcow2.h"
#include "qemu/range.h"

View File

@ -34,6 +34,7 @@
#endif
#include "qcow2.h"
#include "block/block-io.h"
#include "block/thread-pool.h"
#include "crypto.h"

View File

@ -43,6 +43,7 @@
#include "qapi/qapi-visit-block-core.h"
#include "crypto.h"
#include "block/aio_task.h"
#include "block/dirty-bitmap.h"
/*
Differences with QCOW:

View File

@ -12,6 +12,7 @@
*/
#include "qemu/osdep.h"
#include "block/block-io.h"
#include "qed.h"
typedef struct {

View File

@ -13,6 +13,7 @@
*/
#include "qemu/osdep.h"
#include "block/block-io.h"
#include "trace.h"
#include "qemu/sockets.h" /* for EINPROGRESS on Windows */
#include "qed.h"

View File

@ -27,6 +27,7 @@
*/
#include "qemu/osdep.h"
#include "block/block-io.h"
#include "block/block_int.h"
#include "qapi/error.h"
#include "qemu/module.h"

View File

@ -18,6 +18,7 @@
#include "qemu/error-report.h"
#include "qemu/module.h"
#include "qemu/option.h"
#include "block/block-io.h"
#include "block/block_int.h"
#include "block/qdict.h"
#include "crypto/secret.h"

View File

@ -27,6 +27,7 @@
#include <libssh/libssh.h>
#include <libssh/sftp.h>
#include "block/block-io.h"
#include "block/block_int.h"
#include "block/qdict.h"
#include "qapi/error.h"

View File

@ -18,6 +18,8 @@
*/
#include "qemu/osdep.h"
#include "block/block-io.h"
#include "block/block_int.h"
#include "block/throttle-groups.h"
#include "qemu/module.h"
#include "qemu/option.h"

View File

@ -20,6 +20,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "block/block-io.h"
#include "block/block_int.h"
#include "qemu/error-report.h"
#include "qemu/bswap.h"

View File

@ -27,6 +27,7 @@
#include <dirent.h>
#include <glib/gstdio.h>
#include "qapi/error.h"
#include "block/block-io.h"
#include "block/block_int.h"
#include "block/qdict.h"
#include "qemu/module.h"

View File

@ -24,6 +24,7 @@
#include "qemu/osdep.h"
#include "qemu/timer.h"
#include "block/block-io.h"
#include "block/block_int.h"
#include "block/aio.h"
#include "block/raw-aio.h"

View File

@ -11,6 +11,7 @@
*/
#include "qemu/osdep.h"
#include "block/block-io.h"
#include "block/block_int.h"
#include "block/write-threshold.h"
#include "qapi/error.h"

View File

@ -35,6 +35,7 @@
#include "sysemu/blockdev.h"
#include "hw/block/block.h"
#include "block/blockjob.h"
#include "block/dirty-bitmap.h"
#include "block/qdict.h"
#include "block/throttle-groups.h"
#include "monitor/monitor.h"

View File

@ -24,6 +24,7 @@
*/
#include "qemu/osdep.h"
#include "block/aio-wait.h"
#include "block/block.h"
#include "block/blockjob_int.h"
#include "block/block_int.h"

View File

@ -8,6 +8,7 @@
*/
#include "qemu/osdep.h"
#include "block/block_int-common.h"
#include "sysemu/blockdev.h"
#include "sysemu/block-backend.h"
#include "hw/block/block.h"

View File

@ -23,6 +23,7 @@
*/
#include "qemu/osdep.h"
#include "block/block_int-common.h"
#include "qemu/units.h"
#include "cpu.h"
#include "hw/boards.h"

View File

@ -14,6 +14,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/error-report.h"
#include "qemu/iov.h"
#include "qemu/main-loop.h"
#include "hw/virtio/virtio-pmem.h"
#include "hw/qdev-properties.h"

View File

@ -24,12 +24,8 @@
#ifndef BLOCK_COMMON_H
#define BLOCK_COMMON_H
#include "block/aio.h"
#include "block/aio-wait.h"
#include "qemu/iov.h"
#include "block/accounting.h"
#include "qemu/hbitmap.h"
#include "qemu/transactions.h"
#include "qapi/qapi-types-block-core.h"
#include "qemu/queue.h"
/*
* co_wrapper{*}: Function specifiers used by block-coroutine-wrapper.py
@ -55,7 +51,6 @@
#define co_wrapper_bdrv_rdlock
#define co_wrapper_mixed_bdrv_rdlock
#include "block/dirty-bitmap.h"
#include "block/blockjob.h"
/* block.c */

View File

@ -15,8 +15,8 @@
#ifndef BLOCK_COPY_H
#define BLOCK_COPY_H
#include "block/block.h"
#include "qemu/co-shared-resource.h"
#include "block/block-common.h"
#include "qemu/progress_meter.h"
/* All APIs are thread-safe */

View File

@ -24,7 +24,9 @@
#ifndef BLOCK_GLOBAL_STATE_H
#define BLOCK_GLOBAL_STATE_H
#include "block-common.h"
#include "block/block-common.h"
#include "qemu/coroutine.h"
#include "qemu/transactions.h"
/*
* Global state (GS) API. These functions run under the BQL.

View File

@ -15,6 +15,8 @@
#ifndef BLOCK_BLOCK_HMP_CMDS_H
#define BLOCK_BLOCK_HMP_CMDS_H
#include "qemu/coroutine.h"
void hmp_drive_add(Monitor *mon, const QDict *qdict);
void hmp_commit(Monitor *mon, const QDict *qdict);

View File

@ -24,7 +24,10 @@
#ifndef BLOCK_IO_H
#define BLOCK_IO_H
#include "block-common.h"
#include "block/aio-wait.h"
#include "block/block-common.h"
#include "qemu/coroutine.h"
#include "qemu/iov.h"
/*
* I/O API functions. These functions are thread-safe, and therefore

View File

@ -24,8 +24,8 @@
#ifndef BLOCK_H
#define BLOCK_H
#include "block-global-state.h"
#include "block-io.h"
#include "block/block-global-state.h"
#include "block/block-io.h"
/* DO NOT ADD ANYTHING IN HERE. USE ONE OF THE HEADERS INCLUDED ABOVE */

View File

@ -18,7 +18,7 @@
#ifndef BLOCK_BACKUP_H
#define BLOCK_BACKUP_H
#include "block/block_int.h"
#include "block/blockjob.h"
void backup_do_checkpoint(BlockJob *job, Error **errp);

View File

@ -24,17 +24,13 @@
#ifndef BLOCK_INT_COMMON_H
#define BLOCK_INT_COMMON_H
#include "block/accounting.h"
#include "block/block.h"
#include "block/aio-wait.h"
#include "qemu/queue.h"
#include "qemu/coroutine.h"
#include "qemu/stats64.h"
#include "qemu/timer.h"
#include "qemu/hbitmap.h"
#include "block/aio.h"
#include "block/block-common.h"
#include "block/block-global-state.h"
#include "block/snapshot.h"
#include "qemu/throttle.h"
#include "qemu/iov.h"
#include "qemu/rcu.h"
#include "qemu/stats64.h"
#define BLOCK_FLAG_LAZY_REFCOUNTS 8

View File

@ -25,7 +25,10 @@
#ifndef BLOCK_INT_GLOBAL_STATE_H
#define BLOCK_INT_GLOBAL_STATE_H
#include "block_int-common.h"
#include "block/blockjob.h"
#include "block/block_int-common.h"
#include "qemu/hbitmap.h"
#include "qemu/main-loop.h"
/*
* Global state (GS) API. These functions run under the BQL.

View File

@ -24,7 +24,9 @@
#ifndef BLOCK_INT_IO_H
#define BLOCK_INT_IO_H
#include "block_int-common.h"
#include "block/block_int-common.h"
#include "qemu/hbitmap.h"
#include "qemu/main-loop.h"
/*
* I/O API functions. These functions are thread-safe.

View File

@ -24,8 +24,8 @@
#ifndef BLOCK_INT_H
#define BLOCK_INT_H
#include "block_int-global-state.h"
#include "block_int-io.h"
#include "block/block_int-global-state.h"
#include "block/block_int-io.h"
#include "block/graph-lock.h"
/* DO NOT ADD ANYTHING IN HERE. USE ONE OF THE HEADERS INCLUDED ABOVE */

View File

@ -26,8 +26,8 @@
#ifndef BLOCKJOB_H
#define BLOCKJOB_H
#include "qapi/qapi-types-block-core.h"
#include "qemu/job.h"
#include "block/block.h"
#include "qemu/ratelimit.h"
#define BLOCK_JOB_SLICE_TIME 100000000ULL /* ns */

View File

@ -27,7 +27,6 @@
#define BLOCKJOB_INT_H
#include "block/blockjob.h"
#include "block/block.h"
/**
* BlockJobDriver:

View File

@ -1,6 +1,7 @@
#ifndef BLOCK_DIRTY_BITMAP_H
#define BLOCK_DIRTY_BITMAP_H
#include "block/block-common.h"
#include "qapi/qapi-types-block-core.h"
#include "qemu/hbitmap.h"

View File

@ -25,8 +25,8 @@
#ifndef BLOCK_QAPI_H
#define BLOCK_QAPI_H
#include "block/block.h"
#include "block/snapshot.h"
#include "qapi/qapi-types-block-core.h"
BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk,
BlockDriverState *bs,

View File

@ -18,7 +18,7 @@
#ifndef QEMU_THREAD_POOL_H
#define QEMU_THREAD_POOL_H
#include "block/block.h"
#include "block/aio.h"
#define THREAD_POOL_MAX_THREADS_DEFAULT 64

View File

@ -25,8 +25,8 @@
#ifndef THROTTLE_GROUPS_H
#define THROTTLE_GROUPS_H
#include "qemu/coroutine.h"
#include "qemu/throttle.h"
#include "block/block_int.h"
#include "qom/object.h"
/* The ThrottleGroupMember structure indicates membership in a ThrottleGroup

View File

@ -14,6 +14,7 @@
#define BLOCK_BACKEND_IO_H
#include "block-backend-common.h"
#include "block/accounting.h"
/*
* I/O API functions. These functions are thread-safe.

View File

@ -61,6 +61,7 @@
#include "qemu/osdep.h"
#include "block/block.h"
#include "block/block_int.h"
#include "block/dirty-bitmap.h"
#include "sysemu/block-backend.h"
#include "sysemu/runstate.h"
#include "qemu/main-loop.h"

View File

@ -20,6 +20,7 @@
#include "qemu/cutils.h"
#include "qemu/queue.h"
#include "block.h"
#include "block/dirty-bitmap.h"
#include "migration/misc.h"
#include "migration.h"
#include "migration/register.h"

View File

@ -52,6 +52,7 @@
#include "exec/target_page.h"
#include "trace.h"
#include "qemu/iov.h"
#include "qemu/job.h"
#include "qemu/main-loop.h"
#include "block/snapshot.h"
#include "qemu/cutils.h"

View File

@ -14,6 +14,7 @@
*/
#include "qemu/osdep.h"
#include "block/blockjob.h"
#include "qemu/cutils.h"
#include "qemu/option.h"
#include "monitor/monitor.h"

View File

@ -19,7 +19,9 @@
#include "qemu/osdep.h"
#include "block/block_int.h"
#include "block/export.h"
#include "block/dirty-bitmap.h"
#include "qapi/error.h"
#include "qemu/queue.h"
#include "trace.h"

View File

@ -48,6 +48,7 @@
#include "sysemu/block-backend.h"
#include "block/block_int.h"
#include "block/blockjob.h"
#include "block/dirty-bitmap.h"
#include "block/qapi.h"
#include "crypto/init.h"
#include "trace/control.h"

View File

@ -42,7 +42,8 @@ def gen_header():
#include "qemu/osdep.h"
#include "block/coroutines.h"
#include "block/block-gen.h"
#include "block/block_int.h"\
#include "block/block_int.h"
#include "block/dirty-bitmap.h"
"""

View File

@ -34,6 +34,7 @@
#include "sysemu/hw_accel.h"
#include "exec/cpu-common.h"
#include "qemu/thread.h"
#include "qemu/main-loop.h"
#include "qemu/plugin.h"
#include "sysemu/cpus.h"
#include "qemu/guest-random.h"

View File

@ -23,6 +23,7 @@
#include "qemu/cutils.h"
#include "qemu/cacheflush.h"
#include "qemu/hbitmap.h"
#include "qemu/madvise.h"
#ifdef CONFIG_TCG

View File

@ -48,6 +48,7 @@
#include "qemu/config-file.h"
#include "qemu/error-report.h"
#include "qemu/help_option.h"
#include "qemu/job.h"
#include "qemu/log.h"
#include "qemu/main-loop.h"
#include "qemu/module.h"

View File

@ -37,6 +37,7 @@
#include "exec/gdbstub.h"
#include "qemu/host-utils.h"
#include "qemu/main-loop.h"
#include "qemu/ratelimit.h"
#include "qemu/config-file.h"
#include "qemu/error-report.h"
#include "qemu/memalign.h"

View File

@ -23,7 +23,7 @@
*/
#include "qemu/osdep.h"
#include "block/block.h"
#include "block/block_int.h"
#include "block/blockjob_int.h"
#include "sysemu/block-backend.h"
#include "qapi/error.h"

View File

@ -24,6 +24,7 @@
#include "qemu/osdep.h"
#include "block/block.h"
#include "block/block_int-global-state.h"
#include "block/blockjob_int.h"
#include "sysemu/block-backend.h"
#include "qapi/error.h"