From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LNjCl-000693-H0 for qemu-devel@nongnu.org; Fri, 16 Jan 2009 02:33:23 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LNjCj-00068k-Ep for qemu-devel@nongnu.org; Fri, 16 Jan 2009 02:33:22 -0500 Received: from [199.232.76.173] (port=44393 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LNjCi-00068b-UL for qemu-devel@nongnu.org; Fri, 16 Jan 2009 02:33:20 -0500 Received: from mx2.redhat.com ([66.187.237.31]:60328) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LNjCi-0006dU-H2 for qemu-devel@nongnu.org; Fri, 16 Jan 2009 02:33:20 -0500 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n0G7XJQm030273 for ; Fri, 16 Jan 2009 02:33:19 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n0G7XJGd023725 for ; Fri, 16 Jan 2009 02:33:20 -0500 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n0G7XJB1012090 for ; Fri, 16 Jan 2009 02:33:19 -0500 Date: Fri, 16 Jan 2009 09:31:44 +0200 From: Gleb Natapov Subject: Re: [Qemu-devel] [6324] Return -errno on write failure (Gleb Natapov) Message-ID: <20090116073144.GC27165@redhat.com> References: <2858981241-BeMail@laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <2858981241-BeMail@laptop> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Thu, Jan 15, 2009 at 10:20:33PM +0100, Fran=C3=A7ois Revol wrote: > > Revision: 6324 > > http://svn.sv.gnu.org/viewvc/?view=3Drev&root=3Dqemu&revision= =3D6324 > > > Author: aliguori > > Date: 2009-01-15 20:44:26 +0000 (Thu, 15 Jan 2009) > > > > Log Message: > > ----------- > > Return -errno on write failure (Gleb Natapov) >=20 > Nooooooooooo > Please do not this bad broken Unix habit! > errno and E* are negative in BeOS and Haiku and sometimes =3D to > INT32_MIN which means negating it results in positive values or even > overflows. >=20 This is how qemu block layer passes error reason to the caller. Not only here but in other places too. >=20 > #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 >=20 > and return QERROR(errno) or return QERROR(EINVAL); > Patch to fix qemu on BeOS are welcomed :) =20 -- Gleb.