diff mbox

Fix improper usage of cpu_to_be32 in vpc

Message ID tencent_7988986C4A3BA2306FFC0830@qq.com
State New
Headers show

Commit Message

=?ISO-8859-1?B?MjFH?= Sept. 5, 2014, 6:40 p.m. UTC
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>

---
 block/vpc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

-- 
1.8.3.1

Comments

Kevin Wolf Sept. 8, 2014, 11:10 a.m. UTC | #1
Am 05.09.2014 um 20:40 hat 21G geschrieben:
> 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>

Please use 'git send-email' to send patches. Neither 'git am' nor
'patch' can seem to apply this patch (firstly because this is not a
plain text, but a multipart email, but even when doing the extra effort
of saving just the text part it doesn't work).

The same is true for your other patch.

Kevin
diff mbox

Patch

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;