qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 5/7] qemu-img: add status option to dd


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v2 5/7] qemu-img: add status option to dd
Date: Tue, 13 Sep 2016 17:19:21 +0100
User-agent: Mutt/1.7.0 (2016-08-17)

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.

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]