From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:34690) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROAaE-00058C-6E for qemu-devel@nongnu.org; Wed, 09 Nov 2011 11:01:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ROAa9-000473-H0 for qemu-devel@nongnu.org; Wed, 09 Nov 2011 11:01:02 -0500 Received: from cantor2.suse.de ([195.135.220.15]:34600 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROAa9-00046V-76 for qemu-devel@nongnu.org; Wed, 09 Nov 2011 11:00:57 -0500 Message-ID: <4EBAA3B1.707@suse.de> Date: Wed, 09 Nov 2011 17:00:49 +0100 From: =?ISO-8859-1?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <4EB91FA20200009100076E0E@novprvoes0310.provo.novell.com> <4EBA4BEC.5040401@redhat.com> <4EBA3D0D0200009100076EF0@novprvoes0310.provo.novell.com> In-Reply-To: <4EBA3D0D0200009100076EF0@novprvoes0310.provo.novell.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] block: Fix vpc initialization of the Dynamic Disk Header List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Charles Arnold Cc: Kevin Wolf , qemu-devel@nongnu.org Am 09.11.2011 16:42, schrieb Charles Arnold: >>>> On 11/9/2011 at 02:46 AM, in message <4EBA4BEC.5040401@redhat.com>, = Kevin Wolf > wrote:=20 >> Am 08.11.2011 20:25, schrieb 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 initializ= ing >>> only the first 4 bytes, images generated by Microsoft on Windows init= ialize=20 >>> all 8 bytes. >>> >>> Failure to initialize all 8 bytes results in errors from utilities >>> that check specifically for the complete Data Offset field initializa= tion. >>> >>> Signed-off-by: Charles Arnold >>> >>> diff --git a/block/vpc.c b/block/vpc.c >>> index 416f489..35ac3fd 100644 >>> --- a/block/vpc.c >>> +++ b/block/vpc.c >>> @@ -585,7 +585,7 @@ static int vpc_create(const char *filename,=20 >> QEMUOptionParameter *options) >>> >>> memcpy(dyndisk_header->magic, "cxsparse", 8); >>> >>> - dyndisk_header->data_offset =3D be64_to_cpu(0xFFFFFFFF); >>> + dyndisk_header->data_offset =3D be64_to_cpu(0xFFFFFFFFFFFFFFFFUL= L); >>> 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); >> >> Can you please add a short comment explaining why we deviate from the >> specification in this point? If someone notices the discrepancy later, >> he shouldn't have to dig up the git commit message. >> >> Kevin > =20 > Using qemu-img to convert a raw image to a vhd image seems to work fine= accept that only 4 bytes of the 8 byte Dynamic Disk Header Data Offset f= ield are initialized. This seems correct according to the specification = but tools like Citrix's vhd-util fail when querying the image due to the = shortened initialization. Upon further analysis, it was determined that = Microsoft also initializes all 8 bytes when generating a vhd image on win= dows. Initializing all 8 bytes seems more logical and may indicate that = Microsoft needs to update the specification because the requirement for t= his field changed or that it is simply an oversight that has never been n= oticed. Charles, I think Kevin meant inserting a C comment above that line. :) Maybe: /* Microsoft and Citrix tools expect data_offset to be eight bytes 0xff although this does not match the spec. */ Regards, Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg