Skip to content

Commit 74c8b83

Browse files
ikegami-tigaw
authored andcommitted
netapp: enable netapp-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 620e08c commit 74c8b83

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

plugins/meson.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
if json_c_dep.found()
44
sources += [
5-
'plugins/netapp/netapp-nvme.c',
65
'plugins/nvidia/nvidia-nvme.c',
76
'plugins/scaleflux/sfx-nvme.c',
87
'plugins/seagate/seagate-nvme.c',
@@ -27,13 +26,14 @@ sources += [
2726
'plugins/memblaze/memblaze-nvme.c',
2827
'plugins/micron/micron-nvme.c',
2928
'plugins/nbft/nbft-plugin.c',
29+
'plugins/netapp/netapp-nvme.c',
3030
'plugins/shannon/shannon-nvme.c',
3131
'plugins/toshiba/toshiba-nvme.c',
3232
'plugins/transcend/transcend-nvme.c',
3333
'plugins/virtium/virtium-nvme.c',
3434
'plugins/ymtc/ymtc-nvme.c',
3535
'plugins/zns/zns.c',
36-
]
36+
]
3737

3838
subdir('ocp')
3939
subdir('lm')

plugins/netapp/netapp-nvme.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ static void netapp_get_ontap_labels(char *vsname, char *nspath,
248248
}
249249
}
250250

251+
#ifdef CONFIG_JSONC
251252
static void netapp_smdevice_json(struct json_object *devices, char *devname,
252253
char *arrayname, char *volname, int nsid, char *nguid,
253254
char *ctrl, char *astate, char *version, unsigned long long lba,
@@ -293,6 +294,7 @@ static void netapp_ontapdevice_json(struct json_object *devices, char *devname,
293294

294295
json_array_add_value_object(devices, device_attrs);
295296
}
297+
#endif /* CONFIG_JSONC */
296298

297299
static void netapp_smdevices_print_verbose(struct smdevice_info *devices,
298300
int count, int format, const char *devname)
@@ -440,6 +442,7 @@ static void netapp_smdevices_print_regular(struct smdevice_info *devices,
440442
}
441443
}
442444

445+
#ifdef CONFIG_JSONC
443446
static void netapp_smdevices_print_json(struct smdevice_info *devices,
444447
int count, const char *devname)
445448
{
@@ -508,6 +511,9 @@ static void netapp_smdevices_print_json(struct smdevice_info *devices,
508511
printf("\n");
509512
json_free_object(root);
510513
}
514+
#else /* CONFIG_JSONC */
515+
#define netapp_smdevices_print_json(devices, count, devname)
516+
#endif /* CONFIG_JSONC */
511517

512518
static void netapp_ontapdevices_print_verbose(struct ontapdevice_info *devices,
513519
int count, int format, const char *devname)
@@ -623,6 +629,7 @@ static void netapp_ontapdevices_print_regular(struct ontapdevice_info *devices,
623629
}
624630
}
625631

632+
#ifdef CONFIG_JSONC
626633
static void netapp_ontapdevices_print_json(struct ontapdevice_info *devices,
627634
int count, const char *devname)
628635
{
@@ -679,6 +686,9 @@ static void netapp_ontapdevices_print_json(struct ontapdevice_info *devices,
679686
printf("\n");
680687
json_free_object(root);
681688
}
689+
#else /* CONFIG_JSONC */
690+
#define netapp_ontapdevices_print_json(devices, count, devname)
691+
#endif /* CONFIG_JSONC */
682692

683693
static int nvme_get_ontap_c2_log(int fd, __u32 nsid, void *buf, __u32 buflen)
684694
{
@@ -829,8 +839,10 @@ static int netapp_output_format(char *format)
829839
return -EINVAL;
830840
if (!strcmp(format, "normal"))
831841
return NNORMAL;
842+
#ifdef CONFIG_JSONC
832843
if (!strcmp(format, "json"))
833844
return NJSON;
845+
#endif /* CONFIG_JSONC */
834846
if (!strcmp(format, "column"))
835847
return NCOLUMN;
836848
return -EINVAL;

0 commit comments

Comments
 (0)