aboutsummaryrefslogtreecommitdiff
path: root/block/vpc.c
diff options
context:
space:
mode:
authorAlberto Faria <afaria@redhat.com>2022-06-09 16:27:35 +0100
committerHanna Reitz <hreitz@redhat.com>2022-07-12 12:14:55 +0200
commit53fb7844f03241a0e6de2c342c9e1b89df12da4d (patch)
tree917522c3ce90e4449ffa7fb2a430aa137c22391e /block/vpc.c
parent9548cbeffffd4253e38570d29b8cff0bf77c998f (diff)
downloadqemu-53fb7844f03241a0e6de2c342c9e1b89df12da4d.zip
qemu-53fb7844f03241a0e6de2c342c9e1b89df12da4d.tar.gz
qemu-53fb7844f03241a0e6de2c342c9e1b89df12da4d.tar.bz2
block: Add a 'flags' param to bdrv_{pread,pwrite,pwrite_sync}()
For consistency with other I/O functions, and in preparation to implement them using generated_co_wrapper. Callers were updated using this Coccinelle script: @@ expression child, offset, buf, bytes; @@ - bdrv_pread(child, offset, buf, bytes) + bdrv_pread(child, offset, buf, bytes, 0) @@ expression child, offset, buf, bytes; @@ - bdrv_pwrite(child, offset, buf, bytes) + bdrv_pwrite(child, offset, buf, bytes, 0) @@ expression child, offset, buf, bytes; @@ - bdrv_pwrite_sync(child, offset, buf, bytes) + bdrv_pwrite_sync(child, offset, buf, bytes, 0) Resulting 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: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Message-Id: <20220609152744.3891847-2-afaria@redhat.com> Reviewed-by: Hanna Reitz <hreitz@redhat.com> Signed-off-by: Hanna Reitz <hreitz@redhat.com>
Diffstat (limited to 'block/vpc.c')
-rw-r--r--block/vpc.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/block/vpc.c b/block/vpc.c
index 4d8f16e..1ccdfb0 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -252,7 +252,7 @@ static int vpc_open(BlockDriverState *bs, QDict *options, int flags,
goto fail;
}
- ret = bdrv_pread(bs->file, 0, &s->footer, sizeof(s->footer));
+ ret = bdrv_pread(bs->file, 0, &s->footer, sizeof(s->footer), 0);
if (ret < 0) {
error_setg(errp, "Unable to read VHD header");
goto fail;
@@ -272,8 +272,8 @@ static int vpc_open(BlockDriverState *bs, QDict *options, int flags,
}
/* If a fixed disk, the footer is found only at the end of the file */
- ret = bdrv_pread(bs->file, offset - sizeof(*footer),
- footer, sizeof(*footer));
+ ret = bdrv_pread(bs->file, offset - sizeof(*footer), footer,
+ sizeof(*footer), 0);
if (ret < 0) {
goto fail;
}
@@ -347,7 +347,7 @@ static int vpc_open(BlockDriverState *bs, QDict *options, int flags,
if (disk_type == VHD_DYNAMIC) {
ret = bdrv_pread(bs->file, be64_to_cpu(footer->data_offset),
- &dyndisk_header, sizeof(dyndisk_header));
+ &dyndisk_header, sizeof(dyndisk_header), 0);
if (ret < 0) {
error_setg(errp, "Error reading dynamic VHD header");
goto fail;
@@ -402,7 +402,7 @@ static int vpc_open(BlockDriverState *bs, QDict *options, int flags,
s->bat_offset = be64_to_cpu(dyndisk_header.table_offset);
ret = bdrv_pread(bs->file, s->bat_offset, s->pagetable,
- pagetable_size);
+ pagetable_size, 0);
if (ret < 0) {
error_setg(errp, "Error reading pagetable");
goto fail;
@@ -516,7 +516,8 @@ static inline int64_t get_image_offset(BlockDriverState *bs, uint64_t offset,
s->last_bitmap_offset = bitmap_offset;
memset(bitmap, 0xff, s->bitmap_size);
- r = bdrv_pwrite_sync(bs->file, bitmap_offset, bitmap, s->bitmap_size);
+ r = bdrv_pwrite_sync(bs->file, bitmap_offset, bitmap, s->bitmap_size,
+ 0);
if (r < 0) {
*err = r;
return -2;
@@ -538,7 +539,7 @@ static int rewrite_footer(BlockDriverState *bs)
BDRVVPCState *s = bs->opaque;
int64_t offset = s->free_data_block_offset;
- ret = bdrv_pwrite_sync(bs->file, offset, &s->footer, sizeof(s->footer));
+ ret = bdrv_pwrite_sync(bs->file, offset, &s->footer, sizeof(s->footer), 0);
if (ret < 0)
return ret;
@@ -573,7 +574,7 @@ static int64_t alloc_block(BlockDriverState *bs, int64_t offset)
/* Initialize the block's bitmap */
memset(bitmap, 0xff, s->bitmap_size);
ret = bdrv_pwrite_sync(bs->file, s->free_data_block_offset, bitmap,
- s->bitmap_size);
+ s->bitmap_size, 0);
if (ret < 0) {
return ret;
}
@@ -587,7 +588,7 @@ static int64_t alloc_block(BlockDriverState *bs, int64_t offset)
/* Write BAT entry to disk */
bat_offset = s->bat_offset + (4 * index);
bat_value = cpu_to_be32(s->pagetable[index]);
- ret = bdrv_pwrite_sync(bs->file, bat_offset, &bat_value, 4);
+ ret = bdrv_pwrite_sync(bs->file, bat_offset, &bat_value, 4, 0);
if (ret < 0)
goto fail;