svn commit: r350910 - stable/12/sbin/nvmecontrol
Alexander Motin
mav at FreeBSD.org
Mon Aug 12 17:40:55 UTC 2019
Author: mav
Date: Mon Aug 12 17:40:52 2019
New Revision: 350910
URL: https://svnweb.freebsd.org/changeset/base/350910
Log:
MFC r341413 (by imp): Usage cleanup pt 2
Eliminage redundant spaces and nvmecontrol at start of all the usage
strings. Update the usage printing code to add them back when
presenting to the user. Allow multi-line usage messages and print
proper leading spaces for lines starting with a space.
Modified:
stable/12/sbin/nvmecontrol/devlist.c
stable/12/sbin/nvmecontrol/firmware.c
stable/12/sbin/nvmecontrol/format.c
stable/12/sbin/nvmecontrol/identify.c
stable/12/sbin/nvmecontrol/logpage.c
stable/12/sbin/nvmecontrol/ns.c
stable/12/sbin/nvmecontrol/nvmecontrol.c
stable/12/sbin/nvmecontrol/perftest.c
stable/12/sbin/nvmecontrol/power.c
stable/12/sbin/nvmecontrol/reset.c
stable/12/sbin/nvmecontrol/wdc.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sbin/nvmecontrol/devlist.c
==============================================================================
--- stable/12/sbin/nvmecontrol/devlist.c Mon Aug 12 17:40:22 2019 (r350909)
+++ stable/12/sbin/nvmecontrol/devlist.c Mon Aug 12 17:40:52 2019 (r350910)
@@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$");
#include "nvmecontrol.h"
#define DEVLIST_USAGE \
-" nvmecontrol devlist\n"
+ "devlist\n"
static inline uint32_t
ns_get_sector_size(struct nvme_namespace_data *nsdata)
Modified: stable/12/sbin/nvmecontrol/firmware.c
==============================================================================
--- stable/12/sbin/nvmecontrol/firmware.c Mon Aug 12 17:40:22 2019 (r350909)
+++ stable/12/sbin/nvmecontrol/firmware.c Mon Aug 12 17:40:52 2019 (r350910)
@@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$");
#include "nvmecontrol.h"
#define FIRMWARE_USAGE \
-" nvmecontrol firmware [-s slot] [-f path_to_firmware] [-a] <controller id>\n"
+ "firmware [-s slot] [-f path_to_firmware] [-a] <controller id>\n"
static int
slot_has_valid_firmware(int fd, int slot)
Modified: stable/12/sbin/nvmecontrol/format.c
==============================================================================
--- stable/12/sbin/nvmecontrol/format.c Mon Aug 12 17:40:22 2019 (r350909)
+++ stable/12/sbin/nvmecontrol/format.c Mon Aug 12 17:40:52 2019 (r350910)
@@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$");
#include "nvmecontrol.h"
#define FORMAT_USAGE \
-" nvmecontrol format [-f fmt] [-m mset] [-p pi] [-l pil] [-E] [-C] <controller id|namespace id>\n"
+ "format [-f fmt] [-m mset] [-p pi] [-l pil] [-E] [-C] <controller id|namespace id>\n"
static void
format(struct nvme_function *nf, int argc, char *argv[])
Modified: stable/12/sbin/nvmecontrol/identify.c
==============================================================================
--- stable/12/sbin/nvmecontrol/identify.c Mon Aug 12 17:40:22 2019 (r350909)
+++ stable/12/sbin/nvmecontrol/identify.c Mon Aug 12 17:40:52 2019 (r350910)
@@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$");
#include "nvmecontrol_ext.h"
#define IDENTIFY_USAGE \
-" nvmecontrol identify [-x [-v]] <controller id|namespace id>\n"
+ "identify [-x [-v]] <controller id|namespace id>\n"
static void
print_namespace(struct nvme_namespace_data *nsdata)
Modified: stable/12/sbin/nvmecontrol/logpage.c
==============================================================================
--- stable/12/sbin/nvmecontrol/logpage.c Mon Aug 12 17:40:22 2019 (r350909)
+++ stable/12/sbin/nvmecontrol/logpage.c Mon Aug 12 17:40:52 2019 (r350910)
@@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$");
SET_DECLARE(logpage, struct logpage_function);
#define LOGPAGE_USAGE \
-" nvmecontrol logpage <-p page_id> [-b] [-v vendor] [-x] <controller id|namespace id>\n" \
+ "logpage <-p page_id> [-b] [-v vendor] [-x] <controller id|namespace id>\n" \
#define MAX_FW_SLOTS (7)
Modified: stable/12/sbin/nvmecontrol/ns.c
==============================================================================
--- stable/12/sbin/nvmecontrol/ns.c Mon Aug 12 17:40:22 2019 (r350909)
+++ stable/12/sbin/nvmecontrol/ns.c Mon Aug 12 17:40:52 2019 (r350910)
@@ -43,22 +43,22 @@ __FBSDID("$FreeBSD$");
SET_DECLARE(ns, struct nvme_function);
-#define NS_USAGE \
-" nvmecontrol ns (create|delete|attach|detach)\n"
+#define NS_USAGE \
+ "ns (create|delete|attach|detach)\n"
/* handles NVME_OPC_NAMESPACE_MANAGEMENT and ATTACHMENT admin cmds */
#define NSCREATE_USAGE \
-" nvmecontrol ns create -s size [-c cap] [-f fmt] [-m mset] [-n nmic] [-p pi] [-l pil] nvmeN\n"
+ "ns create -s size [-c cap] [-f fmt] [-m mset] [-n nmic] [-p pi] [-l pil] nvmeN\n"
#define NSDELETE_USAGE \
-" nvmecontrol ns delete -n nsid nvmeN\n"
+ "ns delete -n nsid nvmeN\n"
#define NSATTACH_USAGE \
-" nvmecontrol ns attach -n nsid [-c ctrlrid] nvmeN \n"
+ "ns attach -n nsid [-c ctrlrid] nvmeN \n"
#define NSDETACH_USAGE \
-" nvmecontrol ns detach -n nsid [-c ctrlrid] nvmeN\n"
+ "ns detach -n nsid [-c ctrlrid] nvmeN\n"
void nscreate(struct nvme_function *nf, int argc, char *argv[]);
void nsdelete(struct nvme_function *nf, int argc, char *argv[]);
Modified: stable/12/sbin/nvmecontrol/nvmecontrol.c
==============================================================================
--- stable/12/sbin/nvmecontrol/nvmecontrol.c Mon Aug 12 17:40:22 2019 (r350909)
+++ stable/12/sbin/nvmecontrol/nvmecontrol.c Mon Aug 12 17:40:52 2019 (r350910)
@@ -52,7 +52,24 @@ SET_DECLARE(top, struct nvme_function);
static void
print_usage(const struct nvme_function *f)
{
- fprintf(stderr, "%s", f->usage);
+ const char *cp;
+ char ch;
+ bool need_prefix = true;
+
+ cp = f->usage;
+ while (*cp) {
+ ch = *cp++;
+ if (need_prefix) {
+ if (ch != ' ')
+ fputs(" nvmecontrol ", stderr);
+ else
+ fputs(" ", stderr);
+ }
+ fputc(ch, stderr);
+ need_prefix = (ch == '\n');
+ }
+ if (!need_prefix)
+ fputc('\n', stderr);
}
static void
Modified: stable/12/sbin/nvmecontrol/perftest.c
==============================================================================
--- stable/12/sbin/nvmecontrol/perftest.c Mon Aug 12 17:40:22 2019 (r350909)
+++ stable/12/sbin/nvmecontrol/perftest.c Mon Aug 12 17:40:52 2019 (r350910)
@@ -46,10 +46,10 @@ __FBSDID("$FreeBSD$");
#include "nvmecontrol.h"
#define PERFTEST_USAGE \
-" nvmecontrol perftest <-n num_threads> <-o read|write>\n" \
-" <-s size_in_bytes> <-t time_in_seconds>\n" \
-" <-i intr|wait> [-f refthread] [-p]\n" \
-" <namespace id>\n"
+ "perftest <-n num_threads> <-o read|write>\n" \
+ " <-s size_in_bytes> <-t time_in_seconds>\n" \
+ " <-i intr|wait> [-f refthread] [-p]\n" \
+ " <namespace id>\n"
static void
print_perftest(struct nvme_io_test *io_test, bool perthread)
Modified: stable/12/sbin/nvmecontrol/power.c
==============================================================================
--- stable/12/sbin/nvmecontrol/power.c Mon Aug 12 17:40:22 2019 (r350909)
+++ stable/12/sbin/nvmecontrol/power.c Mon Aug 12 17:40:52 2019 (r350910)
@@ -45,7 +45,7 @@ _Static_assert(sizeof(struct nvme_power_state) == 256
"nvme_power_state size wrong");
#define POWER_USAGE \
-" nvmecontrol power [-l] [-p new-state [-w workload-hint]] <controller id>\n"
+ "power [-l] [-p new-state [-w workload-hint]] <controller id>\n"
static void
power_list_one(int i, struct nvme_power_state *nps)
Modified: stable/12/sbin/nvmecontrol/reset.c
==============================================================================
--- stable/12/sbin/nvmecontrol/reset.c Mon Aug 12 17:40:22 2019 (r350909)
+++ stable/12/sbin/nvmecontrol/reset.c Mon Aug 12 17:40:52 2019 (r350910)
@@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$");
#include "nvmecontrol.h"
#define RESET_USAGE \
-" nvmecontrol reset <controller id>\n"
+ "reset <controller id>\n"
static void
reset(struct nvme_function *nf, int argc, char *argv[])
Modified: stable/12/sbin/nvmecontrol/wdc.c
==============================================================================
--- stable/12/sbin/nvmecontrol/wdc.c Mon Aug 12 17:40:22 2019 (r350909)
+++ stable/12/sbin/nvmecontrol/wdc.c Mon Aug 12 17:40:52 2019 (r350910)
@@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$");
#include "nvmecontrol.h"
#define WDC_USAGE \
-" nvmecontrol wdc (cap-diag|drive-log|get-crash-dump|purge|purge-montior)\n"
+ "wdc (cap-diag)\n"
SET_DECLARE(wdc, struct nvme_function);
@@ -54,7 +54,7 @@ SET_DECLARE(wdc, struct nvme_function);
static void wdc_cap_diag(struct nvme_function *nf, int argc, char *argv[]);
-#define WDC_CAP_DIAG_USAGE "\tnvmecontrol wdc cap-diag [-o path-template]\n"
+#define WDC_CAP_DIAG_USAGE "wdc cap-diag [-o path-template]\n"
NVME_COMMAND(wdc, cap-diag, wdc_cap_diag, WDC_CAP_DIAG_USAGE);
More information about the svn-src-stable
mailing list