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