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 <qi.f...@jp.fujitsu.com> --- 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); -- 2.17.1 _______________________________________________ Linux-nvdimm mailing list Linux-nvdimm@lists.01.org https://lists.01.org/mailman/listinfo/linux-nvdimm