Received: from eggs.gnu.org ([140.186.70.92]:45782) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROvzy-0001F7-B3 for qemu-devel@nongnu.org; Fri, 11 Nov 2011 13:38:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ROvzt-0002Vd-Vh for qemu-devel@nongnu.org; Fri, 11 Nov 2011 13:38:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:61796) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROvzt-0002VD-MJ for qemu-devel@nongnu.org; Fri, 11 Nov 2011 13:38:41 -0500 From: Kevin Wolf Date: Fri, 11 Nov 2011 18:39:24 +0100 Message-Id: <1321033168-8739-13-git-send-email-kwolf@redhat.com> In-Reply-To: <1321033168-8739-1-git-send-email-kwolf@redhat.com> References: <1321033168-8739-1-git-send-email-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 12/16] block: Fix vpc initialization of the Dynamic Disk Header List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Charles Arnold 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 initiali= ze 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=C3=A4rber Signed-off-by: Kevin Wolf --- block/vpc.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/block/vpc.c b/block/vpc.c index 79be7d0..54633b6 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -617,7 +617,11 @@ static int vpc_create(const char *filename, QEMUOpti= onParameter *options) =20 memcpy(dyndisk_header->magic, "cxsparse", 8); =20 - dyndisk_header->data_offset =3D 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 =3D be64_to_cpu(0xFFFFFFFFFFFFFFFFULL); dyndisk_header->table_offset =3D be64_to_cpu(3 * 512); dyndisk_header->version =3D be32_to_cpu(0x00010000); dyndisk_header->block_size =3D be32_to_cpu(block_size); --=20 1.7.6.4