mirror of
https://github.com/versity/scoutfs.git
synced 2026-06-08 12:42:35 +00:00
scoutfs: check for newlines in msg.h wrappers
The message formatter adds a newline so callers don't have to. But sometimes they do and we get double newlines. Add a build check that the format string doesn't end in a newline so that we stop adding these. And fix up all the current offenders. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
@@ -351,7 +351,7 @@ static int client_greeting(struct super_block *sb,
|
||||
}
|
||||
|
||||
if (sbi->node_id == 0 && gr->node_id == 0) {
|
||||
scoutfs_warn(sb, "server sent node_id 0, client also has 0\n");
|
||||
scoutfs_warn(sb, "server sent node_id 0, client also has 0");
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
@@ -667,7 +667,7 @@ void scoutfs_client_destroy(struct super_block *sb)
|
||||
}
|
||||
if (ret) {
|
||||
scoutfs_inc_counter(sb, client_farewell_error);
|
||||
scoutfs_warn(sb, "client saw farewell error %d, server might see client connection time out\n", ret);
|
||||
scoutfs_warn(sb, "client saw farewell error %d, server might see client connection time out", ret);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -345,7 +345,7 @@ static bool insert_range_node(struct super_block *sb, struct scoutfs_lock *ins)
|
||||
cmp = scoutfs_key_compare_ranges(&ins->start, &ins->end,
|
||||
&lock->start, &lock->end);
|
||||
if (WARN_ON_ONCE(cmp == 0)) {
|
||||
scoutfs_warn(sb, "inserting lock start "SK_FMT" end "SK_FMT" overlaps with existing lock start "SK_FMT" end "SK_FMT"\n",
|
||||
scoutfs_warn(sb, "inserting lock start "SK_FMT" end "SK_FMT" overlaps with existing lock start "SK_FMT" end "SK_FMT,
|
||||
SK_ARG(&ins->start), SK_ARG(&ins->end),
|
||||
SK_ARG(&lock->start), SK_ARG(&lock->end));
|
||||
return false;
|
||||
|
||||
@@ -8,14 +8,20 @@
|
||||
void __printf(4, 5) scoutfs_msg(struct super_block *sb, const char *prefix,
|
||||
const char *str, const char *fmt, ...);
|
||||
|
||||
#define scoutfs_msg_check(sb, pref, str, fmt, args...) \
|
||||
do { \
|
||||
BUILD_BUG_ON(fmt[sizeof(fmt) - 2] == '\n'); \
|
||||
scoutfs_msg(sb, pref, str, fmt, ##args); \
|
||||
} while (0)
|
||||
|
||||
#define scoutfs_err(sb, fmt, args...) \
|
||||
scoutfs_msg(sb, KERN_ERR, " error", fmt, ##args)
|
||||
scoutfs_msg_check(sb, KERN_ERR, " error", fmt, ##args)
|
||||
|
||||
#define scoutfs_warn(sb, fmt, args...) \
|
||||
scoutfs_msg(sb, KERN_WARNING, " warning", fmt, ##args)
|
||||
scoutfs_msg_check(sb, KERN_WARNING, " warning", fmt, ##args)
|
||||
|
||||
#define scoutfs_info(sb, fmt, args...) \
|
||||
scoutfs_msg(sb, KERN_INFO, "", fmt, ##args)
|
||||
scoutfs_msg_check(sb, KERN_INFO, "", fmt, ##args)
|
||||
|
||||
#define scoutfs_bug_on(sb, cond, fmt, args...) \
|
||||
do { \
|
||||
|
||||
@@ -296,7 +296,7 @@ static inline u8 net_err_from_host(struct super_block *sb, int error)
|
||||
static bool warned;
|
||||
if (!warned) {
|
||||
warned = 1;
|
||||
scoutfs_warn(sb, "host errno %d sent as EINVAL\n",
|
||||
scoutfs_warn(sb, "host errno %d sent as EINVAL",
|
||||
error);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ int scoutfs_parse_options(struct super_block *sb, char *options,
|
||||
return -EINVAL;
|
||||
break;
|
||||
default:
|
||||
scoutfs_err(sb, "Unknown or malformed option, \"%s\"\n",
|
||||
scoutfs_err(sb, "Unknown or malformed option, \"%s\"",
|
||||
p);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user