[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 3/4] parallels: split check for parallels for
From: |
Jeff Cody |
Subject: |
Re: [Qemu-devel] [PATCH v2 3/4] parallels: split check for parallels format in parallels_open |
Date: |
Thu, 7 Aug 2014 10:32:32 -0400 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Mon, Jul 28, 2014 at 08:23:54PM +0400, Denis V. Lunev wrote:
> and rework error path a bit. There is no difference at the moment, but
> the code will be definitely shorter when additional processing will
> be required for WithouFreSpacExt
>
> Signed-off-by: Denis V. Lunev <address@hidden>
> CC: Jeff Cody <address@hidden>
> CC: Kevin Wolf <address@hidden>
> CC: Stefan Hajnoczi <address@hidden>
> ---
> block/parallels.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/block/parallels.c b/block/parallels.c
> index 16d14ad..466705e 100644
> --- a/block/parallels.c
> +++ b/block/parallels.c
> @@ -85,11 +85,11 @@ static int parallels_open(BlockDriverState *bs, QDict
> *options, int flags,
> goto fail;
> }
>
> - if (memcmp(ph.magic, HEADER_MAGIC, 16) ||
> - (le32_to_cpu(ph.version) != HEADER_VERSION)) {
> - error_setg(errp, "Image not in Parallels format");
> - ret = -EINVAL;
> - goto fail;
> + if (le32_to_cpu(ph.version) != HEADER_VERSION) {
> + goto fail_format;
> + }
> + if (memcmp(ph.magic, HEADER_MAGIC, 16)) {
> + goto fail_format;
> }
>
> bs->total_sectors = 0xffffffff & le64_to_cpu(ph.nb_sectors);
> @@ -120,6 +120,9 @@ static int parallels_open(BlockDriverState *bs, QDict
> *options, int flags,
> qemu_co_mutex_init(&s->lock);
> return 0;
>
> +fail_format:
> + error_setg(errp, "Image not in Parallels format");
> + ret = -EINVAL;
> fail:
> g_free(s->catalog_bitmap);
> return ret;
> --
> 1.9.1
>
>
Reviewed-by: Jeff Cody <address@hidden>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Qemu-devel] [PATCH v2 3/4] parallels: split check for parallels format in parallels_open,
Jeff Cody <=