VirtualBox

Changeset 22982 in vbox for trunk


Ignore:
Timestamp:
Sep 13, 2009 10:17:34 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
52261
Message:

VBoxHDD: Add new parameter to VDGetFormat which takes a list of interfaces. Backends need the async I/O interface if VBOX_WITH_NEW_IO_CODE is enabled to access the file

Location:
trunk/src/VBox
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/ISCSIHDDCore.cpp

    r22584 r22982  
    27042704
    27052705/** @copydoc VBOXHDDBACKEND::pfnCheckIfValid */
    2706 static int iscsiCheckIfValid(const char *pszFilename)
     2706static int iscsiCheckIfValid(const char *pszFilename, PVDINTERFACE pVDIfsDisk)
    27072707{
    27082708    LogFlowFunc(("pszFilename=\"%s\"\n", pszFilename));
  • trunk/src/VBox/Devices/Storage/ParallelsHDDCore.cpp

    r22966 r22982  
    409409
    410410/** @copydoc VBOXHDDBACKEND::pfnCheckIfValid */
    411 static int parallelsCheckIfValid(const char *pszFilename)
     411static int parallelsCheckIfValid(const char *pszFilename, PVDINTERFACE pVDIfsDisk)
    412412{
    413413    RTFILE File;
  • trunk/src/VBox/Devices/Storage/RawHDDCore.cpp

    r22966 r22982  
    464464
    465465/** @copydoc VBOXHDDBACKEND::pfnCheckIfValid */
    466 static int rawCheckIfValid(const char *pszFilename)
     466static int rawCheckIfValid(const char *pszFilename, PVDINTERFACE pVDIfsDisk)
    467467{
    468468    LogFlowFunc(("pszFilename=\"%s\"\n", pszFilename));
  • trunk/src/VBox/Devices/Storage/VBoxHDD-Internal.h

    r19176 r22982  
    8181     * @returns VBox status code.
    8282     * @param   pszFilename     Name of the image file.
    83      */
    84     DECLR3CALLBACKMEMBER(int, pfnCheckIfValid, (const char *pszFilename));
     83     * @param   pVDIfsDisk      Pointer to the per-disk VD interface list.
     84     */
     85    DECLR3CALLBACKMEMBER(int, pfnCheckIfValid, (const char *pszFilename, PVDINTERFACE pVDIfsDisk));
    8586
    8687    /**
  • trunk/src/VBox/Devices/Storage/VBoxHDD.cpp

    r22966 r22982  
    11061106 *                       ppszFormat contains the string which can be used as backend name.
    11071107 *          VERR_NOT_SUPPORTED if no backend was found.
     1108 * @param   pVDIfsDisk      Pointer to the per-disk VD interface list.
    11081109 * @param   pszFilename     Name of the image file for which the backend is queried.
    11091110 * @param   ppszFormat      Receives pointer of the UTF-8 string which contains the format name.
    11101111 *                          The returned pointer must be freed using RTStrFree().
    11111112 */
    1112 VBOXDDU_DECL(int) VDGetFormat(const char *pszFilename, char **ppszFormat)
     1113VBOXDDU_DECL(int) VDGetFormat(PVDINTERFACE pVDIfsDisk, const char *pszFilename, char **ppszFormat)
    11131114{
    11141115    int rc = VERR_NOT_SUPPORTED;
     1116    PVDINTERFACE pVDIfAsyncIO;
     1117    VDINTERFACEASYNCIO VDIAsyncIOCallbacks;
     1118    VDINTERFACE        VDIAsyncIO;
    11151119
    11161120    LogFlowFunc(("pszFilename=\"%s\"\n", pszFilename));
     
    11261130        VDInit();
    11271131
     1132    /* Use the fallback async I/O interface if the caller doesn't provide one. */
     1133    pVDIfAsyncIO = VDInterfaceGet(pVDIfsDisk, VDINTERFACETYPE_ASYNCIO);
     1134    if (!pVDIfAsyncIO)
     1135    {
     1136        VDIAsyncIOCallbacks.cbSize        = sizeof(VDINTERFACEASYNCIO);
     1137        VDIAsyncIOCallbacks.enmInterface  = VDINTERFACETYPE_ASYNCIO;
     1138        VDIAsyncIOCallbacks.pfnOpen       = vdAsyncIOOpen;
     1139        VDIAsyncIOCallbacks.pfnClose      = vdAsyncIOClose;
     1140        VDIAsyncIOCallbacks.pfnGetSize    = vdAsyncIOGetSize;
     1141        VDIAsyncIOCallbacks.pfnSetSize    = vdAsyncIOSetSize;
     1142        VDIAsyncIOCallbacks.pfnReadSync   = vdAsyncIOReadSync;
     1143        VDIAsyncIOCallbacks.pfnWriteSync  = vdAsyncIOWriteSync;
     1144        VDIAsyncIOCallbacks.pfnFlushSync  = vdAsyncIOFlushSync;
     1145        VDIAsyncIOCallbacks.pfnReadAsync  = vdAsyncIOReadAsync;
     1146        VDIAsyncIOCallbacks.pfnWriteAsync = vdAsyncIOWriteAsync;
     1147        VDIAsyncIOCallbacks.pfnFlushAsync = vdAsyncIOFlushAsync;
     1148        rc = VDInterfaceAdd(&VDIAsyncIO, "VD_AsyncIO", VDINTERFACETYPE_ASYNCIO,
     1149                            &VDIAsyncIOCallbacks, NULL, &pVDIfsDisk);
     1150        AssertRC(rc);
     1151    }
     1152
    11281153    /* Find the backend supporting this file format. */
    11291154    for (unsigned i = 0; i < g_cBackends; i++)
     
    11311156        if (g_apBackends[i]->pfnCheckIfValid)
    11321157        {
    1133             rc = g_apBackends[i]->pfnCheckIfValid(pszFilename);
     1158            rc = g_apBackends[i]->pfnCheckIfValid(pszFilename, pVDIfsDisk);
    11341159            if (    RT_SUCCESS(rc)
    11351160                /* The correct backend has been found, but there is a small
  • trunk/src/VBox/Devices/Storage/VDIHDDCore.cpp

    r22978 r22982  
    914914
    915915/** @copydoc VBOXHDDBACKEND::pfnCheckIfValid */
    916 static int vdiCheckIfValid(const char *pszFilename)
     916static int vdiCheckIfValid(const char *pszFilename, PVDINTERFACE pVDIfsDisk)
    917917{
    918918    LogFlowFunc(("pszFilename=\"%s\"\n", pszFilename));
     
    940940#endif
    941941    pImage->paBlocks = NULL;
    942     pImage->pVDIfsDisk = NULL;
     942    pImage->pVDIfsDisk = pVDIfsDisk;
    943943
    944944    rc = vdiOpenImage(pImage, VD_OPEN_FLAGS_INFO | VD_OPEN_FLAGS_READONLY);
  • trunk/src/VBox/Devices/Storage/VHDHDDCore.cpp

    r22966 r22982  
    767767}
    768768
    769 static int vhdCheckIfValid(const char *pszFilename)
     769static int vhdCheckIfValid(const char *pszFilename, PVDINTERFACE pVDIfsDisk)
    770770{
    771771    int rc = VINF_SUCCESS;
  • trunk/src/VBox/Devices/Storage/VmdkHDDCore.cpp

    r22966 r22982  
    43904390
    43914391/** @copydoc VBOXHDDBACKEND::pfnCheckIfValid */
    4392 static int vmdkCheckIfValid(const char *pszFilename)
     4392static int vmdkCheckIfValid(const char *pszFilename, PVDINTERFACE pVDIfsDisk)
    43934393{
    43944394    LogFlowFunc(("pszFilename=\"%s\"\n", pszFilename));
     
    44164416    pImage->pGTCache = NULL;
    44174417    pImage->pDescData = NULL;
    4418     pImage->pVDIfsDisk = NULL;
     4418    pImage->pVDIfsDisk = pVDIfsDisk;
    44194419    /** @todo speed up this test open (VD_OPEN_FLAGS_INFO) by skipping as
    44204420     * much as possible in vmdkOpenImage. */
  • trunk/src/VBox/Devices/Storage/testcase/tstVD.cpp

    r17970 r22982  
    539539    {
    540540        RTFileClose(File);
    541         rc = VDGetFormat(pszBaseFilename, &pszFormat);
     541        rc = VDGetFormat(NULL, pszBaseFilename, &pszFormat);
    542542        RTPrintf("VDGetFormat() pszFormat=%s rc=%Rrc\n", pszFormat, rc);
    543543        if (RT_SUCCESS(rc) && strcmp(pszFormat, pszBackend))
  • trunk/src/VBox/Devices/Storage/testcase/tstVDCopy.cpp

    r20417 r22982  
    101101    AssertRC(rc);
    102102
    103     rc = VDGetFormat(argv[1], &pszVD1);
     103    rc = VDGetFormat(NULL, argv[1], &pszVD1);
    104104    CHECK("VDGetFormat() hdd1");
    105105
    106     rc = VDGetFormat(argv[2], &pszVD2);
     106    rc = VDGetFormat(NULL, argv[2], &pszVD2);
    107107    CHECK("VDGetFormat() hdd2");
    108108
  • trunk/src/VBox/Frontends/VBoxManage/VBoxInternalManage.cpp

    r22173 r22982  
    510510    /* just try it */
    511511    char *pszFormat = NULL;
    512     int rc = VDGetFormat(argv[0], &pszFormat);
     512    int rc = VDGetFormat(NULL, argv[0], &pszFormat);
    513513    if (RT_FAILURE(rc))
    514514    {
     
    578578    /* just try it */
    579579    char *pszFormat = NULL;
    580     int rc = VDGetFormat(argv[0], &pszFormat);
     580    int rc = VDGetFormat(NULL, argv[0], &pszFormat);
    581581    if (RT_FAILURE(rc))
    582582    {
     
    15191519    {
    15201520        char *pszFormat = NULL;
    1521         vrc = VDGetFormat(Utf8Str(src).raw(), &pszFormat);
     1521        vrc = VDGetFormat(NULL, Utf8Str(src).raw(), &pszFormat);
    15221522        if (RT_FAILURE(vrc))
    15231523        {
     
    16661666        {
    16671667            char *pszFormat = NULL;
    1668             vrc = VDGetFormat(Utf8Str(src).raw(), &pszFormat);
     1668            vrc = VDGetFormat(NULL, Utf8Str(src).raw(), &pszFormat);
    16691669            if (RT_FAILURE(vrc))
    16701670            {
  • trunk/src/VBox/Main/HardDiskImpl.cpp

    r22779 r22982  
    30083008            if (RT_SUCCESS(vrc))
    30093009            {
    3010                 vrc = VDGetFormat(locationFull.c_str(), &backendName);
     3010                vrc = VDGetFormat(NULL, locationFull.c_str(), &backendName);
    30113011            }
    30123012            else if (vrc != VERR_FILE_NOT_FOUND && vrc != VERR_PATH_NOT_FOUND)
     
    30143014                /* assume it's not a file, restore the original location */
    30153015                location = locationFull = aLocation;
    3016                 vrc = VDGetFormat(locationFull.c_str(), &backendName);
     3016                vrc = VDGetFormat(NULL, locationFull.c_str(), &backendName);
    30173017            }
    30183018
Note: See TracChangeset for help on using the changeset viewer.

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