From owner-svn-src-stable@freebsd.org Mon Aug 12 17:40:55 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 741ECBAACB; Mon, 12 Aug 2019 17:40:55 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 466jn32Tctz4dc9; Mon, 12 Aug 2019 17:40:55 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 37C3C2161; Mon, 12 Aug 2019 17:40:55 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x7CHetgC016533; Mon, 12 Aug 2019 17:40:55 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x7CHerdg016519; Mon, 12 Aug 2019 17:40:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201908121740.x7CHerdg016519@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 12 Aug 2019 17:40:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r350910 - stable/12/sbin/nvmecontrol X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sbin/nvmecontrol X-SVN-Commit-Revision: 350910 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Aug 2019 17:40:55 -0000 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] \n" + "firmware [-s slot] [-f path_to_firmware] [-a] \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] \n" + "format [-f fmt] [-m mset] [-p pi] [-l pil] [-E] [-C] \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]] \n" + "identify [-x [-v]] \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] \n" \ + "logpage <-p page_id> [-b] [-v vendor] [-x] \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" \ -" \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" \ + " \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]] \n" + "power [-l] [-p new-state [-w workload-hint]] \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 \n" + "reset \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);