return !!ret;
}
-static const char * const cmd_rm_dev_usage[] = {
- "btrfs device delete <device> [<device>...] <path>",
- "Remove a device from a filesystem",
- NULL
-};
-
-static int cmd_rm_dev(int argc, char **argv)
+static int _cmd_rm_dev(int argc, char **argv, const char * const *usagestr)
{
char *mntpnt;
int i, fdmnt, ret=0, e;
DIR *dirstream = NULL;
if (check_argc_min(argc, 3))
- usage(cmd_rm_dev_usage);
+ usage(usagestr);
mntpnt = argv[argc - 1];
return !!ret;
}
+static const char * const cmd_rm_dev_usage[] = {
+ "btrfs device remove <device> [<device>...] <path>",
+ "Remove a device from a filesystem",
+ NULL
+};
+
+static int cmd_rm_dev(int argc, char **argv)
+{
+ return _cmd_rm_dev(argc, argv, cmd_rm_dev_usage);
+}
+
+static const char * const cmd_del_dev_usage[] = {
+ "btrfs device delete <device> [<device>...] <path>",
+ "Remove a device from a filesystem",
+ NULL
+};
+
+static int cmd_del_dev(int argc, char **argv)
+{
+ return _cmd_rm_dev(argc, argv, cmd_del_dev_usage);
+}
+
static const char * const cmd_scan_dev_usage[] = {
"btrfs device scan [(-d|--all-devices)|<device> [<device>...]]",
"Scan devices for a btrfs filesystem",
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_rm_dev, cmd_rm_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 },
static int usage_command_internal(const char * const *usagestr,
const char *token, int full, int lst,
- FILE *outf)
+ int alias, FILE *outf)
{
- unsigned int flags = USAGE_SHORT;
+ unsigned int flags = 0;
int ret;
+ if (!alias)
+ flags |= USAGE_SHORT;
if (full)
flags |= USAGE_LONG | USAGE_OPTIONS;
if (lst)
FILE *outf = err ? stderr : stdout;
int ret;
- ret = usage_command_internal(usagestr, token, full, 0, outf);
+ ret = usage_command_internal(usagestr, token, full, 0, 0, outf);
if (!ret)
fputc('\n', outf);
}
}
usage_command_internal(cmd->usagestr, cmd->token, full,
- 1, outf);
+ 1, cmd->flags & CMD_ALIAS, outf);
continue;
}