Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Nov 2020 14:13:30 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r367330 - stable/12/sbin/nvmecontrol
Message-ID:  <202011041413.0A4EDUt0017268@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Wed Nov  4 14:13:29 2020
New Revision: 367330
URL: https://svnweb.freebsd.org/changeset/base/367330

Log:
  MFC r367112: 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.

Modified:
  stable/12/sbin/nvmecontrol/ns.c
  stable/12/sbin/nvmecontrol/passthru.c
  stable/12/sbin/nvmecontrol/reset.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/nvmecontrol/ns.c
==============================================================================
--- stable/12/sbin/nvmecontrol/ns.c	Wed Nov  4 14:12:29 2020	(r367329)
+++ stable/12/sbin/nvmecontrol/ns.c	Wed Nov  4 14:13:29 2020	(r367330)
@@ -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: stable/12/sbin/nvmecontrol/passthru.c
==============================================================================
--- stable/12/sbin/nvmecontrol/passthru.c	Wed Nov  4 14:12:29 2020	(r367329)
+++ stable/12/sbin/nvmecontrol/passthru.c	Wed Nov  4 14:13:29 2020	(r367330)
@@ -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: stable/12/sbin/nvmecontrol/reset.c
==============================================================================
--- stable/12/sbin/nvmecontrol/reset.c	Wed Nov  4 14:12:29 2020	(r367329)
+++ stable/12/sbin/nvmecontrol/reset.c	Wed Nov  4 14:13:29 2020	(r367330)
@@ -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?202011041413.0A4EDUt0017268>