1 /* SPDX-License-Identifier: GPL-2.0-or-later */
4 * Copyright (c) International Business Machines Corp., 2000,2002
5 * Modified by Steve French (sfrench@us.ibm.com)
11 void cifs_dump_mem(char *label
, void *data
, int length
);
12 void cifs_dump_detail(void *buf
, struct TCP_Server_Info
*ptcp_info
);
13 void cifs_dump_mids(struct TCP_Server_Info
*);
14 extern bool traceSMB
; /* flag which enables the function below */
15 void dump_smb(void *, int);
16 #define CIFS_INFO 0x01
18 #define CIFS_TIMER 0x04
23 #ifdef CONFIG_CIFS_DEBUG2
34 #ifdef CONFIG_CIFS_DEBUG
38 * When adding tracepoints and debug messages we have various choices.
39 * Some considerations:
41 * Use cifs_dbg(VFS, ...) for things we always want logged, and the user to see
42 * cifs_info(...) slightly less important, admin can filter via loglevel > 6
43 * cifs_dbg(FYI, ...) minor debugging messages, off by default
44 * trace_smb3_* ftrace functions are preferred for complex debug messages
45 * intended for developers or experienced admins, off by default
48 /* Information level messages, minor events */
49 #define cifs_info_func(ratefunc, fmt, ...) \
51 pr_info_ ## ratefunc("CIFS: " fmt, ##__VA_ARGS__); \
54 #define cifs_info(fmt, ...) \
56 cifs_info_func(ratelimited, fmt, ##__VA_ARGS__); \
59 /* information message: e.g., configuration, major event */
60 #define cifs_dbg_func(ratefunc, type, fmt, ...) \
62 if ((type) & FYI && cifsFYI & CIFS_INFO) { \
63 pr_debug_ ## ratefunc("%s: " \
64 fmt, __FILE__, ##__VA_ARGS__); \
65 } else if ((type) & VFS) { \
66 pr_err_ ## ratefunc("CIFS VFS: " \
67 fmt, ##__VA_ARGS__); \
68 } else if ((type) & NOISY && (NOISY != 0)) { \
69 pr_debug_ ## ratefunc(fmt, ##__VA_ARGS__); \
73 #define cifs_dbg(type, fmt, ...) \
77 type, fmt, ##__VA_ARGS__); \
79 cifs_dbg_func(ratelimited, \
80 type, fmt, ##__VA_ARGS__); \
83 #define cifs_server_dbg_func(ratefunc, type, fmt, ...) \
85 const char *sn = ""; \
86 if (server && server->hostname) \
87 sn = server->hostname; \
88 if ((type) & FYI && cifsFYI & CIFS_INFO) { \
89 pr_debug_ ## ratefunc("%s: \\\\%s " fmt, \
90 __FILE__, sn, ##__VA_ARGS__); \
91 } else if ((type) & VFS) { \
92 pr_err_ ## ratefunc("CIFS VFS: \\\\%s " fmt, \
94 } else if ((type) & NOISY && (NOISY != 0)) { \
95 pr_debug_ ## ratefunc("\\\\%s " fmt, \
100 #define cifs_server_dbg(type, fmt, ...) \
103 cifs_server_dbg_func(once, \
104 type, fmt, ##__VA_ARGS__); \
106 cifs_server_dbg_func(ratelimited, \
107 type, fmt, ##__VA_ARGS__); \
110 #define cifs_tcon_dbg_func(ratefunc, type, fmt, ...) \
112 const char *tn = ""; \
113 if (tcon && tcon->treeName) \
114 tn = tcon->treeName; \
115 if ((type) & FYI && cifsFYI & CIFS_INFO) { \
116 pr_debug_ ## ratefunc("%s: %s " fmt, \
117 __FILE__, tn, ##__VA_ARGS__); \
118 } else if ((type) & VFS) { \
119 pr_err_ ## ratefunc("CIFS VFS: %s " fmt, \
120 tn, ##__VA_ARGS__); \
121 } else if ((type) & NOISY && (NOISY != 0)) { \
122 pr_debug_ ## ratefunc("%s " fmt, \
123 tn, ##__VA_ARGS__); \
127 #define cifs_tcon_dbg(type, fmt, ...) \
130 cifs_tcon_dbg_func(once, \
131 type, fmt, ##__VA_ARGS__); \
133 cifs_tcon_dbg_func(ratelimited, \
134 type, fmt, ##__VA_ARGS__); \
141 #else /* _CIFS_DEBUG */
142 #define cifs_dbg(type, fmt, ...) \
145 pr_debug(fmt, ##__VA_ARGS__); \
148 #define cifs_server_dbg(type, fmt, ...) \
151 pr_debug("\\\\%s " fmt, \
152 server->hostname, ##__VA_ARGS__); \
155 #define cifs_tcon_dbg(type, fmt, ...) \
158 pr_debug("%s " fmt, tcon->treeName, ##__VA_ARGS__); \
161 #define cifs_info(fmt, ...) \
163 pr_info("CIFS: "fmt, ##__VA_ARGS__); \
167 #endif /* _H_CIFS_DEBUG */