diff --git a/plugins/dapustor/dapustor-nvme.c b/plugins/dapustor/dapustor-nvme.c index b86f9ab4a9..8dc12d553e 100644 --- a/plugins/dapustor/dapustor-nvme.c +++ b/plugins/dapustor/dapustor-nvme.c @@ -532,9 +532,7 @@ 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_FLAG_JSON("json", 'j', &cfg.json, json), OPT_END() }; diff --git a/plugins/intel/intel-nvme.c b/plugins/intel/intel-nvme.c index 9014d198c3..e5c896c2c3 100644 --- a/plugins/intel/intel-nvme.c +++ b/plugins/intel/intel-nvme.c @@ -365,9 +365,7 @@ static int get_additional_smart_log(int argc, char **argv, struct command *cmd, 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_FLAG_JSON("json", 'j', &cfg.json, json), OPT_END() }; @@ -1069,9 +1067,7 @@ static int get_lat_stats_log(int argc, char **argv, struct command *cmd, struct OPT_ARGS(opts) = { OPT_FLAG("write", 'w', &cfg.write, write), OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw), -#ifdef CONFIG_JSONC - OPT_FLAG("json", 'j', &cfg.json, json), -#endif /* CONFIG_JSONC */ + OPT_FLAG_JSON("json", 'j', &cfg.json, json), OPT_END() }; diff --git a/plugins/scaleflux/sfx-nvme.c b/plugins/scaleflux/sfx-nvme.c index f6bcad01a9..9363d93fde 100644 --- a/plugins/scaleflux/sfx-nvme.c +++ b/plugins/scaleflux/sfx-nvme.c @@ -344,7 +344,7 @@ static int get_additional_smart_log(int argc, char **argv, struct command *cmd, OPT_ARGS(opts) = { OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace), OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw), - OPT_FLAG("json", 'j', &cfg.json, json), + OPT_FLAG_JSON("json", 'j', &cfg.json, json), OPT_END() }; diff --git a/plugins/ssstc/ssstc-nvme.c b/plugins/ssstc/ssstc-nvme.c index 302df98807..5cbc8f96a3 100644 --- a/plugins/ssstc/ssstc-nvme.c +++ b/plugins/ssstc/ssstc-nvme.c @@ -402,7 +402,7 @@ int ssstc_get_add_smart_log(int argc, char **argv, struct command *cmd, struct p OPT_ARGS(opts) = { OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace), OPT_FLAG("raw-binary", 'b', &cfg.raw_binary, raw), - OPT_FLAG("json", 'j', &cfg.json, json), + OPT_FLAG_JSON("json", 'j', &cfg.json, json), OPT_END() }; diff --git a/util/argconfig.h b/util/argconfig.h index 3dff25a327..44d2e4e6ab 100644 --- a/util/argconfig.h +++ b/util/argconfig.h @@ -96,6 +96,12 @@ enum argconfig_types { #define OPT_LIST(l, s, v, d, ...) OPT_STRING(l, s, "LIST", v, d, __VA_ARGS__) #define OPT_STR(l, s, v, d, ...) OPT_STRING(l, s, "STRING", v, d, __VA_ARGS__) +#ifdef CONFIG_JSONC +#define OPT_FLAG_JSON(l, s, v, d, ...) OPT_FLAG(l, s, v, d, __VA_ARGS__) +#else /* CONFIG_JSONC */ +#define OPT_FLAG_JSON(l, s, v, d, ...) OPT_END() +#endif /* CONFIG_JSONC */ + #define OPT_VALS(n) \ struct argconfig_opt_val n[]