Re: [PATCH net-next v2 3/9] lib: packing: add pack_fields() and unpack_fields()
From: Jakub Kicinski
Date: Sun Nov 03 2024 - 13:31:54 EST
On Fri, 25 Oct 2024 17:04:55 -0700 Jacob Keller wrote:
> +ifdef CONFIG_PACKING_CHECK_FIELDS_1
> +HOSTCFLAGS_lib/gen_packing_checks.o += -DPACKING_CHECK_FIELDS_1
> +endif
> +ifdef CONFIG_PACKING_CHECK_FIELDS_2
> +HOSTCFLAGS_lib/gen_packing_checks.o += -DPACKING_CHECK_FIELDS_2
> +endif
[...]
> +ifdef CONFIG_PACKING_CHECK_FIELDS_49
> +HOSTCFLAGS_lib/gen_packing_checks.o += -DPACKING_CHECK_FIELDS_49
> +endif
> +ifdef CONFIG_PACKING_CHECK_FIELDS_50
> +HOSTCFLAGS_lib/gen_packing_checks.o += -DPACKING_CHECK_FIELDS_50
This series is marked as Not Applicable in PW. Not sure why.
I can't bring myself to revive it, tho, this isn't pretty.
It'd be one thing to do the codegen and the ugly copy / paste
50 times in the lib/ but all drivers have to select all field
counts they use..
Since all you want is compile time checking and logic is quite
well constrained - can we put the field definitions in a separate
ro section and make modpost validate them?
Also Documentation needs to be extended with basic use examples.