aboutsummaryrefslogtreecommitdiff
path: root/scripts/block-coroutine-wrapper.py
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2021-10-06 15:17:12 +0200
committerEric Blake <eblake@redhat.com>2021-10-15 15:51:33 -0500
commit7d55a3bbadc0b00ff6c2a4f37116db887caec7ab (patch)
tree63166ed3b5f9c2e4a3026c5e2b8f9981af604e78 /scripts/block-coroutine-wrapper.py
parent70e8775ed9e46cb4fab8013627df4dd835a1c24c (diff)
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>
Diffstat (limited to 'scripts/block-coroutine-wrapper.py')
-rw-r--r--scripts/block-coroutine-wrapper.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/scripts/block-coroutine-wrapper.py b/scripts/block-coroutine-wrapper.py
index 85dbeb9ecf..08be813407 100644
--- a/scripts/block-coroutine-wrapper.py
+++ b/scripts/block-coroutine-wrapper.py
@@ -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"""\