[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 11/15] block-coroutine-wrapper.py: default to main loop aiocon
From: |
Emanuele Giuseppe Esposito |
Subject: |
[PATCH v5 11/15] block-coroutine-wrapper.py: default to main loop aiocontext if function does not have a BlockDriverState parameter |
Date: |
Wed, 23 Nov 2022 06:42:23 -0500 |
Basically BdrvPollCo->bs is only used by bdrv_poll_co(), and the
functions that it uses are both using bdrv_get_aio_context, that
defaults to qemu_get_aio_context() if bs is NULL.
Therefore pass NULL to BdrvPollCo to automatically generate a function
that create and runs a coroutine in the main loop.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
---
scripts/block-coroutine-wrapper.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/block-coroutine-wrapper.py
b/scripts/block-coroutine-wrapper.py
index 2fa3d01898..7e8f2da84b 100644
--- a/scripts/block-coroutine-wrapper.py
+++ b/scripts/block-coroutine-wrapper.py
@@ -81,8 +81,10 @@ def __init__(self, return_type: str, name: str, args: str,
bs = 'bs'
elif t == 'BdrvChild *':
bs = 'child->bs'
- else:
+ elif t == 'BlockBackend *':
bs = 'blk_bs(blk)'
+ else:
+ bs = 'NULL'
self.bs = bs
def gen_list(self, format: str) -> str:
@@ -165,8 +167,6 @@ def create_coroutine_only(func: FuncDecl) -> str:
def gen_wrapper(func: FuncDecl) -> str:
assert not '_co_' in func.name
assert func.return_type == 'int'
- assert func.args[0].type in ['BlockDriverState *', 'BdrvChild *',
- 'BlockBackend *']
name = func.co_name
struct_name = func.struct_name
--
2.31.1
- Re: [PATCH v5 07/15] block: introduce QEMU_IN_COROUTINE macro, (continued)
- [PATCH v5 10/15] block-coroutine-wrapper.py: introduce generated_co_wrapper_simple, Emanuele Giuseppe Esposito, 2022/11/23
- [PATCH v5 06/15] block: avoid duplicating filename string in bdrv_create, 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 08/15] block: distinguish between bdrv_create running in coroutine and not, 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 11/15] block-coroutine-wrapper.py: default to main loop aiocontext if function does not have a BlockDriverState parameter,
Emanuele Giuseppe Esposito <=
- [PATCH v5 15/15] block/dirty-bitmap: convert coroutine-only functions to generated_co_wrapper_simple, Emanuele Giuseppe Esposito, 2022/11/23
- [PATCH v5 14/15] block: convert bdrv_create to generated_co_wrapper_simple, Emanuele Giuseppe Esposito, 2022/11/23
- [PATCH v5 12/15] block-coroutine-wrapper.py: default to main loop aiocontext if function does not have a BlockDriverState parameter, Emanuele Giuseppe Esposito, 2022/11/23
- [PATCH v5 13/15] block-coroutine-wrapper.py: support also basic return types, Emanuele Giuseppe Esposito, 2022/11/23
- [PATCH v5 01/15] block-io: introduce coroutine_fn duplicates for bdrv_common_block_status_above callers, Emanuele Giuseppe Esposito, 2022/11/23