Changeset 27808 in vbox for trunk/src/VBox/Devices/Storage/RawHDDCore.cpp
- Timestamp:
- Mar 29, 2010 8:52:56 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 59468
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/RawHDDCore.cpp
r27232 r27808 43 43 { 44 44 /** Base image name. */ 45 const char *pszFilename;45 const char *pszFilename; 46 46 #ifndef VBOX_WITH_NEW_IO_CODE 47 47 /** File descriptor. */ 48 RTFILE File;48 RTFILE File; 49 49 #else 50 /** Opaque storage handle. */ 51 void *pvStorage; 50 /** Storage handle. */ 51 PVDIOSTORAGE pStorage; 52 /** I/O interface. */ 53 PVDINTERFACE pInterfaceIO; 54 /** Async I/O interface callbacks. */ 55 PVDINTERFACEIO pInterfaceIOCallbacks; 52 56 #endif 53 57 … … 59 63 /** Opaque data for error callback. */ 60 64 PVDINTERFACEERROR pInterfaceErrorCallbacks; 61 #ifdef VBOX_WITH_NEW_IO_CODE62 /** Async I/O interface. */63 PVDINTERFACE pInterfaceAsyncIO;64 /** Async I/O interface callbacks. */65 PVDINTERFACEASYNCIO pInterfaceAsyncIOCallbacks;66 #endif67 65 68 66 /** Open flags passed by VBoxHD layer. */ 69 unsigned uOpenFlags;67 unsigned uOpenFlags; 70 68 /** Image flags defined during creation or determined during open. */ 71 unsigned uImageFlags;69 unsigned uImageFlags; 72 70 /** Total size of the image. */ 73 uint64_t cbSize;71 uint64_t cbSize; 74 72 /** Physical geometry of this image. */ 75 PDMMEDIAGEOMETRY PCHSGeometry;73 PDMMEDIAGEOMETRY PCHSGeometry; 76 74 /** Logical geometry of this image. */ 77 PDMMEDIAGEOMETRY LCHSGeometry;75 PDMMEDIAGEOMETRY LCHSGeometry; 78 76 79 77 } RAWIMAGE, *PRAWIMAGE; … … 132 130 rc = RTFileOpen(&pImage->File, pImage->pszFilename, fOpen); 133 131 #else 134 135 132 unsigned uOpenFlags = fReadonly ? VD_INTERFACEASYNCIO_OPEN_FLAGS_READONLY : 0; 136 133 … … 138 135 uOpenFlags |= VD_INTERFACEASYNCIO_OPEN_FLAGS_CREATE; 139 136 140 rc = pImage->pInterfaceAsyncIOCallbacks->pfnOpen(pImage->pInterfaceAsyncIO->pvUser, 141 pImage->pszFilename, 142 uOpenFlags, 143 NULL, 144 pImage->pVDIfsDisk, 145 &pImage->pvStorage); 137 rc = pImage->pInterfaceIOCallbacks->pfnOpen(pImage->pInterfaceIO->pvUser, 138 pImage->pszFilename, 139 uOpenFlags, 140 &pImage->pStorage); 146 141 #endif 147 142 … … 159 154 pImage->File = NIL_RTFILE; 160 155 #else 161 if (pImage->p vStorage)162 rc = pImage->pInterface AsyncIOCallbacks->pfnClose(pImage->pInterfaceAsyncIO->pvUser,163 pImage->pvStorage);164 165 pImage->p vStorage = NULL;156 if (pImage->pStorage) 157 rc = pImage->pInterfaceIOCallbacks->pfnClose(pImage->pInterfaceIO->pvUser, 158 pImage->pStorage); 159 160 pImage->pStorage = NULL; 166 161 #endif 167 162 … … 176 171 rc = RTFileFlush(pImage->File); 177 172 #else 178 if (pImage->pvStorage) 179 rc = pImage->pInterfaceAsyncIOCallbacks->pfnFlushSync(pImage->pInterfaceAsyncIO->pvUser, 180 pImage->pvStorage); 173 rc = pImage->pInterfaceIOCallbacks->pfnFlushSync(pImage->pInterfaceIO->pvUser, 174 pImage->pStorage); 181 175 #endif 182 176 … … 191 185 rc = RTFileGetSize(pImage->File, pcbSize); 192 186 #else 193 if (pImage->pvStorage) 194 rc = pImage->pInterfaceAsyncIOCallbacks->pfnGetSize(pImage->pInterfaceAsyncIO->pvUser, 195 pImage->pvStorage, 196 pcbSize); 187 rc = pImage->pInterfaceIOCallbacks->pfnGetSize(pImage->pInterfaceIO->pvUser, 188 pImage->pStorage, 189 pcbSize); 197 190 #endif 198 191 … … 208 201 rc = RTFileSetSize(pImage->File, cbSize); 209 202 #else 210 if (pImage->pvStorage) 211 rc = pImage->pInterfaceAsyncIOCallbacks->pfnSetSize(pImage->pInterfaceAsyncIO->pvUser, 212 pImage->pvStorage, 213 cbSize); 203 rc = pImage->pInterfaceIOCallbacks->pfnSetSize(pImage->pInterfaceIO->pvUser, 204 pImage->pStorage, 205 cbSize); 214 206 #endif 215 207 … … 225 217 rc = RTFileWriteAt(pImage->File, off, pcvBuf, cbWrite, pcbWritten); 226 218 #else 227 if (pImage->pvStorage) 228 rc = pImage->pInterfaceAsyncIOCallbacks->pfnWriteSync(pImage->pInterfaceAsyncIO->pvUser, 229 pImage->pvStorage, 230 off, cbWrite, pcvBuf, 231 pcbWritten); 219 rc = pImage->pInterfaceIOCallbacks->pfnWriteSync(pImage->pInterfaceIO->pvUser, 220 pImage->pStorage, 221 off, cbWrite, pcvBuf, 222 pcbWritten); 232 223 #endif 233 224 … … 242 233 rc = RTFileReadAt(pImage->File, off, pvBuf, cbRead, pcbRead); 243 234 #else 244 if (pImage->pvStorage) 245 rc = pImage->pInterfaceAsyncIOCallbacks->pfnReadSync(pImage->pInterfaceAsyncIO->pvUser, 246 pImage->pvStorage, 247 off, cbRead, pvBuf, 248 pcbRead); 235 rc = pImage->pInterfaceIOCallbacks->pfnReadSync(pImage->pInterfaceIO->pvUser, 236 pImage->pStorage, 237 off, cbRead, pvBuf, 238 pcbRead); 249 239 #endif 250 240 … … 257 247 return pImage->File != NIL_RTFILE; 258 248 #else 259 return pImage->p vStorage != NULL;249 return pImage->pStorage != NULL; 260 250 #endif 261 251 } … … 278 268 279 269 #ifdef VBOX_WITH_NEW_IO_CODE 280 /* Try to get asyncI/O interface. */281 pImage->pInterface AsyncIO = VDInterfaceGet(pImage->pVDIfsDisk, VDINTERFACETYPE_ASYNCIO);282 AssertPtr(pImage->pInterface AsyncIO);283 pImage->pInterface AsyncIOCallbacks = VDGetInterfaceAsyncIO(pImage->pInterfaceAsyncIO);284 AssertPtr(pImage->pInterface AsyncIOCallbacks);270 /* Try to get I/O interface. */ 271 pImage->pInterfaceIO = VDInterfaceGet(pImage->pVDIfsDisk, VDINTERFACETYPE_IO); 272 AssertPtr(pImage->pInterfaceIO); 273 pImage->pInterfaceIOCallbacks = VDGetInterfaceIO(pImage->pInterfaceIO); 274 AssertPtr(pImage->pInterfaceIOCallbacks); 285 275 #endif 286 276 … … 345 335 #ifdef VBOX_WITH_NEW_IO_CODE 346 336 /* Try to get async I/O interface. */ 347 pImage->pInterface AsyncIO = VDInterfaceGet(pImage->pVDIfsDisk, VDINTERFACETYPE_ASYNCIO);348 AssertPtr(pImage->pInterface AsyncIO);349 pImage->pInterface AsyncIOCallbacks = VDGetInterfaceAsyncIO(pImage->pInterfaceAsyncIO);350 AssertPtr(pImage->pInterface AsyncIOCallbacks);337 pImage->pInterfaceIO = VDInterfaceGet(pImage->pVDIfsDisk, VDINTERFACETYPE_IO); 338 AssertPtr(pImage->pInterfaceIO); 339 pImage->pInterfaceIOCallbacks = VDGetInterfaceIO(pImage->pInterfaceIO); 340 AssertPtr(pImage->pInterfaceIOCallbacks); 351 341 #endif 352 342 … … 518 508 pImage->File = NIL_RTFILE; 519 509 #else 520 pImage->p vStorage = NULL;510 pImage->pStorage = NULL; 521 511 #endif 522 512 pImage->pVDIfsDisk = pVDIfsDisk; … … 587 577 pImage->File = NIL_RTFILE; 588 578 #else 589 pImage->p vStorage = NULL;579 pImage->pStorage = NULL; 590 580 #endif 591 581 pImage->pVDIfsDisk = pVDIfsDisk; … … 1214 1204 1215 1205 static int rawAsyncRead(void *pvBackendData, uint64_t uOffset, size_t cbRead, 1216 P PDMDATASEG paSeg, unsigned cSeg, void *pvUser)1206 PVDIOCTX pIoCtx, size_t *pcbActuallyRead) 1217 1207 { 1218 1208 int rc = VERR_NOT_IMPLEMENTED; … … 1222 1212 1223 1213 static int rawAsyncWrite(void *pvBackendData, uint64_t uOffset, size_t cbWrite, 1224 PPDMDATASEG paSeg, unsigned cSeg, void *pvUser) 1214 PVDIOCTX pIoCtx, 1215 size_t *pcbWriteProcess, size_t *pcbPreRead, 1216 size_t *pcbPostRead, unsigned fWrite) 1217 { 1218 int rc = VERR_NOT_IMPLEMENTED; 1219 LogFlowFunc(("returns %Rrc\n", rc)); 1220 return rc; 1221 } 1222 1223 static int rawAsyncFlush(void *pvBackendData, PVDIOCTX pIoCtx) 1225 1224 { 1226 1225 int rc = VERR_NOT_IMPLEMENTED; … … 1317 1316 /* pfnAsyncWrite */ 1318 1317 rawAsyncWrite, 1318 /* pfnAsyncFlush */ 1319 rawAsyncFlush, 1319 1320 /* pfnComposeLocation */ 1320 1321 genericFileComposeLocation,
Note:
See TracChangeset
for help on using the changeset viewer.