diff options
author | Kevin Wolf <kwolf@redhat.com> | 2016-06-10 17:57:26 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2016-06-16 15:19:55 +0200 |
commit | b433d9424d271ce68f592590f77dc2b30944d3a5 (patch) | |
tree | db7b78b61be708dc432cdf9706ea112baf002164 /block/io.c | |
parent | 5ddda0b8f0c07c8082c87d248c8eb23f43fd44a1 (diff) |
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: 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>
Diffstat (limited to 'block/io.c')
-rw-r--r-- | block/io.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/block/io.c b/block/io.c index aac9b67d94..af4d43ebef 100644 --- a/block/io.c +++ b/block/io.c @@ -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) |