|
@@ -75,12 +75,14 @@ def __init__(self, return_type: str, name: str, args: str,
|
|
|
|
|
|
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 @@ def create_mixed_wrapper(func: FuncDecl) -> str:
|
|
|
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 @@ def create_co_wrapper(func: FuncDecl) -> 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 *',
|
|
|
- 'BlockBackend *']
|
|
|
|
|
|
name = func.co_name
|
|
|
struct_name = func.struct_name
|