qemu-devel
[
Top
][
All Lists
]
Advanced
[
Date Prev
][
Date Next
][
Thread Prev
][
Thread Next
][
Date Index
][
Thread Index
]
[Qemu-devel] [PATCH] Fix improper usage of cpu_to_be32 in vpc
From
:
21G
Subject
:
[Qemu-devel] [PATCH] Fix improper usage of cpu_to_be32 in vpc
Date
:
Sat, 6 Sep 2014 02:40:23 +0800
cpu_to_be32() is wrong since vhd_type is an enum constant
(just a regular CPU-endian integer).
Signed-off-by: Xiaodong Gong <address@hidden>
---
block/vpc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/block/vpc.c b/block/vpc.c
index 055efc4..c024b4c 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;
--
1.8.3.1
reply via email to
[
Prev in Thread
]
Current Thread
[
Next in Thread
]
[Qemu-devel] [PATCH] Fix improper usage of cpu_to_be32 in vpc
,
Gordon Gong
,
2014/09/04
Re: [Qemu-devel] [PATCH] Fix improper usage of cpu_to_be32 in vpc
,
Stefan Hajnoczi
,
2014/09/05
[Qemu-devel] [PATCH] Fix improper usage of cpu_to_be32 in vpc
,
21G
<=
Re: [Qemu-devel] [PATCH] Fix improper usage of cpu_to_be32 in vpc
,
Kevin Wolf
,
2014/09/08
[Qemu-devel] [PATCH] Fix improper usage of cpu_to_be32 in vpc
,
Xiaodong Gong
,
2014/09/08
Re: [Qemu-devel] [PATCH] Fix improper usage of cpu_to_be32 in vpc
,
Kevin Wolf
,
2014/09/08
Prev by Date:
Re: [Qemu-devel] [PATCH v7 24/28] ide: add bootindex to qom property
Next by Date:
[Qemu-devel] [RFC PATCH v2] Support vhd type VHD_DIFFERENCING
Previous by thread:
Re: [Qemu-devel] [PATCH] Fix improper usage of cpu_to_be32 in vpc
Next by thread:
Re: [Qemu-devel] [PATCH] Fix improper usage of cpu_to_be32 in vpc
Index(es):
Date
Thread