On Mon, Feb 04, 2013 at 06:53:34PM +0100, Martin Kletzander wrote:
On 02/04/2013 04:53 PM, Daniel P. Berrange wrote:
> On Mon, Feb 04, 2013 at 04:46:53PM +0100, Martin Kletzander wrote:
[...]
>> +
>> + /* not fully supported, but qemu knows it, so we should be able to
>> + * handle this at least basically */
>> + [VIR_STORAGE_FILE_VDI] = { NULL, ".vdi", LV_LITTLE_ENDIAN,
>> + -2, 0, 0, 0, 0, -1, NULL},
>
> We can do better than that - look at block/vdi.c in QEMU GIT tree
> to find out the offsets / values for version number, magic signature
> at least, even if you ignore backing files for now.
>
Thanks for pointing that out, I've got a v2 and will send it
after some testing. However, it looks like VDI doesn't have a
magic, because there is a 40 Byte string at the start that cacn
contain anything the creating binary puts there. For example
qemu-img uses "<<< QEMU VM Virtual Disk Image >>>\n".
According
to [1], I'm adding "<<<" as the magic, because we don't fail
if
it doesn't match and we can still match it by the extension then.
No, you need to look at the 'signature' field of the header
instead, which has a fixed magic value
#define VDI_SIGNATURE 0xbeda107f
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|