From b5e80aecc4b10f73196f272598bac0644f196471 Mon Sep 17 00:00:00 2001 From: Jesse Gross Date: Sun, 11 Apr 2010 09:52:40 -0400 Subject: [PATCH] datapath: Add rtnl_is_locked compatibility function. rtnl_is_locked wasn't added until 2.6.26 so provide an implementation of it. --- .../linux-2.6/compat-2.6/include/linux/rtnetlink.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 */ -- 2.30.2