From: Gleb Natapov <gleb@redhat.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [6324] Return -errno on write failure (Gleb Natapov)
Date: Fri, 16 Jan 2009 09:31:44 +0200 [thread overview]
Message-ID: <20090116073144.GC27165@redhat.com> (raw)
In-Reply-To: <2858981241-BeMail@laptop>
On Thu, Jan 15, 2009 at 10:20:33PM +0100, François Revol wrote:
> > Revision: 6324
> > http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6324
> > > Author: aliguori
> > Date: 2009-01-15 20:44:26 +0000 (Thu, 15 Jan 2009)
> >
> > Log Message:
> > -----------
> > Return -errno on write failure (Gleb Natapov)
>
> Nooooooooooo
> Please do not this bad broken Unix habit!
> errno and E* are negative in BeOS and Haiku and sometimes = to
> INT32_MIN which means negating it results in positive values or even
> overflows.
>
This is how qemu block layer passes error reason to the caller. Not only
here but in other places too.
>
> #if EINVAL > 0
> #define QERROR(e) (-(e)) /**< Returns a negative error code from a
> POSIX error code, to return from library functions. */
> #define QUNERROR(e) (-(e)) /**< Returns a POSIX error code from a
> library function error return value. */
> #else
> /* Some platforms have E* and errno already negated. */
> #define QERROR(e) (e)
> #define QUNERROR(e) (e)
> #endif
>
> and return QERROR(errno) or return QERROR(EINVAL);
>
Patch to fix qemu on BeOS are welcomed :)
--
Gleb.
next prev parent reply other threads:[~2009-01-16 7:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-15 20:44 [Qemu-devel] [6324] Return -errno on write failure (Gleb Natapov) Anthony Liguori
2009-01-15 21:20 ` François Revol
2009-01-15 22:15 ` M. Warner Losh
2009-01-15 22:33 ` François Revol
2009-01-16 7:31 ` Gleb Natapov [this message]
2009-01-16 17:37 ` Ian Jackson
2009-01-16 18:36 ` François Revol
2009-01-16 18:49 ` Anthony Liguori
2009-01-16 19:17 ` François Revol
2009-01-16 19:31 ` Anthony Liguori
2009-01-16 19:41 ` François Revol
2009-01-19 11:37 ` Ian Jackson
2009-01-19 18:52 ` François Revol
2009-01-19 19:47 ` Lennart Sorensen
2009-01-19 20:31 ` François Revol
2009-01-19 20:03 ` M. Warner Losh
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=20090116073144.GC27165@redhat.com \
--to=gleb@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).