diff options
author | Stephen Hemminger <shemminger@osdl.org> | 2006-03-21 01:23:58 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-21 01:23:58 -0500 |
commit | 6756ae4b4e97aba48c042b4aa6b77a18f507d2cb (patch) | |
tree | 05bf37711d782fb0089d474716026c44a454f89b /include | |
parent | 253aa11578c1b89757282430891bb66ae5300092 (diff) |
[NET]: Convert RTNL to mutex.
This patch turns the RTNL from a semaphore to a new 2.6.16 mutex and
gets rid of some of the leftover legacy.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/rtnetlink.h | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index edccefb45188..d263853a8f1c 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
@@ -907,6 +907,7 @@ struct tcamsg | |||
907 | #ifdef __KERNEL__ | 907 | #ifdef __KERNEL__ |
908 | 908 | ||
909 | #include <linux/config.h> | 909 | #include <linux/config.h> |
910 | #include <linux/mutex.h> | ||
910 | 911 | ||
911 | extern size_t rtattr_strlcpy(char *dest, const struct rtattr *rta, size_t size); | 912 | extern size_t rtattr_strlcpy(char *dest, const struct rtattr *rta, size_t size); |
912 | static __inline__ int rtattr_strcmp(const struct rtattr *rta, const char *str) | 913 | static __inline__ int rtattr_strcmp(const struct rtattr *rta, const char *str) |
@@ -1038,24 +1039,17 @@ __rta_reserve(struct sk_buff *skb, int attrtype, int attrlen) | |||
1038 | 1039 | ||
1039 | extern void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change); | 1040 | extern void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change); |
1040 | 1041 | ||
1041 | extern struct semaphore rtnl_sem; | 1042 | /* RTNL is used as a global lock for all changes to network configuration */ |
1042 | |||
1043 | #define rtnl_shlock() down(&rtnl_sem) | ||
1044 | #define rtnl_shlock_nowait() down_trylock(&rtnl_sem) | ||
1045 | |||
1046 | #define rtnl_shunlock() do { up(&rtnl_sem); \ | ||
1047 | if (rtnl && rtnl->sk_receive_queue.qlen) \ | ||
1048 | rtnl->sk_data_ready(rtnl, 0); \ | ||
1049 | } while(0) | ||
1050 | |||
1051 | extern void rtnl_lock(void); | 1043 | extern void rtnl_lock(void); |
1052 | extern int rtnl_lock_interruptible(void); | ||
1053 | extern void rtnl_unlock(void); | 1044 | extern void rtnl_unlock(void); |
1045 | extern int rtnl_trylock(void); | ||
1046 | |||
1054 | extern void rtnetlink_init(void); | 1047 | extern void rtnetlink_init(void); |
1048 | extern void __rtnl_unlock(void); | ||
1055 | 1049 | ||
1056 | #define ASSERT_RTNL() do { \ | 1050 | #define ASSERT_RTNL() do { \ |
1057 | if (unlikely(down_trylock(&rtnl_sem) == 0)) { \ | 1051 | if (unlikely(rtnl_trylock())) { \ |
1058 | up(&rtnl_sem); \ | 1052 | rtnl_unlock(); \ |
1059 | printk(KERN_ERR "RTNL: assertion failed at %s (%d)\n", \ | 1053 | printk(KERN_ERR "RTNL: assertion failed at %s (%d)\n", \ |
1060 | __FILE__, __LINE__); \ | 1054 | __FILE__, __LINE__); \ |
1061 | dump_stack(); \ | 1055 | dump_stack(); \ |