VirtualBox

Changeset 75380 in vbox for trunk/src/VBox/Main/src-all


Ignore:
Timestamp:
Nov 9, 2018 10:25:30 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
126515
Message:

Main,VBoxManage,FE/Qt: Extended the createSharedFolder and ISharedFolder methods with a mount poit parameter/attribute for use when auto-mounting. This is especially useful for Windows and OS/2 guests which operates with drive letters. The change has not yet trickled down to the guest interface and VBoxService.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-all/SharedFolderImpl.cpp

    r73003 r75380  
    4646    bool            fWritable;
    4747    bool            fAutoMount;
     48    const Utf8Str   strAutoMountPoint;
    4849    Utf8Str         strLastAccessError;
    4950};
     
    9596 *  @param aWritable    writable if true, readonly otherwise
    9697 *  @param aAutoMount   if auto mounted by guest true, false otherwise
     98 *  @param aAutoMountPoint Where the guest should try auto mount it.
    9799 *  @param fFailOnError Whether to fail with an error if the shared folder path is bad.
    98100 *
     
    104106                           bool aWritable,
    105107                           bool aAutoMount,
     108                           const Utf8Str &aAutoMountPoint,
    106109                           bool fFailOnError)
    107110{
     
    112115    unconst(mMachine) = aMachine;
    113116
    114     HRESULT rc = i_protectedInit(aMachine, aName, aHostPath, aWritable, aAutoMount, fFailOnError);
     117    HRESULT rc = i_protectedInit(aMachine, aName, aHostPath, aWritable, aAutoMount, aAutoMountPoint, fFailOnError);
    115118
    116119    /* Confirm a successful initialization when it's the case */
     
    146149                                 aThat->m->fWritable,
    147150                                 aThat->m->fAutoMount,
     151                                 aThat->m->strAutoMountPoint,
    148152                                 false /* fFailOnError */ );
    149153
     
    166170 *  @param aHostPath    full path to the shared folder on the host
    167171 *  @param aWritable    writable if true, readonly otherwise
     172 *  @param aAutoMountPoint Where the guest should try auto mount it.
    168173 *  @param fFailOnError Whether to fail with an error if the shared folder path is bad.
    169174 *
     
    175180                           bool aWritable,
    176181                           bool aAutoMount,
     182                           const Utf8Str &aAutoMountPoint
    177183                           bool fFailOnError)
    178184{
     
    183189    unconst(mVirtualBox) = aVirtualBox;
    184190
    185     HRESULT rc = protectedInit(aVirtualBox, aName, aHostPath, aWritable, aAutoMount);
     191    HRESULT rc = protectedInit(aVirtualBox, aName, aHostPath, aWritable, aAutoMount, aAutoMountPoint, fFailOnError);
    186192
    187193    /* Confirm a successful initialization when it's the case */
     
    205211 *  @param aHostPath    full path to the shared folder on the host
    206212 *  @param aWritable    writable if true, readonly otherwise
     213 *  @param aAutoMountPoint Where the guest should try auto mount it.
    207214 *  @param fFailOnError Whether to fail with an error if the shared folder path is bad.
    208215 *
     
    214221                           bool aWritable,
    215222                           bool aAutoMount,
     223                           const Utf8Str &aAutoMountPoint,
    216224                           bool fFailOnError)
    217225{
     
    222230    unconst(mConsole) = aConsole;
    223231
    224     HRESULT rc = i_protectedInit(aConsole, aName, aHostPath, aWritable, aAutoMount, fFailOnError);
     232    HRESULT rc = i_protectedInit(aConsole, aName, aHostPath, aWritable, aAutoMount, aAutoMountPoint, fFailOnError);
    225233
    226234    /* Confirm a successful initialization when it's the case */
     
    243251                                      bool aWritable,
    244252                                      bool aAutoMount,
     253                                      const Utf8Str &aAutoMountPoint,
    245254                                      bool fFailOnError)
    246255{
     
    260269     * accept both the slashified paths and not. */
    261270#if defined (RT_OS_OS2) || defined (RT_OS_WINDOWS)
    262     if (hostPathLen > 2 &&
    263         RTPATH_IS_SEP (hostPath.c_str()[hostPathLen - 1]) &&
    264         RTPATH_IS_VOLSEP (hostPath.c_str()[hostPathLen - 2]))
     271    if (   hostPathLen > 2
     272        && RTPATH_IS_SEP(hostPath.c_str()[hostPathLen - 1])
     273        && RTPATH_IS_VOLSEP(hostPath.c_str()[hostPathLen - 2]))
    265274        ;
    266275#else
     
    292301    m->fWritable = aWritable;
    293302    m->fAutoMount = aAutoMount;
     303    unconst(m->strAutoMountPoint) = aAutoMountPoint;
    294304
    295305    return S_OK;
     
    385395}
    386396
     397HRESULT SharedFolder::getAutoMountPoint(com::Utf8Str &aAutoMountPoint)
     398{
     399    /* strAutoMountPoint is constant during life time, no need to lock. */
     400    aAutoMountPoint = m->strAutoMountPoint;
     401    return S_OK;
     402}
     403
     404
    387405HRESULT SharedFolder::getLastAccessError(com::Utf8Str &aLastAccessError)
    388406{
     
    415433}
    416434
     435const Utf8Str &SharedFolder::i_getAutoMountPoint() const
     436{
     437    return m->strAutoMountPoint;
     438}
     439
    417440/* vi: set tabstop=4 shiftwidth=4 expandtab: */
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