@@ -6630,11 +6630,11 @@ static int set_feature(int argc, char **argv, struct command *cmd, struct plugin
66306630 "for each Feature are vendor-specific and may not be modified."
66316631 "Use get-feature to determine which Features are supported by"
66326632 "the controller and are saveable/changeable." ;
6633- const char * feature_id = "feature identifier (required)" ;
6633+ const char * fid = "feature identifier (required)" ;
66346634 const char * data = "optional file for feature data (default stdin)" ;
66356635 const char * value = "new value of feature (required)" ;
66366636 const char * cdw12 = "feature cdw12, if used" ;
6637- const char * save = "specifies that the controller shall save the attribute" ;
6637+ const char * sv = "specifies that the controller shall save the attribute" ;
66386638
66396639 _cleanup_nvme_root_ nvme_root_t r = NULL ;
66406640 _cleanup_nvme_link_ nvme_link_t l = NULL ;
@@ -6645,35 +6645,35 @@ static int set_feature(int argc, char **argv, struct command *cmd, struct plugin
66456645 nvme_print_flags_t flags ;
66466646
66476647 struct config {
6648- __u32 namespace_id ;
6649- __u8 feature_id ;
6648+ __u32 nsid ;
6649+ __u8 fid ;
66506650 __u64 value ;
66516651 __u32 cdw12 ;
6652- __u8 uuid_index ;
6652+ __u8 uidx ;
66536653 __u32 data_len ;
66546654 char * file ;
6655- bool save ;
6655+ bool sv ;
66566656 };
66576657
66586658 struct config cfg = {
6659- .namespace_id = 0 ,
6660- .feature_id = 0 ,
6659+ .nsid = 0 ,
6660+ .fid = 0 ,
66616661 .value = 0 ,
6662- .uuid_index = 0 ,
6662+ .uidx = 0 ,
66636663 .data_len = 0 ,
66646664 .file = "" ,
6665- .save = false,
6665+ .sv = false,
66666666 };
66676667
66686668 NVME_ARGS (opts ,
6669- OPT_UINT ("namespace-id" , 'n' , & cfg .namespace_id , namespace_desired ),
6670- OPT_BYTE ("feature-id" , 'f' , & cfg .feature_id , feature_id , feature_name ),
6671- OPT_SUFFIX ("value" , 'V' , & cfg .value , value ),
6672- OPT_UINT ("cdw12" , 'c' , & cfg .cdw12 , cdw12 ),
6673- OPT_BYTE ("uuid-index" , 'U' , & cfg .uuid_index , uuid_index_specify ),
6674- OPT_UINT ("data-len" , 'l' , & cfg .data_len , buf_len ),
6675- OPT_FILE ("data" , 'd' , & cfg .file , data ),
6676- OPT_FLAG ("save" , 's' , & cfg .save , save ));
6669+ OPT_UINT ("namespace-id" , 'n' , & cfg .nsid , namespace_desired ),
6670+ OPT_BYTE ("feature-id" , 'f' , & cfg .fid , fid , feature_name ),
6671+ OPT_SUFFIX ("value" , 'V' , & cfg .value , value ),
6672+ OPT_UINT ("cdw12" , 'c' , & cfg .cdw12 , cdw12 ),
6673+ OPT_BYTE ("uuid-index" , 'U' , & cfg .uidx , uuid_index_specify ),
6674+ OPT_UINT ("data-len" , 'l' , & cfg .data_len , buf_len ),
6675+ OPT_FILE ("data" , 'd' , & cfg .file , data ),
6676+ OPT_FLAG ("save" , 's' , & cfg .sv , sv ));
66776677
66786678 err = parse_and_open (& r , & l , argc , argv , desc , opts );
66796679 if (err )
@@ -6686,28 +6686,28 @@ static int set_feature(int argc, char **argv, struct command *cmd, struct plugin
66866686 }
66876687
66886688 if (!argconfig_parse_seen (opts , "namespace-id" )) {
6689- err = nvme_get_nsid (l , & cfg .namespace_id );
6689+ err = nvme_get_nsid (l , & cfg .nsid );
66906690 if (err < 0 ) {
66916691 if (err != - ENOTTY ) {
66926692 nvme_show_error ("get-namespace-id: %s" , nvme_strerror (- err ));
66936693 return err ;
66946694 }
6695- cfg .namespace_id = NVME_NSID_ALL ;
6695+ cfg .nsid = NVME_NSID_ALL ;
66966696 }
66976697 }
66986698
6699- if (!cfg .feature_id ) {
6699+ if (!cfg .fid ) {
67006700 nvme_show_error ("feature-id required param" );
67016701 return - EINVAL ;
67026702 }
67036703
6704- if (cfg .uuid_index > 127 ) {
6705- nvme_show_error ("invalid uuid index param: %u" , cfg .uuid_index );
6704+ if (cfg .uidx > 127 ) {
6705+ nvme_show_error ("invalid uuid index param: %u" , cfg .uidx );
67066706 return -1 ;
67076707 }
67086708
67096709 if (!cfg .data_len )
6710- nvme_get_feature_length (cfg .feature_id , cfg .value ,
6710+ nvme_get_feature_length (cfg .fid , cfg .value ,
67116711 NVME_DATA_TFR_HOST_TO_CTRL ,
67126712 & cfg .data_len );
67136713
@@ -6724,7 +6724,7 @@ static int set_feature(int argc, char **argv, struct command *cmd, struct plugin
67246724 * should use the buffer method if the value exceeds this
67256725 * length.
67266726 */
6727- if (cfg .feature_id == NVME_FEAT_FID_TIMESTAMP &&
6727+ if (cfg .fid == NVME_FEAT_FID_TIMESTAMP &&
67286728 argconfig_parse_seen (opts , "value" )) {
67296729 memcpy (buf , & cfg .value , NVME_FEAT_TIMESTAMP_DATA_SIZE );
67306730 } else {
@@ -6746,33 +6746,20 @@ static int set_feature(int argc, char **argv, struct command *cmd, struct plugin
67466746 }
67476747 }
67486748
6749- struct nvme_set_features_args args = {
6750- .args_size = sizeof (args ),
6751- .fid = cfg .feature_id ,
6752- .nsid = cfg .namespace_id ,
6753- .cdw11 = cfg .value ,
6754- .cdw12 = cfg .cdw12 ,
6755- .save = cfg .save ,
6756- .uuidx = cfg .uuid_index ,
6757- .cdw15 = 0 ,
6758- .data_len = cfg .data_len ,
6759- .data = buf ,
6760- .timeout = nvme_cfg .timeout ,
6761- .result = & result ,
6762- };
6763- err = nvme_set_features (l , & args );
6749+ err = nvme_set_features (l , cfg .nsid , cfg .fid , cfg .sv , cfg .value , cfg .cdw12 ,
6750+ 0 , 0 , cfg .uidx , buf , cfg .data_len , & result );
67646751 if (err < 0 ) {
67656752 nvme_show_error ("set-feature: %s" , nvme_strerror (- err ));
67666753 } else if (!err ) {
67676754 printf ("set-feature:%#0*x (%s), value:%#0*" PRIx64 ", cdw12:%#0*x, save:%#x\n" ,
6768- cfg .feature_id ? 4 : 2 , cfg .feature_id ,
6769- nvme_feature_to_string (cfg .feature_id ),
6755+ cfg .fid ? 4 : 2 , cfg .fid ,
6756+ nvme_feature_to_string (cfg .fid ),
67706757 cfg .value ? 10 : 8 , (uint64_t )cfg .value ,
6771- cfg .cdw12 ? 10 : 8 , cfg .cdw12 , cfg .save );
6772- if (cfg .feature_id == NVME_FEAT_FID_LBA_STS_INTERVAL )
6758+ cfg .cdw12 ? 10 : 8 , cfg .cdw12 , cfg .sv );
6759+ if (cfg .fid == NVME_FEAT_FID_LBA_STS_INTERVAL )
67736760 nvme_show_lba_status_info (result );
67746761 if (buf ) {
6775- if (cfg .feature_id == NVME_FEAT_FID_LBA_RANGE )
6762+ if (cfg .fid == NVME_FEAT_FID_LBA_RANGE )
67766763 nvme_show_lba_range ((struct nvme_lba_range_type * )buf , result , 0 );
67776764 else
67786765 d (buf , cfg .data_len , 16 , 1 );
0 commit comments