File qemu-img-git-vpc-fix.patch of Package virt-utils.import5774

Subject: block: Fix vpc initialization of the Dynamic Disk Header
From: Charles Arnold carnold@suse.com Wed Nov 9 09:32:25 2011 -0700
Date: Fri Nov 11 14:02:58 2011 +0100:
Git: 78439f6af1caa3e8bdafc9fc2d62aeefa53ed63a

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 <carnold@suse.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>

Index: qemu-0.14.0/block/vpc.c
===================================================================
--- qemu-0.14.0.orig/block/vpc.c
+++ qemu-0.14.0/block/vpc.c
@@ -591,7 +591,11 @@ static int vpc_create(const char *filena
 
     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);
openSUSE Build Service is sponsored by