diff options
author | Kevin Wolf | 2016-02-24 15:13:35 +0100 |
---|---|---|
committer | Kevin Wolf | 2016-05-19 16:45:31 +0200 |
commit | 5c8cab48087d3544cb788309ac729bca08244020 (patch) | |
tree | aa5b14bd20159c44139267b448436eef2331be74 /block | |
parent | block: Don't check throttled reqs in bdrv_requests_pending() (diff) | |
download | qemu-5c8cab48087d3544cb788309ac729bca08244020.tar.gz qemu-5c8cab48087d3544cb788309ac729bca08244020.tar.xz qemu-5c8cab48087d3544cb788309ac729bca08244020.zip |
block: Use BdrvChild callbacks for change_media/resize
We want to get rid of BlockDriverState.blk in order to allow multiple
BlockBackends per BDS. Converting the device callbacks in block.c (which
assume a single BlockBackend) to per-child callbacks gets us rid of the
first few instances.
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.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/block/block-backend.c b/block/block-backend.c index a71b54d24d..a085455850 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -94,9 +94,15 @@ static void blk_root_inherit_options(int *child_flags, QDict *child_options, static void blk_root_drained_begin(BdrvChild *child); 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 BdrvChildRole child_root = { .inherit_options = blk_root_inherit_options, + .change_media = blk_root_change_media, + .resize = blk_root_resize, + .drained_begin = blk_root_drained_begin, .drained_end = blk_root_drained_end, }; @@ -556,6 +562,11 @@ void blk_dev_change_media_cb(BlockBackend *blk, bool load) } } +static void blk_root_change_media(BdrvChild *child, bool load) +{ + blk_dev_change_media_cb(child->opaque, load); +} + /* * Does @blk's attached device model have removable media? * %true if no device model is attached. @@ -610,8 +621,10 @@ bool blk_dev_is_medium_locked(BlockBackend *blk) /* * Notify @blk's attached device model of a backend size change. */ -void blk_dev_resize_cb(BlockBackend *blk) +static void blk_root_resize(BdrvChild *child) { + BlockBackend *blk = child->opaque; + if (blk->dev_ops && blk->dev_ops->resize_cb) { blk->dev_ops->resize_cb(blk->dev_opaque); } |