@@ -5230,8 +5230,8 @@ static int fw_commit(int argc, char **argv, struct command *cmd, struct plugin *
52305230 "reset following firmware activation. A reset may be issued "
52315231 "with an 'echo 1 > /sys/class/nvme/nvmeX/reset_controller'. "
52325232 "Ensure nvmeX is the device you just activated before reset." ;
5233- const char * slot = "[0-7]: firmware slot for commit action" ;
5234- const char * action = "[0-7]: commit action" ;
5233+ const char * fs = "[0-7]: firmware slot for commit action" ;
5234+ const char * ca = "[0-7]: commit action" ;
52355235 const char * bpid = "[0,1]: boot partition identifier, if applicable (default: 0)" ;
52365236
52375237 _cleanup_nvme_root_ nvme_root_t r = NULL ;
@@ -5241,21 +5241,21 @@ static int fw_commit(int argc, char **argv, struct command *cmd, struct plugin *
52415241 nvme_print_flags_t flags ;
52425242
52435243 struct config {
5244- __u8 slot ;
5245- __u8 action ;
5244+ __u8 fs ;
5245+ __u8 ca ;
52465246 __u8 bpid ;
52475247 };
52485248
52495249 struct config cfg = {
5250- .slot = 0 ,
5251- .action = 0 ,
5250+ .fs = 0 ,
5251+ .ca = 0 ,
52525252 .bpid = 0 ,
52535253 };
52545254
52555255 NVME_ARGS (opts ,
5256- OPT_BYTE ("slot" , 's' , & cfg .slot , slot ),
5257- OPT_BYTE ("action" , 'a' , & cfg .action , action ),
5258- OPT_BYTE ("bpid" , 'b' , & cfg .bpid , bpid ));
5256+ OPT_BYTE ("slot" , 's' , & cfg .fs , fs ),
5257+ OPT_BYTE ("action" , 'a' , & cfg .ca , ca ),
5258+ OPT_BYTE ("bpid" , 'b' , & cfg .bpid , bpid ));
52595259
52605260 err = parse_and_open (& r , & l , argc , argv , desc , opts );
52615261 if (err )
@@ -5267,29 +5267,20 @@ static int fw_commit(int argc, char **argv, struct command *cmd, struct plugin *
52675267 return err ;
52685268 }
52695269
5270- if (cfg .slot > 7 ) {
5271- nvme_show_error ("invalid slot:%d" , cfg .slot );
5270+ if (cfg .fs > 7 ) {
5271+ nvme_show_error ("invalid slot:%d" , cfg .fs );
52725272 return - EINVAL ;
52735273 }
5274- if (cfg .action > 7 || cfg .action == 4 || cfg .action == 5 ) {
5275- nvme_show_error ("invalid action:%d" , cfg .action );
5274+ if (cfg .ca > 7 || cfg .ca == 4 || cfg .ca == 5 ) {
5275+ nvme_show_error ("invalid action:%d" , cfg .ca );
52765276 return - EINVAL ;
52775277 }
52785278 if (cfg .bpid > 1 ) {
52795279 nvme_show_error ("invalid boot partition id:%d" , cfg .bpid );
52805280 return - EINVAL ;
52815281 }
52825282
5283- struct nvme_fw_commit_args args = {
5284- .args_size = sizeof (args ),
5285- .slot = cfg .slot ,
5286- .action = cfg .action ,
5287- .bpid = cfg .bpid ,
5288- .timeout = nvme_cfg .timeout ,
5289- .result = & result ,
5290- };
5291-
5292- err = nvme_fw_commit (l , & args );
5283+ err = nvme_fw_commit (l , cfg .fs , cfg .ca , cfg .bpid , & result );
52935284 if (err < 0 ) {
52945285 nvme_show_error ("fw-commit: %s" , nvme_strerror (- err ));
52955286 } else if (err != 0 ) {
@@ -5302,8 +5293,8 @@ static int fw_commit(int argc, char **argv, struct command *cmd, struct plugin *
53025293 case NVME_SC_FW_NEEDS_SUBSYS_RESET :
53035294 case NVME_SC_FW_NEEDS_RESET :
53045295 printf ("Success activating firmware action:%d slot:%d" ,
5305- cfg .action , cfg .slot );
5306- if (cfg .action == 6 || cfg .action == 7 )
5296+ cfg .ca , cfg .fs );
5297+ if (cfg .ca == 6 || cfg .ca == 7 )
53075298 printf (" bpid:%d" , cfg .bpid );
53085299 printf (", but firmware requires %s reset\n" ,
53095300 nvme_fw_status_reset_type (val ));
@@ -5317,8 +5308,8 @@ static int fw_commit(int argc, char **argv, struct command *cmd, struct plugin *
53175308 }
53185309 } else {
53195310 printf ("Success committing firmware action:%d slot:%d" ,
5320- cfg .action , cfg .slot );
5321- if (cfg .action == 6 || cfg .action == 7 )
5311+ cfg .ca , cfg .fs );
5312+ if (cfg .ca == 6 || cfg .ca == 7 )
53225313 printf (" bpid:%d" , cfg .bpid );
53235314 printf ("\n" );
53245315 fw_commit_print_mud (l , result );
0 commit comments