linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: hch@lst.de (Christoph Hellwig)
Subject: [PATCH 13/18] add missing endianess conversions in json_nvme_id_ns
Date: Thu, 22 Sep 2016 20:23:04 -0700	[thread overview]
Message-ID: <1474600989-16657-14-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1474600989-16657-1-git-send-email-hch@lst.de>

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 nvme-print.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/nvme-print.c b/nvme-print.c
index 95afdf9..5320951 100644
--- a/nvme-print.c
+++ b/nvme-print.c
@@ -1131,9 +1131,9 @@ void json_nvme_id_ns(struct nvme_id_ns *ns, unsigned int mode)
 
 	root = json_create_object();
 
-	json_object_add_value_int(root, "nsze", ns->nsze);
-	json_object_add_value_int(root, "ncap", ns->ncap);
-	json_object_add_value_int(root, "nuse", ns->nuse);
+	json_object_add_value_int(root, "nsze", le64_to_cpu(ns->nsze));
+	json_object_add_value_int(root, "ncap", le64_to_cpu(ns->ncap));
+	json_object_add_value_int(root, "nuse", le64_to_cpu(ns->nuse));
 	json_object_add_value_int(root, "nsfeat", ns->nsfeat);
 	json_object_add_value_int(root, "nlbaf", ns->nlbaf);
 	json_object_add_value_int(root, "flbas", ns->flbas);
@@ -1143,12 +1143,12 @@ void json_nvme_id_ns(struct nvme_id_ns *ns, unsigned int mode)
 	json_object_add_value_int(root, "nmic", ns->nmic);
 	json_object_add_value_int(root, "rescap", ns->rescap);
 	json_object_add_value_int(root, "fpi", ns->fpi);
-	json_object_add_value_int(root, "nawun", ns->nawun);
-	json_object_add_value_int(root, "nawupf", ns->nawupf);
-	json_object_add_value_int(root, "nacwu", ns->nacwu);
-	json_object_add_value_int(root, "nabsn", ns->nabsn);
-	json_object_add_value_int(root, "nabo", ns->nabo);
-	json_object_add_value_int(root, "nabspf", ns->nabspf);
+	json_object_add_value_int(root, "nawun", le16_to_cpu(ns->nawun));
+	json_object_add_value_int(root, "nawupf", le16_to_cpu(ns->nawupf));
+	json_object_add_value_int(root, "nacwu", le16_to_cpu(ns->nacwu));
+	json_object_add_value_int(root, "nabsn", le16_to_cpu(ns->nabsn));
+	json_object_add_value_int(root, "nabo", le16_to_cpu(ns->nabo));
+	json_object_add_value_int(root, "nabspf", le16_to_cpu(ns->nabspf));
 	json_object_add_value_float(root, "nvmcap", nvmcap);
 
 	memset(eui64, 0, sizeof(eui64_buf));
@@ -1168,9 +1168,9 @@ void json_nvme_id_ns(struct nvme_id_ns *ns, unsigned int mode)
 	for (i = 0; i <= ns->nlbaf; i++) {
 		struct json_object *lbaf = json_create_object();
 
-		json_object_add_value_int(lbaf, "ms", ns->lbaf[i].ms);
-		json_object_add_value_int(lbaf, "ds", ns->lbaf[i].ds);
-		json_object_add_value_int(lbaf, "rp", ns->lbaf[i].rp);
+		json_object_add_value_int(lbaf, "ms", le16_to_cpu(ns->lbaf[i].ms));
+		json_object_add_value_int(lbaf, "ds", le16_to_cpu(ns->lbaf[i].ds));
+		json_object_add_value_int(lbaf, "rp", le16_to_cpu(ns->lbaf[i].rp));
 
 		json_array_add_value_object(lbafs, lbaf);
 	}
-- 
2.1.4

  parent reply	other threads:[~2016-09-23  3:23 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-23  3:22 nvme-cli: add endianess annotations Christoph Hellwig
2016-09-23  3:22 ` [PATCH 01/18] import linux/nvme.h Christoph Hellwig
2016-09-23 20:53   ` Sagi Grimberg
2016-09-23  3:22 ` [PATCH 02/18] fix linux/nvme.h for use with nvme-cli Christoph Hellwig
2016-09-23  3:22 ` [PATCH 03/18] use nvme.h from Linux Christoph Hellwig
2016-09-23  3:22 ` [PATCH 04/18] dynamically allocate log page buffers Christoph Hellwig
2016-09-23  3:22 ` [PATCH 05/18] use abort() instead of __builtin_abort Christoph Hellwig
2016-09-23  3:22 ` [PATCH 06/18] various trivial sparse fixes Christoph Hellwig
2016-09-23  3:22 ` [PATCH 07/18] add support for checking endianess annotations using sparse Christoph Hellwig
2016-09-23  3:22 ` [PATCH 08/18] add missing endianess annoations for lightnvm data structures Christoph Hellwig
2016-09-23  3:23 ` [PATCH 09/18] fabrics: use correct endianess helper in print_discovery_log Christoph Hellwig
2016-09-23  3:23 ` [PATCH 10/18] intel: use correct endianess helpers in show_temp_stats Christoph Hellwig
2016-09-23  3:23 ` [PATCH 11/18] fix num_ctrls endianess in nvme_ns_attachment Christoph Hellwig
2016-09-23  3:23 ` [PATCH 12/18] add missing endianess conversions in print_list_item Christoph Hellwig
2016-09-23  3:23 ` Christoph Hellwig [this message]
2016-09-23  3:23 ` [PATCH 14/18] add missing endianess conversions in json_nvme_id_ctrl Christoph Hellwig
2016-09-23  3:23 ` [PATCH 15/18] add missing endianess conversions in json_smart_log Christoph Hellwig
2016-09-23  3:23 ` [PATCH 16/18] add missing endianess conversions in __lnvm_do_get_bbtbl Christoph Hellwig
2016-09-23  3:23 ` [PATCH 17/18] add missing endianess conversions in __lnvm_do_set_bbtbl Christoph Hellwig
2016-09-23  3:23 ` [PATCH 18/18] add missing endianess conversions in lnvm_do_set_bbtbl Christoph Hellwig
2016-09-23 14:45 ` nvme-cli: add endianess annotations 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=1474600989-16657-14-git-send-email-hch@lst.de \
    --to=hch@lst.de \
    /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;
as well as URLs for NNTP newsgroup(s).