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>
diff --git a/block/vmdk.c b/block/vmdk.c
index aacea10..332565c 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -473,7 +473,6 @@
if (ret < 0) {
goto out;
}
- ret = 0;
p_name = strstr(desc, "parentFileNameHint");
if (p_name != NULL) {
@@ -905,7 +904,7 @@
g_free(buf);
return NULL;
}
- buf[ret] = 0;
+ buf[size] = 0;
return buf;
}
@@ -1630,7 +1629,7 @@
l2_size_bytes,
l2_table,
0
- ) != l2_size_bytes) {
+ ) < 0) {
return VMDK_ERROR;
}