[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 03/10] block: Make bdrv_{pread,pwrite}() return 0 on succe
From: |
Stefan Hajnoczi |
Subject: |
Re: [PATCH v3 03/10] block: Make bdrv_{pread,pwrite}() return 0 on success |
Date: |
Thu, 26 May 2022 09:49:03 +0100 |
On Thu, May 19, 2022 at 03:48:33PM +0100, Alberto Faria wrote:
> diff --git a/block/qcow2.c b/block/qcow2.c
> index 5493e6b847..d5a1e8bc43 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -113,7 +113,7 @@ static ssize_t qcow2_crypto_hdr_read_func(QCryptoBlock
> *block, size_t offset,
> error_setg_errno(errp, -ret, "Could not read encryption header");
> return -1;
> }
> - return ret;
> + return buflen;
> }
>
>
> @@ -174,7 +174,7 @@ static ssize_t qcow2_crypto_hdr_write_func(QCryptoBlock
> *block, size_t offset,
> error_setg_errno(errp, -ret, "Could not read encryption header");
> return -1;
> }
> - return ret;
> + return buflen;
> }
I think block/crypto.c's read_func and write_func could be converted to
0 (success) and -errno (failure) in the same way. Callers don't handle
cases where the return value != buflen or failure.
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
signature.asc
Description: PGP signature
- [PATCH v3 06/10] block: Make 'bytes' param of bdrv_co_{pread, pwrite, preadv, pwritev}() an int64_t, (continued)
- [PATCH v3 06/10] block: Make 'bytes' param of bdrv_co_{pread, pwrite, preadv, pwritev}() an int64_t, Alberto Faria, 2022/05/19
- Re: [PATCH v3 06/10] block: Make 'bytes' param of bdrv_co_{pread,pwrite,preadv,pwritev}() an int64_t, Eric Blake, 2022/05/24
- Re: [PATCH v3 06/10] block: Make 'bytes' param of bdrv_co_{pread,pwrite,preadv,pwritev}() an int64_t, Stefan Hajnoczi, 2022/05/26
- Re: [PATCH v3 06/10] block: Make 'bytes' param of bdrv_co_{pread, pwrite, preadv, pwritev}() an int64_t, Alberto Faria, 2022/05/26
- Re: [PATCH v3 06/10] block: Make 'bytes' param of bdrv_co_{pread,pwrite,preadv,pwritev}() an int64_t, Eric Blake, 2022/05/27
- [PATCH v3 07/10] block: Implement bdrv_{pread, pwrite, pwrite_zeroes}() using generated_co_wrapper, Alberto Faria, 2022/05/19
[PATCH v3 03/10] block: Make bdrv_{pread, pwrite}() return 0 on success, Alberto Faria, 2022/05/19
[PATCH v3 09/10] block: Use bdrv_co_pwrite_sync() when caller is coroutine_fn, Alberto Faria, 2022/05/19
[PATCH v3 08/10] block: Add bdrv_co_pwrite_sync(), Alberto Faria, 2022/05/19
[PATCH v3 10/10] block/qcow2: Use bdrv_pwrite_sync() in qcow2_mark_dirty(), Alberto Faria, 2022/05/19
[PATCH v3 04/10] crypto: Make block callbacks return 0 on success, Alberto Faria, 2022/05/19