Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _FS_CEPH_DEBUG_H
0003 #define _FS_CEPH_DEBUG_H
0004 
0005 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
0006 
0007 #include <linux/string.h>
0008 
0009 #ifdef CONFIG_CEPH_LIB_PRETTYDEBUG
0010 
0011 /*
0012  * wrap pr_debug to include a filename:lineno prefix on each line.
0013  * this incurs some overhead (kernel size and execution time) due to
0014  * the extra function call at each call site.
0015  */
0016 
0017 # if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
0018 #  define dout(fmt, ...)                        \
0019     pr_debug("%.*s %12.12s:%-4d : " fmt,                \
0020          8 - (int)sizeof(KBUILD_MODNAME), "    ",       \
0021          kbasename(__FILE__), __LINE__, ##__VA_ARGS__)
0022 # else
0023 /* faux printk call just to see any compiler warnings. */
0024 #  define dout(fmt, ...)    do {                \
0025         if (0)                      \
0026             printk(KERN_DEBUG fmt, ##__VA_ARGS__);  \
0027     } while (0)
0028 # endif
0029 
0030 #else
0031 
0032 /*
0033  * or, just wrap pr_debug
0034  */
0035 # define dout(fmt, ...) pr_debug(" " fmt, ##__VA_ARGS__)
0036 
0037 #endif
0038 
0039 #endif