qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	pbonzini@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 0/9] Miscellaneous error reporting improvements
Date: Tue, 02 Jun 2015 06:51:01 -0600	[thread overview]
Message-ID: <556DA6B5.6090507@redhat.com> (raw)
In-Reply-To: <87wpzmba5f.fsf@blackfin.pond.sub.org>

[-- Attachment #1: Type: text/plain, Size: 2111 bytes --]

On 06/02/2015 05:51 AM, Markus Armbruster wrote:

>>>> The most confusing part about this is that you have &error_abort almost
>>>> everywhere, but the function doesn't actually abort on error, but rather
>>>> returns a negative error code and leaves errp alone.
>>>
>>> True.  The function contract spells it out, which hopefully reduces the
>>> 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 prefer
>> diagnosing coding bugs.
> 
> You prefer &error_abort, Kevin prefers NULL, so I need to figure out
> what I prefer to break the tie :)
> 
> I think we can agree on these two rules on Error ** arguments:
> 
> R1: When caller doesn't care whether the callee sets an error, it should
> pass NULL.
> 
> 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.

> 
> R1 applies, R2 does not, thus we should pass NULL.
> 
> The case for &error_abort requires a third rule:
> 
> 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.

> 
> To keep things simple, I lean towards rejecting R3 and passing NULL.
> 
> 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).

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

      reply	other threads:[~2015-06-02 12:51 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-28 12:21 [Qemu-devel] [PATCH 0/9] Miscellaneous error reporting improvements Markus Armbruster
2015-05-28 12:21 ` [Qemu-devel] [PATCH 1/9] vl: Report failure to sandbox at most once Markus Armbruster
2015-05-28 14:24   ` Eric Blake
2015-05-28 12:21 ` [Qemu-devel] [PATCH 2/9] vl: Print -device help " Markus Armbruster
2015-05-28 14:47   ` Eric Blake
2015-05-28 12:21 ` [Qemu-devel] [PATCH 3/9] vl: Fail right after first bad -object Markus Armbruster
2015-05-28 14:52   ` Eric Blake
2015-06-02  8:41     ` Markus Armbruster
2015-05-28 12:21 ` [Qemu-devel] [PATCH 4/9] QemuOpts: Drop qemu_opts_foreach() parameter abort_on_failure Markus Armbruster
2015-05-28 15:10   ` Eric Blake
2015-06-02  8:42     ` Markus Armbruster
2015-05-28 12:21 ` [Qemu-devel] [PATCH 5/9] QemuOpts: Convert qemu_opts_foreach() to Error Markus Armbruster
2015-05-28 16:18   ` Eric Blake
2015-06-02 11:33     ` Markus Armbruster
2015-06-02 12:34       ` Eric Blake
2015-06-02 14:13         ` Paolo Bonzini
2015-05-28 12:21 ` [Qemu-devel] [PATCH 6/9] blkdebug: Simplify passing of Error through qemu_opts_foreach() Markus Armbruster
2015-05-28 17:15   ` Eric Blake
2015-05-28 12:21 ` [Qemu-devel] [PATCH 7/9] QemuOpts: Drop qemu_opt_foreach() parameter abort_on_failure Markus Armbruster
2015-05-28 18:57   ` Eric Blake
2015-05-28 12:21 ` [Qemu-devel] [PATCH 8/9] QemuOpts: Convert qemu_opt_foreach() to Error Markus Armbruster
2015-05-28 19:07   ` Eric Blake
2015-05-28 12:21 ` [Qemu-devel] [PATCH 9/9] vhost-user: Improve -netdev/netdev_add/-net/... error reporting Markus Armbruster
2015-05-28 19:20   ` Eric Blake
2015-06-02 16:32   ` Stefan Hajnoczi
2015-05-29  8:51 ` [Qemu-devel] [PATCH 0/9] Miscellaneous error reporting improvements Kevin Wolf
2015-05-29 11:22   ` Markus Armbruster
2015-05-29 12:42     ` Kevin Wolf
2015-05-29 14:00     ` Eric Blake
2015-06-02 11:51       ` Markus Armbruster
2015-06-02 12:51         ` Eric Blake [this message]

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=556DA6B5.6090507@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@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).