lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 6 Oct 2022 14:51:09 +0200
From:   Guillaume Nault <gnault@...hat.com>
To:     Jakub Kicinski <kuba@...nel.org>
Cc:     davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
        pabeni@...hat.com, robh@...nel.org, johannes@...solutions.net,
        ecree.xilinx@...il.com, stephen@...workplumber.org, sdf@...gle.com,
        f.fainelli@...il.com, fw@...len.de, linux-doc@...r.kernel.org,
        razor@...ckwall.org, nicolas.dichtel@...nd.com
Subject: Re: [PATCH net-next v2 3/7] net: add basic C code generators for
 Netlink

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@...nel.org>
> --
> 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)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ