Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Oct 2020 17:28:48 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r367112 - head/sbin/nvmecontrol
Message-ID:  <202010281728.09SHSmPc002222@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202010281728.09SHSmPc002222>