Subject: Re: [patch net-next 02/10] tools: ynl-gen: introduce support for bitfield32 attribute type

From: Jakub Kicinski <[email-masked]>
Date: Tue, 10 Oct 2023 11:58:04 -0700

On Tue, 10 Oct 2023 13:08:21 +0200 Jiri Pirko wrote:
> Introduce support for forgotten attribute type bitfield32.

s/forgotten//, no family need it so far

> Note that since the generated code works with struct nla_bitfiel32,
> the generator adds netlink.h to the list of includes for userspace
> headers. Regenerate the headers.

If all we need it for is bitfield32 it should be added dynamically.
bitfiled32 is an odd concept.

> diff --git a/Documentation/netlink/genetlink-c.yaml b/Documentation/netlink/genetlink-c.yaml
> index f9366aaddd21..8192b87b3046 100644
> --- a/Documentation/netlink/genetlink-c.yaml
> +++ b/Documentation/netlink/genetlink-c.yaml
> @@ -144,7 +144,7 @@ properties:
>                name:
>                  type: string
>                type: &attr-type
> -                enum: [ unused, pad, flag, binary, u8, u16, u32, u64, s32, s64,
> +                enum: [ unused, pad, flag, binary, bitfield32, u8, u16, u32, u64, s32, s64,
>                          string, nest, array-nest, nest-type-value ]

Just for genetlink-legacy, please.
Also I think you need to update Documentation.

> +class TypeBitfield32(Type):
> +    def arg_member(self, ri):
> +        return [f"const struct nla_bitfield32 *{self.c_name}"]
> +
> +    def struct_member(self, ri):
> +        ri.cw.p(f"struct nla_bitfield32 {self.c_name};")

I think that you can re-implement _complex_member_type() instead
of these two?