[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [RFC] error: auto propagated local_err
From: |
Max Reitz |
Subject: |
Re: [Qemu-ppc] [RFC] error: auto propagated local_err |
Date: |
Thu, 19 Sep 2019 10:59:24 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
On 18.09.19 15:02, Vladimir Sementsov-Ogievskiy wrote:
> Hi all!
>
> Here is a proposal (three of them, actually) of auto propagation for
> local_err, to not call error_propagate on every exit point, when we
> deal with local_err.
>
> It also may help make Greg's series[1] about error_append_hint smaller.
>
> See definitions and examples below.
>
> I'm cc-ing to this RFC everyone from series[1] CC list, as if we like
> it, the idea will touch same code (and may be more).
>
> [1]: https://lists.gnu.org/archive/html/qemu-devel/2019-09/msg03449.html
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
> ---
> include/qapi/error.h | 102 +++++++++++++++++++++++++++++++++++++++++++
> block.c | 63 ++++++++++++--------------
> block/backup.c | 8 +++-
> block/gluster.c | 7 +++
> 4 files changed, 144 insertions(+), 36 deletions(-)
If the combination of “if (local_err) { error_propagate(...); ... }” is
what’s cumbersome, can’t this be done simpler by adding an
error_propagate() variant with a return value?
i.e.
bool has_error_then_propagate(Error **errp, Error *err)
{
if (!err) {
return false;
}
error_propagate(errp, err);
return true;
}
And then turn all instances of
if (local_err) {
error_propagate(errp, local_err);
...
}
into
if (has_error_then_propagate(errp, local_err)) {
...
}
?
Max
Re: [Qemu-ppc] [Qemu-devel] [RFC] error: auto propagated local_err, no-reply, 2019/09/18
Re: [Qemu-ppc] [RFC] error: auto propagated local_err, David Hildenbrand, 2019/09/19
Re: [Qemu-ppc] [RFC] error: auto propagated local_err,
Max Reitz <=
Re: [Qemu-ppc] [RFC] error: auto propagated local_err, Greg Kurz, 2019/09/19
Re: [RFC] error: auto propagated local_err, Vladimir Sementsov-Ogievskiy, 2019/09/20