mirror of
https://github.com/kdave/btrfs-progs
synced 2025-02-16 17:56:51 +00:00
btrfs-progs: mkfs: switch status variables to bool
There are many variables for on/off tracking, use bool instead of int. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
585ac14d1a
commit
c1fdf2f20d
46
mkfs/main.c
46
mkfs/main.c
@ -60,7 +60,7 @@ struct mkfs_allocation {
|
|||||||
u64 system;
|
u64 system;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int create_metadata_block_groups(struct btrfs_root *root, int mixed,
|
static int create_metadata_block_groups(struct btrfs_root *root, bool mixed,
|
||||||
struct mkfs_allocation *allocation)
|
struct mkfs_allocation *allocation)
|
||||||
{
|
{
|
||||||
struct btrfs_fs_info *fs_info = root->fs_info;
|
struct btrfs_fs_info *fs_info = root->fs_info;
|
||||||
@ -140,7 +140,7 @@ err:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int create_data_block_groups(struct btrfs_trans_handle *trans,
|
static int create_data_block_groups(struct btrfs_trans_handle *trans,
|
||||||
struct btrfs_root *root, int mixed,
|
struct btrfs_root *root, bool mixed,
|
||||||
struct mkfs_allocation *allocation)
|
struct mkfs_allocation *allocation)
|
||||||
{
|
{
|
||||||
struct btrfs_fs_info *fs_info = root->fs_info;
|
struct btrfs_fs_info *fs_info = root->fs_info;
|
||||||
@ -302,7 +302,7 @@ static int create_one_raid_group(struct btrfs_trans_handle *trans,
|
|||||||
|
|
||||||
static int create_raid_groups(struct btrfs_trans_handle *trans,
|
static int create_raid_groups(struct btrfs_trans_handle *trans,
|
||||||
struct btrfs_root *root, u64 data_profile,
|
struct btrfs_root *root, u64 data_profile,
|
||||||
u64 metadata_profile, int mixed,
|
u64 metadata_profile, bool mixed,
|
||||||
struct mkfs_allocation *allocation)
|
struct mkfs_allocation *allocation)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@ -422,14 +422,14 @@ static int zero_output_file(int out_fd, u64 size)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int is_ssd(const char *file)
|
static bool is_ssd(const char *file)
|
||||||
{
|
{
|
||||||
char rotational;
|
char rotational;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = device_get_queue_param(file, "rotational", &rotational, 1);
|
ret = device_get_queue_param(file, "rotational", &rotational, 1);
|
||||||
if (ret < 1)
|
if (ret < 1)
|
||||||
return 0;
|
return false;
|
||||||
|
|
||||||
return rotational == '0';
|
return rotational == '0';
|
||||||
}
|
}
|
||||||
@ -880,19 +880,19 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
|
|||||||
u32 nodesize = 0;
|
u32 nodesize = 0;
|
||||||
u32 sectorsize = 0;
|
u32 sectorsize = 0;
|
||||||
u32 stripesize = 4096;
|
u32 stripesize = 4096;
|
||||||
int zero_end = 1;
|
bool zero_end = true;
|
||||||
int fd = -1;
|
int fd = -1;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int close_ret;
|
int close_ret;
|
||||||
int i;
|
int i;
|
||||||
int mixed = 0;
|
bool mixed = false;
|
||||||
int nodesize_forced = 0;
|
bool nodesize_forced = false;
|
||||||
int data_profile_opt = 0;
|
bool data_profile_opt = false;
|
||||||
int metadata_profile_opt = 0;
|
bool metadata_profile_opt = false;
|
||||||
int discard = 1;
|
bool discard = true;
|
||||||
int ssd = 0;
|
bool ssd = false;
|
||||||
int zoned = 0;
|
bool zoned = false;
|
||||||
int force_overwrite = 0;
|
bool force_overwrite = false;
|
||||||
char *source_dir = NULL;
|
char *source_dir = NULL;
|
||||||
bool source_dir_set = false;
|
bool source_dir_set = false;
|
||||||
bool shrink_rootdir = false;
|
bool shrink_rootdir = false;
|
||||||
@ -948,28 +948,28 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case 'f':
|
case 'f':
|
||||||
force_overwrite = 1;
|
force_overwrite = true;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
data_profile = parse_profile(optarg);
|
data_profile = parse_profile(optarg);
|
||||||
data_profile_opt = 1;
|
data_profile_opt = true;
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
warning("--leafsize is deprecated, use --nodesize");
|
warning("--leafsize is deprecated, use --nodesize");
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case 'n':
|
case 'n':
|
||||||
nodesize = parse_size_from_string(optarg);
|
nodesize = parse_size_from_string(optarg);
|
||||||
nodesize_forced = 1;
|
nodesize_forced = true;
|
||||||
break;
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
label = parse_label(optarg);
|
label = parse_label(optarg);
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
metadata_profile = parse_profile(optarg);
|
metadata_profile = parse_profile(optarg);
|
||||||
metadata_profile_opt = 1;
|
metadata_profile_opt = true;
|
||||||
break;
|
break;
|
||||||
case 'M':
|
case 'M':
|
||||||
mixed = 1;
|
mixed = true;
|
||||||
break;
|
break;
|
||||||
case 'O': {
|
case 'O': {
|
||||||
char *orig = strdup(optarg);
|
char *orig = strdup(optarg);
|
||||||
@ -1013,7 +1013,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
block_count = parse_size_from_string(optarg);
|
block_count = parse_size_from_string(optarg);
|
||||||
zero_end = 0;
|
zero_end = false;
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
bconf_be_verbose();
|
bconf_be_verbose();
|
||||||
@ -1031,7 +1031,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
|
|||||||
BTRFS_UUID_UNPARSED_SIZE - 1);
|
BTRFS_UUID_UNPARSED_SIZE - 1);
|
||||||
break;
|
break;
|
||||||
case 'K':
|
case 'K':
|
||||||
discard = 0;
|
discard = false;
|
||||||
break;
|
break;
|
||||||
case 'q':
|
case 'q':
|
||||||
bconf_be_quiet();
|
bconf_be_quiet();
|
||||||
@ -1067,7 +1067,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
|
|||||||
if (dev_cnt == 0)
|
if (dev_cnt == 0)
|
||||||
print_usage(1);
|
print_usage(1);
|
||||||
|
|
||||||
zoned = (features & BTRFS_FEATURE_INCOMPAT_ZONED);
|
zoned = !!(features & BTRFS_FEATURE_INCOMPAT_ZONED);
|
||||||
|
|
||||||
if (source_dir_set && dev_cnt > 1) {
|
if (source_dir_set && dev_cnt > 1) {
|
||||||
error("the option -r is limited to a single device");
|
error("the option -r is limited to a single device");
|
||||||
@ -1119,7 +1119,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
|
|||||||
printf(
|
printf(
|
||||||
"Zoned: %s: host-managed device detected, setting zoned feature\n",
|
"Zoned: %s: host-managed device detected, setting zoned feature\n",
|
||||||
file);
|
file);
|
||||||
zoned = 1;
|
zoned = true;
|
||||||
features |= BTRFS_FEATURE_INCOMPAT_ZONED;
|
features |= BTRFS_FEATURE_INCOMPAT_ZONED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user