[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m2mt0q9ygf.fsf@gmail.com>
Date: Fri, 23 Jun 2023 13:04:32 +0100
From: Donald Hunter <donald.hunter@...il.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>, Eric
Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
donald.hunter@...hat.com
Subject: Re: [RFC net-next v1] tools: ynl: Add an strace rendering mode to
ynl-gen
Jakub Kicinski <kuba@...nel.org> writes:
> On Mon, 19 Jun 2023 11:04:11 +0100 Donald Hunter wrote:
>> I tried these suggestions out and they seem a bit problematic. For
>> struct references I don't see a way to validate them, when it's not C
>> codegen. Non C consumers will need to enumarete the struct references
>> they 'understand'. The printk formats are meaningful in kernel, but not
>> directly usable elsewhere, without writing a parser for them.
>>
>> It seems desirable to have schema validation for the values and I tried
>> using the %p printk formats as the enumeration. Using this format, the
>> values need to be quoted everywhere. See diff below.
>>
>> The printk formats also carry specific opinions about formatting details
>> such as the case and separator to be used for output. This seems
>> orthogonal to a type annotation about meaning.
>>
>> Perhaps the middle ground is to derive a list of format specificer
>> enumerations from the printk formats, but that's maybe not much
>> different from defining our own?
>
> Fair point. Our own names would be easier to understand -- OTOH I like
> how the print formats almost forcefully drive the point that these are
> supposed to be used exclusively for printing.
>
> If someone needs to interpret the data they should add a struct.
>
> But I guess a big fat warning above the documentation and calling the
> attribute "print-format" / "print-hint" could work as well? Up to you.
>
> Hope this makes sense.
Does "display-hint" sound okay? Maybe me being a bit fussy vs
"print-hint" but it feels more appropriate to me.
>> I currently have "%pI4", "%pI6", "%pM", "%pMF", "%pU", "%ph", which
>> could be represented as ipv4, ipv6, mac, fddi, uuid, hex. From the
>> printk formats documentation, the only other one I can see is bluetooth.
>> The other formats all look like they cover composite values.
>
>> diff --git a/Documentation/netlink/genetlink-legacy.yaml b/Documentation/netlink/genetlink-legacy.yaml
>> index b474889b49ff..f3ecdeb7c38c 100644
>> --- a/Documentation/netlink/genetlink-legacy.yaml
>> +++ b/Documentation/netlink/genetlink-legacy.yaml
>
> If we're only talking about printing we will want to extend the support
> to new families as well.
Yep, makes sense. Is there any magic/scripted way of keeping the
different schemas in sync or do they just get modified independently?
Powered by blists - more mailing lists