From: Don Slutz <Don@CloudSwitch.com>
To: Stefan Weil <sw@weilnetz.de>
Cc: Kevin Wolf <kwolf@redhat.com>,
qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/4] block: Use new error code for wrong format in selected block drivers
Date: Sat, 15 Dec 2012 10:54:27 -0500 [thread overview]
Message-ID: <50CC9D33.8050808@CloudSwitch.com> (raw)
In-Reply-To: <1355580573-19323-4-git-send-email-sw@weilnetz.de>
On 12/15/12 09:09, Stefan Weil wrote:
> This improves error reports for bochs, cow, qcow, qcow2, qed and vmdk
> when a file with the wrong format is selected.
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
> block/bochs.c | 2 +-
> block/cow.c | 2 +-
> block/qcow.c | 2 +-
> block/qcow2.c | 2 +-
> block/qed.c | 2 +-
> block/vmdk.c | 4 ++--
> 6 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/block/bochs.c b/block/bochs.c
> index ab7944d..063dc3f 100644
> --- a/block/bochs.c
> +++ b/block/bochs.c
> @@ -126,7 +126,7 @@ static int bochs_open(BlockDriverState *bs, int flags)
> strcmp(bochs.subtype, GROWING_TYPE) ||
> ((le32_to_cpu(bochs.version) != HEADER_VERSION) &&
> (le32_to_cpu(bochs.version) != HEADER_V1))) {
> - goto fail;
> + return BDRV_WRONG_FORMAT;
As far as I can tell, all "goto fail" are this error, and so the
fail:
return -1;
Is what should be changed.
> }
>
> if (le32_to_cpu(bochs.version) == HEADER_V1) {
> diff --git a/block/cow.c b/block/cow.c
> index a5a00eb..7ae5ddc 100644
> --- a/block/cow.c
> +++ b/block/cow.c
> @@ -73,7 +73,7 @@ static int cow_open(BlockDriverState *bs, int flags)
> }
>
> if (be32_to_cpu(cow_header.magic) != COW_MAGIC) {
> - ret = -EINVAL;
> + ret = BDRV_WRONG_FORMAT;
> goto fail;
> }
>
> diff --git a/block/qcow.c b/block/qcow.c
> index b239c82..d1be009 100644
> --- a/block/qcow.c
> +++ b/block/qcow.c
> @@ -112,7 +112,7 @@ static int qcow_open(BlockDriverState *bs, int flags)
> be64_to_cpus(&header.l1_table_offset);
>
> if (header.magic != QCOW_MAGIC) {
> - ret = -EINVAL;
> + ret = BDRV_WRONG_FORMAT;
> goto fail;
> }
> if (header.version != QCOW_VERSION) {
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 8520bda..f22e387 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -311,7 +311,7 @@ static int qcow2_open(BlockDriverState *bs, int flags)
> be32_to_cpus(&header.nb_snapshots);
>
> if (header.magic != QCOW_MAGIC) {
> - ret = -EINVAL;
> + ret = BDRV_WRONG_FORMAT;
> goto fail;
> }
> if (header.version < 2 || header.version > 3) {
> diff --git a/block/qed.c b/block/qed.c
> index 0b5374a..58bd35c 100644
> --- a/block/qed.c
> +++ b/block/qed.c
> @@ -390,7 +390,7 @@ static int bdrv_qed_open(BlockDriverState *bs, int flags)
> qed_header_le_to_cpu(&le_header, &s->header);
>
> if (s->header.magic != QED_MAGIC) {
> - return -EINVAL;
> + return BDRV_WRONG_FORMAT;
> }
> if (s->header.features & ~QED_FEATURE_MASK) {
> /* image uses unsupported feature bits */
> diff --git a/block/vmdk.c b/block/vmdk.c
> index 51398c0..931ffbc 100644
> --- a/block/vmdk.c
> +++ b/block/vmdk.c
> @@ -616,7 +616,7 @@ static int vmdk_open_sparse(BlockDriverState *bs,
> return vmdk_open_vmdk4(bs, file, flags);
> break;
> default:
> - return -EINVAL;
> + return BDRV_WRONG_FORMAT;
> break;
> }
> }
> @@ -718,7 +718,7 @@ static int vmdk_open_desc_file(BlockDriverState *bs, int flags,
> }
> buf[2047] = '\0';
> if (vmdk_parse_description(buf, "createType", ct, sizeof(ct))) {
> - return -EINVAL;
> + return BDRV_WRONG_FORMAT;
> }
> if (strcmp(ct, "monolithicFlat") &&
> strcmp(ct, "twoGbMaxExtentSparse") &&
-Don Slutz
next prev parent reply other threads:[~2012-12-15 15:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-15 14:09 [Qemu-devel] [PATCH 0/4] block: Fix error report for wrong file format Stefan Weil
2012-12-15 14:09 ` [Qemu-devel] [PATCH 1/4] block: Add special error code for wrong format Stefan Weil
2012-12-18 14:34 ` Stefan Hajnoczi
2013-01-17 12:01 ` Kevin Wolf
2012-12-15 14:09 ` [Qemu-devel] [PATCH 2/4] block: Improve error report " Stefan Weil
2012-12-17 15:08 ` Luiz Capitulino
2012-12-15 14:09 ` [Qemu-devel] [PATCH 3/4] block: Use new error code for wrong format in selected block drivers Stefan Weil
2012-12-15 15:54 ` Don Slutz [this message]
2012-12-15 14:09 ` [Qemu-devel] [PATCH 4/4] block/vdi: Improved return values from vdi_open and other small fixes Stefan Weil
2013-01-17 12:08 ` Kevin Wolf
2013-01-16 18:53 ` [Qemu-devel] [PATCH 0/4] block: Fix error report for wrong file format Stefan Weil
2013-01-17 8:33 ` Stefan Hajnoczi
2013-01-17 12:10 ` Kevin Wolf
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=50CC9D33.8050808@CloudSwitch.com \
--to=don@cloudswitch.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=sw@weilnetz.de \
/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.