Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / include / linux / genetlink.h
blobbc738504ab4a85a1f3ceff06a4bde0ad2b8716aa
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __LINUX_GENERIC_NETLINK_H
3 #define __LINUX_GENERIC_NETLINK_H
5 #include <uapi/linux/genetlink.h>
8 /* All generic netlink requests are serialized by a global lock. */
9 extern void genl_lock(void);
10 extern void genl_unlock(void);
11 #ifdef CONFIG_LOCKDEP
12 extern bool lockdep_genl_is_held(void);
13 #endif
15 /* for synchronisation between af_netlink and genetlink */
16 extern atomic_t genl_sk_destructing_cnt;
17 extern wait_queue_head_t genl_sk_destructing_waitq;
19 /**
20 * rcu_dereference_genl - rcu_dereference with debug checking
21 * @p: The pointer to read, prior to dereferencing
23 * Do an rcu_dereference(p), but check caller either holds rcu_read_lock()
24 * or genl mutex. Note : Please prefer genl_dereference() or rcu_dereference()
26 #define rcu_dereference_genl(p) \
27 rcu_dereference_check(p, lockdep_genl_is_held())
29 /**
30 * genl_dereference - fetch RCU pointer when updates are prevented by genl mutex
31 * @p: The pointer to read, prior to dereferencing
33 * Return the value of the specified RCU-protected pointer, but omit
34 * the READ_ONCE(), because caller holds genl mutex.
36 #define genl_dereference(p) \
37 rcu_dereference_protected(p, lockdep_genl_is_held())
39 #define MODULE_ALIAS_GENL_FAMILY(family)\
40 MODULE_ALIAS_NET_PF_PROTO_NAME(PF_NETLINK, NETLINK_GENERIC, "-family-" family)
42 #endif /* __LINUX_GENERIC_NETLINK_H */