datapath: Avoid nla_parse_nested const warning on < 2.6.22.
authorJesse Gross <jesse@nicira.com>
Mon, 31 Jan 2011 00:01:56 +0000 (16:01 -0800)
committerJesse Gross <jesse@nicira.com>
Mon, 31 Jan 2011 06:16:37 +0000 (22:16 -0800)
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.

Reported-by: Justin Pettit <jpettit@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
datapath/linux-2.6/compat-2.6/include/net/netlink.h

index f4fb843..0f881f1 100644 (file)
@@ -111,7 +111,10 @@ static inline int nla_type(const struct nlattr *nla)
 }
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
+#define nla_parse_nested(tb, maxtype, nla, policy) \
+       nla_parse_nested(tb, maxtype, (struct nlattr *)(nla), (struct nla_policy *)(policy))
+#elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
 #define nla_parse_nested(tb, maxtype, nla, policy) \
        nla_parse_nested(tb, maxtype, (struct nlattr *)(nla), policy)
 #endif