diff options
author | Ronnie Sahlberg <lsahlber@redhat.com> | 2019-09-04 05:32:41 +0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2019-09-16 19:43:38 +0300 |
commit | 3175eb9b577e82b44a25ad2d515ec9418ae06c04 (patch) | |
tree | bcb8165506bdc73cd5ddf08c371a69870a95cfa3 /fs/cifs/cifs_debug.h | |
parent | 46f17d17687e8140f2e4e517d7dfa65e62fcc5f4 (diff) | |
download | linux-3175eb9b577e82b44a25ad2d515ec9418ae06c04.tar.xz |
cifs: add a debug macro that prints \\server\share for errors
Where we have a tcon available we can log \\server\share as part
of the message. Only do this for the VFS log level.
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/cifs_debug.h')
-rw-r--r-- | fs/cifs/cifs_debug.h | 50 |
1 files changed, 43 insertions, 7 deletions
diff --git a/fs/cifs/cifs_debug.h b/fs/cifs/cifs_debug.h index 567af916f103..100b0056a369 100644 --- a/fs/cifs/cifs_debug.h +++ b/fs/cifs/cifs_debug.h @@ -82,15 +82,18 @@ do { \ #define cifs_server_dbg_func(ratefunc, type, fmt, ...) \ do { \ + const char *sn = ""; \ + if (server && server->hostname) \ + sn = server->hostname; \ if ((type) & FYI && cifsFYI & CIFS_INFO) { \ - pr_debug_ ## ratefunc("%s: Server:%s " fmt, \ - __FILE__, server->hostname, ##__VA_ARGS__);\ + pr_debug_ ## ratefunc("%s: \\\\%s " fmt, \ + __FILE__, sn, ##__VA_ARGS__); \ } else if ((type) & VFS) { \ - pr_err_ ## ratefunc("CIFS VFS: Server:%s " fmt, \ - server->hostname, ##__VA_ARGS__); \ + pr_err_ ## ratefunc("CIFS VFS: \\\\%s " fmt, \ + sn, ##__VA_ARGS__); \ } else if ((type) & NOISY && (NOISY != 0)) { \ - pr_debug_ ## ratefunc("Server:%s " fmt, \ - server->hostname, ##__VA_ARGS__); \ + pr_debug_ ## ratefunc("\\\\%s " fmt, \ + sn, ##__VA_ARGS__); \ } \ } while (0) @@ -104,6 +107,33 @@ do { \ type, fmt, ##__VA_ARGS__); \ } while (0) +#define cifs_tcon_dbg_func(ratefunc, type, fmt, ...) \ +do { \ + const char *tn = ""; \ + if (tcon && tcon->treeName) \ + tn = tcon->treeName; \ + if ((type) & FYI && cifsFYI & CIFS_INFO) { \ + pr_debug_ ## ratefunc("%s: %s " fmt, \ + __FILE__, tn, ##__VA_ARGS__); \ + } else if ((type) & VFS) { \ + pr_err_ ## ratefunc("CIFS VFS: %s " fmt, \ + tn, ##__VA_ARGS__); \ + } else if ((type) & NOISY && (NOISY != 0)) { \ + pr_debug_ ## ratefunc("%s " fmt, \ + tn, ##__VA_ARGS__); \ + } \ +} while (0) + +#define cifs_tcon_dbg(type, fmt, ...) \ +do { \ + if ((type) & ONCE) \ + cifs_tcon_dbg_func(once, \ + type, fmt, ##__VA_ARGS__); \ + else \ + cifs_tcon_dbg_func(ratelimited, \ + type, fmt, ##__VA_ARGS__); \ +} while (0) + /* * debug OFF * --------- @@ -118,10 +148,16 @@ do { \ #define cifs_server_dbg(type, fmt, ...) \ do { \ if (0) \ - pr_debug("Server:%s " fmt, \ + pr_debug("\\\\%s " fmt, \ server->hostname, ##__VA_ARGS__); \ } while (0) +#define cifs_tcon_dbg(type, fmt, ...) \ +do { \ + if (0) \ + pr_debug("%s " fmt, tcon->treeName, ##__VA_ARGS__); \ +} while (0) + #define cifs_info(fmt, ...) \ do { \ pr_info("CIFS: "fmt, ##__VA_ARGS__); \ |