提交 0c3c36d6 编写于 作者: M Max Reitz 提交者: Kevin Wolf

block: Add blk_insert_bs()

This function associates the given BlockDriverState with the given
BlockBackend.
Signed-off-by: NMax Reitz <mreitz@redhat.com>
Reviewed-by: NKevin Wolf <kwolf@redhat.com>
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
上级 a46fc9c9
...@@ -333,6 +333,17 @@ void blk_hide_on_behalf_of_hmp_drive_del(BlockBackend *blk) ...@@ -333,6 +333,17 @@ void blk_hide_on_behalf_of_hmp_drive_del(BlockBackend *blk)
} }
} }
/*
* Associates a new BlockDriverState with @blk.
*/
void blk_insert_bs(BlockBackend *blk, BlockDriverState *bs)
{
assert(!blk->bs && !bs->blk);
bdrv_ref(bs);
blk->bs = bs;
bs->blk = blk;
}
/* /*
* Attach device model @dev to @blk. * Attach device model @dev to @blk.
* Return 0 on success, -EBUSY when a device model is attached already. * Return 0 on success, -EBUSY when a device model is attached already.
......
...@@ -72,6 +72,7 @@ BlockBackend *blk_by_name(const char *name); ...@@ -72,6 +72,7 @@ BlockBackend *blk_by_name(const char *name);
BlockBackend *blk_next(BlockBackend *blk); BlockBackend *blk_next(BlockBackend *blk);
BlockDriverState *blk_bs(BlockBackend *blk); BlockDriverState *blk_bs(BlockBackend *blk);
void blk_insert_bs(BlockBackend *blk, BlockDriverState *bs);
void blk_hide_on_behalf_of_hmp_drive_del(BlockBackend *blk); void blk_hide_on_behalf_of_hmp_drive_del(BlockBackend *blk);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册