<div dir="ltr"><div style>Thanks Klaus, </div><div style>There is nothing wrong with vboxmanage, its just that the API doesn't have these functions.</div><div style><br></div><div style>As for the raw disk image, the block size may always be a multiple of 512 bytes but the file size of the entire image may not. </div>

<div style>For example:</div><div style>dd if=/dev/zero of=test.img count=2 bs=1MB</div><div style><div style>In this case the last 128 bytes are not usable but the entire image is valid. convertfromraw asserts, in debug, on the last block. </div>

<div style><br></div><div style>These asserts are obviously not an issue, since they are only active in debug. I just wanted to know if I can safely disable these asserts.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">

On Tue, Jun 4, 2013 at 5:11 AM, Klaus Espenlaub <span dir="ltr"><<a href="mailto:klaus.espenlaub@oracle.com" target="_blank">klaus.espenlaub@oracle.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

Hi Ribhi,<br>
<div class="im"><br>
On 03.06.2013 23:25, Ribhi Kamal wrote:<br>
> I'm messing around with adding some conversions of raw to/from virtual<br>
> disks to the API and noticed that the functions vdiRead and vdiWrite (in<br>
> VDI.cpp) assert whenever the amount being read/written is not a multiple<br>
> of 512.<br>
<br>
</div>Anything wrong with VBoxManage convertfromraw and/or clonehd? The<br>
functionality should be there already.<br>
<div class="im"><br>
> Do these functions break when the byte count is not a multiple of 512 or<br>
> is this just a sanitary check?<br>
<br>
</div>The code is meant to implement a block device interface with fixed<br>
sector size, and thus the parameter sanity checking is consistent with<br>
this intention. I don't care if the code could theoretically handle such<br>
cases, it's not meant to get such requests ever.<br>
<div class="im"><br>
> Are these asserts valid when dealing with binary image files (they could<br>
> have any size) vs block devices?<br>
<br>
</div>I don't understand... raw disk image files should always be a multiple<br>
of the sector size, and if that's not the case it's a rather clear hint<br>
that the file was corrupted during transfer.<br>
<br>
Klaus<br>
<br>
><br>
> Thanks,<br>
> -- Ribhi<br>
<br>
_______________________________________________<br>
vbox-dev mailing list<br>
<a href="mailto:vbox-dev@virtualbox.org">vbox-dev@virtualbox.org</a><br>
<a href="https://www.virtualbox.org/mailman/listinfo/vbox-dev" target="_blank">https://www.virtualbox.org/mailman/listinfo/vbox-dev</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>-- Ribhi
</div></div>