bcachefs: BCH_ERR_opt_parse_error
authorKent Overstreet <kent.overstreet@linux.dev>
Mon, 4 Dec 2023 18:03:24 +0000 (13:03 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Mon, 1 Jan 2024 16:47:40 +0000 (11:47 -0500)
Continuing the project of replacing generic error codes with more
specific ones.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/errcode.h
fs/bcachefs/opts.c

index d49a4994666d7bc7e337d3b88d9194d11ab9aa39..ac6201403fbe36c88e2a39ad04f2e97c7c21c7bb 100644 (file)
        x(EINVAL,                       insufficient_devices_to_start)          \
        x(EINVAL,                       invalid)                                \
        x(EINVAL,                       internal_fsck_err)                      \
+       x(EINVAL,                       opt_parse_error)                        \
        x(EROFS,                        erofs_trans_commit)                     \
        x(EROFS,                        erofs_no_writes)                        \
        x(EROFS,                        erofs_journal_err)                      \
index 8dd4046cca41ef23b061f4aeac1892f82a504d65..8e6f230eac38155bf5d048367d6ebde35a4a15bd 100644 (file)
@@ -279,14 +279,14 @@ int bch2_opt_validate(const struct bch_option *opt, u64 v, struct printbuf *err)
                if (err)
                        prt_printf(err, "%s: not a multiple of 512",
                               opt->attr.name);
-               return -EINVAL;
+               return -BCH_ERR_opt_parse_error;
        }
 
        if ((opt->flags & OPT_MUST_BE_POW_2) && !is_power_of_2(v)) {
                if (err)
                        prt_printf(err, "%s: must be a power of two",
                               opt->attr.name);
-               return -EINVAL;
+               return -BCH_ERR_opt_parse_error;
        }
 
        if (opt->fn.validate)