From patchwork Tue Apr 26 23:57:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 8949711 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EA830BF29F for ; Tue, 26 Apr 2016 23:58:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 283F9201EF for ; Tue, 26 Apr 2016 23:58:21 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 5D091200FF for ; Tue, 26 Apr 2016 23:58:20 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 519CF1A1EC0; Tue, 26 Apr 2016 16:58:20 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ml01.01.org (Postfix) with ESMTP id 30D0E1A1EC2 for ; Tue, 26 Apr 2016 16:58:19 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP; 26 Apr 2016 16:58:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,538,1455004800"; d="scan'208";a="92532992" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.14]) by fmsmga004.fm.intel.com with ESMTP; 26 Apr 2016 16:58:19 -0700 Subject: [ndctl PATCH 2/2] ndctl, list: add 'id' to the dimm listing From: Dan Williams To: linux-nvdimm@lists.01.org Date: Tue, 26 Apr 2016 16:57:30 -0700 Message-ID: <146171505042.32030.8733064490141646370.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <146171495520.32030.11537526996792266896.stgit@dwillia2-desk3.amr.corp.intel.com> References: <146171495520.32030.11537526996792266896.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.20 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-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Emit the ACPI 6.1 defined DIMM identfier if available. # ndctl list -D -d nmem0 { "dev":"nmem0", "id":"cdab-ffffffff" } Cc: Toshi Kani Signed-off-by: Dan Williams --- util/json.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/util/json.c b/util/json.c index 4e2d902a183e..1d914da318fa 100644 --- a/util/json.c +++ b/util/json.c @@ -53,6 +53,7 @@ struct json_object *util_bus_to_json(struct ndctl_bus *bus) struct json_object *util_dimm_to_json(struct ndctl_dimm *dimm) { struct json_object *jdimm = json_object_new_object(); + const char *id = ndctl_dimm_get_unique_id(dimm); struct json_object *jobj; if (!jdimm) @@ -63,6 +64,13 @@ struct json_object *util_dimm_to_json(struct ndctl_dimm *dimm) goto err; json_object_object_add(jdimm, "dev", jobj); + if (id) { + jobj = json_object_new_string(id); + if (!jobj) + goto err; + json_object_object_add(jdimm, "id", jobj); + } + if (!ndctl_dimm_is_enabled(dimm)) { jobj = json_object_new_string("disabled"); if (!jobj)