]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
Bug fix unsigned int and int should use 64bit api for json-c
authorSteven Seungcheol Lee <sc108.lee@samsung.com>
Mon, 2 Aug 2021 07:00:35 +0000 (16:00 +0900)
committerKeith Busch <kbusch@kernel.org>
Fri, 6 Aug 2021 20:08:22 +0000 (14:08 -0600)
unsigned int should use json_object_new_uint64(json-c >= 0.14-20200419)
    Error examples
    nsze    : 0xe8e088b0
    {
      "nsze":-387938128
    }
    After fix this
    {
      "nsze":3907029168
    }
json_object_add_value_int also should use json_object_new_int64
    since util/json.h support long long type, and other codes are using it for 64bit values

Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
nvme.h

diff --git a/nvme.h b/nvme.h
index 5150c8db05a6a44707a949591a8a377bf14fe0e8..16c493d62ca9535b04d6d16f9000d9a3795b78ab 100644 (file)
--- a/nvme.h
+++ b/nvme.h
@@ -30,9 +30,9 @@
 #define json_free_object(o) json_object_put(o)
 #define json_free_array(a) json_object_put(a)
 #define json_object_add_value_uint(o, k, v) \
-       json_object_object_add(o, k, json_object_new_int(v))
+       json_object_object_add(o, k, json_object_new_uint64(v))
 #define json_object_add_value_int(o, k, v) \
-       json_object_object_add(o, k, json_object_new_int(v))
+       json_object_object_add(o, k, json_object_new_int64(v))
 #define json_object_add_value_float(o, k, v) \
        json_object_object_add(o, k, json_object_new_double(v))
 #define json_object_add_value_string(o, k, v) \