]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
dapustor: enable dapustor-nvme.c build without json-c dependencies checkin
authorTokunori Ikegami <ikegami.t@gmail.com>
Thu, 19 Dec 2024 14:57:52 +0000 (23:57 +0900)
committerDaniel Wagner <wagi@monom.org>
Fri, 20 Dec 2024 09:12:33 +0000 (10:12 +0100)
Only build json print codes with CONFIG_JSONC build option instead.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
plugins/dapustor/dapustor-nvme.c
plugins/meson.build

index 1f96a62cd23af14edf0bc36926bac5a96e8f65b7..b86f9ab4a9813533c934d82f25b2207aeb2bcc2d 100644 (file)
@@ -96,6 +96,7 @@ struct nvme_extended_additional_smart_log {
        struct nvme_additional_smart_log_item   inflight_write_io_cmd;
 };
 
+#ifdef CONFIG_JSONC
 static void show_dapustor_add_smart_log_jsn(struct nvme_additional_smart_log *smart,
                                            struct json_object *dev_stats)
 {
@@ -348,6 +349,9 @@ static void show_dapustor_smart_log_jsn(struct nvme_additional_smart_log *smart,
        json_print_object(root, NULL);
        json_free_object(root);
 }
+#else /* CONFIG_JSONC */
+#define show_dapustor_smart_log_jsn(smart, ext_smart, nsid,  devname, has_ext)
+#endif /* CONFIG_JSONC */
 
 static void show_dapustor_add_smart_log(struct nvme_additional_smart_log *smart)
 {
@@ -505,7 +509,9 @@ static int dapustor_additional_smart_log(int argc, char **argv, struct command *
        const char *desc = "Get DapuStor vendor specific additional smart log, and show it.";
        const char *namespace = "(optional) desired namespace";
        const char *raw = "Dump output in binary format";
+#ifdef CONFIG_JSONC
        const char *json = "Dump output in json format";
+#endif /* CONFIG_JSONC */
 
        struct nvme_additional_smart_log smart_log;
        struct nvme_extended_additional_smart_log ext_smart_log;
@@ -526,7 +532,9 @@ static int dapustor_additional_smart_log(int argc, char **argv, struct command *
        OPT_ARGS(opts) = {
                OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace),
                OPT_FLAG("raw-binary",   'b', &cfg.raw_binary,   raw),
+#ifdef CONFIG_JSONC
                OPT_FLAG("json",         'j', &cfg.json,         json),
+#endif /* CONFIG_JSONC */
                OPT_END()
        };
 
index 174f5ba1d32d3ad17f52bd7384a9a027c57265b9..67060273148757faffa483f605a8e160911e05c8 100644 (file)
@@ -2,7 +2,6 @@
 
 if json_c_dep.found()
   sources += [
-    'plugins/dapustor/dapustor-nvme.c',
     'plugins/dell/dell-nvme.c',
     'plugins/fdp/fdp.c',
     'plugins/huawei/huawei-nvme.c',
@@ -23,6 +22,7 @@ endif
 
 sources += [
   'plugins/amzn/amzn-nvme.c',
+  'plugins/dapustor/dapustor-nvme.c',
   'plugins/dera/dera-nvme.c',
   'plugins/innogrit/innogrit-nvme.c',
   'plugins/inspur/inspur-nvme.c',