Skip to content

Commit fc81036

Browse files
committed
amzn: enable amzn-nvme.c build without json-c dependencies checking
Only build json print codes with CONFIG_JSONC build option instead. Signed-off-by: Tokunori Ikegami <[email protected]>
1 parent 144c5d6 commit fc81036

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

plugins/amzn/amzn-nvme.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@
1717
#define AMZN_NVME_STATS_LOGPAGE_ID 0xD0
1818
#define AMZN_NVME_STATS_MAGIC 0x3C23B510
1919

20+
#ifdef CONFIG_JSONC
2021
#define array_add_obj json_array_add_value_object
2122
#define obj_add_array json_object_add_value_array
2223
#define obj_add_obj json_object_add_value_object
2324
#define obj_add_uint json_object_add_value_uint
2425
#define obj_add_uint64 json_object_add_value_uint64
26+
#endif /* CONFIG_JSONC */
2527

2628
struct nvme_vu_id_ctrl_field {
2729
__u8 bdev[32];
@@ -112,6 +114,7 @@ static void amzn_print_latency_histogram(struct amzn_latency_histogram *hist)
112114
printf("=================================\n\n");
113115
}
114116

117+
#ifdef CONFIG_JSONC
115118
static void amzn_json_add_histogram(struct json_object *root,
116119
struct amzn_latency_histogram *hist)
117120
{
@@ -165,6 +168,7 @@ static void amzn_print_json_stats(struct amzn_latency_log_page *log)
165168

166169
json_free_object(root);
167170
}
171+
#endif /* CONFIG_JSONC */
168172

169173
static void amzn_print_normal_stats(struct amzn_latency_log_page *log)
170174
{
@@ -253,9 +257,11 @@ static int get_stats(int argc, char **argv, struct command *cmd,
253257
return -ENOTSUP;
254258
}
255259

260+
#ifdef CONFIG_JSONC
256261
if (!strcmp(cfg.output_format, "json"))
257262
amzn_print_json_stats(&log);
258263
else
264+
#endif /* CONFIG_JSONC */
259265
amzn_print_normal_stats(&log);
260266

261267
return 0;

plugins/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
if json_c_dep.found()
44
sources += [
5-
'plugins/amzn/amzn-nvme.c',
65
'plugins/dapustor/dapustor-nvme.c',
76
'plugins/dell/dell-nvme.c',
87
'plugins/fdp/fdp.c',
@@ -23,6 +22,7 @@ if json_c_dep.found()
2322
endif
2423

2524
sources += [
25+
'plugins/amzn/amzn-nvme.c',
2626
'plugins/dera/dera-nvme.c',
2727
'plugins/innogrit/innogrit-nvme.c',
2828
'plugins/inspur/inspur-nvme.c',

0 commit comments

Comments
 (0)