Changeset 3944 in vbox for trunk/src/VBox/HostServices/SharedFolders
- Timestamp:
- Jul 31, 2007 3:32:06 PM (17 years ago)
- Location:
- trunk/src/VBox/HostServices/SharedFolders
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedFolders/mappings.cpp
r3338 r3944 75 75 FolderMapping[i].fValid = true; 76 76 FolderMapping[i].cMappings = 0; 77 78 /* Check if the host file system is case sensitive */ 79 RTFSPROPERTIES prop; 80 char *utf8Root, *asciiroot; 81 82 int rc = RTUtf16ToUtf8(FolderMapping[i].pFolderName->String.ucs2, &utf8Root); 83 AssertRC(rc); 84 85 if (VBOX_SUCCESS(rc)) 86 { 87 rc = RTStrUtf8ToCurrentCP(&asciiroot, utf8Root); 88 if (VBOX_SUCCESS(rc)) 89 { 90 rc = RTFsQueryProperties(asciiroot, &prop); 91 AssertRC(rc); 92 RTStrFree(asciiroot); 93 } 94 RTStrFree(utf8Root); 95 } 96 FolderMapping[i].fHostCaseSensitive = VBOX_SUCCESS(rc) ? prop.fCaseSensitive : false; 77 97 break; 78 98 } … … 131 151 } 132 152 153 bool vbsfIsGuestMappingCaseSensitive (SHFLROOT root) 154 { 155 if (root > SHFL_MAX_MAPPINGS) 156 { 157 AssertFailed(); 158 return false; 159 } 160 161 return FolderMapping[root].fGuestCaseSensitive; 162 } 163 164 bool vbsfIsHostMappingCaseSensitive (SHFLROOT root) 165 { 166 if (root > SHFL_MAX_MAPPINGS) 167 { 168 AssertFailed(); 169 return false; 170 } 171 172 return FolderMapping[root].fHostCaseSensitive; 173 } 174 133 175 int vbsfMappingsQuery (SHFLCLIENTDATA *pClient, SHFLMAPPING *pMappings, uint32_t *pcMappings) 134 176 { … … 203 245 } 204 246 205 int vbsfMapFolder (SHFLCLIENTDATA *pClient, PSHFLSTRING pszMapName, RTUCS2 delimiter, SHFLROOT *pRoot)247 int vbsfMapFolder (SHFLCLIENTDATA *pClient, PSHFLSTRING pszMapName, RTUCS2 delimiter, bool fCaseSensitive, SHFLROOT *pRoot) 206 248 { 207 249 size_t index; … … 255 297 256 298 FolderMapping[index].cMappings++; 299 Assert(FolderMapping[index].cMappings == 1 || FolderMapping[index].fGuestCaseSensitive == fCaseSensitive); 300 FolderMapping[index].fGuestCaseSensitive = fCaseSensitive; 257 301 *pRoot = index; 258 302 return VINF_SUCCESS; -
trunk/src/VBox/HostServices/SharedFolders/mappings.h
r3338 r3944 33 33 uint32_t cMappings; 34 34 bool fValid; 35 bool fHostCaseSensitive; 36 bool fGuestCaseSensitive; 35 37 } MAPPING, *PMAPPING; 36 38 … … 45 47 int vbsfMappingsQueryName (SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLSTRING *pString); 46 48 47 int vbsfMapFolder (SHFLCLIENTDATA *pClient, PSHFLSTRING pszMapName, RTUCS2 delimiter, SHFLROOT *pRoot);49 int vbsfMapFolder (SHFLCLIENTDATA *pClient, PSHFLSTRING pszMapName, RTUCS2 delimiter, bool fCaseSensitive, SHFLROOT *pRoot); 48 50 int vbsfUnmapFolder (SHFLCLIENTDATA *pClient, SHFLROOT root); 49 51 50 52 const RTUCS2 *vbsfMappingsQueryHostRoot (SHFLROOT root, uint32_t *pcbRoot); 51 53 bool vbsfIsGuestMappingCaseSensitive (SHFLROOT root); 54 bool vbsfIsHostMappingCaseSensitive (SHFLROOT root); 52 55 53 56 #endif /* __MAPPINGS__H */ -
trunk/src/VBox/HostServices/SharedFolders/service.cpp
r3338 r3944 30 30 #include <iprt/assert.h> 31 31 #include <VBox/ssm.h> 32 33 #define SHFL_SSM_VERSION 2 32 34 33 35 … … 117 119 Log(("svcSaveState: u32ClientID = %d\n", u32ClientID)); 118 120 119 int rc = SSMR3PutU32(pSSM, SHFL_MAX_MAPPINGS); 121 int rc = SSMR3PutU32(pSSM, SHFL_SSM_VERSION); 122 AssertRCReturn(rc, rc); 123 124 rc = SSMR3PutU32(pSSM, SHFL_MAX_MAPPINGS); 120 125 AssertRCReturn(rc, rc); 121 126 … … 153 158 rc = SSMR3PutMem(pSSM, FolderMapping[i].pMapName, len); 154 159 AssertRCReturn(rc, rc); 160 161 rc = SSMR3PutBool(pSSM, FolderMapping[i].fHostCaseSensitive); 162 AssertRCReturn(rc, rc); 163 164 rc = SSMR3PutBool(pSSM, FolderMapping[i].fGuestCaseSensitive); 165 AssertRCReturn(rc, rc); 155 166 } 156 167 } … … 163 174 uint32_t nrMappings; 164 175 SHFLCLIENTDATA *pClient = (SHFLCLIENTDATA *)pvClient; 165 uint32_t len ;176 uint32_t len, version; 166 177 167 178 Log(("svcLoadState: u32ClientID = %d\n", u32ClientID)); 168 179 169 int rc = SSMR3GetU32(pSSM, &nrMappings); 180 int rc = SSMR3GetU32(pSSM, &version); 181 AssertRCReturn(rc, rc); 182 183 if (version != SHFL_SSM_VERSION) 184 return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION; 185 186 rc = SSMR3GetU32(pSSM, &nrMappings); 170 187 AssertRCReturn(rc, rc); 171 188 if (nrMappings != SHFL_MAX_MAPPINGS) … … 245 262 RTMemFree(pName); 246 263 264 bool fCaseSensitive; 265 266 rc = SSMR3GetBool(pSSM, &fCaseSensitive); 267 AssertRCReturn(rc, rc); 268 if (FolderMapping[i].fHostCaseSensitive != fCaseSensitive) 269 return VERR_SSM_UNEXPECTED_DATA; 270 271 rc = SSMR3GetBool(pSSM, &FolderMapping[i].fGuestCaseSensitive); 272 AssertRCReturn(rc, rc); 247 273 } 248 274 } … … 703 729 } 704 730 705 case SHFL_FN_MAP_FOLDER: 706 { 707 Log(("svcCall: SHFL_FN_MAP_FOLDER\n")); 708 709 /* Verify parameter count and types. */ 710 if (cParms != SHFL_CPARMS_MAP_FOLDER) 731 /* Legacy interface */ 732 case SHFL_FN_MAP_FOLDER_OLD: 733 { 734 Log(("svcCall: SHFL_FN_MAP_FOLDER_OLD\n")); 735 736 /* Verify parameter count and types. */ 737 if (cParms != SHFL_CPARMS_MAP_FOLDER_OLD) 711 738 { 712 739 rc = VERR_INVALID_PARAMETER; … … 714 741 else if ( paParms[0].type != VBOX_HGCM_SVC_PARM_PTR /* path */ 715 742 || paParms[1].type != VBOX_HGCM_SVC_PARM_32BIT /* root */ 743 || paParms[2].type != VBOX_HGCM_SVC_PARM_32BIT /* delimiter */ 716 744 ) 717 745 { … … 726 754 727 755 /* Execute the function. */ 728 rc = vbsfMapFolder (pClient, pszMapName, delimiter, &root); 756 rc = vbsfMapFolder (pClient, pszMapName, delimiter, false, &root); 757 758 if (VBOX_SUCCESS(rc)) 759 { 760 /* Update parameters.*/ 761 paParms[1].u.uint32 = root; 762 } 763 } 764 break; 765 } 766 767 case SHFL_FN_MAP_FOLDER: 768 { 769 Log(("svcCall: SHFL_FN_MAP_FOLDER\n")); 770 771 /* Verify parameter count and types. */ 772 if (cParms != SHFL_CPARMS_MAP_FOLDER) 773 { 774 rc = VERR_INVALID_PARAMETER; 775 } 776 else if ( paParms[0].type != VBOX_HGCM_SVC_PARM_PTR /* path */ 777 || paParms[1].type != VBOX_HGCM_SVC_PARM_32BIT /* root */ 778 || paParms[2].type != VBOX_HGCM_SVC_PARM_32BIT /* delimiter */ 779 || paParms[3].type != VBOX_HGCM_SVC_PARM_32BIT /* fCaseSensitive */ 780 ) 781 { 782 rc = VERR_INVALID_PARAMETER; 783 } 784 else 785 { 786 /* Fetch parameters. */ 787 PSHFLSTRING pszMapName = (PSHFLSTRING)paParms[0].u.pointer.addr; 788 SHFLROOT root = (SHFLROOT)paParms[1].u.uint32; 789 RTUCS2 delimiter = (RTUCS2)paParms[2].u.uint32; 790 bool fCaseSensitive = !!paParms[3].u.uint32; 791 792 /* Execute the function. */ 793 rc = vbsfMapFolder (pClient, pszMapName, delimiter, fCaseSensitive, &root); 729 794 730 795 if (VBOX_SUCCESS(rc)) -
trunk/src/VBox/HostServices/SharedFolders/vbsf.cpp
r3338 r3944 240 240 if (VBOX_SUCCESS (rc)) 241 241 { 242 #if 0 243 /* When the host file system is case sensitive and the guest expects a case insensitive fs, then problems can occur */ 244 if ( vbsfIsHostMappingCaseSensitive (root) 245 && !vbsfIsGuestMappingCaseSensitive(root)) 246 { 247 RTFSOBJINFO info; 248 rc = RTPathQueryInfo (pszFullPath, &info, RTFSOBJATTRADD_NOTHING); 249 if (rc != VINF_SUCCESS) 250 { 251 char *src = pszFullPath; 252 253 Assert(rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND); 254 Log(("Handle case insenstive guest fs on top of host case sensitive fs for %ws\n", pszFullPath)); 255 while(*src) 256 { 257 if (*src == RTPATH_DELIMITER) 258 break; 259 src++; 260 } 261 Assert(*src); 262 if (*src) 263 { 264 src++; 265 for(;;) 266 { 267 char *end = src; 268 269 while(*end) 270 { 271 if (*end == RTPATH_DELIMITER) 272 break; 273 end++; 274 } 275 if (!*end) 276 break; 277 278 *end = 0; 279 280 rc = RTPathQueryInfo(src, &info, RTFSOBJATTRADD_NOTHING); 281 if (rc != VINF_SUCCESS) 282 { 283 Assert(rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND); 284 } 285 286 *end = RTPATH_DELIMITER; 287 src = end + 1; 288 } 289 } 290 291 } 292 rc = VINF_SUCCESS; 293 } 294 #endif 242 295 *ppszFullPath = pszFullPath; 243 296
Note:
See TracChangeset
for help on using the changeset viewer.