mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-28 21:03:54 -06:00
block-coroutine-wrapper: allow non bdrv_ prefix
We are going to reuse the script to generate a nbd_ function in further commit. Prepare the script now. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20210610100802.5888-28-vsementsov@virtuozzo.com> Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
43cb34dede
commit
bb43694872
1 changed files with 4 additions and 3 deletions
|
@ -98,12 +98,13 @@ def snake_to_camel(func_name: str) -> str:
|
||||||
|
|
||||||
|
|
||||||
def gen_wrapper(func: FuncDecl) -> str:
|
def gen_wrapper(func: FuncDecl) -> str:
|
||||||
assert func.name.startswith('bdrv_')
|
assert not '_co_' in func.name
|
||||||
assert not func.name.startswith('bdrv_co_')
|
|
||||||
assert func.return_type == 'int'
|
assert func.return_type == 'int'
|
||||||
assert func.args[0].type in ['BlockDriverState *', 'BdrvChild *']
|
assert func.args[0].type in ['BlockDriverState *', 'BdrvChild *']
|
||||||
|
|
||||||
name = 'bdrv_co_' + func.name[5:]
|
subsystem, subname = func.name.split('_', 1)
|
||||||
|
|
||||||
|
name = f'{subsystem}_co_{subname}'
|
||||||
bs = 'bs' if func.args[0].type == 'BlockDriverState *' else 'child->bs'
|
bs = 'bs' if func.args[0].type == 'BlockDriverState *' else 'child->bs'
|
||||||
struct_name = snake_to_camel(name)
|
struct_name = snake_to_camel(name)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue