7272#include "malloc.h"
7373
7474struct feat_cfg {
75- enum nvme_features_id feature_id ;
76- __u32 namespace_id ;
75+ enum nvme_features_id fid ;
76+ __u32 nsid ;
7777 enum nvme_get_features_sel sel ;
7878 __u32 cdw11 ;
7979 __u32 cdw12 ;
80- __u8 uuid_index ;
80+ __u8 uidx ;
8181 __u32 data_len ;
8282 bool raw_binary ;
8383 bool human_readable ;
@@ -4687,11 +4687,11 @@ static int get_feature_id(nvme_link_t l, struct feat_cfg *cfg,
46874687 void * * buf , __u32 * result )
46884688{
46894689 if (!cfg -> data_len )
4690- nvme_get_feature_length (cfg -> feature_id , cfg -> cdw11 ,
4690+ nvme_get_feature_length (cfg -> fid , cfg -> cdw11 ,
46914691 NVME_DATA_TFR_CTRL_TO_HOST ,
46924692 & cfg -> data_len );
46934693
4694- if (cfg -> feature_id == NVME_FEAT_FID_FDP_EVENTS ) {
4694+ if (cfg -> fid == NVME_FEAT_FID_FDP_EVENTS ) {
46954695 cfg -> data_len = 0xff * sizeof (__u16 );
46964696 cfg -> cdw11 |= 0xff << 16 ;
46974697 }
@@ -4705,8 +4705,8 @@ static int get_feature_id(nvme_link_t l, struct feat_cfg *cfg,
47054705 return -1 ;
47064706 }
47074707
4708- return nvme_get_features (l , cfg -> namespace_id , cfg -> feature_id , cfg -> sel ,
4709- cfg -> cdw11 , cfg -> uuid_index , * buf , cfg -> data_len , result );
4708+ return nvme_get_features (l , cfg -> nsid , cfg -> fid , cfg -> sel ,
4709+ cfg -> cdw11 , cfg -> uidx , * buf , cfg -> data_len , result );
47104710}
47114711
47124712static int filter_out_flags (int status )
@@ -4723,11 +4723,11 @@ static void get_feature_id_print(struct feat_cfg cfg, int err, __u32 result,
47234723
47244724 if (!err ) {
47254725 if (!cfg .raw_binary || !buf ) {
4726- nvme_feature_show (cfg .feature_id , cfg .sel , result );
4726+ nvme_feature_show (cfg .fid , cfg .sel , result );
47274727 if (NVME_CHECK (cfg .sel , GET_FEATURES_SEL , SUPPORTED ))
4728- nvme_show_select_result (cfg .feature_id , result );
4728+ nvme_show_select_result (cfg .fid , result );
47294729 else if (verbose || !strcmp (nvme_cfg .output_format , "json" ))
4730- nvme_feature_show_fields (cfg .feature_id , result , buf );
4730+ nvme_feature_show_fields (cfg .fid , result , buf );
47314731 else if (buf )
47324732 d (buf , cfg .data_len , 16 , 1 );
47334733 } else if (buf ) {
@@ -4774,7 +4774,7 @@ static int get_feature_id_changed(nvme_link_t l, struct feat_cfg cfg,
47744774 err_def = get_feature_id (l , & cfg , & buf_def , & result_def );
47754775 }
47764776
4777- if (!err && !is_get_feature_result_set (cfg .feature_id ))
4777+ if (!err && !is_get_feature_result_set (cfg .fid ))
47784778 result = cfg .cdw11 ;
47794779
47804780 if (err || !cfg .changed || err_def || result != result_def ||
@@ -4794,11 +4794,11 @@ static int get_feature_ids(nvme_link_t l, struct feat_cfg cfg,
47944794 int status = 0 ;
47954795 enum nvme_status_type type = NVME_STATUS_TYPE_NVME ;
47964796
4797- if (cfg .feature_id )
4798- feat_max = cfg .feature_id + 1 ;
4797+ if (cfg .fid )
4798+ feat_max = cfg .fid + 1 ;
47994799
4800- for (i = cfg .feature_id ; i < feat_max ; i ++ , feat_num ++ ) {
4801- cfg .feature_id = i ;
4800+ for (i = cfg .fid ; i < feat_max ; i ++ , feat_num ++ ) {
4801+ cfg .fid = i ;
48024802 err = get_feature_id_changed (l , cfg , flags );
48034803 if (!err )
48044804 continue ;
@@ -4807,8 +4807,8 @@ static int get_feature_ids(nvme_link_t l, struct feat_cfg cfg,
48074807 continue ;
48084808 if (!nvme_status_equals (status , type , NVME_SC_INVALID_NS ))
48094809 break ;
4810- nvme_show_error_status (err , "get-feature:%#0*x (%s)" , cfg .feature_id ? 4 : 2 ,
4811- cfg .feature_id , nvme_feature_to_string (cfg .feature_id ));
4810+ nvme_show_error_status (err , "get-feature:%#0*x (%s)" , cfg .fid ? 4 : 2 ,
4811+ cfg .fid , nvme_feature_to_string (cfg .fid ));
48124812 }
48134813
48144814 if (feat_num == 1 && nvme_status_equals (status , type , NVME_SC_INVALID_FIELD ))
@@ -4842,24 +4842,24 @@ static int get_feature(int argc, char **argv, struct command *cmd,
48424842 int err ;
48434843
48444844 struct feat_cfg cfg = {
4845- .feature_id = 0 ,
4846- .namespace_id = 0 ,
4845+ .fid = 0 ,
4846+ .nsid = 0 ,
48474847 .sel = NVME_GET_FEATURES_SEL_CURRENT ,
48484848 .data_len = 0 ,
48494849 .raw_binary = false,
48504850 .cdw11 = 0 ,
4851- .uuid_index = 0 ,
4851+ .uidx = 0 ,
48524852 .human_readable = false,
48534853 };
48544854
48554855 NVME_ARGS (opts ,
4856- OPT_BYTE ("feature-id" , 'f' , & cfg .feature_id , feature_id , feature_name ),
4857- OPT_UINT ("namespace-id" , 'n' , & cfg .namespace_id , namespace_id_desired ),
4856+ OPT_BYTE ("feature-id" , 'f' , & cfg .fid , feature_id , feature_name ),
4857+ OPT_UINT ("namespace-id" , 'n' , & cfg .nsid , namespace_id_desired ),
48584858 OPT_BYTE ("sel" , 's' , & cfg .sel , sel ),
48594859 OPT_UINT ("data-len" , 'l' , & cfg .data_len , buf_len ),
48604860 OPT_FLAG ("raw-binary" , 'b' , & cfg .raw_binary , raw ),
48614861 OPT_UINT ("cdw11" , 'c' , & cfg .cdw11 , cdw11 ),
4862- OPT_BYTE ("uuid-index" , 'U' , & cfg .uuid_index , uuid_index_specify ),
4862+ OPT_BYTE ("uuid-index" , 'U' , & cfg .uidx , uuid_index_specify ),
48634863 OPT_FLAG ("human-readable" , 'H' , & cfg .human_readable , human_readable ),
48644864 OPT_FLAG ("changed" , 'C' , & cfg .changed , changed ));
48654865
@@ -4874,13 +4874,13 @@ static int get_feature(int argc, char **argv, struct command *cmd,
48744874 }
48754875
48764876 if (!argconfig_parse_seen (opts , "namespace-id" )) {
4877- err = nvme_get_nsid (l , & cfg .namespace_id );
4877+ err = nvme_get_nsid (l , & cfg .nsid );
48784878 if (err < 0 ) {
48794879 if (err != - ENOTTY ) {
48804880 nvme_show_error ("get-namespace-id: %s" , nvme_strerror (- err ));
48814881 return err ;
48824882 }
4883- cfg .namespace_id = NVME_NSID_ALL ;
4883+ cfg .nsid = NVME_NSID_ALL ;
48844884 }
48854885 }
48864886
@@ -4889,8 +4889,8 @@ static int get_feature(int argc, char **argv, struct command *cmd,
48894889 return - EINVAL ;
48904890 }
48914891
4892- if (cfg .uuid_index > 127 ) {
4893- nvme_show_error ("invalid uuid index param: %u" , cfg .uuid_index );
4892+ if (cfg .uidx > 127 ) {
4893+ nvme_show_error ("invalid uuid index param: %u" , cfg .uidx );
48944894 return -1 ;
48954895 }
48964896
0 commit comments