From patchwork Wed Jan 16 09:49:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 10765597 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 356521580 for ; Wed, 16 Jan 2019 09:49:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22A742B2B4 for ; Wed, 16 Jan 2019 09:49:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 16FC82BACC; Wed, 16 Jan 2019 09:49:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BF9D32B2B4 for ; Wed, 16 Jan 2019 09:49:32 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B85E6211B7F95; Wed, 16 Jan 2019 01:49:32 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:4864:20::543; helo=mail-pg1-x543.google.com; envelope-from=oohall@gmail.com; receiver=linux-nvdimm@lists.01.org Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 45139211B7F66 for ; Wed, 16 Jan 2019 01:49:31 -0800 (PST) Received: by mail-pg1-x543.google.com with SMTP id t13so2593485pgr.11 for ; Wed, 16 Jan 2019 01:49:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lRsftHXqbcA8HYVYnpE+da6pldgpNEpRW/GWwqlthA4=; b=H/twTdt/Z+iJZPCy89rTBZEiLH8QyesBW36FAPY6QJA6gcU20XiYrr9exjVwB+myRS SMijhHsJNpqkeKurG1E+wtpSjTVSrlg1o/sCnLg1Oe4/tLb0NLbXciGwuaZUxY8CbilB P1DNUb7ENqGdCh2xazVFKxCCirpVSkpi4aKXeVMN/X7WtbHGLv2VXeG56g9CzzXbwFHB E0QxYvAMhnepDdjkQgiQWjVAkWBoxyMr7+ZN3JrWHJK97rS6jWNtkQ2wdA5qcKqLcXKx Jj2EPKoLtF6L17IIfH7grrYpWPQddu5cFFhx9SUYZtSFuLbI1wFRgy0W/NR34xIlHJiB Bk/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lRsftHXqbcA8HYVYnpE+da6pldgpNEpRW/GWwqlthA4=; b=WsyeEg4US5oC2k6cnnYlFS77IDjyUpQLCLuvPwBWIVVRJM6W2BALCas1mfQAh3mtD+ M0C7G2JSMdsNRB4E417s2dRvY+Jfr//CGiws6IkBBM6vYz3Bkkur5A3/U6Lf3XF+A92A vv5fiOYX7hV1fHdqYR+d8zjp9Wu6XOCumL9D5gMytO4uNB4y7KEKf0OwCXpEthMWUp1w yCYrN1EI2CLcfDJjJ2nw5F//U+pxiwNGqYU+Dqc2lIIHS3psvu9sUNrDNPQ/wpJeT33T clMnYXokDsXP1Cx46ranl5pVAJTTo5fYCZ3nC4+ulGqH4pffSL0bVRbcTwy7Hii3W3PG cQmw== X-Gm-Message-State: AJcUukcxgsDMMkOeGdZPGFfBikFF99hPclJbI0J/ZqxuIUhyVp5eyNo3 txsUKifPRNFHn5T6zgJP9mLYgM6F X-Google-Smtp-Source: ALg8bN7bgbZ4F5PXaO+qckzDgk1lY/sUgOqfz6yxOv7Ox2iG5ADtpymsn3ui97Z+ngrwkzdhajYFJg== X-Received: by 2002:a63:fa58:: with SMTP id g24mr7909989pgk.390.1547632170749; Wed, 16 Jan 2019 01:49:30 -0800 (PST) Received: from wafer.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id f13sm8777331pfa.132.2019.01.16.01.49.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 Jan 2019 01:49:30 -0800 (PST) From: Oliver O'Halloran 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 Message-Id: <20190116094909.23112-5-oohall@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190116094909.23112-1-oohall@gmail.com> References: <20190116094909.23112-1-oohall@gmail.com> MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP Automated tooling probably wants to know this and it's helpful output for command line users for ndctl. Signed-off-by: Oliver O'Halloran --- 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)