Merge branch 'address-masking'
[linux-2.6-microblaze.git] / include / linux / ceph / ceph_debug.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _FS_CEPH_DEBUG_H
3 #define _FS_CEPH_DEBUG_H
4
5 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
6
7 #include <linux/string.h>
8
9 #ifdef CONFIG_CEPH_LIB_PRETTYDEBUG
10
11 /*
12  * wrap pr_debug to include a filename:lineno prefix on each line.
13  * this incurs some overhead (kernel size and execution time) due to
14  * the extra function call at each call site.
15  */
16
17 # if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
18 #  define dout(fmt, ...)                                                \
19         pr_debug("%.*s %12.12s:%-4d : " fmt,                            \
20                  8 - (int)sizeof(KBUILD_MODNAME), "    ",               \
21                  kbasename(__FILE__), __LINE__, ##__VA_ARGS__)
22 #  define doutc(client, fmt, ...)                                       \
23         pr_debug("%.*s %12.12s:%-4d : [%pU %llu] " fmt,                 \
24                  8 - (int)sizeof(KBUILD_MODNAME), "    ",               \
25                  kbasename(__FILE__), __LINE__,                         \
26                  &client->fsid, client->monc.auth->global_id,           \
27                  ##__VA_ARGS__)
28 # else
29 /* faux printk call just to see any compiler warnings. */
30 #  define dout(fmt, ...)                                        \
31                 no_printk(KERN_DEBUG fmt, ##__VA_ARGS__)
32 #  define doutc(client, fmt, ...)                               \
33                 no_printk(KERN_DEBUG "[%pU %llu] " fmt,         \
34                           &client->fsid,                        \
35                           client->monc.auth->global_id,         \
36                           ##__VA_ARGS__)
37 # endif
38
39 #else
40
41 /*
42  * or, just wrap pr_debug
43  */
44 # define dout(fmt, ...) pr_debug(" " fmt, ##__VA_ARGS__)
45 # define doutc(client, fmt, ...)                                        \
46         pr_debug(" [%pU %llu] %s: " fmt, &client->fsid,                 \
47                  client->monc.auth->global_id, __func__, ##__VA_ARGS__)
48
49 #endif
50
51 #define pr_notice_client(client, fmt, ...)                              \
52         pr_notice("[%pU %llu]: " fmt, &client->fsid,                    \
53                   client->monc.auth->global_id, ##__VA_ARGS__)
54 #define pr_info_client(client, fmt, ...)                                \
55         pr_info("[%pU %llu]: " fmt, &client->fsid,                      \
56                 client->monc.auth->global_id, ##__VA_ARGS__)
57 #define pr_warn_client(client, fmt, ...)                                \
58         pr_warn("[%pU %llu]: " fmt, &client->fsid,                      \
59                 client->monc.auth->global_id, ##__VA_ARGS__)
60 #define pr_warn_once_client(client, fmt, ...)                           \
61         pr_warn_once("[%pU %llu]: " fmt, &client->fsid,                 \
62                      client->monc.auth->global_id, ##__VA_ARGS__)
63 #define pr_err_client(client, fmt, ...)                                 \
64         pr_err("[%pU %llu]: " fmt, &client->fsid,                       \
65                client->monc.auth->global_id, ##__VA_ARGS__)
66 #define pr_warn_ratelimited_client(client, fmt, ...)                    \
67         pr_warn_ratelimited("[%pU %llu]: " fmt, &client->fsid,          \
68                             client->monc.auth->global_id, ##__VA_ARGS__)
69 #define pr_err_ratelimited_client(client, fmt, ...)                     \
70         pr_err_ratelimited("[%pU %llu]: " fmt, &client->fsid,           \
71                            client->monc.auth->global_id, ##__VA_ARGS__)
72
73 #endif