[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181126093923.74c50dcb@xeon-e3>
Date: Mon, 26 Nov 2018 09:39:23 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: Nikolay Aleksandrov <nikolay@...ulusnetworks.com>
Cc: Andrew Lunn <andrew@...n.ch>, netdev@...r.kernel.org,
roopa@...ulusnetworks.com, davem@...emloft.net,
bridge@...ts.linux-foundation.org
Subject: Re: [PATCH net-next v2 1/3] net: bridge: add support for
user-controlled bool options
On Sun, 25 Nov 2018 10:12:45 +0200
Nikolay Aleksandrov <nikolay@...ulusnetworks.com> wrote:
> On 24/11/2018 18:46, nikolay@...ulusnetworks.com wrote:
> > On 24 November 2018 18:25:41 EET, Andrew Lunn <andrew@...n.ch> wrote:
> >> On Sat, Nov 24, 2018 at 06:18:33PM +0200, nikolay@...ulusnetworks.com
> >> wrote:
> >>> On 24 November 2018 18:10:41 EET, Andrew Lunn <andrew@...n.ch> wrote:
> >>>>> +int br_boolopt_toggle(struct net_bridge *br, enum br_boolopt_id
> >> opt,
> >>>> bool on,
> >>>>> + struct netlink_ext_ack *extack)
> >>>>> +{
> >>>>> + switch (opt) {
> >>>>> + default:
> >>>>> + /* shouldn't be called with unsupported options */
> >>>>> + WARN_ON(1);
> >>>>> + break;
> >>>>
> >>>> So you return 0 here, meaning the br_debug() lower down will not
> >>>> happen. Maybe return -EOPNOTSUPP?
> >>>>
> >>>
> >>> No, the idea here is that some option in the future might return an
> >> error.
> >>> This function cannot be called with unsupported option thus the warn.
>
Please don't implement some part of the API until it is used (YAGNI).
If do this kind of "someday will come" design the code will end up
littered with dead ends.
Powered by blists - more mailing lists