From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "Williams, Dan J" <dan.j.williams@intel.com>,
"linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Subject: Re: [ndctl PATCH] ndctl: hide null uuids
Date: Wed, 23 May 2018 17:45:23 +0000 [thread overview]
Message-ID: <1527097521.9654.5.camel@intel.com> (raw)
In-Reply-To: <152700595304.1878.15402579458295755554.stgit@dwillia2-desk3.amr.corp.intel.com>
On Tue, 2018-05-22 at 09:19 -0700, Dan Williams wrote:
> Clean up the namespace listing to hide the 'raw_uuid' field when it is
> zero.
>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
> util/json.c | 19 +++++++++----------
> 1 file changed, 9 insertions(+), 10 deletions(-)
Looks good, applied.
>
> diff --git a/util/json.c b/util/json.c
> index 1772177a8abd..c606e1cdf770 100644
> --- a/util/json.c
> +++ b/util/json.c
> @@ -652,10 +652,12 @@ static struct json_object
> *util_dax_badblocks_to_json(struct ndctl_dax *dax,
>
> static struct json_object *util_raw_uuid(struct ndctl_namespace *ndns)
> {
> - uuid_t raw_uuid;
> char buf[40];
> + uuid_t raw_uuid;
>
> ndctl_namespace_get_uuid(ndns, raw_uuid);
> + if (uuid_is_null(raw_uuid))
> + return NULL;
> uuid_unparse(raw_uuid, buf);
> return json_object_new_string(buf);
> }
> @@ -734,9 +736,8 @@ struct json_object *util_namespace_to_json(struct
> ndctl_namespace *ndns,
> json_object_object_add(jndns, "uuid", jobj);
>
> jobj = util_raw_uuid(ndns);
> - if (!jobj)
> - goto err;
> - json_object_object_add(jndns, "raw_uuid", jobj);
> + if (jobj)
> + json_object_object_add(jndns, "raw_uuid", jobj);
> bdev = ndctl_btt_get_block_device(btt);
> } else if (pfn) {
> ndctl_pfn_get_uuid(pfn, uuid);
> @@ -746,9 +747,8 @@ struct json_object *util_namespace_to_json(struct
> ndctl_namespace *ndns,
> goto err;
> json_object_object_add(jndns, "uuid", jobj);
> jobj = util_raw_uuid(ndns);
> - if (!jobj)
> - goto err;
> - json_object_object_add(jndns, "raw_uuid", jobj);
> + if (jobj)
> + json_object_object_add(jndns, "raw_uuid", jobj);
> bdev = ndctl_pfn_get_block_device(pfn);
> } else if (dax) {
> struct daxctl_region *dax_region;
> @@ -761,9 +761,8 @@ struct json_object *util_namespace_to_json(struct
> ndctl_namespace *ndns,
> goto err;
> json_object_object_add(jndns, "uuid", jobj);
> jobj = util_raw_uuid(ndns);
> - if (!jobj)
> - goto err;
> - json_object_object_add(jndns, "raw_uuid", jobj);
> + if (jobj)
> + json_object_object_add(jndns, "raw_uuid", jobj);
> if ((flags & UTIL_JSON_DAX) && dax_region) {
> jobj = util_daxctl_region_to_json(dax_region,
> NULL,
> flags);
>
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
prev parent reply other threads:[~2018-05-23 17:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-22 16:19 [ndctl PATCH] ndctl: hide null uuids Dan Williams
2018-05-23 17:45 ` Verma, Vishal L [this message]
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=1527097521.9654.5.camel@intel.com \
--to=vishal.l.verma@intel.com \
--cc=dan.j.williams@intel.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 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).