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