diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-07-11 23:47:29 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:10:07 -0400 |
commit | a0f8faea5f47d6e18253225e8f2f88cdc49d27d8 (patch) | |
tree | cf2b0b930c403173fc70e39313fd4d1348cf428c /fs/bcachefs/opts.h | |
parent | 9f343e24f541bef3d5f081925eae5734c2c39c28 (diff) | |
download | linux-stable-a0f8faea5f47d6e18253225e8f2f88cdc49d27d8.tar.gz linux-stable-a0f8faea5f47d6e18253225e8f2f88cdc49d27d8.tar.bz2 linux-stable-a0f8faea5f47d6e18253225e8f2f88cdc49d27d8.zip |
bcachefs: fix_errors option is now a proper enum
Before, it was parsed as a bool but internally it was really an enum:
this lets us pass in all the possible values.
But we special case the option parsing: no supplied value is parsed as
FSCK_FIX_yes, to match the previous behaviour.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/opts.h')
-rw-r--r-- | fs/bcachefs/opts.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/fs/bcachefs/opts.h b/fs/bcachefs/opts.h index 3be5095aa472..92e2e5e759d9 100644 --- a/fs/bcachefs/opts.h +++ b/fs/bcachefs/opts.h @@ -11,6 +11,7 @@ struct bch_fs; extern const char * const bch2_error_actions[]; +extern const char * const bch2_fsck_fix_opts[]; extern const char * const bch2_version_upgrade_opts[]; extern const char * const bch2_sb_features[]; extern const char * const bch2_sb_compat[]; @@ -105,6 +106,18 @@ struct bch_opt_fn { #define BCACHEFS_VERBOSE_DEFAULT false #endif +#define BCH_FIX_ERRORS_OPTS() \ + x(exit, 0) \ + x(yes, 1) \ + x(no, 2) \ + x(ask, 3) + +enum fsck_err_opts { +#define x(t, n) FSCK_FIX_##t, + BCH_FIX_ERRORS_OPTS() +#undef x +}; + #define BCH_OPTS() \ x(block_size, u16, \ OPT_FS|OPT_FORMAT| \ @@ -325,8 +338,8 @@ struct bch_opt_fn { NULL, "Run fsck on mount") \ x(fix_errors, u8, \ OPT_FS|OPT_MOUNT, \ - OPT_BOOL(), \ - BCH2_NO_SB_OPT, false, \ + OPT_FN(bch2_opt_fix_errors), \ + BCH2_NO_SB_OPT, FSCK_FIX_exit, \ NULL, "Fix errors during fsck without asking") \ x(ratelimit_errors, u8, \ OPT_FS|OPT_MOUNT, \ |