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

@ -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