btrfs-progs: open code print_usage where applicable

After previous change to usage() that now has the return code, there's
no purpose of the print_usage() wrapper so it can be removed.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2023-02-22 00:28:06 +01:00
parent e3a24cf11a
commit a7fa81f296
3 changed files with 8 additions and 23 deletions

View File

@ -3050,11 +3050,6 @@ static const struct cmd_struct image_cmd = {
.usagestr = image_usage .usagestr = image_usage
}; };
static void print_usage(int ret)
{
usage(&image_cmd, ret);
}
int BOX_MAIN(image)(int argc, char *argv[]) int BOX_MAIN(image)(int argc, char *argv[])
{ {
char *source; char *source;
@ -3125,13 +3120,13 @@ int BOX_MAIN(image)(int argc, char *argv[])
break; break;
case GETOPT_VAL_HELP: case GETOPT_VAL_HELP:
default: default:
print_usage(c != GETOPT_VAL_HELP); usage(&image_cmd, c != GETOPT_VAL_HELP);
} }
} }
set_argv0(argv); set_argv0(argv);
if (check_argc_min(argc - optind, 2)) if (check_argc_min(argc - optind, 2))
print_usage(1); usage(&image_cmd, 1);
dev_cnt = argc - optind - 1; dev_cnt = argc - optind - 1;
@ -3139,7 +3134,7 @@ int BOX_MAIN(image)(int argc, char *argv[])
if (dump_data) { if (dump_data) {
error( error(
"data dump feature is experimental and is not configured in this build"); "data dump feature is experimental and is not configured in this build");
print_usage(1); usage(&image_cmd, 1);
} }
#endif #endif
if (create) { if (create) {
@ -3170,7 +3165,7 @@ int BOX_MAIN(image)(int argc, char *argv[])
} }
if (usage_error) if (usage_error)
print_usage(1); usage(&image_cmd, 1);
source = argv[optind]; source = argv[optind];
target = argv[optind + 1]; target = argv[optind + 1];

View File

@ -447,11 +447,6 @@ static const struct cmd_struct mkfs_cmd = {
.usagestr = mkfs_usage .usagestr = mkfs_usage
}; };
static void print_usage(int ret)
{
usage(&mkfs_cmd, ret);
}
static int zero_output_file(int out_fd, u64 size) static int zero_output_file(int out_fd, u64 size)
{ {
int loop_num; int loop_num;
@ -1202,7 +1197,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
break; break;
case GETOPT_VAL_HELP: case GETOPT_VAL_HELP:
default: default:
print_usage(c != GETOPT_VAL_HELP); usage(&mkfs_cmd, c != GETOPT_VAL_HELP);
} }
} }
@ -1223,7 +1218,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
saved_optind = optind; saved_optind = optind;
device_count = argc - optind; device_count = argc - optind;
if (device_count == 0) if (device_count == 0)
print_usage(1); usage(&mkfs_cmd, 1);
opt_zoned = !!(features.incompat_flags & BTRFS_FEATURE_INCOMPAT_ZONED); opt_zoned = !!(features.incompat_flags & BTRFS_FEATURE_INCOMPAT_ZONED);

View File

@ -93,11 +93,6 @@ static const struct cmd_struct tune_cmd = {
.usagestr = tune_usage .usagestr = tune_usage
}; };
static void print_usage(int ret)
{
usage(&tune_cmd, ret);
}
int BOX_MAIN(btrfstune)(int argc, char *argv[]) int BOX_MAIN(btrfstune)(int argc, char *argv[])
{ {
struct btrfs_root *root; struct btrfs_root *root;
@ -182,7 +177,7 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[])
#endif #endif
case GETOPT_VAL_HELP: case GETOPT_VAL_HELP:
default: default:
print_usage(c != GETOPT_VAL_HELP); usage(&tune_cmd, c != GETOPT_VAL_HELP);
} }
} }
@ -198,7 +193,7 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[])
if (!super_flags && !seeding_flag && !(random_fsid || new_fsid_str) && if (!super_flags && !seeding_flag && !(random_fsid || new_fsid_str) &&
!change_metadata_uuid && csum_type == -1 && !to_bg_tree) { !change_metadata_uuid && csum_type == -1 && !to_bg_tree) {
error("at least one option should be specified"); error("at least one option should be specified");
print_usage(1); usage(&tune_cmd, 1);
return 1; return 1;
} }