aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/block-coroutine-wrapper.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/scripts/block-coroutine-wrapper.py b/scripts/block-coroutine-wrapper.py
index 2090c3bf73..f540003af1 100644
--- a/scripts/block-coroutine-wrapper.py
+++ b/scripts/block-coroutine-wrapper.py
@@ -75,12 +75,14 @@ class FuncDecl:
t = self.args[0].type
if t == 'BlockDriverState *':
- bs = 'bs'
+ ctx = 'bdrv_get_aio_context(bs)'
elif t == 'BdrvChild *':
- bs = 'child->bs'
+ ctx = 'bdrv_get_aio_context(child->bs)'
+ elif t == 'BlockBackend *':
+ ctx = 'blk_get_aio_context(blk)'
else:
- bs = 'blk_bs(blk)'
- self.bs = bs
+ ctx = 'qemu_get_aio_context()'
+ self.ctx = ctx
def gen_list(self, format: str) -> str:
return ', '.join(format.format_map(arg.__dict__) for arg in self.args)
@@ -127,7 +129,7 @@ int {func.name}({ func.gen_list('{decl}') })
return {name}({ func.gen_list('{name}') });
}} else {{
{struct_name} s = {{
- .poll_state.bs = {func.bs},
+ .poll_state.ctx = {func.ctx},
.poll_state.in_progress = true,
{ func.gen_block(' .{name} = {name},') }
@@ -150,7 +152,7 @@ def create_co_wrapper(func: FuncDecl) -> str:
int {func.name}({ func.gen_list('{decl}') })
{{
{struct_name} s = {{
- .poll_state.bs = {func.bs},
+ .poll_state.ctx = {func.ctx},
.poll_state.in_progress = true,
{ func.gen_block(' .{name} = {name},') }
@@ -166,8 +168,6 @@ int {func.name}({ func.gen_list('{decl}') })
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 *',
- 'BlockBackend *']
name = func.co_name
struct_name = func.struct_name