genetlink.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef __LINUX_GENERIC_NETLINK_H
  2. #define __LINUX_GENERIC_NETLINK_H
  3. #include <uapi/linux/genetlink.h>
  4. /* All generic netlink requests are serialized by a global lock. */
  5. extern void genl_lock(void);
  6. extern void genl_unlock(void);
  7. #ifdef CONFIG_LOCKDEP
  8. extern bool lockdep_genl_is_held(void);
  9. #endif
  10. /* for synchronisation between af_netlink and genetlink */
  11. extern atomic_t genl_sk_destructing_cnt;
  12. extern wait_queue_head_t genl_sk_destructing_waitq;
  13. /**
  14. * rcu_dereference_genl - rcu_dereference with debug checking
  15. * @p: The pointer to read, prior to dereferencing
  16. *
  17. * Do an rcu_dereference(p), but check caller either holds rcu_read_lock()
  18. * or genl mutex. Note : Please prefer genl_dereference() or rcu_dereference()
  19. */
  20. #define rcu_dereference_genl(p) \
  21. rcu_dereference_check(p, lockdep_genl_is_held())
  22. /**
  23. * genl_dereference - fetch RCU pointer when updates are prevented by genl mutex
  24. * @p: The pointer to read, prior to dereferencing
  25. *
  26. * Return the value of the specified RCU-protected pointer, but omit
  27. * both the smp_read_barrier_depends() and the ACCESS_ONCE(), because
  28. * caller holds genl mutex.
  29. */
  30. #define genl_dereference(p) \
  31. rcu_dereference_protected(p, lockdep_genl_is_held())
  32. #define MODULE_ALIAS_GENL_FAMILY(family)\
  33. MODULE_ALIAS_NET_PF_PROTO_NAME(PF_NETLINK, NETLINK_GENERIC, "-family-" family)
  34. #endif /* __LINUX_GENERIC_NETLINK_H */