From ed21179c98a9fe51d4d682136cbf42dd46df3479 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Fri, 5 Apr 2024 03:00:41 +0200 Subject: [PATCH] btrfs-progs: check: use bool for option status variables Signed-off-by: David Sterba --- check/main.c | 30 +++++++++++++++--------------- check/mode-common.h | 6 +++--- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/check/main.c b/check/main.c index d5c774a9..a1080319 100644 --- a/check/main.c +++ b/check/main.c @@ -81,10 +81,10 @@ u64 data_bytes_allocated = 0; u64 data_bytes_referenced = 0; LIST_HEAD(duplicate_extents); LIST_HEAD(delete_items); -int no_holes = 0; -static int is_free_space_tree = 0; -int init_extent_tree = 0; -int check_data_csum = 0; +bool no_holes = false; +bool is_free_space_tree = false; +bool init_extent_tree = false; +bool check_data_csum = false; struct cache_tree *roots_info_cache = NULL; enum btrfs_check_mode { @@ -6004,7 +6004,7 @@ static int check_csum_root(struct btrfs_root *root) int ret; u64 data_len; unsigned long leaf_offset; - bool verify_csum = !!check_data_csum; + bool verify_csum = check_data_csum; u16 num_entries, max_entries; max_entries = ((BTRFS_LEAF_DATA_SIZE(gfs_info) - @@ -10110,16 +10110,16 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv) int ret = 0; int err = 0; u64 num; - int init_csum_tree = 0; - int readonly = 0; + bool init_csum_tree = false; + bool readonly = false; + bool qgroup_report = false; + bool force = false; int clear_space_cache = 0; - int qgroup_report = 0; int qgroups_repaired = 0; int qgroup_verify_ret; unsigned ctree_flags = OPEN_CTREE_EXCLUSIVE | OPEN_CTREE_ALLOW_TRANSID_MISMATCH | OPEN_CTREE_SKIP_LEAF_ITEM_CHECKS; - int force = 0; while(1) { int c; @@ -10175,7 +10175,7 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv) printf("using SB copy %llu, bytenr %llu\n", num, bytenr); break; case 'Q': - qgroup_report = 1; + qgroup_report = true; break; case 'E': subvolid = arg_strtou64(optarg); @@ -10195,22 +10195,22 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv) ctree_flags |= OPEN_CTREE_WRITES; break; case GETOPT_VAL_READONLY: - readonly = 1; + readonly = true; break; case GETOPT_VAL_INIT_CSUM: printf("Creating a new CRC tree\n"); - init_csum_tree = 1; + init_csum_tree = true; opt_check_repair = 1; ctree_flags |= OPEN_CTREE_WRITES; break; case GETOPT_VAL_INIT_EXTENT: - init_extent_tree = 1; + init_extent_tree = true; ctree_flags |= (OPEN_CTREE_WRITES | OPEN_CTREE_NO_BLOCK_GROUPS); opt_check_repair = 1; break; case GETOPT_VAL_CHECK_CSUM: - check_data_csum = 1; + check_data_csum = true; break; case GETOPT_VAL_MODE: check_mode = parse_check_mode(optarg); @@ -10237,7 +10237,7 @@ static int cmd_check(const struct cmd_struct *cmd, int argc, char **argv) exit(1); break; case GETOPT_VAL_FORCE: - force = 1; + force = true; break; case '?': case 'h': diff --git a/check/mode-common.h b/check/mode-common.h index 80672e51..c37b4dc0 100644 --- a/check/mode-common.h +++ b/check/mode-common.h @@ -80,9 +80,9 @@ extern u64 data_bytes_allocated; extern u64 data_bytes_referenced; extern struct list_head duplicate_extents; extern struct list_head delete_items; -extern int no_holes; -extern int init_extent_tree; -extern int check_data_csum; +extern bool no_holes; +extern bool init_extent_tree; +extern bool check_data_csum; extern struct btrfs_fs_info *gfs_info; extern struct cache_tree *roots_info_cache;