From: Alberto Garcia <berto@igalia.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/3] block: add bdrv_get_device_or_node_name()
Date: Fri, 20 Mar 2015 09:03:04 +0100 [thread overview]
Message-ID: <20150320080304.GA26277@igalia.com> (raw)
In-Reply-To: <87twxgi0b3.fsf@blackfin.pond.sub.org>
On Fri, Mar 20, 2015 at 08:40:32AM +0100, Markus Armbruster wrote:
> > +const char *bdrv_get_device_or_node_name(const BlockDriverState *bs)
> > +{
> > + return bs->blk ? blk_name(bs->blk) : bs->node_name;
> > +}
> > +
>
> Does this have uses beyond identifying @bs to the user?
None that I can think of, although apart from error messages it can
also be used in data types, like the cases of BLOCK_IMAGE_CORRUPTED
and BlockJobInfo that are being discussed:
https://lists.gnu.org/archive/html/qemu-devel/2015-03/msg03651.html
> > static void quorum_report_failure(QuorumAIOCB *acb)
> > {
> > - const char *reference = bdrv_get_device_name(acb->common.bs)[0] ?
> > - bdrv_get_device_name(acb->common.bs) :
> > - acb->common.bs->node_name;
> > -
> > + const char *reference = bdrv_get_device_or_node_name(acb->common.bs);
> > qapi_event_send_quorum_failure(reference, acb->sector_num,
> > acb->nb_sectors, &error_abort);
> > }
>
> Preexisting: what if reference is null?
It can't happen, both the device and the node name strings are
guaranteed to be non-null. The latter is actually a static string so
there's no chance bs->node_name returns a null pointer.
Berto
next prev parent reply other threads:[~2015-03-20 8:03 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-19 15:43 [Qemu-devel] [PATCH 0/3] Add bdrv_get_device_or_node_name() Alberto Garcia
2015-03-19 15:43 ` [Qemu-devel] [PATCH 1/3] block: add bdrv_get_device_or_node_name() Alberto Garcia
2015-03-19 19:26 ` Max Reitz
2015-03-20 7:40 ` Markus Armbruster
2015-03-20 8:03 ` Alberto Garcia [this message]
2015-03-20 8:47 ` Markus Armbruster
2015-03-19 15:43 ` [Qemu-devel] [PATCH 2/3] block: use bdrv_get_device_or_node_name() in error messages Alberto Garcia
2015-03-19 19:37 ` Max Reitz
2015-03-20 7:52 ` Markus Armbruster
2015-03-19 15:43 ` [Qemu-devel] [PATCH 3/3] block: allow BLOCK_IMAGE_CORRUPTED to have a node name Alberto Garcia
2015-03-19 19:42 ` Max Reitz
2015-03-19 21:42 ` Alberto Garcia
2015-03-19 21:52 ` Max Reitz
2015-03-19 22:04 ` Alberto Garcia
2015-03-19 22:15 ` Eric Blake
2015-03-19 22:38 ` Alberto Garcia
2015-03-19 23:14 ` Eric Blake
2015-03-20 9:23 ` Alberto Garcia
2015-03-19 19:37 ` [Qemu-devel] [PATCH 0/3] Add bdrv_get_device_or_node_name() Max Reitz
2015-03-19 21:49 ` Alberto Garcia
-- strict thread matches above, loose matches on Subject: below --
2015-03-20 10:19 [Qemu-devel] [PATCH v2 " Alberto Garcia
2015-03-20 10:19 ` [Qemu-devel] [PATCH 1/3] block: add bdrv_get_device_or_node_name() Alberto Garcia
2015-03-20 13:04 ` Max Reitz
2015-03-20 14:33 [Qemu-devel] [PATCH v3 0/3] Add bdrv_get_device_or_node_name() Alberto Garcia
2015-03-20 14:33 ` [Qemu-devel] [PATCH 1/3] block: add bdrv_get_device_or_node_name() Alberto Garcia
2015-03-20 19:11 ` Max Reitz
2015-04-08 9:29 [Qemu-devel] [PATCH v4 0/3] Add bdrv_get_device_or_node_name() Alberto Garcia
2015-04-08 9:29 ` [Qemu-devel] [PATCH 1/3] block: add bdrv_get_device_or_node_name() Alberto Garcia
2015-04-08 16:32 ` Eric Blake
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=20150320080304.GA26277@igalia.com \
--to=berto@igalia.com \
--cc=armbru@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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.