Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Jun 2013 22:53:21 +0000 (UTC)
From:      Jim Harris <jimharris@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r252264 - head/sbin/nvmecontrol
Message-ID:  <201306262253.r5QMrLXh094655@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jimharris
Date: Wed Jun 26 22:53:21 2013
New Revision: 252264
URL: http://svnweb.freebsd.org/changeset/base/252264

Log:
  Add separate *_usage() functions for each nvmecontrol command.
  
  Sponsored by:	Intel
  MFC after:	3 days

Modified:
  head/sbin/nvmecontrol/nvmecontrol.c

Modified: head/sbin/nvmecontrol/nvmecontrol.c
==============================================================================
--- head/sbin/nvmecontrol/nvmecontrol.c	Wed Jun 26 22:50:49 2013	(r252263)
+++ head/sbin/nvmecontrol/nvmecontrol.c	Wed Jun 26 22:53:21 2013	(r252264)
@@ -289,6 +289,14 @@ open_dev(const char *str, int *fd, int s
 }
 
 static void
+devlist_usage(void)
+{
+	fprintf(stderr, "usage:\n");
+	fprintf(stderr, DEVLIST_USAGE);
+	exit(EX_USAGE);
+}
+
+static void
 devlist(int argc, char *argv[])
 {
 	struct nvme_controller_data	cdata;
@@ -302,7 +310,7 @@ devlist(int argc, char *argv[])
 	while ((ch = getopt(argc, argv, "")) != -1) {
 		switch ((char)ch) {
 		default:
-			usage();
+			devlist_usage();
 		}
 	}
 
@@ -347,6 +355,14 @@ devlist(int argc, char *argv[])
 }
 
 static void
+identify_usage(void)
+{
+	fprintf(stderr, "usage:\n");
+	fprintf(stderr, IDENTIFY_USAGE);
+	exit(EX_USAGE);
+}
+
+static void
 identify_ctrlr(int argc, char *argv[])
 {
 	struct nvme_controller_data	cdata;
@@ -362,7 +378,7 @@ identify_ctrlr(int argc, char *argv[])
 			hexflag = 1;
 			break;
 		default:
-			usage();
+			identify_usage();
 		}
 	}
 
@@ -382,7 +398,7 @@ identify_ctrlr(int argc, char *argv[])
 
 	if (verboseflag == 1) {
 		printf("-v not currently supported without -x.\n");
-		usage();
+		identify_usage();
 	}
 
 	print_controller(&cdata);
@@ -407,7 +423,7 @@ identify_ns(int argc, char *argv[])
 			hexflag = 1;
 			break;
 		default:
-			usage();
+			identify_usage();
 		}
 	}
 
@@ -454,7 +470,7 @@ identify_ns(int argc, char *argv[])
 
 	if (verboseflag == 1) {
 		printf("-v not currently supported without -x.\n");
-		usage();
+		identify_usage();
 	}
 
 	print_namespace(&nsdata);
@@ -467,7 +483,7 @@ identify(int argc, char *argv[])
 	char	*target;
 
 	if (argc < 2)
-		usage();
+		identify_usage();
 
 	while (getopt(argc, argv, "vx") != -1) ;
 
@@ -624,6 +640,14 @@ perftest(int argc, char *argv[])
 }
 
 static void
+reset_usage(void)
+{
+	fprintf(stderr, "usage:\n");
+	fprintf(stderr, RESET_USAGE);
+	exit(EX_USAGE);
+}
+
+static void
 reset_ctrlr(int argc, char *argv[])
 {
 	int	ch, fd;
@@ -631,7 +655,7 @@ reset_ctrlr(int argc, char *argv[])
 	while ((ch = getopt(argc, argv, "")) != -1) {
 		switch ((char)ch) {
 		default:
-			usage();
+			reset_usage();
 		}
 	}
 



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