[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5171B82E.4090707@redhat.com>
Date: Fri, 19 Apr 2013 17:33:34 -0400
From: Vlad Yasevich <vyasevic@...hat.com>
To: Stephen Hemminger <stephen@...workplumber.org>
CC: netdev@...r.kernel.org, bridge@...ts.linux-foundation.org,
mst@...hat.com
Subject: Re: [PATCH v2 net-next 2/6] bridge: make flags sysfs interface a
little bit more extensible
On 04/19/2013 04:55 PM, Stephen Hemminger wrote:
> On Fri, 19 Apr 2013 16:52:46 -0400
> Vlad Yasevich <vyasevic@...hat.com> wrote:
>
>> +
>> +static int store_flag(struct net_bridge_port *p, unsigned long v,
>> + unsigned long mask)
>> +{
>> + unsigned long flags = p->flags;
>> +
>> + if (v)
>> + flags |= mask;
>> + else
>> + flags &= ~mask;
>> +
>> + if (flags != p->flags) {
>> + p->flags = flags;
>> + br_ifinfo_notify(RTM_NEWLINK, p);
>> + }
>> + return 0;
>> +}
>
> I don't want to allow arbitrary flag stores (and shows).
> It exposes kernel bits to user space and creates an unintended ABI.
>
Stephen
This is really no different then what you currently have. It simply
removed code duplication and allows for slight sensibility.
Right now, the above function is essentially defined for every flag
attributed that you define with BRPORT_ATTR_FLAG(). You essentially
have store_<flag>_name() function for every flag that replicates the
above code.
This patch removes this duplication by having each store_<flag>_name()
function call into this new static store_flag() function with the
mask that is coded and expanded at compile time.
So there is no new ABI, there is no arbitrary flag stores, but there is
smaller code and there is ability to extend the flag store behavior to
possibly do something else it if is needed.
-vlad
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists