Changeset 33745 in vbox for trunk/src/VBox/Devices/Storage
- Timestamp:
- Nov 3, 2010 6:31:53 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 67377
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DrvVD.cpp
r33567 r33745 188 188 /** Bandwidth group the disk is assigned to. */ 189 189 char *pszBwGroup; 190 191 /** I/O interface for a cache image. */ 192 VDINTERFACE VDIIOCache; 193 /** Interface list for the cache image. */ 194 PVDINTERFACE pVDIfsCache; 190 195 } VBOXDISK, *PVBOXDISK; 191 196 … … 1931 1936 PVBOXDISK pThis = PDMINS_2_DATA(pDrvIns, PVBOXDISK); 1932 1937 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. */ 1938 1945 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns); 1939 1946 … … 2018 2025 "ReadOnly\0MaybeReadOnly\0TempReadOnly\0Shareable\0HonorZeroWrites\0" 2019 2026 "HostIPStack\0UseNewIo\0BootAcceleration\0BootAccelerationBuffer\0" 2020 "SetupMerge\0MergeSource\0MergeTarget\0BwGroup\0Type\0"); 2027 "SetupMerge\0MergeSource\0MergeTarget\0BwGroup\0Type\0" 2028 "CachePath\0CacheFormat\0"); 2021 2029 } 2022 2030 else … … 2155 2163 } 2156 2164 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 } 2157 2186 } 2158 2187 … … 2456 2485 pCurNode = CFGMR3GetParent(pCurNode); 2457 2486 } 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); 2458 2512 2459 2513 if ( RT_SUCCESS(rc)
Note:
See TracChangeset
for help on using the changeset viewer.