diff options
author | 2023-09-11 11:46:06 +0200 | |
---|---|---|
committer | 2023-09-20 17:46:01 +0200 | |
commit | d21843491ac0edca0963d35306b31e17d70e017f (patch) | |
tree | 39be1a40cb04f695eab6af3db82177ebc3abe4f2 /scripts/block-coroutine-wrapper.py | |
parent | block-coroutine-wrapper: Add no_co_wrapper_bdrv_wrlock functions (diff) | |
download | qemu-d21843491ac0edca0963d35306b31e17d70e017f.tar.xz qemu-d21843491ac0edca0963d35306b31e17d70e017f.zip |
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 <kwolf@redhat.com>
Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20230911094620.45040-8-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'scripts/block-coroutine-wrapper.py')
-rw-r--r-- | scripts/block-coroutine-wrapper.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/block-coroutine-wrapper.py b/scripts/block-coroutine-wrapper.py index fa01c06567..685d0b4ed4 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()' |