]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
Check json-c libversion, recover commit d127537
authorSteven Seungcheol Lee <sc108.lee@samsung.com>
Tue, 10 Aug 2021 05:08:36 +0000 (14:08 +0900)
committerDaniel Wagner <dwagner@suse.de>
Mon, 15 Nov 2021 11:06:29 +0000 (12:06 +0100)
The fix commit support json-c >= 0.14-20200419
If version lower than 0.14, using util/json.h util/json.c

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

index 4da13d55b9d13db2a659eedfb1fa8a919a27643f..74d61c1712ff8e4a0aab92ac7bbd1751447e0508 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ override CPPFLAGS += -D_GNU_SOURCE -D__CHECK_ENDIAN__ -I.
 LIBUUID = $(shell $(LD) -o /dev/null -luuid >/dev/null 2>&1; echo $$?)
 LIBHUGETLBFS = $(shell $(LD) -o /dev/null -lhugetlbfs >/dev/null 2>&1; echo $$?)
 HAVE_SYSTEMD = $(shell pkg-config --exists libsystemd  --atleast-version=242; echo $$?)
-LIBJSONC = $(shell $(LD) -o /dev/null -ljson-c >/dev/null 2>&1; echo $$?)
+LIBJSONC = $(shell pkg-config --atleast-version=0.14 json-c; echo $$?)
 NVME = nvme
 INSTALL ?= install
 DESTDIR =
diff --git a/nvme.h b/nvme.h
index eb7d63ff84bf1d10bb935e3ad1743d0e35f680e0..af16dbf75db2fa34343d7a748cc14358566739ba 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) \