Skip to content

Commit 0911971

Browse files
committed
feat: add FEAT_ARGS to use instead of NVME_ARGS
Includes save and sel options for all nvme feat plugin commands. Signed-off-by: Tokunori Ikegami <[email protected]>
1 parent 2b2cbf7 commit 0911971

2 files changed

Lines changed: 10 additions & 12 deletions

File tree

plugins/feat/feat-nvme.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,9 @@ static int feat_power_mgmt(int argc, char **argv, struct command *cmd, struct pl
108108

109109
struct config cfg = { 0 };
110110

111-
NVME_ARGS(opts,
111+
FEAT_ARGS(opts,
112112
OPT_BYTE("ps", 'p', &cfg.ps, ps),
113-
OPT_BYTE("wh", 'w', &cfg.wh, wh),
114-
OPT_FLAG("save", 's', &cfg.save, save),
115-
OPT_BYTE("sel", 'S', &cfg.sel, sel));
113+
OPT_BYTE("wh", 'w', &cfg.wh, wh));
116114

117115
err = parse_and_open(&dev, argc, argv, POWER_MGMT_DESC, opts);
118116
if (err)
@@ -239,16 +237,14 @@ static int feat_perfc(int argc, char **argv, struct command *cmd, struct plugin
239237

240238
struct perfc_config cfg = { 0 };
241239

242-
NVME_ARGS(opts,
240+
FEAT_ARGS(opts,
243241
OPT_UINT("namespace-id", 'n', &cfg.namespace_id, namespace_id_optional),
244242
OPT_BYTE("attri", 'a', &cfg.attri, attri),
245243
OPT_FLAG("rvspa", 'r', &cfg.rvspa, rvspa),
246244
OPT_BYTE("r4karl", 'R', &cfg.r4karl, r4karl),
247245
OPT_STR("paid", 'p', &cfg.paid, paid),
248246
OPT_SHRT("attrl", 'A', &cfg.attrl, attrl),
249-
OPT_FILE("vs-data", 'V', &cfg.vs_data, vs_data),
250-
OPT_FLAG("save", 's', &cfg.save, save),
251-
OPT_BYTE("sel", 'S', &cfg.sel, sel));
247+
OPT_FILE("vs-data", 'V', &cfg.vs_data, vs_data));
252248

253249
err = parse_and_open(&dev, argc, argv, PERFC_DESC, opts);
254250
if (err)
@@ -340,11 +336,9 @@ static int feat_hctm(int argc, char **argv, struct command *cmd, struct plugin *
340336

341337
struct config cfg = { 0 };
342338

343-
NVME_ARGS(opts,
339+
FEAT_ARGS(opts,
344340
OPT_SHRT("tmt1", 't', &cfg.tmt1, TMT(1)),
345-
OPT_SHRT("tmt2", 'T', &cfg.tmt2, TMT(2)),
346-
OPT_FLAG("save", 's', &cfg.save, save),
347-
OPT_BYTE("sel", 'S', &cfg.sel, sel));
341+
OPT_SHRT("tmt2", 'T', &cfg.tmt2, TMT(2)));
348342

349343
err = parse_and_open(&dev, argc, argv, HCTM_DESC, opts);
350344
if (err)

plugins/feat/feat-nvme.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
#define PERFC_DESC "Get and set perf characteristics feature"
1515
#define HCTM_DESC "Get and set host controlled thermal management feature"
1616

17+
#define FEAT_ARGS(n, ...) \
18+
NVME_ARGS(n, ##__VA_ARGS__, OPT_FLAG("save", 's', &cfg.save, save), \
19+
OPT_BYTE("sel", 'S', &cfg.sel, sel))
20+
1721
PLUGIN(NAME("feat", "NVMe feature extensions", FEAT_PLUGIN_VERSION),
1822
COMMAND_LIST(
1923
ENTRY("power-mgmt", POWER_MGMT_DESC, feat_power_mgmt)

0 commit comments

Comments
 (0)