Re: [PATCH net-next v2 1/3] net: bridge: add support for user-controlled bool options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 25 Nov 2018 10:12:45 +0200
Nikolay Aleksandrov <nikolay@xxxxxxxxxxxxxxxxxxx> wrote:

> On 24/11/2018 18:46, nikolay@xxxxxxxxxxxxxxxxxxx wrote:
> > On 24 November 2018 18:25:41 EET, Andrew Lunn <andrew@xxxxxxx> wrote:  
> >> On Sat, Nov 24, 2018 at 06:18:33PM +0200, nikolay@xxxxxxxxxxxxxxxxxxx
> >> wrote:  
> >>> On 24 November 2018 18:10:41 EET, Andrew Lunn <andrew@xxxxxxx> 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.



[Index of Archives]     [Netdev]     [AoE Tools]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux