From: Stefan Weil <sw@weilnetz.de>
To: Markus Armbruster <armbru@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 2/5] block: Use error code EMEDIUMTYPE for wrong format in some block drivers
Date: Fri, 18 Jan 2013 19:10:06 +0100 [thread overview]
Message-ID: <50F98FFE.5090502@weilnetz.de> (raw)
In-Reply-To: <871udizxb5.fsf@blackfin.pond.sub.org>
Am 18.01.2013 09:53, schrieb Markus Armbruster:
> Stefan Weil <sw@weilnetz.de> writes:
>> 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 1b1d9cd..3737583 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 -EMEDIUMTYPE;
>> }
>>
>> if (le32_to_cpu(bochs.version) == HEADER_V1) {
> You make the function return either 0, -1 or -EMEDIUMTYPE. Please make
> it return either 0 or a negative errno code, like this (untested):
Hi Markus,
returning 0, -1 is like before, only returning -EMEDIUMTYPE is new.
You are right, a return value of -1 should be replaced by a negative
error value. I fixed this for block/vdi.c in a separate patch as
suggested by Kevin, see http://patchwork.ozlabs.org/patch/213375/.
The same kind of improvement should be done for other block
drivers which currently use -1, but that can be done after my
patch series was applied.
The primary purpose of my patch series was fixing open bugreports.
For vdi I did more because I feel responsible for that part of the
code.
Regards,
StefanW.
next prev parent reply other threads:[~2013-01-18 18:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-17 20:45 [Qemu-devel] [PATCH v2 0/5] block: Fix error report for wrong file format Stefan Weil
2013-01-17 20:45 ` [Qemu-devel] [PATCH v2 1/5] block: Add special error code for wrong format Stefan Weil
2013-01-17 20:45 ` [Qemu-devel] [PATCH v2 2/5] block: Use error code EMEDIUMTYPE for wrong format in some block drivers Stefan Weil
2013-01-18 8:53 ` Markus Armbruster
2013-01-18 18:10 ` Stefan Weil [this message]
2013-01-21 11:03 ` Markus Armbruster
2013-01-17 20:45 ` [Qemu-devel] [PATCH v2 3/5] block/vdi: Improve debug output for signature Stefan Weil
2013-01-17 20:45 ` [Qemu-devel] [PATCH v2 4/5] block/vdi: Improved return values from vdi_open Stefan Weil
2013-01-17 20:45 ` [Qemu-devel] [PATCH v2 5/5] block/vdi: Check for bad signature Stefan Weil
2013-01-17 21:28 ` [Qemu-devel] [PATCH v2 0/5] block: Fix error report for wrong file format Eric Blake
2013-01-17 22:25 ` Stefan Weil
2013-01-17 22:41 ` Eric Blake
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=50F98FFE.5090502@weilnetz.de \
--to=sw@weilnetz.de \
--cc=armbru@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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.