Changeset 37596 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- Jun 22, 2011 7:30:06 PM (14 years ago)
- Location:
- trunk/src/VBox/Runtime/common
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/ldr/ldr.cpp
r28800 r37596 39 39 #include <iprt/log.h> 40 40 #include "internal/ldr.h" 41 42 43 /*******************************************************************************44 * Structures and Typedefs *45 *******************************************************************************/46 typedef struct RTLDRREADERFILE47 {48 /** The core. */49 RTLDRREADER Core;50 /** The file. */51 RTFILE File;52 /** The file size. */53 RTFOFF cbFile;54 /** The current offset. */55 RTFOFF off;56 /** The filename (variable size). */57 char szFilename[1];58 } RTLDRREADERFILE, *PRTLDRREADERFILE;59 60 41 61 42 -
trunk/src/VBox/Runtime/common/ldr/ldrFile.cpp
r28800 r37596 55 55 RTLDRREADER Core; 56 56 /** The file. */ 57 RTFILE File;57 RTFILE hFile; 58 58 /** The file size. */ 59 59 RTFOFF cbFile; … … 79 79 if (pFileReader->off != off) 80 80 { 81 int rc = RTFileSeek(pFileReader-> File, off, RTFILE_SEEK_BEGIN, NULL);81 int rc = RTFileSeek(pFileReader->hFile, off, RTFILE_SEEK_BEGIN, NULL); 82 82 if (RT_FAILURE(rc)) 83 83 { … … 91 91 * Read. 92 92 */ 93 int rc = RTFileRead(pFileReader-> File, pvBuf, cb, NULL);93 int rc = RTFileRead(pFileReader->hFile, pvBuf, cb, NULL); 94 94 if (RT_SUCCESS(rc)) 95 95 pFileReader->off += cb; … … 185 185 int rc = VINF_SUCCESS; 186 186 PRTLDRREADERFILE pFileReader = (PRTLDRREADERFILE)pReader; 187 if (pFileReader-> File != NIL_RTFILE)188 { 189 rc = RTFileClose(pFileReader-> File);187 if (pFileReader->hFile != NIL_RTFILE) 188 { 189 rc = RTFileClose(pFileReader->hFile); 190 190 AssertRC(rc); 191 pFileReader-> File = NIL_RTFILE;191 pFileReader->hFile = NIL_RTFILE; 192 192 } 193 193 RTMemFree(pFileReader); … … 211 211 { 212 212 memcpy(pFileReader->szFilename, pszFilename, cchFilename + 1); 213 rc = RTFileOpen(&pFileReader-> File, pszFilename, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE);213 rc = RTFileOpen(&pFileReader->hFile, pszFilename, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE); 214 214 if (RT_SUCCESS(rc)) 215 215 { 216 rc = RTFileGetSize(pFileReader-> File, (uint64_t *)&pFileReader->cbFile);216 rc = RTFileGetSize(pFileReader->hFile, (uint64_t *)&pFileReader->cbFile); 217 217 if (RT_SUCCESS(rc)) 218 218 { … … 230 230 return VINF_SUCCESS; 231 231 } 232 RTFileClose(pFileReader->File); 232 233 RTFileClose(pFileReader->hFile); 233 234 } 234 235 RTMemFree(pFileReader); -
trunk/src/VBox/Runtime/common/log/log.cpp
r37593 r37596 129 129 130 130 /** Handle to log file (if open). */ 131 union 132 { 133 RTFILE hFile; 134 RTHCUINTPTR uPaddingForNewRTFILE; 135 } u; 131 RTFILE hFile; 136 132 /** Log file history settings: maximum amount of data to put in a file. */ 137 133 uint64_t cbHistoryFileMax; … … 157 153 /** The size of the RTLOGGERINTERNAL structure in ring-0. */ 158 154 # define RTLOGGERINTERNAL_R0_SIZE RT_OFFSETOF(RTLOGGERINTERNAL, pfnPhase) 159 AssertCompileMemberAlignment(RTLOGGERINTERNAL, u.hFile, sizeof(void *));155 AssertCompileMemberAlignment(RTLOGGERINTERNAL, hFile, sizeof(void *)); 160 156 AssertCompileMemberAlignment(RTLOGGERINTERNAL, cbHistoryFileMax, sizeof(uint64_t)); 161 157 #endif … … 341 337 { 342 338 PRTLOGGER pLogger = (PRTLOGGER)pvArg; 343 RTFileWrite(pLogger->pInt-> u.hFile, pachChars, cbChars, NULL);339 RTFileWrite(pLogger->pInt->hFile, pachChars, cbChars, NULL); 344 340 return cbChars; 345 341 } … … 479 475 # ifdef IN_RING3 480 476 pLogger->pInt->pfnPhase = pfnPhase; 481 pLogger->pInt-> u.hFile= NIL_RTFILE;477 pLogger->pInt->hFile = NIL_RTFILE; 482 478 pLogger->pInt->cHistory = cHistory; 483 479 if (cbHistoryFileMax == 0) … … 596 592 597 593 /* If the file is not open then rotation is not set up. */ 598 if (pLogger->pInt-> u.hFile == NIL_RTFILE)594 if (pLogger->pInt->hFile == NIL_RTFILE) 599 595 { 600 596 pLogger->pInt->cbHistoryFileWritten = 0; … … 638 634 } 639 635 # ifdef IN_RING3 640 RTFileClose(pLogger->pInt-> u.hFile);636 RTFileClose(pLogger->pInt->hFile); 641 637 # endif 642 638 # if defined(LOG_USE_C99) && defined(RT_WITHOUT_EXEC_ALLOC) … … 736 732 */ 737 733 if ( (pLogger->fDestFlags & RTLOGDEST_FILE) 738 && pLogger->pInt-> u.hFile != NIL_RTFILE)734 && pLogger->pInt->hFile != NIL_RTFILE) 739 735 pLogger->pInt->pfnPhase(pLogger, RTLOGPHASE_END, rtlogPhaseMsgLocked); 740 736 … … 742 738 * Close output stuffs. 743 739 */ 744 if (pLogger->pInt-> u.hFile != NIL_RTFILE)745 { 746 int rc2 = RTFileClose(pLogger->pInt-> u.hFile);740 if (pLogger->pInt->hFile != NIL_RTFILE) 741 { 742 int rc2 = RTFileClose(pLogger->pInt->hFile); 747 743 AssertRC(rc2); 748 744 if (RT_FAILURE(rc2) && RT_SUCCESS(rc)) 749 745 rc = rc2; 750 pLogger->pInt-> u.hFile = NIL_RTFILE;746 pLogger->pInt->hFile = NIL_RTFILE; 751 747 } 752 748 # endif … … 2558 2554 fOpen |= RTFILE_O_WRITE_THROUGH; 2559 2555 2560 int rc = RTFileOpen(&pLogger->pInt-> u.hFile, pLogger->pInt->szFilename, fOpen);2556 int rc = RTFileOpen(&pLogger->pInt->hFile, pLogger->pInt->szFilename, fOpen); 2561 2557 if (RT_FAILURE(rc)) 2562 2558 { 2563 pLogger->pInt-> u.hFile = NIL_RTFILE;2559 pLogger->pInt->hFile = NIL_RTFILE; 2564 2560 if (pszErrorMsg) 2565 2561 RTStrPrintf(pszErrorMsg, cchErrorMsg, N_("could not open file '%s' (fOpen=%#x)"), pLogger->pInt->szFilename, fOpen); … … 2567 2563 else 2568 2564 { 2569 rc = RTFileGetSize(pLogger->pInt-> u.hFile, &pLogger->pInt->cbHistoryFileWritten);2565 rc = RTFileGetSize(pLogger->pInt->hFile, &pLogger->pInt->cbHistoryFileWritten); 2570 2566 if (RT_FAILURE(rc)) 2571 2567 { … … 2619 2615 * Close the old log file. 2620 2616 */ 2621 if (pLogger->pInt-> u.hFile != NIL_RTFILE)2617 if (pLogger->pInt->hFile != NIL_RTFILE) 2622 2618 { 2623 2619 /* Use the callback to generate some final log contents, but only if … … 2631 2627 pLogger->fDestFlags = fODestFlags; 2632 2628 } 2633 RTFileClose(pLogger->pInt-> u.hFile);2634 pLogger->pInt-> u.hFile = NIL_RTFILE;2629 RTFileClose(pLogger->pInt->hFile); 2630 pLogger->pInt->hFile = NIL_RTFILE; 2635 2631 } 2636 2632 … … 2717 2713 if (pLogger->fDestFlags & RTLOGDEST_FILE) 2718 2714 { 2719 if (pLogger->pInt-> u.hFile != NIL_RTFILE)2720 { 2721 RTFileWrite(pLogger->pInt-> u.hFile, pLogger->achScratch, pLogger->offScratch, NULL);2715 if (pLogger->pInt->hFile != NIL_RTFILE) 2716 { 2717 RTFileWrite(pLogger->pInt->hFile, pLogger->achScratch, pLogger->offScratch, NULL); 2722 2718 if (pLogger->fFlags & RTLOGFLAGS_FLUSH) 2723 RTFileFlush(pLogger->pInt-> u.hFile);2719 RTFileFlush(pLogger->pInt->hFile); 2724 2720 } 2725 2721 if (pLogger->pInt->cHistory) -
trunk/src/VBox/Runtime/common/misc/RTFileOpenF.cpp
r28800 r37596 33 33 34 34 35 RTR3DECL(int) RTFileOpenF(PRTFILE pFile, uint 32_t fOpen, const char *pszFilenameFmt, ...)35 RTR3DECL(int) RTFileOpenF(PRTFILE pFile, uint64_t fOpen, const char *pszFilenameFmt, ...) 36 36 { 37 37 va_list va; -
trunk/src/VBox/Runtime/common/misc/RTFileOpenV.cpp
r28800 r37596 37 37 38 38 39 RTR3DECL(int) RTFileOpenV(PRTFILE pFile, uint 32_t fOpen, const char *pszFilenameFmt, va_list va)39 RTR3DECL(int) RTFileOpenV(PRTFILE pFile, uint64_t fOpen, const char *pszFilenameFmt, va_list va) 40 40 { 41 41 char szFilename[RTPATH_MAX]; -
trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp
r35213 r37596 2298 2298 2299 2299 2300 RTDECL(int) RTVfsFileOpen(RTVFS hVfs, const char *pszFilename, uint 32_t fOpen, PRTVFSFILE phVfsFile)2300 RTDECL(int) RTVfsFileOpen(RTVFS hVfs, const char *pszFilename, uint64_t fOpen, PRTVFSFILE phVfsFile) 2301 2301 { 2302 2302 /* -
trunk/src/VBox/Runtime/common/vfs/vfschain.cpp
r34179 r37596 563 563 564 564 565 RTDECL(int) RTVfsChainOpenFile(const char *pszSpec, uint 32_t fOpen, PRTVFSFILE phVfsFile, const char **ppszError)565 RTDECL(int) RTVfsChainOpenFile(const char *pszSpec, uint64_t fOpen, PRTVFSFILE phVfsFile, const char **ppszError) 566 566 { 567 567 AssertPtrReturn(pszSpec, VERR_INVALID_POINTER); … … 610 610 611 611 612 RTDECL(int) RTVfsChainOpenIoStream(const char *pszSpec, uint 32_t fOpen, PRTVFSIOSTREAM phVfsIos, const char **ppszError)612 RTDECL(int) RTVfsChainOpenIoStream(const char *pszSpec, uint64_t fOpen, PRTVFSIOSTREAM phVfsIos, const char **ppszError) 613 613 { 614 614 AssertPtrReturn(pszSpec, VERR_INVALID_POINTER); -
trunk/src/VBox/Runtime/common/vfs/vfsmisc.cpp
r33973 r37596 39 39 40 40 41 RTDECL(int) RTVfsIoStrmFromStdHandle(RTHANDLESTD enmStdHandle, uint 32_t fOpen, bool fLeaveOpen,41 RTDECL(int) RTVfsIoStrmFromStdHandle(RTHANDLESTD enmStdHandle, uint64_t fOpen, bool fLeaveOpen, 42 42 PRTVFSIOSTREAM phVfsIos) 43 43 { -
trunk/src/VBox/Runtime/common/vfs/vfsstdfile.cpp
r36555 r37596 419 419 420 420 421 RTDECL(int) RTVfsFileFromRTFile(RTFILE hFile, uint 32_t fOpen, bool fLeaveOpen, PRTVFSFILE phVfsFile)421 RTDECL(int) RTVfsFileFromRTFile(RTFILE hFile, uint64_t fOpen, bool fLeaveOpen, PRTVFSFILE phVfsFile) 422 422 { 423 423 /* … … 451 451 452 452 453 RTDECL(int) RTVfsIoStrmFromRTFile(RTFILE hFile, uint 32_t fOpen, bool fLeaveOpen, PRTVFSIOSTREAM phVfsIos)453 RTDECL(int) RTVfsIoStrmFromRTFile(RTFILE hFile, uint64_t fOpen, bool fLeaveOpen, PRTVFSIOSTREAM phVfsIos) 454 454 { 455 455 RTVFSFILE hVfsFile;
Note:
See TracChangeset
for help on using the changeset viewer.