VirtualBox

Changeset 11435 in vbox for trunk


Ignore:
Timestamp:
Aug 14, 2008 6:23:31 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
34787
Message:

Storage: big cleanup of the VD interfaces, especially hide the linked list better.

Location:
trunk
Files:
11 edited

Legend:

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

    r11421 r11435  
    280280 *
    281281 * @return  Pointer to the matching interface or NULL if none was found.
    282  * @param   pInterfaces     Pointer to the first interface in the list.
     282 * @param   pVDIfs          Pointer to the VD interface list.
    283283 * @param   enmInterface    Interface to search for.
    284284 */
    285 DECLINLINE(PVDINTERFACE) VDGetInterfaceFromList(PVDINTERFACE pInterfaces, VDINTERFACETYPE enmInterface)
     285DECLINLINE(PVDINTERFACE) VDInterfaceGet(PVDINTERFACE pVDIfs, VDINTERFACETYPE enmInterface)
    286286{
    287287    AssertMsgReturn(   (enmInterface >= VDINTERFACETYPE_FIRST)
     
    289289                    ("enmInterface=%u", enmInterface), NULL);
    290290
    291     while (pInterfaces)
     291    while (pVDIfs)
    292292    {
    293293        /* Sanity checks. */
    294         AssertMsgBreak(pInterfaces->cbSize == sizeof(VDINTERFACE),
    295                        ("cbSize=%u\n", pInterfaces->cbSize));
     294        AssertMsgBreak(pVDIfs->cbSize == sizeof(VDINTERFACE),
     295                       ("cbSize=%u\n", pVDIfs->cbSize));
    296296                       
    297         if (pInterfaces->enmInterface == enmInterface)
    298             return pInterfaces;
    299         pInterfaces = pInterfaces->pNext;
     297        if (pVDIfs->enmInterface == enmInterface)
     298            return pVDIfs;
     299        pVDIfs = pVDIfs->pNext;
    300300    }
    301301
     
    305305
    306306/**
    307  * Initialize a common interface structure.
     307 * Add an interface to a list of interfaces.
    308308 *
    309309 * @return VBox status code.
     
    313313 * @param  pCallbacks   The callback table of the interface.
    314314 * @param  pvUser       Opaque user data passed on every function call.
    315  * @param  pNext        Pointer to the next supported interface if any.
    316  */
    317 DECLINLINE(int) VDInterfaceCreate(PVDINTERFACE pInterface, const char *pszName,
    318                                   VDINTERFACETYPE enmInterface, void *pCallbacks,
    319                                   void *pvUser, PVDINTERFACE pNext)
     315 * @param  ppVDIfs      Pointer to the VD interface list.
     316 */
     317DECLINLINE(int) VDInterfaceAdd(PVDINTERFACE pInterface, const char *pszName,
     318                               VDINTERFACETYPE enmInterface, void *pCallbacks,
     319                               void *pvUser, PVDINTERFACE *ppVDIfs)
    320320{
    321321
     
    329329                    VERR_INVALID_PARAMETER);
    330330
     331    AssertMsgReturn(VALID_PTR(ppVDIfs),
     332                    ("pInterfaceList=%#p", ppVDIfs),
     333                    VERR_INVALID_PARAMETER);
     334
     335    /* Fill out interface descriptor. */
    331336    pInterface->cbSize           = sizeof(VDINTERFACE);
    332337    pInterface->pszInterfaceName = pszName;
     
    334339    pInterface->pCallbacks       = pCallbacks;
    335340    pInterface->pvUser           = pvUser;
    336     pInterface->pNext            = pNext;
     341    pInterface->pNext            = *ppVDIfs;
     342
     343    /* Remember the new start of the list. */
     344    *ppVDIfs = pInterface;
     345
    337346    return VINF_SUCCESS;
    338347}
     
    893902 *
    894903 * @return  VBox status code.
    895  * @param   pInterfaces     Pointer to the first supported interface.
     904 * @param   pVDIfs          Pointer to the VD interface list.
    896905 * @param   ppDisk          Where to store the reference to HDD container.
    897906 */
    898 VBOXDDU_DECL(int) VDCreate(PVDINTERFACE pInterfaces, PVBOXHDD *ppDisk);
     907VBOXDDU_DECL(int) VDCreate(PVDINTERFACE pVDIfs, PVBOXHDD *ppDisk);
    899908
    900909/**
  • trunk/src/VBox/Devices/Storage/DrvVD.cpp

    r11287 r11435  
    8989    /** Flag whether suspend has changed image open mode to read only. */
    9090    bool               fTempReadOnly;
     91    /** Pointer to list of VD interfaces. */
     92    PVDINTERFACE       pVDIfs;
    9193    /** Common structure for the supported error interface. */
    9294    VDINTERFACE        VDIError;
     
    535537
    536538    /* Initialize supported VD interfaces. */
     539    pThis->pVDIfs = NULL;
     540
    537541    pThis->VDIErrorCallbacks.cbSize       = sizeof(VDINTERFACEERROR);
    538542    pThis->VDIErrorCallbacks.enmInterface = VDINTERFACETYPE_ERROR;
    539543    pThis->VDIErrorCallbacks.pfnError     = drvvdErrorCallback;
    540544
    541     rc = VDInterfaceCreate(&pThis->VDIError, "DrvVD_VDIError", VDINTERFACETYPE_ERROR,
    542                            &pThis->VDIErrorCallbacks, pDrvIns, NULL);
     545    rc = VDInterfaceAdd(&pThis->VDIError, "DrvVD_VDIError", VDINTERFACETYPE_ERROR,
     546                        &pThis->VDIErrorCallbacks, pDrvIns, &pThis->pVDIfs);
    543547    AssertRC(rc);
    544548
     
    554558    pThis->VDIAsyncIOCallbacks.pfnTasksSubmit          = drvvdAsyncIOTasksSubmit;
    555559
    556     rc = VDInterfaceCreate(&pThis->VDIAsyncIO, "DrvVD_AsyncIO", VDINTERFACETYPE_ASYNCIO,
    557                            &pThis->VDIAsyncIOCallbacks, pThis, &pThis->VDIError);
     560    rc = VDInterfaceAdd(&pThis->VDIAsyncIO, "DrvVD_AsyncIO", VDINTERFACETYPE_ASYNCIO,
     561                        &pThis->VDIAsyncIOCallbacks, pThis, &pThis->pVDIfs);
    558562    AssertRC(rc);
    559563
     
    573577     * At the moment this is harmless, as iSCSI can only be used as a base
    574578     * image, and no other backend uses the private data for these callbacks. */
    575     rc = VDInterfaceCreate(&pThis->VDIConfig, "DrvVD_Config", VDINTERFACETYPE_CONFIG,
    576                            &pThis->VDIConfigCallbacks, NULL /**< @todo TEMP */, &pThis->VDIAsyncIO);
     579    rc = VDInterfaceAdd(&pThis->VDIConfig, "DrvVD_Config", VDINTERFACETYPE_CONFIG,
     580                        &pThis->VDIConfigCallbacks, NULL /**< @todo TEMP */, &pThis->pVDIfs);
    577581    AssertRC(rc);
    578582
  • trunk/src/VBox/Devices/Storage/RawHDDCore.cpp

    r11421 r11435  
    4747    RTFILE          File;
    4848
     49    /** Pointer to list of VD interfaces. */
     50    PVDINTERFACE      pVDIfs;
    4951    /** Error callback. */
    5052    PVDINTERFACE      pInterfaceError;
     
    116118    pImage->uOpenFlags = uOpenFlags;
    117119
     120    pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfs, VDINTERFACETYPE_ERROR);
     121    if (pImage->pInterfaceError)
     122        pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError);
     123
    118124    /*
    119125     * Open the image.
     
    176182    pImage->LCHSGeometry = *pLCHSGeometry;
    177183
     184    pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfs, VDINTERFACETYPE_ERROR);
     185    if (pImage->pInterfaceError)
     186        pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError);
     187
    178188    /* Create image file. */
    179189    rc = RTFileOpen(&File, pImage->pszFilename,
     
    320330/** @copydoc VBOXHDDBACKEND::pfnOpen */
    321331static int rawOpen(const char *pszFilename, unsigned uOpenFlags,
    322                    PVDINTERFACE pInterfaces, void **ppBackendData)
     332                   PVDINTERFACE pVDIfs, void **ppBackendData)
    323333{
    324334    LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x ppBackendData=%#p\n", pszFilename, uOpenFlags, ppBackendData));
     
    352362    pImage->pInterfaceError = NULL;
    353363    pImage->pInterfaceErrorCallbacks = NULL;
    354 
    355     pImage->pInterfaceError = VDGetInterfaceFromList(pInterfaces, VDINTERFACETYPE_ERROR);
    356     if (pImage->pInterfaceError)
    357         pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError);
     364    pImage->pVDIfs = pVDIfs;
    358365
    359366    rc = rawOpenImage(pImage, uOpenFlags);
     
    374381                     unsigned uOpenFlags, PFNVMPROGRESS pfnProgress,
    375382                     void *pvUser, unsigned uPercentStart,
    376                      unsigned uPercentSpan, PVDINTERFACE pInterfaces,
     383                     unsigned uPercentSpan, PVDINTERFACE pVDIfs,
    377384                     void **ppBackendData)
    378385{
    379     LogFlowFunc(("pszFilename=\"%s\" enmType=%d cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x pfnProgress=%#p pvUser=%#p uPercentStart=%u uPercentSpan=%u pInterfaces=%#p ppBackendData=%#p", pszFilename, enmType, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, pfnProgress, pvUser, uPercentStart, uPercentSpan, pInterfaces, ppBackendData));
     386    LogFlowFunc(("pszFilename=\"%s\" enmType=%d cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x pfnProgress=%#p pvUser=%#p uPercentStart=%u uPercentSpan=%u pVDIfs=%#p ppBackendData=%#p", pszFilename, enmType, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, pfnProgress, pvUser, uPercentStart, uPercentSpan, pVDIfs, ppBackendData));
    380387    int rc;
    381388    PRAWIMAGE pImage;
     
    407414    pImage->pszFilename = pszFilename;
    408415    pImage->File = NIL_RTFILE;
    409 
    410     pImage->pInterfaceError = VDGetInterfaceFromList(pInterfaces, VDINTERFACETYPE_ERROR);
    411     if (pImage->pInterfaceError)
    412         pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError);
    413 
     416    pImage->pVDIfs = pVDIfs;
    414417
    415418    rc = rawCreateImage(pImage, enmType, cbSize, uImageFlags, pszComment,
  • trunk/src/VBox/Devices/Storage/VBoxHDD-new.cpp

    r11421 r11435  
    819819            pDisk->pInterfaceErrorCallbacks = NULL;
    820820
    821             pDisk->pInterfaceError = VDGetInterfaceFromList(pInterfaces, VDINTERFACETYPE_ERROR);
     821            pDisk->pInterfaceError = VDInterfaceGet(pInterfaces, VDINTERFACETYPE_ERROR);
    822822            if (pDisk->pInterfaceError)
    823823                pDisk->pInterfaceErrorCallbacks = VDGetInterfaceError(pDisk->pInterfaceError);
  • trunk/src/VBox/Devices/Storage/VDICore.h

    r10781 r11435  
    579579    /** Physical geometry of this image (never actually stored). */
    580580    PDMMEDIAGEOMETRY        PCHSGeometry;
     581    /** Pointer to list of VD interfaces. */
     582    PVDINTERFACE            pVDIfs;
    581583    /** Error interface. */
    582584    PVDINTERFACE            pInterfaceError;
  • trunk/src/VBox/Devices/Storage/VDIHDDCore.cpp

    r11421 r11435  
    347347    Assert(VALID_PTR(pLCHSGeometry));
    348348
     349    pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfs, VDINTERFACETYPE_ERROR);
     350    if (pImage->pInterfaceError)
     351        pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError);
     352
    349353    vdiInitPreHeader(&pImage->PreHeader);
    350354    vdiInitHeader(&pImage->Header, enmType, uImageFlags, pszComment, cbSize, VDI_IMAGE_DEFAULT_BLOCK_SIZE, 0);
     
    528532
    529533    pImage->uOpenFlags = uOpenFlags;
     534
     535    pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfs, VDINTERFACETYPE_ERROR);
     536    if (pImage->pInterfaceError)
     537        pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError);
    530538
    531539    /*
     
    751759    pImage->pInterfaceError = NULL;
    752760    pImage->pInterfaceErrorCallbacks = NULL;
     761    pImage->pVDIfs = NULL;
    753762
    754763    rc = vdiOpenImage(pImage, VD_OPEN_FLAGS_INFO | VD_OPEN_FLAGS_READONLY);
     
    762771/** @copydoc VBOXHDDBACKEND::pfnOpen */
    763772static int vdiOpen(const char *pszFilename, unsigned uOpenFlags,
    764                    PVDINTERFACE pInterfaces,
    765                    void **ppBackendData)
     773                   PVDINTERFACE pVDIfs, void **ppBackendData)
    766774{
    767775    LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x ppBackendData=%#p\n", pszFilename, uOpenFlags, ppBackendData));
     
    795803    pImage->pInterfaceError = NULL;
    796804    pImage->pInterfaceErrorCallbacks = NULL;
    797 
    798     pImage->pInterfaceError = VDGetInterfaceFromList(pInterfaces, VDINTERFACETYPE_ERROR);
    799     if (pImage->pInterfaceError)
    800         pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError);
     805    pImage->pVDIfs = pVDIfs;
    801806
    802807    rc = vdiOpenImage(pImage, uOpenFlags);
     
    817822                     unsigned uOpenFlags, PFNVMPROGRESS pfnProgress,
    818823                     void *pvUser, unsigned uPercentStart,
    819                      unsigned uPercentSpan, PVDINTERFACE pInterfaces,
     824                     unsigned uPercentSpan, PVDINTERFACE pVDIfs,
    820825                     void **ppBackendData)
    821826{
    822     LogFlowFunc(("pszFilename=\"%s\" enmType=%d cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x pfnProgress=%#p pvUser=%#p uPercentStart=%u uPercentSpan=%u pInterfaces=%#p ppBackendData=%#p", pszFilename, enmType, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, pfnProgress, pvUser, uPercentStart, uPercentSpan, pInterfaces, ppBackendData));
     827    LogFlowFunc(("pszFilename=\"%s\" enmType=%d cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x pfnProgress=%#p pvUser=%#p uPercentStart=%u uPercentSpan=%u pVDIfs=%#p ppBackendData=%#p", pszFilename, enmType, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, pfnProgress, pvUser, uPercentStart, uPercentSpan, pVDIfs, ppBackendData));
    823828    int rc;
    824829    PVDIIMAGEDESC pImage;
     
    855860    pImage->pInterfaceError = NULL;
    856861    pImage->pInterfaceErrorCallbacks = NULL;
     862    pImage->pVDIfs = pVDIfs;
    857863
    858864    rc = vdiCreateImage(pImage, enmType, cbSize, uImageFlags, pszComment,
  • trunk/src/VBox/Devices/Storage/VmdkHDDCore.cpp

    r11421 r11435  
    359359    PVMDKFILE        pFile;
    360360
     361    /** Pointer to list of VD interfaces. */
     362    PVDINTERFACE     pVDIfs;
     363
    361364    /** Error interface. */
    362365    PVDINTERFACE      pInterfaceError;
     
    23262329    pImage->uOpenFlags = uOpenFlags;
    23272330
     2331    /* Try to get error interface. */
     2332    pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfs, VDINTERFACETYPE_ERROR);
     2333    if (pImage->pInterfaceError)
     2334        pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError);
     2335
     2336    /* Try to get async I/O interface. */
     2337    pImage->pInterfaceAsyncIO = VDInterfaceGet(pImage->pVDIfs, VDINTERFACETYPE_ASYNCIO);
     2338    if (pImage->pInterfaceAsyncIO)
     2339        pImage->pInterfaceAsyncIOCallbacks = VDGetInterfaceAsyncIO(pImage->pInterfaceAsyncIO);
     2340
    23282341    /*
    23292342     * Open the image.
     
    31133126
    31143127    pImage->uImageFlags = uImageFlags;
     3128
     3129    /* Try to get error interface. */
     3130    pImage->pInterfaceError = VDInterfaceGet(pImage->pVDIfs, VDINTERFACETYPE_ERROR);
     3131    if (pImage->pInterfaceError)
     3132        pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError);
     3133
     3134    /* Try to get async I/O interface. */
     3135    pImage->pInterfaceAsyncIO = VDInterfaceGet(pImage->pVDIfs, VDINTERFACETYPE_ASYNCIO);
     3136    if (pImage->pInterfaceAsyncIO)
     3137        pImage->pInterfaceAsyncIOCallbacks = VDGetInterfaceAsyncIO(pImage->pInterfaceAsyncIO);
     3138
    31153139    rc = vmdkCreateDescriptor(pImage, pImage->pDescData, pImage->cbDescAlloc,
    31163140                              &pImage->Descriptor);
     
    36783702    pImage->pInterfaceError = NULL;
    36793703    pImage->pInterfaceErrorCallbacks = NULL;
     3704    pImage->pInterfaceAsyncIO = NULL;
     3705    pImage->pInterfaceAsyncIOCallbacks = NULL;
     3706    pImage->pVDIfs = NULL;
    36803707    /** @todo speed up this test open (VD_OPEN_FLAGS_INFO) by skipping as
    36813708     * much as possible in vmdkOpenImage. */
     
    36903717/** @copydoc VBOXHDDBACKEND::pfnOpen */
    36913718static int vmdkOpen(const char *pszFilename, unsigned uOpenFlags,
    3692                     PVDINTERFACE pInterfaces,
    3693                     void **ppBackendData)
     3719                    PVDINTERFACE pVDIfs, void **ppBackendData)
    36943720{
    36953721    LogFlowFunc(("pszFilename=\"%s\" uOpenFlags=%#x ppBackendData=%#p\n", pszFilename, uOpenFlags, ppBackendData));
     
    37283754    pImage->pInterfaceError = NULL;
    37293755    pImage->pInterfaceErrorCallbacks = NULL;
    3730 
    3731     /* Try to get error interface. */
    3732     pImage->pInterfaceError = VDGetInterfaceFromList(pInterfaces, VDINTERFACETYPE_ERROR);
    3733     if (pImage->pInterfaceError)
    3734         pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError);
    3735 
    3736     /* Try to get async I/O interface. */
    3737     pImage->pInterfaceAsyncIO = VDGetInterfaceFromList(pInterfaces, VDINTERFACETYPE_ASYNCIO);
    3738     if (pImage->pInterfaceAsyncIO)
    3739         pImage->pInterfaceAsyncIOCallbacks = VDGetInterfaceAsyncIO(pImage->pInterfaceAsyncIO);
    3740 
     3756    pImage->pInterfaceAsyncIO = NULL;
     3757    pImage->pInterfaceAsyncIOCallbacks = NULL;
     3758    pImage->pVDIfs = NULL;
    37413759
    37423760    rc = vmdkOpenImage(pImage, uOpenFlags);
     
    37573775                      unsigned uOpenFlags, PFNVMPROGRESS pfnProgress,
    37583776                      void *pvUser, unsigned uPercentStart,
    3759                       unsigned uPercentSpan, PVDINTERFACE pInterfaces,
     3777                      unsigned uPercentSpan, PVDINTERFACE pVDIfs,
    37603778                      void **ppBackendData)
    37613779{
    3762     LogFlowFunc(("pszFilename=\"%s\" enmType=%d cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x pfnProgress=%#p pvUser=%#p uPercentStart=%u uPercentSpan=%u pInterfaces=%#p ppBackendData=%#p", pszFilename, enmType, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, pfnProgress, pvUser, uPercentStart, uPercentSpan, pInterfaces, ppBackendData));
     3780    LogFlowFunc(("pszFilename=\"%s\" enmType=%d cbSize=%llu uImageFlags=%#x pszComment=\"%s\" pPCHSGeometry=%#p pLCHSGeometry=%#p Uuid=%RTuuid uOpenFlags=%#x pfnProgress=%#p pvUser=%#p uPercentStart=%u uPercentSpan=%u pVDIfs=%#p ppBackendData=%#p", pszFilename, enmType, cbSize, uImageFlags, pszComment, pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, pfnProgress, pvUser, uPercentStart, uPercentSpan, pVDIfs, ppBackendData));
    37633781    int rc;
    37643782    PVMDKIMAGE pImage;
     
    38013819    pImage->pInterfaceError = NULL;
    38023820    pImage->pInterfaceErrorCallbacks = NULL;
     3821    pImage->pInterfaceAsyncIO = NULL;
     3822    pImage->pInterfaceAsyncIOCallbacks = NULL;
     3823    pImage->pVDIfs = NULL;
    38033824    pImage->cbDescAlloc = VMDK_SECTOR2BYTE(20);
    38043825    pImage->pDescData = (char *)RTMemAllocZ(pImage->cbDescAlloc);
     
    38083829        goto out;
    38093830    }
    3810 
    3811     /* Get error interface. */
    3812     pImage->pInterfaceError = VDGetInterfaceFromList(pInterfaces, VDINTERFACETYPE_ERROR);
    3813     if (pImage->pInterfaceError)
    3814         pImage->pInterfaceErrorCallbacks = VDGetInterfaceError(pImage->pInterfaceError);
    38153831
    38163832    rc = vmdkCreateImage(pImage, enmType, cbSize, uImageFlags, pszComment,
  • trunk/src/VBox/Devices/Storage/testcase/tstVD.cpp

    r11353 r11435  
    5656    PDMMEDIAGEOMETRY PCHS = { 0, 0, 0 };
    5757    PDMMEDIAGEOMETRY LCHS = { 0, 0, 0 };
     58    PVDINTERFACE     pVDIfs = NULL;
    5859    VDINTERFACE      VDIError;
    5960    VDINTERFACEERROR VDIErrorCallbacks;
     
    7576    VDIErrorCallbacks.pfnError = tstVDError;
    7677
    77     rc = VDInterfaceCreate(&VDIError, "tstVD_Error", VDINTERFACETYPE_ERROR, &VDIErrorCallbacks,
    78                            NULL, NULL);
     78    rc = VDInterfaceAdd(&VDIError, "tstVD_Error", VDINTERFACETYPE_ERROR, &VDIErrorCallbacks,
     79                        NULL, &pVDIfs);
    7980    AssertRC(rc);
    8081
     
    431432    uint64_t u64DiskSize  = 1000 * _1M;
    432433    uint32_t u32SectorSize = 512;
     434    PVDINTERFACE     pVDIfs = NULL;
    433435    VDINTERFACE      VDIError;
    434436    VDINTERFACEERROR VDIErrorCallbacks;
     
    450452    VDIErrorCallbacks.pfnError = tstVDError;
    451453
    452     rc = VDInterfaceCreate(&VDIError, "tstVD_Error", VDINTERFACETYPE_ERROR, &VDIErrorCallbacks,
    453                            NULL, NULL);
     454    rc = VDInterfaceAdd(&VDIError, "tstVD_Error", VDINTERFACETYPE_ERROR, &VDIErrorCallbacks,
     455                        NULL, &pVDIfs);
    454456    AssertRC(rc);
    455457
     
    549551    uint64_t u64DiskSize  = 1000 * _1M;
    550552    uint32_t u32SectorSize = 512;
     553    PVDINTERFACE     pVDIfs;
    551554    VDINTERFACE      VDIError;
    552555    VDINTERFACEERROR VDIErrorCallbacks;
     
    568571    VDIErrorCallbacks.pfnError = tstVDError;
    569572
    570     rc = VDInterfaceCreate(&VDIError, "tstVD_Error", VDINTERFACETYPE_ERROR, &VDIErrorCallbacks,
    571                            NULL, NULL);
     573    rc = VDInterfaceAdd(&VDIError, "tstVD_Error", VDINTERFACETYPE_ERROR, &VDIErrorCallbacks,
     574                        NULL, &pVDIfs);
    572575    AssertRC(rc);
    573576
  • trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp

    r11353 r11435  
    749749    HOSTPARTITIONS partitions;
    750750    uint32_t uPartitions = 0;
     751    PVDINTERFACE pVDIfs = NULL;
    751752
    752753    /* let's have a closer look at the arguments */
     
    11501151    vdInterfaceErrorCallbacks.pfnError     = handleVDError;
    11511152
    1152     vrc = VDInterfaceCreate(&vdInterfaceError, "VBoxManage_IError", VDINTERFACETYPE_ERROR,
    1153                             &vdInterfaceErrorCallbacks, NULL, NULL);
     1153    vrc = VDInterfaceAdd(&vdInterfaceError, "VBoxManage_IError", VDINTERFACETYPE_ERROR,
     1154                         &vdInterfaceErrorCallbacks, NULL, &pVDIfs);
    11541155    AssertRC(vrc);
    11551156
     
    12571258    PVBOXHDD pDisk = NULL;
    12581259
     1260    PVDINTERFACE     pVDIfs = NULL;
    12591261    VDINTERFACE      vdInterfaceError;
    12601262    VDINTERFACEERROR vdInterfaceErrorCallbacks;
     
    12631265    vdInterfaceErrorCallbacks.pfnError     = handleVDError;
    12641266
    1265     int vrc = VDInterfaceCreate(&vdInterfaceError, "VBoxManage_IError", VDINTERFACETYPE_ERROR,
    1266                                 &vdInterfaceErrorCallbacks, NULL, NULL);
     1267    int vrc = VDInterfaceAdd(&vdInterfaceError, "VBoxManage_IError", VDINTERFACETYPE_ERROR,
     1268                             &vdInterfaceErrorCallbacks, NULL, &pVDIfs);
    12671269    AssertRC(vrc);
    12681270
     
    13371339    PVBOXHDD pDisk = NULL;
    13381340
     1341    PVDINTERFACE     pVDIfs = NULL;
    13391342    VDINTERFACE      vdInterfaceError;
    13401343    VDINTERFACEERROR vdInterfaceErrorCallbacks;
     
    13431346    vdInterfaceErrorCallbacks.pfnError     = handleVDError;
    13441347
    1345     int vrc = VDInterfaceCreate(&vdInterfaceError, "VBoxManage_IError", VDINTERFACETYPE_ERROR,
    1346                                 &vdInterfaceErrorCallbacks, NULL, NULL);
     1348    int vrc = VDInterfaceAdd(&vdInterfaceError, "VBoxManage_IError", VDINTERFACETYPE_ERROR,
     1349                             &vdInterfaceErrorCallbacks, NULL, &pVDIfs);
    13471350    AssertRC(vrc);
    13481351
  • trunk/src/VBox/Main/HardDiskImpl.cpp

    r10752 r11435  
    34043404
    34053405    /* Create supported error interface. */
     3406    mVDInterfaces = NULL;
    34063407    mInterfaceErrorCallbacks.cbSize       = sizeof(VDINTERFACEERROR);
    34073408    mInterfaceErrorCallbacks.enmInterface = VDINTERFACETYPE_ERROR;
    34083409    mInterfaceErrorCallbacks.pfnError     = VDError;
    3409     int vrc = VDInterfaceCreate(&mInterfaceError, "VMDK_IError", VDINTERFACETYPE_ERROR,
    3410                                 &mInterfaceErrorCallbacks, this, NULL);
     3410    int vrc = VDInterfaceAdd(&mInterfaceError, "VMDK_IError", VDINTERFACETYPE_ERROR,
     3411                             &mInterfaceErrorCallbacks, this, &mVDInterfaces);
    34113412    ComAssertRCRet (vrc, E_FAIL);
    34123413
     
    42924293
    42934294    /* Create supported error interface. */
     4295    mVDInterfaces = NULL;
    42944296    mInterfaceErrorCallbacks.cbSize       = sizeof(VDINTERFACEERROR);
    42954297    mInterfaceErrorCallbacks.enmInterface = VDINTERFACETYPE_ERROR;
    42964298    mInterfaceErrorCallbacks.pfnError     = VDError;
    4297     int vrc = VDInterfaceCreate(&mInterfaceError, "Custom_IError", VDINTERFACETYPE_ERROR,
    4298                                 &mInterfaceErrorCallbacks, this, NULL);
     4299    int vrc = VDInterfaceAdd(&mInterfaceError, "Custom_IError", VDINTERFACETYPE_ERROR,
     4300                             &mInterfaceErrorCallbacks, this, &mVDInterfaces);
    42994301    ComAssertRCRet (vrc, E_FAIL);
    43004302
     
    51385140
    51395141    /* Create supported error interface. */
     5142    mVDInterfaces = NULL;
    51405143    mInterfaceErrorCallbacks.cbSize       = sizeof(VDINTERFACEERROR);
    51415144    mInterfaceErrorCallbacks.enmInterface = VDINTERFACETYPE_ERROR;
    51425145    mInterfaceErrorCallbacks.pfnError     = VDError;
    5143     int vrc = VDInterfaceCreate(&mInterfaceError, "VHD_IError", VDINTERFACETYPE_ERROR,
    5144                                 &mInterfaceErrorCallbacks, this, NULL);
     5146    int vrc = VDInterfaceAdd(&mInterfaceError, "VHD_IError", VDINTERFACETYPE_ERROR,
     5147                             &mInterfaceErrorCallbacks, this, &mVDInterfaces);
    51455148    ComAssertRCRet (vrc, E_FAIL);
    51465149
  • trunk/src/VBox/Main/include/HardDiskImpl.h

    r10715 r11435  
    539539    PVBOXHDD mContainer;
    540540
     541    PVDINTERFACE     mVDInterfaces;
     542
    541543    VDINTERFACE      mInterfaceError;
    542544    VDINTERFACEERROR mInterfaceErrorCallbacks;
     
    654656    PVBOXHDD mContainer;
    655657
     658    PVDINTERFACE     mVDInterfaces;
     659
    656660    VDINTERFACE      mInterfaceError;
    657661    VDINTERFACEERROR mInterfaceErrorCallbacks;
     
    770774    PVBOXHDD mContainer;
    771775
     776    PVDINTERFACE     mVDInterfaces;
     777
    772778    VDINTERFACE      mInterfaceError;
    773779    VDINTERFACEERROR mInterfaceErrorCallbacks;
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