From 353a5d84b25c335b259f37c4f43dad96e6d60ba8 Mon Sep 17 00:00:00 2001 From: Alberto Faria Date: Thu, 9 Jun 2022 16:27:37 +0100 Subject: 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 Reviewed-by: Paolo Bonzini Reviewed-by: Stefan Hajnoczi Message-Id: <20220609152744.3891847-4-afaria@redhat.com> Reviewed-by: Hanna Reitz Signed-off-by: Hanna Reitz --- block/crypto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'block/crypto.c') diff --git a/block/crypto.c b/block/crypto.c index deec7fae2f..e7f5c4e31a 100644 --- a/block/crypto.c +++ b/block/crypto.c @@ -70,7 +70,7 @@ static ssize_t block_crypto_read_func(QCryptoBlock *block, error_setg_errno(errp, -ret, "Could not read encryption header"); return ret; } - return ret; + return buflen; } static ssize_t block_crypto_write_func(QCryptoBlock *block, @@ -88,7 +88,7 @@ static ssize_t block_crypto_write_func(QCryptoBlock *block, error_setg_errno(errp, -ret, "Could not write encryption header"); return ret; } - return ret; + return buflen; } -- cgit v1.2.3