mirror of
https://github.com/mii443/qemu.git
synced 2025-09-01 14:49:23 +00: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:
@ -73,6 +73,7 @@ static void parse_drive(DeviceState *dev, const char *str, void **ptr,
|
||||
{
|
||||
BlockBackend *blk;
|
||||
bool blk_created = false;
|
||||
int ret;
|
||||
|
||||
blk = blk_by_name(str);
|
||||
if (!blk) {
|
||||
@ -80,8 +81,12 @@ static void parse_drive(DeviceState *dev, const char *str, void **ptr,
|
||||
if (bs) {
|
||||
/* FIXME Use real permissions */
|
||||
blk = blk_new(0, BLK_PERM_ALL);
|
||||
blk_insert_bs(blk, bs);
|
||||
blk_created = true;
|
||||
|
||||
ret = blk_insert_bs(blk, bs, errp);
|
||||
if (ret < 0) {
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!blk) {
|
||||
|
Reference in New Issue
Block a user