From: Jon Derrick Date: Wed, 28 Jun 2017 19:15:07 +0000 (-0600) Subject: Show help for nvme reset and subsystem-reset X-Git-Tag: v1.4~35^2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=4b88f282abe98e0eb0ed86e6c3a9edf9025a0037;p=users%2Fsagi%2Fnvme-cli.git Show help for nvme reset and subsystem-reset Remove unused clear_args() Signed-off-by: Jon Derrick --- diff --git a/nvme.c b/nvme.c index 62ddd17f..099302a5 100644 --- a/nvme.c +++ b/nvme.c @@ -1390,20 +1390,19 @@ static int fw_activate(int argc, char **argv, struct command *cmd, struct plugin return err; } -static int clear_args(int argc, char **argv) -{ - int opt, long_index; - - while ((opt = getopt_long(argc, (char **)argv, "", NULL, - &long_index)) != -1); - return get_dev(argc, argv); -} - static int subsystem_reset(int argc, char **argv, struct command *cmd, struct plugin *plugin) { + const char *desc = "Resets the NVMe subsystem\n"; int err, fd; - fd = clear_args(argc, argv); + const struct argconfig_commandline_options command_line_options[] = { + {NULL} + }; + + fd = parse_and_open(argc, argv, desc, command_line_options, NULL, 0); + if (fd < 0) + return fd; + err = nvme_subsystem_reset(fd); if (err < 0) { perror("Subsystem-reset"); @@ -1414,9 +1413,17 @@ static int subsystem_reset(int argc, char **argv, struct command *cmd, struct pl static int reset(int argc, char **argv, struct command *cmd, struct plugin *plugin) { + const char *desc = "Resets the NVMe controller\n"; int err, fd; - fd = clear_args(argc, argv); + const struct argconfig_commandline_options command_line_options[] = { + {NULL} + }; + + fd = parse_and_open(argc, argv, desc, command_line_options, NULL, 0); + if (fd < 0) + return fd; + err = nvme_reset_controller(fd); if (err < 0) { perror("Reset");