From 59334db23c3dc68604fd6e67de2dff5d885f7091 Mon Sep 17 00:00:00 2001 Message-Id: <59334db23c3dc68604fd6e67de2dff5d885f7091.1355928222.git.minovotn@redhat.com> In-Reply-To: <5bb1efba7d5e7913c8641db9d9acc3ed80e03ed7.1355928222.git.minovotn@redhat.com> References: <5bb1efba7d5e7913c8641db9d9acc3ed80e03ed7.1355928222.git.minovotn@redhat.com> From: Charles Arnold Date: Tue, 18 Dec 2012 09:49:17 -0500 Subject: [PATCH 5/6] block: Fix vpc initialization of the Dynamic Disk Header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Data Offset field in the Dynamic Disk Header is an 8 byte field. Although the specification (2006-10-11) gives an example of initializing only the first 4 bytes, images generated by Microsoft on Windows initialize all 8 bytes. Failure to initialize all 8 bytes results in errors from utilities like Citrix's vhd-util which checks specifically for the proper Data Offset field initialization. Signed-off-by: Charles Arnold Reviewed-by: Andreas Färber Signed-off-by: Kevin Wolf (cherry picked from commit 78439f6af1caa3e8bdafc9fc2d62aeefa53ed63a) Signed-off-by: Jeff Cody Signed-off-by: Michal Novotny --- block/vpc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/block/vpc.c b/block/vpc.c index 9e6bf83..852860d 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -590,7 +590,11 @@ static int vpc_create(const char *filename, QEMUOptionParameter *options) memcpy(dyndisk_header->magic, "cxsparse", 8); - dyndisk_header->data_offset = be64_to_cpu(0xFFFFFFFF); + /* + * Note: The spec is actually wrong here for data_offset, it says + * 0xFFFFFFFF, but MS tools expect all 64 bits to be set. + */ + dyndisk_header->data_offset = be64_to_cpu(0xFFFFFFFFFFFFFFFFULL); dyndisk_header->table_offset = be64_to_cpu(3 * 512); dyndisk_header->version = be32_to_cpu(0x00010000); dyndisk_header->block_size = be32_to_cpu(block_size); -- 1.7.11.7