Changeset 78903 in vbox for trunk/src/VBox/HostServices/SharedFolders
- Timestamp:
- May 31, 2019 7:20:16 PM (6 years ago)
- Location:
- trunk/src/VBox/HostServices/SharedFolders
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedFolders/VBoxSharedFoldersSvc.cpp
r78699 r78903 300 300 "Saved SHFLCLIENTDATA enmErrorStyle value %d is not known/valid!", pClient->enmErrorStyle); 301 301 302 /* Drop the root IDs of all configured mappings before restoring: */ 303 vbsfMappingLoadingStart(); 304 302 305 /* We don't actually (fully) restore the state; we simply check if the current state is as we it expect it to be. */ 303 306 for (SHFLROOT i = 0; i < SHFL_MAX_MAPPINGS; i++) … … 418 421 } 419 422 } 423 424 /* Make sure all mappings have root IDs (global folders changes, VM 425 config changes (paranoia)): */ 426 vbsfMappingLoadingDone(); 427 420 428 Log(("SharedFolders host service: successfully loaded state\n")); 421 429 #else -
trunk/src/VBox/HostServices/SharedFolders/mappings.cpp
r77498 r78903 96 96 } 97 97 98 /** 99 * Called before loading mappings from saved state to drop the root IDs. 100 */ 101 void vbsfMappingLoadingStart(void) 102 { 103 for (SHFLROOT idRoot = 0; idRoot < RT_ELEMENTS(g_aIndexFromRoot); idRoot++) 104 g_aIndexFromRoot[idRoot] = SHFL_ROOT_NIL; 105 106 for (SHFLROOT i = 0; i < RT_ELEMENTS(g_FolderMapping); i++) 107 g_FolderMapping[i].fLoadedRootId = false; 108 } 109 110 /** 111 * Called when a mapping is loaded to restore the root ID and make sure it 112 * exists. 113 * 114 * @returns VBox status code. 115 */ 98 116 int vbsfMappingLoaded(const MAPPING *pLoadedMapping, SHFLROOT root) 99 117 { … … 138 156 139 157 /* Actual index is i. Remember that when the guest uses 'root' it is actually 'i'. */ 140 /** @todo This will not work with global shared folders, as these can change 141 * while state is saved and these blind assignments may hid new ones. */ 158 AssertLogRelMsg(g_aIndexFromRoot[root] == SHFL_ROOT_NIL, 159 ("idRoot=%u: current %u ([%s]), new %u (%ls [%s])\n", 160 root, g_aIndexFromRoot[root], g_FolderMapping[g_aIndexFromRoot[root]].pszFolderName, 161 pLoadedMapping->pMapName->String.utf16, pLoadedMapping->pszFolderName)); 142 162 g_aIndexFromRoot[root] = i; 143 163 … … 158 178 pLoadedMapping->fSymlinksCreate, /* fMissing = */ true, /* fPlaceholder = */ true); 159 179 } 180 181 /** 182 * Called after loading mappings from saved state to make sure every mapping has 183 * a root ID. 184 */ 185 void vbsfMappingLoadingDone(void) 186 { 187 for (SHFLROOT iMapping = 0; iMapping < RT_ELEMENTS(g_FolderMapping); iMapping++) 188 if (g_FolderMapping[iMapping].fValid) 189 { 190 AssertLogRel(g_FolderMapping[iMapping].pMapName); 191 AssertLogRel(g_FolderMapping[iMapping].pszFolderName); 192 193 SHFLROOT idRoot; 194 for (idRoot = 0; idRoot < RT_ELEMENTS(g_aIndexFromRoot); idRoot++) 195 if (g_aIndexFromRoot[idRoot] == iMapping) 196 break; 197 if (idRoot >= RT_ELEMENTS(g_aIndexFromRoot)) 198 { 199 for (idRoot = 0; idRoot < RT_ELEMENTS(g_aIndexFromRoot); idRoot++) 200 if (g_aIndexFromRoot[idRoot] == SHFL_ROOT_NIL) 201 break; 202 if (idRoot < RT_ELEMENTS(g_aIndexFromRoot)) 203 g_aIndexFromRoot[idRoot] = iMapping; 204 else 205 LogRel(("SharedFolders: Warning! No free root ID entry for mapping #%u: %ls [%s]\n", iMapping, 206 g_FolderMapping[iMapping].pMapName->String.ucs2, g_FolderMapping[iMapping].pszFolderName)); 207 } 208 } 209 210 /* Log the root ID mappings: */ 211 if (LogRelIs2Enabled()) 212 for (SHFLROOT idRoot = 0; idRoot < RT_ELEMENTS(g_aIndexFromRoot); idRoot++) 213 { 214 SHFLROOT const iMapping = g_aIndexFromRoot[idRoot]; 215 if (iMapping != SHFL_ROOT_NIL) 216 LogRel2(("SharedFolders: idRoot %u: iMapping #%u: %ls [%s]\n", idRoot, iMapping, 217 g_FolderMapping[iMapping].pMapName->String.ucs2, g_FolderMapping[iMapping].pszFolderName)); 218 } 219 } 220 160 221 161 222 MAPPING *vbsfMappingGetByRoot(SHFLROOT root) -
trunk/src/VBox/HostServices/SharedFolders/mappings.h
r76570 r78903 74 74 bool vbsfIsHostMappingCaseSensitive(SHFLROOT root); 75 75 76 int vbsfMappingLoaded(MAPPING const *pLoadedMapping, SHFLROOT root); 76 void vbsfMappingLoadingStart(void); 77 int vbsfMappingLoaded(MAPPING const *pLoadedMapping, SHFLROOT root); 78 void vbsfMappingLoadingDone(void); 77 79 PMAPPING vbsfMappingGetByRoot(SHFLROOT root); 78 80
Note:
See TracChangeset
for help on using the changeset viewer.