mirror of https://github.com/xemu-project/xemu.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 <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>
This commit is contained in:
parent
de90329889
commit
d21843491a
|
@ -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()'
|
||||
|
||||
|
|
Loading…
Reference in New Issue