netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
	sdf@google.com, Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net-next 02/12] tools: ynl-gen: record extra args for regen
Date: Fri,  9 Jun 2023 14:43:36 -0700	[thread overview]
Message-ID: <20230609214346.1605106-3-kuba@kernel.org> (raw)
In-Reply-To: <20230609214346.1605106-1-kuba@kernel.org>

ynl-regen needs to know the arguments used to generate a file.
Record excluded ops and, while at it, user headers.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 tools/net/ynl/ynl-gen-c.py | 5 +++++
 tools/net/ynl/ynl-regen.sh | 4 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py
index a55c4cec2529..89d9471e9c2b 100755
--- a/tools/net/ynl/ynl-gen-c.py
+++ b/tools/net/ynl/ynl-gen-c.py
@@ -2281,6 +2281,11 @@ _C_KW = {
     cw.p("/* Do not edit directly, auto-generated from: */")
     cw.p(f"/*\t{spec_kernel} */")
     cw.p(f"/* YNL-GEN {args.mode} {'header' if args.header else 'source'} */")
+    if args.exclude_op or args.user_header:
+        line = ''
+        line += ' --user-header '.join([''] + args.user_header)
+        line += ' --exclude-op '.join([''] + args.exclude_op)
+        cw.p(f'/* YNL-ARG{line} */')
     cw.nl()
 
     if args.mode == 'uapi':
diff --git a/tools/net/ynl/ynl-regen.sh b/tools/net/ynl/ynl-regen.sh
index 2a4525e2aa17..8d4ca6a50582 100755
--- a/tools/net/ynl/ynl-regen.sh
+++ b/tools/net/ynl/ynl-regen.sh
@@ -19,6 +19,7 @@ for f in $files; do
     # params:     0       1      2     3
     #         $YAML YNL-GEN kernel $mode
     params=( $(git grep -B1 -h '/\* YNL-GEN' $f | sed 's@/\*\(.*\)\*/@\1@') )
+    args=$(sed -n 's@/\* YNL-ARG \(.*\) \*/@\1@p' $f)
 
     if [ $f -nt ${params[0]} -a -z "$force" ]; then
 	echo -e "\tSKIP $f"
@@ -26,5 +27,6 @@ for f in $files; do
     fi
 
     echo -e "\tGEN ${params[2]}\t$f"
-    $TOOL --mode ${params[2]} --${params[3]} --spec $KDIR/${params[0]} -o $f
+    $TOOL --mode ${params[2]} --${params[3]} --spec $KDIR/${params[0]} \
+	  $args -o $f
 done
-- 
2.40.1


  parent reply	other threads:[~2023-06-09 21:43 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09 21:43 [PATCH net-next 00/12] tools: ynl: generate code for the ethtool family Jakub Kicinski
2023-06-09 21:43 ` [PATCH net-next 01/12] tools: ynl-gen: support excluding tricky ops Jakub Kicinski
2023-06-09 21:43 ` Jakub Kicinski [this message]
2023-06-09 21:43 ` [PATCH net-next 03/12] netlink: specs: support setting prefix-name per attribute Jakub Kicinski
2023-06-09 21:43 ` [PATCH net-next 04/12] netlink: specs: ethtool: add C render hints Jakub Kicinski
2023-06-09 21:43 ` [PATCH net-next 05/12] tools: ynl-gen: don't generate enum types if unnamed Jakub Kicinski
2023-06-09 21:43 ` [PATCH net-next 06/12] tools: ynl-gen: resolve enum vs struct name conflicts Jakub Kicinski
2023-06-09 21:43 ` [PATCH net-next 07/12] netlink: specs: ethtool: add empty enum stringset Jakub Kicinski
2023-06-09 21:43 ` [PATCH net-next 08/12] netlink: specs: ethtool: untangle UDP tunnels and cable test a bit Jakub Kicinski
2023-06-09 21:43 ` [PATCH net-next 09/12] netlink: specs: ethtool: untangle stats-get Jakub Kicinski
2023-06-09 21:43 ` [PATCH net-next 10/12] netlink: specs: ethtool: mark pads as pads Jakub Kicinski
2023-06-09 21:43 ` [PATCH net-next 11/12] tools: ynl: generate code for the ethtool family Jakub Kicinski
2023-06-09 21:43 ` [PATCH net-next 12/12] tools: ynl: add sample for ethtool Jakub Kicinski
2023-06-09 22:12 ` [PATCH net-next 00/12] tools: ynl: generate code for the ethtool family Stanislav Fomichev
2023-06-12 10:10 ` patchwork-bot+netdevbpf

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=20230609214346.1605106-3-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@google.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).