Only build json print codes with CONFIG_JSONC build option instead.
Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
if json_c_dep.found()
sources += [
- 'plugins/scaleflux/sfx-nvme.c',
'plugins/seagate/seagate-nvme.c',
'plugins/solidigm/solidigm-nvme.c',
'plugins/ssstc/ssstc-nvme.c',
'plugins/nbft/nbft-plugin.c',
'plugins/netapp/netapp-nvme.c',
'plugins/nvidia/nvidia-nvme.c',
+ 'plugins/scaleflux/sfx-nvme.c',
'plugins/shannon/shannon-nvme.c',
'plugins/toshiba/toshiba-nvme.c',
'plugins/transcend/transcend-nvme.c',
return err;
}
+#ifdef CONFIG_JSONC
static void show_sfx_smart_log_jsn(struct nvme_additional_smart_log *smart,
unsigned int nsid, const char *devname)
{
printf("\n");
json_free_object(root);
}
+#else /* CONFIG_JSONC */
+#define show_sfx_smart_log_jsn(smart, nsid, devname)
+#endif /* CONFIG_JSONC */
static void show_sfx_smart_log(struct nvme_additional_smart_log *smart,
unsigned int nsid, const char *devname)
"Get ScaleFlux vendor specific additional smart log (optionally, for the specified namespace), 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_dev *dev;
struct config {
__u32 namespace_id;
OPT_END()
};
-
err = parse_and_open(&dev, argc, argv, desc, opts);
if (err)
return err;
struct json_object *util_json_object_new_uint128(nvme_uint128_t val);
uint64_t util_json_object_get_uint64(struct json_object *obj);
-
-#else /* !CONFIG_JSONC */
-
+#else /* CONFIG_JSONC */
struct json_object;
#define json_object_add_value_string(o, k, v)
-
-#endif
-
-#endif
+#define json_create_object(o) NULL
+#define json_free_object(o) ((void)(o))
+#define json_object_add_value_uint(o, k, v)
+#define json_object_add_value_int(o, k, v)
+#define json_print_object(o, u)
+#define json_object_add_value_double(o, k, v)
+#define json_object_add_value_object(o, k, v) ((void)(v))
+#endif /* CONFIG_JSONC */
+#endif /* __JSON__H */