105 lines
4.1 KiB
Diff
105 lines
4.1 KiB
Diff
From e1d67b5d67f83789f0cf57d8c822941a5050a454 Mon Sep 17 00:00:00 2001
|
|
From: Kent Overstreet <kent.overstreet@linux.dev>
|
|
Date: Mon, 28 Oct 2024 01:14:53 -0400
|
|
Subject: [PATCH 046/233] bcachefs: bch2_prt_csum_opt()
|
|
Content-Type: text/plain; charset="utf-8"
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
bounds checking helper
|
|
|
|
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
|
|
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
|
---
|
|
fs/bcachefs/bcachefs_format.h | 2 +-
|
|
fs/bcachefs/checksum.h | 2 +-
|
|
fs/bcachefs/opts.c | 3 ++-
|
|
fs/bcachefs/opts.h | 7 ++++---
|
|
4 files changed, 8 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/fs/bcachefs/bcachefs_format.h b/fs/bcachefs/bcachefs_format.h
|
|
index c5e3824d5771..dc14bfe37e3b 100644
|
|
--- a/fs/bcachefs/bcachefs_format.h
|
|
+++ b/fs/bcachefs/bcachefs_format.h
|
|
@@ -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
|
|
diff --git a/fs/bcachefs/checksum.h b/fs/bcachefs/checksum.h
|
|
index e40499fde9a4..43b9d71f2f2b 100644
|
|
--- a/fs/bcachefs/checksum.h
|
|
+++ b/fs/bcachefs/checksum.h
|
|
@@ -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) {
|
|
diff --git a/fs/bcachefs/opts.c b/fs/bcachefs/opts.c
|
|
index 1f5843284e9e..49c59aec6954 100644
|
|
--- a/fs/bcachefs/opts.c
|
|
+++ b/fs/bcachefs/opts.c
|
|
@@ -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);
|
|
diff --git a/fs/bcachefs/opts.h b/fs/bcachefs/opts.h
|
|
index e0e23c29c2d6..f6dc0628b025 100644
|
|
--- a/fs/bcachefs/opts.h
|
|
+++ b/fs/bcachefs/opts.h
|
|
@@ -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, \
|
|
--
|
|
2.45.2
|
|
|