Logo Search packages:      
Sourcecode: virtualbox-ose version File versions

VBOXDDU_DECL ( int   ) 

Initializes HDD backends.

Returns:
VBox status code.
Destroys loaded HDD backends.

Returns:
VBox status code.
Lists all HDD backends and their capabilities in a caller-provided buffer. Free all returned names with RTStrFree() when you no longer need them.

Returns:
VBox status code. VERR_BUFFER_OVERFLOW if not enough space is passed.
Parameters:
cEntriesAlloc Number of list entries available.
pEntries Pointer to array for the entries.
pcEntriesUsed Number of entries returned.
Lists the capablities of a backend indentified by its name. Free all returned names with RTStrFree() when you no longer need them.

Returns:
VBox status code.
Parameters:
pszBackend The backend name (case insensitive).
pEntries Pointer to an entry.
Allocates and initializes an empty HDD container. No image files are opened.

Returns:
VBox status code.
Parameters:
pVDIfsDisk Pointer to the per-disk VD interface list.
ppDisk Where to store the reference to HDD container.
Try to get the backend name which can use this image.

Returns:
VBox status code.
Parameters:
pszFilename Name of the image file for which the backend is queried.
ppszFormat Receives pointer of the UTF-8 string which contains the format name. The returned pointer must be freed using RTStrFree().
Opens an image file.

The first opened image file in HDD container must have a base image type, others (next opened images) must be differencing or undo images. Linkage is checked for differencing image to be consistent with the previously opened image. When another differencing image is opened and the last image was opened in read/write access mode, then the last image is reopened in read-only with deny write sharing mode. This allows other processes to use images in read-only mode too.

Note that the image is opened in read-only mode if a read/write open is not possible. Use VDIsReadOnly to check open mode.

Returns:
VBox status code.
Parameters:
pDisk Pointer to HDD container.
pszBackend Name of the image file backend to use (case insensitive).
pszFilename Name of the image file to open.
uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants.
pVDIfsImage Pointer to the per-image VD interface list.
Creates and opens a new base image file.

Returns:
VBox status code.
Parameters:
pDisk Pointer to HDD container.
pszBackend Name of the image file backend to use (case insensitive).
pszFilename Name of the image file to create.
enmType Image type, only base image types are acceptable.
cbSize Image size in bytes.
uImageFlags Flags specifying special image features.
pszComment Pointer to image comment. NULL is ok.
pPCHSGeometry Pointer to physical disk geometry <= (16383,16,63). Not NULL.
pLCHSGeometry Pointer to logical disk geometry <= (1024,255,63). Not NULL.
pUuid New UUID of the image. If NULL, a new UUID is created.
uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants.
pVDIfsImage Pointer to the per-image VD interface list.
pVDIfsOperation Pointer to the per-operation VD interface list.
Creates and opens a new differencing image file in HDD container. See comments for VDOpen function about differencing images.

Returns:
VBox status code.
Parameters:
pDisk Pointer to HDD container.
pszBackend Name of the image file backend to use (case insensitive).
pszFilename Name of the differencing image file to create.
uImageFlags Flags specifying special image features.
pszComment Pointer to image comment. NULL is ok.
pUuid New UUID of the image. If NULL, a new UUID is created.
pParentUuid New parent UUID of the image. If NULL, the UUID is queried automatically.
uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants.
pVDIfsImage Pointer to the per-image VD interface list.
pVDIfsOperation Pointer to the per-operation VD interface list.
Merges two images (not necessarily with direct parent/child relationship). As a side effect the source image and potentially the other images which are also merged to the destination are deleted from both the disk and the images in the HDD container.

Returns:
VBox status code.

VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.

Parameters:
pDisk Pointer to HDD container.
nImageFrom Name of the image file to merge from.
nImageTo Name of the image file to merge to.
pVDIfsOperation Pointer to the per-operation VD interface list.
Copies an image from one HDD container to another. The copy is opened in the target HDD container. It is possible to convert between different image formats, because the backend for the destination may be different from the source. If both the source and destination reference the same HDD container, then the image is moved (by copying/deleting or renaming) to the new location. The source container is unchanged if the move operation fails, otherwise the image at the new location is opened in the same way as the old one was.

Returns:
VBox status code.

VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.

Parameters:
pDiskFrom Pointer to source HDD container.
nImage Image number, counts from 0. 0 is always base image of container.
pDiskTo Pointer to destination HDD container.
pszBackend Name of the image file backend to use (may be NULL to use the same as the source, case insensitive).
pszFilename New name of the image (may be NULL if pDiskFrom == pDiskTo).
fMoveByRename If true, attempt to perform a move by renaming (if successful the new size is ignored).
cbSize New image size (0 means leave unchanged).
pDstUuid New UUID of the destination image. If NULL, a new UUID is created. This parameter is used if and only if a true copy is created. In all rename/move cases the UUIDs are copied over.
pVDIfsOperation Pointer to the per-operation VD interface list.
pDstVDIfsImage Pointer to the per-image VD interface list, for the destination image.
pDstVDIfsOperation Pointer to the per-operation VD interface list, for the destination operation.
Closes the last opened image file in HDD container. If previous image file was opened in read-only mode (that is normal) and closing image was opened in read-write mode (the whole disk was in read-write mode) - the previous image will be reopened in read/write mode.

Returns:
VBox status code.

VERR_VD_NOT_OPENED if no image is opened in HDD container.

Parameters:
pDisk Pointer to HDD container.
fDelete If true, delete the image from the host disk.
Closes all opened image files in HDD container.

Returns:
VBox status code.
Parameters:
pDisk Pointer to HDD container.
Read data from virtual HDD.

Returns:
VBox status code.

VERR_VD_NOT_OPENED if no image is opened in HDD container.

Parameters:
pDisk Pointer to HDD container.
uOffset Offset of first reading byte from start of disk. Must be aligned to a sector boundary.
pvBuf Pointer to buffer for reading data.
cbRead Number of bytes to read. Must be aligned to a sector boundary.
Write data to virtual HDD.

Returns:
VBox status code.

VERR_VD_NOT_OPENED if no image is opened in HDD container.

Parameters:
pDisk Pointer to HDD container.
uOffset Offset of first writing byte from start of disk. Must be aligned to a sector boundary.
pvBuf Pointer to buffer for writing data.
cbWrite Number of bytes to write. Must be aligned to a sector boundary.
Make sure the on disk representation of a virtual HDD is up to date.

Returns:
VBox status code.

VERR_VD_NOT_OPENED if no image is opened in HDD container.

Parameters:
pDisk Pointer to HDD container.
Get virtual disk PCHS geometry of an image in HDD container.

Returns:
VBox status code.

VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.

VERR_VD_GEOMETRY_NOT_SET if no geometry present in the HDD container.

Parameters:
pDisk Pointer to HDD container.
nImage Image number, counts from 0. 0 is always base image of container.
pPCHSGeometry Where to store PCHS geometry. Not NULL.
Store virtual disk PCHS geometry of an image in HDD container.

Returns:
VBox status code.

VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.

Parameters:
pDisk Pointer to HDD container.
nImage Image number, counts from 0. 0 is always base image of container.
pPCHSGeometry Where to load PCHS geometry from. Not NULL.
Get virtual disk LCHS geometry of an image in HDD container.

Returns:
VBox status code.

VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.

VERR_VD_GEOMETRY_NOT_SET if no geometry present in the HDD container.

Parameters:
pDisk Pointer to HDD container.
nImage Image number, counts from 0. 0 is always base image of container.
pLCHSGeometry Where to store LCHS geometry. Not NULL.
Store virtual disk LCHS geometry of an image in HDD container.

Returns:
VBox status code.

VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.

Parameters:
pDisk Pointer to HDD container.
nImage Image number, counts from 0. 0 is always base image of container.
pLCHSGeometry Where to load LCHS geometry from. Not NULL.
Get version of image in HDD container.

Returns:
VBox status code.

VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.

Parameters:
pDisk Pointer to HDD container.
nImage Image number, counts from 0. 0 is always base image of container.
puVersion Where to store the image version.
Get type of image in HDD container.

Returns:
VBox status code.

VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.

Parameters:
pDisk Pointer to HDD container.
nImage Image number, counts from 0. 0 is always base image of container.
penmType Where to store the image type.
List the capabilities of image backend in HDD container.

Returns:
VBox status code.

VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.

Parameters:
pDisk Pointer to the HDD container.
nImage Image number, counts from 0. 0 is always base image of container.
pbackendInfo Where to store the backend information.
Get flags of image in HDD container.

Returns:
VBox status code.

VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.

Parameters:
pDisk Pointer to HDD container.
nImage Image number, counts from 0. 0 is always base image of container.
puImageFlags Where to store the image flags.
Get open flags of image in HDD container.

Returns:
VBox status code.

VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.

Parameters:
pDisk Pointer to HDD container.
nImage Image number, counts from 0. 0 is always base image of container.
puOpenFlags Where to store the image open flags.
Set open flags of image in HDD container. This operation may cause file locking changes and/or files being reopened. Note that in case of unrecoverable error all images in HDD container will be closed.

Returns:
VBox status code.

VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.

Parameters:
pDisk Pointer to HDD container.
nImage Image number, counts from 0. 0 is always base image of container.
uOpenFlags Image file open mode, see VD_OPEN_FLAGS_* constants.
Get base filename of image in HDD container. Some image formats use other filenames as well, so don't use this for anything but informational purposes.

Returns:
VBox status code.

VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.

VERR_BUFFER_OVERFLOW if pszFilename buffer too small to hold filename.

Parameters:
pDisk Pointer to HDD container.
nImage Image number, counts from 0. 0 is always base image of container.
pszFilename Where to store the image file name.
cbFilename Size of buffer pszFilename points to.
Get the comment line of image in HDD container.

Returns:
VBox status code.

VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.

VERR_BUFFER_OVERFLOW if pszComment buffer too small to hold comment text.

Parameters:
pDisk Pointer to HDD container.
nImage Image number, counts from 0. 0 is always base image of container.
pszComment Where to store the comment string of image. NULL is ok.
cbComment The size of pszComment buffer. 0 is ok.
Changes the comment line of image in HDD container.

Returns:
VBox status code.

VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.

Parameters:
pDisk Pointer to HDD container.
nImage Image number, counts from 0. 0 is always base image of container.
pszComment New comment string (UTF-8). NULL is allowed to reset the comment.
Get UUID of image in HDD container.

Returns:
VBox status code.

VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.

Parameters:
pDisk Pointer to HDD container.
nImage Image number, counts from 0. 0 is always base image of container.
pUuid Where to store the image UUID.
Set the image's UUID. Should not be used by normal applications.

Returns:
VBox status code.

VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.

Parameters:
pDisk Pointer to HDD container.
nImage Image number, counts from 0. 0 is always base image of container.
pUuid New UUID of the image. If NULL, a new UUID is created.
Get last modification UUID of image in HDD container.

Returns:
VBox status code.

VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.

Parameters:
pDisk Pointer to HDD container.
nImage Image number, counts from 0. 0 is always base image of container.
pUuid Where to store the image modification UUID.
Set the image's last modification UUID. Should not be used by normal applications.

Returns:
VBox status code.

VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.

Parameters:
pDisk Pointer to HDD container.
nImage Image number, counts from 0. 0 is always base image of container.
pUuid New modification UUID of the image. If NULL, a new UUID is created.
Get parent UUID of image in HDD container.

Returns:
VBox status code.

VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.

Parameters:
pDisk Pointer to HDD container.
nImage Image number, counts from 0. 0 is always base image of the container.
pUuid Where to store the parent image UUID.
Set the image's parent UUID. Should not be used by normal applications.

Returns:
VBox status code.
Parameters:
pDisk Pointer to HDD container.
nImage Image number, counts from 0. 0 is always base image of container.
pUuid New parent UUID of the image. If NULL, a new UUID is created.
Query if asynchronous operations are supported for this disk.

Returns:
VBox status code.

VERR_VD_IMAGE_NOT_FOUND if image with specified number was not opened.

Parameters:
pDisk Pointer to the HDD container.
nImage Image number, counts from 0. 0 is always base image of container.
pfAIOSupported Where to store if async IO is supported.
Start a asynchronous read request.

Returns:
VBox status code.
Parameters:
pDisk Pointer to the HDD container.
uOffset The offset of the virtual disk to read from.
cbRead How many bytes to read.
paSeg Pointer to an array of segments.
cSeg Number of segments in the array.
pvUser User data which is passed on completion
Start a asynchronous write request.

Returns:
VBox status code.
Parameters:
pDisk Pointer to the HDD container.
uOffset The offset of the virtual disk to write to.
cbWrtie How many bytes to write.
paSeg Pointer to an array of segments.
cSeg Number of segments in the array.
pvUser User data which is passed on completion.
Lists all HDD backends and their capabilities in a caller-provided buffer.

Todo:
this code contains memory leaks, inconsistent (and probably buggy) allocation, and it lacks documentation what the caller needs to free.
Returns:
VBox status code. VERR_BUFFER_OVERFLOW if not enough space is passed.
Parameters:
cEntriesAlloc Number of list entries available.
pEntries Pointer to array for the entries.
pcEntriesUsed Number of entries returned.
Initializes HDD backends.

Returns:
VBox status code.
Destroys loaded HDD backends.

Returns:
VBox status code.
Lists all HDD backends and their capabilities in a caller-provided buffer.

Todo:
this code contains memory leaks, inconsistent (and probably buggy) allocation, and it lacks documentation what the caller needs to free.
Returns:
VBox status code. VERR_BUFFER_OVERFLOW if not enough space is passed.
Parameters:
cEntriesAlloc Number of list entries available.
pEntries Pointer to array for the entries.
pcEntriesUsed Number of entries returned.

Definition at line 703 of file VBoxHDD-new.cpp.

References LogRel, NIL_RTLDRMOD, NULL, RT_ELEMENTS, RT_SUCCESS, vdAddBackends(), vdLoadDynamicBackends(), VERR_INTERNAL_ERROR, and VINF_SUCCESS.

{
    PVBOXHDDBACKEND *pBackends = g_apBackends;
    unsigned cBackends = g_cBackends;

    if (!pBackends)
        return VERR_INTERNAL_ERROR;

    g_cBackends = 0;
    g_apBackends = NULL;

    for (unsigned i = 0; i < cBackends; i++)
        if (pBackends[i]->hPlugin != NIL_RTLDRMOD)
            RTLdrClose(pBackends[i]->hPlugin);

    RTMemFree(pBackends);
    return VINF_SUCCESS;
}


Generated by  Doxygen 1.6.0   Back to index