On Fri, Aug 26, 2016 at 11:16:41AM +0200, Reda Sallahi wrote: > +static int img_dd_status(const char *arg, > + struct DdIo *in, struct DdIo *out, > + struct DdInfo *dd) > +{ > + const struct DdSymbols dd_status[] = { > + { "none", C_STATUS_NONE }, > + { "noxfer", C_STATUS_NOXFER }, > + { NULL, 0 } > + }; > + > + for (int j = 0; dd_status[j].name != NULL; j++) { > + if (!strcmp(arg, dd_status[j].name)) { > + dd->status = dd_status[j].value; > + return 0; > + } > + } Here you can use the existing flags parsing function if you change the function argument to unsigned int *flags_bits as mentioned in another reply. Then you can pass in &dd->status. > + > + error_report("invalid status level: '%s'", arg); > + return 1; > +} > > static int img_dd(int argc, char **argv) > { > @@ -4067,13 +4097,16 @@ static int img_dd(int argc, char **argv) > const char *out_filename; > int64_t size = 0, out_size = 0; > int64_t out_pos, in_pos, sparse_count = 0; > + int64_t in_read = 0, out_wrt = 0; /* Read/write count for status= */ > bool writethrough = false; > int flags = 0; > int ibsz = 0, obsz = 0, bsz; > + struct timeval starttv, endtv; Please use qemu_timeval instead of the system timeval type.