cd9d161
From 69a9776f3e8a4ff5311f78cc63e52ea436dd9cbe Mon Sep 17 00:00:00 2001
cd9d161
From: Charles Arnold <carnold@suse.com>
cd9d161
Date: Wed, 9 Nov 2011 09:32:25 -0700
cd9d161
Subject: [PATCH] block: Fix vpc initialization of the Dynamic Disk Header
cd9d161
MIME-Version: 1.0
cd9d161
Content-Type: text/plain; charset=UTF-8
cd9d161
Content-Transfer-Encoding: 8bit
cd9d161
cd9d161
The Data Offset field in the Dynamic Disk Header is an 8 byte field.
cd9d161
Although the specification (2006-10-11) gives an example of initializing
cd9d161
only the first 4 bytes, images generated by Microsoft on Windows initialize
cd9d161
all 8 bytes.
cd9d161
cd9d161
Failure to initialize all 8 bytes results in errors from utilities
cd9d161
like Citrix's vhd-util which checks specifically for the proper Data
cd9d161
Offset field initialization.
cd9d161
cd9d161
Signed-off-by: Charles Arnold <carnold@suse.com>
cd9d161
Reviewed-by: Andreas Färber <afaerber@suse.de>
cd9d161
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
cd9d161
(cherry picked from commit 78439f6af1caa3e8bdafc9fc2d62aeefa53ed63a)
cd9d161
cd9d161
Signed-off-by: Bruce Rogers <brogers@suse.com>
cd9d161
Signed-off-by: Andreas Färber <afaerber@suse.de>
cd9d161
---
cd9d161
 block/vpc.c | 6 +++++-
cd9d161
 1 file changed, 5 insertions(+), 1 deletion(-)
cd9d161
cd9d161
diff --git a/block/vpc.c b/block/vpc.c
cd9d161
index 56865da..ac33e15 100644
cd9d161
--- a/block/vpc.c
cd9d161
+++ b/block/vpc.c
cd9d161
@@ -587,7 +587,11 @@ static int vpc_create(const char *filename, QEMUOptionParameter *options)
cd9d161
 
cd9d161
     memcpy(dyndisk_header->magic, "cxsparse", 8);
cd9d161
 
cd9d161
-    dyndisk_header->data_offset = be64_to_cpu(0xFFFFFFFF);
cd9d161
+    /*
cd9d161
+     * Note: The spec is actually wrong here for data_offset, it says
cd9d161
+     * 0xFFFFFFFF, but MS tools expect all 64 bits to be set.
cd9d161
+     */
cd9d161
+    dyndisk_header->data_offset = be64_to_cpu(0xFFFFFFFFFFFFFFFFULL);
cd9d161
     dyndisk_header->table_offset = be64_to_cpu(3 * 512);
cd9d161
     dyndisk_header->version = be32_to_cpu(0x00010000);
cd9d161
     dyndisk_header->block_size = be32_to_cpu(block_size);
cd9d161
-- 
cd9d161
1.7.11.2
cd9d161