From: Markus Armbruster <armbru@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: qemu-devel@nongnu.org, fam@euphon.net, kwolf@redhat.com,
hreitz@redhat.com, marcandre.lureau@redhat.com,
peterx@redhat.com, farosas@suse.de, pbonzini@redhat.com,
richard.henderson@linaro.org, qemu-block@nongnu.org
Subject: Re: [PATCH 2/6] dump/win_dump: Improve error messages on write error
Date: Mon, 13 May 2024 16:48:22 +0200 [thread overview]
Message-ID: <87msot6a4p.fsf@pond.sub.org> (raw)
In-Reply-To: <5a74f1af-6068-41b1-b875-6be060369abe@linaro.org> ("Philippe Mathieu-Daudé"'s message of "Mon, 13 May 2024 16:22:54 +0200")
Philippe Mathieu-Daudé <philmd@linaro.org> writes:
> On 13/5/24 16:16, Markus Armbruster wrote:
>> create_win_dump() and write_run report qemu_write_full() failure to
>> their callers as
>> An IO error has occurred
>> The errno set by qemu_write_full() is lost.
>> Improve this to
>> win-dump: failed to write header: <description of errno>
>> and
>> win-dump: failed to save memory: <description of errno>
>> This matches how dump.c reports similar errors.
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>> dump/win_dump.c | 7 ++++---
>> 1 file changed, 4 insertions(+), 3 deletions(-)
>> diff --git a/dump/win_dump.c b/dump/win_dump.c
>> index b7bfaff379..0e4fe692ce 100644
>> --- a/dump/win_dump.c
>> +++ b/dump/win_dump.c
>> @@ -12,7 +12,6 @@
>> #include "sysemu/dump.h"
>> #include "qapi/error.h"
>> #include "qemu/error-report.h"
>> -#include "qapi/qmp/qerror.h"
>> #include "exec/cpu-defs.h"
>> #include "hw/core/cpu.h"
>> #include "qemu/win_dump_defs.h"
>> @@ -52,6 +51,7 @@ static size_t write_run(uint64_t base_page, uint64_t page_count,
>> uint64_t addr = base_page << TARGET_PAGE_BITS;
>> uint64_t size = page_count << TARGET_PAGE_BITS;
>> uint64_t len, l;
>> + int eno;
>> size_t total = 0;
>> while (size) {
>> @@ -65,9 +65,10 @@ static size_t write_run(uint64_t base_page, uint64_t page_count,
>> }
>> l = qemu_write_full(fd, buf, len);
>> + eno = errno;
>
> Hmm this show the qemu_write_full() API isn't ideal.
> Maybe we could pass &l as argument and return errno.
> There are only 20 calls.
qemu_write_full() is a drop-in replacement for write().
>> cpu_physical_memory_unmap(buf, addr, false, len);
>> if (l != len) {
>> - error_setg(errp, QERR_IO_ERROR);
>> + error_setg_errno(errp, eno, "win-dump: failed to save memory");
>> return 0;
>> }
>> @@ -459,7 +460,7 @@ void create_win_dump(DumpState *s, Error **errp)
>> s->written_size = qemu_write_full(s->fd, h, hdr_size);
>> if (s->written_size != hdr_size) {
>> - error_setg(errp, QERR_IO_ERROR);
>> + error_setg_errno(errp, errno, "win-dump: failed to write header");
>> goto out_restore;
>> }
>>
next prev parent reply other threads:[~2024-05-13 15:00 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-13 14:16 [PATCH 0/6] error: Eliminate QERR_IO_ERROR Markus Armbruster
2024-05-13 14:16 ` [PATCH 1/6] block: Improve error message when external snapshot can't flush Markus Armbruster
2024-05-13 14:24 ` Philippe Mathieu-Daudé
2024-05-13 14:16 ` [PATCH 2/6] dump/win_dump: Improve error messages on write error Markus Armbruster
2024-05-13 14:22 ` Philippe Mathieu-Daudé
2024-05-13 14:48 ` Markus Armbruster [this message]
2024-05-13 14:55 ` Philippe Mathieu-Daudé
2024-05-13 14:17 ` [PATCH 3/6] block/vmdk: Improve error messages on extent " Markus Armbruster
2024-05-13 14:23 ` Philippe Mathieu-Daudé
2024-05-13 14:17 ` [PATCH 4/6] cpus: Improve error messages on memsave, pmemsave " Markus Armbruster
2024-05-13 14:27 ` Philippe Mathieu-Daudé
2024-05-13 14:45 ` Markus Armbruster
2024-05-13 14:58 ` Philippe Mathieu-Daudé
2024-05-27 10:41 ` Markus Armbruster
2024-05-13 14:17 ` [PATCH 5/6] migration: Rephrase message on failure to save / load Xen device state Markus Armbruster
2024-05-13 14:24 ` Philippe Mathieu-Daudé
2024-05-13 18:07 ` Fabiano Rosas
2024-05-23 19:43 ` Peter Xu
2024-05-27 10:53 ` Markus Armbruster
2024-05-27 14:35 ` Peter Xu
2024-05-13 14:17 ` [PATCH 6/6] qerror: QERR_IO_ERROR is no longer used, drop Markus Armbruster
2024-05-13 14:28 ` Philippe Mathieu-Daudé
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=87msot6a4p.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=fam@euphon.net \
--cc=farosas@suse.de \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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 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.