From patchwork Tue Jan 29 14:48:57 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: 10786433 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 C7E8014E1 for ; Tue, 29 Jan 2019 14:49:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B56672C8A4 for ; Tue, 29 Jan 2019 14:49:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A9F442C8B2; Tue, 29 Jan 2019 14:49:24 +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 6BE742C8A4 for ; Tue, 29 Jan 2019 14:49:24 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 64BAF211BD5E8; Tue, 29 Jan 2019 06:49:24 -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::542; helo=mail-pg1-x542.google.com; envelope-from=oohall@gmail.com; receiver=linux-nvdimm@lists.01.org Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) (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 22266211B5A34 for ; Tue, 29 Jan 2019 06:49:23 -0800 (PST) Received: by mail-pg1-x542.google.com with SMTP id v28so8829470pgk.10 for ; Tue, 29 Jan 2019 06:49:23 -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=CU5xwkolaoJ/tPmchiTS7SLGeaCrBAxQTSv4OyBQLx4N2a3b7vVjFIQwCCTI7bOW9O N/td84toLkFQ1v75fqN+m6U0dyUhvjJBvYsIqn+j45Vcy/+o2SlVRY1z+aBBHPwXpWfr GbOivoUAhZRrAJUYptqLMnBDB6eLp5QFHfjfDbzix9nFTWqUn7rHEg/qomQkZScAyPhM 6tf45U2FYte7Ek7MEWudrgJ6TNSsf6oGurJgkTPwE2mMhdk4og32cdb9KhQTQJYF4IRs mMDwGPUm3lH/f/cu6l9WD9/fxOY86AU6ItcQdumzDfsFnQoBstzCMDd+Y4LXF0NQaNrr bX8Q== 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=GCRVa3V2eKdBaLYVwKX5Dd6pldGTBhHUw4bCO1FtjZiGPkhO7fPMO4IbZ0FxUTq8xh ki86Dc/annhwC9lumSNq6xRh/R0MPXyONt7p1iPwGw+nx+vNxo/KJ3H9n2gG0VTZN11U QcE8oKlY/wE60PX76OyJ0vldF/kXzSkdLEx6CT+cklIUlF6nZRM22e2hw2oP8cK2Y7Vo UllnvjB800z0B3zUtSK8E7v5/zKPjHJaskgfKyu4LnxT/i7b8j4Hov758jvTpsvuhKSt joC65hdUKRgjQ83t9PTDxXgTPRFqU1ulyRq3o/vYJDBAiullEBrH718yO0H2TssrCr0e al1g== X-Gm-Message-State: AJcUukct+ioHPd1SyRs41vGE47QUA61lurHwwhKDIWugW8FqX+AxEJe7 2YlmSeRFSRORcz8VWuL2VibkccMf X-Google-Smtp-Source: ALg8bN7guDIbGIC9ejCKiabRHDohpSuhkdGSAZqfPqiwMz/99WhgB8ztdwYqI3N1yNshivptU8dKCw== X-Received: by 2002:a63:f047:: with SMTP id s7mr23861275pgj.441.1548773362483; Tue, 29 Jan 2019 06:49:22 -0800 (PST) Received: from 192-168-1-15.tpgi.com.au (203-219-255-210.tpgi.com.au. [203.219.255.210]) by smtp.gmail.com with ESMTPSA id g26sm44944677pfh.61.2019.01.29.06.49.20 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 29 Jan 2019 06:49:21 -0800 (PST) From: Oliver O'Halloran To: linux-nvdimm@lists.01.org Subject: [PATCH v4 5/5] ndctl: Add alignment to the namespace JSON output Date: Wed, 30 Jan 2019 01:48:57 +1100 Message-Id: <20190129144857.6741-5-oohall@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190129144857.6741-1-oohall@gmail.com> References: <20190129144857.6741-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)