|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [qemu-upstream-unstable] vpc: Fix size in fixed image creation
commit c70221df1f89953e85a3f1f96ceefbd6888bb55f
Author: Kevin Wolf <kwolf@xxxxxxxxxx>
AuthorDate: Wed Feb 11 17:19:57 2015 +0100
Commit: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
CommitDate: Sun Mar 8 22:58:14 2015 -0500
vpc: Fix size in fixed image creation
If total_sectors is rounded to match the geometry, total_size needs to
be changed as well. Otherwise we end up with an image whose geometry
describes a disk larger than the image file, which doesn't end well.
Signed-off-by: Kevin Wolf <kwolf@xxxxxxxxxx>
Reviewed-by: Max Reitz <mreitz@xxxxxxxxxx>
(cherry picked from commit c7dd631d482912fd615a9ef18a0e0691e7a84836)
Signed-off-by: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
---
block/vpc.c | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/block/vpc.c b/block/vpc.c
index 38c4f02..40baa64 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -801,6 +801,7 @@ static int vpc_create(const char *filename, QemuOpts *opts,
Error **errp)
}
total_sectors = (int64_t) cyls * heads * secs_per_cyl;
+ total_size = total_sectors * BDRV_SECTOR_SIZE;
/* Prepare the Hard Disk Footer */
memset(buf, 0, 1024);
@@ -822,13 +823,8 @@ static int vpc_create(const char *filename, QemuOpts
*opts, Error **errp)
/* Version of Virtual PC 2007 */
footer->major = cpu_to_be16(0x0005);
footer->minor = cpu_to_be16(0x0003);
- if (disk_type == VHD_DYNAMIC) {
- footer->orig_size = cpu_to_be64(total_sectors * 512);
- footer->size = cpu_to_be64(total_sectors * 512);
- } else {
- footer->orig_size = cpu_to_be64(total_size);
- footer->size = cpu_to_be64(total_size);
- }
+ footer->orig_size = cpu_to_be64(total_size);
+ footer->size = cpu_to_be64(total_size);
footer->cyls = cpu_to_be16(cyls);
footer->heads = heads;
footer->secs_per_cyl = secs_per_cyl;
--
generated by git-patchbot for /home/xen/git/qemu-upstream-unstable.git
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |