From c6cf9778e8f8dbdb0597edfd8adb712663b9e422 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Sat, 11 Jul 2015 00:05:05 +0200 Subject: btrfs-progs: unify naming of command handlers Use cmd_ + group + command schema. Signed-off-by: David Sterba --- cmds-device.c | 58 ++++++++++++++++++++++++++++--------------------------- cmds-filesystem.c | 54 ++++++++++++++++++++++++++++----------------------- cmds-inspect.c | 43 +++++++++++++++++++++-------------------- cmds-property.c | 42 +++++++++++++++++++++++----------------- cmds-replace.c | 30 ++++++++++++++-------------- cmds-rescue.c | 22 +++++++++++---------- cmds-subvolume.c | 20 ++++++++++--------- 7 files changed, 144 insertions(+), 125 deletions(-) diff --git a/cmds-device.c b/cmds-device.c index 0e605002..458c088d 100644 --- a/cmds-device.c +++ b/cmds-device.c @@ -37,7 +37,7 @@ static const char * const device_cmd_group_usage[] = { NULL }; -static const char * const cmd_add_dev_usage[] = { +static const char * const cmd_device_add_usage[] = { "btrfs device add [options] [...] ", "Add a device to a filesystem", "-K|--nodiscard do not perform whole device TRIM", @@ -45,7 +45,7 @@ static const char * const cmd_add_dev_usage[] = { NULL }; -static int cmd_add_dev(int argc, char **argv) +static int cmd_device_add(int argc, char **argv) { char *mntpnt; int i, fdmnt, ret=0, e; @@ -72,14 +72,14 @@ static int cmd_add_dev(int argc, char **argv) force = 1; break; default: - usage(cmd_add_dev_usage); + usage(cmd_device_add_usage); } } argc = argc - optind; if (check_argc_min(argc, 2)) - usage(cmd_add_dev_usage); + usage(cmd_device_add_usage); mntpnt = argv[optind + argc - 1]; @@ -143,7 +143,8 @@ error_out: return !!ret; } -static int _cmd_rm_dev(int argc, char **argv, const char * const *usagestr) +static int _cmd_device_remove(int argc, char **argv, + const char * const *usagestr) { char *mntpnt; int i, fdmnt, ret=0, e; @@ -192,36 +193,36 @@ static int _cmd_rm_dev(int argc, char **argv, const char * const *usagestr) return !!ret; } -static const char * const cmd_rm_dev_usage[] = { +static const char * const cmd_device_remove_usage[] = { "btrfs device remove [...] ", "Remove a device from a filesystem", NULL }; -static int cmd_rm_dev(int argc, char **argv) +static int cmd_device_remove(int argc, char **argv) { - return _cmd_rm_dev(argc, argv, cmd_rm_dev_usage); + return _cmd_device_remove(argc, argv, cmd_device_remove_usage); } -static const char * const cmd_del_dev_usage[] = { +static const char * const cmd_device_delete_usage[] = { "btrfs device delete [...] ", "Remove a device from a filesystem", NULL }; -static int cmd_del_dev(int argc, char **argv) +static int cmd_device_delete(int argc, char **argv) { - return _cmd_rm_dev(argc, argv, cmd_del_dev_usage); + return _cmd_device_remove(argc, argv, cmd_device_delete_usage); } -static const char * const cmd_scan_dev_usage[] = { +static const char * const cmd_device_scan_usage[] = { "btrfs device scan [(-d|--all-devices)| [...]]", "Scan devices for a btrfs filesystem", " -d|--all-devices (deprecated)", NULL }; -static int cmd_scan_dev(int argc, char **argv) +static int cmd_device_scan(int argc, char **argv) { int i; int devstart = 1; @@ -244,12 +245,12 @@ static int cmd_scan_dev(int argc, char **argv) all = 1; break; default: - usage(cmd_scan_dev_usage); + usage(cmd_device_scan_usage); } } if (all && check_argc_max(argc, 2)) - usage(cmd_scan_dev_usage); + usage(cmd_device_scan_usage); if (all || argc == 1) { printf("Scanning for Btrfs filesystems\n"); @@ -292,13 +293,13 @@ out: return !!ret; } -static const char * const cmd_ready_dev_usage[] = { +static const char * const cmd_device_ready_usage[] = { "btrfs device ready ", "Check device to see if it has all of its devices in cache for mounting", NULL }; -static int cmd_ready_dev(int argc, char **argv) +static int cmd_device_ready(int argc, char **argv) { struct btrfs_ioctl_vol_args args; int fd; @@ -306,7 +307,7 @@ static int cmd_ready_dev(int argc, char **argv) char *path; if (check_argc_min(argc, 2)) - usage(cmd_ready_dev_usage); + usage(cmd_device_ready_usage); fd = open("/dev/btrfs-control", O_RDWR); if (fd < 0) { @@ -346,13 +347,13 @@ out: return ret; } -static const char * const cmd_dev_stats_usage[] = { +static const char * const cmd_device_stats_usage[] = { "btrfs device stats [-z] |", "Show current device IO stats. -z to reset stats afterwards.", NULL }; -static int cmd_dev_stats(int argc, char **argv) +static int cmd_device_stats(int argc, char **argv) { char *dev_path; struct btrfs_ioctl_fs_info_args fi_args; @@ -373,13 +374,13 @@ static int cmd_dev_stats(int argc, char **argv) break; case '?': default: - usage(cmd_dev_stats_usage); + usage(cmd_device_stats_usage); } } argc = argc - optind; if (check_argc_exact(argc, 1)) - usage(cmd_dev_stats_usage); + usage(cmd_device_stats_usage); dev_path = argv[optind]; @@ -605,12 +606,13 @@ static const char device_cmd_group_info[] = const struct cmd_group device_cmd_group = { device_cmd_group_usage, device_cmd_group_info, { - { "add", cmd_add_dev, cmd_add_dev_usage, NULL, 0 }, - { "delete", cmd_del_dev, cmd_del_dev_usage, NULL, CMD_ALIAS }, - { "remove", cmd_rm_dev, cmd_rm_dev_usage, NULL, 0 }, - { "scan", cmd_scan_dev, cmd_scan_dev_usage, NULL, 0 }, - { "ready", cmd_ready_dev, cmd_ready_dev_usage, NULL, 0 }, - { "stats", cmd_dev_stats, cmd_dev_stats_usage, NULL, 0 }, + { "add", cmd_device_add, cmd_device_add_usage, NULL, 0 }, + { "delete", cmd_device_delete, cmd_device_delete_usage, NULL, + CMD_ALIAS }, + { "remove", cmd_device_remove, cmd_device_remove_usage, NULL, 0 }, + { "scan", cmd_device_scan, cmd_device_scan_usage, NULL, 0 }, + { "ready", cmd_device_ready, cmd_device_ready_usage, NULL, 0 }, + { "stats", cmd_device_stats, cmd_device_stats_usage, NULL, 0 }, { "usage", cmd_device_usage, cmd_device_usage_usage, NULL, 0 }, NULL_CMD_STRUCT diff --git a/cmds-filesystem.c b/cmds-filesystem.c index 800aa4dc..7998add6 100644 --- a/cmds-filesystem.c +++ b/cmds-filesystem.c @@ -815,7 +815,7 @@ fail_out: goto out; } -static const char * const cmd_show_usage[] = { +static const char * const cmd_filesystem_show_usage[] = { "btrfs filesystem show [options] [|||label]", "Show the structure of a filesystem", "-d|--all-devices show only disks under /dev containing btrfs filesystem", @@ -832,7 +832,7 @@ static const char * const cmd_show_usage[] = { NULL }; -static int cmd_show(int argc, char **argv) +static int cmd_filesystem_show(int argc, char **argv) { LIST_HEAD(all_uuids); struct btrfs_fs_devices *fs_devices; @@ -900,17 +900,17 @@ static int cmd_show(int argc, char **argv) units_set_mode(&unit_mode, UNITS_HUMAN_BINARY); break; default: - usage(cmd_show_usage); + usage(cmd_filesystem_show_usage); } } if (check_argc_max(argc, optind + 1)) - usage(cmd_show_usage); + usage(cmd_filesystem_show_usage); if (argc > optind) { search = argv[optind]; if (strlen(search) == 0) - usage(cmd_show_usage); + usage(cmd_filesystem_show_usage); type = check_arg_type(search); /* @@ -1007,20 +1007,20 @@ out: return ret; } -static const char * const cmd_sync_usage[] = { +static const char * const cmd_filesystem_sync_usage[] = { "btrfs filesystem sync ", "Force a sync on a filesystem", NULL }; -static int cmd_sync(int argc, char **argv) +static int cmd_filesystem_sync(int argc, char **argv) { int fd, res, e; char *path; DIR *dirstream = NULL; if (check_argc_exact(argc, 2)) - usage(cmd_sync_usage); + usage(cmd_filesystem_sync_usage); path = argv[1]; @@ -1055,7 +1055,7 @@ static int parse_compress_type(char *s) }; } -static const char * const cmd_defrag_usage[] = { +static const char * const cmd_filesystem_defrag_usage[] = { "btrfs filesystem defragment [options] | [|...]", "Defragment a file or a directory", "", @@ -1121,7 +1121,7 @@ error: return 0; } -static int cmd_defrag(int argc, char **argv) +static int cmd_filesystem_defrag(int argc, char **argv) { int fd; int flush = 0; @@ -1181,12 +1181,12 @@ static int cmd_defrag(int argc, char **argv) recursive = 1; break; default: - usage(cmd_defrag_usage); + usage(cmd_filesystem_defrag_usage); } } if (check_argc_min(argc - optind, 1)) - usage(cmd_defrag_usage); + usage(cmd_filesystem_defrag_usage); memset(&defrag_global_range, 0, sizeof(range)); defrag_global_range.start = start; @@ -1270,7 +1270,7 @@ static int cmd_defrag(int argc, char **argv) return !!defrag_global_errors; } -static const char * const cmd_resize_usage[] = { +static const char * const cmd_filesystem_resize_usage[] = { "btrfs filesystem resize [devid:][+/-][kKmMgGtTpPeE]|[devid:]max ", "Resize a filesystem", "If 'max' is passed, the filesystem will occupy all available space", @@ -1279,7 +1279,7 @@ static const char * const cmd_resize_usage[] = { NULL }; -static int cmd_resize(int argc, char **argv) +static int cmd_filesystem_resize(int argc, char **argv) { struct btrfs_ioctl_vol_args args; int fd, res, len, e; @@ -1288,7 +1288,7 @@ static int cmd_resize(int argc, char **argv) struct stat st; if (check_argc_exact(argc, 3)) - usage(cmd_resize_usage); + usage(cmd_filesystem_resize_usage); amount = argv[1]; path = argv[2]; @@ -1346,7 +1346,7 @@ static int cmd_resize(int argc, char **argv) return 0; } -static const char * const cmd_label_usage[] = { +static const char * const cmd_filesystem_label_usage[] = { "btrfs filesystem label [|] []", "Get or change the label of a filesystem", "With one argument, get the label of filesystem on .", @@ -1354,10 +1354,10 @@ static const char * const cmd_label_usage[] = { NULL }; -static int cmd_label(int argc, char **argv) +static int cmd_filesystem_label(int argc, char **argv) { if (check_argc_min(argc, 2) || check_argc_max(argc, 3)) - usage(cmd_label_usage); + usage(cmd_filesystem_label_usage); if (argc > 2) { return set_label(argv[1], argv[2]); @@ -1379,12 +1379,18 @@ static const char filesystem_cmd_group_info[] = const struct cmd_group filesystem_cmd_group = { filesystem_cmd_group_usage, filesystem_cmd_group_info, { { "df", cmd_filesystem_df, cmd_filesystem_df_usage, NULL, 0 }, - { "show", cmd_show, cmd_show_usage, NULL, 0 }, - { "sync", cmd_sync, cmd_sync_usage, NULL, 0 }, - { "defragment", cmd_defrag, cmd_defrag_usage, NULL, 0 }, - { "balance", cmd_balance, NULL, &balance_cmd_group, CMD_HIDDEN }, - { "resize", cmd_resize, cmd_resize_usage, NULL, 0 }, - { "label", cmd_label, cmd_label_usage, NULL, 0 }, + { "show", cmd_filesystem_show, cmd_filesystem_show_usage, NULL, + 0 }, + { "sync", cmd_filesystem_sync, cmd_filesystem_sync_usage, NULL, + 0 }, + { "defragment", cmd_filesystem_defrag, + cmd_filesystem_defrag_usage, NULL, 0 }, + { "balance", cmd_balance, NULL, &balance_cmd_group, + CMD_HIDDEN }, + { "resize", cmd_filesystem_resize, cmd_filesystem_resize_usage, + NULL, 0 }, + { "label", cmd_filesystem_label, cmd_filesystem_label_usage, + NULL, 0 }, { "usage", cmd_filesystem_usage, cmd_filesystem_usage_usage, NULL, 0 }, diff --git a/cmds-inspect.c b/cmds-inspect.c index 18235846..56da09f9 100644 --- a/cmds-inspect.c +++ b/cmds-inspect.c @@ -82,7 +82,7 @@ out: return !!ret; } -static const char * const cmd_inode_resolve_usage[] = { +static const char * const cmd_inspect_inode_resolve_usage[] = { "btrfs inspect-internal inode-resolve [-v] ", "Get file system paths for the given inode", "", @@ -90,7 +90,7 @@ static const char * const cmd_inode_resolve_usage[] = { NULL }; -static int cmd_inode_resolve(int argc, char **argv) +static int cmd_inspect_inode_resolve(int argc, char **argv) { int fd; int verbose = 0; @@ -108,12 +108,12 @@ static int cmd_inode_resolve(int argc, char **argv) verbose = 1; break; default: - usage(cmd_inode_resolve_usage); + usage(cmd_inspect_inode_resolve_usage); } } if (check_argc_exact(argc - optind, 2)) - usage(cmd_inode_resolve_usage); + usage(cmd_inspect_inode_resolve_usage); fd = open_file_or_dir(argv[optind+1], &dirstream); if (fd < 0) { @@ -128,7 +128,7 @@ static int cmd_inode_resolve(int argc, char **argv) } -static const char * const cmd_logical_resolve_usage[] = { +static const char * const cmd_inspect_logical_resolve_usage[] = { "btrfs inspect-internal logical-resolve [-Pv] [-s bufsize] ", "Get file system paths for the given logical address", "-P skip the path resolving and print the inodes instead", @@ -139,7 +139,7 @@ static const char * const cmd_logical_resolve_usage[] = { NULL }; -static int cmd_logical_resolve(int argc, char **argv) +static int cmd_inspect_logical_resolve(int argc, char **argv) { int ret; int fd; @@ -171,12 +171,12 @@ static int cmd_logical_resolve(int argc, char **argv) size = arg_strtou64(optarg); break; default: - usage(cmd_logical_resolve_usage); + usage(cmd_inspect_logical_resolve_usage); } } if (check_argc_exact(argc - optind, 2)) - usage(cmd_logical_resolve_usage); + usage(cmd_inspect_logical_resolve_usage); size = min(size, (u64)64 * 1024); inodes = malloc(size); @@ -260,13 +260,13 @@ out: return !!ret; } -static const char * const cmd_subvolid_resolve_usage[] = { +static const char * const cmd_inspect_subvolid_resolve_usage[] = { "btrfs inspect-internal subvolid-resolve ", "Get file system paths for the given subvolume ID.", NULL }; -static int cmd_subvolid_resolve(int argc, char **argv) +static int cmd_inspect_subvolid_resolve(int argc, char **argv) { int ret; int fd = -1; @@ -275,7 +275,7 @@ static int cmd_subvolid_resolve(int argc, char **argv) DIR *dirstream = NULL; if (check_argc_exact(argc, 3)) - usage(cmd_subvolid_resolve_usage); + usage(cmd_inspect_subvolid_resolve_usage); fd = open_file_or_dir(argv[2], &dirstream); if (fd < 0) { @@ -302,13 +302,13 @@ out: return ret ? 1 : 0; } -static const char* const cmd_rootid_usage[] = { +static const char* const cmd_inspect_rootid_usage[] = { "btrfs inspect-internal rootid ", "Get tree ID of the containing subvolume of path.", NULL }; -static int cmd_rootid(int argc, char **argv) +static int cmd_inspect_rootid(int argc, char **argv) { int ret; int fd = -1; @@ -316,7 +316,7 @@ static int cmd_rootid(int argc, char **argv) DIR *dirstream = NULL; if (check_argc_exact(argc, 2)) - usage(cmd_rootid_usage); + usage(cmd_inspect_rootid_usage); fd = open_file_or_dir(argv[1], &dirstream); if (fd < 0) { @@ -636,13 +636,14 @@ static const char inspect_cmd_group_info[] = const struct cmd_group inspect_cmd_group = { inspect_cmd_group_usage, inspect_cmd_group_info, { - { "inode-resolve", cmd_inode_resolve, cmd_inode_resolve_usage, - NULL, 0 }, - { "logical-resolve", cmd_logical_resolve, - cmd_logical_resolve_usage, NULL, 0 }, - { "subvolid-resolve", cmd_subvolid_resolve, - cmd_subvolid_resolve_usage, NULL, 0 }, - { "rootid", cmd_rootid, cmd_rootid_usage, NULL, 0 }, + { "inode-resolve", cmd_inspect_inode_resolve, + cmd_inspect_inode_resolve_usage, NULL, 0 }, + { "logical-resolve", cmd_inspect_logical_resolve, + cmd_inspect_logical_resolve_usage, NULL, 0 }, + { "subvolid-resolve", cmd_inspect_subvolid_resolve, + cmd_inspect_subvolid_resolve_usage, NULL, 0 }, + { "rootid", cmd_inspect_rootid, cmd_inspect_rootid_usage, NULL, + 0 }, { "min-dev-size", cmd_inspect_min_dev_size, cmd_inspect_min_dev_size_usage, NULL, 0 }, NULL_CMD_STRUCT diff --git a/cmds-property.c b/cmds-property.c index 5f1dd5b3..44f79079 100644 --- a/cmds-property.c +++ b/cmds-property.c @@ -32,7 +32,7 @@ static const char * const property_cmd_group_usage[] = { NULL }; -static const char * const cmd_get_usage[] = { +static const char * const cmd_property_get_usage[] = { "btrfs property get [-t ] []", "Gets a property from a btrfs object.", "If no name is specified, all properties for the given object are", @@ -45,7 +45,7 @@ static const char * const cmd_get_usage[] = { NULL }; -static const char * const cmd_set_usage[] = { +static const char * const cmd_property_set_usage[] = { "btrfs property set [-t ] ", "Sets a property on a btrfs object.", "Please see the help of 'btrfs property get' for a description of", @@ -53,7 +53,7 @@ static const char * const cmd_set_usage[] = { NULL }; -static const char * const cmd_list_usage[] = { +static const char * const cmd_property_list_usage[] = { "btrfs property list [-t ] ", "Lists available properties with their descriptions for the given object.", "Please see the help of 'btrfs property get' for a description of", @@ -394,7 +394,7 @@ static void parse_args(int argc, char **argv, } } -static int cmd_get(int argc, char **argv) +static int cmd_property_get(int argc, char **argv) { int ret; char *object = NULL; @@ -402,12 +402,13 @@ static int cmd_get(int argc, char **argv) int types = 0; if (check_argc_min(argc, 2) || check_argc_max(argc, 5)) - usage(cmd_get_usage); + usage(cmd_property_get_usage); - parse_args(argc, argv, cmd_get_usage, &types, &object, &name, NULL); + parse_args(argc, argv, cmd_property_get_usage, &types, &object, &name, + NULL); if (!object) { fprintf(stderr, "ERROR: invalid arguments.\n"); - usage(cmd_set_usage); + usage(cmd_property_set_usage); } if (name) @@ -418,7 +419,7 @@ static int cmd_get(int argc, char **argv) return ret; } -static int cmd_set(int argc, char **argv) +static int cmd_property_set(int argc, char **argv) { int ret; char *object = NULL; @@ -427,12 +428,13 @@ static int cmd_set(int argc, char **argv) int types = 0; if (check_argc_min(argc, 4) || check_argc_max(argc, 6)) - usage(cmd_set_usage); + usage(cmd_property_set_usage); - parse_args(argc, argv, cmd_set_usage, &types, &object, &name, &value); + parse_args(argc, argv, cmd_property_set_usage, &types, + &object, &name, &value); if (!object || !name || !value) { fprintf(stderr, "ERROR: invalid arguments.\n"); - usage(cmd_set_usage); + usage(cmd_property_set_usage); } ret = setget_prop(types, object, name, value); @@ -440,19 +442,20 @@ static int cmd_set(int argc, char **argv) return ret; } -static int cmd_list(int argc, char **argv) +static int cmd_property_list(int argc, char **argv) { int ret; char *object = NULL; int types = 0; if (check_argc_min(argc, 2) || check_argc_max(argc, 4)) - usage(cmd_list_usage); + usage(cmd_property_list_usage); - parse_args(argc, argv, cmd_list_usage, &types, &object, NULL, NULL); + parse_args(argc, argv, cmd_property_list_usage, + &types, &object, NULL, NULL); if (!object) { fprintf(stderr, "ERROR: invalid arguments.\n"); - usage(cmd_set_usage); + usage(cmd_property_set_usage); } ret = dump_props(types, object, 1); @@ -465,9 +468,12 @@ static const char property_cmd_group_info[] = const struct cmd_group property_cmd_group = { property_cmd_group_usage, property_cmd_group_info, { - { "get", cmd_get, cmd_get_usage, NULL, 0 }, - { "set", cmd_set, cmd_set_usage, NULL, 0 }, - { "list", cmd_list, cmd_list_usage, NULL, 0 }, + { "get", cmd_property_get, + cmd_property_get_usage, NULL, 0 }, + { "set", cmd_property_set, + cmd_property_set_usage, NULL, 0 }, + { "list", cmd_property_list, + cmd_property_list_usage, NULL, 0 }, { 0, 0, 0, 0, 0 }, } }; diff --git a/cmds-replace.c b/cmds-replace.c index 85365e39..2f123cbe 100644 --- a/cmds-replace.c +++ b/cmds-replace.c @@ -98,7 +98,7 @@ static int dev_replace_handle_sigint(int fd) return sigaction(SIGINT, &sa, NULL); } -static const char *const cmd_start_replace_usage[] = { +static const char *const cmd_replace_start_usage[] = { "btrfs replace start [-Bfr] | ", "Replace device of a btrfs filesystem.", "On a live filesystem, duplicate the data to the target device which", @@ -124,7 +124,7 @@ static const char *const cmd_start_replace_usage[] = { NULL }; -static int cmd_start_replace(int argc, char **argv) +static int cmd_replace_start(int argc, char **argv) { struct btrfs_ioctl_dev_replace_args start_args = {0}; struct btrfs_ioctl_dev_replace_args status_args = {0}; @@ -156,7 +156,7 @@ static int cmd_start_replace(int argc, char **argv) break; case '?': default: - usage(cmd_start_replace_usage); + usage(cmd_replace_start_usage); } } @@ -165,7 +165,7 @@ static int cmd_start_replace(int argc, char **argv) BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_AVOID : BTRFS_IOCTL_DEV_REPLACE_CONT_READING_FROM_SRCDEV_MODE_ALWAYS; if (check_argc_exact(argc - optind, 3)) - usage(cmd_start_replace_usage); + usage(cmd_replace_start_usage); path = argv[optind + 2]; fdmnt = open_path_or_dev_mnt(path, &dirstream); @@ -328,7 +328,7 @@ leave_with_error: return 1; } -static const char *const cmd_status_replace_usage[] = { +static const char *const cmd_replace_status_usage[] = { "btrfs replace status [-1] ", "Print status and progress information of a running device replace", "operation", @@ -338,7 +338,7 @@ static const char *const cmd_status_replace_usage[] = { NULL }; -static int cmd_status_replace(int argc, char **argv) +static int cmd_replace_status(int argc, char **argv) { int fd; int e; @@ -355,12 +355,12 @@ static int cmd_status_replace(int argc, char **argv) break; case '?': default: - usage(cmd_status_replace_usage); + usage(cmd_replace_status_usage); } } if (check_argc_exact(argc - optind, 1)) - usage(cmd_status_replace_usage); + usage(cmd_replace_status_usage); path = argv[optind]; fd = open_file_or_dir(path, &dirstream); @@ -507,13 +507,13 @@ progress2string(char *buf, size_t s, int progress_1000) return buf; } -static const char *const cmd_cancel_replace_usage[] = { +static const char *const cmd_replace_cancel_usage[] = { "btrfs replace cancel ", "Cancel a running device replace operation.", NULL }; -static int cmd_cancel_replace(int argc, char **argv) +static int cmd_replace_cancel(int argc, char **argv) { struct btrfs_ioctl_dev_replace_args args = {0}; int ret; @@ -527,12 +527,12 @@ static int cmd_cancel_replace(int argc, char **argv) switch (c) { case '?': default: - usage(cmd_cancel_replace_usage); + usage(cmd_replace_cancel_usage); } } if (check_argc_exact(argc - optind, 1)) - usage(cmd_cancel_replace_usage); + usage(cmd_replace_cancel_usage); path = argv[optind]; fd = open_file_or_dir(path, &dirstream); @@ -570,11 +570,11 @@ static const char replace_cmd_group_info[] = const struct cmd_group replace_cmd_group = { replace_cmd_group_usage, replace_cmd_group_info, { - { "start", cmd_start_replace, cmd_start_replace_usage, NULL, + { "start", cmd_replace_start, cmd_replace_start_usage, NULL, 0 }, - { "status", cmd_status_replace, cmd_status_replace_usage, NULL, + { "status", cmd_replace_status, cmd_replace_status_usage, NULL, 0 }, - { "cancel", cmd_cancel_replace, cmd_cancel_replace_usage, NULL, + { "cancel", cmd_replace_cancel, cmd_replace_cancel_usage, NULL, 0 }, NULL_CMD_STRUCT } diff --git a/cmds-rescue.c b/cmds-rescue.c index a82da167..dd7c01ea 100644 --- a/cmds-rescue.c +++ b/cmds-rescue.c @@ -33,7 +33,7 @@ static const char * const rescue_cmd_group_usage[] = { int btrfs_recover_chunk_tree(char *path, int verbose, int yes); int btrfs_recover_superblocks(char *path, int verbose, int yes); -const char * const cmd_chunk_recover_usage[] = { +const char * const cmd_rescue_chunk_recover_usage[] = { "btrfs rescue chunk-recover [options] ", "Recover the chunk tree by scanning the devices one by one.", "", @@ -43,7 +43,7 @@ const char * const cmd_chunk_recover_usage[] = { NULL }; -const char * const cmd_super_recover_usage[] = { +const char * const cmd_rescue_super_recover_usage[] = { "btrfs rescue super-recover [options] ", "Recover bad superblocks from good copies", "", @@ -52,7 +52,7 @@ const char * const cmd_super_recover_usage[] = { NULL }; -int cmd_chunk_recover(int argc, char *argv[]) +int cmd_rescue_chunk_recover(int argc, char *argv[]) { int ret = 0; char *file; @@ -72,13 +72,13 @@ int cmd_chunk_recover(int argc, char *argv[]) break; case 'h': default: - usage(cmd_chunk_recover_usage); + usage(cmd_rescue_chunk_recover_usage); } } argc = argc - optind; if (check_argc_exact(argc, 1)) - usage(cmd_chunk_recover_usage); + usage(cmd_rescue_chunk_recover_usage); file = argv[optind]; @@ -112,7 +112,7 @@ int cmd_chunk_recover(int argc, char *argv[]) * 3 : Fail to Recover bad supeblocks * 4 : Abort to recover bad superblocks */ -int cmd_super_recover(int argc, char **argv) +int cmd_rescue_super_recover(int argc, char **argv) { int ret; int verbose = 0; @@ -131,12 +131,12 @@ int cmd_super_recover(int argc, char **argv) yes = 1; break; default: - usage(cmd_super_recover_usage); + usage(cmd_rescue_super_recover_usage); } } argc = argc - optind; if (check_argc_exact(argc, 1)) - usage(cmd_super_recover_usage); + usage(cmd_rescue_super_recover_usage); dname = argv[optind]; ret = check_mounted(dname); @@ -206,8 +206,10 @@ static const char rescue_cmd_group_info[] = const struct cmd_group rescue_cmd_group = { rescue_cmd_group_usage, rescue_cmd_group_info, { - { "chunk-recover", cmd_chunk_recover, cmd_chunk_recover_usage, NULL, 0}, - { "super-recover", cmd_super_recover, cmd_super_recover_usage, NULL, 0}, + { "chunk-recover", cmd_rescue_chunk_recover, + cmd_rescue_chunk_recover_usage, NULL, 0}, + { "super-recover", cmd_rescue_super_recover, + cmd_rescue_super_recover_usage, NULL, 0}, { "zero-log", cmd_rescue_zero_log, cmd_rescue_zero_log_usage, NULL, 0}, NULL_CMD_STRUCT } diff --git a/cmds-subvolume.c b/cmds-subvolume.c index e88a6e6e..61f08f51 100644 --- a/cmds-subvolume.c +++ b/cmds-subvolume.c @@ -611,7 +611,7 @@ out: return !!ret; } -static const char * const cmd_snapshot_usage[] = { +static const char * const cmd_subvol_snapshot_usage[] = { "btrfs subvolume snapshot [-r] [-i ] |[/]", "Create a snapshot of the subvolume", "Create a writable/readonly snapshot of the subvolume with", @@ -624,7 +624,7 @@ static const char * const cmd_snapshot_usage[] = { NULL }; -static int cmd_snapshot(int argc, char **argv) +static int cmd_subvol_snapshot(int argc, char **argv) { char *subvol, *dst; int res, retval; @@ -671,12 +671,12 @@ static int cmd_snapshot(int argc, char **argv) } break; default: - usage(cmd_snapshot_usage); + usage(cmd_subvol_snapshot_usage); } } if (check_argc_exact(argc - optind, 2)) - usage(cmd_snapshot_usage); + usage(cmd_subvol_snapshot_usage); subvol = argv[optind]; dst = argv[optind + 1]; @@ -875,13 +875,13 @@ static int cmd_subvol_set_default(int argc, char **argv) return 0; } -static const char * const cmd_find_new_usage[] = { +static const char * const cmd_subvol_find_new_usage[] = { "btrfs subvolume find-new ", "List the recently modified files in a filesystem", NULL }; -static int cmd_find_new(int argc, char **argv) +static int cmd_subvol_find_new(int argc, char **argv) { int fd; int ret; @@ -890,7 +890,7 @@ static int cmd_find_new(int argc, char **argv) DIR *dirstream = NULL; if (check_argc_exact(argc, 3)) - usage(cmd_find_new_usage); + usage(cmd_subvol_find_new_usage); subvol = argv[1]; last_gen = arg_strtou64(argv[2]); @@ -1353,12 +1353,14 @@ const struct cmd_group subvolume_cmd_group = { { "create", cmd_subvol_create, cmd_subvol_create_usage, NULL, 0 }, { "delete", cmd_subvol_delete, cmd_subvol_delete_usage, NULL, 0 }, { "list", cmd_subvol_list, cmd_subvol_list_usage, NULL, 0 }, - { "snapshot", cmd_snapshot, cmd_snapshot_usage, NULL, 0 }, + { "snapshot", cmd_subvol_snapshot, cmd_subvol_snapshot_usage, + NULL, 0 }, { "get-default", cmd_subvol_get_default, cmd_subvol_get_default_usage, NULL, 0 }, { "set-default", cmd_subvol_set_default, cmd_subvol_set_default_usage, NULL, 0 }, - { "find-new", cmd_find_new, cmd_find_new_usage, NULL, 0 }, + { "find-new", cmd_subvol_find_new, cmd_subvol_find_new_usage, + NULL, 0 }, { "show", cmd_subvol_show, cmd_subvol_show_usage, NULL, 0 }, { "sync", cmd_subvol_sync, cmd_subvol_sync_usage, NULL, 0 }, NULL_CMD_STRUCT -- cgit v1.2.3