From: Jesse Gross Date: Sun, 11 Apr 2010 13:52:40 +0000 (-0400) Subject: datapath: Add rtnl_is_locked compatibility function. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5e80aecc4b10f73196f272598bac0644f196471;p=openvswitch datapath: Add rtnl_is_locked compatibility function. rtnl_is_locked wasn't added until 2.6.26 so provide an implementation of it. --- diff --git a/datapath/linux-2.6/compat-2.6/include/linux/rtnetlink.h b/datapath/linux-2.6/compat-2.6/include/linux/rtnetlink.h index 4d7bd784..dcee3187 100644 --- a/datapath/linux-2.6/compat-2.6/include/linux/rtnetlink.h +++ b/datapath/linux-2.6/compat-2.6/include/linux/rtnetlink.h @@ -30,4 +30,17 @@ static inline void rtnl_set_sk_err(struct net *net, u32 group, int error) ((void) rtnl_notify(skb, net, pid, group, nlh, flags)) #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) +static inline int rtnl_is_locked(void) +{ + if (unlikely(rtnl_trylock())) { + rtnl_unlock(); + return 0; + } + + return 1; +} + +#endif + #endif /* linux/rtnetlink.h wrapper */