VirtualBox

Changeset 37596 in vbox for trunk/src/VBox/Runtime/common


Ignore:
Timestamp:
Jun 22, 2011 7:30:06 PM (14 years ago)
Author:
vboxsync
Message:

*: RTFILE becomes a pointer, RTFileOpen++ expands it's flags paramter from uint32_t to uint64_t.

Location:
trunk/src/VBox/Runtime/common
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/ldr/ldr.cpp

    r28800 r37596  
    3939#include <iprt/log.h>
    4040#include "internal/ldr.h"
    41 
    42 
    43 /*******************************************************************************
    44 *   Structures and Typedefs                                                    *
    45 *******************************************************************************/
    46 typedef struct RTLDRREADERFILE
    47 {
    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 
    6041
    6142
  • trunk/src/VBox/Runtime/common/ldr/ldrFile.cpp

    r28800 r37596  
    5555    RTLDRREADER     Core;
    5656    /** The file. */
    57     RTFILE          File;
     57    RTFILE          hFile;
    5858    /** The file size. */
    5959    RTFOFF          cbFile;
     
    7979    if (pFileReader->off != off)
    8080    {
    81         int rc = RTFileSeek(pFileReader->File, off, RTFILE_SEEK_BEGIN, NULL);
     81        int rc = RTFileSeek(pFileReader->hFile, off, RTFILE_SEEK_BEGIN, NULL);
    8282        if (RT_FAILURE(rc))
    8383        {
     
    9191     * Read.
    9292     */
    93     int rc = RTFileRead(pFileReader->File, pvBuf, cb, NULL);
     93    int rc = RTFileRead(pFileReader->hFile, pvBuf, cb, NULL);
    9494    if (RT_SUCCESS(rc))
    9595        pFileReader->off += cb;
     
    185185    int rc = VINF_SUCCESS;
    186186    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);
    190190        AssertRC(rc);
    191         pFileReader->File = NIL_RTFILE;
     191        pFileReader->hFile = NIL_RTFILE;
    192192    }
    193193    RTMemFree(pFileReader);
     
    211211    {
    212212        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);
    214214        if (RT_SUCCESS(rc))
    215215        {
    216             rc = RTFileGetSize(pFileReader->File, (uint64_t *)&pFileReader->cbFile);
     216            rc = RTFileGetSize(pFileReader->hFile, (uint64_t *)&pFileReader->cbFile);
    217217            if (RT_SUCCESS(rc))
    218218            {
     
    230230                return VINF_SUCCESS;
    231231            }
    232             RTFileClose(pFileReader->File);
     232
     233            RTFileClose(pFileReader->hFile);
    233234        }
    234235        RTMemFree(pFileReader);
  • trunk/src/VBox/Runtime/common/log/log.cpp

    r37593 r37596  
    129129
    130130    /** Handle to log file (if open). */
    131     union
    132     {
    133         RTFILE              hFile;
    134         RTHCUINTPTR         uPaddingForNewRTFILE;
    135     } u;
     131    RTFILE                  hFile;
    136132    /** Log file history settings: maximum amount of data to put in a file. */
    137133    uint64_t                cbHistoryFileMax;
     
    157153/** The size of the RTLOGGERINTERNAL structure in ring-0.  */
    158154# define RTLOGGERINTERNAL_R0_SIZE       RT_OFFSETOF(RTLOGGERINTERNAL, pfnPhase)
    159 AssertCompileMemberAlignment(RTLOGGERINTERNAL, u.hFile, sizeof(void *));
     155AssertCompileMemberAlignment(RTLOGGERINTERNAL, hFile, sizeof(void *));
    160156AssertCompileMemberAlignment(RTLOGGERINTERNAL, cbHistoryFileMax, sizeof(uint64_t));
    161157#endif
     
    341337{
    342338    PRTLOGGER pLogger = (PRTLOGGER)pvArg;
    343     RTFileWrite(pLogger->pInt->u.hFile, pachChars, cbChars, NULL);
     339    RTFileWrite(pLogger->pInt->hFile, pachChars, cbChars, NULL);
    344340    return cbChars;
    345341}
     
    479475# ifdef IN_RING3
    480476        pLogger->pInt->pfnPhase                 = pfnPhase;
    481         pLogger->pInt->u.hFile                  = NIL_RTFILE;
     477        pLogger->pInt->hFile                    = NIL_RTFILE;
    482478        pLogger->pInt->cHistory                 = cHistory;
    483479        if (cbHistoryFileMax == 0)
     
    596592
    597593                    /* 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)
    599595                    {
    600596                        pLogger->pInt->cbHistoryFileWritten = 0;
     
    638634            }
    639635# ifdef IN_RING3
    640             RTFileClose(pLogger->pInt->u.hFile);
     636            RTFileClose(pLogger->pInt->hFile);
    641637# endif
    642638# if defined(LOG_USE_C99) && defined(RT_WITHOUT_EXEC_ALLOC)
     
    736732     */
    737733    if (   (pLogger->fDestFlags & RTLOGDEST_FILE)
    738         && pLogger->pInt->u.hFile != NIL_RTFILE)
     734        && pLogger->pInt->hFile != NIL_RTFILE)
    739735        pLogger->pInt->pfnPhase(pLogger, RTLOGPHASE_END, rtlogPhaseMsgLocked);
    740736
     
    742738     * Close output stuffs.
    743739     */
    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);
    747743        AssertRC(rc2);
    748744        if (RT_FAILURE(rc2) && RT_SUCCESS(rc))
    749745            rc = rc2;
    750         pLogger->pInt->u.hFile = NIL_RTFILE;
     746        pLogger->pInt->hFile = NIL_RTFILE;
    751747    }
    752748# endif
     
    25582554        fOpen |= RTFILE_O_WRITE_THROUGH;
    25592555
    2560     int rc = RTFileOpen(&pLogger->pInt->u.hFile, pLogger->pInt->szFilename, fOpen);
     2556    int rc = RTFileOpen(&pLogger->pInt->hFile, pLogger->pInt->szFilename, fOpen);
    25612557    if (RT_FAILURE(rc))
    25622558    {
    2563         pLogger->pInt->u.hFile = NIL_RTFILE;
     2559        pLogger->pInt->hFile = NIL_RTFILE;
    25642560        if (pszErrorMsg)
    25652561            RTStrPrintf(pszErrorMsg, cchErrorMsg, N_("could not open file '%s' (fOpen=%#x)"), pLogger->pInt->szFilename, fOpen);
     
    25672563    else
    25682564    {
    2569         rc = RTFileGetSize(pLogger->pInt->u.hFile, &pLogger->pInt->cbHistoryFileWritten);
     2565        rc = RTFileGetSize(pLogger->pInt->hFile, &pLogger->pInt->cbHistoryFileWritten);
    25702566        if (RT_FAILURE(rc))
    25712567        {
     
    26192615     * Close the old log file.
    26202616     */
    2621     if (pLogger->pInt->u.hFile != NIL_RTFILE)
     2617    if (pLogger->pInt->hFile != NIL_RTFILE)
    26222618    {
    26232619        /* Use the callback to generate some final log contents, but only if
     
    26312627            pLogger->fDestFlags = fODestFlags;
    26322628        }
    2633         RTFileClose(pLogger->pInt->u.hFile);
    2634         pLogger->pInt->u.hFile = NIL_RTFILE;
     2629        RTFileClose(pLogger->pInt->hFile);
     2630        pLogger->pInt->hFile = NIL_RTFILE;
    26352631    }
    26362632
     
    27172713    if (pLogger->fDestFlags & RTLOGDEST_FILE)
    27182714    {
    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);
    27222718            if (pLogger->fFlags & RTLOGFLAGS_FLUSH)
    2723                 RTFileFlush(pLogger->pInt->u.hFile);
     2719                RTFileFlush(pLogger->pInt->hFile);
    27242720        }
    27252721        if (pLogger->pInt->cHistory)
  • trunk/src/VBox/Runtime/common/misc/RTFileOpenF.cpp

    r28800 r37596  
    3333
    3434
    35 RTR3DECL(int) RTFileOpenF(PRTFILE pFile, uint32_t fOpen, const char *pszFilenameFmt, ...)
     35RTR3DECL(int) RTFileOpenF(PRTFILE pFile, uint64_t fOpen, const char *pszFilenameFmt, ...)
    3636{
    3737    va_list va;
  • trunk/src/VBox/Runtime/common/misc/RTFileOpenV.cpp

    r28800 r37596  
    3737
    3838
    39 RTR3DECL(int) RTFileOpenV(PRTFILE pFile, uint32_t fOpen, const char *pszFilenameFmt, va_list va)
     39RTR3DECL(int) RTFileOpenV(PRTFILE pFile, uint64_t fOpen, const char *pszFilenameFmt, va_list va)
    4040{
    4141    char szFilename[RTPATH_MAX];
  • trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp

    r35213 r37596  
    22982298
    22992299
    2300 RTDECL(int)         RTVfsFileOpen(RTVFS hVfs, const char *pszFilename, uint32_t fOpen, PRTVFSFILE phVfsFile)
     2300RTDECL(int)         RTVfsFileOpen(RTVFS hVfs, const char *pszFilename, uint64_t fOpen, PRTVFSFILE phVfsFile)
    23012301{
    23022302    /*
  • trunk/src/VBox/Runtime/common/vfs/vfschain.cpp

    r34179 r37596  
    563563
    564564
    565 RTDECL(int) RTVfsChainOpenFile(const char *pszSpec, uint32_t fOpen, PRTVFSFILE phVfsFile, const char **ppszError)
     565RTDECL(int) RTVfsChainOpenFile(const char *pszSpec, uint64_t fOpen, PRTVFSFILE phVfsFile, const char **ppszError)
    566566{
    567567    AssertPtrReturn(pszSpec, VERR_INVALID_POINTER);
     
    610610
    611611
    612 RTDECL(int) RTVfsChainOpenIoStream(const char *pszSpec, uint32_t fOpen, PRTVFSIOSTREAM phVfsIos, const char **ppszError)
     612RTDECL(int) RTVfsChainOpenIoStream(const char *pszSpec, uint64_t fOpen, PRTVFSIOSTREAM phVfsIos, const char **ppszError)
    613613{
    614614    AssertPtrReturn(pszSpec, VERR_INVALID_POINTER);
  • trunk/src/VBox/Runtime/common/vfs/vfsmisc.cpp

    r33973 r37596  
    3939
    4040
    41 RTDECL(int)         RTVfsIoStrmFromStdHandle(RTHANDLESTD enmStdHandle, uint32_t fOpen, bool fLeaveOpen,
     41RTDECL(int)         RTVfsIoStrmFromStdHandle(RTHANDLESTD enmStdHandle, uint64_t fOpen, bool fLeaveOpen,
    4242                                             PRTVFSIOSTREAM phVfsIos)
    4343{
  • trunk/src/VBox/Runtime/common/vfs/vfsstdfile.cpp

    r36555 r37596  
    419419
    420420
    421 RTDECL(int) RTVfsFileFromRTFile(RTFILE hFile, uint32_t fOpen, bool fLeaveOpen, PRTVFSFILE phVfsFile)
     421RTDECL(int) RTVfsFileFromRTFile(RTFILE hFile, uint64_t fOpen, bool fLeaveOpen, PRTVFSFILE phVfsFile)
    422422{
    423423    /*
     
    451451
    452452
    453 RTDECL(int)         RTVfsIoStrmFromRTFile(RTFILE hFile, uint32_t fOpen, bool fLeaveOpen, PRTVFSIOSTREAM phVfsIos)
     453RTDECL(int)         RTVfsIoStrmFromRTFile(RTFILE hFile, uint64_t fOpen, bool fLeaveOpen, PRTVFSIOSTREAM phVfsIos)
    454454{
    455455    RTVFSFILE hVfsFile;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette