Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * linux/include/linux/sunrpc/debug.h | |
3 | * | |
4 | * Debugging support for sunrpc module | |
5 | * | |
6 | * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de> | |
7 | */ | |
1da177e4 LT |
8 | #ifndef _LINUX_SUNRPC_DEBUG_H_ |
9 | #define _LINUX_SUNRPC_DEBUG_H_ | |
10 | ||
e3dd9a52 | 11 | #include <uapi/linux/sunrpc/debug.h> |
1da177e4 | 12 | |
1da177e4 LT |
13 | /* |
14 | * Debugging macros etc | |
15 | */ | |
f895b252 | 16 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
1da177e4 LT |
17 | extern unsigned int rpc_debug; |
18 | extern unsigned int nfs_debug; | |
19 | extern unsigned int nfsd_debug; | |
20 | extern unsigned int nlm_debug; | |
21 | #endif | |
22 | ||
23 | #define dprintk(args...) dfprintk(FACILITY, ## args) | |
2446ab60 | 24 | #define dprintk_rcu(args...) dfprintk_rcu(FACILITY, ## args) |
1da177e4 LT |
25 | |
26 | #undef ifdebug | |
f895b252 | 27 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
1da177e4 | 28 | # define ifdebug(fac) if (unlikely(rpc_debug & RPCDBG_##fac)) |
2446ab60 | 29 | |
dbb9c2a2 CL |
30 | # define dfprintk(fac, args...) \ |
31 | do { \ | |
32 | ifdebug(fac) \ | |
33 | printk(KERN_DEFAULT args); \ | |
34 | } while (0) | |
2446ab60 TM |
35 | |
36 | # define dfprintk_rcu(fac, args...) \ | |
37 | do { \ | |
38 | ifdebug(fac) { \ | |
39 | rcu_read_lock(); \ | |
40 | printk(KERN_DEFAULT args); \ | |
41 | rcu_read_unlock(); \ | |
42 | } \ | |
43 | } while (0) | |
44 | ||
1da177e4 LT |
45 | # define RPC_IFDEBUG(x) x |
46 | #else | |
47 | # define ifdebug(fac) if (0) | |
b3b536a1 CL |
48 | # define dfprintk(fac, args...) do {} while (0) |
49 | # define dfprintk_rcu(fac, args...) do {} while (0) | |
1da177e4 LT |
50 | # define RPC_IFDEBUG(x) |
51 | #endif | |
52 | ||
1da177e4 LT |
53 | /* |
54 | * Sysctl interface for RPC debugging | |
55 | */ | |
b4b9d2cc JL |
56 | |
57 | struct rpc_clnt; | |
388f0c77 | 58 | struct rpc_xprt; |
b4b9d2cc | 59 | |
f895b252 | 60 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
1da177e4 LT |
61 | void rpc_register_sysctl(void); |
62 | void rpc_unregister_sysctl(void); | |
f9c72d10 | 63 | void sunrpc_debugfs_init(void); |
b4b9d2cc | 64 | void sunrpc_debugfs_exit(void); |
f9c72d10 | 65 | void rpc_clnt_debugfs_register(struct rpc_clnt *); |
b4b9d2cc | 66 | void rpc_clnt_debugfs_unregister(struct rpc_clnt *); |
f9c72d10 | 67 | void rpc_xprt_debugfs_register(struct rpc_xprt *); |
388f0c77 | 68 | void rpc_xprt_debugfs_unregister(struct rpc_xprt *); |
b4b9d2cc | 69 | #else |
f9c72d10 | 70 | static inline void |
b4b9d2cc JL |
71 | sunrpc_debugfs_init(void) |
72 | { | |
f9c72d10 | 73 | return; |
b4b9d2cc JL |
74 | } |
75 | ||
76 | static inline void | |
77 | sunrpc_debugfs_exit(void) | |
78 | { | |
79 | return; | |
80 | } | |
81 | ||
f9c72d10 | 82 | static inline void |
b4b9d2cc JL |
83 | rpc_clnt_debugfs_register(struct rpc_clnt *clnt) |
84 | { | |
f9c72d10 | 85 | return; |
b4b9d2cc JL |
86 | } |
87 | ||
88 | static inline void | |
89 | rpc_clnt_debugfs_unregister(struct rpc_clnt *clnt) | |
90 | { | |
91 | return; | |
92 | } | |
388f0c77 | 93 | |
f9c72d10 | 94 | static inline void |
388f0c77 JL |
95 | rpc_xprt_debugfs_register(struct rpc_xprt *xprt) |
96 | { | |
f9c72d10 | 97 | return; |
388f0c77 JL |
98 | } |
99 | ||
100 | static inline void | |
101 | rpc_xprt_debugfs_unregister(struct rpc_xprt *xprt) | |
102 | { | |
103 | return; | |
104 | } | |
1da177e4 LT |
105 | #endif |
106 | ||
1da177e4 | 107 | #endif /* _LINUX_SUNRPC_DEBUG_H_ */ |