Changeset 69828 in vbox for trunk/src/VBox/Runtime/common/fs
- Timestamp:
- Nov 24, 2017 5:32:23 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 119259
- Location:
- trunk/src/VBox/Runtime/common/fs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/fs/fatvfs.cpp
r69826 r69828 507 507 static int rtFsFatDirShrd_PutEntryAfterUpdate(PRTFSFATDIRSHRD pThis, PFATDIRENTRY pDirEntry, uint32_t uWriteLock); 508 508 static int rtFsFatDirShrd_Flush(PRTFSFATDIRSHRD pThis); 509 static int rtFsFatDir_NewWithShared(PRTFSFATVOL pThis, PRTFSFATDIRSHRD pShared, PRTVFSDIR phVfsDir); 509 510 static int rtFsFatDir_New(PRTFSFATVOL pThis, PRTFSFATDIRSHRD pParentDir, PCFATDIRENTRY pDirEntry, uint32_t offEntryInDir, 510 511 uint32_t idxCluster, uint64_t offDisk, uint32_t cbDir, PRTVFSDIR phVfsDir); … … 4006 4007 PRTFSFATDIR pThis = (PRTFSFATDIR)pvThis; 4007 4008 PRTFSFATDIRSHRD pShared = pThis->pShared; 4009 int rc; 4010 4011 /* 4012 * Special cases '.' and '.' 4013 */ 4014 if (pszEntry[0] == '.') 4015 { 4016 PRTFSFATDIRSHRD pSharedToOpen; 4017 if (pszEntry[1] == '\0') 4018 pSharedToOpen = pShared; 4019 else if (pszEntry[1] == '.' && pszEntry[2] == '\0') 4020 { 4021 pSharedToOpen = pShared->Core.pParentDir; 4022 if (!pSharedToOpen) 4023 pSharedToOpen = pShared; 4024 } 4025 else 4026 pSharedToOpen = NULL; 4027 if (pSharedToOpen) 4028 { 4029 if (fFlags & RTVFSOBJ_F_OPEN_DIRECTORY) 4030 { 4031 if ( (fOpen & RTFILE_O_ACTION_MASK) == RTFILE_O_OPEN 4032 || (fOpen & RTFILE_O_ACTION_MASK) == RTFILE_O_OPEN_CREATE) 4033 { 4034 rtFsFatDirShrd_Retain(pSharedToOpen); 4035 RTVFSDIR hVfsDir; 4036 rc = rtFsFatDir_NewWithShared(pShared->Core.pVol, pSharedToOpen, &hVfsDir); 4037 if (RT_SUCCESS(rc)) 4038 { 4039 *phVfsObj = RTVfsObjFromDir(hVfsDir); 4040 RTVfsDirRelease(hVfsDir); 4041 AssertStmt(*phVfsObj != NIL_RTVFSOBJ, rc = VERR_INTERNAL_ERROR_3); 4042 } 4043 } 4044 else 4045 rc = VERR_ACCESS_DENIED; 4046 } 4047 else 4048 rc = VERR_IS_A_DIRECTORY; 4049 return rc; 4050 } 4051 } 4008 4052 4009 4053 /* … … 4013 4057 bool fLong; 4014 4058 FATDIRENTRY DirEntry; 4015 intrc = rtFsFatDirShrd_FindEntry(pShared, pszEntry, &offEntryInDir, &fLong, &DirEntry);4059 rc = rtFsFatDirShrd_FindEntry(pShared, pszEntry, &offEntryInDir, &fLong, &DirEntry); 4016 4060 if (RT_SUCCESS(rc)) 4017 4061 { … … 4195 4239 4196 4240 /** 4197 * @interface_method_impl{RTVFSDIROPS,pfnOpenDir}4198 */4199 static DECLCALLBACK(int) rtFsFatDir_OpenDir(void *pvThis, const char *pszSubDir, uint32_t fFlags, PRTVFSDIR phVfsDir)4200 {4201 PRTFSFATDIR pThis = (PRTFSFATDIR)pvThis;4202 PRTFSFATDIRSHRD pShared = pThis->pShared;4203 AssertReturn(!fFlags, VERR_INVALID_FLAGS);4204 4205 /*4206 * Try open directory.4207 */4208 uint32_t offEntryInDir;4209 bool fLong;4210 FATDIRENTRY DirEntry;4211 int rc = rtFsFatDirShrd_FindEntry(pShared, pszSubDir, &offEntryInDir, &fLong, &DirEntry);4212 LogFlow(("rtFsFatDir_OpenDir: FindEntry(,%s,,,) -> %Rrc fLong=%d offEntryInDir=%#RX32\n", pszSubDir, rc, fLong, offEntryInDir));4213 if (RT_SUCCESS(rc))4214 {4215 switch (DirEntry.fAttrib & (FAT_ATTR_DIRECTORY | FAT_ATTR_VOLUME))4216 {4217 case FAT_ATTR_DIRECTORY:4218 rc = rtFsFatDir_New(pShared->Core.pVol, pShared, &DirEntry, offEntryInDir,4219 RTFSFAT_GET_CLUSTER(&DirEntry, pShared->Core.pVol), UINT64_MAX /*offDisk*/,4220 DirEntry.cbFile, phVfsDir);4221 break;4222 4223 case 0:4224 rc = VERR_NOT_A_DIRECTORY;4225 break;4226 4227 default:4228 rc = VERR_PATH_NOT_FOUND;4229 break;4230 }4231 }4232 return rc;4233 }4234 4235 4236 /**4237 4241 * @interface_method_impl{RTVFSDIROPS,pfnCreateDir} 4238 4242 */ … … 4252 4256 if (rc != VERR_FILE_NOT_FOUND) 4253 4257 return RT_SUCCESS(rc) ? VERR_ALREADY_EXISTS : rc; 4258 4259 if ( strcmp(pszSubDir, ".") == 0 4260 || strcmp(pszSubDir, "..") == 0) 4261 return VERR_ALREADY_EXISTS; 4254 4262 4255 4263 /* … … 4287 4295 4288 4296 4297 #if 0 4289 4298 /** 4290 4299 * @interface_method_impl{RTVFSDIROPS,pfnQueryEntryInfo} … … 4316 4325 return rc; 4317 4326 } 4327 #endif 4318 4328 4319 4329 … … 4725 4735 NULL /* pfnFollowAbsoluteSymlink */, 4726 4736 rtFsFatDir_OpenFile, 4727 rtFsFatDir_OpenDir,4737 NULL /* pfnOpenDir */, 4728 4738 rtFsFatDir_CreateDir, 4729 4739 rtFsFatDir_OpenSymlink, 4730 4740 rtFsFatDir_CreateSymlink, 4731 rtFsFatDir_QueryEntryInfo,4741 NULL /* pfnQueryEntryInfo */, 4732 4742 rtFsFatDir_UnlinkEntry, 4733 4743 rtFsFatDir_RenameEntry, -
trunk/src/VBox/Runtime/common/fs/isovfs.cpp
r69826 r69828 461 461 static void rtFsIsoDirShrd_AddOpenChild(PRTFSISODIRSHRD pDir, PRTFSISOCORE pChild); 462 462 static void rtFsIsoDirShrd_RemoveOpenChild(PRTFSISODIRSHRD pDir, PRTFSISOCORE pChild); 463 static int rtFsIsoDir_NewWithShared(PRTFSISOVOL pThis, PRTFSISODIRSHRD pShared, PRTVFSDIR phVfsDir); 463 464 static int rtFsIsoDir_New9660(PRTFSISOVOL pThis, PRTFSISODIRSHRD pParentDir, PCISO9660DIRREC pDirRec, 464 465 uint32_t cDirRecs, uint64_t offDirRec, PRTVFSDIR phVfsDir); … … 2897 2898 PRTFSISODIROBJ pThis = (PRTFSISODIROBJ)pvThis; 2898 2899 PRTFSISODIRSHRD pShared = pThis->pShared; 2900 int rc; 2899 2901 2900 2902 /* 2901 2903 * We cannot create or replace anything, just open stuff. 2902 2904 */ 2903 if ( (fOpen & RTFILE_O_ACTION_MASK) == RTFILE_O_CREATE 2904 || (fOpen & RTFILE_O_ACTION_MASK) == RTFILE_O_CREATE_REPLACE) 2905 if ( (fOpen & RTFILE_O_ACTION_MASK) == RTFILE_O_OPEN 2906 || (fOpen & RTFILE_O_ACTION_MASK) == RTFILE_O_OPEN_CREATE) 2907 { /* likely */ } 2908 else 2905 2909 return VERR_WRITE_PROTECT; 2906 2910 2907 2911 /* 2912 * Special cases '.' and '.' 2913 */ 2914 if (pszEntry[0] == '.') 2915 { 2916 PRTFSISODIRSHRD pSharedToOpen; 2917 if (pszEntry[1] == '\0') 2918 pSharedToOpen = pShared; 2919 else if (pszEntry[1] == '.' && pszEntry[2] == '\0') 2920 { 2921 pSharedToOpen = pShared->Core.pParentDir; 2922 if (!pSharedToOpen) 2923 pSharedToOpen = pShared; 2924 } 2925 else 2926 pSharedToOpen = NULL; 2927 if (pSharedToOpen) 2928 { 2929 if (fFlags & RTVFSOBJ_F_OPEN_DIRECTORY) 2930 { 2931 rtFsIsoDirShrd_Retain(pSharedToOpen); 2932 RTVFSDIR hVfsDir; 2933 rc = rtFsIsoDir_NewWithShared(pShared->Core.pVol, pSharedToOpen, &hVfsDir); 2934 if (RT_SUCCESS(rc)) 2935 { 2936 *phVfsObj = RTVfsObjFromDir(hVfsDir); 2937 RTVfsDirRelease(hVfsDir); 2938 AssertStmt(*phVfsObj != NIL_RTVFSOBJ, rc = VERR_INTERNAL_ERROR_3); 2939 } 2940 } 2941 else 2942 rc = VERR_IS_A_DIRECTORY; 2943 return rc; 2944 } 2945 } 2946 2947 /* 2908 2948 * Try open whatever it is. 2909 2949 */ 2910 int rc;2911 2950 if (pShared->Core.pVol->enmType != RTFSISOVOLTYPE_UDF) 2912 2951 { 2952 2913 2953 /* 2914 2954 * ISO 9660 … … 3112 3152 3113 3153 3154 #if 0 3114 3155 /** 3115 3156 * @interface_method_impl{RTVFSDIROPS,pfnOpenDir} … … 3185 3226 return rc; 3186 3227 } 3228 #endif 3187 3229 3188 3230 … … 3218 3260 3219 3261 3262 #if 0 3220 3263 /** 3221 3264 * @interface_method_impl{RTVFSDIROPS,pfnQueryEntryInfo} … … 3281 3324 return rc; 3282 3325 } 3326 #endif 3283 3327 3284 3328 … … 3693 3737 NULL /* pfnFollowAbsoluteSymlink */, 3694 3738 rtFsIsoDir_OpenFile, 3695 rtFsIsoDir_OpenDir,3739 NULL /* pfnOpenDir */, 3696 3740 rtFsIsoDir_CreateDir, 3697 3741 rtFsIsoDir_OpenSymlink, 3698 3742 rtFsIsoDir_CreateSymlink, 3699 rtFsIsoDir_QueryEntryInfo,3743 NULL /* pfnQueryEntryInfo */, 3700 3744 rtFsIsoDir_UnlinkEntry, 3701 3745 rtFsIsoDir_RenameEntry,
Note:
See TracChangeset
for help on using the changeset viewer.