summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorXiaodong Gong <gordongong0350@gmail.com>2014-09-08 22:40:44 +0800
committerKevin Wolf <kwolf@redhat.com>2014-09-10 10:41:29 +0200
commit0d4cc3e715f5794077895345577725539afe81eb (patch)
tree3de9de9a6a2efc3209817ddbb8df7fced81a458d /block
parentc7c2ff0c7e5d2c04fc612d74caab19b41c52c2e9 (diff)
downloadqemu-0d4cc3e715f5794077895345577725539afe81eb.tar.gz
qemu-0d4cc3e715f5794077895345577725539afe81eb.tar.bz2
qemu-0d4cc3e715f5794077895345577725539afe81eb.zip
Fix improper usage of cpu_to_be32 in vpc
cpu_to_be32() is wrong since vhd_type is an enum constant (just a regular CPU-endian integer). Signed-off-by: Xiaodong Gong <gordongong0350@gmail.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/vpc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/block/vpc.c b/block/vpc.c
index 055efc42d2..c024b4cf3f 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -489,7 +489,7 @@ static int vpc_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
BDRVVPCState *s = (BDRVVPCState *)bs->opaque;
VHDFooter *footer = (VHDFooter *) s->footer_buf;
- if (cpu_to_be32(footer->type) != VHD_FIXED) {
+ if (be32_to_cpu(footer->type) != VHD_FIXED) {
bdi->cluster_size = s->block_size;
}
@@ -506,7 +506,7 @@ static int vpc_read(BlockDriverState *bs, int64_t sector_num,
int64_t sectors, sectors_per_block;
VHDFooter *footer = (VHDFooter *) s->footer_buf;
- if (cpu_to_be32(footer->type) == VHD_FIXED) {
+ if (be32_to_cpu(footer->type) == VHD_FIXED) {
return bdrv_read(bs->file, sector_num, buf, nb_sectors);
}
while (nb_sectors > 0) {
@@ -555,7 +555,7 @@ static int vpc_write(BlockDriverState *bs, int64_t sector_num,
int ret;
VHDFooter *footer = (VHDFooter *) s->footer_buf;
- if (cpu_to_be32(footer->type) == VHD_FIXED) {
+ if (be32_to_cpu(footer->type) == VHD_FIXED) {
return bdrv_write(bs->file, sector_num, buf, nb_sectors);
}
while (nb_sectors > 0) {
@@ -857,7 +857,7 @@ static int vpc_has_zero_init(BlockDriverState *bs)
BDRVVPCState *s = bs->opaque;
VHDFooter *footer = (VHDFooter *) s->footer_buf;
- if (cpu_to_be32(footer->type) == VHD_FIXED) {
+ if (be32_to_cpu(footer->type) == VHD_FIXED) {
return bdrv_has_zero_init(bs->file);
} else {
return 1;