netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Donald Hunter <donald.hunter@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org,  "David S. Miller" <davem@davemloft.net>,
	 Eric Dumazet <edumazet@google.com>,
	 Paolo Abeni <pabeni@redhat.com>,
	donald.hunter@redhat.com
Subject: Re: [RFC net-next v1] tools: ynl: Add an strace rendering mode to ynl-gen
Date: Fri, 23 Jun 2023 13:04:32 +0100	[thread overview]
Message-ID: <m2mt0q9ygf.fsf@gmail.com> (raw)
In-Reply-To: <20230619120025.74c33a5d@kernel.org> (Jakub Kicinski's message of "Mon, 19 Jun 2023 12:00:25 -0700")

Jakub Kicinski <kuba@kernel.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?

  reply	other threads:[~2023-06-23 12:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-15 15:13 [RFC net-next v1] tools: ynl: Add an strace rendering mode to ynl-gen Donald Hunter
2023-06-15 17:19 ` Simon Horman
2023-06-16  3:00 ` Jakub Kicinski
2023-06-16 10:17   ` Donald Hunter
2023-06-16 18:11     ` Jakub Kicinski
2023-06-19 10:04       ` Donald Hunter
2023-06-19 19:00         ` Jakub Kicinski
2023-06-23 12:04           ` Donald Hunter [this message]
2023-06-23 15:28             ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2mt0q9ygf.fsf@gmail.com \
    --to=donald.hunter@gmail.com \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@redhat.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).