<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV>Alex,</DIV>
<DIV> </DIV>
<DIV>Thanks, that's very helpful.</DIV>
<DIV> </DIV>
<DIV>We have implemented a mini port virtual disk driver, and features to convert between different formats (vdi, vhd, vmdk). </DIV>
<DIV> </DIV>
<DIV>Also doing a p2v converter. Will post as free tool when finished.</DIV>
<DIV> </DIV>
<DIV>Huihong<BR><BR>--- On <B>Mon, 6/29/09, Alexander Eichner <I><Alexander.Eichner@Sun.COM></I></B> wrote:<BR></DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid"><BR>From: Alexander Eichner <Alexander.Eichner@Sun.COM><BR>Subject: Re: [vbox-dev] vhd format not stable?<BR>To: "Huihong Luo" <huisinro@yahoo.com><BR>Cc: vbox-dev@virtualbox.org<BR>Date: Monday, June 29, 2009, 1:38 PM<BR><BR>
<DIV class=plainMail>Hi Huihong,<BR><BR>DrvVD is the only example at the moment where you can see how snapshots<BR>are added to the chain but include/VBox/VBoxHDD.h contains documentation<BR>on how to use the API. Your assumption is correct - the first image<BR>which is opened must be a base image. The other ones must be<BR>differencing.<BR><BR>An image can have more than one child disk. VBoxHDD doesn't know if the<BR>diff image really belongs to the base image it was opened with.<BR>For example take the following disk structure.<BR><BR> base_image<BR> / \<BR> chain_1_diff_1 chain_2_diff_1<BR> / \
|<BR>chain_1_diff_2 chain_1_diff_3 chain_2_diff_2 <BR><BR>To open the chain ending with chain_1_diff_3 you need to do the<BR>following:<BR>1. VDOpen(pDisk, pszBackend, base_image, ...);<BR>2. VDOpen(pDisk, pszBackend, chain_1_diff_1, ...);<BR>3. VDOpen(pDisk, pszBackend, chain_1_diff_3, ...);<BR><BR>And to open the chain ending with chain_2_diff_2:<BR>1. VDOpen(pDisk, pszBackend, base_image, ...);<BR>2. VDOpen(pDisk, pszBackend, chain_2_diff_1, ...);<BR>3. VDOpen(pDisk, pszBackend, chain_2_diff_2, ...);<BR><BR>You could also do the following (VBoxHDD would not complain):<BR>1. VDOpen(pDisk, pszBackend, base_image, ...);<BR>2. VDOpen(pDisk, pszBackend, chain_1_diff_1, ...);<BR>3. VDOpen(pDisk, pszBackend, chain_2_diff_2, ...);<BR><BR>but the data would be inconsistent and the guest would not<BR>operate correctly.<BR><BR>Hope this answers your question (if not just ask again ;) ).<BR><BR>Regards,<BR>Alexander Eichner<BR><BR>Am
Montag, den 29.06.2009, 09:00 -0700 schrieb Huihong Luo:<BR>> Alex,<BR>> <BR>> Great. I will use your new fix.<BR>> <BR>> By the way, I am trying to read the base disk files, and snapshot<BR>> files, to create a virtual disk.<BR>> <BR>> It seems <BR>> drvvdConstruct() in DrvVD.cpp is the code I can ref to. Any other<BR>> clean code?<BR>> <BR>> Open the base image first, then 1st gen diff file, then 2nd gen<BR>> diff, ...., is this the correct stesp?<BR>> <BR>> Does one image only have one child disk? If you can provide some code,<BR>> would be really helpful.<BR>> <BR>> Thanks,<BR>> <BR>> Huihong<BR>> <BR>> --- On Sun, 6/28/09, Alexander Eichner <<A href="http://us.mc343.mail.yahoo.com/mc/compose?to=Alexander.Eichner@Sun.COM" ymailto="mailto:Alexander.Eichner@Sun.COM">Alexander.Eichner@Sun.COM</A>><BR>> wrote:<BR>> <BR>>
<BR>> From: Alexander Eichner <<A href="http://us.mc343.mail.yahoo.com/mc/compose?to=Alexander.Eichner@Sun.COM" ymailto="mailto:Alexander.Eichner@Sun.COM">Alexander.Eichner@Sun.COM</A>><BR>> Subject: Re: [vbox-dev] vhd format not stable?<BR>> To: "Huihong Luo" <<A href="http://us.mc343.mail.yahoo.com/mc/compose?to=huisinro@yahoo.com" ymailto="mailto:huisinro@yahoo.com">huisinro@yahoo.com</A>><BR>> Date: Sunday, June 28, 2009, 12:11 PM<BR>> <BR>> Hi Huihong,<BR>> <BR>> you are right. The code for the 32it alignment is completely<BR>>
wrong<BR>> and results in the wrong bits tested. I restored the old<BR>> behavior<BR>> and just added the allocation of additional bytes. Adding<BR>> addtional 8<BR>> bytes should be only necessary on 64bit systems as the BT<BR>> assembler<BR>> instruction may read 8 bytes there. Many thanks for pointing<BR>> that out.<BR>> The fix should appear in svn soon.<BR>> <BR>> Regards,<BR>> Alexander Eichner<BR>>
<BR>> Am Samstag, den 27.06.2009, 17:41 -0700 schrieb Huihong Luo:<BR>> > Hi Alex,<BR>> > <BR>> > If I reverted your changes on vhdRead(), and just simply add<BR>> 8 extra<BR>> > bytes to pImage->pu8Bitmap, then works.<BR>> > <BR>> > I also included your fix on parentFilename.<BR>> > <BR>> > I've attached the diff (to prev version, not to latest) and<BR>> the<BR>> > working VHDHDDCore.cpp for your
ref.<BR>> > There must be something funny about your 32-bit alignment<BR>> bit calc.<BR>> > <BR>> > This would be very important, as I can't install ac97<BR>> driver.<BR>> > <BR>> > Huihong<BR>> > <BR>> > <BR>> > --- On Wed, 6/24/09, Alexander Eichner<BR>> <<A href="http://us.mc343.mail.yahoo.com/mc/compose?to=Alexander.Eichner@Sun.COM" ymailto="mailto:Alexander.Eichner@Sun.COM">Alexander.Eichner@Sun.COM</A>><BR>> >
wrote:<BR>> > <BR>> > <BR>> > From: Alexander Eichner <<A href="http://us.mc343.mail.yahoo.com/mc/compose?to=Alexander.Eichner@Sun.COM" ymailto="mailto:Alexander.Eichner@Sun.COM">Alexander.Eichner@Sun.COM</A>><BR>> > Subject: Re: [vbox-dev] vhd format not stable?<BR>> > To: "Huihong Luo" <<A href="http://us.mc343.mail.yahoo.com/mc/compose?to=huisinro@yahoo.com" ymailto="mailto:huisinro@yahoo.com">huisinro@yahoo.com</A>><BR>> > Date: Wednesday, June 24, 2009, 3:54 PM<BR>>
> <BR>> > Hi Huihong,<BR>> > <BR>> > yes will do.<BR>> > <BR>> > Kind regards,<BR>> > Alexander Eichner<BR>> > <BR>> > Am Dienstag, den 23.06.2009, 16:12 -0700 schrieb<BR>> Huihong Luo:<BR>>
> > Alex,<BR>> > > <BR>> > > Thanks for the fix on the crash.<BR>> > > <BR>> > > Can you examine the fix and check if it breaks<BR>> anything? all<BR>> > of<BR>> > > sudden, all of the audio drivers are not<BR>> recognized inside<BR>> >
vm. When I<BR>> > > use the vboxddu.dll before the fix, then works.<BR>> > > <BR>> > > Thanks,<BR>> > > <BR>> > > - hl<BR>> > > <BR>> > > --- On Mon, 6/22/09, Alexander Eichner<BR>> > <<A
href="http://us.mc343.mail.yahoo.com/mc/compose?to=Alexander.Eichner@Sun.COM" ymailto="mailto:Alexander.Eichner@Sun.COM">Alexander.Eichner@Sun.COM</A>><BR>> > > wrote:<BR>> > > <BR>> > > <BR>> > > From: Alexander Eichner<BR>> <<A href="http://us.mc343.mail.yahoo.com/mc/compose?to=Alexander.Eichner@Sun.COM" ymailto="mailto:Alexander.Eichner@Sun.COM">Alexander.Eichner@Sun.COM</A>><BR>> > >
Subject: Re: [vbox-dev] vhd format not<BR>> stable?<BR>> > > To: "Huihong Luo" <<A href="http://us.mc343.mail.yahoo.com/mc/compose?to=huisinro@yahoo.com" ymailto="mailto:huisinro@yahoo.com">huisinro@yahoo.com</A>><BR>> > > Cc: <A href="http://us.mc343.mail.yahoo.com/mc/compose?to=vbox-dev@virtualbox.org" ymailto="mailto:vbox-dev@virtualbox.org">vbox-dev@virtualbox.org</A>, "Frank<BR>> Mehnert"<BR>> > > <<A href="http://us.mc343.mail.yahoo.com/mc/compose?to=Frank.Mehnert@Sun.COM"
ymailto="mailto:Frank.Mehnert@Sun.COM">Frank.Mehnert@Sun.COM</A>><BR>> > > Date: Monday, June 22, 2009, 12:25 PM<BR>> > > <BR>> > > Hi Huihong,<BR>> > > <BR>> > > the crash should be really fixed now. I<BR>> also fixed<BR>> >
the crash<BR>> > > with<BR>> > > snapshots you reported in another mail.<BR>> They will<BR>> > appear soon<BR>> > > in the<BR>> > > public svn. Thanks again for your help!<BR>> > > <BR>>
> > Kind regards,<BR>> > > Alexander Eichner<BR>> > > <BR>> > > Am Montag, den 22.06.2009, 08:59 -0700<BR>> schrieb<BR>> > Huihong Luo:<BR>> > > > Frank,<BR>> >
> > <BR>> > > > Right, that would be the correct fix.<BR>> > > > <BR>> > > > I was wondering if there are other<BR>> places that<BR>> > have similar<BR>> > > issues.<BR>> > >
> This problem would be very rare in<BR>> happening, as<BR>> > the memory<BR>> > > address<BR>> > > > would be still ok to be read even if<BR>> it's less<BR>> > then DWORD in<BR>> > > len.<BR>> > >
> <BR>> > > > Inside kernel mode, this becomes a<BR>> severe problem,<BR>> > throwing<BR>> > > invalid<BR>> > > > memory access crashes.<BR>> > > > <BR>> > > > - Huihong<BR>>
> > > <BR>> > > > --- On Mon, 6/22/09, Frank Mehnert<BR>> > <<A href="http://us.mc343.mail.yahoo.com/mc/compose?to=Frank.Mehnert@Sun.COM" ymailto="mailto:Frank.Mehnert@Sun.COM">Frank.Mehnert@Sun.COM</A>><BR>> > > wrote:<BR>> > > > <BR>> > > >
<BR>> > > > From: Frank Mehnert<BR>> > <<A href="http://us.mc343.mail.yahoo.com/mc/compose?to=Frank.Mehnert@Sun.COM" ymailto="mailto:Frank.Mehnert@Sun.COM">Frank.Mehnert@Sun.COM</A>><BR>> > > > Subject: Re: [vbox-dev] vhd<BR>> format not<BR>> > stable?<BR>> > > >
To: <A href="http://us.mc343.mail.yahoo.com/mc/compose?to=vbox-dev@virtualbox.org" ymailto="mailto:vbox-dev@virtualbox.org">vbox-dev@virtualbox.org</A><BR>> > > > Date: Monday, June 22, 2009,<BR>> 3:30 AM<BR>> > > > <BR>> > > > Huihong,<BR>> > > >
<BR>> > > > On Friday 19 June 2009, Huihong<BR>> Luo wrote:<BR>> > > > > I tested it again, but it<BR>> still crashed.<BR>> > > > > <BR>> > > > > I think I now found the cause,<BR>>
it's<BR>> > quite<BR>> > > delicate, but you<BR>> > > > should be able<BR>> > > > > to fix it right away. <BR>> > > > > a8bd6ffd ff ff<BR>> >
> ><BR>> ><BR>> ff ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??<BR>> > > > > <BR>> > > > > The above is the bitmap when<BR>> crashed.<BR>> > You can see<BR>> > > the<BR>> >
> > beginnig there are<BR>> > > > > only 3 bytes are valid, the<BR>> 4th byte<BR>> > will cause<BR>> > > crash. <BR>> > > > > But when you call<BR>> > >
> > ASMBitTest(const volatile void<BR>> > *pvBitmap, int32_t<BR>> > > iBit)<BR>> > > > > <BR>> > > > > it will the 1st 4-byte int,<BR>> thus caused<BR>> > the crash.<BR>> >
> > <BR>> > > > Good catch!<BR>> > > > <BR>> > > > > The easiest fix is to allocate<BR>> 8 byte<BR>> > length more<BR>> > >
for the<BR>> > > > bitmap, and zero<BR>> > > > > fill them, that will<BR>> definitely solve<BR>> > the issue.<BR>> > > You can<BR>> > > > also change<BR>> >
> > > ASMBitTest method impl. <BR>> > > > <BR>> > > > I think a better fix would be to<BR>> ensure<BR>> > that<BR>> > > ASMBitTest isn't<BR>> > >
> called<BR>> > > > with non-word-aligned memory<BR>> addresses.<BR>> > > > <BR>> > > > Kind regards,<BR>> > > > <BR>> >
> > Frank<BR>> > > > -- <BR>> > > > Dr.-Ing. Frank Mehnert Sun<BR>> > Microsystems, Inc.<BR>> > > > www.sun.com<BR>> > > >
<BR>> > > > <BR>> > > > -----Inline Attachment<BR>> Follows-----<BR>> > > > <BR>> > > ><BR>> > _______________________________________________<BR>> >
> > vbox-dev mailing list<BR>> > > > <A href="http://us.mc343.mail.yahoo.com/mc/compose?to=vbox-dev@virtualbox.org" ymailto="mailto:vbox-dev@virtualbox.org">vbox-dev@virtualbox.org</A><BR>> > > ><BR>> > <A href="http://vbox.innotek.de/mailman/listinfo/vbox-dev" target=_blank>http://vbox.innotek.de/mailman/listinfo/vbox-dev</A><BR>> > > >
<BR>> > > ><BR>> _______________________________________________<BR>> > > > vbox-dev mailing list<BR>> > > > <A href="http://us.mc343.mail.yahoo.com/mc/compose?to=vbox-dev@virtualbox.org" ymailto="mailto:vbox-dev@virtualbox.org">vbox-dev@virtualbox.org</A><BR>> > > ><BR>> <A href="http://vbox.innotek.de/mailman/listinfo/vbox-dev"
target=_blank>http://vbox.innotek.de/mailman/listinfo/vbox-dev</A><BR>> > > <BR>> > > <BR>> > <BR>> > <BR>> <BR>> <BR><BR></DIV></BLOCKQUOTE></td></tr></table>