]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-print-json: use human helper everywhere
authorDaniel Wagner <dwagner@suse.de>
Thu, 16 Nov 2023 10:29:01 +0000 (11:29 +0100)
committerDaniel Wagner <wagi@monom.org>
Thu, 16 Nov 2023 10:32:26 +0000 (11:32 +0100)
If we have this helper let's use it.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
nvme-print-json.c

index e96e16de5565c8fcf9f7a652da0a634ab3b0caf2..ed9dd4b36cb7730024d1354f36f33a16893f84d0 100644 (file)
@@ -602,8 +602,8 @@ static void json_endurance_log(struct nvme_endurance_group_log *endurance_group,
 static void json_smart_log(struct nvme_smart_log *smart, unsigned int nsid,
                           const char *devname)
 {
-       int c, human = json_print_ops.flags  & VERBOSE;
        struct json_object *r = json_create_object();
+       int c;
        char key[21];
        unsigned int temperature = ((smart->temperature[1] << 8) |
                smart->temperature[0]);
@@ -618,7 +618,7 @@ static void json_smart_log(struct nvme_smart_log *smart, unsigned int nsid,
        nvme_uint128_t media_errors = le128_to_cpu(smart->media_errors);
        nvme_uint128_t num_err_log_entries = le128_to_cpu(smart->num_err_log_entries);
 
-       if (human) {
+       if (human()) {
                struct json_object *crt = json_create_object();
 
                obj_add_int(crt, "Value", smart->critical_warning);
@@ -1236,10 +1236,9 @@ static void json_single_property(int offset, uint64_t value64)
 {
        struct json_object *r = json_create_object();
        char json_str[STR_LEN];
-       int human = json_print_ops.flags & VERBOSE;
        uint32_t value32 = (uint32_t)value64;
 
-       if (human) {
+       if (human()) {
                json_single_property_human(offset, value64, r);
        } else {
                sprintf(json_str, "0x%02x", offset);