]>
Commit | Line | Data |
---|---|---|
1a59d1b8 | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
1da177e4 LT |
2 | /* |
3 | * | |
4 | * Copyright (c) International Business Machines Corp., 2000,2002 | |
5 | * Modified by Steve French (sfrench@us.ibm.com) | |
1da177e4 | 6 | */ |
1da177e4 LT |
7 | |
8 | #ifndef _H_CIFS_DEBUG | |
9 | #define _H_CIFS_DEBUG | |
10 | ||
11 | void cifs_dump_mem(char *label, void *data, int length); | |
14547f7d | 12 | void cifs_dump_detail(void *buf, struct TCP_Server_Info *ptcp_info); |
3979877e | 13 | void cifs_dump_mids(struct TCP_Server_Info *); |
1404297e | 14 | extern bool traceSMB; /* flag which enables the function below */ |
792af7b0 | 15 | void dump_smb(void *, int); |
1047abc1 | 16 | #define CIFS_INFO 0x01 |
13cd4b7f | 17 | #define CIFS_RC 0x02 |
1047abc1 | 18 | #define CIFS_TIMER 0x04 |
1da177e4 | 19 | |
f96637be JP |
20 | #define VFS 1 |
21 | #define FYI 2 | |
bde98197 | 22 | extern int cifsFYI; |
f96637be JP |
23 | #ifdef CONFIG_CIFS_DEBUG2 |
24 | #define NOISY 4 | |
25 | #else | |
26 | #define NOISY 0 | |
27 | #endif | |
f2f176b4 | 28 | #define ONCE 8 |
bde98197 | 29 | |
1da177e4 LT |
30 | /* |
31 | * debug ON | |
32 | * -------- | |
33 | */ | |
471b1f98 | 34 | #ifdef CONFIG_CIFS_DEBUG |
1da177e4 | 35 | |
8c1beb98 SF |
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 | ||
9a0efecc RF |
48 | /* Information level messages, minor events */ |
49 | #define cifs_info_func(ratefunc, fmt, ...) \ | |
50 | do { \ | |
51 | pr_info_ ## ratefunc("CIFS: " fmt, ##__VA_ARGS__); \ | |
52 | } while (0) | |
53 | ||
54 | #define cifs_info(fmt, ...) \ | |
55 | do { \ | |
56 | cifs_info_func(ratelimited, fmt, ##__VA_ARGS__); \ | |
57 | } while (0) | |
58 | ||
f96637be | 59 | /* information message: e.g., configuration, major event */ |
f2f176b4 AA |
60 | #define cifs_dbg_func(ratefunc, type, fmt, ...) \ |
61 | do { \ | |
62 | if ((type) & FYI && cifsFYI & CIFS_INFO) { \ | |
63 | pr_debug_ ## ratefunc("%s: " \ | |
64 | fmt, __FILE__, ##__VA_ARGS__); \ | |
65 | } else if ((type) & VFS) { \ | |
596632de | 66 | pr_err_ ## ratefunc("CIFS VFS: " \ |
f2f176b4 AA |
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, ...) \ | |
74 | do { \ | |
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__); \ | |
b6b38f70 | 81 | } while (0) |
1da177e4 LT |
82 | |
83 | /* | |
84 | * debug OFF | |
85 | * --------- | |
86 | */ | |
87 | #else /* _CIFS_DEBUG */ | |
f96637be | 88 | #define cifs_dbg(type, fmt, ...) \ |
bde98197 JP |
89 | do { \ |
90 | if (0) \ | |
0b456f04 | 91 | pr_debug(fmt, ##__VA_ARGS__); \ |
bde98197 | 92 | } while (0) |
9a0efecc RF |
93 | |
94 | #define cifs_info(fmt, ...) \ | |
95 | do { \ | |
96 | pr_info("CIFS: "fmt, ##__VA_ARGS__); \ | |
97 | } while (0) | |
f96637be | 98 | #endif |
1da177e4 LT |
99 | |
100 | #endif /* _H_CIFS_DEBUG */ |