public inbox for linux-nvdimm@lists.01.org
 help / color / mirror / Atom feed
From: QI Fuli <qi.fuli@jp.fujitsu.com>
To: linux-nvdimm@lists.01.org
Subject: [ndctl PATCH v2] ndctl, list: add alarm_enable_<field> to list
Date: Wed,  8 Aug 2018 11:43:35 +0900	[thread overview]
Message-ID: <20180808024335.12793-1-qi.fuli@jp.fujitsu.com> (raw)

This patch adds alarm_enable_<field> to list, so that users could check
if the "ndctl inject-smart --<field>-alarm=on/off" works well or not.

Signed-off-by: QI Fuli <qi.fuli@jp.fujitsu.com>
---
v1 -> v2:
 remove the renaming for list items.

 ndctl/util/json-smart.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/ndctl/util/json-smart.c b/ndctl/util/json-smart.c
index 6a1f294..e25483d 100644
--- a/ndctl/util/json-smart.c
+++ b/ndctl/util/json-smart.c
@@ -39,34 +39,61 @@ static void smart_threshold_to_json(struct ndctl_dimm *dimm,
 		unsigned int temp;
 		double t;
 
+		jobj = json_object_new_boolean(true);
+		if (jobj)
+			json_object_object_add(jhealth,
+					"alarm_enable_media_temperature", jobj);
 		temp = ndctl_cmd_smart_threshold_get_temperature(cmd);
 		t = ndctl_decode_smart_temperature(temp);
 		jobj = json_object_new_double(t);
 		if (jobj)
 			json_object_object_add(jhealth,
 					"temperature_threshold", jobj);
+	} else {
+		jobj = json_object_new_boolean(false);
+		if (jobj)
+			json_object_object_add(jhealth,
+					"alarm_enable_media_temperature", jobj);
 	}
 
 	if (alarm_control & ND_SMART_CTEMP_TRIP) {
 		unsigned int temp;
 		double t;
 
+		jobj = json_object_new_boolean(true);
+		if (jobj)
+			json_object_object_add(jhealth,
+					"alarm_enable_ctrl_temperature", jobj);
 		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);
+	} else {
+		jobj = json_object_new_boolean(false);
+		if (jobj)
+			json_object_object_add(jhealth,
+					"alarm_enable_ctrl_temperature", jobj);
 	}
 
 	if (alarm_control & ND_SMART_SPARE_TRIP) {
 		unsigned int spares;
 
+		jobj = json_object_new_boolean(true);
+		if (jobj)
+			json_object_object_add(jhealth,
+					"alarm_enable_spares", jobj);
 		spares = ndctl_cmd_smart_threshold_get_spares(cmd);
 		jobj = json_object_new_int(spares);
 		if (jobj)
 			json_object_object_add(jhealth,
 					"spares_threshold", jobj);
+	} else {
+		jobj = json_object_new_boolean(false);
+		if (jobj)
+			json_object_object_add(jhealth,
+					"alarm_enable_spares", jobj);
 	}
 
  out:
-- 
2.18.0


_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

             reply	other threads:[~2018-08-08  2:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-08  2:43 QI Fuli [this message]
2018-08-08 18:31 ` [ndctl PATCH v2] ndctl, list: add alarm_enable_<field> to list Verma, Vishal L

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180808024335.12793-1-qi.fuli@jp.fujitsu.com \
    --to=qi.fuli@jp.fujitsu.com \
    --cc=linux-nvdimm@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox