[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZYFqEePnN9wesTt0@Laptop-X1>
Date: Tue, 19 Dec 2023 18:01:53 +0800
From: Hangbin Liu <liuhangbin@...il.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH net-next 1/3] tools: ynl-gen: use correct len for string
and binary
On Mon, Dec 18, 2023 at 02:22:09PM -0800, Jakub Kicinski wrote:
> On Sat, 16 Dec 2023 16:35:40 +0800 Hangbin Liu wrote:
> > The max-len / min-len / extact-len micro are used by binary. For string we
> > need to use "len" to define the max length. e.g.
> >
> > static const struct nla_policy
> > team_nl_option_policy[TEAM_ATTR_OPTION_MAX + 1] = {
> > [TEAM_ATTR_OPTION_UNSPEC] = { .type = NLA_UNSPEC, },
> > [TEAM_ATTR_OPTION_NAME] = {
> > .type = NLA_STRING,
> > .len = TEAM_STRING_MAX_LEN,
> > },
>
> max-len / min-len / extact-len are just the names in the spec.
> We can put the value provided in the spec as max-len inside
> nla_policy as len, given that for string spec::max-len == policy::len
>
> Am I confused?
Yes, we can do that. While this looks like another magic. When user set max-len
for a string type in the yaml spec. After converting to c code, it's .len
attribute. This still makes user confused.
Anyway, this is just a matter of choosing apple or banana. I'm OK to using
the current YAML spec policy.
Thanks
Hangbin
Powered by blists - more mailing lists