Skip to content

Commit

Permalink
netapp: enable netapp-nvme.c build without json-c dependencies checking
Browse files Browse the repository at this point in the history
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 620e08c commit 74c8b83
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions 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/netapp/netapp-nvme.c',
'plugins/nvidia/nvidia-nvme.c',
'plugins/scaleflux/sfx-nvme.c',
'plugins/seagate/seagate-nvme.c',
Expand All @@ -27,13 +26,14 @@ sources += [
'plugins/memblaze/memblaze-nvme.c',
'plugins/micron/micron-nvme.c',
'plugins/nbft/nbft-plugin.c',
'plugins/netapp/netapp-nvme.c',
'plugins/shannon/shannon-nvme.c',
'plugins/toshiba/toshiba-nvme.c',
'plugins/transcend/transcend-nvme.c',
'plugins/virtium/virtium-nvme.c',
'plugins/ymtc/ymtc-nvme.c',
'plugins/zns/zns.c',
]
]

subdir('ocp')
subdir('lm')
Expand Down
12 changes: 12 additions & 0 deletions plugins/netapp/netapp-nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ static void netapp_get_ontap_labels(char *vsname, char *nspath,
}
}

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

json_array_add_value_object(devices, device_attrs);
}
#endif /* CONFIG_JSONC */

static void netapp_smdevices_print_verbose(struct smdevice_info *devices,
int count, int format, const char *devname)
Expand Down Expand Up @@ -440,6 +442,7 @@ static void netapp_smdevices_print_regular(struct smdevice_info *devices,
}
}

#ifdef CONFIG_JSONC
static void netapp_smdevices_print_json(struct smdevice_info *devices,
int count, const char *devname)
{
Expand Down Expand Up @@ -508,6 +511,9 @@ static void netapp_smdevices_print_json(struct smdevice_info *devices,
printf("\n");
json_free_object(root);
}
#else /* CONFIG_JSONC */
#define netapp_smdevices_print_json(devices, count, devname)
#endif /* CONFIG_JSONC */

static void netapp_ontapdevices_print_verbose(struct ontapdevice_info *devices,
int count, int format, const char *devname)
Expand Down Expand Up @@ -623,6 +629,7 @@ static void netapp_ontapdevices_print_regular(struct ontapdevice_info *devices,
}
}

#ifdef CONFIG_JSONC
static void netapp_ontapdevices_print_json(struct ontapdevice_info *devices,
int count, const char *devname)
{
Expand Down Expand Up @@ -679,6 +686,9 @@ static void netapp_ontapdevices_print_json(struct ontapdevice_info *devices,
printf("\n");
json_free_object(root);
}
#else /* CONFIG_JSONC */
#define netapp_ontapdevices_print_json(devices, count, devname)
#endif /* CONFIG_JSONC */

static int nvme_get_ontap_c2_log(int fd, __u32 nsid, void *buf, __u32 buflen)
{
Expand Down Expand Up @@ -829,8 +839,10 @@ static int netapp_output_format(char *format)
return -EINVAL;
if (!strcmp(format, "normal"))
return NNORMAL;
#ifdef CONFIG_JSONC
if (!strcmp(format, "json"))
return NJSON;
#endif /* CONFIG_JSONC */
if (!strcmp(format, "column"))
return NCOLUMN;
return -EINVAL;
Expand Down

0 comments on commit 74c8b83

Please sign in to comment.