diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-02-04 03:01:40 +0100 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 23:09:33 +0200 |
commit | 401ec4db630802729f10d53ad995083ced98caca (patch) | |
tree | 245f07e5928f1414b6da71f14c417829e763fdde /fs/bcachefs/opts.c | |
parent | bcachefs: Fix btree node read error path (diff) | |
download | linux-401ec4db630802729f10d53ad995083ced98caca.tar.xz linux-401ec4db630802729f10d53ad995083ced98caca.zip |
bcachefs: Printbuf rework
This converts bcachefs to the modern printbuf interface/implementation,
synced with the version to be submitted upstream.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/opts.c')
-rw-r--r-- | fs/bcachefs/opts.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/fs/bcachefs/opts.c b/fs/bcachefs/opts.c index c4ccb42d7851..5540d5d98d84 100644 --- a/fs/bcachefs/opts.c +++ b/fs/bcachefs/opts.c @@ -228,28 +228,28 @@ int bch2_opt_validate(const struct bch_option *opt, u64 v, struct printbuf *err) { if (v < opt->min) { if (err) - pr_buf(err, "%s: too small (min %llu)", + prt_printf(err, "%s: too small (min %llu)", opt->attr.name, opt->min); return -ERANGE; } if (opt->max && v >= opt->max) { if (err) - pr_buf(err, "%s: too big (max %llu)", + prt_printf(err, "%s: too big (max %llu)", opt->attr.name, opt->max); return -ERANGE; } if ((opt->flags & OPT_SB_FIELD_SECTORS) && (v & 511)) { if (err) - pr_buf(err, "%s: not a multiple of 512", + prt_printf(err, "%s: not a multiple of 512", opt->attr.name); return -EINVAL; } if ((opt->flags & OPT_MUST_BE_POW_2) && !is_power_of_2(v)) { if (err) - pr_buf(err, "%s: must be a power of two", + prt_printf(err, "%s: must be a power of two", opt->attr.name); return -EINVAL; } @@ -269,8 +269,8 @@ int bch2_opt_parse(struct bch_fs *c, ret = kstrtou64(val, 10, res); if (ret < 0 || (*res != 0 && *res != 1)) { if (err) - pr_buf(err, "%s: must be bool", - opt->attr.name); + prt_printf(err, "%s: must be bool", + opt->attr.name); return ret; } break; @@ -280,8 +280,8 @@ int bch2_opt_parse(struct bch_fs *c, : kstrtou64(val, 10, res); if (ret < 0) { if (err) - pr_buf(err, "%s: must be a number", - opt->attr.name); + prt_printf(err, "%s: must be a number", + opt->attr.name); return ret; } break; @@ -289,8 +289,8 @@ int bch2_opt_parse(struct bch_fs *c, ret = match_string(opt->choices, -1, val); if (ret < 0) { if (err) - pr_buf(err, "%s: invalid selection", - opt->attr.name); + prt_printf(err, "%s: invalid selection", + opt->attr.name); return ret; } @@ -303,8 +303,8 @@ int bch2_opt_parse(struct bch_fs *c, ret = opt->parse(c, val, res); if (ret < 0) { if (err) - pr_buf(err, "%s: parse error", - opt->attr.name); + prt_printf(err, "%s: parse error", + opt->attr.name); return ret; } } @@ -319,28 +319,28 @@ void bch2_opt_to_text(struct printbuf *out, { if (flags & OPT_SHOW_MOUNT_STYLE) { if (opt->type == BCH_OPT_BOOL) { - pr_buf(out, "%s%s", + prt_printf(out, "%s%s", v ? "" : "no", opt->attr.name); return; } - pr_buf(out, "%s=", opt->attr.name); + prt_printf(out, "%s=", opt->attr.name); } switch (opt->type) { case BCH_OPT_BOOL: case BCH_OPT_UINT: if (opt->flags & OPT_HUMAN_READABLE) - bch2_hprint(out, v); + prt_human_readable_u64(out, v); else - pr_buf(out, "%lli", v); + prt_printf(out, "%lli", v); break; case BCH_OPT_STR: if (flags & OPT_SHOW_FULL_LIST) - bch2_string_opt_to_text(out, opt->choices, v); + prt_string_option(out, opt->choices, v); else - pr_buf(out, "%s", opt->choices[v]); + prt_printf(out, "%s", opt->choices[v]); break; case BCH_OPT_FN: opt->to_text(out, c, sb, v); |