]> 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)
committerKeith Busch <kbusch@kernel.org>
Thu, 26 Aug 2021 18:24:50 +0000 (11:24 -0700)
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 86eb7c65ec8d9e726086d64e0bd0ef941d5dc012..dded91721e66cf3845977dae59a8467b7f400449 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ override CPPFLAGS += -D_GNU_SOURCE -D__CHECK_ENDIAN__
 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 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) \