Browse Source

block: reduce files included by block/aio.h

Avoid including all of qdev everywhere (the hw/core/qdev.h header in fact
brings in a lot more headers too), instead declare a couple structs for
which only a pointer type is needed.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
pull/316/head
Paolo Bonzini 4 months ago
parent
commit
238449947d
  1. 7
      include/block/aio.h
  2. 1
      include/block/block-copy.h
  3. 1
      include/block/block-global-state.h
  4. 1
      include/block/block-io.h
  5. 1
      include/block/dirty-bitmap.h
  6. 6
      include/hw/core/qdev.h
  7. 1
      include/qemu/job.h
  8. 2
      include/qemu/main-loop.h
  9. 10
      include/qemu/mem-reentrancy.h
  10. 1
      net/net.c
  11. 2
      tests/unit/ptimer-test-stubs.c
  12. 1
      util/async.c

7
include/block/aio.h

@ -23,9 +23,8 @@
#include "qemu/lockcnt.h"
#include "qemu/thread.h"
#include "qemu/timer.h"
#include "block/graph-lock.h"
#include "hw/core/qdev.h"
struct MemReentrancyGuard;
typedef struct AioHandler AioHandler;
typedef QLIST_HEAD(, AioHandler) AioHandlerList;
@ -211,7 +210,7 @@ struct AioContext {
* of nodes and edges from block graph while some
* other thread is traversing it.
*/
BdrvGraphRWlock *bdrv_graph;
struct BdrvGraphRWlock *bdrv_graph;
/* The list of registered AIO handlers. Protected by ctx->list_lock. */
AioHandlerList aio_handlers;
@ -393,7 +392,7 @@ void aio_bh_schedule_oneshot_full(AioContext *ctx, QEMUBHFunc *cb, void *opaque,
* device-reentrancy issues
*/
QEMUBH *aio_bh_new_full(AioContext *ctx, QEMUBHFunc *cb, void *opaque,
const char *name, MemReentrancyGuard *reentrancy_guard);
const char *name, struct MemReentrancyGuard *reentrancy_guard);
/**
* aio_bh_new: Allocate a new bottom half structure

1
include/block/block-copy.h

@ -16,6 +16,7 @@
#define BLOCK_COPY_H
#include "block/block-common.h"
#include "block/graph-lock.h"
#include "qemu/progress_meter.h"
/* All APIs are thread-safe */

1
include/block/block-global-state.h

@ -25,6 +25,7 @@
#define BLOCK_GLOBAL_STATE_H
#include "qemu/aiocb.h"
#include "block/graph-lock.h"
#include "block/block-common.h"
#include "qemu/coroutine.h"
#include "qemu/transactions.h"

1
include/block/block-io.h

@ -27,6 +27,7 @@
#include "qemu/aiocb.h"
#include "block/aio-wait.h"
#include "block/block-common.h"
#include "block/graph-lock.h"
#include "qemu/coroutine.h"
#include "qemu/iov.h"

1
include/block/dirty-bitmap.h

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

6
include/hw/core/qdev.h

@ -4,6 +4,7 @@
#include "qemu/atomic.h"
#include "qemu/queue.h"
#include "qemu/bitmap.h"
#include "qemu/mem-reentrancy.h"
#include "qemu/rcu.h"
#include "qemu/rcu_queue.h"
#include "qom/object.h"
@ -208,11 +209,6 @@ struct NamedClockList {
QLIST_ENTRY(NamedClockList) node;
};
typedef struct MemReentrancyGuard {
bool engaged_in_io;
} MemReentrancyGuard;
typedef QLIST_HEAD(, NamedGPIOList) NamedGPIOListHead;
typedef QLIST_HEAD(, NamedClockList) NamedClockListHead;
typedef QLIST_HEAD(, BusState) BusStateHead;

1
include/qemu/job.h

@ -32,6 +32,7 @@
#include "qemu/progress_meter.h"
#include "qemu/coroutine.h"
#include "block/aio.h"
#include "block/graph-lock.h"
typedef struct JobDriver JobDriver;
typedef struct JobTxn JobTxn;

2
include/qemu/main-loop.h

@ -431,7 +431,7 @@ void qemu_cond_timedwait_bql(QemuCond *cond, int ms);
#define qemu_bh_new(cb, opaque) \
qemu_bh_new_full((cb), (opaque), (stringify(cb)), NULL)
QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name,
MemReentrancyGuard *reentrancy_guard);
struct MemReentrancyGuard *reentrancy_guard);
void qemu_bh_schedule_idle(QEMUBH *bh);
enum {

10
include/qemu/mem-reentrancy.h

@ -0,0 +1,10 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef QEMU_MEM_REENTRANCY_H
#define QEMU_MEM_REENTRANCY_H 1
typedef struct MemReentrancyGuard {
bool engaged_in_io;
} MemReentrancyGuard;
#endif

1
net/net.c

@ -39,6 +39,7 @@
#include "qobject/qdict.h"
#include "qapi/qmp/qerror.h"
#include "qemu/error-report.h"
#include "qemu/mem-reentrancy.h"
#include "qemu/sockets.h"
#include "qemu/cutils.h"
#include "qemu/config-file.h"

2
tests/unit/ptimer-test-stubs.c

@ -108,7 +108,7 @@ int64_t qemu_clock_deadline_ns_all(QEMUClockType type, int attr_mask)
}
QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name,
MemReentrancyGuard *reentrancy_guard)
struct MemReentrancyGuard *reentrancy_guard)
{
QEMUBH *bh = g_new(QEMUBH, 1);

1
util/async.c

@ -29,6 +29,7 @@
#include "block/thread-pool.h"
#include "block/graph-lock.h"
#include "qemu/main-loop.h"
#include "qemu/mem-reentrancy.h"
#include "qemu/atomic.h"
#include "qemu/lockcnt.h"
#include "qemu/rcu_queue.h"

Loading…
Cancel
Save