Linux Audio

Check our new training course

Loading...
v5.4
  1/* SPDX-License-Identifier: GPL-2.0-or-later */
  2/*
  3 *
  4 *   Copyright (c) International Business Machines  Corp., 2000,2002
  5 *   Modified by Steve French (sfrench@us.ibm.com)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  6*/
  7
  8#ifndef _H_CIFS_DEBUG
  9#define _H_CIFS_DEBUG
 10
 11void cifs_dump_mem(char *label, void *data, int length);
 12void cifs_dump_detail(void *buf, struct TCP_Server_Info *ptcp_info);
 13void cifs_dump_mids(struct TCP_Server_Info *);
 14extern bool traceSMB;		/* flag which enables the function below */
 15void dump_smb(void *, int);
 16#define CIFS_INFO	0x01
 17#define CIFS_RC		0x02
 18#define CIFS_TIMER	0x04
 19
 20#define VFS 1
 21#define FYI 2
 22extern int cifsFYI;
 23#ifdef CONFIG_CIFS_DEBUG2
 24#define NOISY 4
 25#else
 26#define NOISY 0
 27#endif
 28#define ONCE 8
 29
 30/*
 31 *	debug ON
 32 *	--------
 33 */
 34#ifdef CONFIG_CIFS_DEBUG
 35
 36
 37/*
 38 * When adding tracepoints and debug messages we have various choices.
 39 * Some considerations:
 40 *
 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
 46 */
 47
 48/* Information level messages, minor events */
 49#define cifs_info_func(ratefunc, fmt, ...)			\
 50do {								\
 51	pr_info_ ## ratefunc("CIFS: " fmt, ##__VA_ARGS__); 	\
 52} while (0)
 53
 54#define cifs_info(fmt, ...)					\
 55do { 								\
 56	cifs_info_func(ratelimited, fmt, ##__VA_ARGS__); 	\
 57} while (0)
 58
 59/* information message: e.g., configuration, major event */
 60#define cifs_dbg_func(ratefunc, type, fmt, ...)			\
 61do {								\
 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__);	\
 70	}							\
 71} while (0)
 72
 73#define cifs_dbg(type, fmt, ...) \
 74do {							\
 75	if ((type) & ONCE)				\
 76		cifs_dbg_func(once,			\
 77			 type, fmt, ##__VA_ARGS__);	\
 78	else						\
 79		cifs_dbg_func(ratelimited,		\
 80			type, fmt, ##__VA_ARGS__);	\
 81} while (0)
 82
 83#define cifs_server_dbg_func(ratefunc, type, fmt, ...)		\
 84do {								\
 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,	\
 93			sn, ##__VA_ARGS__);			\
 94	} else if ((type) & NOISY && (NOISY != 0)) {		\
 95		pr_debug_ ## ratefunc("\\\\%s " fmt,		\
 96			sn, ##__VA_ARGS__);			\
 97	}							\
 98} while (0)
 99
100#define cifs_server_dbg(type, fmt, ...)			\
101do {							\
102	if ((type) & ONCE)				\
103		cifs_server_dbg_func(once,		\
104			type, fmt, ##__VA_ARGS__);	\
105	else						\
106		cifs_server_dbg_func(ratelimited,	\
107			type, fmt, ##__VA_ARGS__);	\
108} while (0)
109
110#define cifs_tcon_dbg_func(ratefunc, type, fmt, ...)		\
111do {								\
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__);			\
124	}							\
125} while (0)
126
127#define cifs_tcon_dbg(type, fmt, ...)			\
128do {							\
129	if ((type) & ONCE)				\
130		cifs_tcon_dbg_func(once,		\
131			type, fmt, ##__VA_ARGS__);	\
132	else						\
133		cifs_tcon_dbg_func(ratelimited,	\
134			type, fmt, ##__VA_ARGS__);	\
135} while (0)
136
137/*
138 *	debug OFF
139 *	---------
140 */
141#else		/* _CIFS_DEBUG */
142#define cifs_dbg(type, fmt, ...)					\
143do {									\
144	if (0)								\
145		pr_debug(fmt, ##__VA_ARGS__);				\
146} while (0)
147
148#define cifs_server_dbg(type, fmt, ...)					\
149do {									\
150	if (0)								\
151		pr_debug("\\\\%s " fmt,					\
152			 server->hostname, ##__VA_ARGS__);		\
153} while (0)
154
155#define cifs_tcon_dbg(type, fmt, ...)					\
156do {									\
157	if (0)								\
158		pr_debug("%s " fmt, tcon->treeName, ##__VA_ARGS__);	\
159} while (0)
160
161#define cifs_info(fmt, ...)						\
162do {									\
163	pr_info("CIFS: "fmt, ##__VA_ARGS__);				\
164} while (0)
165#endif
166
167#endif				/* _H_CIFS_DEBUG */
v4.10.11
 
 1/*
 2 *
 3 *   Copyright (c) International Business Machines  Corp., 2000,2002
 4 *   Modified by Steve French (sfrench@us.ibm.com)
 5 *
 6 *   This program is free software;  you can redistribute it and/or modify
 7 *   it under the terms of the GNU General Public License as published by
 8 *   the Free Software Foundation; either version 2 of the License, or
 9 *   (at your option) any later version.
10 *
11 *   This program is distributed in the hope that it will be useful,
12 *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
13 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
14 *   the GNU General Public License for more details.
15 *
16 *   You should have received a copy of the GNU General Public License
17 *   along with this program;  if not, write to the Free Software
18 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20*/
21
22#ifndef _H_CIFS_DEBUG
23#define _H_CIFS_DEBUG
24
25void cifs_dump_mem(char *label, void *data, int length);
26void cifs_dump_detail(void *);
27void cifs_dump_mids(struct TCP_Server_Info *);
28extern bool traceSMB;		/* flag which enables the function below */
29void dump_smb(void *, int);
30#define CIFS_INFO	0x01
31#define CIFS_RC		0x02
32#define CIFS_TIMER	0x04
33
34#define VFS 1
35#define FYI 2
36extern int cifsFYI;
37#ifdef CONFIG_CIFS_DEBUG2
38#define NOISY 4
39#else
40#define NOISY 0
41#endif
 
42
43/*
44 *	debug ON
45 *	--------
46 */
47#ifdef CONFIG_CIFS_DEBUG
48
49__printf(1, 2) void cifs_vfs_err(const char *fmt, ...);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
51/* information message: e.g., configuration, major event */
52#define cifs_dbg(type, fmt, ...)					\
53do {									\
54	if (type == FYI && cifsFYI & CIFS_INFO) {			\
55		pr_debug_ratelimited("%s: "				\
56			    fmt, __FILE__, ##__VA_ARGS__);		\
57	} else if (type == VFS) {					\
58		cifs_vfs_err(fmt, ##__VA_ARGS__);			\
59	} else if (type == NOISY && type != 0) {			\
60		pr_debug_ratelimited(fmt, ##__VA_ARGS__);		\
61	}								\
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62} while (0)
63
64/*
65 *	debug OFF
66 *	---------
67 */
68#else		/* _CIFS_DEBUG */
69#define cifs_dbg(type, fmt, ...)					\
70do {									\
71	if (0)								\
72		pr_debug(fmt, ##__VA_ARGS__);				\
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73} while (0)
74#endif
75
76#endif				/* _H_CIFS_DEBUG */