]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcachefs: bch2_prt_csum_opt()
authorKent Overstreet <kent.overstreet@linux.dev>
Mon, 28 Oct 2024 05:14:53 +0000 (01:14 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sat, 21 Dec 2024 06:36:16 +0000 (01:36 -0500)
bounds checking helper

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

index c5e3824d577184bb03fb5043fe88cb802c0a37b4..dc14bfe37e3bdf2b8f6d62be6957e716fd420578 100644 (file)
@@ -1030,7 +1030,7 @@ static inline _Bool bch2_csum_type_is_encryption(enum bch_csum_type type)
        x(crc64,                2)      \
        x(xxhash,               3)
 
-enum bch_csum_opts {
+enum bch_csum_opt {
 #define x(t, n) BCH_CSUM_OPT_##t = n,
        BCH_CSUM_OPTS()
 #undef x
index e40499fde9a4019fc75d62f825e9e5583caf803b..43b9d71f2f2b46fa184b428f64ba704167922d94 100644 (file)
@@ -109,7 +109,7 @@ int bch2_enable_encryption(struct bch_fs *, bool);
 void bch2_fs_encryption_exit(struct bch_fs *);
 int bch2_fs_encryption_init(struct bch_fs *);
 
-static inline enum bch_csum_type bch2_csum_opt_to_type(enum bch_csum_opts type,
+static inline enum bch_csum_type bch2_csum_opt_to_type(enum bch_csum_opt type,
                                                       bool data)
 {
        switch (type) {
index 1f5843284e9e60a7236a3b6ecb218c2c0baa0347..49c59aec69546031f448addf054182429fc41d47 100644 (file)
@@ -48,7 +48,7 @@ static const char * const __bch2_csum_types[] = {
        NULL
 };
 
-const char * const bch2_csum_opts[] = {
+const char * const __bch2_csum_opts[] = {
        BCH_CSUM_OPTS()
        NULL
 };
@@ -113,6 +113,7 @@ void bch2_prt_##name(struct printbuf *out, type t)                          \
 PRT_STR_OPT_BOUNDSCHECKED(jset_entry_type,     enum bch_jset_entry_type);
 PRT_STR_OPT_BOUNDSCHECKED(fs_usage_type,       enum bch_fs_usage_type);
 PRT_STR_OPT_BOUNDSCHECKED(data_type,           enum bch_data_type);
+PRT_STR_OPT_BOUNDSCHECKED(csum_opt,            enum bch_csum_opt);
 PRT_STR_OPT_BOUNDSCHECKED(csum_type,           enum bch_csum_type);
 PRT_STR_OPT_BOUNDSCHECKED(compression_type,    enum bch_compression_type);
 PRT_STR_OPT_BOUNDSCHECKED(str_hash_type,       enum bch_str_hash_type);
index e0e23c29c2d63bfe5aa5c11811236cb94fb0ec06..f6dc0628b025704c305197885b045ebbb20eb3ef 100644 (file)
@@ -16,7 +16,7 @@ extern const char * const bch2_version_upgrade_opts[];
 extern const char * const bch2_sb_features[];
 extern const char * const bch2_sb_compat[];
 extern const char * const __bch2_btree_ids[];
-extern const char * const bch2_csum_opts[];
+extern const char * const __bch2_csum_opts[];
 extern const char * const bch2_compression_opts[];
 extern const char * const __bch2_str_hash_types[];
 extern const char * const bch2_str_hash_opts[];
@@ -27,6 +27,7 @@ extern const char * const bch2_d_types[];
 void bch2_prt_jset_entry_type(struct printbuf *,       enum bch_jset_entry_type);
 void bch2_prt_fs_usage_type(struct printbuf *,         enum bch_fs_usage_type);
 void bch2_prt_data_type(struct printbuf *,             enum bch_data_type);
+void bch2_prt_csum_opt(struct printbuf *,              enum bch_csum_opt);
 void bch2_prt_csum_type(struct printbuf *,             enum bch_csum_type);
 void bch2_prt_compression_type(struct printbuf *,      enum bch_compression_type);
 void bch2_prt_str_hash_type(struct printbuf *,         enum bch_str_hash_type);
@@ -171,12 +172,12 @@ enum fsck_err_opts {
          "size",       "Maximum size of checksummed/compressed extents")\
        x(metadata_checksum,            u8,                             \
          OPT_FS|OPT_FORMAT|OPT_MOUNT|OPT_RUNTIME,                      \
-         OPT_STR(bch2_csum_opts),                                      \
+         OPT_STR(__bch2_csum_opts),                                    \
          BCH_SB_META_CSUM_TYPE,        BCH_CSUM_OPT_crc32c,            \
          NULL,         NULL)                                           \
        x(data_checksum,                u8,                             \
          OPT_FS|OPT_INODE|OPT_FORMAT|OPT_MOUNT|OPT_RUNTIME,            \
-         OPT_STR(bch2_csum_opts),                                      \
+         OPT_STR(__bch2_csum_opts),                                    \
          BCH_SB_DATA_CSUM_TYPE,        BCH_CSUM_OPT_crc32c,            \
          NULL,         NULL)                                           \
        x(compression,                  u8,                             \