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