examples/nvme/identify: clean up arguments
- Make the usage columns line up - Fix the wording of the usage messages - Fix the getopt() string for -x, which has no argument - Use the default discovery NQN if none specified - Use the nvmf_spec.h #define for max NQN length Change-Id: I88608ead57d1bee46738ba05dc2074230d22be0d Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
1910c552f7
commit
b3e46acfe9
@ -45,6 +45,7 @@
|
|||||||
#include "spdk/nvme.h"
|
#include "spdk/nvme.h"
|
||||||
#include "spdk/env.h"
|
#include "spdk/env.h"
|
||||||
#include "spdk/nvme_intel.h"
|
#include "spdk/nvme_intel.h"
|
||||||
|
#include "spdk/nvmf_spec.h"
|
||||||
#include "spdk/pci_ids.h"
|
#include "spdk/pci_ids.h"
|
||||||
|
|
||||||
static int outstanding_commands;
|
static int outstanding_commands;
|
||||||
@ -849,16 +850,16 @@ usage(const char *program_name)
|
|||||||
{
|
{
|
||||||
printf("%s [options]", program_name);
|
printf("%s [options]", program_name);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("\t-x print hex dump of raw data\n");
|
|
||||||
printf("options:\n");
|
printf("options:\n");
|
||||||
printf("\t-a addr address for nvmf target\n");
|
printf(" -a addr address of NVMe over Fabrics discovery service\n");
|
||||||
printf("\t-s service service id for nvmf target\n");
|
printf(" -s service service ID for NVMe over Fabrics discovery service\n");
|
||||||
printf("\t-n nqn nqn for nvmf target\n");
|
printf(" -n nqn NQN of NVMe over Fabrics discovery service\n");
|
||||||
|
|
||||||
spdk_tracelog_usage(stdout, "-t");
|
spdk_tracelog_usage(stdout, "-t");
|
||||||
|
|
||||||
printf("\t-v - verbose (enable warnings)\n");
|
printf(" -x print hex dump of raw data\n");
|
||||||
printf("\t-H - show this usage\n");
|
printf(" -v verbose (enable warnings)\n");
|
||||||
|
printf(" -H show this usage\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -866,7 +867,9 @@ parse_args(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int op, rc;
|
int op, rc;
|
||||||
|
|
||||||
while ((op = getopt(argc, argv, "a:n:s:t:x:H")) != -1) {
|
info.nqn = SPDK_NVMF_DISCOVERY_NQN;
|
||||||
|
|
||||||
|
while ((op = getopt(argc, argv, "a:n:s:t:xH")) != -1) {
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case 'x':
|
case 'x':
|
||||||
g_hex_dump = true;
|
g_hex_dump = true;
|
||||||
@ -910,8 +913,8 @@ parse_args(int argc, char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((strlen(info.nqn) > 223)) {
|
if (strlen(info.nqn) >= SPDK_NVMF_NQN_MAX_LEN) {
|
||||||
printf("The string len of nqn should <= 223\n");
|
printf("NQN must be less than %d bytes long\n", SPDK_NVMF_NQN_MAX_LEN);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -950,7 +953,6 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
rc = parse_args(argc, argv);
|
rc = parse_args(argc, argv);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
printf("parse_args error\n");
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user