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