mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
block: Make .bdrv_load_vmstate() vectored
This brings it in line with .bdrv_save_vmstate(). Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
f1e8474115
commit
5ddda0b8f0
5 changed files with 36 additions and 13 deletions
25
block/io.c
25
block/io.c
|
@ -1870,14 +1870,29 @@ int bdrv_writev_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos)
|
|||
|
||||
int bdrv_load_vmstate(BlockDriverState *bs, uint8_t *buf,
|
||||
int64_t pos, int size)
|
||||
{
|
||||
QEMUIOVector qiov;
|
||||
struct iovec iov = {
|
||||
.iov_base = buf,
|
||||
.iov_len = size,
|
||||
};
|
||||
|
||||
qemu_iovec_init_external(&qiov, &iov, 1);
|
||||
return bdrv_readv_vmstate(bs, &qiov, pos);
|
||||
}
|
||||
|
||||
int bdrv_readv_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos)
|
||||
{
|
||||
BlockDriver *drv = bs->drv;
|
||||
if (!drv)
|
||||
|
||||
if (!drv) {
|
||||
return -ENOMEDIUM;
|
||||
if (drv->bdrv_load_vmstate)
|
||||
return drv->bdrv_load_vmstate(bs, buf, pos, size);
|
||||
if (bs->file)
|
||||
return bdrv_load_vmstate(bs->file->bs, buf, pos, size);
|
||||
} else if (drv->bdrv_load_vmstate) {
|
||||
return drv->bdrv_load_vmstate(bs, qiov, pos);
|
||||
} else if (bs->file) {
|
||||
return bdrv_readv_vmstate(bs->file->bs, qiov, pos);
|
||||
}
|
||||
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue