Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: mlin@kernel.org (Ming Lin)
Subject: [PATCH nvme-cli] print friendly name for trtype and adrfam
Date: Tue, 07 Jun 2016 14:33:20 -0700	[thread overview]
Message-ID: <1465335200-32354-1-git-send-email-mlin@kernel.org> (raw)

From: Ming Lin <ming.l@samsung.com>

Without this patch:
=====Discovery Log Entry 0======
trtype:  1
adrfam:  1

With this patch:
=====Discovery Log Entry 0======
trtype:  ipv4
adrfam:  rdma

Signed-off-by: Ming Lin <ming.l at samsung.com>
---
 fabrics.c | 38 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 36 insertions(+), 2 deletions(-)

diff --git a/fabrics.c b/fabrics.c
index c643598..d30bef2 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -271,8 +271,42 @@ static void print_discovery_log(struct nvmf_disc_rsp_page_hdr *log, int numrec)
 		struct nvmf_disc_rsp_page_entry *e = &log->entries[i];
 
 		printf("=====Discovery Log Entry %d======\n", i);
-		printf("trtype:  %d\n", e->trtype);
-		printf("adrfam:  %d\n", e->adrfam);
+
+		printf("trtype:  ");
+		switch(e->trtype) {
+		case NVMF_ADDR_FAMILY_IP4:
+			printf("ipv4\n");
+			break;
+		case NVMF_ADDR_FAMILY_IP6:
+			printf("ipv6\n");
+			break;
+		case NVMF_ADDR_FAMILY_IB:
+			printf("ib\n");
+			break;
+		case NVMF_ADDR_FAMILY_FC:
+			printf("fc\n");
+			break;
+		default:
+			printf("unknown\n");
+			break;
+		}
+
+		printf("adrfam:  ");
+		switch(e->adrfam) {
+		case NVMF_TRTYPE_RDMA:
+			printf("rdma\n");
+			break;
+		case NVMF_TRTYPE_FC:
+			printf("fc\n");
+			break;
+		case NVMF_TRTYPE_LOOP:
+			printf("loop\n");
+			break;
+		default:
+			printf("unknown\n");
+			break;
+		}
+
 		printf("nqntype: %d\n", e->nqntype);
 		printf("treq:    %d\n", e->treq);
 		printf("portid:  %d\n", e->portid);
-- 
1.9.1

             reply	other threads:[~2016-06-07 21:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-07 21:33 Ming Lin [this message]
2016-06-07 21:50 ` [PATCH nvme-cli] print friendly name for trtype and adrfam Keith Busch
2016-06-07 21:52   ` Minturn, Dave B
2016-06-07 21:58     ` Ming Lin
2016-06-07 22:08       ` Keith Busch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1465335200-32354-1-git-send-email-mlin@kernel.org \
    --to=mlin@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox