qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-block@nongnu.org, Laszlo Ersek <lersek@redhat.com>,
	qemu-devel@nongnu.org, philmd@redhat.com, mreitz@redhat.com,
	alex.bennee@linaro.org
Subject: Re: [Qemu-devel] [PATCH v7] pflash: Require backend size to match device, improve errors
Date: Fri, 8 Mar 2019 18:18:58 +0100	[thread overview]
Message-ID: <20190308171858.GF31583@localhost.localdomain> (raw)
In-Reply-To: <87bm2l8fiu.fsf@dusky.pond.sub.org>

Am 08.03.2019 um 18:03 hat Markus Armbruster geschrieben:
> >> bool blk_check_size_and_read_all(BlockBackend *blk, void *buf, hwaddr size,
> >>                                  Error **errp)
> >> {
> >>     int64_t blk_len;
> >>     int ret;
> >> 
> >>     blk_len = blk_getlength(blk);
> >>     if (blk_len < 0) {
> >>         error_setg_errno(errp, -blk_len,
> >>                          "can't get size of block backend '%s'",
> >>                          blk_name(blk));
> >>         return false;
> >>     }
> >>     if (blk_len != size) {
> >>         error_setg(errp, "device requires %" PRIu64 " bytes, "
> >>                    "block backend '%s' provides %" PRIu64 " bytes",
> >>                    size, blk_name(blk), blk_len);
> >
> > Should size use HWADDR_PRIu?
> 
> Yes.
> 
> > I'm not sure if printing the BlockBackend name is a good idea because
> > hopefully one day the BlockBackend will be anonymous even for the flash
> > devices.
> 
> Hmm.  Tell me what else I can use to identify the troublemaker to the
> user.

My hope was that a caller of this would prefix the right context. For
example, if the device were created by -device, the error message would
be prefixed with the whole "-device driver=pflash...:" string, which
gives enough context to the user.

Machine code that instantiates the device based on -drive should
probably do something similar.

Kevin

  reply	other threads:[~2019-03-08 17:19 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-08  6:24 [Qemu-devel] [PATCH v7] pflash: Require backend size to match device, improve errors Markus Armbruster
2019-03-08 10:00 ` Alex Bennée
2019-03-08 12:16   ` Markus Armbruster
2019-03-08 11:47 ` Laszlo Ersek
2019-03-08 12:28   ` Markus Armbruster
2019-03-08 13:35     ` Kevin Wolf
2019-03-08 14:09       ` Laszlo Ersek
2019-03-08 14:26       ` Philippe Mathieu-Daudé
2019-03-08 14:29       ` Markus Armbruster
2019-03-08 15:40         ` Kevin Wolf
2019-03-08 16:45           ` Philippe Mathieu-Daudé
2019-03-08 17:03           ` Markus Armbruster
2019-03-08 17:18             ` Kevin Wolf [this message]
2019-03-08 18:51           ` Philippe Mathieu-Daudé
2019-03-09  9:20             ` Markus Armbruster
2019-03-08 14:40   ` 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=20190308171858.GF31583@localhost.localdomain \
    --to=kwolf@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=lersek@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=philmd@redhat.com \
    --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 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).