Re: [PATCH net-next 1/6] tools: ynl-gen: bitshift the flag values in the generated code
From: Asbjørn Sloth Tønnesen
Date: Tue Oct 14 2025 - 13:29:48 EST
On 10/14/25 12:53 AM, Jakub Kicinski wrote:
On Mon, 13 Oct 2025 16:49:58 +0000 Asbjørn Sloth Tønnesen wrote:
Instead of pre-computing the flag values within the code generator,
then move the bitshift operation into the generated code.
This IMHO makes the generated code read more like handwritten code.
I like it the way it is. The values are irrelevant.
Bit-shifting seams like the preferred way across the uAPI headers.
Would you be open to hexadecimal notation, if not bit-shifting?
Currently NLA_POLICY_MASK() is generated with a hexadecimal mask, and
with these patches, if render-max is not set. If using literal values
then we should properly consistently generate them as either decimal
or hexadecimal. I prefer hexadecimal over decimal.
And returning a string from user_value() is quite ugly.It only returns a string, when as_c is set, I am happy to duplicate
some code instead, and add a dedicated method always returning a string,
but can we please agree on the generated output, before implementation?