From 704714c2ee46c96006ea8e25ff574c1a1cfbfd9c Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 27 Mar 2018 12:44:27 -0700 Subject: [PATCH] scoutfs: add scoutfs_bug_on() Add a BUG_ON() wrapper that identifies the file system via the super block and prints the condition and some additional formatted output. Signed-off-by: Zach Brown --- kmod/src/msg.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kmod/src/msg.h b/kmod/src/msg.h index eff34766..0586f75c 100644 --- a/kmod/src/msg.h +++ b/kmod/src/msg.h @@ -15,4 +15,12 @@ void __printf(4, 5) scoutfs_msg(struct super_block *sb, const char *prefix, #define scoutfs_info(sb, fmt, args...) \ scoutfs_msg(sb, KERN_INFO, "", fmt, ##args) +#define scoutfs_bug_on(sb, cond, fmt, args...) \ +do { \ + if (cond) { \ + scoutfs_err(sb, "(" __stringify(cond) "), " fmt, ##args); \ + BUG(); \ + } \ +} while (0) \ + #endif