VirtualBox

Changeset 33745 in vbox for trunk/src/VBox/Devices/Storage


Ignore:
Timestamp:
Nov 3, 2010 6:31:53 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
67377
Message:

VCI: Updates

File:
1 edited

Legend:

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

    r33567 r33745  
    188188    /** Bandwidth group the disk is assigned to. */
    189189    char               *pszBwGroup;
     190
     191    /** I/O interface for a cache image. */
     192    VDINTERFACE         VDIIOCache;
     193    /** Interface list for the cache image. */
     194    PVDINTERFACE        pVDIfsCache;
    190195} VBOXDISK, *PVBOXDISK;
    191196
     
    19311936    PVBOXDISK pThis = PDMINS_2_DATA(pDrvIns, PVBOXDISK);
    19321937    int rc = VINF_SUCCESS;
    1933     char *pszName = NULL;   /**< The path of the disk image file. */
    1934     char *pszFormat = NULL; /**< The format backed to use for this image. */
    1935     bool fReadOnly;         /**< True if the media is read-only. */
    1936     bool fMaybeReadOnly;    /**< True if the media may or may not be read-only. */
    1937     bool fHonorZeroWrites;  /**< True if zero blocks should be written. */
     1938    char *pszName = NULL;        /**< The path of the disk image file. */
     1939    char *pszFormat = NULL;      /**< The format backed to use for this image. */
     1940    char *pszCachePath = NULL;   /**< The path to the cache image. */
     1941    char *pszCacheFormat = NULL; /**< The format backend to use for the cache image. */
     1942    bool fReadOnly;              /**< True if the media is read-only. */
     1943    bool fMaybeReadOnly;         /**< True if the media may or may not be read-only. */
     1944    bool fHonorZeroWrites;       /**< True if zero blocks should be written. */
    19381945    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
    19391946
     
    20182025                                          "ReadOnly\0MaybeReadOnly\0TempReadOnly\0Shareable\0HonorZeroWrites\0"
    20192026                                          "HostIPStack\0UseNewIo\0BootAcceleration\0BootAccelerationBuffer\0"
    2020                                           "SetupMerge\0MergeSource\0MergeTarget\0BwGroup\0Type\0");
     2027                                          "SetupMerge\0MergeSource\0MergeTarget\0BwGroup\0Type\0"
     2028                                          "CachePath\0CacheFormat\0");
    20212029        }
    20222030        else
     
    21552163            }
    21562164            MMR3HeapFree(psz); psz = NULL;
     2165
     2166            rc = CFGMR3QueryStringAlloc(pCurNode, "CachePath", &pszCachePath);
     2167            if (RT_FAILURE(rc) && rc != VERR_CFGM_VALUE_NOT_FOUND)
     2168            {
     2169                rc = PDMDRV_SET_ERROR(pDrvIns, rc,
     2170                                      N_("DrvVD: Configuration error: Querying \"CachePath\" as string failed"));
     2171                break;
     2172            }
     2173            else
     2174                rc = VINF_SUCCESS;
     2175
     2176            if (pszCachePath)
     2177            {
     2178                rc = CFGMR3QueryStringAlloc(pCurNode, "CacheFormat", &pszCacheFormat);
     2179                if (RT_FAILURE(rc))
     2180                {
     2181                    rc = PDMDRV_SET_ERROR(pDrvIns, rc,
     2182                                          N_("DrvVD: Configuration error: Querying \"CacheFormat\" as string failed"));
     2183                    break;
     2184                }
     2185            }
    21572186        }
    21582187
     
    24562485        pCurNode = CFGMR3GetParent(pCurNode);
    24572486    }
     2487
     2488    /* Open the cache image if set. */
     2489    if (   RT_SUCCESS(rc)
     2490        && VALID_PTR(pszCachePath))
     2491    {
     2492        /* Insert the custom I/O interface only if we're told to use new IO.
     2493         * Since the I/O interface is per image we could make this more
     2494         * flexible in the future if we want to. */
     2495        if (fUseNewIo)
     2496        {
     2497            rc = VDInterfaceAdd(&pThis->VDIIOCache, "DrvVD_IO", VDINTERFACETYPE_IO,
     2498                                &pThis->VDIIOCallbacks, pThis,
     2499                                &pThis->pVDIfsCache);
     2500            AssertRC(rc);
     2501        }
     2502
     2503        rc = VDCacheOpen(pThis->pDisk, pszCacheFormat, pszCachePath, VD_OPEN_FLAGS_NORMAL, pThis->pVDIfsCache);
     2504        if (RT_FAILURE(rc))
     2505            rc = PDMDRV_SET_ERROR(pDrvIns, rc, N_("DrvVD: Could not open cache image"));
     2506    }
     2507
     2508    if (VALID_PTR(pszCachePath))
     2509        MMR3HeapFree(pszCachePath);
     2510    if (VALID_PTR(pszCacheFormat))
     2511        MMR3HeapFree(pszCacheFormat);
    24582512
    24592513    if (   RT_SUCCESS(rc)
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