From patchwork Tue Jun 26 02:00:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: QI Fuli X-Patchwork-Id: 10487859 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DD11D60230 for ; Tue, 26 Jun 2018 02:00:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB08928711 for ; Tue, 26 Jun 2018 02:00:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BDA0728724; Tue, 26 Jun 2018 02:00:40 +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.9 required=2.0 tests=BAYES_00, 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 0F77D28711 for ; Tue, 26 Jun 2018 02:00:36 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B750F202E545B; Mon, 25 Jun 2018 19:00:36 -0700 (PDT) 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=202.219.69.169; helo=mgwkm02.jp.fujitsu.com; envelope-from=qi.fuli@jp.fujitsu.com; receiver=linux-nvdimm@lists.01.org Received: from mgwkm02.jp.fujitsu.com (mgwkm02.jp.fujitsu.com [202.219.69.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 77BCC202E53F3 for ; Mon, 25 Jun 2018 19:00:34 -0700 (PDT) Received: from kw-mxauth.gw.nic.fujitsu.com (unknown [192.168.231.132]) by mgwkm02.jp.fujitsu.com with smtp id 2730_7fae_1e69b2e0_a9ab_480a_b0f4_255d41ca5345; Tue, 26 Jun 2018 11:00:27 +0900 Received: from m3050.s.css.fujitsu.com (msm.b.css.fujitsu.com [10.134.21.208]) by kw-mxauth.gw.nic.fujitsu.com (Postfix) with ESMTP id 1DDACAC007F for ; Tue, 26 Jun 2018 11:00:27 +0900 (JST) Received: from qi-fedora.fujitsu.com (unknown [10.124.196.110]) by m3050.s.css.fujitsu.com (Postfix) with ESMTP id F0B071C0; Tue, 26 Jun 2018 11:00:26 +0900 (JST) From: QI Fuli To: linux-nvdimm@lists.01.org Subject: [PATCH v2] ndctl, list: add controller temperature threshold Date: Tue, 26 Jun 2018 11:00:12 +0900 Message-Id: <20180626020012.14097-1-qi.fuli@jp.fujitsu.com> X-Mailer: git-send-email 2.17.1 X-TM-AS-MML: disable X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP This patch is used for adding controller_temperature_threshold and alarm_controller_temperature to list. When a dimm-controller-temperature event fires, users need to know the current controller temperature threshold value. Signed-off-by: QI Fuli --- ndctl/util/json-smart.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ndctl/util/json-smart.c b/ndctl/util/json-smart.c index 9482b35..6a1f294 100644 --- a/ndctl/util/json-smart.c +++ b/ndctl/util/json-smart.c @@ -47,6 +47,18 @@ static void smart_threshold_to_json(struct ndctl_dimm *dimm, "temperature_threshold", jobj); } + if (alarm_control & ND_SMART_CTEMP_TRIP) { + unsigned int temp; + double t; + + temp = ndctl_cmd_smart_threshold_get_ctrl_temperature(cmd); + t = ndctl_decode_smart_temperature(temp); + jobj = json_object_new_double(t); + if (jobj) + json_object_object_add(jhealth, + "controller_temperature_threshold", jobj); + } + if (alarm_control & ND_SMART_SPARE_TRIP) { unsigned int spares; @@ -130,12 +142,17 @@ struct json_object *util_dimm_health_to_json(struct ndctl_dimm *dimm) if (flags & ND_SMART_ALARM_VALID) { unsigned int alarm_flags = ndctl_cmd_smart_get_alarm_flags(cmd); bool temp_flag = !!(alarm_flags & ND_SMART_TEMP_TRIP); + bool ctrl_temp_flag = !!(alarm_flags & ND_SMART_CTEMP_TRIP); bool spares_flag = !!(alarm_flags & ND_SMART_SPARE_TRIP); jobj = json_object_new_boolean(temp_flag); if (jobj) json_object_object_add(jhealth, "alarm_temperature", jobj); + jobj = json_object_new_boolean(ctrl_temp_flag); + if (jobj) + json_object_object_add(jhealth, "alarm_controller_temperature", jobj); + jobj = json_object_new_boolean(spares_flag); if (jobj) json_object_object_add(jhealth, "alarm_spares", jobj);