Changeset 99758 in vbox for trunk/src/VBox/Runtime/r3/nt
- Timestamp:
- May 11, 2023 9:37:59 PM (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/nt/dirrel-r3-nt.cpp
r98103 r99758 482 482 483 483 484 /**485 * Changes the mode flags of a file system object relative to @a hDir.486 *487 * The API requires at least one of the mode flag sets (Unix/Dos) to488 * be set. The type is ignored.489 *490 * @returns IPRT status code.491 * @param hDir The directory @a pszRelPath is relative to.492 * @param pszRelPath The relative path to the file system object.493 * @param fMode The new file mode, see @ref grp_rt_fs for details.494 * @param fFlags RTPATH_F_ON_LINK or RTPATH_F_FOLLOW_LINK.495 *496 * @sa RTPathSetMode497 */498 484 RTDECL(int) RTDirRelPathSetMode(RTDIR hDir, const char *pszRelPath, RTFMODE fMode, uint32_t fFlags) 499 485 { … … 550 536 551 537 552 /**553 * Changes one or more of the timestamps associated of file system object554 * relative to @a hDir.555 *556 * @returns IPRT status code.557 * @param hDir The directory @a pszRelPath is relative to.558 * @param pszRelPath The relative path to the file system object.559 * @param pAccessTime Pointer to the new access time.560 * @param pModificationTime Pointer to the new modification time.561 * @param pChangeTime Pointer to the new change time. NULL if not to be changed.562 * @param pBirthTime Pointer to the new time of birth. NULL if not to be changed.563 * @param fFlags RTPATH_F_ON_LINK or RTPATH_F_FOLLOW_LINK.564 *565 * @remark The file system might not implement all these time attributes,566 * the API will ignore the ones which aren't supported.567 *568 * @remark The file system might not implement the time resolution569 * employed by this interface, the time will be chopped to fit.570 *571 * @remark The file system may update the change time even if it's572 * not specified.573 *574 * @remark POSIX can only set Access & Modification and will always set both.575 *576 * @sa RTPathSetTimesEx577 */578 538 RTDECL(int) RTDirRelPathSetTimes(RTDIR hDir, const char *pszRelPath, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime, 579 539 PCRTTIMESPEC pChangeTime, PCRTTIMESPEC pBirthTime, uint32_t fFlags) … … 586 546 int rc = rtDirRelBuildFullPath(pThis, szPath, sizeof(szPath), pszRelPath); 587 547 if (RT_SUCCESS(rc)) 588 {589 RTAssertMsg2("DBG: RTDirRelPathSetTimes(%s)...\n", szPath);590 548 rc = RTPathSetTimesEx(szPath, pAccessTime, pModificationTime, pChangeTime, pBirthTime, fFlags); 591 } 592 return rc; 593 } 594 595 596 /** 597 * Changes the owner and/or group of a file system object relative to @a hDir. 598 * 599 * @returns IPRT status code. 600 * @param hDir The directory @a pszRelPath is relative to. 601 * @param pszRelPath The relative path to the file system object. 602 * @param uid The new file owner user id. Pass NIL_RTUID to leave 603 * this unchanged. 604 * @param gid The new group id. Pass NIL_RTGID to leave this 605 * unchanged. 606 * @param fFlags RTPATH_F_ON_LINK or RTPATH_F_FOLLOW_LINK. 607 * 608 * @sa RTPathSetOwnerEx 609 */ 549 return rc; 550 } 551 552 610 553 RTDECL(int) RTDirRelPathSetOwner(RTDIR hDir, const char *pszRelPath, uint32_t uid, uint32_t gid, uint32_t fFlags) 611 554 { … … 618 561 if (RT_SUCCESS(rc)) 619 562 { 620 RTAssertMsg2("DBG: RTDirRelPathSetOwner(%s)...\n", szPath);621 563 #ifndef RT_OS_WINDOWS 622 564 rc = RTPathSetOwnerEx(szPath, uid, gid, fFlags); … … 630 572 631 573 632 /**633 * Renames a directory relative path within a filesystem.634 *635 * This will rename symbolic links. If RTPATHRENAME_FLAGS_REPLACE is used and636 * pszDst is a symbolic link, it will be replaced and not its target.637 *638 * @returns IPRT status code.639 * @param hDirSrc The directory the source path is relative to.640 * @param pszSrc The source path, relative to @a hDirSrc.641 * @param hDirSrc The directory the destination path is relative to.642 * @param pszDst The destination path, relative to @a hDirDst.643 * @param fRename Rename flags, RTPATHRENAME_FLAGS_XXX.644 *645 * @sa RTPathRename646 */647 574 RTDECL(int) RTDirRelPathRename(RTDIR hDirSrc, const char *pszSrc, RTDIR hDirDst, const char *pszDst, unsigned fRename) 648 575 { … … 665 592 rc = rtDirRelBuildFullPath(pThis, szDstPath, sizeof(szDstPath), pszDst); 666 593 if (RT_SUCCESS(rc)) 667 {668 RTAssertMsg2("DBG: RTDirRelPathRename(%s,%s)...\n", szSrcPath, szDstPath);669 594 rc = RTPathRename(szSrcPath, szDstPath, fRename); 670 } 671 } 672 return rc; 673 } 674 675 676 /** 677 * Removes the last component of the directory relative path. 678 * 679 * @returns IPRT status code. 680 * @param hDir The directory @a pszRelPath is relative to. 681 * @param pszRelPath The relative path to the file system object. 682 * @param fUnlink Unlink flags, RTPATHUNLINK_FLAGS_XXX. 683 * 684 * @sa RTPathUnlink 685 */ 595 } 596 return rc; 597 } 598 599 686 600 RTDECL(int) RTDirRelPathUnlink(RTDIR hDir, const char *pszRelPath, uint32_t fUnlink) 687 601 { … … 693 607 int rc = rtDirRelBuildFullPath(pThis, szPath, sizeof(szPath), pszRelPath); 694 608 if (RT_SUCCESS(rc)) 695 {696 RTAssertMsg2("DBG: RTDirRelPathUnlink(%s)...\n", szPath);697 609 rc = RTPathUnlink(szPath, fUnlink); 698 }699 610 return rc; 700 611 } … … 711 622 712 623 713 /**714 * Creates a symbolic link (@a pszSymlink) relative to @a hDir targeting @a715 * pszTarget.716 *717 * @returns IPRT status code.718 * @param hDir The directory @a pszSymlink is relative to.719 * @param pszSymlink The relative path of the symbolic link.720 * @param pszTarget The path to the symbolic link target. This is721 * relative to @a pszSymlink or an absolute path.722 * @param enmType The symbolic link type. For Windows compatability723 * it is very important to set this correctly. When724 * RTSYMLINKTYPE_UNKNOWN is used, the API will try725 * make a guess and may attempt query information726 * about @a pszTarget in the process.727 * @param fCreate Create flags, RTSYMLINKCREATE_FLAGS_XXX.728 *729 * @sa RTSymlinkCreate730 */731 624 RTDECL(int) RTDirRelSymlinkCreate(RTDIR hDir, const char *pszSymlink, const char *pszTarget, 732 625 RTSYMLINKTYPE enmType, uint32_t fCreate) … … 739 632 int rc = rtDirRelBuildFullPath(pThis, szPath, sizeof(szPath), pszSymlink); 740 633 if (RT_SUCCESS(rc)) 741 {742 RTAssertMsg2("DBG: RTDirRelSymlinkCreate(%s)...\n", szPath);743 634 rc = RTSymlinkCreate(szPath, pszTarget, enmType, fCreate); 744 } 745 return rc; 746 } 747 748 749 /** 750 * Read the symlink target relative to @a hDir. 751 * 752 * @returns IPRT status code. 753 * @retval VERR_NOT_SYMLINK if @a pszSymlink does not specify a symbolic link. 754 * @retval VERR_BUFFER_OVERFLOW if the link is larger than @a cbTarget. The 755 * buffer will contain what all we managed to read, fully terminated 756 * if @a cbTarget > 0. 757 * 758 * @param hDir The directory @a pszSymlink is relative to. 759 * @param pszSymlink The relative path to the symbolic link that should 760 * be read. 761 * @param pszTarget The target buffer. 762 * @param cbTarget The size of the target buffer. 763 * @param fRead Read flags, RTSYMLINKREAD_FLAGS_XXX. 764 * 765 * @sa RTSymlinkRead 766 */ 635 return rc; 636 } 637 638 767 639 RTDECL(int) RTDirRelSymlinkRead(RTDIR hDir, const char *pszSymlink, char *pszTarget, size_t cbTarget, uint32_t fRead) 768 640 { … … 774 646 int rc = rtDirRelBuildFullPath(pThis, szPath, sizeof(szPath), pszSymlink); 775 647 if (RT_SUCCESS(rc)) 776 {777 RTAssertMsg2("DBG: RTDirRelSymlinkRead(%s)...\n", szPath);778 648 rc = RTSymlinkRead(szPath, pszTarget, cbTarget, fRead); 779 } 780 return rc; 781 } 782 649 return rc; 650 } 651
Note:
See TracChangeset
for help on using the changeset viewer.