Changeset 34031 in vbox
- Timestamp:
- Nov 12, 2010 3:02:30 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 67711
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/vfs.h
r34014 r34031 322 322 323 323 /** @defgroup grp_vfs_iostream VFS Symbolic Link API 324 * 325 * @remarks The TAR VFS and filesystem stream uses symbolic links for 326 * describing hard links as well. The users must use RTFS_IS_SYMLINK 327 * to check if it is a real symlink in those cases. 328 * 329 * @remarks Any VFS which is backed by a real file system may be subject to 330 * races with other processes or threads, so the user may get 331 * unexpected errors when this happends. This is a bit host specific, 332 * i.e. it might be prevent on windows if we care. 333 * 324 334 * @{ 325 335 */ 326 336 337 338 /** 339 * Retains a reference to the VFS symbolic link handle. 340 * 341 * @returns New reference count on success, UINT32_MAX on failure. 342 * @param hVfsSym The VFS symbolic link handle. 343 */ 327 344 RTDECL(uint32_t) RTVfsSymlinkRetain(RTVFSSYMLINK hVfsSym); 345 346 /** 347 * Releases a reference to the VFS symbolic link handle. 348 * 349 * @returns New reference count on success (0 if closed), UINT32_MAX on failure. 350 * @param hVfsSym The VFS symbolic link handle. 351 */ 328 352 RTDECL(uint32_t) RTVfsSymlinkRelease(RTVFSSYMLINK hVfsSym); 353 354 /** 355 * Query information about the symbolic link. 356 * 357 * @returns IPRT status code. 358 * @param hVfsSym The VFS symbolic link handle. 359 * @param pObjInfo Where to return the info. 360 * @param enmAddAttr Which additional attributes should be retrieved. 361 * 362 * @sa RTFileQueryInfo, RTPathQueryInfo, RTPathQueryInfoEx 363 */ 364 RTDECL(int) RTVfsSymlinkQueryInfo(RTVFSSYMLINK hVfsSym, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr); 365 366 /** 367 * Set the unix style owner and group. 368 * 369 * @returns IPRT status code. 370 * @param hVfsSym The VFS symbolic link handle. 371 * @param fMode The new mode bits. 372 * @param fMask The mask indicating which bits we are changing. 373 * @sa RTFileSetMode, RTPathSetMode 374 */ 375 RTDECL(int) RTVfsSymlinkSetMode(RTVFSSYMLINK hVfsSym, RTFMODE fMode, RTFMODE fMask); 376 377 /** 378 * Set the timestamps associated with the object. 379 * 380 * @returns IPRT status code. 381 * @param hVfsSym The VFS symbolic link handle. 382 * @param pAccessTime Pointer to the new access time. NULL if not 383 * to be changed. 384 * @param pModificationTime Pointer to the new modifcation time. NULL if 385 * not to be changed. 386 * @param pChangeTime Pointer to the new change time. NULL if not to be 387 * changed. 388 * @param pBirthTime Pointer to the new time of birth. NULL if not to be 389 * changed. 390 * @remarks See RTFileSetTimes for restrictions and behavior imposed by the 391 * host OS or underlying VFS provider. 392 * @sa RTFileSetTimes, RTPathSetTimes 393 */ 394 RTDECL(int) RTVfsSymlinkSetTimes(RTVFSSYMLINK hVfsSym, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime, 395 PCRTTIMESPEC pChangeTime, PCRTTIMESPEC pBirthTime); 396 397 /** 398 * Set the unix style owner and group. 399 * 400 * @returns IPRT status code. 401 * @param hVfsSym The VFS symbolic link handle. 402 * @param uid The user ID of the new owner. NIL_RTUID if 403 * unchanged. 404 * @param gid The group ID of the new owner group. NIL_RTGID if 405 * unchanged. 406 * @sa RTFileSetOwner, RTPathSetOwner. 407 */ 408 RTDECL(int) RTVfsSymlinkSetOwner(RTVFSSYMLINK hVfsSym, RTUID uid, RTGID gid); 329 409 330 410 /** … … 556 636 */ 557 637 RTDECL(int) RTVfsIoStrmZeroFill(RTVFSIOSTREAM hVfsIos, RTFOFF cb); 638 639 /** 640 * Checks if we're at the end of the I/O stream. 641 * 642 * @returns true if at EOS, otherwise false. 643 * @param hVfsIos The VFS I/O stream handle. 644 */ 645 RTDECL(bool) RTVfsIoStrmIsAtEnd(RTVFSIOSTREAM hVfsIos); 558 646 /** @} */ 559 647 -
trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp
r34030 r34031 41 41 42 42 #include "internal/file.h" 43 #include "internal/fs.h" 43 44 #include "internal/magics.h" 44 45 //#include "internal/vfs.h" … … 351 352 RTVFSLOCKINTERNAL *pThis = hLock; 352 353 AssertPtrReturn(pThis, UINT32_MAX); 353 Assert PtrReturn(pThis->enmType > RTVFSLOCKTYPE_INVALID && pThis->enmType < RTVFSLOCKTYPE_END, UINT32_MAX);354 AssertReturn(pThis->enmType > RTVFSLOCKTYPE_INVALID && pThis->enmType < RTVFSLOCKTYPE_END, UINT32_MAX); 354 355 355 356 uint32_t cRefs = ASMAtomicIncU32(&pThis->cRefs); … … 396 397 RTVFSLOCKINTERNAL *pThis = hLock; 397 398 AssertPtrReturn(pThis, UINT32_MAX); 398 Assert PtrReturn(pThis->enmType > RTVFSLOCKTYPE_INVALID && pThis->enmType < RTVFSLOCKTYPE_END, UINT32_MAX);399 AssertReturn(pThis->enmType > RTVFSLOCKTYPE_INVALID && pThis->enmType < RTVFSLOCKTYPE_END, UINT32_MAX); 399 400 400 401 uint32_t cRefs = ASMAtomicDecU32(&pThis->cRefs); … … 1708 1709 1709 1710 1710 RTDECL(int) RTVfsSymlinkRead(RTVFSSYMLINK hVfsSym, char *pszTarget, size_t cbTarget) 1711 RTDECL(int) RTVfsSymlinkQueryInfo(RTVFSSYMLINK hVfsSym, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr) 1712 { 1713 RTVFSSYMLINKINTERNAL *pThis = hVfsSym; 1714 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 1715 AssertReturn(pThis->uMagic == RTVFSSYMLINK_MAGIC, VERR_INVALID_HANDLE); 1716 return RTVfsObjQueryInfo(&pThis->Base, pObjInfo, enmAddAttr); 1717 } 1718 1719 1720 RTDECL(int) RTVfsSymlinkSetMode(RTVFSSYMLINK hVfsSym, RTFMODE fMode, RTFMODE fMask) 1721 { 1722 RTVFSSYMLINKINTERNAL *pThis = hVfsSym; 1723 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 1724 AssertReturn(pThis->uMagic == RTVFSSYMLINK_MAGIC, VERR_INVALID_HANDLE); 1725 1726 fMode = rtFsModeNormalize(fMode, NULL, 0); 1727 if (!rtFsModeIsValid(fMode)) 1728 return VERR_INVALID_PARAMETER; 1729 1730 RTVfsLockAcquireWrite(pThis->Base.hLock); 1731 int rc = pThis->pOps->ObjSet.pfnSetMode(pThis->Base.pvThis, fMode, fMask); 1732 RTVfsLockReleaseWrite(pThis->Base.hLock); 1733 return rc; 1734 } 1735 1736 1737 RTDECL(int) RTVfsSymlinkSetTimes(RTVFSSYMLINK hVfsSym, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime, 1738 PCRTTIMESPEC pChangeTime, PCRTTIMESPEC pBirthTime) 1739 { 1740 RTVFSSYMLINKINTERNAL *pThis = hVfsSym; 1741 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 1742 AssertReturn(pThis->uMagic == RTVFSSYMLINK_MAGIC, VERR_INVALID_HANDLE); 1743 1744 AssertPtrNullReturn(pAccessTime, VERR_INVALID_POINTER); 1745 AssertPtrNullReturn(pModificationTime, VERR_INVALID_POINTER); 1746 AssertPtrNullReturn(pChangeTime, VERR_INVALID_POINTER); 1747 AssertPtrNullReturn(pBirthTime, VERR_INVALID_POINTER); 1748 1749 RTVfsLockAcquireWrite(pThis->Base.hLock); 1750 int rc = pThis->pOps->ObjSet.pfnSetTimes(pThis->Base.pvThis, pAccessTime, pModificationTime, pChangeTime, pBirthTime); 1751 RTVfsLockReleaseWrite(pThis->Base.hLock); 1752 return rc; 1753 } 1754 1755 1756 RTDECL(int) RTVfsSymlinkSetOwner(RTVFSSYMLINK hVfsSym, RTUID uid, RTGID gid) 1757 { 1758 RTVFSSYMLINKINTERNAL *pThis = hVfsSym; 1759 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 1760 AssertReturn(pThis->uMagic == RTVFSSYMLINK_MAGIC, VERR_INVALID_HANDLE); 1761 1762 RTVfsLockAcquireWrite(pThis->Base.hLock); 1763 int rc = pThis->pOps->ObjSet.pfnSetOwner(pThis->Base.pvThis, uid, gid); 1764 RTVfsLockReleaseWrite(pThis->Base.hLock); 1765 return rc; 1766 } 1767 1768 1769 RTDECL(int) RTVfsSymlinkRead(RTVFSSYMLINK hVfsSym, char *pszTarget, size_t cbTarget) 1711 1770 { 1712 1771 RTVFSSYMLINKINTERNAL *pThis = hVfsSym; … … 2019 2078 2020 2079 2080 RTDECL(bool) RTVfsIoStrmIsAtEnd(RTVFSIOSTREAM hVfsIos) 2081 { 2082 /* 2083 * There is where the zero read behavior comes in handy. 2084 */ 2085 char bDummy; 2086 size_t cbRead; 2087 int rc = RTVfsIoStrmRead(hVfsIos, &bDummy, 0 /*cbToRead*/, false /*fBlocking*/, &cbRead); 2088 return rc == VINF_EOF; 2089 } 2090 2091 2092 2021 2093 2022 2094
Note:
See TracChangeset
for help on using the changeset viewer.