@@ -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
@@ -102,24 +101,21 @@ static int feat_power_mgmt(int argc, char **argv, struct command *cmd, struct pl
102101 struct config {
103102 __u8 ps ;
104103 __u8 wh ;
105- bool save ;
106104 __u8 sel ;
107105 };
108106
109107 struct config cfg = { 0 };
110108
111- NVME_ARGS (opts ,
109+ FEAT_ARGS (opts ,
112110 OPT_BYTE ("ps" , 'p' , & cfg .ps , ps ),
113- OPT_BYTE ("wh" , 'w' , & cfg .wh , wh ),
114- OPT_FLAG ("save" , 's' , & cfg .save , save ),
115- OPT_BYTE ("sel" , 'S' , & cfg .sel , sel ));
111+ OPT_BYTE ("wh" , 'w' , & cfg .wh , wh ));
116112
117113 err = parse_and_open (& dev , argc , argv , POWER_MGMT_DESC , opts );
118114 if (err )
119115 return err ;
120116
121117 if (argconfig_parse_seen (opts , "ps" ))
122- err = power_mgmt_set (dev , fid , cfg .ps , cfg .wh , cfg . save );
118+ err = power_mgmt_set (dev , fid , cfg .ps , cfg .wh , argconfig_parse_seen ( opts , " save" ) );
123119 else
124120 err = power_mgmt_get (dev , fid , cfg .sel );
125121
@@ -239,16 +235,14 @@ static int feat_perfc(int argc, char **argv, struct command *cmd, struct plugin
239235
240236 struct perfc_config cfg = { 0 };
241237
242- NVME_ARGS (opts ,
238+ FEAT_ARGS (opts ,
243239 OPT_UINT ("namespace-id" , 'n' , & cfg .namespace_id , namespace_id_optional ),
244240 OPT_BYTE ("attri" , 'a' , & cfg .attri , attri ),
245241 OPT_FLAG ("rvspa" , 'r' , & cfg .rvspa , rvspa ),
246242 OPT_BYTE ("r4karl" , 'R' , & cfg .r4karl , r4karl ),
247243 OPT_STR ("paid" , 'p' , & cfg .paid , paid ),
248244 OPT_SHRT ("attrl" , 'A' , & cfg .attrl , attrl ),
249- OPT_FILE ("vs-data" , 'V' , & cfg .vs_data , vs_data ),
250- OPT_FLAG ("save" , 's' , & cfg .save , save ),
251- OPT_BYTE ("sel" , 'S' , & cfg .sel , sel ));
245+ OPT_FILE ("vs-data" , 'V' , & cfg .vs_data , vs_data ));
252246
253247 err = parse_and_open (& dev , argc , argv , PERFC_DESC , opts );
254248 if (err )
@@ -334,24 +328,21 @@ static int feat_hctm(int argc, char **argv, struct command *cmd, struct plugin *
334328 struct config {
335329 __u16 tmt1 ;
336330 __u16 tmt2 ;
337- bool save ;
338331 __u8 sel ;
339332 };
340333
341334 struct config cfg = { 0 };
342335
343- NVME_ARGS (opts ,
336+ FEAT_ARGS (opts ,
344337 OPT_SHRT ("tmt1" , 't' , & cfg .tmt1 , TMT (1 )),
345- OPT_SHRT ("tmt2" , 'T' , & cfg .tmt2 , TMT (2 )),
346- OPT_FLAG ("save" , 's' , & cfg .save , save ),
347- OPT_BYTE ("sel" , 'S' , & cfg .sel , sel ));
338+ OPT_SHRT ("tmt2" , 'T' , & cfg .tmt2 , TMT (2 )));
348339
349340 err = parse_and_open (& dev , argc , argv , HCTM_DESC , opts );
350341 if (err )
351342 return err ;
352343
353344 if (argconfig_parse_seen (opts , "tmt1" ) || argconfig_parse_seen (opts , "tmt2" ))
354- err = hctm_set (dev , fid , cfg .tmt1 , cfg .tmt2 , cfg . save );
345+ err = hctm_set (dev , fid , cfg .tmt1 , cfg .tmt2 , argconfig_parse_seen ( opts , " save" ) );
355346 else
356347 err = hctm_get (dev , fid , cfg .sel );
357348
0 commit comments