Changeset View
Changeset View
Standalone View
Standalone View
head/sbin/nvmecontrol/reset.c
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | static const struct args args[] = { | ||||
{ arg_none, NULL, NULL }, | { arg_none, NULL, NULL }, | ||||
}; | }; | ||||
static void | static void | ||||
reset(const struct cmd *f, int argc, char *argv[]) | reset(const struct cmd *f, int argc, char *argv[]) | ||||
{ | { | ||||
int fd; | int fd; | ||||
arg_parse(argc, argv, f); | if (arg_parse(argc, argv, f)) | ||||
return; | |||||
open_dev(opt.dev, &fd, 1, 1); | open_dev(opt.dev, &fd, 1, 1); | ||||
if (ioctl(fd, NVME_RESET_CONTROLLER) < 0) | if (ioctl(fd, NVME_RESET_CONTROLLER) < 0) | ||||
err(1, "reset request to %s failed", argv[optind]); | err(1, "reset request to %s failed", argv[optind]); | ||||
exit(0); | exit(0); | ||||
} | } | ||||
static struct cmd reset_cmd = { | static struct cmd reset_cmd = { | ||||
.name = "reset", | .name = "reset", | ||||
.fn = reset, | .fn = reset, | ||||
.descr = "Perform a controller-level reset", | .descr = "Perform a controller-level reset", | ||||
.args = args, | .args = args, | ||||
}; | }; | ||||
CMD_COMMAND(reset_cmd); | CMD_COMMAND(reset_cmd); |