[ovs-dev] [PATCH] datapath: Avoid nla_parse_nested const warning on < 2.6.22.

Jesse Gross jesse at nicira.com
Mon Jan 31 22:50:52 UTC 2011


On Sun, Jan 30, 2011 at 5:30 PM, Simon Horman <horms at verge.net.au> wrote:
> On Sun, Jan 30, 2011 at 04:35:20PM -0800, Jesse Gross wrote:
>> We mark our Netlink policies as const for safety but the argument
>> to nla_parse_nested didn't become const until 2.6.22, which provokes
>> warnings.  This casts away the constness on affected kernels to
>> avoid the warnings.
>
> Is there really any value to hiding warnings in this way?

Well, there are two alternatives: either write code according to the
interfaces at the time or have a bunch of spurious warnings.  The
first one isn't really doable for all the various kernel versions that
we are attempting to support or at the very least would result in very
convoluted code that only could use the lowest common denominator
interfaces.  The second is better but it tends to make the real
warnings hard to pick out.

Unfortunately, the compatibility directory is full of this type of
stuff (and worse).  It's perhaps some consolation that there is no
danger of assumptions becoming invalid in the future because the
compat code is only for kernels older than the current one and the old
kernels won't change.

Obviously the ideal solution is to merge upstream and people get the
version that is included with their kernel.  However, we're not quite
there yet.




More information about the dev mailing list