Skip to content

Commit c90d3d7

Browse files
martin-gpyigaw
authored andcommitted
nvme-print: print more details in ns-descs verbose output
Print additional details such as loc, nidt, nidl & type in the ns-descs verbose output for parity with the corresponding json output. Signed-off-by: Martin George <marting@netapp.com>
1 parent 7c22f11 commit c90d3d7

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

nvme-print-stdout.c

+15-1
Original file line numberDiff line numberDiff line change
@@ -2714,7 +2714,7 @@ static void stdout_cmd_set_independent_id_ns(struct nvme_id_independent_id_ns *n
27142714
static void stdout_id_ns_descs(void *data, unsigned int nsid)
27152715
{
27162716
int pos, len = 0;
2717-
int i;
2717+
int i, verbose = stdout_print_ops.flags & VERBOSE;
27182718
__u8 uuid[NVME_UUID_LEN];
27192719
char uuid_str[NVME_UUID_LEN_STRING];
27202720
__u8 eui64[8];
@@ -2728,9 +2728,17 @@ static void stdout_id_ns_descs(void *data, unsigned int nsid)
27282728
if (cur->nidl == 0)
27292729
break;
27302730

2731+
if (verbose) {
2732+
printf("loc : %d\n", pos);
2733+
printf("nidt : %d\n", (int)cur->nidt);
2734+
printf("nidl : %d\n", (int)cur->nidl);
2735+
}
2736+
27312737
switch (cur->nidt) {
27322738
case NVME_NIDT_EUI64:
27332739
memcpy(eui64, data + pos + sizeof(*cur), sizeof(eui64));
2740+
if (verbose)
2741+
printf("type : eui64\n");
27342742
printf("eui64 : ");
27352743
for (i = 0; i < 8; i++)
27362744
printf("%02x", eui64[i]);
@@ -2739,6 +2747,8 @@ static void stdout_id_ns_descs(void *data, unsigned int nsid)
27392747
break;
27402748
case NVME_NIDT_NGUID:
27412749
memcpy(nguid, data + pos + sizeof(*cur), sizeof(nguid));
2750+
if (verbose)
2751+
printf("type : nguid\n");
27422752
printf("nguid : ");
27432753
for (i = 0; i < 16; i++)
27442754
printf("%02x", nguid[i]);
@@ -2748,11 +2758,15 @@ static void stdout_id_ns_descs(void *data, unsigned int nsid)
27482758
case NVME_NIDT_UUID:
27492759
memcpy(uuid, data + pos + sizeof(*cur), 16);
27502760
nvme_uuid_to_string(uuid, uuid_str);
2761+
if (verbose)
2762+
printf("type : uuid\n");
27512763
printf("uuid : %s\n", uuid_str);
27522764
len = sizeof(uuid);
27532765
break;
27542766
case NVME_NIDT_CSI:
27552767
memcpy(&csi, data + pos + sizeof(*cur), 1);
2768+
if (verbose)
2769+
printf("type : csi\n");
27562770
printf("csi : %#x\n", csi);
27572771
len += sizeof(csi);
27582772
break;

nvme.c

+3
Original file line numberDiff line numberDiff line change
@@ -3615,6 +3615,9 @@ static int ns_descs(int argc, char **argv, struct command *cmd, struct plugin *p
36153615
if (cfg.raw_binary)
36163616
flags = BINARY;
36173617

3618+
if (argconfig_parse_seen(opts, "verbose"))
3619+
flags |= VERBOSE;
3620+
36183621
if (!cfg.namespace_id) {
36193622
err = nvme_get_nsid(dev_fd(dev), &cfg.namespace_id);
36203623
if (err < 0) {

0 commit comments

Comments
 (0)