From patchwork Wed Jan 30 10:59:25 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: 10788271 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 12B911390 for ; Wed, 30 Jan 2019 10:59:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2EA72E3BB for ; Wed, 30 Jan 2019 10:59:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E76422E3E2; Wed, 30 Jan 2019 10:59:49 +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 A63B92E3BB for ; Wed, 30 Jan 2019 10:59:49 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9DFB5211BFCCE; Wed, 30 Jan 2019 02:59:49 -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::541; helo=mail-pg1-x541.google.com; envelope-from=oohall@gmail.com; receiver=linux-nvdimm@lists.01.org Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) (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 6F87A211BFCDB for ; Wed, 30 Jan 2019 02:59:48 -0800 (PST) Received: by mail-pg1-x541.google.com with SMTP id w7so10165256pgp.13 for ; Wed, 30 Jan 2019 02:59:48 -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=QLL3zLrBGVui20yStz2pUosX2LkCNQGOGiyot84L0wdIszRxndjbNiVLGeED6nSivq wp/eisj68s0Mhl6Mtrs0+uE+kIU26ykoyLOPeoIBjFxEXmRGsChHL1hQ9PAz5N1BuR2i CNS3FIpNCGZ9bwWGUKfCJEI8JtFbtlXwV0wApY3L8BHyDjcJoISG3imXYXUsKPJGbjMZ M09I4MQuDeZs2UEmrv5g5/7jcohSOOIlkg0ULads5NPA9l3t6yRjV4119FqAht61g4mN zKVxQ9Fs4tJrFMkt9g2cKQ9AaYvHpvuQxXQsDDSwClNtTu3nzLZkRiS9bind/BJqa5Oy 1HAA== 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=gqPzO6x5cfvoluysjKrRre1gluD9HQ0JisvtJX6iF5gx/cFV1n7rpfrF3pEy+7mJsF bSAsZnPqO4HXW70bJOaXN+Yqv+NDeF5ldmaHgAGixYHYoPdn9y+i/06uB4X5Dx3PH+Qr NaAaqYYaxMeT4gm6yZDBfo8c89sfaLXz/6tueCXL75mCzgIUscEN0WengL5WpfJ3SDf9 vd8bugEY2tmkJxvaPxlwWvTfGceYCfMCQvaVUEVXynWhsEzPUVoPBAMGnAOi5EnTJpo7 ZJlYKPX6eVF/Nl8Ps2qxIhIN/WfKkt73P2F6Hw4T+Cm+bx3N97Dn4UztUy2js8LAmdMY +6hg== X-Gm-Message-State: AJcUukdlNTaRTFC3dDzmhbI5QfH2UHD2Pz4MHsFGgqQn1+LMqGB5K64/ X4Bimfk5AMfisCFPDJGQ+p5X9Ur0 X-Google-Smtp-Source: ALg8bN5SXQFV9uOkt8Qzif4m49pd0K7CX0EgFWF/9i73aAJuaRJX5jko1GIrosPc+Su3kdU/lw/Qzg== X-Received: by 2002:a63:a16:: with SMTP id 22mr27111621pgk.318.1548845987877; Wed, 30 Jan 2019 02:59:47 -0800 (PST) Received: from wafer.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id r1sm3547452pgo.17.2019.01.30.02.59.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 30 Jan 2019 02:59:47 -0800 (PST) From: Oliver O'Halloran To: linux-nvdimm@lists.01.org Subject: [PATCH v5 5/7] ndctl: Add alignment to the namespace JSON output Date: Wed, 30 Jan 2019 21:59:25 +1100 Message-Id: <20190130105927.31901-5-oohall@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190130105927.31901-1-oohall@gmail.com> References: <20190130105927.31901-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)