cifs_debug.h 2.3 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
/*
 *
 *   Copyright (c) International Business Machines  Corp., 2000,2002
 *   Modified by Steve French (sfrench@us.ibm.com)
 *
 *   This program is free software;  you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
 *   the GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program;  if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
*/

#ifndef _H_CIFS_DEBUG
#define _H_CIFS_DEBUG

void cifs_dump_mem(char *label, void *data, int length);
26
void cifs_dump_detail(void *);
27
void cifs_dump_mids(struct TCP_Server_Info *);
28
extern bool traceSMB;		/* flag which enables the function below */
29
void dump_smb(void *, int);
S
Steve French 已提交
30
#define CIFS_INFO	0x01
31
#define CIFS_RC		0x02
S
Steve French 已提交
32
#define CIFS_TIMER	0x04
L
Linus Torvalds 已提交
33

34 35
#define VFS 1
#define FYI 2
36
extern int cifsFYI;
37 38 39 40 41
#ifdef CONFIG_CIFS_DEBUG2
#define NOISY 4
#else
#define NOISY 0
#endif
42
#define ONCE 8
43

L
Linus Torvalds 已提交
44 45 46 47
/*
 *	debug ON
 *	--------
 */
48
#ifdef CONFIG_CIFS_DEBUG
L
Linus Torvalds 已提交
49

50
/* information message: e.g., configuration, major event */
51 52 53 54 55 56
#define cifs_dbg_func(ratefunc, type, fmt, ...)			\
do {								\
	if ((type) & FYI && cifsFYI & CIFS_INFO) {		\
		pr_debug_ ## ratefunc("%s: "			\
				fmt, __FILE__, ##__VA_ARGS__);	\
	} else if ((type) & VFS) {				\
A
Aurelien Aptel 已提交
57
		pr_err_ ## ratefunc("CIFS VFS: "		\
58 59 60 61 62 63 64 65 66 67 68 69 70 71
				 fmt, ##__VA_ARGS__);		\
	} else if ((type) & NOISY && (NOISY != 0)) {		\
		pr_debug_ ## ratefunc(fmt, ##__VA_ARGS__);	\
	}							\
} while (0)

#define cifs_dbg(type, fmt, ...) \
do {							\
	if ((type) & ONCE)				\
		cifs_dbg_func(once,			\
			 type, fmt, ##__VA_ARGS__);	\
	else						\
		cifs_dbg_func(ratelimited,		\
			type, fmt, ##__VA_ARGS__);	\
72
} while (0)
L
Linus Torvalds 已提交
73 74 75 76 77 78

/*
 *	debug OFF
 *	---------
 */
#else		/* _CIFS_DEBUG */
79
#define cifs_dbg(type, fmt, ...)					\
80 81
do {									\
	if (0)								\
82
		pr_debug(fmt, ##__VA_ARGS__);				\
83
} while (0)
84
#endif
L
Linus Torvalds 已提交
85 86

#endif				/* _H_CIFS_DEBUG */