debug.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * linux/include/linux/sunrpc/debug.h
  3. *
  4. * Debugging support for sunrpc module
  5. *
  6. * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
  7. */
  8. #ifndef _LINUX_SUNRPC_DEBUG_H_
  9. #define _LINUX_SUNRPC_DEBUG_H_
  10. #include <uapi/linux/sunrpc/debug.h>
  11. /*
  12. * Debugging macros etc
  13. */
  14. #if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
  15. extern unsigned int rpc_debug;
  16. extern unsigned int nfs_debug;
  17. extern unsigned int nfsd_debug;
  18. extern unsigned int nlm_debug;
  19. #endif
  20. #define dprintk(args...) dfprintk(FACILITY, ## args)
  21. #define dprintk_rcu(args...) dfprintk_rcu(FACILITY, ## args)
  22. #undef ifdebug
  23. #if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
  24. # define ifdebug(fac) if (unlikely(rpc_debug & RPCDBG_##fac))
  25. # define dfprintk(fac, args...) \
  26. do { \
  27. ifdebug(fac) \
  28. printk(KERN_DEFAULT args); \
  29. } while (0)
  30. # define dfprintk_rcu(fac, args...) \
  31. do { \
  32. ifdebug(fac) { \
  33. rcu_read_lock(); \
  34. printk(KERN_DEFAULT args); \
  35. rcu_read_unlock(); \
  36. } \
  37. } while (0)
  38. # define RPC_IFDEBUG(x) x
  39. #else
  40. # define ifdebug(fac) if (0)
  41. # define dfprintk(fac, args...) do {} while (0)
  42. # define dfprintk_rcu(fac, args...) do {} while (0)
  43. # define RPC_IFDEBUG(x)
  44. #endif
  45. /*
  46. * Sysctl interface for RPC debugging
  47. */
  48. struct rpc_clnt;
  49. struct rpc_xprt;
  50. #if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
  51. void rpc_register_sysctl(void);
  52. void rpc_unregister_sysctl(void);
  53. void sunrpc_debugfs_init(void);
  54. void sunrpc_debugfs_exit(void);
  55. void rpc_clnt_debugfs_register(struct rpc_clnt *);
  56. void rpc_clnt_debugfs_unregister(struct rpc_clnt *);
  57. void rpc_xprt_debugfs_register(struct rpc_xprt *);
  58. void rpc_xprt_debugfs_unregister(struct rpc_xprt *);
  59. #else
  60. static inline void
  61. sunrpc_debugfs_init(void)
  62. {
  63. return;
  64. }
  65. static inline void
  66. sunrpc_debugfs_exit(void)
  67. {
  68. return;
  69. }
  70. static inline void
  71. rpc_clnt_debugfs_register(struct rpc_clnt *clnt)
  72. {
  73. return;
  74. }
  75. static inline void
  76. rpc_clnt_debugfs_unregister(struct rpc_clnt *clnt)
  77. {
  78. return;
  79. }
  80. static inline void
  81. rpc_xprt_debugfs_register(struct rpc_xprt *xprt)
  82. {
  83. return;
  84. }
  85. static inline void
  86. rpc_xprt_debugfs_unregister(struct rpc_xprt *xprt)
  87. {
  88. return;
  89. }
  90. #endif
  91. #endif /* _LINUX_SUNRPC_DEBUG_H_ */