VirtualBox

Changeset 32553 in vbox for trunk/include/VBox


Ignore:
Timestamp:
Sep 16, 2010 12:07:01 PM (14 years ago)
Author:
vboxsync
Message:

VBoxHDD: More cleanup

  • The I/O interface between the generic layer and the backend is private because it includes operations for various async I/O tasks the user of VBoxHDD doesn't know about. Renamed it to make clear that it is internal and make the old async I/O interface the one which can be used for the VFS layer from the outside.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/VBoxHDD.h

    r32536 r32553  
    253253    /** Interface to pass error message to upper layers. Per-disk. */
    254254    VDINTERFACETYPE_ERROR = VDINTERFACETYPE_FIRST,
    255     /** Interface for asynchronous I/O operations. Per-disk. */
    256     VDINTERFACETYPE_ASYNCIO,
     255    /** Interface for I/O operations. Per-disk. */
     256    VDINTERFACETYPE_IO,
    257257    /** Interface for progress notification. Per-operation. */
    258258    VDINTERFACETYPE_PROGRESS,
     
    265265    /** Interface for synchronizing accesses from several threads. Per-disk. */
    266266    VDINTERFACETYPE_THREADSYNC,
    267     /** Interface for I/O between the generic VBoxHDD code and the backend. Per-image. */
    268     VDINTERFACETYPE_IO,
     267    /** Interface for I/O between the generic VBoxHDD code and the backend. Per-image (internal).
     268     * This interface is completely internal and must not be used elsewhere. */
     269    VDINTERFACETYPE_IOINT,
    269270    /** invalid interface. */
    270271    VDINTERFACETYPE_INVALID
     
    506507
    507508/**
    508  * Support interface for asynchronous I/O
    509  *
    510  * Per-disk. Optional.
    511  */
    512 typedef struct VDINTERFACEASYNCIO
     509 * Support interface for I/O
     510 *
     511 * Per-disk. Optional as input.
     512 */
     513typedef struct VDINTERFACEIO
    513514{
    514515    /**
     
    555556
    556557    /**
     558     * Delete callback.
     559     *
     560     * @return  VBox status code.
     561     * @param   pvUser          The opaque data passed on container creation.
     562     * @param   pcszFilename    Name of the file to delete.
     563     */
     564    DECLR3CALLBACKMEMBER(int, pfnDelete, (void *pvUser, const char *pcszFilename));
     565
     566    /**
     567     * Move callback.
     568     *
     569     * @return  VBox status code.
     570     * @param   pvUser          The opaque data passed on container creation.
     571     * @param   pcszSrc         The path to the source file.
     572     * @param   pcszDst         The path to the destination file.
     573     *                          This file will be created.
     574     * @param   fMove           A combination of the RTFILEMOVE_* flags.
     575     */
     576    DECLR3CALLBACKMEMBER(int, pfnMove, (void *pvUser, const char *pcszSrc, const char *pcszDst, unsigned fMove));
     577
     578    /**
     579     * Returns the free space on a disk.
     580     *
     581     * @return  VBox status code.
     582     * @param   pvUser          The opaque data passed on container creation.
     583     * @param   pcszFilename    Name of a file to identify the disk.
     584     * @param   pcbFreeSpace    Where to store the free space of the disk.
     585     */
     586    DECLR3CALLBACKMEMBER(int, pfnGetFreeSpace, (void *pvUser, const char *pcszFilename, int64_t *pcbFreeSpace));
     587
     588    /**
     589     * Returns the last modification timestamp of a file.
     590     *
     591     * @return  VBox status code.
     592     * @param   pvUser          The opaque data passed on container creation.
     593     * @param   pcszFilename    Name of a file to identify the disk.
     594     * @param   pModificationTime   Where to store the timestamp of the file.
     595     */
     596    DECLR3CALLBACKMEMBER(int, pfnGetModificationTime, (void *pvUser, const char *pcszFilename, PRTTIMESPEC pModificationTime));
     597
     598    /**
    557599     * Returns the size of the opened storage backend.
    558600     *
     
    660702                                              void *pvCompletion, void **ppTask));
    661703
    662 } VDINTERFACEASYNCIO, *PVDINTERFACEASYNCIO;
     704} VDINTERFACEIO, *PVDINTERFACEIO;
    663705
    664706/**
     
    668710 * @param  pInterface Pointer to the interface descriptor.
    669711 */
    670 DECLINLINE(PVDINTERFACEASYNCIO) VDGetInterfaceAsyncIO(PVDINTERFACE pInterface)
    671 {
    672     PVDINTERFACEASYNCIO pInterfaceAsyncIO;
     712DECLINLINE(PVDINTERFACEIO) VDGetInterfaceIO(PVDINTERFACE pInterface)
     713{
     714    PVDINTERFACEIO pInterfaceIO;
    673715
    674716    /* Check that the interface descriptor is a async I/O interface. */
    675     AssertMsgReturn(   (pInterface->enmInterface == VDINTERFACETYPE_ASYNCIO)
     717    AssertMsgReturn(   (pInterface->enmInterface == VDINTERFACETYPE_IO)
    676718                    && (pInterface->cbSize == sizeof(VDINTERFACE)),
    677719                    ("Not an async I/O interface"), NULL);
    678720
    679     pInterfaceAsyncIO = (PVDINTERFACEASYNCIO)pInterface->pCallbacks;
     721    pInterfaceIO = (PVDINTERFACEIO)pInterface->pCallbacks;
    680722
    681723    /* Do basic checks. */
    682     AssertMsgReturn(   (pInterfaceAsyncIO->cbSize == sizeof(VDINTERFACEASYNCIO))
    683                     && (pInterfaceAsyncIO->enmInterface == VDINTERFACETYPE_ASYNCIO),
    684                     ("A non async I/O callback table attached to a async I/O interface descriptor\n"), NULL);
    685 
    686     return pInterfaceAsyncIO;
     724    AssertMsgReturn(   (pInterfaceIO->cbSize == sizeof(VDINTERFACEIO))
     725                    && (pInterfaceIO->enmInterface == VDINTERFACETYPE_IO),
     726                    ("A non async I/O callback table attached to a I/O interface descriptor\n"), NULL);
     727
     728    return pInterfaceIO;
    687729}
    688730
     
    15471589
    15481590/**
    1549  * Support interface for file I/O
    1550  *
    1551  * Per-image. Optional as input, always passed to backends.
    1552  */
    1553 typedef struct VDINTERFACEIO
    1554 {
    1555     /**
    1556      * Size of the I/O interface.
     1591 * Internal I/O interface between the generic VD layer and the backends.
     1592 *
     1593 * Per-image. Always passed to backends.
     1594 */
     1595typedef struct VDINTERFACEIOINT
     1596{
     1597    /**
     1598     * Size of the internal I/O interface.
    15571599     */
    15581600    uint32_t    cbSize;
     
    18561898    DECLR3CALLBACKMEMBER(void, pfnIoCtxCompleted, (void *pvUser, PVDIOCTX pIoCtx,
    18571899                                                   int rcReq, size_t cbCompleted));
    1858 } VDINTERFACEIO, *PVDINTERFACEIO;
    1859 
    1860 /**
    1861  * Get async I/O interface from opaque callback table.
     1900} VDINTERFACEIOINT, *PVDINTERFACEIOINT;
     1901
     1902/**
     1903 * Get internal I/O interface from opaque callback table.
    18621904 *
    18631905 * @return Pointer to the callback table.
    18641906 * @param  pInterface Pointer to the interface descriptor.
    18651907 */
    1866 DECLINLINE(PVDINTERFACEIO) VDGetInterfaceIO(PVDINTERFACE pInterface)
    1867 {
    1868     PVDINTERFACEIO pInterfaceIO;
     1908DECLINLINE(PVDINTERFACEIOINT) VDGetInterfaceIOInt(PVDINTERFACE pInterface)
     1909{
     1910    PVDINTERFACEIOINT pInterfaceIO;
    18691911
    18701912    /* Check that the interface descriptor is a async I/O interface. */
    1871     AssertMsgReturn(   (pInterface->enmInterface == VDINTERFACETYPE_IO)
     1913    AssertMsgReturn(   (pInterface->enmInterface == VDINTERFACETYPE_IOINT)
    18721914                    && (pInterface->cbSize == sizeof(VDINTERFACE)),
    18731915                    ("Not an I/O interface"), NULL);
    18741916
    1875     pInterfaceIO = (PVDINTERFACEIO)pInterface->pCallbacks;
     1917    pInterfaceIO = (PVDINTERFACEIOINT)pInterface->pCallbacks;
    18761918
    18771919    /* Do basic checks. */
    1878     AssertMsgReturn(   (pInterfaceIO->cbSize == sizeof(VDINTERFACEIO))
    1879                     && (pInterfaceIO->enmInterface == VDINTERFACETYPE_IO),
     1920    AssertMsgReturn(   (pInterfaceIO->cbSize == sizeof(VDINTERFACEIOINT))
     1921                    && (pInterfaceIO->enmInterface == VDINTERFACETYPE_IOINT),
    18801922                    ("A non I/O callback table attached to a I/O interface descriptor\n"), NULL);
    18811923
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette