Changeset 3666 in vbox for trunk/src/VBox/Devices/Storage/DrvHostBase.cpp
- Timestamp:
- Jul 17, 2007 6:33:02 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/DrvHostBase.cpp
r3538 r3666 26 26 *******************************************************************************/ 27 27 #define LOG_GROUP LOG_GROUP_DRV_HOST_BASE 28 #ifdef __DARWIN__28 #ifdef RT_OS_DARWIN 29 29 # include <mach/mach.h> 30 30 # include <Carbon/Carbon.h> … … 41 41 /* Nothing special requires... yeah, right. */ 42 42 43 #elif defined( __LINUX__)43 #elif defined(RT_OS_LINUX) 44 44 # include <sys/ioctl.h> 45 45 # include <sys/fcntl.h> 46 46 # include <errno.h> 47 47 48 #elif defined( __WIN__)48 #elif defined(RT_OS_WINDOWS) 49 49 # define WIN32_NO_STATUS 50 50 # include <Windows.h> … … 134 134 */ 135 135 int rc; 136 #ifdef __DARWIN__136 #ifdef RT_OS_DARWIN 137 137 if ( pThis->fMediaPresent 138 138 && pThis->ppScsiTaskDI … … 142 142 #endif 143 143 { 144 #ifdef __DARWIN__144 #ifdef RT_OS_DARWIN 145 145 /* 146 146 * Issue a READ(12) request. … … 211 211 if (pThis->fMediaPresent) 212 212 { 213 #ifdef __DARWIN__213 #ifdef RT_OS_DARWIN 214 214 /** @todo write support... */ 215 215 rc = VERR_WRITE_PROTECT; … … 256 256 if (pThis->fMediaPresent) 257 257 { 258 #ifdef __DARWIN__258 #ifdef RT_OS_DARWIN 259 259 rc = VINF_SUCCESS; 260 260 /** @todo scsi device buffer flush... */ … … 561 561 /* -=-=-=-=- poller thread -=-=-=-=- */ 562 562 563 #ifdef __DARWIN__563 #ifdef RT_OS_DARWIN 564 564 /** The runloop input source name for the disk arbitration events. */ 565 565 #define MY_RUN_LOOP_MODE CFSTR("drvHostBaseDA") … … 734 734 } 735 735 } 736 #endif /* __DARWIN__*/736 #endif /* RT_OS_DARWIN */ 737 737 738 738 … … 745 745 static int drvHostBaseOpen(PDRVHOSTBASE pThis, PRTFILE pFileDevice, bool fReadOnly) 746 746 { 747 #ifdef __DARWIN__747 #ifdef RT_OS_DARWIN 748 748 /* Darwin is kind of special... */ 749 749 Assert(!pFileDevice); NOREF(pFileDevice); … … 923 923 return rc; 924 924 925 #elif defined( __LINUX__)925 #elif defined(RT_OS_LINUX) 926 926 /** @todo we've got RTFILE_O_NON_BLOCK now. Change the code to use RTFileOpen. */ 927 927 int FileDevice = open(pThis->pszDeviceOpen, (pThis->fReadOnlyConfig ? O_RDONLY : O_RDWR) | O_NONBLOCK); … … 950 950 static int drvHostBaseReopen(PDRVHOSTBASE pThis) 951 951 { 952 #ifndef __DARWIN__/* Only *one* open for darwin. */952 #ifndef RT_OS_DARWIN /* Only *one* open for darwin. */ 953 953 LogFlow(("%s-%d: drvHostBaseReopen: '%s'\n", pThis->pDrvIns->pDrvReg->szDriverName, pThis->pDrvIns->iInstance, pThis->pszDeviceOpen)); 954 954 … … 976 976 RTFileClose(pThis->FileDevice); 977 977 pThis->FileDevice = FileDevice; 978 #endif /* ! __DARWIN__*/978 #endif /* !RT_OS_DARWIN */ 979 979 return VINF_SUCCESS; 980 980 } … … 990 990 static int drvHostBaseGetMediaSize(PDRVHOSTBASE pThis, uint64_t *pcb) 991 991 { 992 #ifdef __DARWIN__992 #ifdef RT_OS_DARWIN 993 993 /* 994 994 * Try a READ_CAPACITY command... … … 1019 1019 return rc; 1020 1020 1021 #elif defined( __WIN__)1021 #elif defined(RT_OS_WINDOWS) 1022 1022 /* use NT api, retry a few times if the media is being verified. */ 1023 1023 IO_STATUS_BLOCK IoStatusBlock = {0}; … … 1054 1054 1055 1055 1056 #ifdef __DARWIN__1056 #ifdef RT_OS_DARWIN 1057 1057 /** 1058 1058 * Execute a SCSI command. … … 1090 1090 *pcbBuf = 0; 1091 1091 1092 # ifdef __DARWIN__1092 # ifdef RT_OS_DARWIN 1093 1093 Assert(pThis->ppScsiTaskDI); 1094 1094 … … 1227 1227 1228 1228 1229 #ifdef __WIN__1229 #ifdef RT_OS_WINDOWS 1230 1230 1231 1231 /** … … 1284 1284 } 1285 1285 1286 #endif /* __WIN__*/1286 #endif /* RT_OS_WINDOWS */ 1287 1287 1288 1288 … … 1299 1299 LogFlow(("%s-%d: drvHostBaseMediaThread: ThreadSelf=%p pvUser=%p\n", 1300 1300 pThis->pDrvIns->pDrvReg->szDriverName, pThis->pDrvIns->iInstance, ThreadSelf, pvUser)); 1301 #ifdef __WIN__1301 #ifdef RT_OS_WINDOWS 1302 1302 static WNDCLASS s_classDeviceChange = {0}; 1303 1303 static ATOM s_hAtomDeviceChange = 0; … … 1352 1352 Assert(!pThis->hwndDeviceChange); 1353 1353 1354 #else /* ! __WIN__*/1354 #else /* !RT_OS_WINDOWS */ 1355 1355 bool fFirst = true; 1356 1356 int cRetries = 10; … … 1396 1396 } 1397 1397 1398 #endif /* ! __WIN__*/1398 #endif /* !RT_OS_WINDOWS */ 1399 1399 1400 1400 /* (Don't clear the thread handle here, the destructor thread is using it to wait.) */ … … 1450 1450 do 1451 1451 { 1452 #ifdef __WIN__1452 #ifdef RT_OS_WINDOWS 1453 1453 if (pThis->hwndDeviceChange) 1454 1454 PostMessage(pThis->hwndDeviceChange, WM_CLOSE, 0, 0); /* default win proc will destroy the window */ … … 1466 1466 * Unlock the drive if we've locked it or we're in passthru mode. 1467 1467 */ 1468 #ifdef __DARWIN__1468 #ifdef RT_OS_DARWIN 1469 1469 if ( ( pThis->fLocked 1470 1470 || pThis->IBlock.pfnSendCmd) … … 1485 1485 * Cleanup the other resources. 1486 1486 */ 1487 #ifdef __WIN__1487 #ifdef RT_OS_WINDOWS 1488 1488 if (pThis->hwndDeviceChange) 1489 1489 { … … 1500 1500 #endif 1501 1501 1502 #ifdef __DARWIN__1502 #ifdef RT_OS_DARWIN 1503 1503 /* 1504 1504 * The unclaiming doesn't seem to mean much, the DVD is actaully … … 1598 1598 pThis->fKeepInstance = false; 1599 1599 pThis->ThreadPoller = NIL_RTTHREAD; 1600 #ifdef __DARWIN__1600 #ifdef RT_OS_DARWIN 1601 1601 pThis->MasterPort = NULL; 1602 1602 pThis->ppMMCDI = NULL; … … 1736 1736 1737 1737 /* name to open & watch for */ 1738 #ifdef __WIN__1738 #ifdef RT_OS_WINDOWS 1739 1739 int iBit = toupper(pThis->pszDevice[0]) - 'A'; 1740 1740 if ( iBit > 'Z' - 'A' … … 1798 1798 * Verify type. 1799 1799 */ 1800 #ifdef __WIN__1800 #ifdef RT_OS_WINDOWS 1801 1801 UINT uDriveType = GetDriveType(pThis->pszDevice); 1802 1802 switch (pThis->enmType) … … 1833 1833 * Open the device. 1834 1834 */ 1835 #ifdef __DARWIN__1835 #ifdef RT_OS_DARWIN 1836 1836 rc = drvHostBaseOpen(pThis, NULL, pThis->fReadOnlyConfig); 1837 1837 #else … … 1841 1841 { 1842 1842 char *pszDevice = pThis->pszDevice; 1843 #ifndef __DARWIN__1843 #ifndef RT_OS_DARWIN 1844 1844 char szPathReal[256]; 1845 1845 if ( RTPathExists(pszDevice) … … 1859 1859 case VERR_ACCESS_DENIED: 1860 1860 return PDMDrvHlpVMSetError(pDrvIns, rc, RT_SRC_POS, 1861 #ifdef __LINUX__1861 #ifdef RT_OS_LINUX 1862 1862 N_("Cannot open host device '%s' for %s access. Check the permissions " 1863 1863 "of that device ('/bin/ls -l %s'): Most probably you need to be member " … … 1882 1882 } 1883 1883 } 1884 #ifdef __WIN__1884 #ifdef RT_OS_WINDOWS 1885 1885 if (VBOX_SUCCESS(src)) 1886 1886 DRVHostBaseMediaPresent(pThis); … … 1901 1901 } 1902 1902 1903 #ifndef __WIN__1903 #ifndef RT_OS_WINDOWS 1904 1904 if (VBOX_SUCCESS(src)) 1905 1905 { … … 1938 1938 rc = RTThreadUserWait(pThis->ThreadPoller, 10000); 1939 1939 AssertRC(rc); 1940 #ifdef __WIN__1940 #ifdef RT_OS_WINDOWS 1941 1941 if (!pThis->hwndDeviceChange) 1942 1942 return VERR_GENERAL_FAILURE;
Note:
See TracChangeset
for help on using the changeset viewer.