All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver O'Halloran <oohall@gmail.com>
To: linux-nvdimm@lists.01.org
Subject: [PATCH v3 5/6] ndctl: Add alignment to the namespace JSON output
Date: Wed, 16 Jan 2019 20:49:08 +1100	[thread overview]
Message-ID: <20190116094909.23112-5-oohall@gmail.com> (raw)
In-Reply-To: <20190116094909.23112-1-oohall@gmail.com>

Automated tooling probably wants to know this and it's helpful output
for command line users for ndctl.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 util/json.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/util/json.c b/util/json.c
index 5c3424e2a707..77c96fb53c27 100644
--- a/util/json.c
+++ b/util/json.c
@@ -753,6 +753,7 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
 	struct ndctl_btt *btt;
 	struct ndctl_pfn *pfn;
 	struct ndctl_dax *dax;
+	unsigned long align = 0;
 	char buf[40];
 	uuid_t uuid;
 	int numa;
@@ -825,6 +826,7 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
 		util_raw_uuid_to_json(ndns, flags, jndns);
 		bdev = ndctl_btt_get_block_device(btt);
 	} else if (pfn) {
+		align = ndctl_pfn_get_align(pfn);
 		ndctl_pfn_get_uuid(pfn, uuid);
 		uuid_unparse(uuid, buf);
 		jobj = json_object_new_string(buf);
@@ -837,6 +839,7 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
 		struct daxctl_region *dax_region;
 
 		dax_region = ndctl_dax_get_daxctl_region(dax);
+		align = ndctl_dax_get_align(dax);
 		ndctl_dax_get_uuid(dax, uuid);
 		uuid_unparse(uuid, buf);
 		jobj = json_object_new_string(buf);
@@ -897,6 +900,13 @@ struct json_object *util_namespace_to_json(struct ndctl_namespace *ndns,
 		json_object_object_add(jndns, "sector_size", jobj);
 	}
 
+	if (align) {
+		jobj = json_object_new_int64(align);
+		if (!jobj)
+			goto err;
+		json_object_object_add(jndns, "align", jobj);
+	}
+
 	if (bdev && bdev[0]) {
 		jobj = json_object_new_string(bdev);
 		if (!jobj)
-- 
2.20.1

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  parent reply	other threads:[~2019-01-16  9:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-16  9:49 [PATCH v3 1/6] libndctl: Use the supported_alignment attribute Oliver O'Halloran
2019-01-16  9:49 ` [PATCH v3 2/6] ndctl/namespace: Check for seed namespaces earlier Oliver O'Halloran
2019-01-16  9:49 ` [PATCH v3 3/6] ndctl/namespace: Use seed alignment as the default Oliver O'Halloran
2019-01-16  9:49 ` [PATCH v3 4/6] ndctl/namespace: Validate alignment from the {pfn|dax} seed Oliver O'Halloran
2019-01-16  9:49 ` Oliver O'Halloran [this message]
2019-01-16  9:49 ` [PATCH v3 6/6] ndctl: Add supported_alignments to the JSON output Oliver O'Halloran
2019-01-29 14:40   ` Oliver
2019-01-29 19:28     ` Verma, Vishal L
2019-01-29 19:43       ` Dan Williams
2019-01-23 19:32 ` [PATCH v3 1/6] libndctl: Use the supported_alignment attribute Verma, Vishal L
2019-01-28 23:11   ` Oliver
2019-01-28 23:15     ` Verma, Vishal L
2019-01-28 23:20       ` Oliver
2019-01-28 23:22         ` Verma, Vishal L

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=20190116094909.23112-5-oohall@gmail.com \
    --to=oohall@gmail.com \
    --cc=linux-nvdimm@lists.01.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.