summaryrefslogtreecommitdiffstats
path: root/block.c
diff options
context:
space:
mode:
authorAlberto Faria2022-07-05 18:15:09 +0200
committerHanna Reitz2022-07-12 12:14:56 +0200
commitbf5b16fa401633475d21d69c66532f5b29e8433d (patch)
tree60779d913b400906135b6bbce90d6128a52ac3ef /block.c
parenttests/qemu-iotests: skip 108 when FUSE is not loaded (diff)
downloadqemu-bf5b16fa401633475d21d69c66532f5b29e8433d.tar.gz
qemu-bf5b16fa401633475d21d69c66532f5b29e8433d.tar.xz
qemu-bf5b16fa401633475d21d69c66532f5b29e8433d.zip
block: Make blk_{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. Signed-off-by: Alberto Faria <afaria@redhat.com> Message-Id: <20220705161527.1054072-2-afaria@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/block.c b/block.c
index 2c00dddd80..0fd830e2e2 100644
--- a/block.c
+++ b/block.c
@@ -1045,14 +1045,16 @@ static int find_image_format(BlockBackend *file, const char *filename,
return ret;
}
- drv = bdrv_probe_all(buf, ret, filename);
+ drv = bdrv_probe_all(buf, sizeof(buf), filename);
if (!drv) {
error_setg(errp, "Could not determine image format: No compatible "
"driver found");
- ret = -ENOENT;
+ *pdrv = NULL;
+ return -ENOENT;
}
+
*pdrv = drv;
- return ret;
+ return 0;
}
/**