Thomas Graf | 482a852 | 2005-11-10 02:25:56 +0100 | [diff] [blame] | 1 | #ifndef __LINUX_GENERIC_NETLINK_H |
| 2 | #define __LINUX_GENERIC_NETLINK_H |
| 3 | |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 4 | #include <uapi/linux/genetlink.h> |
Thomas Graf | 482a852 | 2005-11-10 02:25:56 +0100 | [diff] [blame] | 5 | |
James Chapman | f408e0c | 2010-04-02 06:19:05 +0000 | [diff] [blame] | 6 | |
| 7 | /* All generic netlink requests are serialized by a global lock. */ |
| 8 | extern void genl_lock(void); |
| 9 | extern void genl_unlock(void); |
WANG Cong | 320f5ea | 2012-07-24 13:44:01 +0800 | [diff] [blame] | 10 | #ifdef CONFIG_LOCKDEP |
Pravin B Shelar | 86b1309 | 2011-11-10 19:14:51 -0800 | [diff] [blame] | 11 | extern int lockdep_genl_is_held(void); |
| 12 | #endif |
James Chapman | f408e0c | 2010-04-02 06:19:05 +0000 | [diff] [blame] | 13 | |
Jesse Gross | b4e1661 | 2011-11-19 16:21:37 -0800 | [diff] [blame] | 14 | /** |
| 15 | * rcu_dereference_genl - rcu_dereference with debug checking |
| 16 | * @p: The pointer to read, prior to dereferencing |
| 17 | * |
| 18 | * Do an rcu_dereference(p), but check caller either holds rcu_read_lock() |
| 19 | * or genl mutex. Note : Please prefer genl_dereference() or rcu_dereference() |
| 20 | */ |
| 21 | #define rcu_dereference_genl(p) \ |
| 22 | rcu_dereference_check(p, lockdep_genl_is_held()) |
| 23 | |
| 24 | /** |
| 25 | * genl_dereference - fetch RCU pointer when updates are prevented by genl mutex |
| 26 | * @p: The pointer to read, prior to dereferencing |
| 27 | * |
| 28 | * Return the value of the specified RCU-protected pointer, but omit |
| 29 | * both the smp_read_barrier_depends() and the ACCESS_ONCE(), because |
| 30 | * caller holds genl mutex. |
| 31 | */ |
| 32 | #define genl_dereference(p) \ |
| 33 | rcu_dereference_protected(p, lockdep_genl_is_held()) |
| 34 | |
Neil Horman | e9412c3 | 2012-05-29 09:30:41 +0000 | [diff] [blame] | 35 | #define MODULE_ALIAS_GENL_FAMILY(family)\ |
| 36 | MODULE_ALIAS_NET_PF_PROTO_NAME(PF_NETLINK, NETLINK_GENERIC, "-family-" family) |
| 37 | |
Thomas Graf | 482a852 | 2005-11-10 02:25:56 +0100 | [diff] [blame] | 38 | #endif /* __LINUX_GENERIC_NETLINK_H */ |