VDIHDDCore.cpp revision bbede9c189def47a9880f0ffb03c0c230c774185
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * Virtual Disk Image (VDI), Core Code.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * Copyright (C) 2006-2010 Sun Microsystems, Inc.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * available from http://www.virtualbox.org. This file is free software;
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * you can redistribute it and/or modify it under the terms of the GNU
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * General Public License (GPL) as published by the Free Software
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * additional information or have any questions.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync/*******************************************************************************
a180a41bba1d50822df23fff0099e90b86638b89vboxsync* Header Files *
a180a41bba1d50822df23fff0099e90b86638b89vboxsync*******************************************************************************/
a180a41bba1d50822df23fff0099e90b86638b89vboxsync#define VBOX_VDICORE_VD /* Signal that the header is included from here. */
a180a41bba1d50822df23fff0099e90b86638b89vboxsync/*******************************************************************************
a180a41bba1d50822df23fff0099e90b86638b89vboxsync* Static Variables *
a180a41bba1d50822df23fff0099e90b86638b89vboxsync*******************************************************************************/
a180a41bba1d50822df23fff0099e90b86638b89vboxsync/** NULL-terminated array of supported file extensions. */
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncstatic const char *const s_apszVdiFileExtensions[] =
a180a41bba1d50822df23fff0099e90b86638b89vboxsync/*******************************************************************************
a180a41bba1d50822df23fff0099e90b86638b89vboxsync* Internal Functions *
a180a41bba1d50822df23fff0099e90b86638b89vboxsync*******************************************************************************/
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncstatic void vdiInitPreHeader(PVDIPREHEADER pPreHdr);
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncstatic int vdiValidatePreHeader(PVDIPREHEADER pPreHdr);
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncstatic void vdiInitHeader(PVDIHEADER pHeader, uint32_t uImageFlags,
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncstatic void vdiSetupImageDesc(PVDIIMAGEDESC pImage);
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncstatic int vdiUpdateBlockInfo(PVDIIMAGEDESC pImage, unsigned uBlock);
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncstatic void vdiFreeImage(PVDIIMAGEDESC pImage, bool fDelete);
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * Internal: signal an error to the frontend.
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncDECLINLINE(int) vdiError(PVDIIMAGEDESC pImage, int rc, RT_SRC_POS_DECL,
a180a41bba1d50822df23fff0099e90b86638b89vboxsync const char *pszFormat, ...)
a180a41bba1d50822df23fff0099e90b86638b89vboxsync if (pImage->pInterfaceError && pImage->pInterfaceErrorCallbacks)
a180a41bba1d50822df23fff0099e90b86638b89vboxsync pImage->pInterfaceErrorCallbacks->pfnError(pImage->pInterfaceError->pvUser,
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncstatic int vdiFileOpen(PVDIIMAGEDESC pImage, bool fReadonly, bool fCreate)
a180a41bba1d50822df23fff0099e90b86638b89vboxsync AssertMsg(!(fReadonly && fCreate), ("Image can't be opened readonly whilebeing created\n"));
a180a41bba1d50822df23fff0099e90b86638b89vboxsync uint32_t fOpen = fReadonly ? RTFILE_O_READ | RTFILE_O_DENY_NONE
a180a41bba1d50822df23fff0099e90b86638b89vboxsync rc = RTFileOpen(&pImage->File, pImage->pszFilename, fOpen);
a180a41bba1d50822df23fff0099e90b86638b89vboxsync unsigned uOpenFlags = fReadonly ? VD_INTERFACEASYNCIO_OPEN_FLAGS_READONLY : 0;
a180a41bba1d50822df23fff0099e90b86638b89vboxsync uOpenFlags |= VD_INTERFACEASYNCIO_OPEN_FLAGS_CREATE;
a180a41bba1d50822df23fff0099e90b86638b89vboxsync rc = pImage->pInterfaceAsyncIOCallbacks->pfnOpen(pImage->pInterfaceAsyncIO->pvUser,
a180a41bba1d50822df23fff0099e90b86638b89vboxsync rc = pImage->pInterfaceAsyncIOCallbacks->pfnClose(pImage->pInterfaceAsyncIO->pvUser,
a180a41bba1d50822df23fff0099e90b86638b89vboxsync rc = pImage->pInterfaceAsyncIOCallbacks->pfnFlushSync(pImage->pInterfaceAsyncIO->pvUser,
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncstatic int vdiFileGetSize(PVDIIMAGEDESC pImage, uint64_t *pcbSize)
a180a41bba1d50822df23fff0099e90b86638b89vboxsync rc = pImage->pInterfaceAsyncIOCallbacks->pfnGetSize(pImage->pInterfaceAsyncIO->pvUser,
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncstatic int vdiFileSetSize(PVDIIMAGEDESC pImage, uint64_t cbSize)
a180a41bba1d50822df23fff0099e90b86638b89vboxsync rc = pImage->pInterfaceAsyncIOCallbacks->pfnSetSize(pImage->pInterfaceAsyncIO->pvUser,
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncstatic int vdiFileWriteSync(PVDIIMAGEDESC pImage, uint64_t off, const void *pcvBuf, size_t cbWrite, size_t *pcbWritten)
a180a41bba1d50822df23fff0099e90b86638b89vboxsync rc = RTFileWriteAt(pImage->File, off, pcvBuf, cbWrite, pcbWritten);
a180a41bba1d50822df23fff0099e90b86638b89vboxsync rc = pImage->pInterfaceAsyncIOCallbacks->pfnWriteSync(pImage->pInterfaceAsyncIO->pvUser,
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncstatic int vdiFileReadSync(PVDIIMAGEDESC pImage, uint64_t off, void *pvBuf, size_t cbRead, size_t *pcbRead)
a180a41bba1d50822df23fff0099e90b86638b89vboxsync rc = RTFileReadAt(pImage->File, off, pvBuf, cbRead, pcbRead);
a180a41bba1d50822df23fff0099e90b86638b89vboxsync rc = pImage->pInterfaceAsyncIOCallbacks->pfnReadSync(pImage->pInterfaceAsyncIO->pvUser,
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * internal: return power of 2 or 0 if num error.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync unsigned uPower2 = 0;
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * Internal: Init VDI preheader.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync memset(pPreHdr->szFileInfo, 0, sizeof(pPreHdr->szFileInfo));
a180a41bba1d50822df23fff0099e90b86638b89vboxsync strncat(pPreHdr->szFileInfo, VDI_IMAGE_FILE_INFO, sizeof(pPreHdr->szFileInfo));
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * Internal: check VDI preheader.
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncstatic int vdiValidatePreHeader(PVDIPREHEADER pPreHdr)
a180a41bba1d50822df23fff0099e90b86638b89vboxsync if ( VDI_GET_VERSION_MAJOR(pPreHdr->u32Version) != VDI_IMAGE_VERSION_MAJOR
a180a41bba1d50822df23fff0099e90b86638b89vboxsync && pPreHdr->u32Version != 0x00000002) /* old version. */
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * Internal: translate VD image flags to VDI image type enum.
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncstatic VDIIMAGETYPE vdiTranslateImageFlags2VDI(unsigned uImageFlags)
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * Internal: translate VDI image type enum to VD image type enum.
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncstatic unsigned vdiTranslateVDI2ImageFlags(VDIIMAGETYPE enmType)
a180a41bba1d50822df23fff0099e90b86638b89vboxsync AssertMsgFailed(("invalid VDIIMAGETYPE enmType=%d\n", (int)enmType));
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * Internal: Init VDI header. Always use latest header version.
a180a41bba1d50822df23fff0099e90b86638b89vboxsync * @param pHeader Assumes it was initially initialized to all zeros.
a180a41bba1d50822df23fff0099e90b86638b89vboxsyncstatic void vdiInitHeader(PVDIHEADER pHeader, uint32_t uImageFlags,
a180a41bba1d50822df23fff0099e90b86638b89vboxsync pHeader->u.v1.u32Type = (uint32_t)vdiTranslateImageFlags2VDI(uImageFlags);
a180a41bba1d50822df23fff0099e90b86638b89vboxsync pHeader->u.v1.fFlags = (uImageFlags & VD_VDI_IMAGE_FLAGS_ZERO_EXPAND) ? 1 : 0;
a180a41bba1d50822df23fff0099e90b86638b89vboxsync Assert(!memcmp(pHeader->u.v1.szComment, achZero, VDI_IMAGE_COMMENT_SIZE));
if (pszComment)
pHeader->u.v1.offBlocks = RT_ALIGN_32(sizeof(VDIPREHEADER) + sizeof(VDIHEADER1), VDI_GEOMETRY_SECTOR_SIZE);
pHeader->u.v1.offData = RT_ALIGN_32(pHeader->u.v1.offBlocks + (pHeader->u.v1.cBlocks * sizeof(VDIIMAGEBLOCKPOINTER)), VDI_GEOMETRY_SECTOR_SIZE);
return VERR_VD_VDI_INVALID_HEADER;
return VERR_VD_VDI_INVALID_HEADER;
if (getImageDataOffset(pHeader) < (getImageBlocksOffset(pHeader) + getImageBlocks(pHeader) * sizeof(VDIIMAGEBLOCKPOINTER)))
getImageDataOffset(pHeader), getImageBlocksOffset(pHeader) + getImageBlocks(pHeader) * sizeof(VDIIMAGEBLOCKPOINTER)));
return VERR_VD_VDI_INVALID_HEADER;
return VERR_VD_VDI_UNSUPPORTED_VERSION;
bool fFailed = false;
fFailed = true;
fFailed = true;
fFailed = true;
fFailed = true;
fFailed = true;
fFailed = true;
fFailed = true;
fFailed = true;
fFailed = true;
int rc;
rc = vdiError(pImage, VERR_VD_VDI_COMMENT_TOO_LONG, RT_SRC_POS, N_("VDI: comment is too long for '%s'"), pImage->pszFilename);
goto out;
#ifdef VBOX_WITH_NEW_IO_CODE
pImage->paBlocks = (PVDIIMAGEBLOCKPOINTER)RTMemAlloc(sizeof(VDIIMAGEBLOCKPOINTER) * getImageBlocks(&pImage->Header));
goto out;
goto out;
rc = vdiError(pImage, VERR_DISK_FULL, RT_SRC_POS, N_("VDI: disk would overflow creating image '%s'"), pImage->pszFilename);
goto out;
rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: setting image size failed for '%s'"), pImage->pszFilename);
goto out;
rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: writing pre-header failed for '%s'"), pImage->pszFilename);
goto out;
rc = vdiFileWriteSync(pImage, sizeof(pImage->PreHeader), &pImage->Header.u.v1plus, sizeof(pImage->Header.u.v1plus), NULL);
rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: writing header failed for '%s'"), pImage->pszFilename);
goto out;
NULL);
rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: writing block pointers failed for '%s'"), pImage->pszFilename);
goto out;
if (!pvBuf)
goto out;
uOff = 0;
rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: writing block failed for '%s'"), pImage->pszFilename);
goto out;
if (pfnProgress)
goto out;
out:
return rc;
int rc;
return VERR_NOT_SUPPORTED;
#ifdef VBOX_WITH_NEW_IO_CODE
goto out;
NULL);
rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: error reading pre-header in '%s'"), pImage->pszFilename);
goto out;
goto out;
NULL);
rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: error reading v0 header in '%s'"), pImage->pszFilename);
goto out;
NULL);
rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: error reading v1 header in '%s'"), pImage->pszFilename);
goto out;
rc = vdiFileReadSync(pImage, sizeof(pImage->PreHeader), &pImage->Header.u.v1plus, sizeof(pImage->Header.u.v1plus), NULL);
rc = vdiError(pImage, rc, RT_SRC_POS, N_("VDI: error reading v1.1+ header in '%s'"), pImage->pszFilename);
goto out;
rc = vdiError(pImage, VERR_VD_VDI_UNSUPPORTED_VERSION, RT_SRC_POS, N_("VDI: unsupported major version %u in '%s'"), GET_MAJOR_HEADER_VERSION(&pImage->Header), pImage->pszFilename);
goto out;
rc = vdiError(pImage, VERR_VD_VDI_INVALID_HEADER, RT_SRC_POS, N_("VDI: invalid header in '%s'"), pImage->pszFilename);
goto out;
pImage->paBlocks = (PVDIIMAGEBLOCKPOINTER)RTMemAlloc(sizeof(VDIIMAGEBLOCKPOINTER) * getImageBlocks(&pImage->Header));
goto out;
NULL);
out:
return rc;
int rc;
rc = vdiFileWriteSync(pImage, sizeof(VDIPREHEADER), &pImage->Header.u.v0, sizeof(pImage->Header.u.v0), NULL);
rc = vdiFileWriteSync(pImage, sizeof(VDIPREHEADER), &pImage->Header.u.v1, sizeof(pImage->Header.u.v1), NULL);
rc = vdiFileWriteSync(pImage, sizeof(VDIPREHEADER), &pImage->Header.u.v1plus, sizeof(pImage->Header.u.v1plus), NULL);
return rc;
sizeof(VDIIMAGEBLOCKPOINTER),
NULL);
return rc;
|| !*pszFilename)
goto out;
if (!pImage)
goto out;
#ifndef VBOX_WITH_NEW_IO_CODE
out:
return rc;
void **ppBackendData)
LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, ppBackendData));
int rc;
goto out;
|| !*pszFilename)
goto out;
if (!pImage)
goto out;
#ifndef VBOX_WITH_NEW_IO_CODE
out:
return rc;
void **ppBackendData)
LogFlowFunc(("pszFilename=\"%s\" cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x uPercentStart=%u uPercentSpan=%u pVDIfsDisk=%#p pVDIfsImage=%#p pVDIfsOperation=%#p ppBackendData=%#p", pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, ppBackendData));
int rc;
if (pIfProgress)
if (pCbProgress)
goto out;
if ( !cbSize
goto out;
|| !*pszFilename
goto out;
if (!pImage)
goto out;
#ifndef VBOX_WITH_NEW_IO_CODE
goto out;
out:
return rc;
if ( !pImage
|| !pszFilename
|| !*pszFilename)
goto out;
goto out;
goto out;
out:
return rc;
if (pImage)
return rc;
LogFlowFunc(("pBackendData=%#p uOffset=%llu pvBuf=%#p cbToRead=%zu pcbActuallyRead=%#p\n", pBackendData, uOffset, pvBuf, cbToRead, pcbActuallyRead));
unsigned uBlock;
unsigned offRead;
int rc;
|| !cbToRead)
goto out;
if (pcbActuallyRead)
out:
return rc;
LogFlowFunc(("pBackendData=%#p uOffset=%llu pvBuf=%#p cbToWrite=%zu pcbWriteProcess=%#p pcbPreRead=%#p pcbPostRead=%#p\n", pBackendData, uOffset, pvBuf, cbToWrite, pcbWriteProcess, pcbPreRead, pcbPostRead));
unsigned uBlock;
unsigned offWrite;
goto out;
goto out;
goto out;
goto out;
*pcbPreRead = 0;
*pcbPostRead = 0;
if (pcbWriteProcess)
out:
return rc;
return rc;
unsigned uVersion;
if (pImage)
uVersion = 0;
return uVersion;
if (pImage)
cbSize = 0;
return cbSize;
if (pImage)
return cb;
int rc;
if (pImage)
LogFlowFunc(("returns %Rrc (PCHS=%u/%u/%u)\n", rc, pPCHSGeometry->cCylinders, pPCHSGeometry->cHeads, pPCHSGeometry->cSectors));
return rc;
LogFlowFunc(("pBackendData=%#p pPCHSGeometry=%#p PCHS=%u/%u/%u\n", pBackendData, pPCHSGeometry, pPCHSGeometry->cCylinders, pPCHSGeometry->cHeads, pPCHSGeometry->cSectors));
int rc;
if (pImage)
goto out;
out:
return rc;
int rc;
if (pImage)
if (!pGeometry)
LogFlowFunc(("returns %Rrc (LCHS=%u/%u/%u)\n", rc, pLCHSGeometry->cCylinders, pLCHSGeometry->cHeads, pLCHSGeometry->cSectors));
return rc;
LogFlowFunc(("pBackendData=%#p pLCHSGeometry=%#p LCHS=%u/%u/%u\n", pBackendData, pLCHSGeometry, pLCHSGeometry->cCylinders, pLCHSGeometry->cHeads, pLCHSGeometry->cSectors));
int rc;
if (pImage)
goto out;
if (pGeometry)
out:
return rc;
unsigned uImageFlags;
if (pImage)
uImageFlags = 0;
return uImageFlags;
unsigned uOpenFlags;
if (pImage)
uOpenFlags = 0;
return uOpenFlags;
int rc;
const char *pszFilename;
goto out;
out:
return rc;
LogFlowFunc(("pBackendData=%#p pszComment=%#p cbComment=%zu\n", pBackendData, pszComment, cbComment));
if (pImage)
return rc;
int rc;
goto out;
if (pImage)
goto out;
out:
return rc;
int rc;
if (pImage)
return rc;
if (pImage)
return rc;
int rc;
if (pImage)
return rc;
if (pImage)
return rc;
int rc;
if (pImage)
return rc;
if (pImage)
return rc;
int rc;
if (pImage)
return rc;
if (pImage)
return rc;
#ifndef VBOX_WITH_NEW_IO_CODE
pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Dumping VDI image \"%s\" mode=%s uOpenFlags=%X File=%08X\n",
pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Dumping VDI image \"%s\" mode=%s uOpenFlags=%X File=%#p\n",
pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Header: Version=%08X Type=%X Flags=%X Size=%llu\n",
pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Header: cbBlock=%u cbBlockExtra=%u cBlocks=%u cBlocksAllocated=%u\n",
pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Header: offBlocks=%u offData=%u\n",
if (pg)
pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Header: Geometry: C/H/S=%u/%u/%u cbSector=%u\n",
pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Header: uuidCreation={%RTuuid}\n", getImageCreationUUID(&pImage->Header));
pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Header: uuidModification={%RTuuid}\n", getImageModificationUUID(&pImage->Header));
pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Header: uuidParent={%RTuuid}\n", getImageParentUUID(&pImage->Header));
pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Header: uuidParentModification={%RTuuid}\n", getImageParentModificationUUID(&pImage->Header));
pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Image: fFlags=%08X offStartBlocks=%u offStartData=%u\n",
pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "Image: uBlockMask=%08X cbTotalBlockData=%u uShiftOffset2Index=%u offStartBlockData=%u\n",
cBadBlocks++;
pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "!! WARNING: %u blocks actually allocated (cBlocksAllocated=%u) !!\n",
if (cBadBlocks)
pImage->pInterfaceErrorCallbacks->pfnMessage(pImage->pInterfaceError->pvUser, "!! WARNING: %u bad blocks found !!\n",
return rc;
return rc;
return rc;
return rc;
return rc;
return rc;
return rc;
if (pIfParentState)
if (pCbParentState)
if (pIfProgress)
if (pCbProgress)
unsigned cBlocks;
unsigned cBlocksToMove = 0;
if (pfnParentRead)
unsigned cBlocksAllocated = (unsigned)((cbFile - pImage->offStartData - pImage->offStartBlockData) >> pImage->uShiftOffset2Index);
if (cBlocksAllocated == 0)
for (unsigned i = 0; i < cBlocksAllocated; i++)
for (unsigned i = 0; i < cBlocks; i++)
for (unsigned i = 0; i < cBlocks; i++)
else if (pfnParentRead)
unsigned cBlocksMoved = 0;
for (unsigned i = 0; i < cBlocksAllocated; i++)
if (uBlockUsedPos == i)
cBlocksMoved++;
if (paBlocks2)
if (pvTmp)
if (pvBuf)
return rc;
sizeof(VBOXHDDBACKEND),
NULL,