From: Kevin Wolf <kwolf@redhat.com>
To: Stefan Weil <weil@mail.berlios.de>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: [Qemu-devel] Re: [PATCH] block: Use error codes from lower levels for error message
Date: Mon, 19 Jul 2010 14:26:37 +0200 [thread overview]
Message-ID: <4C44447D.9020405@redhat.com> (raw)
In-Reply-To: <1279482150-19385-1-git-send-email-weil@mail.berlios.de>
Am 18.07.2010 21:42, schrieb Stefan Weil:
> "No such file or directory" is a misleading error message
> when a user tries to open a file with wrong permissions.
>
> Cc: Kevin Wolf <kwolf@redhat.com>
> Signed-off-by: Stefan Weil <weil@mail.berlios.de>
> ---
> block.c | 12 ++++++++----
> 1 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/block.c b/block.c
> index f837876..2f80540 100644
> --- a/block.c
> +++ b/block.c
> @@ -330,16 +330,20 @@ BlockDriver *bdrv_find_protocol(const char *filename)
> return NULL;
> }
>
> -static BlockDriver *find_image_format(const char *filename)
> +static BlockDriver *find_image_format(const char *filename, int *error)
Wouldn't it be a more natural interface to return an 0/-errno int and
pass the BlockDriver* by reference? I think we already have some
function that work this way in the block code, but I can't remember any
that get an int *error.
> {
> int ret, score, score_max;
> BlockDriver *drv1, *drv;
> uint8_t buf[2048];
> BlockDriverState *bs;
>
> + *error = -ENOENT;
Why -ENOENT is the default would be clearer if you moved it down next to
the drv = NULL before the loop that searches for the driver.
Apart from these minor nitpicks it looks good.
Kevin
next prev parent reply other threads:[~2010-07-19 12:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-18 19:42 [Qemu-devel] [PATCH] block: Use error codes from lower levels for error message Stefan Weil
2010-07-19 12:26 ` Kevin Wolf [this message]
2010-07-19 20:55 ` [Qemu-devel] " Stefan Weil
2010-07-20 7:44 ` Kevin Wolf
2010-07-21 19:51 ` [Qemu-devel] " Stefan Weil
2010-07-26 8:50 ` [Qemu-devel] " 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=4C44447D.9020405@redhat.com \
--to=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=weil@mail.berlios.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).