diff mbox

block: Fix vpc initialization of the Dynamic Disk Header

Message ID 4EBA48A90200009100076EF6@novprvoes0310.provo.novell.com
State New
Headers show

Commit Message

Charles Arnold Nov. 9, 2011, 4:32 p.m. UTC
>>> On 11/9/2011 at 08:58 AM, in message <4EBAA30D.1090209@redhat.com>, Kevin Wolf
<kwolf@redhat.com> wrote: 
> 
> Right, I'm not arguing that your change is wrong. What I'm asking for is
> just something like:
> 
> -    dyndisk_header->data_offset = be64_to_cpu(0xFFFFFFFF);
> +    /* Note: The spec is actually wrong here, it says 0xFFFFFFFF, but
> MS tools expect all 64 bits to be set */
> +    dyndisk_header->data_offset = be64_to_cpu(0xFFFFFFFFFFFFFFFFULL);
> 
> Kevin

Ok, I had the header comment on the brain, not a code comment. 
Here is the revised patch.

- Charles


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>

Comments

Andreas Färber Nov. 9, 2011, 4:38 p.m. UTC | #1
Am 09.11.2011 17:32, schrieb Charles Arnold:
>>>> On 11/9/2011 at 08:58 AM, in message <4EBAA30D.1090209@redhat.com>, Kevin Wolf
> <kwolf@redhat.com> wrote: 
>>
>> Right, I'm not arguing that your change is wrong. What I'm asking for is
>> just something like:
>>
>> -    dyndisk_header->data_offset = be64_to_cpu(0xFFFFFFFF);
>> +    /* Note: The spec is actually wrong here, it says 0xFFFFFFFF, but
>> MS tools expect all 64 bits to be set */
>> +    dyndisk_header->data_offset = be64_to_cpu(0xFFFFFFFFFFFFFFFFULL);
>>
>> Kevin
> 
> Ok, I had the header comment on the brain, not a code comment. 
> Here is the revised patch.
> 
> - Charles
> 
> 
> 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>

Andreas

> 
> diff --git a/block/vpc.c b/block/vpc.c
> index 416f489..179c6ae 100644
> --- a/block/vpc.c
> +++ b/block/vpc.c
> @@ -585,7 +585,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);
Kevin Wolf Nov. 9, 2011, 4:57 p.m. UTC | #2
Am 09.11.2011 17:32, schrieb Charles Arnold:
>>>> On 11/9/2011 at 08:58 AM, in message <4EBAA30D.1090209@redhat.com>, Kevin Wolf
> <kwolf@redhat.com> wrote: 
>>
>> Right, I'm not arguing that your change is wrong. What I'm asking for is
>> just something like:
>>
>> -    dyndisk_header->data_offset = be64_to_cpu(0xFFFFFFFF);
>> +    /* Note: The spec is actually wrong here, it says 0xFFFFFFFF, but
>> MS tools expect all 64 bits to be set */
>> +    dyndisk_header->data_offset = be64_to_cpu(0xFFFFFFFFFFFFFFFFULL);
>>
>> Kevin
> 
> Ok, I had the header comment on the brain, not a code comment. 
> Here is the revised patch.
> 
> - Charles
> 
> 
> 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>

Thanks, applied to the block-stable branch (for 1.0)

Kevin
diff mbox

Patch

diff --git a/block/vpc.c b/block/vpc.c
index 416f489..179c6ae 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -585,7 +585,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);