VirtualBox

source: vbox/trunk/src/VBox/HostServices/SharedFolders/mappings.h@ 76066

Last change on this file since 76066 was 75407, checked in by vboxsync, 6 years ago

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

  • 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.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 KB
Line 
1/* $Id: mappings.h 75407 2018-11-12 20:06:57Z vboxsync $ */
2/** @file
3 * Shared folders service - Mappings header.
4 */
5
6/*
7 * Copyright (C) 2006-2017 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ___MAPPINGS_H
19#define ___MAPPINGS_H
20
21#include "shfl.h"
22#include <VBox/shflsvc.h>
23
24typedef struct
25{
26 char *pszFolderName; /**< Directory at the host to share with the guest. */
27 PSHFLSTRING pMapName; /**< Share name for the guest. */
28 uint32_t cMappings; /**< Number of mappings. */
29 bool fValid; /**< Mapping entry is used/valid. */
30 bool fHostCaseSensitive; /**< Host file name space is case-sensitive. */
31 bool fGuestCaseSensitive; /**< Guest file name space is case-sensitive. */
32 bool fWritable; /**< Folder is writable for the guest. */
33 PSHFLSTRING pAutoMountPoint; /**< Where the guest should try auto-mount the folder. */
34 bool fAutoMount; /**< Folder will be auto-mounted by the guest. */
35 bool fSymlinksCreate; /**< Guest is able to create symlinks. */
36 bool fMissing; /**< Mapping not invalid but host path does not exist.
37 Any guest operation on such a folder fails! */
38 bool fPlaceholder; /**< Mapping does not exist in the VM settings but the guest
39 still has. fMissing is always true for this mapping. */
40 bool fLoadedRootId; /**< Set if vbsfMappingLoaded has found this mapping already. */
41} MAPPING;
42/** Pointer to a MAPPING structure. */
43typedef MAPPING *PMAPPING;
44
45void vbsfMappingInit(void);
46
47bool vbsfMappingQuery(uint32_t iMapping, PMAPPING *pMapping);
48
49int vbsfMappingsAdd(const char *pszFolderName, PSHFLSTRING pMapName, bool fWritable,
50 bool fAutoMount, PSHFLSTRING pAutoMountPoint, bool fCreateSymlinks, bool fMissing, bool fPlaceholder);
51int vbsfMappingsRemove(PSHFLSTRING pMapName);
52
53int vbsfMappingsQuery(PSHFLCLIENTDATA pClient, bool fOnlyAutoMounts, PSHFLMAPPING pMappings, uint32_t *pcMappings);
54int vbsfMappingsQueryName(PSHFLCLIENTDATA pClient, SHFLROOT root, SHFLSTRING *pString);
55int vbsfMappingsQueryWritable(PSHFLCLIENTDATA pClient, SHFLROOT root, bool *fWritable);
56int vbsfMappingsQueryAutoMount(PSHFLCLIENTDATA pClient, SHFLROOT root, bool *fAutoMount);
57int vbsfMappingsQuerySymlinksCreate(PSHFLCLIENTDATA pClient, SHFLROOT root, bool *fSymlinksCreate);
58int vbsfMappingsQueryInfo(PSHFLCLIENTDATA pClient, SHFLROOT root, PSHFLSTRING pNameBuf, PSHFLSTRING pMntPtBuf,
59 uint64_t *pfFlags, uint32_t *puVersion);
60
61int vbsfMapFolder(PSHFLCLIENTDATA pClient, PSHFLSTRING pszMapName, RTUTF16 delimiter,
62 bool fCaseSensitive, SHFLROOT *pRoot);
63int vbsfUnmapFolder(PSHFLCLIENTDATA pClient, SHFLROOT root);
64
65int vbsfMappingsWaitForChanges(PSHFLCLIENTDATA pClient, VBOXHGCMCALLHANDLE hCall, PVBOXHGCMSVCPARM pParm, bool fRestored);
66int vbsfMappingsCancelChangesWaits(PSHFLCLIENTDATA pClient);
67
68const char* vbsfMappingsQueryHostRoot(SHFLROOT root);
69int vbsfMappingsQueryHostRootEx(SHFLROOT hRoot, const char **ppszRoot, uint32_t *pcbRootLen);
70bool vbsfIsGuestMappingCaseSensitive(SHFLROOT root);
71bool vbsfIsHostMappingCaseSensitive(SHFLROOT root);
72
73int vbsfMappingLoaded(MAPPING const *pLoadedMapping, SHFLROOT root);
74PMAPPING vbsfMappingGetByRoot(SHFLROOT root);
75
76#endif /* !___MAPPINGS_H */
77
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette