VirtualBox

Changeset 35055 in vbox


Ignore:
Timestamp:
Dec 14, 2010 9:35:29 AM (14 years ago)
Author:
vboxsync
Message:

VBoxService/AutoMount: Logging, handle write protected mounts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp

    r35016 r35055  
    150150    }
    151151#endif
     152
     153    VBoxServiceVerbose(4, "VBoxServiceAutoMountShareIsMounted: Share \"%s\" at mount point \"%s\" = %s\n",
     154                       pszShare, fMounted ? pszMountPoint : "<None>", fMounted ? "Yes" : "No");
    152155    return fMounted;
    153156}
     
    190193            rc = RTPathSetMode(pszMountPoint, fMode);
    191194            if (RT_FAILURE(rc))
    192                 VBoxServiceError("VBoxServiceAutoMountPrepareMountPoint: Could not set mode %RTfmode for mount directory \"%s\", rc = %Rrc\n",
    193                                  fMode, pszMountPoint, rc);
     195            {
     196                if (rc == VERR_WRITE_PROTECT)
     197                {
     198                    VBoxServiceError("VBoxServiceAutoMountPrepareMountPoint: Mount directory \"%s\" already is used/mounted\n", pszMountPoint);
     199                    rc = VINF_SUCCESS;
     200                }
     201                else
     202                    VBoxServiceError("VBoxServiceAutoMountPrepareMountPoint: Could not set mode %RTfmode for mount directory \"%s\", rc = %Rrc\n",
     203                                     fMode, pszMountPoint, rc);
     204            }
    194205        }
    195206        else
     
    368379}
    369380
    370 static int VBoxServiceAutoMountProcessMappings(PVBGLR3SHAREDFOLDERMAPPING paMappings, uint32_t cMappings, 
     381static int VBoxServiceAutoMountProcessMappings(PVBGLR3SHAREDFOLDERMAPPING paMappings, uint32_t cMappings,
    371382                                               const char *pszMountDir, const char *pszSharePrefix, uint32_t uClientID)
    372383{
     
    376387    AssertPtrReturn(pszMountDir, VERR_INVALID_PARAMETER);
    377388    AssertPtrReturn(pszSharePrefix, VERR_INVALID_PARAMETER);
    378     AssertPtrReturn(*pszSharePrefix, VERR_INVALID_PARAMETER);
    379389    AssertReturn(uClientID > 0, VERR_INVALID_PARAMETER);
    380390
     
    391401            char *pszShareNameFull = NULL;
    392402            if (RTStrAPrintf(&pszShareNameFull, "%s%s", pszSharePrefix, pszShareName) > 0)
    393             {               
     403            {
    394404                char szMountPoint[RTPATH_MAX];
    395405                rc = RTPathJoin(szMountPoint, sizeof(szMountPoint), pszMountDir, pszShareNameFull);
     
    397407                {
    398408                    VBoxServiceVerbose(4, "VBoxServiceAutoMountWorker: Processing mount point \"%s\"\n", szMountPoint);
    399    
     409
    400410                    struct group *grp_vboxsf = getgrnam("vboxsf");
    401411                    if (grp_vboxsf)
     
    418428                            NULL,                  /* convertcp */
    419429                        };
    420    
    421                         /* We always use "/media" as our root mounting directory. */
    422                         /** @todo Detect the correct "media/mnt" directory, based on the current guest (?). */
     430
    423431                        rc = VBoxServiceAutoMountSharedFolder(pszShareName, szMountPoint, &mount_opts);
    424432                    }
     
    462470        rc = VbglR3SharedFolderGetMappings(u32ClientId, true /* Only process auto-mounted folders */,
    463471                                           &paMappings, &cMappings);
    464         if (RT_SUCCESS(rc))
     472        if (   RT_SUCCESS(rc)
     473            && cMappings)
    465474        {
    466475            char *pszMountDir;
     
    474483                char *pszSharePrefix;
    475484                rc = VbglR3SharedFolderGetMountPrefix(&pszSharePrefix);
    476 
    477                 {
    478                 }
    479485                if (RT_SUCCESS(rc))
    480486                {
     
    501507            }
    502508            else
    503                 VBoxServiceError("VBoxServiceAutoMountWorker: Error while getting the shared folder directory, rc = %Rrc\n", rc);                       
     509                VBoxServiceError("VBoxServiceAutoMountWorker: Error while getting the shared folder directory, rc = %Rrc\n", rc);
    504510            RTMemFree(paMappings);
    505511        }
    506512        else
    507             VBoxServiceError("VBoxServiceAutoMountWorker: Error while getting the shared folder mappings, rc = %Rrc\n", rc);
     513        {
     514            if (RT_FAILURE(rc))
     515                VBoxServiceError("VBoxServiceAutoMountWorker: Error while getting the shared folder mappings, rc = %Rrc\n", rc);
     516            else if (!cMappings)
     517                VBoxServiceVerbose(3, "VBoxServiceAutoMountWorker: No shared folder mappings fouund\n");
     518        }
    508519        VbglR3SharedFolderDisconnect(u32ClientId);
    509520    }
     
    512523    g_AutoMountEvent = NIL_RTSEMEVENTMULTI;
    513524
    514     VBoxServiceVerbose(3, "VBoxServiceAutoMountWorker: Finished\n");
    515     return 0;
     525    VBoxServiceVerbose(3, "VBoxServiceAutoMountWorker: Finished with rc=%Rrc\n", rc);
     526    return VINF_SUCCESS;
    516527}
    517528
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