mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
block-coroutine-wrapper.py: support BlockBackend first argument
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Message-Id: <20211006131718.214235-7-vsementsov@virtuozzo.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
70e8775ed9
commit
7d55a3bbad
2 changed files with 13 additions and 2 deletions
|
@ -100,12 +100,20 @@ def snake_to_camel(func_name: str) -> 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 *']
|
||||
assert func.args[0].type in ['BlockDriverState *', 'BdrvChild *',
|
||||
'BlockBackend *']
|
||||
|
||||
subsystem, subname = func.name.split('_', 1)
|
||||
|
||||
name = f'{subsystem}_co_{subname}'
|
||||
bs = 'bs' if func.args[0].type == 'BlockDriverState *' else 'child->bs'
|
||||
|
||||
t = func.args[0].type
|
||||
if t == 'BlockDriverState *':
|
||||
bs = 'bs'
|
||||
elif t == 'BdrvChild *':
|
||||
bs = 'child->bs'
|
||||
else:
|
||||
bs = 'blk_bs(blk)'
|
||||
struct_name = snake_to_camel(name)
|
||||
|
||||
return f"""\
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue