提交 b433d942 编写于 作者: K Kevin Wolf

block: Allow .bdrv_load/save_vmstate() to return 0/-errno

The return value of .bdrv_load/save_vmstate() can be any non-negative
number in case of success now. It used to be bytes/-errno.
Signed-off-by: NKevin Wolf <kwolf@redhat.com>
Reviewed-by: NFam Zheng <famz@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
Reviewed-by: NStefan Hajnoczi <stefanha@redhat.com>
上级 5ddda0b8
......@@ -1848,9 +1848,16 @@ int bdrv_save_vmstate(BlockDriverState *bs, const uint8_t *buf,
.iov_base = (void *) buf,
.iov_len = size,
};
int ret;
qemu_iovec_init_external(&qiov, &iov, 1);
return bdrv_writev_vmstate(bs, &qiov, pos);
ret = bdrv_writev_vmstate(bs, &qiov, pos);
if (ret < 0) {
return ret;
}
return size;
}
int bdrv_writev_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos)
......@@ -1876,9 +1883,15 @@ int bdrv_load_vmstate(BlockDriverState *bs, uint8_t *buf,
.iov_base = buf,
.iov_len = size,
};
int ret;
qemu_iovec_init_external(&qiov, &iov, 1);
return bdrv_readv_vmstate(bs, &qiov, pos);
ret = bdrv_readv_vmstate(bs, &qiov, pos);
if (ret < 0) {
return ret;
}
return size;
}
int bdrv_readv_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册