diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-09-15 07:07:15 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-09-15 22:29:45 -0400 |
commit | 7dff59efbb0e8b0f81c95fd40379c0d0c757c808 (patch) | |
tree | 17651e0f5ef9b4a4b00352b52351a3fc23ac4671 /include/linux | |
parent | e0de7c93b950b9e784894efc4b529c6958cb747a (diff) |
net: add rtnl_dereference()
We sometime want to dereference an rcu protected pointer while
holding RTNL. Use a macro to hide all lockdep details.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/rtnetlink.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index 263690d991a8..68c436bddc88 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
@@ -760,6 +760,15 @@ extern int lockdep_rtnl_is_held(void); | |||
760 | rcu_dereference_check(p, rcu_read_lock_held() || \ | 760 | rcu_dereference_check(p, rcu_read_lock_held() || \ |
761 | lockdep_rtnl_is_held()) | 761 | lockdep_rtnl_is_held()) |
762 | 762 | ||
763 | /** | ||
764 | * rtnl_dereference - rcu_dereference with debug checking | ||
765 | * @p: The pointer to read, prior to dereferencing | ||
766 | * | ||
767 | * Do an rcu_dereference(p), but check caller holds RTNL | ||
768 | */ | ||
769 | #define rtnl_dereference(p) \ | ||
770 | rcu_dereference_check(p, lockdep_rtnl_is_held()) | ||
771 | |||
763 | extern void rtnetlink_init(void); | 772 | extern void rtnetlink_init(void); |
764 | extern void __rtnl_unlock(void); | 773 | extern void __rtnl_unlock(void); |
765 | 774 | ||