From: Jesse Gross Date: Mon, 31 Jan 2011 00:01:56 +0000 (-0800) Subject: datapath: Avoid nla_parse_nested const warning on < 2.6.22. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3569d18f47f49c115d80033a3661ad31c13d06c9;p=openvswitch datapath: Avoid nla_parse_nested const warning on < 2.6.22. 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 Signed-off-by: Jesse Gross --- diff --git a/datapath/linux-2.6/compat-2.6/include/net/netlink.h b/datapath/linux-2.6/compat-2.6/include/net/netlink.h index f4fb8437..0f881f1c 100644 --- a/datapath/linux-2.6/compat-2.6/include/net/netlink.h +++ b/datapath/linux-2.6/compat-2.6/include/net/netlink.h @@ -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