blob: 9385bd74c8604fb467979c16c164cdcd4723ec83 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 */
Linus Torvalds1da177e2005-04-16 15:20:36 -07008#ifndef _LINUX_SUNRPC_DEBUG_H_
9#define _LINUX_SUNRPC_DEBUG_H_
10
David Howellse3dd9a52012-10-09 09:49:04 +010011#include <uapi/linux/sunrpc/debug.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012
David Woodhouse1af04222006-04-25 15:16:44 +010013
David Woodhouse1af04222006-04-25 15:16:44 +010014/*
15 * Enable RPC debugging/profiling.
16 */
Trond Myklebuste27d3592012-03-18 14:07:42 -040017#ifdef CONFIG_SUNRPC_DEBUG
David Woodhouse1af04222006-04-25 15:16:44 +010018#define RPC_DEBUG
19#endif
Trond Myklebust2f09c242012-02-08 22:01:15 -050020#ifdef CONFIG_TRACEPOINTS
21#define RPC_TRACEPOINTS
22#endif
David Woodhouse1af04222006-04-25 15:16:44 +010023/* #define RPC_PROFILE */
Linus Torvalds1da177e2005-04-16 15:20:36 -070024
25/*
26 * Debugging macros etc
27 */
28#ifdef RPC_DEBUG
29extern unsigned int rpc_debug;
30extern unsigned int nfs_debug;
31extern unsigned int nfsd_debug;
32extern unsigned int nlm_debug;
33#endif
34
35#define dprintk(args...) dfprintk(FACILITY, ## args)
Trond Myklebust2446ab62012-03-01 17:00:56 -050036#define dprintk_rcu(args...) dfprintk_rcu(FACILITY, ## args)
Linus Torvalds1da177e2005-04-16 15:20:36 -070037
38#undef ifdebug
39#ifdef RPC_DEBUG
40# define ifdebug(fac) if (unlikely(rpc_debug & RPCDBG_##fac))
Trond Myklebust2446ab62012-03-01 17:00:56 -050041
Chuck Leverdbb9c2a2012-02-15 16:35:08 -050042# define dfprintk(fac, args...) \
43 do { \
44 ifdebug(fac) \
45 printk(KERN_DEFAULT args); \
46 } while (0)
Trond Myklebust2446ab62012-03-01 17:00:56 -050047
48# define dfprintk_rcu(fac, args...) \
49 do { \
50 ifdebug(fac) { \
51 rcu_read_lock(); \
52 printk(KERN_DEFAULT args); \
53 rcu_read_unlock(); \
54 } \
55 } while (0)
56
Linus Torvalds1da177e2005-04-16 15:20:36 -070057# define RPC_IFDEBUG(x) x
58#else
59# define ifdebug(fac) if (0)
Chuck Leverb3b536a2012-03-20 19:20:53 -040060# define dfprintk(fac, args...) do {} while (0)
61# define dfprintk_rcu(fac, args...) do {} while (0)
Linus Torvalds1da177e2005-04-16 15:20:36 -070062# define RPC_IFDEBUG(x)
63#endif
64
Linus Torvalds1da177e2005-04-16 15:20:36 -070065/*
66 * Sysctl interface for RPC debugging
67 */
68#ifdef RPC_DEBUG
69void rpc_register_sysctl(void);
70void rpc_unregister_sysctl(void);
71#endif
72
Linus Torvalds1da177e2005-04-16 15:20:36 -070073#endif /* _LINUX_SUNRPC_DEBUG_H_ */