All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Reda Sallahi <fullmanet@gmail.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
	Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>,
	Fam Zheng <famz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 5/7] qemu-img: add status option to dd
Date: Tue, 13 Sep 2016 17:19:21 +0100	[thread overview]
Message-ID: <20160913161921.GF5677@stefanha-x1.localdomain> (raw)
In-Reply-To: <20160826091643.15841-6-fullmanet@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1403 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

  reply	other threads:[~2016-09-13 16:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-26  9:16 [Qemu-devel] [PATCH v2 0/7] qemu-img dd Reda Sallahi
2016-08-26  9:16 ` [Qemu-devel] [PATCH v2 1/7] qemu-img: add seek option to dd Reda Sallahi
2016-08-26  9:16 ` [Qemu-devel] [PATCH v2 2/7] qemu-img: add iflag and oflag options " Reda Sallahi
2016-09-13 15:48   ` Stefan Hajnoczi
2016-08-26  9:16 ` [Qemu-devel] [PATCH v2 3/7] qemu-img: add more conv= conversions " Reda Sallahi
2016-09-13 16:06   ` Stefan Hajnoczi
2016-08-26  9:16 ` [Qemu-devel] [PATCH v2 4/7] qemu-img: delete not used variable and an unecessary check Reda Sallahi
2016-08-26  9:16 ` [Qemu-devel] [PATCH v2 5/7] qemu-img: add status option to dd Reda Sallahi
2016-09-13 16:19   ` Stefan Hajnoczi [this message]
2016-08-26  9:16 ` [Qemu-devel] [PATCH v2 6/7] qemu-img: clean up dd documentation Reda Sallahi
2016-09-13 16:31   ` Eric Blake
2016-08-26  9:16 ` [Qemu-devel] [PATCH v2 7/7] qemu-img: add a test suite for the count option Reda Sallahi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160913161921.GF5677@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=famz@redhat.com \
    --cc=fullmanet@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.