debug.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. #if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
  50. void rpc_register_sysctl(void);
  51. void rpc_unregister_sysctl(void);
  52. int sunrpc_debugfs_init(void);
  53. void sunrpc_debugfs_exit(void);
  54. int rpc_clnt_debugfs_register(struct rpc_clnt *);
  55. void rpc_clnt_debugfs_unregister(struct rpc_clnt *);
  56. #else
  57. static inline int
  58. sunrpc_debugfs_init(void)
  59. {
  60. return 0;
  61. }
  62. static inline void
  63. sunrpc_debugfs_exit(void)
  64. {
  65. return;
  66. }
  67. static inline int
  68. rpc_clnt_debugfs_register(struct rpc_clnt *clnt)
  69. {
  70. return 0;
  71. }
  72. static inline void
  73. rpc_clnt_debugfs_unregister(struct rpc_clnt *clnt)
  74. {
  75. return;
  76. }
  77. #endif
  78. #endif /* _LINUX_SUNRPC_DEBUG_H_ */