Commit a973de85 authored by Kent Overstreet's avatar Kent Overstreet
Browse files

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
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -3,6 +3,8 @@
#define _BCACHEFS_ERRCODE_H

#define BCH_ERRCODES()								\
	x(ERANGE,			ERANGE_option_too_small)		\
	x(ERANGE,			ERANGE_option_too_big)			\
	x(ENOMEM,			ENOMEM_stripe_buf)			\
	x(ENOMEM,			ENOMEM_replicas_table)			\
	x(ENOMEM,			ENOMEM_cpu_replicas)			\
+2 −2
Original line number Diff line number Diff line
@@ -265,14 +265,14 @@ int bch2_opt_validate(const struct bch_option *opt, u64 v, struct printbuf *err)
		if (err)
			prt_printf(err, "%s: too small (min %llu)",
			       opt->attr.name, opt->min);
		return -ERANGE;
		return -BCH_ERR_ERANGE_option_too_small;
	}

	if (opt->max && v >= opt->max) {
		if (err)
			prt_printf(err, "%s: too big (max %llu)",
			       opt->attr.name, opt->max);
		return -ERANGE;
		return -BCH_ERR_ERANGE_option_too_big;
	}

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