[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 07/15] block: introduce QEMU_IN_COROUTINE macro
From: |
Emanuele Giuseppe Esposito |
Subject: |
[PATCH v5 07/15] block: introduce QEMU_IN_COROUTINE macro |
Date: |
Wed, 23 Nov 2022 06:42:19 -0500 |
This macro will be used to mark all coroutine_fn functions.
Right now, it will be used for the newly introduced coroutine_fn, since
we know the callers.
As a TODO, in the future we might want to add this macro to all
corotuine_fn functions, to be sure that they are only called in
coroutines context.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
include/block/block-common.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/block/block-common.h b/include/block/block-common.h
index 297704c1e9..24de1d63fd 100644
--- a/include/block/block-common.h
+++ b/include/block/block-common.h
@@ -34,6 +34,17 @@
#include "qemu/hbitmap.h"
#include "qemu/transactions.h"
+/*
+ * QEMU_IN_COROUTINE
+ *
+ * To be used in all coroutine_fn functions, to make sure that the caller
+ * is always a coroutine.
+ */
+#define QEMU_IN_COROUTINE() \
+ do { \
+ assert(qemu_in_coroutine()); \
+ } while (0)
+
/*
* generated_co_wrapper
*
--
2.31.1
- [PATCH v5 00/15] Still more coroutine and various fixes in block layer, Emanuele Giuseppe Esposito, 2022/11/23
- [PATCH v5 03/15] nbd/server.c: add missing coroutine_fn annotations, Emanuele Giuseppe Esposito, 2022/11/23
- [PATCH v5 09/15] block: bdrv_create_file is a coroutine_fn, Emanuele Giuseppe Esposito, 2022/11/23
- [PATCH v5 07/15] block: introduce QEMU_IN_COROUTINE macro,
Emanuele Giuseppe Esposito <=
- [PATCH v5 04/15] block-backend: replace bdrv_*_above with blk_*_above, Emanuele Giuseppe Esposito, 2022/11/23
- [PATCH v5 08/15] block: distinguish between bdrv_create running in coroutine and not, Emanuele Giuseppe Esposito, 2022/11/23
- [PATCH v5 02/15] block-copy: add missing coroutine_fn annotations, Emanuele Giuseppe Esposito, 2022/11/23
- [PATCH v5 05/15] block/vmdk: add missing coroutine_fn annotations, Emanuele Giuseppe Esposito, 2022/11/23
- [PATCH v5 06/15] block: avoid duplicating filename string in bdrv_create, Emanuele Giuseppe Esposito, 2022/11/23