Changeset 75993 in vbox for trunk/src/VBox/HostServices/SharedFolders/mappings.cpp
- Timestamp:
- Dec 5, 2018 9:38:00 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedFolders/mappings.cpp
r75498 r75993 32 32 #include <iprt/path.h> 33 33 #include <iprt/string.h> 34 #include <VBox/AssertGuest.h> 34 35 35 36 #ifdef UNITTEST … … 722 723 } 723 724 725 SHFLROOT RootTmp; 726 if (!pRoot) 727 pRoot = &RootTmp; 724 728 if (BIT_FLAG(pClient->fu32Flags, SHFL_CF_UTF8)) 725 729 { … … 727 731 PRTUTF16 utf16Name; 728 732 729 rc = RTStrToUtf16 733 rc = RTStrToUtf16((const char *) pszMapName->String.utf8, &utf16Name); 730 734 if (RT_FAILURE (rc)) 731 735 return rc; 732 736 733 737 pFolderMapping = vbsfMappingGetByName(utf16Name, pRoot); 734 RTUtf16Free 738 RTUtf16Free(utf16Name); 735 739 } 736 740 else … … 744 748 } 745 749 750 /* 751 * Check for reference count overflows and settings compatibility. 752 * For paranoid reasons, we don't allow modifying the case sensitivity 753 * setting while there are other mappings of a folder. 754 */ 755 AssertLogRelReturn(*pRoot < RT_ELEMENTS(pClient->acMappings), VERR_INTERNAL_ERROR); 756 AssertLogRelReturn(!pClient->fHasMappingCounts || pClient->acMappings[*pRoot] < _32K, VERR_TOO_MANY_OPENS); 757 ASSERT_GUEST_LOGREL_MSG_RETURN( pFolderMapping->cMappings == 0 758 || pFolderMapping->fGuestCaseSensitive == fCaseSensitive, 759 ("Incompatible case sensitivity setting: %s: %u mappings, %ssenitive, requested %ssenitive!\n", 760 pFolderMapping->pszFolderName, pFolderMapping->cMappings, 761 pFolderMapping->fGuestCaseSensitive ? "" : "in", fCaseSensitive ? "" : "in"), 762 VERR_INCOMPATIBLE_CONFIG); 763 764 /* 765 * Go ahead and map it. 766 */ 767 if (pClient->fHasMappingCounts) 768 pClient->acMappings[*pRoot] += 1; 746 769 pFolderMapping->cMappings++; 747 Assert(pFolderMapping->cMappings == 1 || pFolderMapping->fGuestCaseSensitive == fCaseSensitive);748 770 pFolderMapping->fGuestCaseSensitive = fCaseSensitive; 771 Log(("vbsfMmapFolder (cMappings=%u, acMappings[%u]=%u)\n", pFolderMapping->cMappings, *pRoot, pClient->acMappings[*pRoot])); 749 772 return VINF_SUCCESS; 750 773 } … … 775 798 return VERR_FILE_NOT_FOUND; 776 799 } 777 778 800 Assert(pFolderMapping->fValid == true && pFolderMapping->cMappings > 0); 801 802 AssertLogRelReturn(root < RT_ELEMENTS(pClient->acMappings), VERR_INTERNAL_ERROR); 803 AssertLogRelReturn(!pClient->fHasMappingCounts || pClient->acMappings[root] > 0, VERR_INVALID_HANDLE); 804 805 if (pClient->fHasMappingCounts) 806 pClient->acMappings[root] -= 1; 807 779 808 if (pFolderMapping->cMappings > 0) 780 809 pFolderMapping->cMappings--; 781 810 782 if ( pFolderMapping->cMappings == 0 811 uint32_t const cMappings = pFolderMapping->cMappings; 812 if ( cMappings == 0 783 813 && pFolderMapping->fPlaceholder) 784 814 { … … 790 820 } 791 821 792 Log(("vbsfUnmapFolder \n"));822 Log(("vbsfUnmapFolder (cMappings=%u, acMappings[%u]=%u)\n", cMappings, root, pClient->acMappings[root])); 793 823 return rc; 794 824 }
Note:
See TracChangeset
for help on using the changeset viewer.