summaryrefslogtreecommitdiffstats
path: root/qemu-img.c
diff options
context:
space:
mode:
authorAlberto Faria2022-07-05 18:15:10 +0200
committerHanna Reitz2022-07-12 12:14:56 +0200
commit3b35d4542c8537a9269f6372df531ced6c960084 (patch)
tree0a59e4957fa7193db852233956f77515e37a2c41 /qemu-img.c
parentblock: Make blk_{pread,pwrite}() return 0 on success (diff)
downloadqemu-3b35d4542c8537a9269f6372df531ced6c960084.tar.gz
qemu-3b35d4542c8537a9269f6372df531ced6c960084.tar.xz
qemu-3b35d4542c8537a9269f6372df531ced6c960084.zip
block: Add a 'flags' param to blk_pread()
For consistency with other I/O functions, and in preparation to implement it using generated_co_wrapper. Callers were updated using this Coccinelle script: @@ expression blk, offset, buf, bytes; @@ - blk_pread(blk, offset, buf, bytes) + blk_pread(blk, offset, buf, bytes, 0) It had no effect on hw/block/nand.c, presumably due to the #if, so that file was updated manually. Overly-long lines were then fixed by hand. Signed-off-by: Alberto Faria <afaria@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Greg Kurz <groug@kaod.org> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Message-Id: <20220705161527.1054072-3-afaria@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
Diffstat (limited to 'qemu-img.c')
-rw-r--r--qemu-img.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/qemu-img.c b/qemu-img.c
index 2dc07e5ac3..a0c0e8914e 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1309,7 +1309,7 @@ static int check_empty_sectors(BlockBackend *blk, int64_t offset,
int ret = 0;
int64_t idx;
- ret = blk_pread(blk, offset, buffer, bytes);
+ ret = blk_pread(blk, offset, buffer, bytes, 0);
if (ret < 0) {
error_report("Error while reading offset %" PRId64 " of %s: %s",
offset, filename, strerror(-ret));
@@ -1526,7 +1526,7 @@ static int img_compare(int argc, char **argv)
int64_t pnum;
chunk = MIN(chunk, IO_BUF_SIZE);
- ret = blk_pread(blk1, offset, buf1, chunk);
+ ret = blk_pread(blk1, offset, buf1, chunk, 0);
if (ret < 0) {
error_report("Error while reading offset %" PRId64
" of %s: %s",
@@ -1534,7 +1534,7 @@ static int img_compare(int argc, char **argv)
ret = 4;
goto out;
}
- ret = blk_pread(blk2, offset, buf2, chunk);
+ ret = blk_pread(blk2, offset, buf2, chunk, 0);
if (ret < 0) {
error_report("Error while reading offset %" PRId64
" of %s: %s",
@@ -3779,7 +3779,7 @@ static int img_rebase(int argc, char **argv)
n = old_backing_size - offset;
}
- ret = blk_pread(blk_old_backing, offset, buf_old, n);
+ ret = blk_pread(blk_old_backing, offset, buf_old, n, 0);
if (ret < 0) {
error_report("error while reading from old backing file");
goto out;
@@ -3793,7 +3793,7 @@ static int img_rebase(int argc, char **argv)
n = new_backing_size - offset;
}
- ret = blk_pread(blk_new_backing, offset, buf_new, n);
+ ret = blk_pread(blk_new_backing, offset, buf_new, n, 0);
if (ret < 0) {
error_report("error while reading from new backing file");
goto out;
@@ -5122,7 +5122,7 @@ static int img_dd(int argc, char **argv)
for (out_pos = 0; in_pos < size; block_count++) {
int bytes = (in_pos + in.bsz > size) ? size - in_pos : in.bsz;
- ret = blk_pread(blk1, in_pos, in.buf, bytes);
+ ret = blk_pread(blk1, in_pos, in.buf, bytes, 0);
if (ret < 0) {
error_report("error while reading from input image file: %s",
strerror(-ret));