Lines Matching +full:0 +full:- +full:9 +full:a +full:- +full:f

8 Usage: block-coroutine-wrapper.py generated-file.c FILE.[ch]...
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 You should have received a copy of the GNU General Public License
35 return f"""\
37 * File is generated by scripts/block-coroutine-wrapper.py
44 #include "block/block-gen.h"
46 #include "block/dirty-bitmap.h"
53 r'(?P<name>[a-z][a-z0-9_]*)'
56 def __init__(self, param_decl: str) -> None:
59 raise ValueError(f'Wrong parameter declaration: "{param_decl}"')
67 args: str, variant: str) -> None:
80 raise ValueError(f"co function can't be wrlock: {self.name}")
82 self.target_name = f'{subsystem}_co_{subname}'
87 raise ValueError(f"Invalid no_co function name: {self.name}")
89 raise ValueError(f"no_co function can't be mixed: {self.name}")
92 f"{self.name}")
93 self.target_name = f'{subsystem}_{subname}'
95 self.get_result = 's->ret = '
105 def gen_ctx(self, prefix: str = '') -> str:
106 t = self.args[0].type
107 name = self.args[0].name
109 return f'bdrv_get_aio_context({prefix}{name})'
111 return f'bdrv_get_aio_context({prefix}{name}->bs)'
113 return f'blk_get_aio_context({prefix}{name})'
117 def gen_list(self, format: str) -> str:
120 def gen_block(self, format: str) -> str:
124 # Match wrappers declared with a co_wrapper mark
125 func_decl_re = re.compile(r'^(?P<return_type>[a-zA-Z][a-zA-Z0-9_]* [\*]?)'
128 r'(?P<variant>(_[a-z][a-z0-9_]*)?)\s*'
129 r'(?P<wrapper_name>[a-z][a-z0-9_]*)'
133 def func_decl_iter(text: str) -> Iterator:
142 def snake_to_camel(func_name: str) -> str:
144 Convert underscore names like 'some_function_name' to camel-case like
148 words = [w[0].upper() + w[1:] for w in words]
152 def create_mixed_wrapper(func: FuncDecl) -> str:
160 return f"""\
182 def create_co_wrapper(func: FuncDecl) -> str:
188 return f"""\
206 def gen_co_wrapper(func: FuncDecl) -> str:
223 return f"""\
239 {func.get_result}{name}({ func.gen_list('s->{name}') });
241 s->poll_state.in_progress = false;
249 def gen_no_co_wrapper(func: FuncDecl) -> str:
265 return f"""\
281 {func.get_result}{name}({ func.gen_list('s->{name}') });
284 aio_co_wake(s->co);
302 def gen_wrappers(input_code: str) -> str:
316 exit(f'Usage: {sys.argv[0]} OUT_FILE.c IN_FILE.[ch]...')
318 with open(sys.argv[1], 'w', encoding='utf-8') as f_out:
321 with open(fname, encoding='utf-8') as f_in: