Nicholas Flintham | 1e3d311 | 2013-04-10 10:48:38 +0100 | [diff] [blame^] | 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 | */ |
| 8 | |
| 9 | #ifndef _LINUX_SUNRPC_DEBUG_H_ |
| 10 | #define _LINUX_SUNRPC_DEBUG_H_ |
| 11 | |
| 12 | #define RPCDBG_XPRT 0x0001 |
| 13 | #define RPCDBG_CALL 0x0002 |
| 14 | #define RPCDBG_DEBUG 0x0004 |
| 15 | #define RPCDBG_NFS 0x0008 |
| 16 | #define RPCDBG_AUTH 0x0010 |
| 17 | #define RPCDBG_BIND 0x0020 |
| 18 | #define RPCDBG_SCHED 0x0040 |
| 19 | #define RPCDBG_TRANS 0x0080 |
| 20 | #define RPCDBG_SVCXPRT 0x0100 |
| 21 | #define RPCDBG_SVCDSP 0x0200 |
| 22 | #define RPCDBG_MISC 0x0400 |
| 23 | #define RPCDBG_CACHE 0x0800 |
| 24 | #define RPCDBG_ALL 0x7fff |
| 25 | |
| 26 | #ifdef __KERNEL__ |
| 27 | |
| 28 | #ifdef CONFIG_SUNRPC_DEBUG |
| 29 | #define RPC_DEBUG |
| 30 | #endif |
| 31 | #ifdef CONFIG_TRACEPOINTS |
| 32 | #define RPC_TRACEPOINTS |
| 33 | #endif |
| 34 | |
| 35 | #ifdef RPC_DEBUG |
| 36 | extern unsigned int rpc_debug; |
| 37 | extern unsigned int nfs_debug; |
| 38 | extern unsigned int nfsd_debug; |
| 39 | extern unsigned int nlm_debug; |
| 40 | #endif |
| 41 | |
| 42 | #define dprintk(args...) dfprintk(FACILITY, ## args) |
| 43 | #define dprintk_rcu(args...) dfprintk_rcu(FACILITY, ## args) |
| 44 | |
| 45 | #undef ifdebug |
| 46 | #ifdef RPC_DEBUG |
| 47 | # define ifdebug(fac) if (unlikely(rpc_debug & RPCDBG_##fac)) |
| 48 | |
| 49 | # define dfprintk(fac, args...) \ |
| 50 | do { \ |
| 51 | ifdebug(fac) \ |
| 52 | printk(KERN_DEFAULT args); \ |
| 53 | } while (0) |
| 54 | |
| 55 | # define dfprintk_rcu(fac, args...) \ |
| 56 | do { \ |
| 57 | ifdebug(fac) { \ |
| 58 | rcu_read_lock(); \ |
| 59 | printk(KERN_DEFAULT args); \ |
| 60 | rcu_read_unlock(); \ |
| 61 | } \ |
| 62 | } while (0) |
| 63 | |
| 64 | # define RPC_IFDEBUG(x) x |
| 65 | #else |
| 66 | # define ifdebug(fac) if (0) |
| 67 | # define dfprintk(fac, args...) do {} while (0) |
| 68 | # define dfprintk_rcu(fac, args...) do {} while (0) |
| 69 | # define RPC_IFDEBUG(x) |
| 70 | #endif |
| 71 | |
| 72 | #ifdef RPC_DEBUG |
| 73 | void rpc_register_sysctl(void); |
| 74 | void rpc_unregister_sysctl(void); |
| 75 | #endif |
| 76 | |
| 77 | #endif |
| 78 | |
| 79 | |
| 80 | enum { |
| 81 | CTL_RPCDEBUG = 1, |
| 82 | CTL_NFSDEBUG, |
| 83 | CTL_NFSDDEBUG, |
| 84 | CTL_NLMDEBUG, |
| 85 | CTL_SLOTTABLE_UDP, |
| 86 | CTL_SLOTTABLE_TCP, |
| 87 | CTL_MIN_RESVPORT, |
| 88 | CTL_MAX_RESVPORT, |
| 89 | }; |
| 90 | |
| 91 | #endif |