On Thu, Sep 29, 2022 at 07:34:14PM -0700, Jakub Kicinski wrote: > Code generators to turn Netlink specs into C code. > I'm definitely not proud of it. > > The main generator is in Python, there's a bash script > to regen all code-gen'ed files in tree after making > spec changes. > > Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx> > -- > v2: - use /* */ comments instead of // Probably not a very interesting feedback, but there are still many comments generated in the // style. For example in this block: > + if args.mode == "kernel": > + if args.header: > + if parsed.kernel_policy == 'global': > + cw.p(f"// Global operation policy for {parsed.name}") > + > + struct = Struct(parsed, parsed.global_policy_set, type_list=parsed.global_policy) > + print_req_policy_fwd(cw, struct) > + cw.nl() > + > + for op_name, op in parsed.ops.items(): > + if parsed.kernel_policy == 'per-op' and 'do' in op and 'event' not in op: > + cw.p(f"// {op.enum_name} - do") > + ri = RenderInfo(cw, parsed, args.mode, op, op_name, "do") > + print_req_policy_fwd(cw, ri.struct['request'], op=op) > + cw.nl() > + > + print_kernel_op_table_fwd(parsed, cw) > + else: > + if parsed.kernel_policy == 'global': > + cw.p(f"// Global operation policy for {parsed.name}") > + > + struct = Struct(parsed, parsed.global_policy_set, type_list=parsed.global_policy) > + print_req_policy(cw, struct) > + cw.nl() > + > + for op_name, op in parsed.ops.items(): > + if parsed.kernel_policy == 'per-op': > + for op_mode in {'do', 'dump'}: > + if op_mode in op and 'request' in op[op_mode]: > + cw.p(f"// {op.enum_name} - {op_mode}") > + ri = RenderInfo(cw, parsed, args.mode, op, op_name, op_mode) > + print_req_policy(cw, ri.struct['request'], op=op) > + cw.nl() > + > + print_kernel_op_table(parsed, cw)