nilfs2: add nilfs_msg() message interface
[cascardo/linux.git] / fs / nilfs2 / nilfs.h
index b1d48bc..b57ce41 100644 (file)
@@ -299,10 +299,35 @@ static inline int nilfs_mark_inode_dirty_sync(struct inode *inode)
 /* super.c */
 extern struct inode *nilfs_alloc_inode(struct super_block *);
 extern void nilfs_destroy_inode(struct inode *);
+
+extern __printf(3, 4)
+void __nilfs_msg(struct super_block *sb, const char *level,
+                const char *fmt, ...);
 extern __printf(3, 4)
-void nilfs_error(struct super_block *, const char *, const char *, ...);
+void __nilfs_error(struct super_block *sb, const char *function,
+                  const char *fmt, ...);
 extern __printf(3, 4)
 void nilfs_warning(struct super_block *, const char *, const char *, ...);
+
+#ifdef CONFIG_PRINTK
+
+#define nilfs_msg(sb, level, fmt, ...)                                 \
+       __nilfs_msg(sb, level, fmt, ##__VA_ARGS__)
+#define nilfs_error(sb, fmt, ...)                                      \
+       __nilfs_error(sb, __func__, fmt, ##__VA_ARGS__)
+
+#else
+
+#define nilfs_msg(sb, level, fmt, ...)                                 \
+       no_printk(fmt, ##__VA_ARGS__)
+#define nilfs_error(sb, fmt, ...)                                      \
+       do {                                                            \
+               no_printk(fmt, ##__VA_ARGS__);                          \
+               __nilfs_error(sb, "", " ");                             \
+       } while (0)
+
+#endif /* CONFIG_PRINTK */
+
 extern struct nilfs_super_block *
 nilfs_read_super_block(struct super_block *, u64, int, struct buffer_head **);
 extern int nilfs_store_magic_and_option(struct super_block *,