Skip to content

Commit 86be4e0

Browse files
committed
nvme: add fw-commit command ca option values
Allow to set the ca definition names instead of the values. Signed-off-by: Tokunori Ikegami <[email protected]>
1 parent e262ca7 commit 86be4e0

3 files changed

Lines changed: 32 additions & 1 deletion

File tree

completions/_nvme

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,16 @@ _nvme () {
732732
;;
733733
esac
734734
;;
735+
(fw-commit)
736+
case ${words[CURRENT-1]} in
737+
(--action=|-a)
738+
_values '' 'replace' 'replace-and-activate' 'set-active' 'replace-and-activate-immediate' 'replace-boot-partition' 'activate-boot-partition'
739+
;;
740+
(*)
741+
_files
742+
;;
743+
esac
744+
;;
735745
(*)
736746
_files
737747
;;

completions/bash-nvme-completion.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,13 @@ nvme_list_opts () {
231231
;;
232232
"fw-commit")
233233
opts+=" --slot= -s --action= -a --bpid= -b --timeout= -t"
234+
case $opt in
235+
--action|-a)
236+
vals+=" replace replace-and-activate set-active \
237+
replace-and-activate-immediate
238+
replace-boot-partition activate-boot-partition"
239+
;;
240+
esac
234241
;;
235242
"fw-download")
236243
opts+=" --fw= -f --xfer= -x --offset= -O --timeout= -t"

nvme.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5290,9 +5290,23 @@ static int fw_commit(int argc, char **argv, struct command *acmd, struct plugin
52905290
.bpid = 0,
52915291
};
52925292

5293+
OPT_VALS(ca) = {
5294+
VAL_BYTE("replace", NVME_FW_COMMIT_CA_REPLACE),
5295+
VAL_BYTE("replace-and-activate",
5296+
NVME_FW_COMMIT_CA_REPLACE_AND_ACTIVATE),
5297+
VAL_BYTE("set-active", NVME_FW_COMMIT_CA_SET_ACTIVE),
5298+
VAL_BYTE("replace-and-activate-immediate",
5299+
NVME_FW_COMMIT_CA_REPLACE_AND_ACTIVATE_IMMEDIATE),
5300+
VAL_BYTE("replace-boot-partition",
5301+
NVME_FW_COMMIT_CA_REPLACE_BOOT_PARTITION),
5302+
VAL_BYTE("activate-boot-partition",
5303+
NVME_FW_COMMIT_CA_ACTIVATE_BOOT_PARTITION),
5304+
VAL_END()
5305+
};
5306+
52935307
NVME_ARGS(opts,
52945308
OPT_BYTE("slot", 's', &cfg.slot, slot),
5295-
OPT_BYTE("action", 'a', &cfg.action, action),
5309+
OPT_BYTE("action", 'a', &cfg.action, action, ca),
52965310
OPT_BYTE("bpid", 'b', &cfg.bpid, bpid));
52975311

52985312
err = parse_and_open(&ctx, &hdl, argc, argv, desc, opts);

0 commit comments

Comments
 (0)