]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
block: reduce files included by block/aio.h
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 3 Dec 2025 11:09:49 +0000 (12:09 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 27 Dec 2025 09:11:12 +0000 (10:11 +0100)
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>
12 files changed:
include/block/aio.h
include/block/block-copy.h
include/block/block-global-state.h
include/block/block-io.h
include/block/dirty-bitmap.h
include/hw/core/qdev.h
include/qemu/job.h
include/qemu/main-loop.h
include/qemu/mem-reentrancy.h [new file with mode: 0644]
net/net.c
tests/unit/ptimer-test-stubs.c
util/async.c

index 59c56d695ee2d63f76580f4ab8b4b53f6041d3ba..8cca2360d1a19b9d39eff3f1d627521a4c3feaef 100644 (file)
@@ -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
index dd5cc82f3b2cfc9fc7ef6f1c93bf5c8df5bbdd70..0df2771181bd515a68b14b3e59ae47e899125eb8 100644 (file)
@@ -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 */
index c2127f17249e2dc357bd4d6a421f15b727308cb5..ed89999f0fbcb5cf6792964d671b00f9b9d4ab51 100644 (file)
@@ -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"
index e5efe0efb2fcfe681d650fc028ce5b5a86af8deb..7925e2241e69f40163cecaeb6a31413b470f16e2 100644 (file)
@@ -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"
 
index fa956debfb2883e721142fafe5c2f1941fca621c..28029bbc2bc53c33b3c282846be305602f400994 100644 (file)
@@ -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"
 
index e211d807e82b043e6cd5eda5a47fa61ab1ea59d2..4b2730e9d8e8fadaa8d258c70746563ccda01a23 100644 (file)
@@ -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;
index af29b8c65310a181438edaa972678e523dfc6ab6..2b163602c56ccb503da8855218b21ccddc3d32d2 100644 (file)
@@ -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;
index 0d55c636b21a9443aedcd20f1e7fbe025e54a425..241dc87be503ae248361277f5ce3131c6e00aabd 100644 (file)
@@ -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 {
diff --git a/include/qemu/mem-reentrancy.h b/include/qemu/mem-reentrancy.h
new file mode 100644 (file)
index 0000000..07cafd4
--- /dev/null
@@ -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
index 4930b573ed34f24a7035d3749ced8dd2fd8f249f..a176936f9bcff0126bfecba3d884d9bb4f1b2072 100644 (file)
--- a/net/net.c
+++ b/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"
index 8c9407c560a3c03bffa6b758da0afbaf6ab244e7..da46dda32d2e69f12a4ce531a91806ee07b027d0 100644 (file)
@@ -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);
 
index 48f88286369bdf4dc6d4f0d0d3e7f3023bc396f3..39f391fb71a00bcb9317412f4c0f2748901c6ab7 100644 (file)
@@ -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"