From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yzlex-0001Un-LZ for qemu-devel@nongnu.org; Tue, 02 Jun 2015 08:51:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yzlet-00062p-Ky for qemu-devel@nongnu.org; Tue, 02 Jun 2015 08:51:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54930) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yzlet-00062f-Dh for qemu-devel@nongnu.org; Tue, 02 Jun 2015 08:51:07 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 097DA19F970 for ; Tue, 2 Jun 2015 12:51:06 +0000 (UTC) Message-ID: <556DA6B5.6090507@redhat.com> Date: Tue, 02 Jun 2015 06:51:01 -0600 From: Eric Blake MIME-Version: 1.0 References: <1432815695-31687-1-git-send-email-armbru@redhat.com> <20150529085154.GB3804@noname.redhat.com> <877frr4oig.fsf@blackfin.pond.sub.org> <556870FC.3020806@redhat.com> <87wpzmba5f.fsf@blackfin.pond.sub.org> In-Reply-To: <87wpzmba5f.fsf@blackfin.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="GPfNmV8SLWWbTdNg5rBNGl2vuutvQLHpM" Subject: Re: [Qemu-devel] [PATCH 0/9] Miscellaneous error reporting improvements List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Kevin Wolf , pbonzini@redhat.com, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --GPfNmV8SLWWbTdNg5rBNGl2vuutvQLHpM Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/02/2015 05:51 AM, Markus Armbruster wrote: >>>> The most confusing part about this is that you have &error_abort alm= ost >>>> everywhere, but the function doesn't actually abort on error, but ra= ther >>>> returns a negative error code and leaves errp alone. >>> >>> True. The function contract spells it out, which hopefully reduces t= he >>> confusion somewhat. >> >> Except that you don't enforce the contract; I suggested adding >> assert(!*errp) at the right place in the two conversions. >> >>> >>> Would you find NULL less confusing than &error_abort? >> >> NULL says to ignore errors, &error_abort says to diagnose errors as >> programming bugs. If we know we aren't going to have an error, I pref= er >> diagnosing coding bugs. >=20 > You prefer &error_abort, Kevin prefers NULL, so I need to figure out > what I prefer to break the tie :) >=20 > I think we can agree on these two rules on Error ** arguments: >=20 > R1: When caller doesn't care whether the callee sets an error, it shoul= d > pass NULL. >=20 > R2: When a caller relies on the callee not setting an error, it should > pass &error_abort. Yes, these two rules cover the current state of the art. >=20 > R1 applies, R2 does not, thus we should pass NULL. >=20 > The case for &error_abort requires a third rule: >=20 > Proposed R3: When a caller knows that the callee won't set an error, it= > may pass &error_abort to document this knowledge even when it doesn't > actually rely on it (thus R2 doesn't apply). This is an exception to > R1. Or, as I explored in another message, if the caller passes NULL, but we then turn it to &error_abort locally, to enforce that the callback does not set an error for either success or failure. >=20 > To keep things simple, I lean towards rejecting R3 and passing NULL. >=20 > Opinions? At this point I'm leaning towards simplicity - pass NULL, and not worth modifying the contract (passing NULL does not need to get transformed into error_abort). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --GPfNmV8SLWWbTdNg5rBNGl2vuutvQLHpM Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVbaa1AAoJEKeha0olJ0NqXh4H/3HjH76iPzjiz8lex//cLWH7 NXZZy1zfL2qQMjLf8sknOy3cTGnh/GIor+p3XwMCuHpmPf2XMDC1rFk3U9RIrgSO 9+k7kiGIfPLIdpY/+PEmTflLjFrqkTlrr2jcHcnzLWskEIKYmLu35lnA6TpegSwf Jyg41PTeOgKVTB8gbXmpnzkPnJxsNq7ZGZtYW3NiL4ItUMZrYlvNBzN1xQg+wMiK abV6AtQJO4q5HwT4vjwOcAAVGFgwCoQpV8/0nZqpoVNkHrJugz78T8jffQcibwVK RUyatg0x7zWg6fCDwQi1sKP0Jofm5XnrIzf++ac8Hc3/azqXz0c1IRS81pay1/8= =2vb4 -----END PGP SIGNATURE----- --GPfNmV8SLWWbTdNg5rBNGl2vuutvQLHpM--