VirtualBox

Changeset 55956 in vbox


Ignore:
Timestamp:
May 20, 2015 12:14:28 AM (10 years ago)
Author:
vboxsync
Message:

VBox/vd.h: Removed what to me seemed like excessive prediction (RT_UNLIKELY) in VDOpenFlagsToFileOpenFlags. Reordered an if, though, but no RT_LIKELEY.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vd.h

    r54835 r55956  
    265265 *
    266266 * @return  RTFile open flags.
    267  * @param   uOpenFlags      VD_OPEN_FLAGS_* open flags.
     267 * @param   fOpenFlags      VD_OPEN_FLAGS_* open flags.
    268268 * @param   fCreate         Flag that the file should be created.
    269269 */
    270 DECLINLINE(uint32_t) VDOpenFlagsToFileOpenFlags(unsigned uOpenFlags, bool fCreate)
     270DECLINLINE(uint32_t) VDOpenFlagsToFileOpenFlags(unsigned fOpenFlags, bool fCreate)
    271271{
    272     AssertMsg(!((uOpenFlags & VD_OPEN_FLAGS_READONLY) && fCreate), ("Image can't be opened readonly while being created\n"));
    273 
    274     uint32_t fOpen = 0;
    275 
    276     if (RT_UNLIKELY(uOpenFlags & VD_OPEN_FLAGS_READONLY))
    277         fOpen |= RTFILE_O_READ | RTFILE_O_DENY_NONE;
     272    AssertMsg(!(fOpenFlags & VD_OPEN_FLAGS_READONLY) || !fCreate, ("Image can't be opened readonly while being created\n"));
     273
     274    uint32_t fOpen;
     275    if (fOpenFlags & VD_OPEN_FLAGS_READONLY)
     276        fOpen = RTFILE_O_READ | RTFILE_O_DENY_NONE;
    278277    else
    279278    {
    280         fOpen |= RTFILE_O_READWRITE;
    281 
    282         if (RT_UNLIKELY(uOpenFlags & VD_OPEN_FLAGS_SHAREABLE))
     279        fOpen = RTFILE_O_READWRITE;
     280
     281        if (fOpenFlags & VD_OPEN_FLAGS_SHAREABLE)
    283282            fOpen |= RTFILE_O_DENY_NONE;
    284283        else
     
    286285    }
    287286
    288     if (RT_UNLIKELY(fCreate))
     287    if (!fCreate)
     288        fOpen |= RTFILE_O_OPEN;
     289    else
    289290        fOpen |= RTFILE_O_CREATE | RTFILE_O_NOT_CONTENT_INDEXED;
    290     else
    291         fOpen |= RTFILE_O_OPEN;
    292291
    293292    return fOpen;
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