@@ -34,30 +34,25 @@ static int fdp_configs(int argc, char **argv, struct command *acmd,
3434
3535 struct config {
3636 __u16 egid ;
37- char * output_format ;
3837 bool human_readable ;
3938 bool raw_binary ;
4039 };
4140
4241 struct config cfg = {
4342 .egid = 0 ,
44- .output_format = "normal" ,
4543 .raw_binary = false,
4644 };
4745
48- OPT_ARGS (opts ) = {
46+ NVME_ARGS (opts ,
4947 OPT_UINT ("endgrp-id" , 'e' , & cfg .egid , egid ),
50- OPT_FMT ("output-format" , 'o' , & cfg .output_format , output_format ),
5148 OPT_FLAG ("raw-binary" , 'b' , & cfg .raw_binary , raw ),
52- OPT_FLAG ("human-readable" , 'H' , & cfg .human_readable , human_readable ),
53- OPT_END ()
54- };
49+ OPT_FLAG ("human-readable" , 'H' , & cfg .human_readable , human_readable ));
5550
5651 err = parse_and_open (& ctx , & hdl , argc , argv , desc , opts );
5752 if (err )
5853 return err ;
5954
60- err = validate_output_format (cfg .output_format , & flags );
55+ err = validate_output_format (nvme_args .output_format , & flags );
6156 if (err < 0 )
6257 return err ;
6358
@@ -116,22 +111,18 @@ static int fdp_usage(int argc, char **argv, struct command *acmd, struct plugin
116111
117112 struct config cfg = {
118113 .egid = 0 ,
119- .output_format = "normal" ,
120114 .raw_binary = false,
121115 };
122116
123- OPT_ARGS (opts ) = {
117+ NVME_ARGS (opts ,
124118 OPT_UINT ("endgrp-id" , 'e' , & cfg .egid , egid ),
125- OPT_FMT ("output-format" , 'o' , & cfg .output_format , output_format ),
126- OPT_FLAG ("raw-binary" , 'b' , & cfg .raw_binary , raw ),
127- OPT_END ()
128- };
119+ OPT_FLAG ("raw-binary" , 'b' , & cfg .raw_binary , raw ));
129120
130121 err = parse_and_open (& ctx , & hdl , argc , argv , desc , opts );
131122 if (err )
132123 return err ;
133124
134- err = validate_output_format (cfg .output_format , & flags );
125+ err = validate_output_format (nvme_args .output_format , & flags );
135126 if (err < 0 )
136127 return err ;
137128
@@ -186,12 +177,9 @@ static int fdp_stats(int argc, char **argv, struct command *acmd, struct plugin
186177 .raw_binary = false,
187178 };
188179
189- OPT_ARGS (opts ) = {
180+ NVME_ARGS (opts ,
190181 OPT_UINT ("endgrp-id" , 'e' , & cfg .egid , egid ),
191- OPT_FMT ("output-format" , 'o' , & cfg .output_format , output_format ),
192- OPT_FLAG ("raw-binary" , 'b' , & cfg .raw_binary , raw ),
193- OPT_END ()
194- };
182+ OPT_FLAG ("raw-binary" , 'b' , & cfg .raw_binary , raw ));
195183
196184 err = parse_and_open (& ctx , & hdl , argc , argv , desc , opts );
197185 if (err )
@@ -238,30 +226,25 @@ static int fdp_events(int argc, char **argv, struct command *acmd, struct plugin
238226 struct config {
239227 __u16 egid ;
240228 bool host_events ;
241- char * output_format ;
242229 bool raw_binary ;
243230 };
244231
245232 struct config cfg = {
246233 .egid = 0 ,
247234 .host_events = false,
248- .output_format = "normal" ,
249235 .raw_binary = false,
250236 };
251237
252- OPT_ARGS (opts ) = {
238+ NVME_ARGS (opts ,
253239 OPT_UINT ("endgrp-id" , 'e' , & cfg .egid , egid ),
254240 OPT_FLAG ("host-events" , 'E' , & cfg .host_events , host_events ),
255- OPT_FMT ("output-format" , 'o' , & cfg .output_format , output_format ),
256- OPT_FLAG ("raw-binary" , 'b' , & cfg .raw_binary , raw ),
257- OPT_END ()
258- };
241+ OPT_FLAG ("raw-binary" , 'b' , & cfg .raw_binary , raw ));
259242
260243 err = parse_and_open (& ctx , & hdl , argc , argv , desc , opts );
261244 if (err )
262245 return err ;
263246
264- err = validate_output_format (cfg .output_format , & flags );
247+ err = validate_output_format (nvme_args .output_format , & flags );
265248 if (err < 0 )
266249 return err ;
267250
@@ -304,27 +287,22 @@ static int fdp_status(int argc, char **argv, struct command *acmd, struct plugin
304287
305288 struct config {
306289 __u32 nsid ;
307- char * output_format ;
308290 bool raw_binary ;
309291 };
310292
311293 struct config cfg = {
312- .output_format = "normal" ,
313294 .raw_binary = false,
314295 };
315296
316- OPT_ARGS (opts ) = {
317- OPT_UINT ("namespace-id" , 'n' , & cfg .nsid , namespace_id ),
318- OPT_FMT ("output-format" , 'o' , & cfg .output_format , output_format ),
319- OPT_FLAG ("raw-binary" , 'b' , & cfg .raw_binary , raw ),
320- OPT_END ()
321- };
297+ NVME_ARGS (opts ,
298+ OPT_UINT ("namespace-id" , 'n' , & cfg .nsid , namespace_id ),
299+ OPT_FLAG ("raw-binary" , 'b' , & cfg .raw_binary , raw ));
322300
323301 err = parse_and_open (& ctx , & hdl , argc , argv , desc , opts );
324302 if (err )
325303 return err ;
326304
327- err = validate_output_format (cfg .output_format , & flags );
305+ err = validate_output_format (nvme_args .output_format , & flags );
328306 if (err < 0 )
329307 return err ;
330308
@@ -388,11 +366,9 @@ static int fdp_update(int argc, char **argv, struct command *acmd, struct plugin
388366 .pids = "" ,
389367 };
390368
391- OPT_ARGS (opts ) = {
369+ NVME_ARGS (opts ,
392370 OPT_UINT ("namespace-id" , 'n' , & cfg .nsid , namespace_id ),
393- OPT_LIST ("pids" , 'p' , & cfg .pids , _pids ),
394- OPT_END ()
395- };
371+ OPT_LIST ("pids" , 'p' , & cfg .pids , _pids ));
396372
397373 err = parse_and_open (& ctx , & hdl , argc , argv , desc , opts );
398374 if (err )
@@ -459,14 +435,12 @@ static int fdp_set_events(int argc, char **argv, struct command *acmd, struct pl
459435 .sv = false,
460436 };
461437
462- OPT_ARGS (opts ) = {
438+ NVME_ARGS (opts ,
463439 OPT_UINT ("namespace-id" , 'n' , & cfg .nsid , nsid ),
464440 OPT_SHRT ("placement-handle" , 'p' , & cfg .ph , ph ),
465441 OPT_FLAG ("enable" , 'e' , & cfg .enable , enable ),
466442 OPT_FLAG ("save" , 's' , & cfg .sv , sv ),
467- OPT_LIST ("event-types" , 't' , & cfg .event_types , event_types ),
468- OPT_END ()
469- };
443+ OPT_LIST ("event-types" , 't' , & cfg .event_types , event_types ));
470444
471445 err = parse_and_open (& ctx , & hdl , argc , argv , desc , opts );
472446 if (err )
@@ -537,13 +511,10 @@ static int fdp_feature(int argc, char **argv, struct command *acmd, struct plugi
537511 .endgid = 0 ,
538512 };
539513
540- OPT_ARGS (opts ) = {
514+ NVME_ARGS (opts ,
541515 OPT_SHRT ("endgrp-id" , 'e' , & cfg .endgid , endurance_group ),
542516 OPT_BYTE ("enable-conf-idx" , 'c' , & cfg .fdpcidx , enable_conf_idx ),
543- OPT_FLAG ("disable" , 'd' , & cfg .disable , disable ),
544- OPT_INCR ("verbose" , 'v' , & nvme_args .verbose , verbose ),
545- OPT_END ()
546- };
517+ OPT_FLAG ("disable" , 'd' , & cfg .disable , disable ));
547518
548519 err = parse_and_open (& ctx , & hdl , argc , argv , desc , opts );
549520 if (err )
0 commit comments