1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _FS_CEPH_DEBUG_H
3 #define _FS_CEPH_DEBUG_H
5 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
7 #include <linux/string.h>
9 #ifdef CONFIG_CEPH_LIB_PRETTYDEBUG
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.
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, \
29 /* faux printk call just to see any compiler warnings. */
30 # define dout(fmt, ...) do { \
32 printk(KERN_DEBUG fmt, ##__VA_ARGS__); \
34 # define doutc(client, fmt, ...) do { \
36 printk(KERN_DEBUG "[%pU %llu] " fmt, \
38 client->monc.auth->global_id, \
46 * or, just wrap pr_debug
48 # define dout(fmt, ...) pr_debug(" " fmt, ##__VA_ARGS__)
49 # define doutc(client, fmt, ...) \
50 pr_debug(" [%pU %llu] %s: " fmt, &client->fsid, \
51 client->monc.auth->global_id, __func__, ##__VA_ARGS__)
55 #define pr_notice_client(client, fmt, ...) \
56 pr_notice("[%pU %llu]: " fmt, &client->fsid, \
57 client->monc.auth->global_id, ##__VA_ARGS__)
58 #define pr_info_client(client, fmt, ...) \
59 pr_info("[%pU %llu]: " fmt, &client->fsid, \
60 client->monc.auth->global_id, ##__VA_ARGS__)
61 #define pr_warn_client(client, fmt, ...) \
62 pr_warn("[%pU %llu]: " fmt, &client->fsid, \
63 client->monc.auth->global_id, ##__VA_ARGS__)
64 #define pr_warn_once_client(client, fmt, ...) \
65 pr_warn_once("[%pU %llu]: " fmt, &client->fsid, \
66 client->monc.auth->global_id, ##__VA_ARGS__)
67 #define pr_err_client(client, fmt, ...) \
68 pr_err("[%pU %llu]: " fmt, &client->fsid, \
69 client->monc.auth->global_id, ##__VA_ARGS__)
70 #define pr_warn_ratelimited_client(client, fmt, ...) \
71 pr_warn_ratelimited("[%pU %llu]: " fmt, &client->fsid, \
72 client->monc.auth->global_id, ##__VA_ARGS__)
73 #define pr_err_ratelimited_client(client, fmt, ...) \
74 pr_err_ratelimited("[%pU %llu]: " fmt, &client->fsid, \
75 client->monc.auth->global_id, ##__VA_ARGS__)