diff options
author | Alberto Faria <afaria@redhat.com> | 2022-06-09 16:27:35 +0100 |
---|---|---|
committer | Hanna Reitz <hreitz@redhat.com> | 2022-07-12 12:14:55 +0200 |
commit | 53fb7844f03241a0e6de2c342c9e1b89df12da4d (patch) | |
tree | 917522c3ce90e4449ffa7fb2a430aa137c22391e /block/vhdx.c | |
parent | 9548cbeffffd4253e38570d29b8cff0bf77c998f (diff) |
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/vhdx.c')
-rw-r--r-- | block/vhdx.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/block/vhdx.c b/block/vhdx.c index 410c6f9610..f5c812c9cf 100644 --- a/block/vhdx.c +++ b/block/vhdx.c @@ -326,7 +326,7 @@ static int vhdx_write_header(BdrvChild *file, VHDXHeader *hdr, buffer = qemu_blockalign(bs_file, VHDX_HEADER_SIZE); if (read) { /* if true, we can't assume the extra reserved bytes are 0 */ - ret = bdrv_pread(file, offset, buffer, VHDX_HEADER_SIZE); + ret = bdrv_pread(file, offset, buffer, VHDX_HEADER_SIZE, 0); if (ret < 0) { goto exit; } @@ -340,7 +340,7 @@ static int vhdx_write_header(BdrvChild *file, VHDXHeader *hdr, vhdx_header_le_export(hdr, header_le); vhdx_update_checksum(buffer, VHDX_HEADER_SIZE, offsetof(VHDXHeader, checksum)); - ret = bdrv_pwrite_sync(file, offset, header_le, sizeof(VHDXHeader)); + ret = bdrv_pwrite_sync(file, offset, header_le, sizeof(VHDXHeader), 0); exit: qemu_vfree(buffer); @@ -440,8 +440,8 @@ static void vhdx_parse_header(BlockDriverState *bs, BDRVVHDXState *s, /* We have to read the whole VHDX_HEADER_SIZE instead of * sizeof(VHDXHeader), because the checksum is over the whole * region */ - ret = bdrv_pread(bs->file, VHDX_HEADER1_OFFSET, buffer, - VHDX_HEADER_SIZE); + ret = bdrv_pread(bs->file, VHDX_HEADER1_OFFSET, buffer, VHDX_HEADER_SIZE, + 0); if (ret < 0) { goto fail; } @@ -457,8 +457,8 @@ static void vhdx_parse_header(BlockDriverState *bs, BDRVVHDXState *s, } } - ret = bdrv_pread(bs->file, VHDX_HEADER2_OFFSET, buffer, - VHDX_HEADER_SIZE); + ret = bdrv_pread(bs->file, VHDX_HEADER2_OFFSET, buffer, VHDX_HEADER_SIZE, + 0); if (ret < 0) { goto fail; } @@ -532,7 +532,7 @@ static int vhdx_open_region_tables(BlockDriverState *bs, BDRVVHDXState *s) buffer = qemu_blockalign(bs, VHDX_HEADER_BLOCK_SIZE); ret = bdrv_pread(bs->file, VHDX_REGION_TABLE_OFFSET, buffer, - VHDX_HEADER_BLOCK_SIZE); + VHDX_HEADER_BLOCK_SIZE, 0); if (ret < 0) { goto fail; } @@ -645,7 +645,7 @@ static int vhdx_parse_metadata(BlockDriverState *bs, BDRVVHDXState *s) buffer = qemu_blockalign(bs, VHDX_METADATA_TABLE_MAX_SIZE); ret = bdrv_pread(bs->file, s->metadata_rt.file_offset, buffer, - VHDX_METADATA_TABLE_MAX_SIZE); + VHDX_METADATA_TABLE_MAX_SIZE, 0); if (ret < 0) { goto exit; } @@ -751,7 +751,8 @@ static int vhdx_parse_metadata(BlockDriverState *bs, BDRVVHDXState *s) s->metadata_entries.file_parameters_entry.offset + s->metadata_rt.file_offset, &s->params, - sizeof(s->params)); + sizeof(s->params), + 0); if (ret < 0) { goto exit; @@ -786,7 +787,8 @@ static int vhdx_parse_metadata(BlockDriverState *bs, BDRVVHDXState *s) s->metadata_entries.virtual_disk_size_entry.offset + s->metadata_rt.file_offset, &s->virtual_disk_size, - sizeof(uint64_t)); + sizeof(uint64_t), + 0); if (ret < 0) { goto exit; } @@ -794,7 +796,8 @@ static int vhdx_parse_metadata(BlockDriverState *bs, BDRVVHDXState *s) s->metadata_entries.logical_sector_size_entry.offset + s->metadata_rt.file_offset, &s->logical_sector_size, - sizeof(uint32_t)); + sizeof(uint32_t), + 0); if (ret < 0) { goto exit; } @@ -802,7 +805,8 @@ static int vhdx_parse_metadata(BlockDriverState *bs, BDRVVHDXState *s) s->metadata_entries.phys_sector_size_entry.offset + s->metadata_rt.file_offset, &s->physical_sector_size, - sizeof(uint32_t)); + sizeof(uint32_t), + 0); if (ret < 0) { goto exit; } @@ -1010,7 +1014,7 @@ static int vhdx_open(BlockDriverState *bs, QDict *options, int flags, QLIST_INIT(&s->regions); /* validate the file signature */ - ret = bdrv_pread(bs->file, 0, &signature, sizeof(uint64_t)); + ret = bdrv_pread(bs->file, 0, &signature, sizeof(uint64_t), 0); if (ret < 0) { goto fail; } @@ -1069,7 +1073,7 @@ static int vhdx_open(BlockDriverState *bs, QDict *options, int flags, goto fail; } - ret = bdrv_pread(bs->file, s->bat_offset, s->bat, s->bat_rt.length); + ret = bdrv_pread(bs->file, s->bat_offset, s->bat, s->bat_rt.length, 0); if (ret < 0) { goto fail; } |