mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
block: Introduce bdrv_writev_vmstate
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
e2ec3f9768
commit
cf8074b382
5 changed files with 42 additions and 13 deletions
25
block.c
25
block.c
|
@ -3183,14 +3183,29 @@ int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
|
|||
|
||||
int bdrv_save_vmstate(BlockDriverState *bs, const uint8_t *buf,
|
||||
int64_t pos, int size)
|
||||
{
|
||||
QEMUIOVector qiov;
|
||||
struct iovec iov = {
|
||||
.iov_base = (void *) buf,
|
||||
.iov_len = size,
|
||||
};
|
||||
|
||||
qemu_iovec_init_external(&qiov, &iov, 1);
|
||||
return bdrv_writev_vmstate(bs, &qiov, pos);
|
||||
}
|
||||
|
||||
int bdrv_writev_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos)
|
||||
{
|
||||
BlockDriver *drv = bs->drv;
|
||||
if (!drv)
|
||||
|
||||
if (!drv) {
|
||||
return -ENOMEDIUM;
|
||||
if (drv->bdrv_save_vmstate)
|
||||
return drv->bdrv_save_vmstate(bs, buf, pos, size);
|
||||
if (bs->file)
|
||||
return bdrv_save_vmstate(bs->file, buf, pos, size);
|
||||
} else if (drv->bdrv_save_vmstate) {
|
||||
return drv->bdrv_save_vmstate(bs, qiov, pos);
|
||||
} else if (bs->file) {
|
||||
return bdrv_writev_vmstate(bs->file, qiov, pos);
|
||||
}
|
||||
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue