nvme-print: fix smart log temperature output in json mode
PATCH 1/1 nvme-print: fix smart log temperature output in json mode
--- nvme-print.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
nvme-print.c +1 -1
@@ -593,7 +593,7 @@ static void json_smart_log(struct nvme_smart_log *smart, unsigned int nsid,char key[21 ];unsigned int temperature = ((smart->temperature[1 ] <<8 ) | - smart->temperature[0 ]); + smart->temperature[0 ]) -273 ;long double data_units_read =int128_to_double (smart->data_units_read);long double data_units_written =int128_to_double (smart->data_units_written);
Signature · 7 lines
2.21.0 _______________________________________________ linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Keith Busch
maintainerQuoted 10 lines · Yi Zhang
Signed-off-by Yi Zhang <[email protected]>--- nvme-print.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)nvme-print.c +0
-0
nvme-print.c static void json_smart_log(struct nvme_smart_log *smart, unsigned int nsid, · line 596
Quoted 5 lines
nvme-print.c +1
-1@@ -593,7 +593,7 @@ static void json_smart_log(struct nvme_smart_log *smart, unsigned int nsid,char key[21 ];unsigned int temperature = ((smart->temperature[1 ] <<8 ) | - smart->temperature[0 ]); + smart->temperature[0 ]) -273 ;
I usually consider json output as something to be consumed by another program rather than by a human, so we've not done much manipulation from the spec defined units. It's just a serialized representation of the structure.
If you need a more human friendly output, we can add flags to refine the output, but we can't just change the default reporting from Kelvin to Celsius since that may break existing programs interpreting the current json.
_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Quoted 13 lines · Keith Busch
Quoted 12 lines · Yi Zhang
Signed-off-by Yi Zhang <[email protected]>--- nvme-print.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)nvme-print.c +0
-0@@ -593,7 +593,7 @@ static void json_smart_log(struct nvme_smart_log *smart, unsigned int nsid,char key[21 ];
Quoted 7 lines
nvme-print.c static void json_smart_log(struct nvme_smart_log *smart, unsigned int nsid, · line 596
Quoted 3 lines
nvme-print.c +1
-1unsigned int temperature = ((smart->temperature[1 ] <<8 ) | - smart->temperature[0 ]); + smart->temperature[0 ]) -273 ;I usually consider json output as something to be consumed by another program rather than by a human, so we've not done much manipulation from the spec defined units. It's just a serialized representation of the structure.
I checked this field in the spec, it make sense to keep Kelvin here. So drop this patch, thanks.
Quoted 5 lines
If you need a more human friendly output, we can add flags to refine the output, but we can't just change the default reporting from Kelvin to Celsius since that may break existing programs interpreting the current json.
_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme