Commit a973de85 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Replace ERANGE with private error codes

We avoid using standard error codes: private, per-callsite error codes
make debugging easier.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent a8958a1a
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
#define _BCACHEFS_ERRCODE_H #define _BCACHEFS_ERRCODE_H
#define BCH_ERRCODES() \ #define BCH_ERRCODES() \
x(ERANGE, ERANGE_option_too_small) \
x(ERANGE, ERANGE_option_too_big) \
x(ENOMEM, ENOMEM_stripe_buf) \ x(ENOMEM, ENOMEM_stripe_buf) \
x(ENOMEM, ENOMEM_replicas_table) \ x(ENOMEM, ENOMEM_replicas_table) \
x(ENOMEM, ENOMEM_cpu_replicas) \ x(ENOMEM, ENOMEM_cpu_replicas) \
......
...@@ -265,14 +265,14 @@ int bch2_opt_validate(const struct bch_option *opt, u64 v, struct printbuf *err) ...@@ -265,14 +265,14 @@ int bch2_opt_validate(const struct bch_option *opt, u64 v, struct printbuf *err)
if (err) if (err)
prt_printf(err, "%s: too small (min %llu)", prt_printf(err, "%s: too small (min %llu)",
opt->attr.name, opt->min); opt->attr.name, opt->min);
return -ERANGE; return -BCH_ERR_ERANGE_option_too_small;
} }
if (opt->max && v >= opt->max) { if (opt->max && v >= opt->max) {
if (err) if (err)
prt_printf(err, "%s: too big (max %llu)", prt_printf(err, "%s: too big (max %llu)",
opt->attr.name, opt->max); opt->attr.name, opt->max);
return -ERANGE; return -BCH_ERR_ERANGE_option_too_big;
} }
if ((opt->flags & OPT_SB_FIELD_SECTORS) && (v & 511)) { if ((opt->flags & OPT_SB_FIELD_SECTORS) && (v & 511)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment