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>
This commit is contained in:
parent
bd8f4c42c8
commit
ed089506ee
|
@ -869,6 +869,14 @@ int blk_insert_bs(BlockBackend *blk, BlockDriverState *bs, Error **errp)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.
|
* Sets the permission bitmasks that the user of the BlockBackend needs.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -102,6 +102,7 @@ BlockBackend *blk_by_public(BlockBackendPublic *public);
|
||||||
BlockDriverState *blk_bs(BlockBackend *blk);
|
BlockDriverState *blk_bs(BlockBackend *blk);
|
||||||
void blk_remove_bs(BlockBackend *blk);
|
void blk_remove_bs(BlockBackend *blk);
|
||||||
int blk_insert_bs(BlockBackend *blk, BlockDriverState *bs, Error **errp);
|
int blk_insert_bs(BlockBackend *blk, BlockDriverState *bs, Error **errp);
|
||||||
|
int blk_replace_bs(BlockBackend *blk, BlockDriverState *new_bs, Error **errp);
|
||||||
bool bdrv_has_blk(BlockDriverState *bs);
|
bool bdrv_has_blk(BlockDriverState *bs);
|
||||||
bool bdrv_is_root_node(BlockDriverState *bs);
|
bool bdrv_is_root_node(BlockDriverState *bs);
|
||||||
int blk_set_perm(BlockBackend *blk, uint64_t perm, uint64_t shared_perm,
|
int blk_set_perm(BlockBackend *blk, uint64_t perm, uint64_t shared_perm,
|
||||||
|
|
Loading…
Reference in New Issue