From: Kevin Wolf Date: Mon, 11 Sep 2023 09:46:06 +0000 (+0200) Subject: block-coroutine-wrapper: Allow arbitrary parameter names X-Git-Tag: v8.2.0-rc0~115^2~21 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d21843491ac0edca0963d35306b31e17d70e017f;p=thirdparty%2Fqemu.git block-coroutine-wrapper: Allow arbitrary parameter names Don't assume specific parameter names like 'bs' or 'blk' in the generated code, but use the actual name. Signed-off-by: Kevin Wolf Reviewed-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi Message-ID: <20230911094620.45040-8-kwolf@redhat.com> Signed-off-by: Kevin Wolf --- diff --git a/scripts/block-coroutine-wrapper.py b/scripts/block-coroutine-wrapper.py index fa01c065678..685d0b4ed41 100644 --- a/scripts/block-coroutine-wrapper.py +++ b/scripts/block-coroutine-wrapper.py @@ -105,12 +105,13 @@ class FuncDecl: def gen_ctx(self, prefix: str = '') -> str: t = self.args[0].type + name = self.args[0].name if t == 'BlockDriverState *': - return f'bdrv_get_aio_context({prefix}bs)' + return f'bdrv_get_aio_context({prefix}{name})' elif t == 'BdrvChild *': - return f'bdrv_get_aio_context({prefix}child->bs)' + return f'bdrv_get_aio_context({prefix}{name}->bs)' elif t == 'BlockBackend *': - return f'blk_get_aio_context({prefix}blk)' + return f'blk_get_aio_context({prefix}{name})' else: return 'qemu_get_aio_context()'