aboutsummaryrefslogtreecommitdiff
path: root/block/vhdx.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/vhdx.c')
-rw-r--r--block/vhdx.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/block/vhdx.c b/block/vhdx.c
index f5c812c9cf..12f5261f80 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, 0);
+ ret = bdrv_pread(file, offset, VHDX_HEADER_SIZE, buffer, 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), 0);
+ ret = bdrv_pwrite_sync(file, offset, sizeof(VHDXHeader), header_le, 0);
exit:
qemu_vfree(buffer);
@@ -440,7 +440,7 @@ 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, VHDX_HEADER_SIZE, buffer,
0);
if (ret < 0) {
goto fail;
@@ -457,7 +457,7 @@ 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, VHDX_HEADER_SIZE, buffer,
0);
if (ret < 0) {
goto fail;
@@ -531,8 +531,8 @@ static int vhdx_open_region_tables(BlockDriverState *bs, BDRVVHDXState *s)
* whole block */
buffer = qemu_blockalign(bs, VHDX_HEADER_BLOCK_SIZE);
- ret = bdrv_pread(bs->file, VHDX_REGION_TABLE_OFFSET, buffer,
- VHDX_HEADER_BLOCK_SIZE, 0);
+ ret = bdrv_pread(bs->file, VHDX_REGION_TABLE_OFFSET,
+ VHDX_HEADER_BLOCK_SIZE, buffer, 0);
if (ret < 0) {
goto fail;
}
@@ -644,8 +644,8 @@ 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, 0);
+ ret = bdrv_pread(bs->file, s->metadata_rt.file_offset,
+ VHDX_METADATA_TABLE_MAX_SIZE, buffer, 0);
if (ret < 0) {
goto exit;
}
@@ -750,8 +750,8 @@ static int vhdx_parse_metadata(BlockDriverState *bs, BDRVVHDXState *s)
ret = bdrv_pread(bs->file,
s->metadata_entries.file_parameters_entry.offset
+ s->metadata_rt.file_offset,
- &s->params,
sizeof(s->params),
+ &s->params,
0);
if (ret < 0) {
@@ -786,8 +786,8 @@ static int vhdx_parse_metadata(BlockDriverState *bs, BDRVVHDXState *s)
ret = bdrv_pread(bs->file,
s->metadata_entries.virtual_disk_size_entry.offset
+ s->metadata_rt.file_offset,
- &s->virtual_disk_size,
sizeof(uint64_t),
+ &s->virtual_disk_size,
0);
if (ret < 0) {
goto exit;
@@ -795,8 +795,8 @@ static int vhdx_parse_metadata(BlockDriverState *bs, BDRVVHDXState *s)
ret = bdrv_pread(bs->file,
s->metadata_entries.logical_sector_size_entry.offset
+ s->metadata_rt.file_offset,
- &s->logical_sector_size,
sizeof(uint32_t),
+ &s->logical_sector_size,
0);
if (ret < 0) {
goto exit;
@@ -804,8 +804,8 @@ static int vhdx_parse_metadata(BlockDriverState *bs, BDRVVHDXState *s)
ret = bdrv_pread(bs->file,
s->metadata_entries.phys_sector_size_entry.offset
+ s->metadata_rt.file_offset,
- &s->physical_sector_size,
sizeof(uint32_t),
+ &s->physical_sector_size,
0);
if (ret < 0) {
goto exit;
@@ -1014,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), 0);
+ ret = bdrv_pread(bs->file, 0, sizeof(uint64_t), &signature, 0);
if (ret < 0) {
goto fail;
}
@@ -1073,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, 0);
+ ret = bdrv_pread(bs->file, s->bat_offset, s->bat_rt.length, s->bat, 0);
if (ret < 0) {
goto fail;
}