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 */ 9 #ifndef _LINUX_SUNRPC_DEBUG_H_ 8 #ifndef _LINUX_SUNRPC_DEBUG_H_ 10 #define _LINUX_SUNRPC_DEBUG_H_ 9 #define _LINUX_SUNRPC_DEBUG_H_ 11 10 12 #include <uapi/linux/sunrpc/debug.h> 11 #include <uapi/linux/sunrpc/debug.h> 13 12 14 /* 13 /* 15 * Debugging macros etc 14 * Debugging macros etc 16 */ 15 */ 17 #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) 16 #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) 18 extern unsigned int rpc_debug; 17 extern unsigned int rpc_debug; 19 extern unsigned int nfs_debug; 18 extern unsigned int nfs_debug; 20 extern unsigned int nfsd_debug; 19 extern unsigned int nfsd_debug; 21 extern unsigned int nlm_debug; 20 extern unsigned int nlm_debug; 22 #endif 21 #endif 23 22 24 #define dprintk(fmt, ...) !! 23 #define dprintk(args...) dfprintk(FACILITY, ## args) 25 dfprintk(FACILITY, fmt, ##__VA_ARGS__) !! 24 #define dprintk_rcu(args...) dfprintk_rcu(FACILITY, ## 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 25 33 #undef ifdebug 26 #undef ifdebug 34 #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) 27 #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) 35 # define ifdebug(fac) if (unlikely(r 28 # define ifdebug(fac) if (unlikely(rpc_debug & RPCDBG_##fac)) 36 29 37 # define dfprintk(fac, fmt, ...) !! 30 # define dfprintk(fac, args...) \ 38 do { !! 31 do { \ 39 ifdebug(fac) !! 32 ifdebug(fac) \ 40 printk(KERN_DEFAULT fmt, ##__V !! 33 printk(KERN_DEFAULT args); \ 41 } while (0) !! 34 } while (0) 42 !! 35 43 # define dfprintk_cont(fac, fmt, ...) !! 36 # define dfprintk_rcu(fac, args...) \ 44 do { !! 37 do { \ 45 ifdebug(fac) !! 38 ifdebug(fac) { \ 46 printk(KERN_CONT fmt, ##__VA_A !! 39 rcu_read_lock(); \ 47 } while (0) !! 40 printk(KERN_DEFAULT args); \ 48 !! 41 rcu_read_unlock(); \ 49 # define dfprintk_rcu(fac, fmt, ...) !! 42 } \ 50 do { !! 43 } while (0) 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 44 67 # define RPC_IFDEBUG(x) x 45 # define RPC_IFDEBUG(x) x 68 #else 46 #else 69 # define ifdebug(fac) if (0) 47 # define ifdebug(fac) if (0) 70 # define dfprintk(fac, fmt, ...) do {} !! 48 # define dfprintk(fac, args...) do {} while (0) 71 # define dfprintk_cont(fac, fmt, ...) do {} !! 49 # define dfprintk_rcu(fac, args...) do {} while (0) 72 # define dfprintk_rcu(fac, fmt, ...) do {} << 73 # define RPC_IFDEBUG(x) 50 # define RPC_IFDEBUG(x) 74 #endif 51 #endif 75 52 76 /* 53 /* 77 * Sysctl interface for RPC debugging 54 * Sysctl interface for RPC debugging 78 */ 55 */ 79 56 80 struct rpc_clnt; 57 struct rpc_clnt; 81 struct rpc_xprt; 58 struct rpc_xprt; 82 59 83 #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) 60 #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) 84 void rpc_register_sysctl(void); 61 void rpc_register_sysctl(void); 85 void rpc_unregister_sysctl(void); 62 void rpc_unregister_sysctl(void); 86 void sunrpc_debugfs_init(void); 63 void sunrpc_debugfs_init(void); 87 void sunrpc_debugfs_exit(void); 64 void sunrpc_debugfs_exit(void); 88 void rpc_clnt_debugfs_register(stru 65 void rpc_clnt_debugfs_register(struct rpc_clnt *); 89 void rpc_clnt_debugfs_unregister(st 66 void rpc_clnt_debugfs_unregister(struct rpc_clnt *); 90 void rpc_xprt_debugfs_register(stru 67 void rpc_xprt_debugfs_register(struct rpc_xprt *); 91 void rpc_xprt_debugfs_unregister(st 68 void rpc_xprt_debugfs_unregister(struct rpc_xprt *); 92 #else 69 #else 93 static inline void 70 static inline void 94 sunrpc_debugfs_init(void) 71 sunrpc_debugfs_init(void) 95 { 72 { 96 return; 73 return; 97 } 74 } 98 75 99 static inline void 76 static inline void 100 sunrpc_debugfs_exit(void) 77 sunrpc_debugfs_exit(void) 101 { 78 { 102 return; 79 return; 103 } 80 } 104 81 105 static inline void 82 static inline void 106 rpc_clnt_debugfs_register(struct rpc_clnt *cln 83 rpc_clnt_debugfs_register(struct rpc_clnt *clnt) 107 { 84 { 108 return; 85 return; 109 } 86 } 110 87 111 static inline void 88 static inline void 112 rpc_clnt_debugfs_unregister(struct rpc_clnt *c 89 rpc_clnt_debugfs_unregister(struct rpc_clnt *clnt) 113 { 90 { 114 return; 91 return; 115 } 92 } 116 93 117 static inline void 94 static inline void 118 rpc_xprt_debugfs_register(struct rpc_xprt *xpr 95 rpc_xprt_debugfs_register(struct rpc_xprt *xprt) 119 { 96 { 120 return; 97 return; 121 } 98 } 122 99 123 static inline void 100 static inline void 124 rpc_xprt_debugfs_unregister(struct rpc_xprt *x 101 rpc_xprt_debugfs_unregister(struct rpc_xprt *xprt) 125 { 102 { 126 return; 103 return; 127 } 104 } 128 #endif 105 #endif 129 106 130 #endif /* _LINUX_SUNRPC_DEBUG_H_ */ 107 #endif /* _LINUX_SUNRPC_DEBUG_H_ */ 131 108
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.