blob: 51c5bd64bd0022c8a3f197d846c23448e7bb6a6e [file] [log] [blame]
Sage Weilde576062009-10-06 11:31:07 -07001#ifndef _FS_CEPH_DEBUG_H
2#define _FS_CEPH_DEBUG_H
3
4#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
5
Ilya Dryomov6f4dbd12017-05-19 11:33:16 +02006#include <linux/string.h>
7
Yehuda Sadeh3d14c5d2010-04-06 15:14:15 -07008#ifdef CONFIG_CEPH_LIB_PRETTYDEBUG
Sage Weilde576062009-10-06 11:31:07 -07009
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)
Sage Weilde576062009-10-06 11:31:07 -070017# define dout(fmt, ...) \
Yehuda Sadeh3d14c5d2010-04-06 15:14:15 -070018 pr_debug("%.*s %12.12s:%-4d : " fmt, \
19 8 - (int)sizeof(KBUILD_MODNAME), " ", \
Ilya Dryomov6f4dbd12017-05-19 11:33:16 +020020 kbasename(__FILE__), __LINE__, ##__VA_ARGS__)
Sage Weilde576062009-10-06 11:31:07 -070021# 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