diff options
author | Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> | 2021-08-24 11:38:24 +0300 |
---|---|---|
committer | Hanna Reitz <hreitz@redhat.com> | 2021-09-01 12:57:31 +0200 |
commit | ed089506eeb44fd7f7f385a9172e51b198ae489d (patch) | |
tree | fc460516ab9e37c862f4781d8e72cb647bea2ea1 /block/block-backend.c | |
parent | bd8f4c42c8547a74b0f92dc17af93c3247c69f18 (diff) |
block: introduce blk_replace_bs
Add function to change bs inside blk.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20210824083856.17408-3-vsementsov@virtuozzo.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
Diffstat (limited to 'block/block-backend.c')
-rw-r--r-- | block/block-backend.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/block/block-backend.c b/block/block-backend.c index deb55c272e..6140d133e2 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -870,6 +870,14 @@ int blk_insert_bs(BlockBackend *blk, BlockDriverState *bs, Error **errp) } /* + * Change BlockDriverState associated with @blk. + */ +int blk_replace_bs(BlockBackend *blk, BlockDriverState *new_bs, Error **errp) +{ + return bdrv_replace_child_bs(blk->root, new_bs, errp); +} + +/* * Sets the permission bitmasks that the user of the BlockBackend needs. */ int blk_set_perm(BlockBackend *blk, uint64_t perm, uint64_t shared_perm, |