mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 17:23:56 -06:00
block: Add error parameter to blk_insert_bs()
Now that blk_insert_bs() requests the BlockBackend permissions for the node it attaches to, it can fail. Instead of aborting, pass the errors to the callers. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Acked-by: Fam Zheng <famz@redhat.com>
This commit is contained in:
parent
6d0eb64d5c
commit
d7086422b1
14 changed files with 100 additions and 29 deletions
|
@ -891,10 +891,14 @@ NBDExport *nbd_export_new(BlockDriverState *bs, off_t dev_offset, off_t size,
|
|||
{
|
||||
BlockBackend *blk;
|
||||
NBDExport *exp = g_malloc0(sizeof(NBDExport));
|
||||
int ret;
|
||||
|
||||
/* FIXME Use real permissions */
|
||||
blk = blk_new(0, BLK_PERM_ALL);
|
||||
blk_insert_bs(blk, bs);
|
||||
ret = blk_insert_bs(blk, bs, errp);
|
||||
if (ret < 0) {
|
||||
goto fail;
|
||||
}
|
||||
blk_set_enable_write_cache(blk, !writethrough);
|
||||
|
||||
exp->refcount = 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue