xref: /linux-6.15/include/linux/ceph/ceph_debug.h (revision bbb03029)
1 #ifndef _FS_CEPH_DEBUG_H
2 #define _FS_CEPH_DEBUG_H
3 
4 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
5 
6 #include <linux/string.h>
7 
8 #ifdef CONFIG_CEPH_LIB_PRETTYDEBUG
9 
10 /*
11  * wrap pr_debug to include a filename:lineno prefix on each line.
12  * this incurs some overhead (kernel size and execution time) due to
13  * the extra function call at each call site.
14  */
15 
16 # if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
17 #  define dout(fmt, ...)						\
18 	pr_debug("%.*s %12.12s:%-4d : " fmt,				\
19 		 8 - (int)sizeof(KBUILD_MODNAME), "    ",		\
20 		 kbasename(__FILE__), __LINE__, ##__VA_ARGS__)
21 # else
22 /* faux printk call just to see any compiler warnings. */
23 #  define dout(fmt, ...)	do {				\
24 		if (0)						\
25 			printk(KERN_DEBUG fmt, ##__VA_ARGS__);	\
26 	} while (0)
27 # endif
28 
29 #else
30 
31 /*
32  * or, just wrap pr_debug
33  */
34 # define dout(fmt, ...)	pr_debug(" " fmt, ##__VA_ARGS__)
35 
36 #endif
37 
38 #endif
39