From: Stefan Hajnoczi <stefanha@redhat.com>
To: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"John Snow" <jsnow@redhat.com>, "Kevin Wolf" <kwolf@redhat.com>,
"Hanna Reitz" <hreitz@redhat.com>,
"Alistair Francis" <alistair@alistair23.me>
Subject: Re: [PATCH v2 2/2] hw/block/block.c: improve confusing blk_check_size_and_read_all() error
Date: Mon, 29 Jan 2024 18:58:02 -0500 [thread overview]
Message-ID: <20240129235802.GA217529@fedora> (raw)
In-Reply-To: <8e7eb17fbd39d746079e2bb2525b0ed8c97cca33.1706023972.git.manos.pitsidianakis@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 1335 bytes --]
On Tue, Jan 23, 2024 at 05:35:31PM +0200, Manos Pitsidianakis wrote:
> if (blk_len != size) {
> - error_setg(errp, "device requires %" HWADDR_PRIu " bytes, "
> - "block backend provides %" PRIu64 " bytes",
> - size, blk_len);
> + dev_id = qdev_get_human_name(dev);
> + error_setg(errp, "%s device with id='%s' requires %" HWADDR_PRIu
Since qdev_get_human_name() falls back to returning the path instead of
the id, this error message could be confusing. Perhaps avoid saying what
dev_id is and let the user interpret it:
%s device '%s'
> + " bytes, %s block backend provides %" PRIu64 " bytes",
> + object_get_typename(OBJECT(dev)), dev_id, size,
> + blk_name(blk), blk_len);
> return false;
> }
>
> @@ -89,7 +90,11 @@ bool blk_check_size_and_read_all(BlockBackend *blk, void *buf, hwaddr size,
> assert(size <= BDRV_REQUEST_MAX_BYTES);
> ret = blk_pread_nonzeroes(blk, size, buf);
> if (ret < 0) {
> - error_setg_errno(errp, -ret, "can't read block backend");
> + dev_id = qdev_get_human_name(dev);
> + error_setg_errno(errp, -ret, "can't read %s block backend"
> + "for %s device with id='%s'",
Same here.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
prev parent reply other threads:[~2024-01-29 23:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-23 15:35 [PATCH v2 0/2] hw/block/block.c: improve confusing error Manos Pitsidianakis
2024-01-23 15:35 ` [PATCH v2 1/2] hw/core/qdev.c: add qdev_get_human_name() Manos Pitsidianakis
2024-01-30 0:02 ` Stefan Hajnoczi
2024-01-23 15:35 ` [PATCH v2 2/2] hw/block/block.c: improve confusing blk_check_size_and_read_all() error Manos Pitsidianakis
2024-01-29 23:58 ` Stefan Hajnoczi [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=20240129235802.GA217529@fedora \
--to=stefanha@redhat.com \
--cc=alistair@alistair23.me \
--cc=hreitz@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=manos.pitsidianakis@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-block@nongnu.org \
--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 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.