Changeset 69818 in vbox for trunk/src/VBox/Runtime/common/vfs
- Timestamp:
- Nov 23, 2017 7:44:07 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 119242
- Location:
- trunk/src/VBox/Runtime/common/vfs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp
r69816 r69818 92 92 Assert((pDirOps)->uVersion == RTVFSDIROPS_VERSION); \ 93 93 Assert(!(pDirOps)->fReserved); \ 94 AssertPtr((pDirOps)->pfn TraversalOpen); \95 AssertPtr ((pDirOps)->pfnOpenFile); \96 AssertPtr ((pDirOps)->pfnOpenDir); \97 AssertPtr ((pDirOps)->pfnCreateDir); \98 AssertPtr ((pDirOps)->pfnOpenSymlink); \94 AssertPtr((pDirOps)->pfnOpen); \ 95 AssertPtrNull((pDirOps)->pfnOpenFile); \ 96 AssertPtrNull((pDirOps)->pfnOpenDir); \ 97 AssertPtrNull((pDirOps)->pfnCreateDir); \ 98 AssertPtrNull((pDirOps)->pfnOpenSymlink); \ 99 99 AssertPtr((pDirOps)->pfnCreateSymlink); \ 100 100 AssertPtr((pDirOps)->pfnUnlinkEntry); \ … … 1697 1697 RTVFSSYMLINK hSymlink = NIL_RTVFSSYMLINK; 1698 1698 RTVFS hVfsMnt = NIL_RTVFS; 1699 RTVFSOBJ hVfsObj = NIL_RTVFSOBJ; 1699 1700 if (fFinal) 1700 1701 { 1701 1702 RTVfsLockAcquireRead(pCurDir->Base.hLock); 1702 rc = pCurDir->pOps->pfnTraversalOpen(pCurDir->Base.pvThis, pszEntry, NULL, &hSymlink, NULL); 1703 rc = pCurDir->pOps->pfnOpen(pCurDir->Base.pvThis, pszEntry, 1704 RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE, 1705 RTVFSOBJ_F_OPEN_SYMLINK | RTVFSOBJ_F_CREATE_NOTHING 1706 | RTVFSOBJ_F_TRAVERSAL | RTPATH_F_ON_LINK, 1707 &hVfsObj); 1703 1708 RTVfsLockReleaseRead(pCurDir->Base.hLock); 1704 1709 *pszEntryEnd = '\0'; 1705 if ( rc == VERR_PATH_NOT_FOUND1706 || rc == VERR_FILE_NOT_FOUND1707 || rc == VERR_NOT_A_DIRECTORY1708 || rc == VERR_NOT_SYMLINK)1709 rc = VINF_SUCCESS;1710 1710 if (RT_FAILURE(rc)) 1711 { 1712 if ( rc == VERR_PATH_NOT_FOUND 1713 || rc == VERR_FILE_NOT_FOUND 1714 || rc == VERR_IS_A_DIRECTORY 1715 || rc == VERR_IS_A_FILE 1716 || rc == VERR_IS_A_FIFO 1717 || rc == VERR_IS_A_SOCKET 1718 || rc == VERR_IS_A_CHAR_DEVICE 1719 || rc == VERR_IS_A_BLOCK_DEVICE 1720 || rc == VERR_NOT_SYMLINK) 1721 { 1722 *ppVfsParentDir = pCurDir; 1723 return VINF_SUCCESS; 1724 } 1711 1725 break; 1712 1713 if (hSymlink == NIL_RTVFSSYMLINK)1714 {1715 *ppVfsParentDir = pCurDir;1716 return VINF_SUCCESS;1717 1726 } 1727 hSymlink = RTVfsObjToSymlink(hVfsObj); 1728 Assert(hSymlink != NIL_RTVFSSYMLINK); 1718 1729 } 1719 1730 else 1720 1731 { 1721 1732 RTVfsLockAcquireRead(pCurDir->Base.hLock); 1722 rc = pCurDir->pOps->pfnTraversalOpen(pCurDir->Base.pvThis, pszEntry, &hDir, &hSymlink, &hVfsMnt); 1733 rc = pCurDir->pOps->pfnOpen(pCurDir->Base.pvThis, pszEntry, 1734 RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_NONE, 1735 RTVFSOBJ_F_OPEN_DIRECTORY | RTVFSOBJ_F_OPEN_SYMLINK | RTVFSOBJ_F_OPEN_MOUNT 1736 | RTVFSOBJ_F_CREATE_NOTHING | RTVFSOBJ_F_TRAVERSAL | RTPATH_F_ON_LINK, 1737 &hVfsObj); 1723 1738 RTVfsLockReleaseRead(pCurDir->Base.hLock); 1724 1739 *pszEntryEnd = '/'; 1725 1740 if (RT_FAILURE(rc)) 1726 break;1727 1728 if ( hDir == NIL_RTVFSDIR1729 && hSymlink == NIL_RTVFSSYMLINK1730 && hVfsMnt == NIL_RTVFS)1731 1741 { 1732 rc = VERR_NOT_A_DIRECTORY; 1742 if (rc == VERR_FILE_NOT_FOUND) 1743 rc = VERR_PATH_NOT_FOUND; 1733 1744 break; 1734 1745 } 1746 hDir = RTVfsObjToDir(hVfsObj); 1747 hSymlink = RTVfsObjToSymlink(hVfsObj); 1748 hVfsMnt = RTVfsObjToVfs(hVfsObj); 1735 1749 } 1736 1750 Assert( (hDir != NIL_RTVFSDIR && hSymlink == NIL_RTVFSSYMLINK && hVfsMnt == NIL_RTVFS) 1737 1751 || (hDir == NIL_RTVFSDIR && hSymlink != NIL_RTVFSSYMLINK && hVfsMnt == NIL_RTVFS) 1738 1752 || (hDir == NIL_RTVFSDIR && hSymlink == NIL_RTVFSSYMLINK && hVfsMnt != NIL_RTVFS)); 1753 RTVfsObjRelease(hVfsObj); 1739 1754 1740 1755 if (hDir != NIL_RTVFSDIR) … … 2613 2628 if (RT_SUCCESS(rc)) 2614 2629 { 2615 if ( !pPath->fDirSlash 2616 && pPath->cComponents > 0) 2630 if (pPath->cComponents > 0) 2617 2631 { 2618 2632 /* … … 2621 2635 */ 2622 2636 RTVFSDIRINTERNAL *pVfsParentDir; 2623 rc = rtVfsDirTraverseToParent(pThis, pPath, RTPATH_F_FOLLOW_LINK, &pVfsParentDir); 2637 rc = rtVfsDirTraverseToParent(pThis, pPath, 2638 (fOpen & RTFILE_O_NO_SYMLINKS ? RTPATH_F_NO_SYMLINKS : 0) | RTPATH_F_FOLLOW_LINK, 2639 &pVfsParentDir); 2624 2640 if (RT_SUCCESS(rc)) 2625 2641 { 2626 2642 const char *pszEntryName = &pPath->szPath[pPath->aoffComponents[pPath->cComponents - 1]]; 2627 2643 2628 /** @todo there is a symlink creation race here. */ 2629 RTVfsLockAcquireWrite(pVfsParentDir->Base.hLock); 2630 rc = pVfsParentDir->pOps->pfnOpenFile(pVfsParentDir->Base.pvThis, pszEntryName, fOpen, phVfsFile); 2631 RTVfsLockReleaseWrite(pVfsParentDir->Base.hLock); 2632 2633 RTVfsDirRelease(pVfsParentDir); 2644 if ( pVfsParentDir->pOps->pfnOpenFile == NULL 2645 || pPath->fDirSlash) 2646 { 2647 RTVFSOBJ hVfsObj; 2648 RTVfsLockAcquireWrite(pVfsParentDir->Base.hLock); 2649 rc = pVfsParentDir->pOps->pfnOpen(pVfsParentDir->Base.pvThis, pszEntryName, fOpen, 2650 RTVFSOBJ_F_OPEN_ANY_FILE | RTVFSOBJ_F_CREATE_FILE 2651 | RTPATH_F_FOLLOW_LINK, &hVfsObj); 2652 RTVfsLockReleaseWrite(pVfsParentDir->Base.hLock); 2653 if (RT_SUCCESS(rc)) 2654 { 2655 if (RTVfsObjGetType(hVfsObj) != RTVFSOBJTYPE_SYMLINK) 2656 *phVfsFile = RTVfsObjToFile(hVfsObj); 2657 else 2658 { 2659 /** @todo parse symbolic links. */ 2660 AssertFailed(); 2661 rc = VERR_NOT_IMPLEMENTED; 2662 } 2663 RTVfsObjRelease(hVfsObj); 2664 } 2665 } 2666 else 2667 { 2668 /** @todo there is a symlink creation race here. */ 2669 RTVfsLockAcquireWrite(pVfsParentDir->Base.hLock); 2670 rc = pVfsParentDir->pOps->pfnOpenFile(pVfsParentDir->Base.pvThis, pszEntryName, fOpen, phVfsFile); 2671 RTVfsLockReleaseWrite(pVfsParentDir->Base.hLock); 2672 } 2634 2673 2635 2674 if (RT_SUCCESS(rc)) … … 2638 2677 Assert((*phVfsFile)->uMagic == RTVFSFILE_MAGIC); 2639 2678 } 2679 2680 RTVfsDirRelease(pVfsParentDir); 2640 2681 } 2641 2682 } … … 2682 2723 2683 2724 /* 2684 * Parse the relative path. 2725 * Parse the relative path. If it ends with a directory slash or it boils 2726 * down to an empty path (i.e. re-opening hVfsDir), adjust the flags to only 2727 * open/create directories. 2685 2728 */ 2686 2729 PRTVFSPARSEDPATH pPath; … … 2690 2733 if ( pPath->fDirSlash 2691 2734 || pPath->cComponents == 0) 2735 { 2692 2736 fObjFlags &= ~RTVFSOBJ_F_OPEN_ANY | RTVFSOBJ_F_OPEN_DIRECTORY; 2693 2737 if ((fObjFlags & RTVFSOBJ_F_CREATE_MASK) != RTVFSOBJ_F_CREATE_DIRECTORY) 2738 fObjFlags = (fObjFlags & ~RTVFSOBJ_F_CREATE_MASK) | RTVFSOBJ_F_CREATE_NOTHING; 2739 } 2740 2741 /* 2742 * Tranverse the path, resolving the parent node, not checking for 2743 * symbolic links in the final element. 2744 */ 2745 const char *pszEntryName; 2746 RTVFSDIRINTERNAL *pVfsParentDir; 2694 2747 if (pPath->cComponents > 0) 2695 2748 { 2749 rc = rtVfsDirTraverseToParent(pThis, pPath, fObjFlags & RTPATH_F_MASK, &pVfsParentDir); 2750 pszEntryName = &pPath->szPath[pPath->aoffComponents[pPath->cComponents - 1]]; 2751 } 2752 else 2753 { 2754 RTVfsDirRetain(pThis); 2755 pVfsParentDir = pThis; 2756 pszEntryName = "."; 2757 } 2758 if (RT_SUCCESS(rc)) 2759 { 2696 2760 /* 2697 * Tranverse the path, resolving the parent node, not 2698 * checking for symbolic links in the final element. 2761 * Do the opening. 2699 2762 */ 2700 RTVFSDIRINTERNAL *pVfsParentDir; 2701 rc = rtVfsDirTraverseToParent(pThis, pPath, RTPATH_F_ON_LINK, &pVfsParentDir); 2702 if (RT_SUCCESS(rc)) 2763 RTVfsLockAcquireWrite(pVfsParentDir->Base.hLock); 2764 rc = pVfsParentDir->pOps->pfnOpen(pVfsParentDir->Base.pvThis, pszEntryName, fFileOpen, fObjFlags, phVfsObj); 2765 RTVfsLockReleaseWrite(pVfsParentDir->Base.hLock); 2766 2767 if ( (fObjFlags & RTPATH_F_FOLLOW_LINK) 2768 && RTVfsObjGetType(*phVfsObj) == RTVFSOBJTYPE_SYMLINK) 2703 2769 { 2704 const char *pszEntryName = &pPath->szPath[pPath->aoffComponents[pPath->cComponents - 1]]; 2705 2706 /* 2707 * If we've got a trailing directory slash, use pfnOpenDir 2708 * instead of pfnOpenObj. 2709 */ 2710 if (pPath->fDirSlash) 2711 { 2712 RTVFSDIR hVfsSubDir; 2713 RTVfsLockAcquireWrite(pVfsParentDir->Base.hLock); 2714 rc = pVfsParentDir->pOps->pfnOpenDir(pVfsParentDir->Base.pvThis, pszEntryName, 2715 0 /** @todo fFlags*/, &hVfsSubDir); 2716 RTVfsLockReleaseWrite(pVfsParentDir->Base.hLock); 2717 if (RT_SUCCESS(rc)) 2718 { 2719 *phVfsObj = RTVfsObjFromDir(hVfsSubDir); 2720 RTVfsDirRelease(hVfsSubDir); 2721 AssertStmt(*phVfsObj != NIL_RTVFSOBJ, rc = VERR_INTERNAL_ERROR_3); 2722 } 2723 } 2724 else 2725 { 2726 RTVfsLockAcquireWrite(pVfsParentDir->Base.hLock); 2727 rc = pVfsParentDir->pOps->pfnOpen(pVfsParentDir->Base.pvThis, pszEntryName, fFileOpen, fObjFlags, phVfsObj); 2728 RTVfsLockReleaseWrite(pVfsParentDir->Base.hLock); 2729 } 2730 RTVfsDirRelease(pVfsParentDir); 2770 /** @todo implement following symbolic links. */ 2771 AssertFailed(); 2772 RTVfsObjRelease(*phVfsObj); 2773 *phVfsObj = NIL_RTVFSOBJ; 2774 rc = VERR_NOT_IMPLEMENTED; 2731 2775 } 2732 } 2733 /* 2734 * The path boils down to '.', call pfnOpenDir on pThis with '.' as input. 2735 * The caller may wish for a new directory instance to enumerate the entries 2736 * in parallel or some such thing. 2737 */ 2738 else 2739 { 2740 RTVFSDIR hVfsSubDir; 2741 RTVfsLockAcquireWrite(pThis->Base.hLock); 2742 rc = pThis->pOps->pfnOpenDir(pThis->Base.pvThis, ".", 0 /** @todo fFlags*/, &hVfsSubDir); 2743 RTVfsLockReleaseWrite(pThis->Base.hLock); 2744 if (RT_SUCCESS(rc)) 2745 { 2746 *phVfsObj = RTVfsObjFromDir(hVfsSubDir); 2747 RTVfsDirRelease(hVfsSubDir); 2748 AssertStmt(*phVfsObj != NIL_RTVFSOBJ, rc = VERR_INTERNAL_ERROR_3); 2749 } 2750 } 2751 2776 2777 RTVfsDirRelease(pVfsParentDir); 2778 } 2752 2779 RTVfsParsePathFree(pPath); 2753 2780 } -
trunk/src/VBox/Runtime/common/vfs/vfsstddir.cpp
r69813 r69818 251 251 252 252 253 254 /** 255 * @interface_method_impl{RTVFSDIROPS,pfnTraversalOpen} 256 */ 257 static DECLCALLBACK(int) rtVfsStdDir_TraversalOpen(void *pvThis, const char *pszEntry, PRTVFSDIR phVfsDir, 258 PRTVFSSYMLINK phVfsSymlink, PRTVFS phVfsMounted) 259 { 260 /* No union mounting or mount points here (yet). */ 261 if (phVfsMounted) 262 *phVfsMounted = NIL_RTVFS; 263 264 int rc; 265 if (phVfsDir || phVfsSymlink) 266 { 267 if (phVfsDir) 268 *phVfsDir = NIL_RTVFSDIR; 269 if (phVfsSymlink) 270 *phVfsSymlink = NIL_RTVFSSYMLINK; 271 272 RTFSOBJINFO ObjInfo; 273 rc = rtVfsStdDir_QueryEntryInfo(pvThis, pszEntry, &ObjInfo, RTFSOBJATTRADD_NOTHING); 274 if (RT_SUCCESS(rc)) 275 { 276 switch (ObjInfo.Attr.fMode & RTFS_TYPE_MASK) 277 { 278 case RTFS_TYPE_DIRECTORY: 279 if (phVfsDir) 280 rc = rtVfsStdDir_OpenDir(pvThis, pszEntry, 0, phVfsDir); 281 else 282 rc = VERR_NOT_SYMLINK; 283 break; 284 285 case RTFS_TYPE_SYMLINK: 286 if (phVfsSymlink) 287 rc = rtVfsStdDir_OpenSymlink(pvThis, pszEntry, phVfsSymlink); 288 else 289 rc = VERR_NOT_A_DIRECTORY; 290 break; 291 292 default: 293 rc = phVfsDir ? VERR_NOT_A_DIRECTORY : VERR_NOT_SYMLINK; 294 break; 295 } 296 } 297 } 298 else 299 rc = VERR_PATH_NOT_FOUND; 300 301 LogFlow(("rtVfsStdDir_TraversalOpen: %s -> %Rrc\n", pszEntry, rc)); 302 return rc; 303 } 304 305 306 /** 307 * @interface_method_impl{RTVFSDIROPS,pfnOpenObj} 308 */ 309 static DECLCALLBACK(int) rtVfsStdDir_OpenObj(void *pvThis, const char *pszEntry, uint64_t fOpen, 310 uint32_t fFlags, PRTVFSOBJ phVfsObj) 253 /** 254 * @interface_method_impl{RTVFSDIROPS,pfnOpen} 255 */ 256 static DECLCALLBACK(int) rtVfsStdDir_Open(void *pvThis, const char *pszEntry, uint64_t fFileOpen, 257 uint32_t fVfsFlags, PRTVFSOBJ phVfsObj) 311 258 { 312 259 PRTVFSSTDDIR pThis = (PRTVFSSTDDIR)pvThis; … … 323 270 { 324 271 case RTFS_TYPE_DIRECTORY: 325 if (!(f Flags & RTVFSOBJ_F_OPEN_DIRECTORY))272 if (!(fVfsFlags & RTVFSOBJ_F_OPEN_DIRECTORY)) 326 273 { 327 if ( (f Open & RTFILE_O_ACTION_MASK) == RTFILE_O_OPEN328 || (f Open & RTFILE_O_ACTION_MASK) == RTFILE_O_OPEN_CREATE329 || (f Open & RTFILE_O_ACTION_MASK) == RTFILE_O_CREATE_REPLACE)274 if ( (fFileOpen & RTFILE_O_ACTION_MASK) == RTFILE_O_OPEN 275 || (fFileOpen & RTFILE_O_ACTION_MASK) == RTFILE_O_OPEN_CREATE 276 || (fFileOpen & RTFILE_O_ACTION_MASK) == RTFILE_O_CREATE_REPLACE) 330 277 { 331 278 RTDIR hSubDir; 332 rc = RTDirRelDirOpenFiltered(pThis->hDir, pszEntry, RTDIRFILTER_NONE, f Flags, &hSubDir);279 rc = RTDirRelDirOpenFiltered(pThis->hDir, pszEntry, RTDIRFILTER_NONE, fVfsFlags, &hSubDir); 333 280 if (RT_SUCCESS(rc)) 334 281 { … … 339 286 *phVfsObj = RTVfsObjFromDir(hVfsDir); 340 287 RTVfsDirRelease(hVfsDir); 341 AssertStmt(*phVfsObj == NIL_RTVFSOBJ, rc = VERR_INTERNAL_ERROR_3);288 AssertStmt(*phVfsObj != NIL_RTVFSOBJ, rc = VERR_INTERNAL_ERROR_3); 342 289 } 343 290 else … … 360 307 { 361 308 case RTFS_TYPE_FILE: 362 rc = f Flags & RTVFSOBJ_F_OPEN_FILE ? VINF_SUCCESS : VERR_IS_A_FILE;309 rc = fVfsFlags & RTVFSOBJ_F_OPEN_FILE ? VINF_SUCCESS : VERR_IS_A_FILE; 363 310 break; 364 311 case RTFS_TYPE_DEV_BLOCK: 365 rc = f Flags & RTVFSOBJ_F_OPEN_DEV_BLOCK ? VINF_SUCCESS : VERR_IS_A_BLOCK_DEVICE;312 rc = fVfsFlags & RTVFSOBJ_F_OPEN_DEV_BLOCK ? VINF_SUCCESS : VERR_IS_A_BLOCK_DEVICE; 366 313 break; 367 314 case RTFS_TYPE_DEV_CHAR: 368 rc = f Flags & RTVFSOBJ_F_OPEN_DEV_CHAR ? VINF_SUCCESS : VERR_IS_A_CHAR_DEVICE;315 rc = fVfsFlags & RTVFSOBJ_F_OPEN_DEV_CHAR ? VINF_SUCCESS : VERR_IS_A_CHAR_DEVICE; 369 316 break; 370 317 /** @todo These two types should not result in files, but pure I/O streams. 371 318 * possibly char device too. */ 372 319 case RTFS_TYPE_FIFO: 373 rc = f Flags & RTVFSOBJ_F_OPEN_FIFO ? VINF_SUCCESS : VERR_IS_A_FIFO;320 rc = fVfsFlags & RTVFSOBJ_F_OPEN_FIFO ? VINF_SUCCESS : VERR_IS_A_FIFO; 374 321 break; 375 322 case RTFS_TYPE_SOCKET: 376 rc = f Flags & RTVFSOBJ_F_OPEN_SOCKET ? VINF_SUCCESS : VERR_IS_A_SOCKET;323 rc = fVfsFlags & RTVFSOBJ_F_OPEN_SOCKET ? VINF_SUCCESS : VERR_IS_A_SOCKET; 377 324 break; 378 325 default: … … 382 329 if (RT_SUCCESS(rc)) 383 330 { 384 if ( (f Open & RTFILE_O_ACTION_MASK) == RTFILE_O_OPEN385 || (f Open & RTFILE_O_ACTION_MASK) == RTFILE_O_OPEN_CREATE386 || (f Open & RTFILE_O_ACTION_MASK) == RTFILE_O_CREATE_REPLACE)331 if ( (fFileOpen & RTFILE_O_ACTION_MASK) == RTFILE_O_OPEN 332 || (fFileOpen & RTFILE_O_ACTION_MASK) == RTFILE_O_OPEN_CREATE 333 || (fFileOpen & RTFILE_O_ACTION_MASK) == RTFILE_O_CREATE_REPLACE) 387 334 { 388 335 RTFILE hFile; 389 rc = RTDirRelFileOpen(pThis->hDir, pszEntry, f Open, &hFile);336 rc = RTDirRelFileOpen(pThis->hDir, pszEntry, fFileOpen, &hFile); 390 337 if (RT_SUCCESS(rc)) 391 338 { 392 339 RTVFSFILE hVfsFile; 393 rc = RTVfsFileFromRTFile(hFile, f Open, false /*fLeaveOpen*/, &hVfsFile);340 rc = RTVfsFileFromRTFile(hFile, fFileOpen, false /*fLeaveOpen*/, &hVfsFile); 394 341 if (RT_SUCCESS(rc)) 395 342 { 396 343 *phVfsObj = RTVfsObjFromFile(hVfsFile); 397 344 RTVfsFileRelease(hVfsFile); 398 AssertStmt(*phVfsObj == NIL_RTVFSOBJ, rc = VERR_INTERNAL_ERROR_3);345 AssertStmt(*phVfsObj != NIL_RTVFSOBJ, rc = VERR_INTERNAL_ERROR_3); 399 346 } 400 347 else … … 408 355 409 356 case RTFS_TYPE_SYMLINK: 410 if (f Flags & RTVFSOBJ_F_OPEN_SYMLINK)357 if (fVfsFlags & RTVFSOBJ_F_OPEN_SYMLINK) 411 358 { 412 359 uint32_t cRefs = RTVfsDirRetain(pThis->hSelf); … … 448 395 * Consider file or directory creation. 449 396 */ 450 if ( ( (f Open & RTFILE_O_ACTION_MASK) == RTFILE_O_CREATE451 || (f Open & RTFILE_O_ACTION_MASK) == RTFILE_O_OPEN_CREATE452 || (f Open & RTFILE_O_ACTION_MASK) == RTFILE_O_CREATE_REPLACE)453 && (f Flags & RTVFSOBJ_F_CREATE_MASK) != RTVFSOBJ_F_CREATE_NOTHING)397 if ( ( (fFileOpen & RTFILE_O_ACTION_MASK) == RTFILE_O_CREATE 398 || (fFileOpen & RTFILE_O_ACTION_MASK) == RTFILE_O_OPEN_CREATE 399 || (fFileOpen & RTFILE_O_ACTION_MASK) == RTFILE_O_CREATE_REPLACE) 400 && (fVfsFlags & RTVFSOBJ_F_CREATE_MASK) != RTVFSOBJ_F_CREATE_NOTHING) 454 401 { 455 402 456 if ((f Flags & RTVFSOBJ_F_CREATE_MASK) == RTVFSOBJ_F_CREATE_FILE)403 if ((fVfsFlags & RTVFSOBJ_F_CREATE_MASK) == RTVFSOBJ_F_CREATE_FILE) 457 404 { 458 405 RTFILE hFile; 459 rc = RTDirRelFileOpen(pThis->hDir, pszEntry, f Open, &hFile);406 rc = RTDirRelFileOpen(pThis->hDir, pszEntry, fFileOpen, &hFile); 460 407 if (RT_SUCCESS(rc)) 461 408 { 462 409 RTVFSFILE hVfsFile; 463 rc = RTVfsFileFromRTFile(hFile, f Open, false /*fLeaveOpen*/, &hVfsFile);410 rc = RTVfsFileFromRTFile(hFile, fFileOpen, false /*fLeaveOpen*/, &hVfsFile); 464 411 if (RT_SUCCESS(rc)) 465 412 { 466 413 *phVfsObj = RTVfsObjFromFile(hVfsFile); 467 414 RTVfsFileRelease(hVfsFile); 468 AssertStmt(*phVfsObj == NIL_RTVFSOBJ, rc = VERR_INTERNAL_ERROR_3);415 AssertStmt(*phVfsObj != NIL_RTVFSOBJ, rc = VERR_INTERNAL_ERROR_3); 469 416 } 470 417 else … … 472 419 } 473 420 } 474 else if ((f Flags & RTVFSOBJ_F_CREATE_MASK) == RTVFSOBJ_F_CREATE_DIRECTORY)421 else if ((fVfsFlags & RTVFSOBJ_F_CREATE_MASK) == RTVFSOBJ_F_CREATE_DIRECTORY) 475 422 { 476 423 RTDIR hSubDir; 477 rc = RTDirRelDirCreate(pThis->hDir, pszEntry, (f Open & RTFILE_O_CREATE_MODE_MASK) >> RTFILE_O_CREATE_MODE_SHIFT,478 0 /* f Flags */, &hSubDir);424 rc = RTDirRelDirCreate(pThis->hDir, pszEntry, (fFileOpen & RTFILE_O_CREATE_MODE_MASK) >> RTFILE_O_CREATE_MODE_SHIFT, 425 0 /* fVfsFlags */, &hSubDir); 479 426 if (RT_SUCCESS(rc)) 480 427 { … … 720 667 RTVFSOBJSETOPS_VERSION 721 668 }, 722 rtVfsStdDir_OpenObj, 723 rtVfsStdDir_TraversalOpen, 669 rtVfsStdDir_Open, 724 670 rtVfsStdDir_OpenFile, 725 671 rtVfsStdDir_OpenDir,
Note:
See TracChangeset
for help on using the changeset viewer.