VirtualBox

Changeset 75411 in vbox


Ignore:
Timestamp:
Nov 12, 2018 8:31:05 PM (6 years ago)
Author:
vboxsync
Message:

VBoxSharedFolders,VBoxService,VBoxTray: New go at auto mounting shared folders, now also at runtime. bugref:3544 [build fix]

  • Added three new functions to the shared folders service:
    1. query mountpoint and everything else about a shared folder.
    2. wait for folder (mappings) config changes.
    3. cancel such waits.
  • Relaxed some of the check wrt placeholder folders so that the GUI can succesfully make changes to a folder while it is being used. The old code would end up failing if the guest was using the folder because of a (placeholder) duplicate.
  • Ran into some weird weird flag passing between service.cpp and vbsfMappingsQuery via pClient->fu32Flags. Didn't make sense to me and clashed with a new flag I added for the wait cancellation, so I changed it to use a parameter (fOnlyAutoMounts) for the purpose.
  • Pointed out that vbsfMappingsQuery is weird in a the way it doesn't return an overflow indicator, meaning that the guest library wrapper's checks for VINF_BUFFER_OVERFLOW is pointless.
  • In VBoxService I've reimplemented the automounter subservice. Only tested with a windows 7 guest so far. Highlights:
    • Use host specified mount points / drive letters.
    • Adjust to changes in mapping configuration.
    • Mappings should be global on windows guests, given that VBoxService runs under the System user (only verified on Win7).
  • One TODO is that I would like to try relocate a mapping that's not on the specified mount point once the mount point is freed up.
  • VBoxTray no longer maps shared folder on startup.
File:
1 edited

Legend:

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

    r75407 r75411  
    6060#  include <sys/mnttab.h>
    6161#  include <sys/vfs.h>
     62RT_C_DECLS_BEGIN /* Only needed for old code.*/
     63#  include "../../linux/sharedfolders/vbsfmount.h"
     64RT_C_DECLS_END
    6265# elif defined(RT_OS_LINUX)
    6366#  include <mntent.h>
     
    10001003            {
    10011004                /* Look for the dummy automounter option. */
    1002                 if (   Entry.mnt_opts != NULL
    1003                     && strstr(Entry.mnt_opts, g_szTag) != NULL)
     1005                if (   Entry.mnt_mntopts != NULL
     1006                    && strstr(Entry.mnt_mntopts, g_szTag) != NULL)
    10041007                {
    10051008                    rc = vbsvcAutomounterAddEntry(pMountTable, Entry.mnt_special, Entry.mnt_mountp);
     
    15231526
    15241527    rc = mount(pEntry->pszName, pEntry->pszActualMountPoint, MS_OPTIONSTR, "vboxfs",
    1525                NULL /*dataptr*/, 0 /* datalen */, szOptBuf, cchOpts + 1);
     1528               NULL /*dataptr*/, 0 /* datalen */, szOpts, cchOpts + 1);
    15261529    if (rc == 0)
    15271530    {
    1528         VGSvcVerbose(0, "vbsvcAutomounterMountIt: Shared folder '%s' was mounted to '%s'\n", pszShareName, pszMountPoint);
     1531        VGSvcVerbose(0, "vbsvcAutomounterMountIt: Successfully mounted '%s' on '%s'\n",
     1532                     pEntry->pszName, pEntry->pszActualMountPoint);
    15291533        return VINF_SUCCESS;
    15301534    }
    15311535
    15321536    rc = errno;
    1533     VGSvcError("vbsvcAutomounterMountIt: mount failed for '%s' at '%s': %s (%d)\n",
    1534                pEntry->pszName, pEntry->pszActualMountPoint, strerror(rc), rc);
     1537    VGSvcError("vbsvcAutomounterMountIt: mount failed for '%s' on '%s' (szOpts=%s): %s (%d)\n",
     1538               pEntry->pszName, pEntry->pszActualMountPoint, szOpts, strerror(rc), rc);
    15351539    return VERR_OPEN_FAILED;
    15361540
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