aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2016-02-26 10:22:16 +0100
committerKevin Wolf <kwolf@redhat.com>2016-05-19 16:45:31 +0200
commit4c265bf9f434d4b47f42e3c079adc205b7625ad6 (patch)
treefd9b775bf928f0d79cdd10cc74223b7673a0fdb7 /block
parent5c8cab48087d3544cb788309ac729bca08244020 (diff)
block: User BdrvChild callback for device name
In order to get rid of bs->blk for bdrv_get_device_name() and bdrv_get_device_or_node_name(), ask all parents for their name and simply pick the first one. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/block-backend.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/block/block-backend.c b/block/block-backend.c
index a085455850..a31fc204cd 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -97,11 +97,17 @@ static void blk_root_drained_end(BdrvChild *child);
static void blk_root_change_media(BdrvChild *child, bool load);
static void blk_root_resize(BdrvChild *child);
+static const char *blk_root_get_name(BdrvChild *child)
+{
+ return blk_name(child->opaque);
+}
+
static const BdrvChildRole child_root = {
.inherit_options = blk_root_inherit_options,
.change_media = blk_root_change_media,
.resize = blk_root_resize,
+ .get_name = blk_root_get_name,
.drained_begin = blk_root_drained_begin,
.drained_end = blk_root_drained_end,