[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1538038297.14416.25.camel@sipsolutions.net>
Date: Thu, 27 Sep 2018 10:51:37 +0200
From: Johannes Berg <johannes@...solutions.net>
To: Michal Kubecek <mkubecek@...e.cz>
Cc: linux-wireless@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH] netlink: add policy attribute range validation
On Thu, 2018-09-27 at 10:48 +0200, Michal Kubecek wrote:
> We could still use helper macros so this part could become
>
> DEFINE_NLA_U8_RANGE(retry_range, 1, 255);
>
> or
>
> DEFINE_NLA_RANGE(retry_range, u8, 1, 255);
True.
> > policy[] = {
> > ...
> > [NL80211_ATTR_WIPHY_RETRY_SHORT] = {
> > .type = NLA_U8,
> > .validation_data = &retry_range,
> > },
> > ...
> > };
>
> And this could be also shortened using a macro.
>
> It would still be longer but not that much.
Right. You'd still have to name it, and then we'd probably eventually
want to share some common range definitions, but indeed it would work.
> I didn't mean it as a serious objection, rather a note that the gain may
> not be worth the additional complexity.
Sure, and suggestions are very welcome. I was just trying to explain why
I chose this direction, more than anything else.
> But if you want to follow in the
> direction you indicated later (in particular, allowing different
> interpretations of validation_data for the same type), overloading does
> indeed make more sense.
I'm just working on the patches - give me a few more minutes.
johannes
Powered by blists - more mailing lists