[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v7 02/31] main loop: macros to mark GS and I/O functions
From: |
Emanuele Giuseppe Esposito |
Subject: |
[PATCH v7 02/31] main loop: macros to mark GS and I/O functions |
Date: |
Fri, 11 Feb 2022 09:51:24 -0500 |
Righ now, IO_CODE and IO_OR_GS_CODE are nop, as there isn't
really a way to check that a function is only called in I/O.
On the other side, we can use qemu_in_main_thread to check if
we are in the main loop.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
include/qemu/main-loop.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h
index bc42b5939d..77adc51627 100644
--- a/include/qemu/main-loop.h
+++ b/include/qemu/main-loop.h
@@ -269,6 +269,15 @@ bool qemu_mutex_iothread_locked(void);
*/
bool qemu_in_main_thread(void);
+/* Mark and check that the function is part of the global state API. */
+#define GLOBAL_STATE_CODE() assert(qemu_in_main_thread())
+
+/* Mark and check that the function is part of the I/O API. */
+#define IO_CODE() /* nop */
+
+/* Mark and check that the function is part of the "I/O OR GS" API. */
+#define IO_OR_GS_CODE() /* nop */
+
/**
* qemu_mutex_lock_iothread: Lock the main loop mutex.
*
--
2.31.1
- [PATCH v7 00/31] block layer: split block APIs in global state and I/O, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 01/31] main-loop.h: introduce qemu_in_main_thread(), Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 04/31] assertions for block global state API, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 02/31] main loop: macros to mark GS and I/O functions,
Emanuele Giuseppe Esposito <=
- [PATCH v7 12/31] assertions for block_int global state API, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 15/31] include/block/blockjob_int.h: split header into I/O and GS API, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 14/31] block: introduce assert_bdrv_graph_writable, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 11/31] include/block/block_int: split header into I/O and global state API, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 17/31] block.c: add assertions to static functions, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 22/31] include/block/snapshot: global state API + assertions, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 20/31] include/sysemu/blockdev.h: global state API, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 18/31] include/block/blockjob.h: global state API, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 13/31] IO_CODE and IO_OR_GS_CODE for block_int I/O API, Emanuele Giuseppe Esposito, 2022/02/11
- [PATCH v7 10/31] block.c: assertions to the block layer permissions API, Emanuele Giuseppe Esposito, 2022/02/11