Skip to content

Commit a973de8

Browse files
author
Kent Overstreet
committed
bcachefs: Replace ERANGE with private error codes
We avoid using standard error codes: private, per-callsite error codes make debugging easier. Signed-off-by: Kent Overstreet <[email protected]>
1 parent a8958a1 commit a973de8

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

fs/bcachefs/errcode.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
#define _BCACHEFS_ERRCODE_H
44

55
#define BCH_ERRCODES() \
6+
x(ERANGE, ERANGE_option_too_small) \
7+
x(ERANGE, ERANGE_option_too_big) \
68
x(ENOMEM, ENOMEM_stripe_buf) \
79
x(ENOMEM, ENOMEM_replicas_table) \
810
x(ENOMEM, ENOMEM_cpu_replicas) \

fs/bcachefs/opts.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,14 +265,14 @@ int bch2_opt_validate(const struct bch_option *opt, u64 v, struct printbuf *err)
265265
if (err)
266266
prt_printf(err, "%s: too small (min %llu)",
267267
opt->attr.name, opt->min);
268-
return -ERANGE;
268+
return -BCH_ERR_ERANGE_option_too_small;
269269
}
270270

271271
if (opt->max && v >= opt->max) {
272272
if (err)
273273
prt_printf(err, "%s: too big (max %llu)",
274274
opt->attr.name, opt->max);
275-
return -ERANGE;
275+
return -BCH_ERR_ERANGE_option_too_big;
276276
}
277277

278278
if ((opt->flags & OPT_SB_FIELD_SECTORS) && (v & 511)) {

0 commit comments

Comments
 (0)