VirtualBox

Changeset 43952 in vbox


Ignore:
Timestamp:
Nov 23, 2012 3:21:25 PM (12 years ago)
Author:
vboxsync
Message:

Shared folders: instead of dropping a shared folder which does not have a mapping on the host, include it but make any operation on it fail. This is necessary to keep SSM consistent.

Location:
trunk
Files:
5 edited

Legend:

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

    r39643 r43952  
    13391339 */
    13401340
     1341/** mapping is writable */
    13411342#define SHFL_ADD_MAPPING_F_WRITABLE         (RT_BIT_32(0))
     1343/** mapping is automounted by the guest */
    13421344#define SHFL_ADD_MAPPING_F_AUTOMOUNT        (RT_BIT_32(1))
     1345/** allow the guest to create symlinks */
    13431346#define SHFL_ADD_MAPPING_F_CREATE_SYMLINKS  (RT_BIT_32(2))
     1347/** mapping is actually missing on the host */
     1348#define SHFL_ADD_MAPPING_F_MISSING          (RT_BIT_32(3))
    13441349
    13451350#define SHFL_CPARMS_ADD_MAPPING  (3)
  • trunk/src/VBox/HostServices/SharedFolders/mappings.cpp

    r41013 r43952  
    192192 */
    193193int vbsfMappingsAdd(PSHFLSTRING pFolderName, PSHFLSTRING pMapName,
    194                     bool fWritable, bool fAutoMount, bool fSymlinksCreate)
     194                    bool fWritable, bool fAutoMount, bool fSymlinksCreate, bool fMissing)
    195195{
    196196    unsigned i;
     
    237237            FolderMapping[i].fAutoMount      = fAutoMount;
    238238            FolderMapping[i].fSymlinksCreate = fSymlinksCreate;
     239            FolderMapping[i].fMissing        = fMissing;
    239240
    240241            /* Check if the host file system is case sensitive */
     
    318319    MAPPING *pFolderMapping = vbsfMappingGetByRoot(root);
    319320    AssertReturn(pFolderMapping, NULL);
     321    if (pFolderMapping->fMissing)
     322        return NULL;
    320323    return pFolderMapping->pszFolderName;
    321324}
     
    460463    AssertReturn(pFolderMapping, VERR_INVALID_PARAMETER);
    461464
    462     if (pFolderMapping->fValid == true)
     465    if (   pFolderMapping->fValid
     466        && !pFolderMapping->fMissing)
    463467        *fWritable = pFolderMapping->fWritable;
    464468    else
  • trunk/src/VBox/HostServices/SharedFolders/mappings.h

    r39643 r43952  
    3232    bool        fAutoMount;           /**< folder will be auto-mounted by the guest */
    3333    bool        fSymlinksCreate;      /**< guest is able to create symlinks */
     34    bool        fMissing;             /**< mapping not invalid but host path does not exist.
     35                                           Any guest operation on such a folder fails! */
    3436} MAPPING;
    3537/** Pointer to a MAPPING structure. */
     
    4143
    4244int vbsfMappingsAdd(PSHFLSTRING pFolderName, PSHFLSTRING pMapName,
    43                     bool fWritable, bool fAutoMount, bool fCreateSymlinks);
     45                    bool fWritable, bool fAutoMount, bool fCreateSymlinks, bool fMissing);
    4446int vbsfMappingsRemove(PSHFLSTRING pMapName);
    4547
  • trunk/src/VBox/HostServices/SharedFolders/service.cpp

    r39643 r43952  
    13141314            else
    13151315            {
    1316                 LogRel(("    Host path '%ls', map name '%ls', %s, automount=%s, create_symlinks=%s\n",
     1316                LogRel(("    Host path '%ls', map name '%ls', %s, automount=%s, create_symlinks=%s, missing=%s\n",
    13171317                        ((SHFLSTRING *)paParms[0].u.pointer.addr)->String.ucs2,
    13181318                        ((SHFLSTRING *)paParms[1].u.pointer.addr)->String.ucs2,
    13191319                        RT_BOOL(fFlags & SHFL_ADD_MAPPING_F_WRITABLE) ? "writable" : "read-only",
    13201320                        RT_BOOL(fFlags & SHFL_ADD_MAPPING_F_AUTOMOUNT) ? "true" : "false",
    1321                         RT_BOOL(fFlags & SHFL_ADD_MAPPING_F_CREATE_SYMLINKS) ? "true" : "false"));
     1321                        RT_BOOL(fFlags & SHFL_ADD_MAPPING_F_CREATE_SYMLINKS) ? "true" : "false",
     1322                        RT_BOOL(fFlags & SHFL_ADD_MAPPING_F_MISSING) ? "true" : "false"));
    13221323
    13231324                /* Execute the function. */
     
    13251326                                     RT_BOOL(fFlags & SHFL_ADD_MAPPING_F_WRITABLE),
    13261327                                     RT_BOOL(fFlags & SHFL_ADD_MAPPING_F_AUTOMOUNT),
    1327                                      RT_BOOL(fFlags & SHFL_ADD_MAPPING_F_CREATE_SYMLINKS));
     1328                                     RT_BOOL(fFlags & SHFL_ADD_MAPPING_F_CREATE_SYMLINKS),
     1329                                     RT_BOOL(fFlags & SHFL_ADD_MAPPING_F_MISSING));
    13281330                if (RT_SUCCESS(rc))
    13291331                {
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r43649 r43952  
    73577357                          hostPathFull,
    73587358                          sizeof(hostPathFull));
     7359
     7360    bool fMissing = false;
    73597361    if (RT_FAILURE(vrc))
    73607362        return setError(E_INVALIDARG,
     
    73627364                        aData.m_strHostPath.c_str(), vrc);
    73637365    if (!RTPathExists(hostPathFull))
    7364         return setError(E_INVALIDARG,
    7365                         tr("Shared folder path '%s' does not exist on the host"),
    7366                         aData.m_strHostPath.c_str());
     7366        fMissing = true;
     7367
    73677368    /* Check whether the path is full (absolute) */
    73687369    if (RTPathCompare(aData.m_strHostPath.c_str(), hostPathFull) != 0)
     
    74107411    parms[2].u.uint32 = (aData.m_fWritable ? SHFL_ADD_MAPPING_F_WRITABLE : 0)
    74117412                      | (aData.m_fAutoMount ? SHFL_ADD_MAPPING_F_AUTOMOUNT : 0)
    7412                       | (fSymlinksCreate ? SHFL_ADD_MAPPING_F_CREATE_SYMLINKS : 0);
     7413                      | (fSymlinksCreate ? SHFL_ADD_MAPPING_F_CREATE_SYMLINKS : 0)
     7414                      | (fMissing ? SHFL_ADD_MAPPING_F_MISSING : 0)
     7415                      ;
    74137416
    74147417    vrc = m_pVMMDev->hgcmHostCall("VBoxSharedFolders",
     
    74227425            tr("Could not create a shared folder '%s' mapped to '%s' (%Rrc)"),
    74237426            strName.c_str(), aData.m_strHostPath.c_str(), vrc);
     7427
     7428    if (fMissing)
     7429        return setError(E_INVALIDARG,
     7430                        tr("Shared folder path '%s' does not exist on the host"),
     7431                        aData.m_strHostPath.c_str());
    74247432
    74257433    return S_OK;
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