mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
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>
This commit is contained in:
parent
92529251d2
commit
bf5b16fa40
12 changed files with 49 additions and 51 deletions
|
@ -891,14 +891,14 @@ static int coroutine_fn qcow_co_create(BlockdevCreateOptions *opts,
|
|||
|
||||
/* write all the data */
|
||||
ret = blk_pwrite(qcow_blk, 0, &header, sizeof(header), 0);
|
||||
if (ret != sizeof(header)) {
|
||||
if (ret < 0) {
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (qcow_opts->has_backing_file) {
|
||||
ret = blk_pwrite(qcow_blk, sizeof(header),
|
||||
qcow_opts->backing_file, backing_filename_len, 0);
|
||||
if (ret != backing_filename_len) {
|
||||
if (ret < 0) {
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
@ -908,7 +908,7 @@ static int coroutine_fn qcow_co_create(BlockdevCreateOptions *opts,
|
|||
i++) {
|
||||
ret = blk_pwrite(qcow_blk, header_size + BDRV_SECTOR_SIZE * i,
|
||||
tmp, BDRV_SECTOR_SIZE, 0);
|
||||
if (ret != BDRV_SECTOR_SIZE) {
|
||||
if (ret < 0) {
|
||||
g_free(tmp);
|
||||
goto exit;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue