Changeset 31002 in vbox for trunk/src/VBox/HostServices
- Timestamp:
- Jul 22, 2010 2:45:41 PM (15 years ago)
- Location:
- trunk/src/VBox/HostServices/SharedFolders
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedFolders/mappings.cpp
r28800 r31002 171 171 172 172 /* 173 *174 173 * We are always executed from one specific HGCM thread. So thread safe. 175 *176 174 */ 177 int vbsfMappingsAdd (PSHFLSTRING pFolderName, PSHFLSTRING pMapName, uint32_t fWritable) 175 int vbsfMappingsAdd (PSHFLSTRING pFolderName, PSHFLSTRING pMapName, 176 uint32_t fWritable, uint32_t fAutoMount) 178 177 { 179 178 unsigned i; … … 218 217 memcpy(FolderMapping[i].pMapName->String.ucs2, pMapName->String.ucs2, pMapName->u16Size); 219 218 220 FolderMapping[i].fValid = true; 221 FolderMapping[i].cMappings = 0; 222 FolderMapping[i].fWritable = !!fWritable; 219 FolderMapping[i].fValid = true; 220 FolderMapping[i].cMappings = 0; 221 FolderMapping[i].fWritable = !!fWritable; 222 FolderMapping[i].fAutoMount = !!fAutoMount; 223 223 224 224 /* Check if the host file system is case sensitive */ … … 343 343 { 344 344 MAPPING *pFolderMapping = vbsfMappingGetByRoot(i); 345 if (pFolderMapping != NULL && pFolderMapping->fValid == true) 346 { 345 if ( pFolderMapping != NULL 346 && pFolderMapping->fValid == true) 347 { 348 /* Skip mappings which are not marked for auto-mounting if 349 * the SHFL_MF_AUTOMOUNT flag ist set. */ 350 if ( (pClient->fu32Flags & SHFL_MF_AUTOMOUNT) 351 && !pFolderMapping->fAutoMount) 352 continue; 353 347 354 pMappings[*pcMappings].u32Status = SHFL_MS_NEW; 348 355 pMappings[*pcMappings].root = i; … … 350 357 } 351 358 } 352 353 359 LogFlow(("vbsfMappingsQuery: return rc = %Rrc\n", rc)); 354 355 360 return rc; 356 361 } … … 371 376 if (BIT_FLAG(pClient->fu32Flags, SHFL_CF_UTF8)) 372 377 { 373 /* not implemented*/378 /* Not implemented. */ 374 379 AssertFailed(); 375 380 return VERR_INVALID_PARAMETER; … … 412 417 } 413 418 419 int vbsfMappingsQueryAutoMount (SHFLCLIENTDATA *pClient, SHFLROOT root, bool *fAutoMount) 420 { 421 int rc = VINF_SUCCESS; 422 423 LogFlow(("vbsfMappingsQueryAutoMount: pClient = %p, root = %d\n", 424 pClient, root)); 425 426 MAPPING *pFolderMapping = vbsfMappingGetByRoot(root); 427 if (pFolderMapping == NULL) 428 { 429 return VERR_INVALID_PARAMETER; 430 } 431 432 if (pFolderMapping->fValid == true) 433 *fAutoMount = pFolderMapping->fAutoMount; 434 else 435 rc = VERR_FILE_NOT_FOUND; 436 437 LogFlow(("vbsfMappingsQueryAutoMount:Writable return rc = %Rrc\n", rc)); 438 439 return rc; 440 } 441 414 442 int vbsfMapFolder (SHFLCLIENTDATA *pClient, PSHFLSTRING pszMapName, RTUTF16 delimiter, bool fCaseSensitive, SHFLROOT *pRoot) 415 443 { -
trunk/src/VBox/HostServices/SharedFolders/mappings.h
r28800 r31002 4 4 5 5 /* 6 * Copyright (C) 2006-20 07Oracle Corporation6 * Copyright (C) 2006-2010 Oracle Corporation 7 7 * 8 8 * This file is part of VirtualBox Open Source Edition (OSE), as … … 30 30 bool fGuestCaseSensitive; 31 31 bool fWritable; 32 bool fAutoMount; 32 33 } MAPPING, *PMAPPING; 33 34 … … 36 37 bool vbsfMappingQuery(uint32_t iMapping, PMAPPING *pMapping); 37 38 38 int vbsfMappingsAdd (PSHFLSTRING pFolderName, PSHFLSTRING pMapName, uint32_t fWritable);39 int vbsfMappingsRemove 39 int vbsfMappingsAdd(PSHFLSTRING pFolderName, PSHFLSTRING pMapName, uint32_t fWritable, uint32_t fAutoMount); 40 int vbsfMappingsRemove(PSHFLSTRING pMapName); 40 41 41 int vbsfMappingsQuery 42 int vbsfMappingsQueryName 43 int vbsfMappingsQueryWritable 42 int vbsfMappingsQuery(SHFLCLIENTDATA *pClient, SHFLMAPPING *pMappings, uint32_t *pcMappings); 43 int vbsfMappingsQueryName(SHFLCLIENTDATA *pClient, SHFLROOT root, SHFLSTRING *pString); 44 int vbsfMappingsQueryWritable(SHFLCLIENTDATA *pClient, SHFLROOT root, bool *fWritable); 44 45 45 int vbsfMapFolder 46 int vbsfUnmapFolder 46 int vbsfMapFolder(SHFLCLIENTDATA *pClient, PSHFLSTRING pszMapName, RTUTF16 delimiter, bool fCaseSensitive, SHFLROOT *pRoot); 47 int vbsfUnmapFolder(SHFLCLIENTDATA *pClient, SHFLROOT root); 47 48 48 PCRTUTF16 49 bool 50 bool 49 PCRTUTF16 vbsfMappingsQueryHostRoot (SHFLROOT root, uint32_t *pcbRoot); 50 bool vbsfIsGuestMappingCaseSensitive (SHFLROOT root); 51 bool vbsfIsHostMappingCaseSensitive (SHFLROOT root); 51 52 52 53 int vbsfMappingLoaded (const MAPPING *pLoadedMapping, SHFLROOT root); -
trunk/src/VBox/HostServices/SharedFolders/service.cpp
r30502 r31002 310 310 311 311 /* Verify parameters values. */ 312 if ( (fu32Flags & ~SHFL_MF_ UTF8) != 0313 || cbMappings / sizeof (SHFLMAPPING) <cMappings312 if ( (fu32Flags & ~SHFL_MF_MASK) != 0 313 || cbMappings / sizeof (SHFLMAPPING) != cMappings 314 314 ) 315 315 { … … 320 320 /* Execute the function. */ 321 321 if (fu32Flags & SHFL_MF_UTF8) 322 {323 322 pClient->fu32Flags |= SHFL_CF_UTF8; 324 }325 326 rc = vbsfMappingsQuery (pClient, pMappings, &cMappings); 327 328 if (RT_SUCCESS(rc)) 329 { 330 /* Update parameters. */323 if (fu32Flags & SHFL_MF_AUTOMOUNT) 324 pClient->fu32Flags |= SHFL_MF_AUTOMOUNT; 325 326 rc = vbsfMappingsQuery(pClient, pMappings, &cMappings); 327 if (RT_SUCCESS(rc)) 328 { 329 /* Update parameters. */ 331 330 paParms[1].u.uint32 = cMappings; 332 331 } … … 346 345 rc = VERR_INVALID_PARAMETER; 347 346 } 348 else if ( paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT /* root*/349 || paParms[1].type != VBOX_HGCM_SVC_PARM_PTR /* name*/347 else if ( paParms[0].type != VBOX_HGCM_SVC_PARM_32BIT /* Root. */ 348 || paParms[1].type != VBOX_HGCM_SVC_PARM_PTR /* Name. */ 350 349 ) 351 350 { … … 366 365 { 367 366 /* Execute the function. */ 368 rc = vbsfMappingsQueryName 367 rc = vbsfMappingsQueryName(pClient, root, pString); 369 368 370 369 if (RT_SUCCESS(rc)) 371 370 { 372 371 /* Update parameters.*/ 373 ; /* none*/372 ; /* None. */ 374 373 } 375 374 } … … 1162 1161 1163 1162 /* Verify parameter count and types. */ 1164 if (cParms != SHFL_CPARMS_ADD_MAPPING) 1163 if ( (cParms != SHFL_CPARMS_ADD_MAPPING) 1164 && (cParms != SHFL_CPARMS_ADD_MAPPING2) /* With auto-mount flag. */ 1165 ) 1165 1166 { 1166 1167 rc = VERR_INVALID_PARAMETER; … … 1169 1170 || paParms[1].type != VBOX_HGCM_SVC_PARM_PTR /* guest map name */ 1170 1171 || paParms[2].type != VBOX_HGCM_SVC_PARM_32BIT /* fWritable */ 1171 ) 1172 /* With auto-mount flag? */ 1173 || ( cParms == SHFL_CPARMS_ADD_MAPPING2 1174 && paParms[3].type != VBOX_HGCM_SVC_PARM_32BIT)) 1172 1175 { 1173 1176 rc = VERR_INVALID_PARAMETER; … … 1179 1182 SHFLSTRING *pMapName = (SHFLSTRING *)paParms[1].u.pointer.addr; 1180 1183 uint32_t fWritable = paParms[2].u.uint32; 1184 uint32_t fAutoMount = 0; /* Disabled by default. */ 1185 1186 /* Handle auto-mount flag if present. */ 1187 if (cParms == SHFL_CPARMS_ADD_MAPPING2) 1188 fAutoMount = paParms[3].u.uint32; 1181 1189 1182 1190 /* Verify parameters values. */ … … 1190 1198 { 1191 1199 /* Execute the function. */ 1192 rc = vbsfMappingsAdd (pFolderName, pMapName, fWritable); 1193 1200 rc = vbsfMappingsAdd(pFolderName, pMapName, fWritable, fAutoMount); 1194 1201 if (RT_SUCCESS(rc)) 1195 1202 {
Note:
See TracChangeset
for help on using the changeset viewer.