qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: jemmy858585@gmail.com
Cc: qemu-devel@nongnu.org, kwolf@redhat.com,
	Lidong Chen <lidongchen@tencent.com>,
	qemu-block@nongnu.org, mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH] qemu-img: check bs_n when use old style option
Date: Thu, 20 Apr 2017 15:51:28 +0800	[thread overview]
Message-ID: <20170420075128.GD24486@lemon.lan> (raw)
In-Reply-To: <1492661065-18510-1-git-send-email-lidongchen@tencent.com>

On Thu, 04/20 12:04, jemmy858585@gmail.com wrote:
> From: Lidong Chen <lidongchen@tencent.com>
> 
> When use old style option like -o backing_file, img_convert
> continue run when bs_n > 1, this patch fix this bug.
> 
> Signed-off-by: Lidong Chen <lidongchen@tencent.com>
> ---
>  qemu-img.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/qemu-img.c b/qemu-img.c
> index b220cf7..c673aef 100644
> --- a/qemu-img.c
> +++ b/qemu-img.c
> @@ -2225,6 +2225,13 @@ static int img_convert(int argc, char **argv)
>          out_baseimg = out_baseimg_param;
>      }
>  
> +    if (bs_n > 1 && out_baseimg) {
> +        error_report("-B makes no sense when concatenating multiple input "
> +                     "images");
> +        ret = -1;
> +        goto out;
> +    }
> +
>      /* Check if compression is supported */
>      if (compress) {
>          bool encryption =
> -- 
> 1.8.3.1
> 
> 

Is this essentially the same as the check a few lines above:

    ...
    if (bs_n < 1) {
        error_exit("Must specify image file name");
    }


    if (bs_n > 1 && out_baseimg) {
        error_report("-B makes no sense when concatenating multiple input "
                     "images");
        ret = -1;
        goto out;
    }

    src_flags = 0;
    ret = bdrv_parse_cache_mode(src_cache, &src_flags, &src_writethrough);
    if (ret < 0) {
        error_report("Invalid source cache option: %s", src_cache);
        goto out;
    }
    ...

How about moving that down?

Fam

  reply	other threads:[~2017-04-20  7:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-20  4:04 [Qemu-devel] [PATCH] qemu-img: check bs_n when use old style option jemmy858585
2017-04-20  7:51 ` Fam Zheng [this message]
2017-04-20  7:59   ` 858585 jemmy
2017-04-20  8:11     ` Fam Zheng
2017-04-20  8:16       ` 858585 jemmy

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=20170420075128.GD24486@lemon.lan \
    --to=famz@redhat.com \
    --cc=jemmy858585@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=lidongchen@tencent.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).