VirtualBox

Changeset 55668 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
May 5, 2015 3:45:27 PM (10 years ago)
Author:
vboxsync
Message:

Modified IGuestSession::fileOpenEx: removed the 'offset' parameter and added generic flags parameter so we can easily add features later when we need them (see RTFILE_O_XXX for inspiration). Changed FileSeekOrigin_Set to FileSeekOrigin_Begin.

Location:
trunk/src/VBox/Main
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r55633 r55668  
    99819981  <enum
    99829982    name="FileSeekOrigin"
    9983     uuid="939ba94f-497a-4119-ebd3-d193e176c98e"
     9983    uuid="ad32f789-4279-4530-979c-f16892e1c263"
    99849984    >
    99859985    <desc>
     
    99879987    </desc>
    99889988
    9989     <const name="Set"                   value="0">
    9990       <desc>Seek from the start of the file.</desc>
     9989    <const name="Begin"                 value="0">
     9990      <desc>Seek from the beginning of the file.</desc>
    99919991    </const>
    99929992    <const name="Current"               value="1">
     
    1055910559
    1056010560  <enum
     10561    name="FileOpenExFlags"
     10562    uuid="9d62017b-ddd3-4e5a-a08e-14d1c23bbac1"
     10563    >
     10564    <desc>
     10565      Open flags for <link to="IGuestSession::fileOpenEx"/>.
     10566    </desc>
     10567    <const name="None"        value="0">
     10568      <desc>No flag set.</desc>
     10569    </const>
     10570  </enum>
     10571
     10572  <enum
    1056110573    name="FileStatus"
    1056210574    uuid="8c86468b-b97b-4080-8914-e29f5b0abd2c"
     
    1096810980  <interface
    1096910981    name="IGuestSession" extends="$unknown"
    10970     uuid="91306653-4e3a-88cb-a809-85ae64ceb4fd"
     10982    uuid="3cbf62cf-c9cd-48c6-9623-d1dbe54ca557"
    1097110983    wsmap="managed"
    1097210984    >
     
    1168211694        </desc>
    1168311695      </param>
    11684 <!-- r=bird: Use case for the 'offset' parameter, please? I see no possible rational, especially with readAt/writeAt/seek handy.
    11685              Or is this an alternative way of doing "append" accessMode?  Anyway, it's pretty harmless... -->
    11686       <param name="offset" type="long long" dir="in">
    11687         <desc>The initial read/write offset (in bytes).</desc>
     11696      <param name="flags" type="FileOpenExFlags" dir="in" safearray="yes">
     11697        <desc>Zero or more <link to="FileOpenExFlags"/> values. </desc>
    1168811698      </param>
    1168911699      <param name="file" type="IGuestFile" dir="return">
  • trunk/src/VBox/Main/include/GuestCtrlImplPrivate.h

    r55644 r55668  
    610610    /** Octal creation mode. */
    611611    uint32_t                mCreationMode;
    612     /** The initial offset on open. */
    613     uint64_t                mInitialOffset;
     612    /** Extended open flags (currently none defined). */
     613    uint32_t                mfOpenEx;
    614614};
    615615
  • trunk/src/VBox/Main/include/GuestSessionImpl.h

    r55631 r55668  
    353353                       FileSharingMode_T aSharingMode,
    354354                       ULONG aCreationMode,
    355                        LONG64 aOffset,
     355                       const std::vector<FileOpenExFlags_T> &aFlags,
    356356                       ComPtr<IGuestFile> &aFile);
    357357    HRESULT fileQuerySize(const com::Utf8Str &aPath,
  • trunk/src/VBox/Main/src-client/GuestFileImpl.cpp

    r55645 r55668  
    475475                pSvcCbData->mpaParms[idx++].getUInt32(&dataCb.u.open.uHandle);
    476476
    477                 {
    478                     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    479                     AssertMsg(mData.mID == VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(pCbCtx->uContextID),
    480                               ("File ID %RU32 does not match context ID %RU32\n", mData.mID,
    481                               VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(pCbCtx->uContextID)));
    482 
    483                     /* Set the initial offset. On the guest the whole opening operation
    484                      * would fail if an initial seek isn't possible. */
    485                     mData.mOffCurrent = mData.mOpenInfo.mInitialOffset;
    486                 }
     477                AssertMsg(mData.mID == VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(pCbCtx->uContextID),
     478                          ("File ID %RU32 does not match context ID %RU32\n", mData.mID,
     479                           VBOX_GUESTCTRL_CONTEXTID_GET_OBJECT(pCbCtx->uContextID)));
    487480
    488481                /* Set the process status. */
     
    654647    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    655648
    656     LogFlowThisFunc(("strFile=%s, enmAccessMode=%d (%s) enmOpenAction=%d (%s) uCreationMode=%RU32, uOffset=%RU64\n",
     649    LogFlowThisFunc(("strFile=%s, enmAccessMode=%d (%s) enmOpenAction=%d (%s) uCreationMode=%RU32, mfOpenEx=%RU32\n",
    657650                     mData.mOpenInfo.mFileName.c_str(), mData.mOpenInfo.mAccessMode, mData.mOpenInfo.mpszAccessMode,
    658651                     mData.mOpenInfo.mOpenAction, mData.mOpenInfo.mpszOpenAction, mData.mOpenInfo.mCreationMode,
    659                      mData.mOpenInfo.mInitialOffset));
     652                     mData.mOpenInfo.mfOpenEx));
    660653    int vrc;
    661654
     
    686679    paParms[i++].setString(""); /** @todo sharing mode. */
    687680    paParms[i++].setUInt32(mData.mOpenInfo.mCreationMode);
    688     paParms[i++].setUInt64(mData.mOpenInfo.mInitialOffset);
     681    paParms[i++].setUInt64(0 /* initial offset */);
     682    /** @todo Next protocol version: add flags, replace strings, remove initial offset. */
    689683
    690684    alock.release(); /* Drop write lock before sending. */
     
    13001294    switch (aWhence)
    13011295    {
    1302         case FileSeekOrigin_Set:
     1296        case FileSeekOrigin_Begin:
    13031297            eSeekType = GUEST_FILE_SEEKTYPE_BEGIN;
    13041298            break;
  • trunk/src/VBox/Main/src-client/GuestSessionImpl.cpp

    r55645 r55668  
    12321232                                     ComObjPtr<GuestFile> &pFile, int *pGuestRc)
    12331233{
    1234     LogFlowThisFunc(("strFile=%s, enmAccessMode=%d (%s) enmOpenAction=%d (%s) uCreationMode=%RU32, uOffset=%RU64\n",
     1234    LogFlowThisFunc(("strFile=%s, enmAccessMode=%d (%s) enmOpenAction=%d (%s) uCreationMode=%RU32 mfOpenEx=%RU32\n",
    12351235                     openInfo.mFileName.c_str(), openInfo.mAccessMode, openInfo.mpszAccessMode,
    1236                      openInfo.mOpenAction, openInfo.mpszOpenAction, openInfo.mCreationMode, openInfo.mInitialOffset));
     1236                     openInfo.mOpenAction, openInfo.mpszOpenAction, openInfo.mCreationMode, openInfo.mfOpenEx));
    12371237
    12381238    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    29782978{
    29792979    LogFlowThisFuncEnter();
    2980     return fileOpenEx(aPath, aAccessMode, aOpenAction, FileSharingMode_All, aCreationMode, 0 /* aOffset */, aFile);
     2980    const std::vector<FileOpenExFlags_T> EmptyFlags;
     2981    return fileOpenEx(aPath, aAccessMode, aOpenAction, FileSharingMode_All, aCreationMode, EmptyFlags, aFile);
    29812982}
    29822983
    29832984HRESULT GuestSession::fileOpenEx(const com::Utf8Str &aPath, FileAccessMode_T aAccessMode, FileOpenAction_T aOpenAction,
    2984                                  FileSharingMode_T aSharingMode, ULONG aCreationMode, LONG64 aOffset, ComPtr<IGuestFile> &aFile)
     2985                                 FileSharingMode_T aSharingMode, ULONG aCreationMode,
     2986                                 const std::vector<FileOpenExFlags_T> &aFlags, ComPtr<IGuestFile> &aFile)
    29852987{
    29862988    LogFlowThisFuncEnter();
     
    29962998    openInfo.mFileName = aPath;
    29972999    openInfo.mCreationMode = aCreationMode;
    2998     openInfo.mInitialOffset = aOffset;
    29993000
    30003001    /* convert + validate aAccessMode to the old format. */
     
    30453046            return setError(E_INVALIDARG, tr("Unknown FileOpenAction value %u (%#x)"), aAccessMode, aAccessMode);
    30463047    }
     3048
     3049    /* Combine and validate flags. */
     3050    uint32_t fOpenEx = 0;
     3051    for (size_t i = 0; i < aFlags.size(); i++)
     3052        fOpenEx = aFlags[i];
     3053    if (fOpenEx)
     3054        return setError(E_INVALIDARG, tr("Unsupported FileOpenExFlags values in aFlags (%#x)"), fOpenEx);
     3055    openInfo.mfOpenEx = fOpenEx;
    30473056
    30483057    ComObjPtr <GuestFile> pFile;
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