From: Luiz Capitulino <lcapitulino@redhat.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 2/4] block: Improve error report for wrong format
Date: Mon, 17 Dec 2012 13:08:01 -0200 [thread overview]
Message-ID: <20121217130801.67265153@doriath.home> (raw)
In-Reply-To: <1355580573-19323-3-git-send-email-sw@weilnetz.de>
On Sat, 15 Dec 2012 15:09:31 +0100
Stefan Weil <sw@weilnetz.de> wrote:
> There is no good system error for this kind of error,
> so it needs special handling instead of strerror.
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
> blockdev.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/blockdev.c b/blockdev.c
> index 5a4cd56..3da44f6 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -624,8 +624,13 @@ DriveInfo *drive_init(QemuOpts *opts, BlockInterfaceType block_default_type)
>
> ret = bdrv_open(dinfo->bdrv, file, bdrv_flags, drv);
> if (ret < 0) {
> - error_report("could not open disk image %s: %s",
> - file, strerror(-ret));
> + if (ret == BDRV_WRONG_FORMAT) {
> + error_report("could not open disk image %s: not in %s format",
> + file, drv->format_name);
> + } else {
> + error_report("could not open disk image %s: %s",
> + file, strerror(-ret));
IIRC, I have an rfc series propagating an Error object down to bdrv_open(),
and was planning to propagate it to block drivers. You could do it instead
of creating this new error code.
It's usually more work, but the end result is usually better.
> + }
> goto err;
> }
>
next prev parent reply other threads:[~2012-12-17 15:08 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 [this message]
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
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=20121217130801.67265153@doriath.home \
--to=lcapitulino@redhat.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 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).