[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201005125101.5681ce22@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Mon, 5 Oct 2020 12:51:01 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Johannes Berg <johannes@...solutions.net>
Cc: davem@...emloft.net, netdev@...r.kernel.org, kernel-team@...com,
jiri@...nulli.us, andrew@...n.ch, mkubecek@...e.cz
Subject: Re: [PATCH net-next 1/6] ethtool: wire up get policies to ops
On Mon, 05 Oct 2020 21:46:02 +0200 Johannes Berg wrote:
> On Mon, 2020-10-05 at 12:41 -0700, Jakub Kicinski wrote:
>
> > > Now you can freely add any attributes, and, due to strict validation,
> > > anything not specified in the policy will be rejected, whether by being
> > > out of range (> maxattr) or not specified (NLA_UNSPEC).
> >
> > 100%, but in ethtool policy is defined in a different compilation unit
> > than the op array.
>
> Ah. OK, then that won't work, of course, never mind.
>
> I'd probably go with your preference then, but perhaps drop the actual
> size definition:
>
> const struct nla_policy policy[] = {
> ...
> };
>
> extern const struct nla_policy policy[OTHER_ATTR + 1];
>
> op = {
> .policy = policy,
> .max_attr = ARRAY_SIZE(policy) - 1,
> }
>
>
> But that'd really just be to save typing copying it if it ever changes,
> since it's compiler checked for consistency.
Sounds good, will do (unless Michal speaks up and prefers otherwise :)).
Powered by blists - more mailing lists