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 <eespo...@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