* [Qemu-devel] [PATCH] Fix improper usage of cpu_to_be32 in vpc
@ 2014-09-08 14:40 Xiaodong Gong
2014-09-08 15:34 ` Kevin Wolf
0 siblings, 1 reply; 6+ messages in thread
From: Xiaodong Gong @ 2014-09-08 14:40 UTC (permalink / raw)
To: kwolf; +Cc: qemu-devel, stefanha, Xiaodong Gong
From: Xiaodong Gong <gordongong0350@gmail.com>
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(-)
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH] Fix improper usage of cpu_to_be32 in vpc
@ 2014-09-05 18:40 21G
2014-09-08 11:10 ` Kevin Wolf
0 siblings, 1 reply; 6+ messages in thread
From: 21G @ 2014-09-05 18:40 UTC (permalink / raw)
To: kwolf, stefanha; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1835 bytes --]
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(-)
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
[-- Attachment #2: Type: text/html, Size: 2655 bytes --]
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] Fix improper usage of cpu_to_be32 in vpc
2014-09-05 18:40 21G
@ 2014-09-08 11:10 ` Kevin Wolf
0 siblings, 0 replies; 6+ messages in thread
From: Kevin Wolf @ 2014-09-08 11:10 UTC (permalink / raw)
To: 21G; +Cc: qemu-devel, stefanha
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH] Fix improper usage of cpu_to_be32 in vpc
@ 2014-09-04 14:43 Gordon Gong
2014-09-05 10:04 ` Stefan Hajnoczi
0 siblings, 1 reply; 6+ messages in thread
From: Gordon Gong @ 2014-09-04 14:43 UTC (permalink / raw)
To: stefanha; +Cc: Xiaoding (B), Liuji (Jeremy), Luohao (brian), qemu-devel
[-- Attachment #1.1: Type: text/plain, Size: 2031 bytes --]
>From fd3f0fd9c53d7782d4d835597c8a07b897bec3d0 Mon Sep 17 00:00:00 2001
From: Xiaodong Gong <gordongong0350@gmail.com>
Date: Sat, 30 Aug 2014 03:17:03 +0800
Subject: 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>
---
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
[-- Attachment #1.2: Type: text/html, Size: 11424 bytes --]
[-- Attachment #2: 0001-Fix-improper-usage-of-cpu_to_be32-in-vpc.patch --]
[-- Type: application/octet-stream, Size: 1995 bytes --]
From fd3f0fd9c53d7782d4d835597c8a07b897bec3d0 Mon Sep 17 00:00:00 2001
From: Xiaodong Gong <gordongong0350@gmail.com>
Date: Sat, 30 Aug 2014 03:17:03 +0800
Subject: 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>
---
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] Fix improper usage of cpu_to_be32 in vpc
2014-09-04 14:43 Gordon Gong
@ 2014-09-05 10:04 ` Stefan Hajnoczi
0 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2014-09-05 10:04 UTC (permalink / raw)
To: Gordon Gong
Cc: Xiaoding (B), Liuji (Jeremy), Luohao (brian), qemu-devel,
stefanha
[-- Attachment #1: Type: text/plain, Size: 834 bytes --]
On Thu, Sep 04, 2014 at 10:43:58PM +0800, Gordon Gong wrote:
> From fd3f0fd9c53d7782d4d835597c8a07b897bec3d0 Mon Sep 17 00:00:00 2001
>
> From: Xiaodong Gong <gordongong0350@gmail.com>
>
> Date: Sat, 30 Aug 2014 03:17:03 +0800
>
> Subject: 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>
>
> ---
>
> block/vpc.c | 8 ++++----
>
> 1 file changed, 4 insertions(+), 4 deletions(-)
This patch is malformed and does not apply with git-am(1). Please use
git-send-email(1) to send properly formatted patches.
Copy-pasting patches into GMail's web interface does not work.
http://qemu-project.org/Contribute/SubmitAPatch
Stefan
[-- Attachment #2: Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-09-08 15:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-08 14:40 [Qemu-devel] [PATCH] Fix improper usage of cpu_to_be32 in vpc Xiaodong Gong
2014-09-08 15:34 ` Kevin Wolf
-- strict thread matches above, loose matches on Subject: below --
2014-09-05 18:40 21G
2014-09-08 11:10 ` Kevin Wolf
2014-09-04 14:43 Gordon Gong
2014-09-05 10:04 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).