debug.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. * Enable RPC debugging/profiling.
  13. */
  14. #ifdef CONFIG_SUNRPC_DEBUG
  15. #define RPC_DEBUG
  16. #endif
  17. #ifdef CONFIG_TRACEPOINTS
  18. #define RPC_TRACEPOINTS
  19. #endif
  20. /* #define RPC_PROFILE */
  21. /*
  22. * Debugging macros etc
  23. */
  24. #ifdef RPC_DEBUG
  25. extern unsigned int rpc_debug;
  26. extern unsigned int nfs_debug;
  27. extern unsigned int nfsd_debug;
  28. extern unsigned int nlm_debug;
  29. #endif
  30. #define dprintk(args...) dfprintk(FACILITY, ## args)
  31. #define dprintk_rcu(args...) dfprintk_rcu(FACILITY, ## args)
  32. #undef ifdebug
  33. #ifdef RPC_DEBUG
  34. # define ifdebug(fac) if (unlikely(rpc_debug & RPCDBG_##fac))
  35. # define dfprintk(fac, args...) \
  36. do { \
  37. ifdebug(fac) \
  38. printk(KERN_DEFAULT args); \
  39. } while (0)
  40. # define dfprintk_rcu(fac, args...) \
  41. do { \
  42. ifdebug(fac) { \
  43. rcu_read_lock(); \
  44. printk(KERN_DEFAULT args); \
  45. rcu_read_unlock(); \
  46. } \
  47. } while (0)
  48. # define RPC_IFDEBUG(x) x
  49. #else
  50. # define ifdebug(fac) if (0)
  51. # define dfprintk(fac, args...) do {} while (0)
  52. # define dfprintk_rcu(fac, args...) do {} while (0)
  53. # define RPC_IFDEBUG(x)
  54. #endif
  55. /*
  56. * Sysctl interface for RPC debugging
  57. */
  58. #ifdef RPC_DEBUG
  59. void rpc_register_sysctl(void);
  60. void rpc_unregister_sysctl(void);
  61. #endif
  62. #endif /* _LINUX_SUNRPC_DEBUG_H_ */