]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
kclient: make dout() behave despite file prefix, cleanup
authorSage Weil <sage@newdream.net>
Thu, 16 Jul 2009 20:39:48 +0000 (13:39 -0700)
committerSage Weil <sage@newdream.net>
Thu, 16 Jul 2009 20:39:48 +0000 (13:39 -0700)
src/kernel/ceph_debug.h
src/kernel/super.c

index 0510b08c55501fa494e2973cd7fa9b5f0a64f20d..a1a5107c2c26d3e35ff437f2ed17c3c81e8e035d 100644 (file)
@@ -1,19 +1,23 @@
 #ifndef _FS_CEPH_DEBUG_H
 #define _FS_CEPH_DEBUG_H
 
-#include <linux/string.h>
+/*
+ * wrap pr_debug to include a filename:lineno prefix on each line
+ */
 
-#define _STRINGIFY(x) #x
-#define STRINGIFY(x) _STRINGIFY(x)
+static inline const char *ceph_file_part(const char *s, int len)
+{
+       const char *e = s + len;
 
-#define FMT_PREFIX " %12.12s:%-4d : "
-#define FMT_SUFFIX "%s"
-#define LOG_ARGS __FILE__ + 8, __LINE__  /* strip of fs/ceph/ from __FILE__ */
-#define TRAIL_PARAM ""
+       while (*(e-1) != '/')
+               e--;
+       return e;
+}
 
-#define LOG_LINE FMT_PREFIX fmt, LOG_ARGS, args
-
-#define _dout(fmt, args...) pr_debug(FMT_PREFIX fmt FMT_SUFFIX, LOG_ARGS, args);
-#define dout(args...) _dout(args, TRAIL_PARAM)
+#define _dout(fmt, args...)                                            \
+       pr_debug(" %12.12s:%-4d : " fmt "%s",                           \
+                ceph_file_part(__FILE__, sizeof(__FILE__)), __LINE__,  \
+                args);
+#define dout(args...) _dout(args, "")
 
 #endif
index d68a6905bbeb6c816d25236804ab75b3421684a6..4805e3e4fb0f8c8059617cc4b026cf2714793b6e 100644 (file)
@@ -1108,6 +1108,9 @@ static struct file_system_type ceph_fs_type = {
        .fs_flags       = FS_RENAME_DOES_D_MOVE,
 };
 
+#define _STRINGIFY(x) #x
+#define STRINGIFY(x) _STRINGIFY(x)
+
 static int __init init_ceph(void)
 {
        int ret = 0;