qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 3/6] block: Allow .bdrv_load/save_vmstate() to r


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 3/6] block: Allow .bdrv_load/save_vmstate() to return 0/-errno
Date: Fri, 10 Jun 2016 15:29:39 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 06/10/2016 10:05 AM, Kevin Wolf wrote:
> 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 <address@hidden>
> ---
>  block/io.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/block/io.c b/block/io.c
> index 602c7d3..bca244c 100644
> --- a/block/io.c
> +++ b/block/io.c
> @@ -1839,9 +1839,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)
> @@ -1870,7 +1877,12 @@ int bdrv_load_vmstate(BlockDriverState *bs, uint8_t 
> *buf,
>      int ret;

Aha, my complaint in v2 about it being dead means you need to reinstate
it here.

>  
>      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)
> 

Matches the semantics we have elsewhere (I'm not sure if 'size' is the
best choice if we ever need to support short read/write, but doesn't
seem to hurt).

Reviewed-by: Eric Blake <address@hidden>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]