Skip to content

Commit b701b9c

Browse files
committed
scaleflux: enable sfx-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 e21db3e commit b701b9c

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

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/scaleflux/sfx-nvme.c',
65
'plugins/seagate/seagate-nvme.c',
76
'plugins/solidigm/solidigm-nvme.c',
87
'plugins/ssstc/ssstc-nvme.c',
@@ -27,6 +26,7 @@ sources += [
2726
'plugins/nbft/nbft-plugin.c',
2827
'plugins/netapp/netapp-nvme.c',
2928
'plugins/nvidia/nvidia-nvme.c',
29+
'plugins/scaleflux/sfx-nvme.c',
3030
'plugins/shannon/shannon-nvme.c',
3131
'plugins/toshiba/toshiba-nvme.c',
3232
'plugins/transcend/transcend-nvme.c',

plugins/scaleflux/sfx-nvme.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ int nvme_sfx_get_features(int fd, __u32 nsid, __u32 fid, __u32 *result)
101101
return err;
102102
}
103103

104+
#ifdef CONFIG_JSONC
104105
static void show_sfx_smart_log_jsn(struct nvme_additional_smart_log *smart,
105106
unsigned int nsid, const char *devname)
106107
{
@@ -239,6 +240,9 @@ static void show_sfx_smart_log_jsn(struct nvme_additional_smart_log *smart,
239240
printf("\n");
240241
json_free_object(root);
241242
}
243+
#else /* CONFIG_JSONC */
244+
#define show_sfx_smart_log_jsn(smart, nsid, devname)
245+
#endif /* CONFIG_JSONC */
242246

243247
static void show_sfx_smart_log(struct nvme_additional_smart_log *smart,
244248
unsigned int nsid, const char *devname)
@@ -328,7 +332,9 @@ static int get_additional_smart_log(int argc, char **argv, struct command *cmd,
328332
"Get ScaleFlux vendor specific additional smart log (optionally, for the specified namespace), and show it.";
329333
const char *namespace = "(optional) desired namespace";
330334
const char *raw = "dump output in binary format";
335+
#ifdef CONFIG_JSONC
331336
const char *json = "Dump output in json format";
337+
#endif /* CONFIG_JSONC */
332338
struct nvme_dev *dev;
333339
struct config {
334340
__u32 namespace_id;

util/json.h

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,16 @@ struct json_object *util_json_object_new_uint128(nvme_uint128_t val);
5151
struct json_object *util_json_object_new_uint128(nvme_uint128_t val);
5252

5353
uint64_t util_json_object_get_uint64(struct json_object *obj);
54-
55-
#else /* !CONFIG_JSONC */
56-
54+
#else /* CONFIG_JSONC */
5755
struct json_object;
5856

5957
#define json_object_add_value_string(o, k, v)
60-
61-
#endif
62-
63-
#endif
58+
#define json_create_object(o) NULL
59+
#define json_free_object(o) ((void)(o))
60+
#define json_object_add_value_uint(o, k, v)
61+
#define json_object_add_value_int(o, k, v)
62+
#define json_print_object(o, u)
63+
#define json_object_add_value_double(o, k, v)
64+
#define json_object_add_value_object(o, k, v) ((void)(v))
65+
#endif /* CONFIG_JSONC */
66+
#endif /* __JSON__H */

0 commit comments

Comments
 (0)