Changeset 64252 in vbox
- Timestamp:
- Oct 13, 2016 2:20:01 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 111262
- Location:
- trunk/src/VBox/Devices/Storage
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DrvHostBase-darwin.cpp
r64251 r64252 208 208 } 209 209 210 211 DECLHIDDEN(int) drvHostBasePollerWakeupOs(PDRVHOSTBASE pThis) 212 { 213 return RTSemEventSignal(pThis->EventPoller); 214 } 215 216 217 DECLHIDDEN(void) drvHostBaseDestructOs(PDRVHOSTBASE pThis) 218 { 219 if (pThis->EventPoller != NULL) 220 { 221 RTSemEventDestroy(pThis->EventPoller); 222 pThis->EventPoller = NULL; 223 } 224 225 /* 226 * The unclaiming doesn't seem to mean much, the DVD is actually 227 * remounted when we release exclusive access. I'm not quite sure 228 * if I should put the unclaim first or not... 229 * 230 * Anyway, that it's automatically remounted very good news for us, 231 * because that means we don't have to mess with that ourselves. Of 232 * course there is the unlikely scenario that we've succeeded in claiming 233 * and umount the DVD but somehow failed to gain exclusive scsi access... 234 */ 235 if (pThis->ppScsiTaskDI) 236 { 237 LogFlow(("%s-%d: releasing exclusive scsi access!\n", pDrvIns->pReg->szName, pDrvIns->iInstance)); 238 (*pThis->ppScsiTaskDI)->ReleaseExclusiveAccess(pThis->ppScsiTaskDI); 239 (*pThis->ppScsiTaskDI)->Release(pThis->ppScsiTaskDI); 240 pThis->ppScsiTaskDI = NULL; 241 } 242 if (pThis->pDADisk) 243 { 244 LogFlow(("%s-%d: unclaiming the disk!\n", pDrvIns->pReg->szName, pDrvIns->iInstance)); 245 DADiskUnclaim(pThis->pDADisk); 246 CFRelease(pThis->pDADisk); 247 pThis->pDADisk = NULL; 248 } 249 if (pThis->ppMMCDI) 250 { 251 LogFlow(("%s-%d: releasing the MMC object!\n", pDrvIns->pReg->szName, pDrvIns->iInstance)); 252 (*pThis->ppMMCDI)->Release(pThis->ppMMCDI); 253 pThis->ppMMCDI = NULL; 254 } 255 if (pThis->MasterPort != IO_OBJECT_NULL) 256 { 257 mach_port_deallocate(mach_task_self(), pThis->MasterPort); 258 pThis->MasterPort = IO_OBJECT_NULL; 259 } 260 if (pThis->pDASession) 261 { 262 LogFlow(("%s-%d: releasing the DA session!\n", pDrvIns->pReg->szName, pDrvIns->iInstance)); 263 CFRelease(pThis->pDASession); 264 pThis->pDASession = NULL; 265 } 266 } 267 -
trunk/src/VBox/Devices/Storage/DrvHostBase-freebsd.cpp
r64251 r64252 208 208 } 209 209 210 211 DECLHIDDEN(int) drvHostBasePollerWakeupOs(PDRVHOSTBASE pThis) 212 { 213 return RTSemEventSignal(pThis->EventPoller); 214 } 215 216 217 DECLHIDDEN(void) drvHostBaseDestructOs(PDRVHOSTBASE pThis) 218 { 219 if (pThis->EventPoller != NULL) 220 { 221 RTSemEventDestroy(pThis->EventPoller); 222 pThis->EventPoller = NULL; 223 } 224 225 if (pThis->hFileDevice != NIL_RTFILE) 226 { 227 int rc = RTFileClose(pThis->hFileDevice); 228 AssertRC(rc); 229 pThis->hFileDevice = NIL_RTFILE; 230 } 231 } 232 -
trunk/src/VBox/Devices/Storage/DrvHostBase-linux.cpp
r64251 r64252 181 181 } 182 182 183 184 DECLHIDDEN(int) drvHostBasePollerWakeupOs(PDRVHOSTBASE pThis) 185 { 186 return RTSemEventSignal(pThis->EventPoller); 187 } 188 189 190 DECLHIDDEN(void) drvHostBaseDestructOs(PDRVHOSTBASE pThis) 191 { 192 if (pThis->pbDoubleBuffer) 193 { 194 RTMemFree(pThis->pbDoubleBuffer); 195 pThis->pbDoubleBuffer = NULL; 196 } 197 198 if (pThis->EventPoller != NULL) 199 { 200 RTSemEventDestroy(pThis->EventPoller); 201 pThis->EventPoller = NULL; 202 } 203 204 if (pThis->hFileDevice != NIL_RTFILE) 205 { 206 int rc = RTFileClose(pThis->hFileDevice); 207 AssertRC(rc); 208 pThis->hFileDevice = NIL_RTFILE; 209 } 210 } 211 -
trunk/src/VBox/Devices/Storage/DrvHostBase-solaris.cpp
r64251 r64252 201 201 } 202 202 203 204 DECLHIDDEN(int) drvHostBasePollerWakeupOs(PDRVHOSTBASE pThis) 205 { 206 return RTSemEventSignal(pThis->EventPoller); 207 } 208 209 210 DECLHIDDEN(void) drvHostBaseDestructOs(PDRVHOSTBASE pThis) 211 { 212 if (pThis->EventPoller != NULL) 213 { 214 RTSemEventDestroy(pThis->EventPoller); 215 pThis->EventPoller = NULL; 216 } 217 218 if (pThis->hFileDevice != NIL_RTFILE) 219 { 220 int rc = RTFileClose(pThis->hFileDevice); 221 AssertRC(rc); 222 pThis->hFileDevice = NIL_RTFILE; 223 } 224 225 if (pThis->hFileRawDevice != NIL_RTFILE) 226 { 227 int rc = RTFileClose(pThis->hFileRawDevice); 228 AssertRC(rc); 229 pThis->hFileRawDevice = NIL_RTFILE; 230 } 231 232 if (pThis->pszRawDeviceOpen) 233 { 234 RTStrFree(pThis->pszRawDeviceOpen); 235 pThis->pszRawDeviceOpen = NULL; 236 } 237 } 238 -
trunk/src/VBox/Devices/Storage/DrvHostBase-win.cpp
r64251 r64252 239 239 } 240 240 241 242 DECLHIDDEN(int) drvHostBasePollerWakeupOs(PDRVHOSTBASE pThis) 243 { 244 if (pThis->hwndDeviceChange) 245 PostMessage(pThis->hwndDeviceChange, WM_CLOSE, 0, 0); /* default win proc will destroy the window */ 246 247 return VINF_SUCCESS; 248 } 249 250 251 DECLHIDDEN(void) drvHostBaseDestructOs(PDRVHOSTBASE pThis) 252 { 253 if (pThis->EventPoller != NULL) 254 { 255 RTSemEventDestroy(pThis->EventPoller); 256 pThis->EventPoller = NULL; 257 } 258 259 if (pThis->hwndDeviceChange) 260 { 261 if (SetWindowLongPtr(pThis->hwndDeviceChange, GWLP_USERDATA, 0) == (LONG_PTR)pThis) 262 PostMessage(pThis->hwndDeviceChange, WM_CLOSE, 0, 0); /* default win proc will destroy the window */ 263 pThis->hwndDeviceChange = NULL; 264 } 265 266 if (pThis->hFileDevice != NIL_RTFILE) 267 { 268 int rc = RTFileClose(pThis->hFileDevice); 269 AssertRC(rc); 270 pThis->hFileDevice = NIL_RTFILE; 271 } 272 } 273 -
trunk/src/VBox/Devices/Storage/DrvHostBase.cpp
r64251 r64252 1369 1369 do 1370 1370 { 1371 #ifdef RT_OS_WINDOWS 1372 if (pThis->hwndDeviceChange) 1373 PostMessage(pThis->hwndDeviceChange, WM_CLOSE, 0, 0); /* default win proc will destroy the window */ 1374 #else 1375 RTSemEventSignal(pThis->EventPoller); 1376 #endif 1371 drvHostBasePollerWakeupOs(pThis); 1377 1372 rc = RTThreadWait(pThis->ThreadPoller, 100, NULL); 1378 1373 } while (cTimes-- > 0 && rc == VERR_TIMEOUT); … … 1404 1399 * Cleanup the other resources. 1405 1400 */ 1406 #ifdef RT_OS_WINDOWS 1407 if (pThis->hwndDeviceChange) 1408 { 1409 if (SetWindowLongPtr(pThis->hwndDeviceChange, GWLP_USERDATA, 0) == (LONG_PTR)pThis) 1410 PostMessage(pThis->hwndDeviceChange, WM_CLOSE, 0, 0); /* default win proc will destroy the window */ 1411 pThis->hwndDeviceChange = NULL; 1412 } 1413 #else 1414 if (pThis->EventPoller != NULL) 1415 { 1416 RTSemEventDestroy(pThis->EventPoller); 1417 pThis->EventPoller = NULL; 1418 } 1419 #endif 1420 1421 #ifdef RT_OS_DARWIN 1422 /* 1423 * The unclaiming doesn't seem to mean much, the DVD is actually 1424 * remounted when we release exclusive access. I'm not quite sure 1425 * if I should put the unclaim first or not... 1426 * 1427 * Anyway, that it's automatically remounted very good news for us, 1428 * because that means we don't have to mess with that ourselves. Of 1429 * course there is the unlikely scenario that we've succeeded in claiming 1430 * and umount the DVD but somehow failed to gain exclusive scsi access... 1431 */ 1432 if (pThis->ppScsiTaskDI) 1433 { 1434 LogFlow(("%s-%d: releasing exclusive scsi access!\n", pDrvIns->pReg->szName, pDrvIns->iInstance)); 1435 (*pThis->ppScsiTaskDI)->ReleaseExclusiveAccess(pThis->ppScsiTaskDI); 1436 (*pThis->ppScsiTaskDI)->Release(pThis->ppScsiTaskDI); 1437 pThis->ppScsiTaskDI = NULL; 1438 } 1439 if (pThis->pDADisk) 1440 { 1441 LogFlow(("%s-%d: unclaiming the disk!\n", pDrvIns->pReg->szName, pDrvIns->iInstance)); 1442 DADiskUnclaim(pThis->pDADisk); 1443 CFRelease(pThis->pDADisk); 1444 pThis->pDADisk = NULL; 1445 } 1446 if (pThis->ppMMCDI) 1447 { 1448 LogFlow(("%s-%d: releasing the MMC object!\n", pDrvIns->pReg->szName, pDrvIns->iInstance)); 1449 (*pThis->ppMMCDI)->Release(pThis->ppMMCDI); 1450 pThis->ppMMCDI = NULL; 1451 } 1452 if (pThis->MasterPort != IO_OBJECT_NULL) 1453 { 1454 mach_port_deallocate(mach_task_self(), pThis->MasterPort); 1455 pThis->MasterPort = IO_OBJECT_NULL; 1456 } 1457 if (pThis->pDASession) 1458 { 1459 LogFlow(("%s-%d: releasing the DA session!\n", pDrvIns->pReg->szName, pDrvIns->iInstance)); 1460 CFRelease(pThis->pDASession); 1461 pThis->pDASession = NULL; 1462 } 1463 #else 1464 if (pThis->hFileDevice != NIL_RTFILE) 1465 { 1466 int rc = RTFileClose(pThis->hFileDevice); 1467 AssertRC(rc); 1468 pThis->hFileDevice = NIL_RTFILE; 1469 } 1470 #endif 1471 1472 #ifdef RT_OS_SOLARIS 1473 if (pThis->hFileRawDevice != NIL_RTFILE) 1474 { 1475 int rc = RTFileClose(pThis->hFileRawDevice); 1476 AssertRC(rc); 1477 pThis->hFileRawDevice = NIL_RTFILE; 1478 } 1479 1480 if (pThis->pszRawDeviceOpen) 1481 { 1482 RTStrFree(pThis->pszRawDeviceOpen); 1483 pThis->pszRawDeviceOpen = NULL; 1484 } 1485 #endif 1401 drvHostBaseDestructOs(pThis); 1486 1402 1487 1403 if (pThis->pszDevice) -
trunk/src/VBox/Devices/Storage/DrvHostBase.h
r64251 r64252 23 23 #include <iprt/critsect.h> 24 24 #include <iprt/log.h> 25 #include <iprt/semaphore.h> 25 26 #include <VBox/cdefs.h> 26 27 #include <VBox/vmm/pdmdrv.h> … … 197 198 DECLHIDDEN(int) drvHostBaseFlushOs(PDRVHOSTBASE pThis); 198 199 200 DECLHIDDEN(int) drvHostBasePollerWakeupOs(PDRVHOSTBASE pThis); 201 DECLHIDDEN(void) drvHostBaseDestructOs(PDRVHOSTBASE pThis); 202 199 203 /** Makes a PDRVHOSTBASE out of a PPDMIMOUNT. */ 200 204 #define PDMIMOUNT_2_DRVHOSTBASE(pInterface) ( (PDRVHOSTBASE)((uintptr_t)pInterface - RT_OFFSETOF(DRVHOSTBASE, IMount)) ) -
trunk/src/VBox/Devices/Storage/DrvHostDVD.cpp
r64247 r64252 442 442 static DECLCALLBACK(void) drvHostDvdDestruct(PPDMDRVINS pDrvIns) 443 443 { 444 #ifdef RT_OS_LINUX445 PDRVHOSTBASE pThis = PDMINS_2_DATA(pDrvIns, PDRVHOSTBASE);446 447 if (pThis->pbDoubleBuffer)448 {449 RTMemFree(pThis->pbDoubleBuffer);450 pThis->pbDoubleBuffer = NULL;451 }452 #endif453 444 return DRVHostBaseDestruct(pDrvIns); 454 445 }
Note:
See TracChangeset
for help on using the changeset viewer.