From: Peter Xu <peterx@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: berrange@redhat.com, qemu-devel@nongnu.org,
qemu-block@nongnu.org, leiyang@redhat.com,
marcandre.lureau@redhat.com,
Markus Armbruster <armbru@redhat.com>,
Michael Roth <michael.roth@amd.com>
Subject: Re: [PATCH v3 04/13] util/error: add &error_reporter
Date: Mon, 15 Sep 2025 11:45:27 -0400 [thread overview]
Message-ID: <aMg0l0xgq3hdiDnh@x1.local> (raw)
In-Reply-To: <20250915132211.135095-5-vsementsov@yandex-team.ru>
On Mon, Sep 15, 2025 at 04:22:01PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> Add a pair to &error_warn helper, to reduce the pattern like
>
> Error *local_err = NULL;
>
> ...
>
> if (!foo(..., &local_err)) {
> error_report_err(local_err);
> return false;
> }
>
> to simply
>
> if (!foo(..., &error_reporter)) {
> return false;
> }
>
> Of course, for new interfaces, it's better to always support and handle
> errp argument. But when have to rework the old ones, it's not always
> feasible to convert everything to support/handle errp.
>
> The new helper is used in following commits.
Could we add some explanation of why we need this if we already have
error_warn?
I don't see much difference except error_warn will prepend it with
"warning: ", but that doesn't sound like a real problem..
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> ---
> include/qapi/error.h | 6 ++++++
> util/error.c | 3 +++
> 2 files changed, 9 insertions(+)
>
> diff --git a/include/qapi/error.h b/include/qapi/error.h
> index 41e3816380..cea95f5c36 100644
> --- a/include/qapi/error.h
> +++ b/include/qapi/error.h
> @@ -539,6 +539,12 @@ G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(ErrorPropagator, error_propagator_cleanup);
> */
> extern Error *error_warn;
>
> +/*
> + * Special error destination to report on error.
> + * See error_setg() and error_propagate() for details.
> + */
> +extern Error *error_reporter;
> +
> /*
> * Special error destination to abort on error.
> * See error_setg() and error_propagate() for details.
> diff --git a/util/error.c b/util/error.c
> index daea2142f3..5160435c86 100644
> --- a/util/error.c
> +++ b/util/error.c
> @@ -20,6 +20,7 @@
> Error *error_abort;
> Error *error_fatal;
> Error *error_warn;
> +Error *error_reporter;
>
> static void error_handle(Error **errp, Error *err)
> {
> @@ -43,6 +44,8 @@ static void error_handle(Error **errp, Error *err)
> }
> if (errp == &error_warn) {
> warn_report_err(err);
> + } else if (errp == &error_reporter) {
> + error_report_err(err);
> } else if (errp && !*errp) {
> *errp = err;
> } else {
> --
> 2.48.1
>
--
Peter Xu
next prev parent reply other threads:[~2025-09-15 15:47 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-15 13:21 [PATCH v3 00/13] io: deal with blocking/non-blocking fds Vladimir Sementsov-Ogievskiy
2025-09-15 13:21 ` [PATCH v3 01/13] char-socket: tcp_chr_recv(): drop extra _set_(block, cloexec) Vladimir Sementsov-Ogievskiy
2025-09-15 13:21 ` [PATCH v3 02/13] char-socket: tcp_chr_recv(): add comment Vladimir Sementsov-Ogievskiy
2025-09-15 13:22 ` [PATCH v3 03/13] util: add qemu_set_blocking() function Vladimir Sementsov-Ogievskiy
2025-09-15 13:22 ` [PATCH v3 04/13] util/error: add &error_reporter Vladimir Sementsov-Ogievskiy
2025-09-15 15:45 ` Peter Xu [this message]
2025-09-15 18:14 ` Vladimir Sementsov-Ogievskiy
2025-09-15 18:29 ` Daniel P. Berrangé
2025-09-15 18:40 ` Vladimir Sementsov-Ogievskiy
2025-09-17 13:51 ` Markus Armbruster
2025-09-15 13:22 ` [PATCH v3 05/13] handle result of qio_channel_set_blocking() Vladimir Sementsov-Ogievskiy
2025-09-15 17:04 ` Jag Raman
2025-09-15 18:32 ` Vladimir Sementsov-Ogievskiy
2025-09-15 13:22 ` [PATCH v3 06/13] migration: qemu_file_set_blocking(): add errp parameter Vladimir Sementsov-Ogievskiy
2025-09-15 13:22 ` [PATCH v3 07/13] util: drop qemu_socket_set_nonblock() Vladimir Sementsov-Ogievskiy
2025-09-15 13:22 ` [PATCH v3 08/13] util: drop qemu_socket_try_set_nonblock() Vladimir Sementsov-Ogievskiy
2025-09-15 13:22 ` [PATCH v3 09/13] io/channel-socket: rework qio_channel_socket_copy_fds() Vladimir Sementsov-Ogievskiy
2025-09-15 15:21 ` Daniel P. Berrangé
2025-09-15 13:22 ` [PATCH v3 10/13] util: drop qemu_socket_set_block() Vladimir Sementsov-Ogievskiy
2025-09-15 13:22 ` [PATCH v3 11/13] use qemu_set_blocking instead of g_unix_set_fd_nonblocking Vladimir Sementsov-Ogievskiy
2025-09-15 15:22 ` Daniel P. Berrangé
2025-09-15 13:22 ` [PATCH v3 12/13] chardev: qemu_chr_open_fd(): add errp Vladimir Sementsov-Ogievskiy
2025-09-15 15:23 ` Daniel P. Berrangé
2025-09-15 13:22 ` [PATCH v3 13/13] chardev: close an fd on failure path Vladimir Sementsov-Ogievskiy
2025-09-15 15:25 ` Daniel P. Berrangé
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=aMg0l0xgq3hdiDnh@x1.local \
--to=peterx@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=leiyang@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=michael.roth@amd.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@yandex-team.ru \
/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).