Changeset 37597 in vbox for trunk/src/VBox
- Timestamp:
- Jun 22, 2011 8:54:05 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 72443
- Location:
- trunk/src/VBox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Serial/DrvHostSerial.cpp
r37596 r37597 635 635 FD_SET(RTPipeToNative(pThis->hWakeupPipeR), &XcptSet); 636 636 # if 1 /* it seems like this select is blocking the write... */ 637 rc = select(RT_MAX(RT FileToPipe(pThis->hWakeupPipeR), RTFileToNative(pThis->hDeviceFileR)) + 1,637 rc = select(RT_MAX(RTPipeToNative(pThis->hWakeupPipeR), RTFileToNative(pThis->hDeviceFileR)) + 1, 638 638 &RdSet, NULL, &XcptSet, NULL); 639 639 # else 640 640 struct timeval tv = { 0, 1000 }; 641 rc = select(RT FileToPipe(pThis->hWakeupPipeR), RTFileToNative(pThis->hDeviceFileR) + 1,641 rc = select(RTPipeToNative(pThis->hWakeupPipeR), RTFileToNative(pThis->hDeviceFileR) + 1, 642 642 &RdSet, NULL, &XcptSet, &tv); 643 643 # endif … … 659 659 size_t cbRead; 660 660 if ( FD_ISSET(RTPipeToNative(pThis->hWakeupPipeR), &RdSet) 661 || FD_ISSET( pThis->hWakeupPipeR, &XcptSet))661 || FD_ISSET(RTPipeToNative(pThis->hWakeupPipeR), &XcptSet)) 662 662 { 663 663 rc = RTPipeRead(pThis->hWakeupPipeR, abBuffer, 1, &cbRead); … … 1276 1276 /* Linux & darwin needs a separate thread which monitors the status lines. */ 1277 1277 # ifndef RT_OS_LINUX 1278 ioctl( pThis->DeviceFile, TIOCMGET, &pThis->fStatusLines);1278 ioctl(RTFileToNative(pThis->hDeviceFile), TIOCMGET, &pThis->fStatusLines); 1279 1279 # endif 1280 1280 rc = PDMDrvHlpThreadCreate(pDrvIns, &pThis->pMonitorThread, pThis, drvHostSerialMonitorThread, drvHostSerialWakeupMonitorThread, 0, RTTHREADTYPE_IO, "SerMon"); -
trunk/src/VBox/Runtime/r0drv/darwin/mach_kernel-r0drv-darwin.cpp
r37578 r37597 26 26 27 27 28 #define RTMEM_WRAP_TO_EF_APIS29 28 /******************************************************************************* 30 29 * Header Files * … … 50 49 #include "internal/iprt.h" 51 50 #include <iprt/darwin/machkernel.h> 52 53 #ifdef IN_RING0 /* till RTFILE is changed in types.h */54 # include <iprt/types.h>55 typedef struct RTFILENEWINT *RTFILENEW;56 typedef RTFILENEW *PRTFILENEW;57 # undef NIL_RTFILE58 # define RTFILE RTFILENEW59 # define PRTFILE PRTFILENEW60 # define NIL_RTFILE ((RTFILENEW)-1)61 #endif62 51 63 52 #include <iprt/asm.h> … … 197 186 * Darwin kernel file handle data. 198 187 */ 199 typedef struct RTFILE NEWINT188 typedef struct RTFILEINT 200 189 { 201 190 /** Magic value (RTFILE_MAGIC). */ … … 209 198 /** The vnode returned by vnode_open. */ 210 199 vnode_t hVnode; 211 } RTFILE NEWINT;212 /** Magic number for RTFILE NEWINT::u32Magic (To Be Determined). */200 } RTFILEINT; 201 /** Magic number for RTFILEINT::u32Magic (To Be Determined). */ 213 202 #define RTFILE_MAGIC UINT32_C(0x01020304) 214 203 215 204 216 RTDECL(int) RTFileOpen(PRTFILE phFile, const char *pszFilename, uint 32_t fOpen)217 { 218 RTFILE NEWINT *pThis = (RTFILENEWINT *)RTMemAllocZ(sizeof(*pThis));205 RTDECL(int) RTFileOpen(PRTFILE phFile, const char *pszFilename, uint64_t fOpen) 206 { 207 RTFILEINT *pThis = (RTFILEINT *)RTMemAllocZ(sizeof(*pThis)); 219 208 if (!pThis) 220 209 return VERR_NO_MEMORY; … … 286 275 return VINF_SUCCESS; 287 276 288 RTFILE NEWINT *pThis = hFile;277 RTFILEINT *pThis = hFile; 289 278 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 290 279 AssertReturn(pThis->u32Magic == RTFILE_MAGIC, VERR_INVALID_HANDLE); … … 300 289 RTDECL(int) RTFileReadAt(RTFILE hFile, RTFOFF off, void *pvBuf, size_t cbToRead, size_t *pcbRead) 301 290 { 302 RTFILE NEWINT *pThis = hFile;291 RTFILEINT *pThis = hFile; 303 292 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 304 293 AssertReturn(pThis->u32Magic == RTFILE_MAGIC, VERR_INVALID_HANDLE); -
trunk/src/VBox/Runtime/r3/darwin/filelock-darwin.cpp
r28800 r37597 5 5 6 6 /* 7 * Copyright (C) 2006-20 07Oracle Corporation7 * Copyright (C) 2006-2011 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 50 50 51 51 52 RTR3DECL(int) RTFileLock(RTFILE File, unsigned fLock, int64_t offLock, uint64_t cbLock)52 RTR3DECL(int) RTFileLock(RTFILE hFile, unsigned fLock, int64_t offLock, uint64_t cbLock) 53 53 { 54 54 Assert(offLock >= 0); … … 83 83 84 84 Assert(RTFILE_LOCK_WAIT); 85 if (fcntl( File, (fLock & RTFILE_LOCK_WAIT) ? F_SETLKW : F_SETLK, &fl) >= 0)85 if (fcntl(RTFileToNative(hFile), (fLock & RTFILE_LOCK_WAIT) ? F_SETLKW : F_SETLK, &fl) >= 0) 86 86 return VINF_SUCCESS; 87 87 int iErr = errno; … … 102 102 else 103 103 f |= LOCK_SH; 104 if (!flock( File, f))104 if (!flock(RTFileToNative(hFile), f)) 105 105 return VINF_SUCCESS; 106 106 iErr = errno; … … 117 117 118 118 119 RTR3DECL(int) RTFileChangeLock(RTFILE File, unsigned fLock, int64_t offLock, uint64_t cbLock)119 RTR3DECL(int) RTFileChangeLock(RTFILE hFile, unsigned fLock, int64_t offLock, uint64_t cbLock) 120 120 { 121 121 /** @todo We never returns VERR_FILE_NOT_LOCKED for now. */ 122 return RTFileLock( File, fLock, offLock, cbLock);122 return RTFileLock(hFile, fLock, offLock, cbLock); 123 123 } 124 124 125 125 126 RTR3DECL(int) RTFileUnlock(RTFILE File, int64_t offLock, uint64_t cbLock)126 RTR3DECL(int) RTFileUnlock(RTFILE hFile, int64_t offLock, uint64_t cbLock) 127 127 { 128 128 Assert(offLock >= 0); … … 148 148 fl.l_pid = 0; 149 149 150 if (fcntl( File, F_SETLK, &fl) >= 0)150 if (fcntl(RTFileToNative(hFile), F_SETLK, &fl) >= 0) 151 151 return VINF_SUCCESS; 152 152 … … 155 155 { 156 156 /* A SMB hack, see RTFileLock. */ 157 if (!flock( File, LOCK_UN))157 if (!flock(RTFileToNative(hFile), LOCK_UN)) 158 158 return VINF_SUCCESS; 159 159 } -
trunk/src/VBox/VMM/VMMR3/PDMAsyncCompletionFile.cpp
r37596 r37597 638 638 DISK_GEOMETRY DriveGeo; 639 639 DWORD cbDriveGeo; 640 if (DeviceIoControl((HANDLE) hFile,640 if (DeviceIoControl((HANDLE)RTFileToNative(hFile), 641 641 IOCTL_DISK_GET_DRIVE_GEOMETRY, NULL, 0, 642 642 &DriveGeo, sizeof(DriveGeo), &cbDriveGeo, NULL)) … … 652 652 GET_LENGTH_INFORMATION DiskLenInfo; 653 653 DWORD junk; 654 if (DeviceIoControl((HANDLE) hFile,654 if (DeviceIoControl((HANDLE)RTFileToNative(hFile), 655 655 IOCTL_DISK_GET_LENGTH_INFO, NULL, 0, 656 656 &DiskLenInfo, sizeof(DiskLenInfo), &junk, (LPOVERLAPPED)NULL)) … … 668 668 } 669 669 else 670 {671 670 rc = RTErrConvertFromWin32(GetLastError()); 672 } 671 673 672 #elif defined(RT_OS_DARWIN) 674 673 struct stat DevStat; 675 if (!fstat( hFile, &DevStat) && S_ISBLK(DevStat.st_mode))674 if (!fstat(RTFileToNative(hFile), &DevStat) && S_ISBLK(DevStat.st_mode)) 676 675 { 677 676 uint64_t cBlocks; 678 677 uint32_t cbBlock; 679 if (!ioctl( hFile, DKIOCGETBLOCKCOUNT, &cBlocks))678 if (!ioctl(RTFileToNative(hFile), DKIOCGETBLOCKCOUNT, &cBlocks)) 680 679 { 681 if (!ioctl( hFile, DKIOCGETBLOCKSIZE, &cbBlock))680 if (!ioctl(RTFileToNative(hFile), DKIOCGETBLOCKSIZE, &cbBlock)) 682 681 cbSize = cBlocks * cbBlock; 683 682 else … … 689 688 else 690 689 rc = VERR_INVALID_PARAMETER; 690 691 691 #elif defined(RT_OS_SOLARIS) 692 692 struct stat DevStat; 693 if (!fstat(hFile, &DevStat) && ( S_ISBLK(DevStat.st_mode) 694 || S_ISCHR(DevStat.st_mode))) 693 if ( !fstat(RTFileToNative(hFile), &DevStat) 694 && ( S_ISBLK(DevStat.st_mode) 695 || S_ISCHR(DevStat.st_mode))) 695 696 { 696 697 struct dk_minfo mediainfo; 697 if (!ioctl( hFile, DKIOCGMEDIAINFO, &mediainfo))698 if (!ioctl(RTFileToNative(hFile), DKIOCGMEDIAINFO, &mediainfo)) 698 699 cbSize = mediainfo.dki_capacity * mediainfo.dki_lbsize; 699 700 else … … 702 703 else 703 704 rc = VERR_INVALID_PARAMETER; 705 704 706 #elif defined(RT_OS_FREEBSD) 705 707 struct stat DevStat; 706 if (!fstat( hFile, &DevStat) && S_ISCHR(DevStat.st_mode))708 if (!fstat(RTFileToNative(hFile), &DevStat) && S_ISCHR(DevStat.st_mode)) 707 709 { 708 710 off_t cbMedia = 0; 709 if (!ioctl( hFile, DIOCGMEDIASIZE, &cbMedia))711 if (!ioctl(RTFileToNative(hFile), DIOCGMEDIASIZE, &cbMedia)) 710 712 { 711 713 cbSize = cbMedia; … … 1012 1014 * contain dirty buffers. 1013 1015 */ 1014 RTFILE hFile = NIL_RTFILE; 1015 1016 RTFILE hFile; 1016 1017 rc = RTFileOpen(&hFile, pszUri, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE); 1017 1018 if (RT_SUCCESS(rc))
Note:
See TracChangeset
for help on using the changeset viewer.