Author: mav
Date: Wed Oct 28 17:28:48 2020
New Revision: 367112
URL: https://svnweb.freebsd.org/changeset/base/367112

Log:
  Use proper variable for device path.
  
  It seems *-passthru commands were broken from the day one, since the
  device path is fetched into opt.dev variable and not left in argv[optind].
  The other three wrong argv[optind] instances are just in error messages.
  
  MFC after:    1 week
  Sponsored by: iXsystems, Inc.

Modified:
  head/sbin/nvmecontrol/ns.c
  head/sbin/nvmecontrol/passthru.c
  head/sbin/nvmecontrol/reset.c

Modified: head/sbin/nvmecontrol/ns.c
==============================================================================
--- head/sbin/nvmecontrol/ns.c  Wed Oct 28 17:03:03 2020        (r367111)
+++ head/sbin/nvmecontrol/ns.c  Wed Oct 28 17:28:48 2020        (r367112)
@@ -605,7 +605,7 @@ nscreate(const struct cmd *f, int argc, char *argv[])
        pt.len = sizeof(struct nvme_namespace_data);
        pt.is_read = 0; /* passthrough writes data to ctrlr */
        if ((result = ioctl(fd, NVME_PASSTHROUGH_CMD, &pt)) < 0)
-               errx(1, "ioctl request to %s failed: %d", argv[optind], result);
+               errx(1, "ioctl request to %s failed: %d", create_opt.dev, 
result);
 
        if (nvme_completion_is_error(&pt.cpl)) {
                errx(1, "namespace creation failed: %s",
@@ -822,7 +822,7 @@ nsdetach(const struct cmd *f, int argc, char *argv[])
        pt.len = sizeof(clist);
 
        if ((result = ioctl(fd, NVME_PASSTHROUGH_CMD, &pt)) < 0)
-               errx(1, "ioctl request to %s failed: %d", argv[optind], result);
+               errx(1, "ioctl request to %s failed: %d", detach_opt.dev, 
result);
 
        if (nvme_completion_is_error(&pt.cpl)) {
                errx(1, "namespace detach failed: %s",

Modified: head/sbin/nvmecontrol/passthru.c
==============================================================================
--- head/sbin/nvmecontrol/passthru.c    Wed Oct 28 17:03:03 2020        
(r367111)
+++ head/sbin/nvmecontrol/passthru.c    Wed Oct 28 17:28:48 2020        
(r367112)
@@ -164,7 +164,7 @@ passthru(const struct cmd *f, int argc, char *argv[])
 
        if (arg_parse(argc, argv, f))
                return;
-       open_dev(argv[optind], &fd, 1, 1);
+       open_dev(opt.dev, &fd, 1, 1);
 
        if (opt.read && opt.write)
                errx(1, "need exactly one of --read or --write");

Modified: head/sbin/nvmecontrol/reset.c
==============================================================================
--- head/sbin/nvmecontrol/reset.c       Wed Oct 28 17:03:03 2020        
(r367111)
+++ head/sbin/nvmecontrol/reset.c       Wed Oct 28 17:28:48 2020        
(r367112)
@@ -70,7 +70,7 @@ reset(const struct cmd *f, int argc, char *argv[])
        free(path);
 
        if (ioctl(fd, NVME_RESET_CONTROLLER) < 0)
-               err(1, "reset request to %s failed", argv[optind]);
+               err(1, "reset request to %s failed", opt.dev);
 
        exit(0);
 }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to