Skip to content

Commit

Permalink
dapustor: enable dapustor-nvme.c build without json-c dependencies ch…
Browse files Browse the repository at this point in the history
…eckin

Only build json print codes with CONFIG_JSONC build option instead.

Signed-off-by: Tokunori Ikegami <[email protected]>
  • Loading branch information
ikegami-t authored and igaw committed Dec 20, 2024
1 parent 8919109 commit 64e5df3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions plugins/dapustor/dapustor-nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand All @@ -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()
};

Expand Down
2 changes: 1 addition & 1 deletion plugins/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down

0 comments on commit 64e5df3

Please sign in to comment.