diff options
author | Alberto Faria | 2022-06-09 17:27:37 +0200 |
---|---|---|
committer | Hanna Reitz | 2022-07-12 12:14:55 +0200 |
commit | 353a5d84b25c335b259f37c4f43dad96e6d60ba8 (patch) | |
tree | 2bad4cabb0ec9703ee289439ca877b00b5f07696 /block/qcow2.c | |
parent | block: Change bdrv_{pread,pwrite,pwrite_sync}() param order (diff) | |
download | qemu-353a5d84b25c335b259f37c4f43dad96e6d60ba8.tar.gz qemu-353a5d84b25c335b259f37c4f43dad96e6d60ba8.tar.xz qemu-353a5d84b25c335b259f37c4f43dad96e6d60ba8.zip |
block: Make bdrv_{pread,pwrite}() return 0 on success
They currently return the value of their 'bytes' parameter on success.
Make them return 0 instead, for consistency with other I/O functions and
in preparation to implement them using generated_co_wrapper. This also
makes it clear that short reads/writes are not possible.
The few callers that rely on the previous behavior are adjusted
accordingly by hand.
Signed-off-by: Alberto Faria <afaria@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20220609152744.3891847-4-afaria@redhat.com>
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
Diffstat (limited to 'block/qcow2.c')
-rw-r--r-- | block/qcow2.c | 4 |
1 files changed, 2 insertions, 2 deletions
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; } static QDict* |