ndctl, list: add alarm_enable_<field> to list
PATCH v2 1/1 ndctl, list: add alarm_enable_<field> to list
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 <[email protected]>
---
v1 -> v2:
remove the renaming for list items.
ndctl/util/json-smart.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
ndctl/util/json-smart.c +27 -0
@@ -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:
Signature · 7 lines
2.18.0 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Verma, Vishal L
maintainerQuoted 8 lines · QI Fuli
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 <[email protected]>---
v1 -> v2:
remove the renaming for list items.
Thanks, looks good and applied.
Quoted 80 lines
ndctl/util/json-smart.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)ndctl/util/json-smart.c +22
-0@@ -39,34 +39,61 @@ static void smart_threshold_to_json(structndctl_dimm *dimm, unsigned int temp;double t; + jobj =json_object_new_boolean (true); +if (jobj) +json_object_object_add (jhealth, +"alarm_enable_media_temperat ure", 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_temperat ure", 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_temperatu re", 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_temperatu re", 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);
ndctl/util/json-smart.c +5
-0spares =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);
}
Quoted 1 line
out:
_______________________________________________
Linux-nvdimm mailing list
[email protected]
https://lists.01.org/mailman/listinfo/linux-nvdimm