Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Sage Weil | de57606 | 2009-10-06 11:31:07 -0700 | [diff] [blame] | 2 | #ifndef _FS_CEPH_DEBUG_H |
| 3 | #define _FS_CEPH_DEBUG_H |
| 4 | |
| 5 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 6 | |
Ilya Dryomov | 6f4dbd1 | 2017-05-19 11:33:16 +0200 | [diff] [blame] | 7 | #include <linux/string.h> |
| 8 | |
Yehuda Sadeh | 3d14c5d | 2010-04-06 15:14:15 -0700 | [diff] [blame] | 9 | #ifdef CONFIG_CEPH_LIB_PRETTYDEBUG |
Sage Weil | de57606 | 2009-10-06 11:31:07 -0700 | [diff] [blame] | 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) |
Sage Weil | de57606 | 2009-10-06 11:31:07 -0700 | [diff] [blame] | 18 | # define dout(fmt, ...) \ |
Yehuda Sadeh | 3d14c5d | 2010-04-06 15:14:15 -0700 | [diff] [blame] | 19 | pr_debug("%.*s %12.12s:%-4d : " fmt, \ |
| 20 | 8 - (int)sizeof(KBUILD_MODNAME), " ", \ |
Ilya Dryomov | 6f4dbd1 | 2017-05-19 11:33:16 +0200 | [diff] [blame] | 21 | kbasename(__FILE__), __LINE__, ##__VA_ARGS__) |
Sage Weil | de57606 | 2009-10-06 11:31:07 -0700 | [diff] [blame] | 22 | # else |
| 23 | /* faux printk call just to see any compiler warnings. */ |
| 24 | # define dout(fmt, ...) do { \ |
| 25 | if (0) \ |
| 26 | printk(KERN_DEBUG fmt, ##__VA_ARGS__); \ |
| 27 | } while (0) |
| 28 | # endif |
| 29 | |
| 30 | #else |
| 31 | |
| 32 | /* |
| 33 | * or, just wrap pr_debug |
| 34 | */ |
| 35 | # define dout(fmt, ...) pr_debug(" " fmt, ##__VA_ARGS__) |
| 36 | |
| 37 | #endif |
| 38 | |
| 39 | #endif |