1 /* SPDX-License-Identifier: GPL-2.0 */ << 2 /* 1 /* 3 * linux/include/linux/sunrpc/debug.h 2 * linux/include/linux/sunrpc/debug.h 4 * 3 * 5 * Debugging support for sunrpc module 4 * Debugging support for sunrpc module 6 * 5 * 7 * Copyright (C) 1996, Olaf Kirch <okir@monad. 6 * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> 8 */ 7 */ >> 8 9 #ifndef _LINUX_SUNRPC_DEBUG_H_ 9 #ifndef _LINUX_SUNRPC_DEBUG_H_ 10 #define _LINUX_SUNRPC_DEBUG_H_ 10 #define _LINUX_SUNRPC_DEBUG_H_ 11 11 12 #include <uapi/linux/sunrpc/debug.h> !! 12 /* >> 13 * RPC debug facilities >> 14 */ >> 15 #define RPCDBG_XPRT 0x0001 >> 16 #define RPCDBG_CALL 0x0002 >> 17 #define RPCDBG_DEBUG 0x0004 >> 18 #define RPCDBG_NFS 0x0008 >> 19 #define RPCDBG_AUTH 0x0010 >> 20 #define RPCDBG_BIND 0x0020 >> 21 #define RPCDBG_SCHED 0x0040 >> 22 #define RPCDBG_TRANS 0x0080 >> 23 #define RPCDBG_SVCXPRT 0x0100 >> 24 #define RPCDBG_SVCDSP 0x0200 >> 25 #define RPCDBG_MISC 0x0400 >> 26 #define RPCDBG_CACHE 0x0800 >> 27 #define RPCDBG_ALL 0x7fff >> 28 >> 29 #ifdef __KERNEL__ >> 30 >> 31 #include <linux/timer.h> >> 32 #include <linux/workqueue.h> >> 33 >> 34 /* >> 35 * Enable RPC debugging/profiling. >> 36 */ >> 37 #ifdef CONFIG_SYSCTL >> 38 #define RPC_DEBUG >> 39 #endif >> 40 /* #define RPC_PROFILE */ 13 41 14 /* 42 /* 15 * Debugging macros etc 43 * Debugging macros etc 16 */ 44 */ 17 #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) !! 45 #ifdef RPC_DEBUG 18 extern unsigned int rpc_debug; 46 extern unsigned int rpc_debug; 19 extern unsigned int nfs_debug; 47 extern unsigned int nfs_debug; 20 extern unsigned int nfsd_debug; 48 extern unsigned int nfsd_debug; 21 extern unsigned int nlm_debug; 49 extern unsigned int nlm_debug; 22 #endif 50 #endif 23 51 24 #define dprintk(fmt, ...) !! 52 #define dprintk(args...) dfprintk(FACILITY, ## args) 25 dfprintk(FACILITY, fmt, ##__VA_ARGS__) << 26 #define dprintk_cont(fmt, ...) << 27 dfprintk_cont(FACILITY, fmt, ##__VA_AR << 28 #define dprintk_rcu(fmt, ...) << 29 dfprintk_rcu(FACILITY, fmt, ##__VA_ARG << 30 #define dprintk_rcu_cont(fmt, ...) << 31 dfprintk_rcu_cont(FACILITY, fmt, ##__V << 32 53 33 #undef ifdebug 54 #undef ifdebug 34 #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) !! 55 #ifdef RPC_DEBUG 35 # define ifdebug(fac) if (unlikely(r 56 # define ifdebug(fac) if (unlikely(rpc_debug & RPCDBG_##fac)) 36 !! 57 # define dfprintk(fac, args...) do { ifdebug(fac) printk(args); } while(0) 37 # define dfprintk(fac, fmt, ...) << 38 do { << 39 ifdebug(fac) << 40 printk(KERN_DEFAULT fmt, ##__V << 41 } while (0) << 42 << 43 # define dfprintk_cont(fac, fmt, ...) << 44 do { << 45 ifdebug(fac) << 46 printk(KERN_CONT fmt, ##__VA_A << 47 } while (0) << 48 << 49 # define dfprintk_rcu(fac, fmt, ...) << 50 do { << 51 ifdebug(fac) { << 52 rcu_read_lock(); << 53 printk(KERN_DEFAULT fmt, ##__V << 54 rcu_read_unlock(); << 55 } << 56 } while (0) << 57 << 58 # define dfprintk_rcu_cont(fac, fmt, ...) << 59 do { << 60 ifdebug(fac) { << 61 rcu_read_lock(); << 62 printk(KERN_CONT fmt, ##__VA_A << 63 rcu_read_unlock(); << 64 } << 65 } while (0) << 66 << 67 # define RPC_IFDEBUG(x) x 58 # define RPC_IFDEBUG(x) x 68 #else 59 #else 69 # define ifdebug(fac) if (0) 60 # define ifdebug(fac) if (0) 70 # define dfprintk(fac, fmt, ...) do {} !! 61 # define dfprintk(fac, args...) do ; while (0) 71 # define dfprintk_cont(fac, fmt, ...) do {} << 72 # define dfprintk_rcu(fac, fmt, ...) do {} << 73 # define RPC_IFDEBUG(x) 62 # define RPC_IFDEBUG(x) 74 #endif 63 #endif 75 64 76 /* 65 /* 77 * Sysctl interface for RPC debugging 66 * Sysctl interface for RPC debugging 78 */ 67 */ 79 !! 68 #ifdef RPC_DEBUG 80 struct rpc_clnt; << 81 struct rpc_xprt; << 82 << 83 #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) << 84 void rpc_register_sysctl(void); 69 void rpc_register_sysctl(void); 85 void rpc_unregister_sysctl(void); 70 void rpc_unregister_sysctl(void); 86 void sunrpc_debugfs_init(void); << 87 void sunrpc_debugfs_exit(void); << 88 void rpc_clnt_debugfs_register(stru << 89 void rpc_clnt_debugfs_unregister(st << 90 void rpc_xprt_debugfs_register(stru << 91 void rpc_xprt_debugfs_unregister(st << 92 #else << 93 static inline void << 94 sunrpc_debugfs_init(void) << 95 { << 96 return; << 97 } << 98 << 99 static inline void << 100 sunrpc_debugfs_exit(void) << 101 { << 102 return; << 103 } << 104 << 105 static inline void << 106 rpc_clnt_debugfs_register(struct rpc_clnt *cln << 107 { << 108 return; << 109 } << 110 << 111 static inline void << 112 rpc_clnt_debugfs_unregister(struct rpc_clnt *c << 113 { << 114 return; << 115 } << 116 << 117 static inline void << 118 rpc_xprt_debugfs_register(struct rpc_xprt *xpr << 119 { << 120 return; << 121 } << 122 << 123 static inline void << 124 rpc_xprt_debugfs_unregister(struct rpc_xprt *x << 125 { << 126 return; << 127 } << 128 #endif 71 #endif >> 72 >> 73 #endif /* __KERNEL__ */ >> 74 >> 75 /* >> 76 * Declarations for the sysctl debug interface, which allows to read or >> 77 * change the debug flags for rpc, nfs, nfsd, and lockd. Since the sunrpc >> 78 * module currently registers its sysctl table dynamically, the sysctl path >> 79 * for module FOO is <CTL_SUNRPC, CTL_FOODEBUG>. >> 80 */ >> 81 >> 82 enum { >> 83 CTL_RPCDEBUG = 1, >> 84 CTL_NFSDEBUG, >> 85 CTL_NFSDDEBUG, >> 86 CTL_NLMDEBUG, >> 87 CTL_SLOTTABLE_UDP, >> 88 CTL_SLOTTABLE_TCP, >> 89 CTL_MIN_RESVPORT, >> 90 CTL_MAX_RESVPORT, >> 91 }; 129 92 130 #endif /* _LINUX_SUNRPC_DEBUG_H_ */ 93 #endif /* _LINUX_SUNRPC_DEBUG_H_ */ 131 94
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.