@@ -19,7 +19,6 @@ struct perfc_config {
1919 char * paid ;
2020 __u16 attrl ;
2121 char * vs_data ;
22- bool save ;
2322 __u8 sel ;
2423};
2524
@@ -119,24 +118,21 @@ static int feat_power_mgmt(int argc, char **argv, struct command *cmd, struct pl
119118 struct config {
120119 __u8 ps ;
121120 __u8 wh ;
122- bool save ;
123121 __u8 sel ;
124122 };
125123
126124 struct config cfg = { 0 };
127125
128- NVME_ARGS (opts ,
126+ FEAT_ARGS (opts ,
129127 OPT_BYTE ("ps" , 'p' , & cfg .ps , ps ),
130- OPT_BYTE ("wh" , 'w' , & cfg .wh , wh ),
131- OPT_FLAG ("save" , 's' , & cfg .save , save ),
132- OPT_BYTE ("sel" , 'S' , & cfg .sel , sel ));
128+ OPT_BYTE ("wh" , 'w' , & cfg .wh , wh ));
133129
134130 err = parse_and_open (& dev , argc , argv , POWER_MGMT_DESC , opts );
135131 if (err )
136132 return err ;
137133
138134 if (argconfig_parse_seen (opts , "ps" ))
139- err = power_mgmt_set (dev , fid , cfg .ps , cfg .wh , cfg . save );
135+ err = power_mgmt_set (dev , fid , cfg .ps , cfg .wh , argconfig_parse_seen ( opts , " save" ) );
140136 else
141137 err = feat_get (dev , fid , 0 , cfg .sel , power_mgmt_feat );
142138
@@ -228,16 +224,14 @@ static int feat_perfc(int argc, char **argv, struct command *cmd, struct plugin
228224
229225 struct perfc_config cfg = { 0 };
230226
231- NVME_ARGS (opts ,
227+ FEAT_ARGS (opts ,
232228 OPT_UINT ("namespace-id" , 'n' , & cfg .namespace_id , namespace_id_optional ),
233229 OPT_BYTE ("attri" , 'a' , & cfg .attri , attri ),
234230 OPT_FLAG ("rvspa" , 'r' , & cfg .rvspa , rvspa ),
235231 OPT_BYTE ("r4karl" , 'R' , & cfg .r4karl , r4karl ),
236232 OPT_STR ("paid" , 'p' , & cfg .paid , paid ),
237233 OPT_SHRT ("attrl" , 'A' , & cfg .attrl , attrl ),
238- OPT_FILE ("vs-data" , 'V' , & cfg .vs_data , vs_data ),
239- OPT_FLAG ("save" , 's' , & cfg .save , save ),
240- OPT_BYTE ("sel" , 'S' , & cfg .sel , sel ));
234+ OPT_FILE ("vs-data" , 'V' , & cfg .vs_data , vs_data ));
241235
242236 err = parse_and_open (& dev , argc , argv , PERFC_DESC , opts );
243237 if (err )
@@ -298,24 +292,21 @@ static int feat_hctm(int argc, char **argv, struct command *cmd, struct plugin *
298292 struct config {
299293 __u16 tmt1 ;
300294 __u16 tmt2 ;
301- bool save ;
302295 __u8 sel ;
303296 };
304297
305298 struct config cfg = { 0 };
306299
307- NVME_ARGS (opts ,
300+ FEAT_ARGS (opts ,
308301 OPT_SHRT ("tmt1" , 't' , & cfg .tmt1 , TMT (1 )),
309- OPT_SHRT ("tmt2" , 'T' , & cfg .tmt2 , TMT (2 )),
310- OPT_FLAG ("save" , 's' , & cfg .save , save ),
311- OPT_BYTE ("sel" , 'S' , & cfg .sel , sel ));
302+ OPT_SHRT ("tmt2" , 'T' , & cfg .tmt2 , TMT (2 )));
312303
313304 err = parse_and_open (& dev , argc , argv , HCTM_DESC , opts );
314305 if (err )
315306 return err ;
316307
317308 if (argconfig_parse_seen (opts , "tmt1" ) || argconfig_parse_seen (opts , "tmt2" ))
318- err = hctm_set (dev , fid , cfg .tmt1 , cfg .tmt2 , cfg . save );
309+ err = hctm_set (dev , fid , cfg .tmt1 , cfg .tmt2 , argconfig_parse_seen ( opts , " save" ) );
319310 else
320311 err = feat_get (dev , fid , 0 , cfg .sel , hctm_feat );
321312
0 commit comments