From: Kevin Wolf <kwolf@redhat.com>
To: Stefan Weil <sw@weilnetz.de>
Cc: qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/4] block: Add special error code for wrong format
Date: Thu, 17 Jan 2013 13:01:49 +0100 [thread overview]
Message-ID: <50F7E82D.7080404@redhat.com> (raw)
In-Reply-To: <1355580573-19323-2-git-send-email-sw@weilnetz.de>
Am 15.12.2012 15:09, schrieb Stefan Weil:
> The block drivers normally return -errno for typical errors.
> There is no appropriate error code for "wrong format", so
> use a special error code which does not conflict with system
> error codes.
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
> block.h | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/block.h b/block.h
> index 893448a..829e18b 100644
> --- a/block.h
> +++ b/block.h
> @@ -90,6 +90,13 @@ typedef struct BlockDevOps {
> #define BDRV_SECTOR_SIZE (1ULL << BDRV_SECTOR_BITS)
> #define BDRV_SECTOR_MASK ~(BDRV_SECTOR_SIZE - 1)
>
> +/* The block drivers normally return -errno for typical errors.
> + * There is no appropriate error code for "wrong format", so
> + * use a special error code which does not conflict with system
> + * error codes.
> + */
> +#define BDRV_WRONG_FORMAT INT_MIN
I think it would be better to use the E* format and a positive number so
that it's obvious that it's meant to be used in -errno returns.
Also, I would consider moving it to qemu-common.h where other errno
values are defined that may be missing on some systems, so that
everything stays in one place and we won't define overlapping codes:
#if !defined(ENOTSUP)
#define ENOTSUP 4096
#endif
#if !defined(ECANCELED)
#define ECANCELED 4097
#endif
This sounds like a good addition in the same place would be:
#define EBDRV_WRONG_FORMAT 4098
Or just use EINVAL or ENOTTY like Stefan suggested.
Kevin
next prev parent reply other threads:[~2013-01-17 12:02 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 [this message]
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
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=50F7E82D.7080404@redhat.com \
--to=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).