VDI.cpp revision 1a3f4928b55651645e48c5015349cddf9a9d14dd
/* $Id$ */
/** @file
* Virtual Disk Image (VDI), Core Code.
*/
/*
* Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP LOG_GROUP_VD_VDI
#include <VBox/vd-plugin.h>
#include "VDICore.h"
#define VDI_IMAGE_DEFAULT_BLOCK_SIZE _1M
/*******************************************************************************
* Static Variables *
*******************************************************************************/
/** NULL-terminated array of supported file extensions. */
static const VDFILEEXTENSION s_aVdiFileExtensions[] =
{
{"vdi", VDTYPE_HDD},
};
/*******************************************************************************
* Internal Functions *
*******************************************************************************/
static unsigned getPowerOfTwo(unsigned uNumber);
bool fUpdateHdr);
/**
* Internal: Flush the image file to disk.
*/
{
{
/* Save header. */
}
}
/**
* Internal: Free all allocated space for representing an image, and optionally
* delete the image from disk.
*/
{
int rc = VINF_SUCCESS;
/* Freeing a never allocated image (e.g. because the open failed) is
* not signalled as an error. After all nothing bad happens. */
if (pImage)
{
{
/* No point updating the file that is deleted anyway. */
if (!fDelete)
}
{
}
if (pImage->paBlocksRev)
{
}
}
return rc;
}
/**
* internal: return power of 2 or 0 if num error.
*/
static unsigned getPowerOfTwo(unsigned uNumber)
{
if (uNumber == 0)
return 0;
unsigned uPower2 = 0;
while ((uNumber & 1) == 0)
{
uNumber >>= 1;
uPower2++;
}
}
/**
* Internal: Init VDI preheader.
*/
{
}
/**
* Internal: check VDI preheader.
*/
{
return VERR_VD_VDI_INVALID_HEADER;
return VERR_VD_VDI_UNSUPPORTED_VERSION;
return VINF_SUCCESS;
}
/**
* Internal: translate VD image flags to VDI image type enum.
*/
{
if (uImageFlags & VD_IMAGE_FLAGS_FIXED)
return VDI_IMAGE_TYPE_FIXED;
else if (uImageFlags & VD_IMAGE_FLAGS_DIFF)
return VDI_IMAGE_TYPE_DIFF;
else
return VDI_IMAGE_TYPE_NORMAL;
}
/**
* Internal: translate VDI image type enum to VD image type enum.
*/
{
switch (enmType)
{
case VDI_IMAGE_TYPE_NORMAL:
return VD_IMAGE_FLAGS_NONE;
case VDI_IMAGE_TYPE_FIXED:
return VD_IMAGE_FLAGS_FIXED;
case VDI_IMAGE_TYPE_DIFF:
return VD_IMAGE_FLAGS_DIFF;
default:
return VD_IMAGE_FLAGS_NONE;
}
}
/**
* Internal: Init VDI header. Always use latest header version.
* @param pHeader Assumes it was initially initialized to all zeros.
*/
{
#ifdef VBOX_STRICT
char achZero[VDI_IMAGE_COMMENT_SIZE] = {0};
#endif
if (pszComment)
{
}
/* Mark the legacy geometry not-calculated. */
/* Init offsets. */
pHeader->u.v1plus.offBlocks = RT_ALIGN_32(sizeof(VDIPREHEADER) + sizeof(VDIHEADER1PLUS), VDI_DATA_ALIGN);
pHeader->u.v1plus.offData = RT_ALIGN_32(pHeader->u.v1plus.offBlocks + (pHeader->u.v1plus.cBlocks * sizeof(VDIIMAGEBLOCKPOINTER)), VDI_DATA_ALIGN);
/* Init uuids. */
/* Mark LCHS geometry not-calculated. */
}
/**
* Internal: Check VDI header.
*/
{
/* Check version-dependent header parameters. */
switch (GET_MAJOR_HEADER_VERSION(pHeader))
{
case 0:
{
/* Old header version. */
break;
}
case 1:
{
/* Current header version. */
{
LogRel(("VDI: v1 header size wrong (%d < %d)\n",
return VERR_VD_VDI_INVALID_HEADER;
}
{
LogRel(("VDI: v1 blocks offset wrong (%d < %d)\n",
return VERR_VD_VDI_INVALID_HEADER;
}
if (getImageDataOffset(pHeader) < (getImageBlocksOffset(pHeader) + getImageBlocks(pHeader) * sizeof(VDIIMAGEBLOCKPOINTER)))
{
LogRel(("VDI: v1 image data offset wrong (%d < %d)\n",
getImageDataOffset(pHeader), getImageBlocksOffset(pHeader) + getImageBlocks(pHeader) * sizeof(VDIIMAGEBLOCKPOINTER)));
return VERR_VD_VDI_INVALID_HEADER;
}
break;
}
default:
/* Unsupported. */
return VERR_VD_VDI_UNSUPPORTED_VERSION;
}
/* Check common header parameters. */
bool fFailed = false;
{
fFailed = true;
}
{
fFailed = true;
}
if ( getImageLCHSGeometry(pHeader)
{
LogRel(("VDI: wrong sector size (%d != %d)\n",
fFailed = true;
}
if ( getImageDiskSize(pHeader) == 0
|| getImageBlockSize(pHeader) == 0
|| getImageBlocks(pHeader) == 0
{
LogRel(("VDI: wrong size (%lld, %d, %d, %d)\n",
fFailed = true;
}
{
LogRel(("VDI: too many blocks allocated (%d > %d)\n"
" blocksize=%d disksize=%lld\n",
fFailed = true;
}
if ( getImageExtraBlockSize(pHeader) != 0
{
LogRel(("VDI: wrong extra size (%d, %d)\n",
fFailed = true;
}
{
LogRel(("VDI: wrong disk size (%d, %d, %lld)\n",
fFailed = true;
}
{
LogRel(("VDI: uuid of creator is 0\n"));
fFailed = true;
}
{
LogRel(("VDI: uuid of modifier is 0\n"));
fFailed = true;
}
}
/**
* Internal: Set up VDIIMAGEDESC structure by image header.
*/
{
}
/**
* Internal: Create VDI image file.
*/
unsigned uImageFlags, const char *pszComment,
void *pvUser, unsigned uPercentStart,
unsigned uPercentSpan)
{
int rc;
/* Special check for comment length. */
if ( VALID_PTR(pszComment)
{
goto out;
}
/* Save PCHS geometry. Not much work, and makes the flow of information
* quite a bit clearer - relying on the higher level isn't obvious. */
/* Set LCHS geometry (legacy geometry is ignored for the current 1.1+). */
pImage->paBlocks = (PVDIIMAGEBLOCKPOINTER)RTMemAlloc(sizeof(VDIIMAGEBLOCKPOINTER) * getImageBlocks(&pImage->Header));
{
rc = VERR_NO_MEMORY;
goto out;
}
if (!(uImageFlags & VD_IMAGE_FLAGS_FIXED))
{
/* for growing images mark all blocks in paBlocks as free. */
}
else
{
/* for fixed images mark all blocks in paBlocks as allocated */
}
/* Setup image parameters. */
/* Create image file. */
true /* fCreate */),
if (RT_FAILURE(rc))
{
goto out;
}
if (uImageFlags & VD_IMAGE_FLAGS_FIXED)
{
/* Check the free space on the disk and leave early if there is not
* sufficient space available. */
{
goto out;
}
}
if (uImageFlags & VD_IMAGE_FLAGS_FIXED)
{
/*
* Allocate & commit whole file if fixed image, it must be more
* effective than expanding file by write operations.
*/
}
else
{
/* Set file size to hold header and blocks array. */
}
if (RT_FAILURE(rc))
{
goto out;
}
/* Use specified image uuid */
/* Generate image last-modify uuid */
/* Write pre-header. */
if (RT_FAILURE(rc))
{
goto out;
}
/* Write header. */
if (RT_FAILURE(rc))
{
goto out;
}
rc = vdIfIoIntFileWriteSync(pImage->pIfIo, pImage->pStorage, pImage->offStartBlocks, pImage->paBlocks,
NULL);
if (RT_FAILURE(rc))
{
goto out;
}
if (uImageFlags & VD_IMAGE_FLAGS_FIXED)
{
/* Fill image with zeroes. We do this for every fixed-size image since on some systems
* (for example Windows Vista), it takes ages to write a block near the end of a sparse
* file and the guest could complain about an ATA timeout. */
/** @todo Starting with Linux 2.6.23, there is an fallocate() system call.
* Currently supported file systems are ext4 and ocfs2. */
/* Allocate a temporary zero-filled buffer. Use a bigger block size to optimize writing */
if (!pvBuf)
{
rc = VERR_NO_MEMORY;
goto out;
}
uOff = 0;
/* Write data to all image blocks. */
{
if (RT_FAILURE(rc))
{
rc = vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VDI: writing block failed for '%s'"), pImage->pszFilename);
goto out;
}
if (pfnProgress)
{
if (RT_FAILURE(rc))
goto out;
}
}
}
out:
if (RT_FAILURE(rc))
return rc;
}
/**
* Internal: Open a VDI image.
*/
{
int rc;
/*
* Open the image.
*/
if (RT_FAILURE(rc))
{
/* Do NOT signal an appropriate error here, as the VD layer has the
* choice of retrying the open if it failed. */
goto out;
}
/* Get file size. */
if (RT_FAILURE(rc))
{
vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VDI: error getting the image size in '%s'"), pImage->pszFilename);
goto out;
}
/* Read pre-header. */
if (RT_FAILURE(rc))
{
vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VDI: error reading pre-header in '%s'"), pImage->pszFilename);
goto out;
}
if (RT_FAILURE(rc))
{
rc = vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VDI: invalid pre-header in '%s'"), pImage->pszFilename);
goto out;
}
/* Read header. */
{
case 0:
NULL);
if (RT_FAILURE(rc))
{
rc = vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VDI: error reading v0 header in '%s'"), pImage->pszFilename);
goto out;
}
break;
case 1:
NULL);
if (RT_FAILURE(rc))
{
rc = vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VDI: error reading v1 header in '%s'"), pImage->pszFilename);
goto out;
}
* Conversion is harmless, as any VirtualBox version supporting VDI
* 1.1 doesn't touch fields it doesn't know about. */
{
/* Mark LCHS geometry not-calculated. */
}
{
/* Read the actual VDI 1.1+ header completely. */
if (RT_FAILURE(rc))
{
rc = vdIfError(pImage->pIfError, rc, RT_SRC_POS, N_("VDI: error reading v1.1+ header in '%s'"), pImage->pszFilename);
goto out;
}
}
break;
default:
rc = vdIfError(pImage->pIfError, 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;
}
if (RT_FAILURE(rc))
{
rc = vdIfError(pImage->pIfError, VERR_VD_VDI_INVALID_HEADER, RT_SRC_POS, N_("VDI: invalid header in '%s'"), pImage->pszFilename);
goto out;
}
/* Setup image parameters by header. */
/* Allocate memory for blocks array. */
pImage->paBlocks = (PVDIIMAGEBLOCKPOINTER)RTMemAlloc(sizeof(VDIIMAGEBLOCKPOINTER) * getImageBlocks(&pImage->Header));
{
rc = VERR_NO_MEMORY;
goto out;
}
/* Read blocks array. */
rc = vdIfIoIntFileReadSync(pImage->pIfIo, pImage->pStorage, pImage->offStartBlocks, pImage->paBlocks,
NULL);
if (uOpenFlags & VD_OPEN_FLAGS_DISCARD)
{
/*
* Create the back resolving table for discards.
* any error or inconsistency results in a fail because this might
* get us into trouble later on.
*/
if (pImage->paBlocksRev)
{
for (unsigned i = 0; i < cBlocks; i++)
for (unsigned i = 0; i < cBlocks; i++)
{
{
if (ptrBlock < cBlocksAllocated)
{
else
{
break;
}
}
else
{
break;
}
}
}
}
else
rc = VERR_NO_MEMORY;
}
out:
if (RT_FAILURE(rc))
vdiFreeImage(pImage, false);
return rc;
}
/**
* Internal: Save header to file.
*/
{
int rc;
{
case 0:
NULL);
break;
case 1:
NULL);
else
NULL);
break;
default:
break;
}
return rc;
}
/**
* Internal: Save header to file - async version.
*/
{
int rc;
{
case 0:
break;
case 1:
else
break;
default:
break;
}
return rc;
}
/**
* Internal: Save block pointer to file, save header to file.
*/
{
/* Update image header. */
if (RT_SUCCESS(rc))
{
/* write only one block pointer. */
NULL);
}
return rc;
}
/**
* Internal: Save block pointer to file, save header to file - async version.
*/
{
int rc = VINF_SUCCESS;
/* Update image header. */
if (fUpdateHdr)
{
/* write only one block pointer. */
sizeof(VDIIMAGEBLOCKPOINTER),
("vdiUpdateBlockInfo failed to update block=%u, filename=\"%s\", rc=%Rrc\n",
}
return rc;
}
/**
* Internal: Flush the image file to disk - async version.
*/
{
int rc = VINF_SUCCESS;
{
/* Save header. */
("vdiUpdateHeaderAsync() failed, filename=\"%s\", rc=%Rrc\n",
("Flushing data to disk failed rc=%Rrc\n", rc));
}
return rc;
}
/**
* Internal: Discard a whole block from the image filling the created hole with
* data from another block.
*
* @returns VBox status code.
* @param pImage VDI image instance data.
* @param uBlock The block to discard.
* @param pvBlock Memory to use for the I/O.
*/
{
int rc = VINF_SUCCESS;
LogFlowFunc(("pImage=%#p uBlock=%u pvBlock=%#p\n",
do
{
/*
* The block is empty, remove it.
* Read the last block of the image first.
*/
if (idxLastBlock != ptrBlockDiscard)
{
LogFlowFunc(("Moving block [%u]=%u into [%u]=%u\n",
if (RT_FAILURE(rc))
break;
/* Write to the now unallocated block. */
if (RT_FAILURE(rc))
break;
/* Update block and reverse block tables. */
if (RT_FAILURE(rc))
break;
}
else
/* Update the block pointers. */
if (RT_FAILURE(rc))
break;
} while (0);
return rc;
}
/**
*
* @return VBox status code.
* VINF_SUCCESS if everything was successful and the transfer can continue.
* VERR_VD_ASYNC_IO_IN_PROGRESS if there is another data transfer pending.
* @param pBackendData The opaque backend data.
* @param pIoCtx I/O context associated with this request.
* @param rcReq Status code for the completed request.
*/
static DECLCALLBACK(int) vdiDiscardBlockAsyncUpdate(void *pBackendData, PVDIOCTX pIoCtx, void *pvUser, int rcReq)
{
int rc = VINF_SUCCESS;
switch (pDiscardAsync->enmState)
{
{
uint64_t u64Offset = (uint64_t)pDiscardAsync->idxLastBlock * pImage->cbTotalBlockData + pImage->offStartData;
if (RT_FAILURE(rc))
break;
/* Release immediately and go to next step. */
}
{
/* Block read complete. Write to the new location (discarded block). */
uint64_t u64Offset = (uint64_t)pDiscardAsync->ptrBlockDiscard * pImage->cbTotalBlockData + pImage->offStartData;
if (RT_FAILURE(rc))
break;
}
{
int rc2;
/* Block write complete. Update metadata. */
{
if ( RT_FAILURE(rc)
&& rc != VERR_VD_ASYNC_IO_IN_PROGRESS)
break;
}
if ( RT_FAILURE(rc)
&& rc != VERR_VD_ASYNC_IO_IN_PROGRESS)
break;
if (RT_FAILURE(rc2))
/* Free discard state. */
break;
}
default:
}
if (rc == VERR_VD_NOT_ENOUGH_METADATA)
return rc;
}
/**
* Internal: Discard a whole block from the image filling the created hole with
* data from another block - async I/O version.
*
* @returns VBox status code.
* @param pImage VDI image instance data.
* @param pIoCtx I/O context associated with this request.
* @param uBlock The block to discard.
* @param pvBlock Memory to use for the I/O.
*/
{
int rc = VINF_SUCCESS;
LogFlowFunc(("pImage=%#p uBlock=%u pvBlock=%#p\n",
if (RT_UNLIKELY(!pDiscardAsync))
return VERR_NO_MEMORY;
/* Init block discard state. */
/*
* The block is empty, remove it.
* Read the last block of the image first.
*/
{
LogFlowFunc(("Moving block [%u]=%u into [%u]=%u\n",
}
else
{
pDiscardAsync->enmState = VDIBLOCKDISCARDSTATE_UPDATE_METADATA; /* Start immediately to shrink the image. */
}
/* Call the update callback directly. */
return rc;
}
/**
* Internal: Creates a allocation bitmap from the given data.
* Sectors which contain only 0 are marked as unallocated and sectors with
* other data as allocated.
*
* @returns Pointer to the allocation bitmap or NULL on failure.
* @param pvData The data to create the allocation bitmap for.
* @param cbData Number of bytes in the buffer.
*/
{
unsigned uSectorCur = 0;
void *pbmAllocationBitmap = NULL;
if (!pbmAllocationBitmap)
return NULL;
while (uSectorCur < cSectors)
{
if (idxSet != -1)
{
}
else
break;
}
return pbmAllocationBitmap;
}
/**
* Updates the state of the async cluster allocation.
*
* @returns VBox status code.
* @param pBackendData The opaque backend data.
* @param pIoCtx I/O context associated with this request.
* @param rcReq Status code for the completed request.
*/
static DECLCALLBACK(int) vdiAsyncBlockAllocUpdate(void *pBackendData, PVDIOCTX pIoCtx, void *pvUser, int rcReq)
{
int rc = VINF_SUCCESS;
if (RT_SUCCESS(rcReq))
{
if (pImage->paBlocksRev)
true /* fUpdateHdr */);
}
/* else: I/O error don't update the block table. */
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnCheckIfValid */
{
int rc = VINF_SUCCESS;
if ( !VALID_PTR(pszFilename)
|| !*pszFilename)
{
goto out;
}
if (!pImage)
{
rc = VERR_NO_MEMORY;
goto out;
}
vdiFreeImage(pImage, false);
if (RT_SUCCESS(rc))
*penmType = VDTYPE_HDD;
out:
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnOpen */
{
LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x pVDIfsDisk=%#p pVDIfsImage=%#p ppBackendData=%#p\n", pszFilename, uOpenFlags, pVDIfsDisk, pVDIfsImage, ppBackendData));
int rc;
/* Check open flags. All valid flags are supported. */
if (uOpenFlags & ~VD_OPEN_FLAGS_MASK)
{
goto out;
}
/* Check remaining arguments. */
if ( !VALID_PTR(pszFilename)
|| !*pszFilename)
{
goto out;
}
if (!pImage)
{
rc = VERR_NO_MEMORY;
goto out;
}
if (RT_SUCCESS(rc))
*ppBackendData = pImage;
else
out:
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnCreate */
unsigned uImageFlags, const char *pszComment,
unsigned uPercentStart, unsigned uPercentSpan,
{
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\n", pszFilename, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, uPercentStart, uPercentSpan, pVDIfsDisk, pVDIfsImage, pVDIfsOperation, ppBackendData));
int rc;
if (pIfProgress)
{
}
/* Check the image flags. */
if ((uImageFlags & ~VD_VDI_IMAGE_FLAGS_MASK) != 0)
{
goto out;
}
/* Check open flags. All valid flags are supported. */
if (uOpenFlags & ~VD_OPEN_FLAGS_MASK)
{
goto out;
}
/* Check size. Maximum 4PB-3M. No tricks with adjusting the 1M block size
* so far, which would extend the size. */
if ( !cbSize
{
goto out;
}
/* Check remaining arguments. */
if ( !VALID_PTR(pszFilename)
|| !*pszFilename
|| !VALID_PTR(pPCHSGeometry)
|| !VALID_PTR(pLCHSGeometry))
{
goto out;
}
if (!pImage)
{
rc = VERR_NO_MEMORY;
goto out;
}
if (RT_SUCCESS(rc))
{
* image is opened in read-only mode if the caller requested that. */
if (uOpenFlags & VD_OPEN_FLAGS_READONLY)
{
vdiFreeImage(pImage, false);
if (RT_FAILURE(rc))
{
goto out;
}
}
*ppBackendData = pImage;
}
else
out:
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnRename */
{
int rc = VINF_SUCCESS;
/* Check arguments. */
if ( !pImage
|| !pszFilename
|| !*pszFilename)
{
goto out;
}
/* Close the image. */
vdiFreeImage(pImage, false);
/* Rename the file. */
if (RT_FAILURE(rc))
{
/* The move failed, try to reopen the original image. */
if (RT_FAILURE(rc2))
goto out;
}
/* Update pImage with the new information. */
/* Open the new image. */
if (RT_FAILURE(rc))
goto out;
out:
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnClose */
{
int rc;
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnRead */
{
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;
}
/* Calculate starting block number and offset inside it. */
/* Clip read range to at most the rest of the block. */
{
rc = VINF_SUCCESS;
}
else
{
/* Block present in image file, read relevant data. */
else
{
LogRel(("VDI: Out of range access (%llu) in image %s, image size %llu\n",
}
}
if (pcbActuallyRead)
out:
return rc;
}
/**@copydoc VBOXHDDBACKEND::pfnWrite */
{
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;
int rc = VINF_SUCCESS;
{
goto out;
}
{
goto out;
}
/* No size check here, will do that later. For dynamic images which are
* not multiples of the block size in length, this would prevent writing to
* the last block. */
/* Calculate starting block number and offset inside it. */
/* Clip write range to at most the rest of the block. */
do
{
{
/* Block is either free or zero. */
{
/* If the destination block is unallocated at this point, it's
* either a zero block or a block which hasn't been used so far
* (which also means that it's a zero block. Don't need to write
* anything to this block if the data consists of just zeroes. */
{
*pcbPreRead = 0;
*pcbPostRead = 0;
break;
}
}
&& !(fWrite & VD_WRITE_NO_ALLOC))
{
/* Full block write to previously unallocated block.
* Allocate block and write data. */
if (RT_FAILURE(rc))
goto out;
if (pImage->paBlocksRev)
if (RT_FAILURE(rc))
goto out;
*pcbPreRead = 0;
*pcbPostRead = 0;
}
else
{
/* Trying to do a partial write to an unallocated block. Don't do
* anything except letting the upper layer know what to do. */
}
}
else
{
/* Block present in image file, write relevant data. */
}
} while (0);
if (pcbWriteProcess)
out:
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnFlush */
static int vdiFlush(void *pBackendData)
{
int rc = VINF_SUCCESS;
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnGetVersion */
static unsigned vdiGetVersion(void *pBackendData)
{
unsigned uVersion;
if (pImage)
else
uVersion = 0;
return uVersion;
}
/** @copydoc VBOXHDDBACKEND::pfnGetSize */
{
if (pImage)
else
cbSize = 0;
return cbSize;
}
/** @copydoc VBOXHDDBACKEND::pfnGetFileSize */
{
if (pImage)
{
{
if (RT_SUCCESS(rc))
}
}
return cb;
}
/** @copydoc VBOXHDDBACKEND::pfnGetPCHSGeometry */
{
int rc;
if (pImage)
{
{
rc = VINF_SUCCESS;
}
else
}
else
LogFlowFunc(("returns %Rrc (PCHS=%u/%u/%u)\n", rc, pPCHSGeometry->cCylinders, pPCHSGeometry->cHeads, pPCHSGeometry->cSectors));
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnSetPCHSGeometry */
{
LogFlowFunc(("pBackendData=%#p pPCHSGeometry=%#p PCHS=%u/%u/%u\n", pBackendData, pPCHSGeometry, pPCHSGeometry->cCylinders, pPCHSGeometry->cHeads, pPCHSGeometry->cSectors));
int rc;
if (pImage)
{
{
goto out;
}
rc = VINF_SUCCESS;
}
else
out:
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnGetLCHSGeometry */
{
int rc;
if (pImage)
{
if (!pGeometry)
if ( pGeometry->cCylinders > 0
{
rc = VINF_SUCCESS;
}
else
}
else
LogFlowFunc(("returns %Rrc (LCHS=%u/%u/%u)\n", rc, pLCHSGeometry->cCylinders, pLCHSGeometry->cHeads, pLCHSGeometry->cSectors));
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnSetLCHSGeometry */
{
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)
{
/* Update header information in base image file. */
}
rc = VINF_SUCCESS;
}
else
out:
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnGetImageFlags */
static unsigned vdiGetImageFlags(void *pBackendData)
{
unsigned uImageFlags;
if (pImage)
else
uImageFlags = 0;
return uImageFlags;
}
/** @copydoc VBOXHDDBACKEND::pfnGetOpenFlags */
static unsigned vdiGetOpenFlags(void *pBackendData)
{
unsigned uOpenFlags;
if (pImage)
else
uOpenFlags = 0;
return uOpenFlags;
}
/** @copydoc VBOXHDDBACKEND::pfnSetOpenFlags */
{
int rc;
const char *pszFilename;
/* Image must be opened and the new flags must be valid. */
if (!pImage || (uOpenFlags & ~(VD_OPEN_FLAGS_READONLY | VD_OPEN_FLAGS_INFO | VD_OPEN_FLAGS_ASYNC_IO | VD_OPEN_FLAGS_SHAREABLE | VD_OPEN_FLAGS_SEQUENTIAL | VD_OPEN_FLAGS_DISCARD)))
{
goto out;
}
/* Implement this operation via reopening the image. */
if (RT_FAILURE(rc))
goto out;
out:
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnGetComment */
{
LogFlowFunc(("pBackendData=%#p pszComment=%#p cbComment=%zu\n", pBackendData, pszComment, cbComment));
int rc = VINF_SUCCESS;
if (pImage)
{
/* Make this foolproof even if the image doesn't have the zero
* termination. With some luck the repaired header will be saved. */
if (cb == VDI_IMAGE_COMMENT_SIZE)
{
cb--;
}
{
/* memcpy is much better than strncpy. */
}
else
}
else
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnGetComment */
{
int rc;
if (pImage)
{
else
{
if (cchComment >= VDI_IMAGE_COMMENT_SIZE)
{
goto out;
}
/* we don't support old style images */
{
/*
* Update the comment field, making sure to zero out all of the previous comment.
*/
/* write out new the header */
}
else
}
}
else
out:
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnGetUuid */
{
int rc;
if (pImage)
{
rc = VINF_SUCCESS;
}
else
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnSetUuid */
{
int rc = VINF_SUCCESS;
if (pImage)
{
{
/* Make it possible to clone old VDIs. */
else
{
LogFunc(("Version is not supported!\n"));
}
}
else
}
else
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnGetModificationUuid */
{
int rc;
if (pImage)
{
rc = VINF_SUCCESS;
}
else
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnSetModificationUuid */
{
int rc = VINF_SUCCESS;
if (pImage)
{
{
/* Make it possible to clone old VDIs. */
else
{
LogFunc(("Version is not supported!\n"));
}
}
else
}
else
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnGetParentUuid */
{
int rc;
if (pImage)
{
rc = VINF_SUCCESS;
}
else
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnSetParentUuid */
{
int rc = VINF_SUCCESS;
if (pImage)
{
{
/* Make it possible to clone old VDIs. */
else
{
LogFunc(("Version is not supported!\n"));
}
}
else
}
else
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnGetParentModificationUuid */
{
int rc;
if (pImage)
{
rc = VINF_SUCCESS;
}
else
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnSetParentModificationUuid */
{
int rc = VINF_SUCCESS;
if (pImage)
{
{
else
{
LogFunc(("Version is not supported!\n"));
}
}
else
}
else
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnDump */
static void vdiDump(void *pBackendData)
{
vdIfErrorMessage(pImage->pIfError, "Header: cbBlock=%u cbBlockExtra=%u cBlocks=%u cBlocksAllocated=%u\n",
if (pg)
vdIfErrorMessage(pImage->pIfError, "Header: uuidCreation={%RTuuid}\n", getImageCreationUUID(&pImage->Header));
vdIfErrorMessage(pImage->pIfError, "Header: uuidModification={%RTuuid}\n", getImageModificationUUID(&pImage->Header));
vdIfErrorMessage(pImage->pIfError, "Header: uuidParent={%RTuuid}\n", getImageParentUUID(&pImage->Header));
vdIfErrorMessage(pImage->pIfError, "Header: uuidParentModification={%RTuuid}\n", getImageParentModificationUUID(&pImage->Header));
vdIfErrorMessage(pImage->pIfError, "Image: uBlockMask=%08X cbTotalBlockData=%u uShiftOffset2Index=%u offStartBlockData=%u\n",
{
{
cBadBlocks++;
}
}
{
vdIfErrorMessage(pImage->pIfError, "!! WARNING: %u blocks actually allocated (cBlocksAllocated=%u) !!\n",
}
if (cBadBlocks)
{
}
}
{
LogFlowFunc(("pBackendData=%#p uOffset=%llu pIoCtx=%#p cbToRead=%zu pcbActuallyRead=%#p\n",
unsigned uBlock;
unsigned offRead;
int rc;
|| !cbToRead)
{
goto out;
}
/* Calculate starting block number and offset inside it. */
/* Clip read range to at most the rest of the block. */
{
rc = VINF_SUCCESS;
}
else
{
/* Block present in image file, read relevant data. */
else
{
LogRel(("VDI: Out of range access (%llu) in image %s, image size %llu\n",
}
}
if (pcbActuallyRead)
out:
return rc;
}
{
LogFlowFunc(("pBackendData=%#p uOffset=%llu pIoCtx=%#p cbToWrite=%zu pcbWriteProcess=%#p pcbPreRead=%#p pcbPostRead=%#p\n",
unsigned uBlock;
unsigned offWrite;
int rc = VINF_SUCCESS;
{
goto out;
}
{
goto out;
}
/* No size check here, will do that later. For dynamic images which are
* not multiples of the block size in length, this would prevent writing to
* the last block. */
/* Calculate starting block number and offset inside it. */
/* Clip write range to at most the rest of the block. */
do
{
{
/* Block is either free or zero. */
{
#if 0 /** @todo Provide interface to check an I/O context for a specific value */
/* If the destination block is unallocated at this point, it's
* either a zero block or a block which hasn't been used so far
* (which also means that it's a zero block. Don't need to write
* anything to this block if the data consists of just zeroes. */
{
break;
}
#endif
}
&& !(fWrite & VD_WRITE_NO_ALLOC))
{
/* Full block write to previously unallocated block.
* Allocate block and write data. */
if (!pBlockAlloc)
{
rc = VERR_NO_MEMORY;
break;
}
*pcbPreRead = 0;
*pcbPostRead = 0;
if (rc == VERR_VD_ASYNC_IO_IN_PROGRESS)
break;
else if (RT_FAILURE(rc))
{
break;
}
}
else
{
/* Trying to do a partial write to an unallocated block. Don't do
* anything except letting the upper layer know what to do. */
}
}
else
{
/* Block present in image file, write relevant data. */
}
} while (0);
if (pcbWriteProcess)
out:
return rc;
}
{
int rc = VINF_SUCCESS;
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnCompact */
{
int rc = VINF_SUCCESS;
if (pIfParentState)
{
}
do {
unsigned cBlocks;
unsigned cBlocksToMove = 0;
if (pfnParentRead)
{
}
unsigned cBlocksAllocated = (unsigned)((cbFile - pImage->offStartData - pImage->offStartBlockData) >> pImage->uShiftOffset2Index);
if (cBlocksAllocated == 0)
{
/* No data blocks in this image, no need to compact. */
rc = VINF_SUCCESS;
break;
}
/* Allocate block array for back resolving. */
* compacting the image, just to be on the safe side. Update the
* image contents straight away, as this enables cancelling. */
for (unsigned i = 0; i < cBlocksAllocated; i++)
rc = VINF_SUCCESS;
for (unsigned i = 0; i < cBlocks; i++)
{
{
if (ptrBlock < cBlocksAllocated)
{
else
{
LogFunc(("Freed cross-linked block %u in file \"%s\"\n",
i, pImage->pszFilename));
if (RT_FAILURE(rc))
break;
}
}
else
{
LogFunc(("Freed out of bounds reference for block %u in file \"%s\"\n",
i, pImage->pszFilename));
if (RT_FAILURE(rc))
break;
}
}
}
if (RT_FAILURE(rc))
break;
/* Find redundant information and update the block pointers
* accordingly, creating bubbles. Keep disk up to date, as this
* enables cancelling. */
for (unsigned i = 0; i < cBlocks; i++)
{
{
/* Block present in image file, read relevant data. */
if (RT_FAILURE(rc))
break;
{
if (RT_FAILURE(rc))
break;
/* Adjust progress info, one block to be relocated. */
}
else if (pfnParentRead)
{
if (RT_FAILURE(rc))
break;
{
if (RT_FAILURE(rc))
break;
/* Adjust progress info, one block to be relocated. */
}
}
}
/* Check if the range is in use if the block is still allocated. */
&& pIfQueryRangeUse)
{
bool fUsed = true;
if (RT_FAILURE(rc))
break;
if (!fUsed)
{
if (RT_FAILURE(rc))
break;
/* Adjust progress info, one block to be relocated. */
}
}
{
if (RT_FAILURE(rc))
break;
}
}
if (RT_FAILURE(rc))
break;
/* Fill bubbles with other data (if available). */
unsigned cBlocksMoved = 0;
unsigned uBlockUsedPos = cBlocksAllocated;
for (unsigned i = 0; i < cBlocksAllocated; i++)
{
if (uBlock == VDI_IMAGE_BLOCK_FREE)
{
unsigned uBlockData = VDI_IMAGE_BLOCK_FREE;
{
}
/* Terminate early if there is no block which needs copying. */
if (uBlockUsedPos == i)
break;
if (RT_FAILURE(rc))
break;
paBlocks2[i] = uBlockData;
cBlocksMoved++;
}
{
if (RT_FAILURE(rc))
break;
}
}
if (RT_FAILURE(rc))
break;
/* Update image header. */
/* Truncate the image to the proper size to finish compacting. */
} while (0);
if (paBlocks2)
if (pvTmp)
if (pvBuf)
{
}
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnResize */
unsigned uPercentStart, unsigned uPercentSpan,
{
int rc = VINF_SUCCESS;
/*
* Making the image smaller is not supported at the moment.
* Resizing is also not supported for fixed size images and
* very old images.
*/
/** @todo implement making the image smaller, it is the responsibility of
* the user to know what he's doing. */
{
unsigned cBlocksAllocated = getImageBlocksAllocated(&pImage->Header); /** < Blocks currently allocated, doesn't change during resize */
uint32_t cBlocksNew = cbSize / getImageBlockSize(&pImage->Header); /** < New number of blocks in the image after the resize */
cBlocksNew++;
uint64_t cbBlockspaceNew = cBlocksNew * sizeof(VDIIMAGEBLOCKPOINTER); /** < Required space for the block array after the resize. */
uint64_t offStartDataNew = RT_ALIGN_32(pImage->offStartBlocks + cbBlockspaceNew, VDI_DATA_ALIGN); /** < New start offset for block data after the resize */
&& cBlocksAllocated > 0)
{
/* Calculate how many sectors need to be relocated. */
cBlocksReloc++;
/* Since only full blocks can be relocated the new data start is
* determined by moving it block by block. */
/* Do the relocation. */
/*
* Get the blocks we need to relocate first, they are appended to the end
* of the image.
*/
do
{
/* Allocate data buffer. */
if (!pvBuf)
{
rc = VERR_NO_MEMORY;
break;
}
/* Allocate buffer for overwriting with zeroes. */
if (!pvZero)
{
rc = VERR_NO_MEMORY;
break;
}
for (unsigned i = 0; i < cBlocksReloc; i++)
{
/* Search the index in the block table. */
{
{
/* Read data and append to the end of the image. */
if (RT_FAILURE(rc))
break;
if (RT_FAILURE(rc))
break;
if (RT_FAILURE(rc))
break;
/* Zero out the old block area. */
if (RT_FAILURE(rc))
break;
/* Update block counter. */
/*
* Decrease the block number of all other entries in the array.
* They were moved one block to the front.
* Doing it as a separate step iterating over the array again
* because an error while relocating the block might end up
* in a corrupted image otherwise.
*/
{
}
/* Continue with the next block. */
break;
}
}
if (RT_FAILURE(rc))
break;
uBlock++;
}
} while (0);
if (pvBuf)
if (pvZero)
}
/*
* We need to update the new offsets for the image data in the out of memory
* case too because we relocated the blocks already.
*/
/*
* Relocation done, expand the block array and update the header with
* the new data.
*/
if (RT_SUCCESS(rc))
{
PVDIIMAGEBLOCKPOINTER paBlocksNew = (PVDIIMAGEBLOCKPOINTER)RTMemRealloc(pImage->paBlocks, cbBlockspaceNew);
if (paBlocksNew)
{
/* Mark the new blocks as unallocated. */
}
else
rc = VERR_NO_MEMORY;
/* Write the block array before updating the rest. */
if (RT_SUCCESS(rc))
{
/* Update size and new block count. */
/* Update geometry. */
if (pGeometry)
{
}
}
}
/* Update header information in base image file. */
}
/* Same size doesn't change the image at all. */
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnDiscard */
void **ppbmAllocationBitmap,
unsigned fDiscard)
{
unsigned uBlock;
unsigned offDiscard;
int rc = VINF_SUCCESS;
LogFlowFunc(("pBackendData=%#p uOffset=%llu cbDiscard=%zu pcbPreAllocated=%#p pcbPostAllocated=%#p pcbActuallyDiscarded=%#p ppbmAllocationBitmap=%#p fDiscard=%#x\n",
pBackendData, uOffset, cbDiscard, pcbPreAllocated, pcbPostAllocated, pcbActuallyDiscarded, ppbmAllocationBitmap, fDiscard));
("Image is readonly\n"), VERR_VD_IMAGE_READ_ONLY);
&& cbDiscard,
("Invalid parameters uOffset=%llu cbDiscard=%zu\n",
do
{
("Image is opened readonly\n"),
("cbDiscard=%u\n", cbDiscard),
/* Calculate starting block number and offset inside it. */
/* Clip range to at most the rest of the block. */
if (pcbPreAllocated)
*pcbPreAllocated = 0;
if (pcbPostAllocated)
*pcbPostAllocated = 0;
{
/* Read the block data. */
if (!pvBlock)
{
rc = VERR_NO_MEMORY;
break;
}
if (!cbPreAllocated && !cbPostAllocated)
{
/*
* Discarding a whole block, don't check for allocated sectors.
* It is possible to just remove the whole block which avoids
* one read and checking the whole block for data.
*/
}
else
{
/* Read data. */
uint64_t u64Offset = (uint64_t)pImage->paBlocks[uBlock] * pImage->cbTotalBlockData + pImage->offStartData;
if (RT_FAILURE(rc))
break;
/* Clear data. */
else if (fDiscard & VD_DISCARD_MARK_UNUSED)
{
/* Write changed data to the image. */
}
else
{
/* Block has data, create allocation bitmap. */
if (RT_UNLIKELY(!*ppbmAllocationBitmap))
rc = VERR_NO_MEMORY;
else
}
} /* if: no complete block discarded */
} /* if: Block is allocated. */
/* else: nothing to do. */
} while (0);
if (pcbActuallyDiscarded)
if (pvBlock)
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnDiscard */
void **ppbmAllocationBitmap,
unsigned fDiscard)
{
unsigned uBlock;
unsigned offDiscard;
int rc = VINF_SUCCESS;
LogFlowFunc(("pBackendData=%#p pIoCtx=%#p uOffset=%llu cbDiscard=%zu pcbPreAllocated=%#p pcbPostAllocated=%#p pcbActuallyDiscarded=%#p ppbmAllocationBitmap=%#p fDiscard=%#x\n",
pBackendData, pIoCtx, uOffset, cbDiscard, pcbPreAllocated, pcbPostAllocated, pcbActuallyDiscarded, ppbmAllocationBitmap, fDiscard));
("Image is readonly\n"), VERR_VD_IMAGE_READ_ONLY);
&& cbDiscard,
("Invalid parameters uOffset=%llu cbDiscard=%zu\n",
do
{
("Image is opened readonly\n"),
("cbDiscard=%u\n", cbDiscard),
/* Calculate starting block number and offset inside it. */
/* Clip range to at most the rest of the block. */
if (pcbPreAllocated)
*pcbPreAllocated = 0;
if (pcbPostAllocated)
*pcbPostAllocated = 0;
{
/* Read the block data. */
if (!pvBlock)
{
rc = VERR_NO_MEMORY;
break;
}
if (!cbPreAllocated && !cbPostAllocated)
{
/*
* Discarding a whole block, don't check for allocated sectors.
* It is possible to just remove the whole block which avoids
* one read and checking the whole block for data.
*/
}
else if (fDiscard & VD_DISCARD_MARK_UNUSED)
{
/* Just zero out the given range. */
uint64_t u64Offset = (uint64_t)pImage->paBlocks[uBlock] * pImage->cbTotalBlockData + pImage->offStartData + offDiscard;
}
else
{
/*
* Read complete block as metadata, the I/O context has no memory buffer
* and we need to access the content directly anyway.
*/
uint64_t u64Offset = (uint64_t)pImage->paBlocks[uBlock] * pImage->cbTotalBlockData + pImage->offStartData;
if (RT_FAILURE(rc))
break;
/* Clear data. */
else
{
/* Block has data, create allocation bitmap. */
if (RT_UNLIKELY(!*ppbmAllocationBitmap))
rc = VERR_NO_MEMORY;
else
}
} /* if: no complete block discarded */
} /* if: Block is allocated. */
/* else: nothing to do. */
} while (0);
if (pcbActuallyDiscarded)
return rc;
}
/** @copydoc VBOXHDDBACKEND::pfnRepair */
{
LogFlowFunc(("pszFilename=\"%s\" pVDIfsDisk=%#p pVDIfsImage=%#p\n", pszFilename, pVDIfsDisk, pVDIfsImage));
int rc;
do
{
bool fRepairHdr = false;
bool fRepairBlockArray = false;
: 0,
false /* fCreate */),
&pStorage);
if (RT_FAILURE(rc))
{
break;
}
if (RT_FAILURE(rc))
{
break;
}
/* Read pre-header. */
if (RT_FAILURE(rc))
{
break;
}
if (RT_FAILURE(rc))
{
break;
}
/* Read header. */
switch (GET_MAJOR_HEADER_VERSION(&Hdr))
{
case 0:
NULL);
if (RT_FAILURE(rc))
break;
case 1:
if (RT_FAILURE(rc))
{
}
{
/* Read the VDI 1.1+ header completely. */
NULL);
if (RT_FAILURE(rc))
}
break;
default:
N_("VDI: unsupported major version %u in '%s'"),
break;
}
if (RT_SUCCESS(rc))
{
if (RT_FAILURE(rc))
{
break;
}
}
/* Setup image parameters by header. */
/* Allocate memory for blocks array. */
if (!paBlocks)
{
"Failed to allocate memory for block array");
break;
}
/* Read blocks array. */
NULL);
if (RT_FAILURE(rc))
{
"Failed to read block array (at %llu), %Rrc",
offStartBlocks, rc);
break;
}
if (!pu32BlockBitmap)
{
"Failed to allocate memory for block bitmap");
break;
}
{
if (IS_VDI_IMAGE_BLOCK_ALLOCATED(paBlocks[i]))
{
+ offStartData;
/*
* Check that the offsets are valid (inside of the image) and
* that there are no double references.
*/
{
i, offBlock);
paBlocks[i] = VDI_IMAGE_BLOCK_FREE;
fRepairBlockArray = true;
}
{
i);
paBlocks[i] = VDI_IMAGE_BLOCK_FREE;
fRepairBlockArray = true;
}
}
}
/* Write repaired structures now. */
if (!fRepairBlockArray)
else if (!(fFlags & VD_REPAIR_DRY_RUN))
{
NULL);
if (RT_FAILURE(rc))
{
"Could not write repaired block allocation table (at %llu), %Rrc",
offStartBlocks, rc);
break;
}
}
} while(0);
if (paBlocks)
if (pu32BlockBitmap)
if (pStorage)
return rc;
}
{
/* pszBackendName */
"VDI",
/* cbSize */
sizeof(VBOXHDDBACKEND),
/* uBackendCaps */
/* paFileExtensions */
/* paConfigInfo */
NULL,
/* hPlugin */
/* pfnCheckIfValid */
/* pfnOpen */
/* pfnCreate */
/* pfnRename */
/* pfnClose */
/* pfnRead */
/* pfnWrite */
/* pfnFlush */
/* pfnGetVersion */
/* pfnGetSize */
/* pfnGetFileSize */
/* pfnGetPCHSGeometry */
/* pfnSetPCHSGeometry */
/* pfnGetLCHSGeometry */
/* pfnSetLCHSGeometry */
/* pfnGetImageFlags */
/* pfnGetOpenFlags */
/* pfnSetOpenFlags */
/* pfnGetComment */
/* pfnSetComment */
/* pfnGetUuid */
/* pfnSetUuid */
/* pfnGetModificationUuid */
/* pfnSetModificationUuid */
/* pfnGetParentUuid */
/* pfnSetParentUuid */
/* pfnGetParentModificationUuid */
/* pfnSetParentModificationUuid */
/* pfnDump */
/* pfnGetTimeStamp */
NULL,
/* pfnGetParentTimeStamp */
NULL,
/* pfnSetParentTimeStamp */
NULL,
/* pfnGetParentFilename */
NULL,
/* pfnSetParentFilename */
NULL,
/* pfnAsyncRead */
/* pfnAsyncWrite */
/* pfnAsyncFlush */
/* pfnComposeLocation */
/* pfnComposeName */
/* pfnCompact */
/* pfnResize */
/* pfnDiscard */
/* pfnAsyncDiscard */
/* pfnRepair */
};