From: Jakub Kicinski <kuba@kernel.org>
To: Donald Hunter <donald.hunter@gmail.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
Jan Stancek <jstancek@redhat.com>, Jiri Pirko <jiri@resnulli.us>,
donald.hunter@redhat.com
Subject: Re: [PATCH net-next v1 1/2] tools/net/ynl: add support for --family and --list-families
Date: Fri, 10 Jan 2025 17:08:40 -0800 [thread overview]
Message-ID: <20250110170840.0990f829@kernel.org> (raw)
In-Reply-To: <20250110144145.3493-1-donald.hunter@gmail.com>
On Fri, 10 Jan 2025 14:41:44 +0000 Donald Hunter wrote:
> Add a --family option to ynl to specify the spec by family name instead
> of file path, with support for searching in-tree and system install
> location and a --list-families option to show the available families.
Neat!
> class YnlEncoder(json.JSONEncoder):
> def default(self, obj):
> @@ -32,7 +50,14 @@ def main():
>
> parser = argparse.ArgumentParser(description=description,
> epilog=epilog)
> - parser.add_argument('--spec', dest='spec', type=str, required=True)
> + spec_group = parser.add_mutually_exclusive_group(required=True)
> + spec_group.add_argument('--family', dest='family', type=str,
> + help='name of the netlink FAMILY')
> + spec_group.add_argument('--list-families', action='store_true',
> + help='list all available netlink families')
Do we need to indicate that the list families lists the families for
which we found specs in the filesystem? As opposed to listing all
families currently loaded in the kernel?
Some users may be surprised if they run --list-families, see a family,
issue a request and get an exception that family is not found..
I guess OTOH we also list spec ops in --list-ops, so there's precedent.
Up to you.
> + if args.family:
> + spec = f"{spec_dir()}/{args.family}.yaml"
> + if args.schema is None:
Could we only do this if spec_dir() startswith sys_schema_dir ?
We want to make sure schema is always validated during development.
> + args.schema = ''
> + else:
> + spec = args.spec
> + if not os.path.isfile(spec):
> + raise Exception(f"Spec file {spec} does not exist")
> +
> + ynl = YnlFamily(spec, args.schema, args.process_unknown,
> recv_size=args.dbg_small_recv)
> if args.dbg_small_recv:
> ynl.set_recv_dbg(True)
next prev parent reply other threads:[~2025-01-11 1:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 14:41 [PATCH net-next v1 1/2] tools/net/ynl: add support for --family and --list-families Donald Hunter
2025-01-10 14:41 ` [PATCH net-next v1 2/2] tools/net/ynl: ethtool: support spec load from install location Donald Hunter
2025-01-11 1:10 ` Jakub Kicinski
2025-01-11 1:08 ` Jakub Kicinski [this message]
2025-01-11 14:04 ` [PATCH net-next v1 1/2] tools/net/ynl: add support for --family and --list-families Donald Hunter
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=20250110170840.0990f829@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=donald.hunter@redhat.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=jiri@resnulli.us \
--cc=jstancek@redhat.com \
--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).