From: Markus Armbruster <armbru@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Cc: peterx@redhat.com, stefanb@linux.vnet.ibm.com, farosas@suse.de,
qemu-devel@nongnu.org, armbru@redhat.com, berrange@redhat.com
Subject: Re: [PATCH v2 2/2] migration: vmsd errp handlers: return bool
Date: Wed, 22 Oct 2025 08:14:45 +0200 [thread overview]
Message-ID: <87ecqviht6.fsf@pond.sub.org> (raw)
In-Reply-To: <9064223d-6f35-4023-b5b6-99b8d766f506@yandex-team.ru> (Vladimir Sementsov-Ogievskiy's message of "Tue, 21 Oct 2025 14:50:36 +0300")
Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> writes:
> On 20.10.25 19:03, Vladimir Sementsov-Ogievskiy wrote:
>> Recently we moved to returning errp. Why to keep int return value?
>> Generally it doesn't help: you can't use in a logic of handling
>> an error, as you are never sure, that in future the logic in
>> the stack will not change: it may start to return another error
>> code in the same case, or return same error code in another case.
>> Actually, we can only rely on concrete errno code when get it
>> _directly_ from documented library function or syscall. This way we
>> handle for example EINTR. But later in a stack, we can only add
>> this errno to the textual error by strerror().
>> Let this new, recently added API be simpler and clearer, let it
>> return simple boolean value, so we shouldn't think:
>> - should we handle different error codes differently
>> (if yes - how exactly, if no - why do we need this information?)
>> - should we add it to errp, or it was already added earlier in
>> the stack
>
>
> Less aggressive commit message may be:
>
> Switch the new API to simple bool-returning interface, as return value
> is not used otherwise than check is function failed or not. No logic
> depend on concrete errno values.
Good, except it isn't quite accurate: callers include the return value
in error messages.
They format it as a number, which is inappropriate.
If they formatted it appropriately, with strerror(), would that be
helpful? I *think* the answer is no. The functions set an Error, and
their callers prepend to that Error's message. The original Error
should suffice to tell what went wrong. The prepended text's purpose is
to add context.
I think the easiest way to make this argument is to split this patch
into a part changing the error messages, and a part changing the return
type.
next prev parent reply other threads:[~2025-10-22 6:15 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-20 16:03 [PATCH v2 0/2] migration: vmsd errp handlers: return bool Vladimir Sementsov-Ogievskiy
2025-10-20 16:03 ` [PATCH v2 1/2] migration: vmstate_save_state_v(): fix error path Vladimir Sementsov-Ogievskiy
2025-10-20 17:57 ` Philippe Mathieu-Daudé
2025-10-20 16:03 ` [PATCH v2 2/2] migration: vmsd errp handlers: return bool Vladimir Sementsov-Ogievskiy
2025-10-21 11:50 ` Vladimir Sementsov-Ogievskiy
2025-10-22 6:14 ` Markus Armbruster [this message]
2025-10-22 6:58 ` Vladimir Sementsov-Ogievskiy
2025-10-25 19:50 ` Vladimir Sementsov-Ogievskiy
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=87ecqviht6.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=farosas@suse.de \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanb@linux.vnet.ibm.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.