qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 19/20] block: do not abuse EMEDIUMTYPE


From: Fam Zheng
Subject: Re: [Qemu-devel] [PATCH 19/20] block: do not abuse EMEDIUMTYPE
Date: Mon, 10 Feb 2014 16:47:22 +0800
User-agent: Mutt/1.5.22 (2013-10-16)

On Sun, 02/09 10:48, Paolo Bonzini wrote:
> diff --git a/block/bochs.c b/block/bochs.c
> index 51d9a90..f0f9a7e 100644
> --- a/block/bochs.c
> +++ b/block/bochs.c
> @@ -129,7 +129,8 @@ static int bochs_open(BlockDriverState *bs, QDict 
> *options, int flags,
>          strcmp(bochs.subtype, GROWING_TYPE) ||
>       ((le32_to_cpu(bochs.version) != HEADER_VERSION) &&
>       (le32_to_cpu(bochs.version) != HEADER_V1))) {
> -        return -EMEDIUMTYPE;
> +        error_setg(errp, "invalid Bochs image header\n");

Ending "\n" is not necessary, including all following cases.

> +        return -EINVAL;
>      }
>  
>      if (le32_to_cpu(bochs.version) == HEADER_V1) {

<snip>

> diff --git a/block/qcow2.c b/block/qcow2.c
> index 2da62b8..fa63d37 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -449,7 +449,7 @@ static int qcow2_open(BlockDriverState *bs, QDict 
> *options, int flags,
>  
>      if (header.magic != QCOW_MAGIC) {
>          error_setg(errp, "Image is not in qcow2 format");

It might be good to have a consistent message pattern in qcow2 as others. Is it
worth adding a QERR_ error class for unexpected format magic?

Fam

> -        ret = -EMEDIUMTYPE;
> +        ret = -EINVAL;
>          goto fail;
>      }
>      if (header.version < 2 || header.version > 3) {



reply via email to

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