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