VirtualBox

Changeset 69716 in vbox for trunk/include/iprt


Ignore:
Timestamp:
Nov 16, 2017 2:31:25 PM (7 years ago)
Author:
vboxsync
Message:

IPRT: More work on directory relative APIs (NT mainly) and VFS; introducing RTMkDir (test) tool.

  • Added RTVfsDirCreateDir
  • Added RTVfsChainOpenParentDir and RTVfsChainSplitOffFinalPath.
  • Added new tool for testing this called RTMkDir.
  • Fixed directory traversal problem with stddir by making it okay to return VERR_FILE_NOT_FOUND as well.
Location:
trunk/include/iprt
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/dir.h

    r69709 r69716  
    620620 * @param   fMode           The mode of the new directory.
    621621 * @param   fCreate         Create flags, RTDIRCREATE_FLAGS_XXX.
     622 * @param   phSubDir        Where to return the handle of the created directory.
     623 *                          Optional.
    622624 *
    623625 * @sa      RTDirCreate
    624626 */
    625 RTDECL(int) RTDirRelDirCreate(PRTDIR hDir, const char *pszRelPath, RTFMODE fMode, uint32_t fCreate);
     627RTDECL(int) RTDirRelDirCreate(PRTDIR hDir, const char *pszRelPath, RTFMODE fMode, uint32_t fCreate, PRTDIR *phSubDir);
    626628
    627629/**
  • trunk/include/iprt/err.h

    r69105 r69716  
    20792079/** VFS chain doesn't end with a path only element. */
    20802080#define VERR_VFS_CHAIN_NOT_PATH_ONLY                (-22157)
     2081/** The path only element at the end of the VFS chain is too short to make out
     2082 *  the parent directory. */
     2083#define VERR_VFS_CHAIN_TOO_SHORT_FOR_PARENT         (-22158)
    20812084/** @} */
    20822085
  • trunk/include/iprt/mangling.h

    r69674 r69716  
    24182418# define RTVfsChainMsgErrorExitFailure                  RT_MANGLER(RTVfsChainMsgErrorExitFailure)
    24192419# define RTVfsChainOpenDir                              RT_MANGLER(RTVfsChainOpenDir)
     2420# define RTVfsChainOpenParentDir                        RT_MANGLER(RTVfsChainOpenParentDir)
    24202421# define RTVfsChainOpenFile                             RT_MANGLER(RTVfsChainOpenFile)
    24212422# define RTVfsChainOpenIoStream                         RT_MANGLER(RTVfsChainOpenIoStream)
     
    24252426# define RTVfsChainSpecFree                             RT_MANGLER(RTVfsChainSpecFree)
    24262427# define RTVfsChainSpecParse                            RT_MANGLER(RTVfsChainSpecParse)
     2428# define RTVfsChainSplitOffFinalPath                    RT_MANGLER(RTVfsChainSplitOffFinalPath)
    24272429# define RTVfsChainValidateOpenFileOrIoStream           RT_MANGLER(RTVfsChainValidateOpenFileOrIoStream)
    24282430# define RTVfsDirRelease                                RT_MANGLER(RTVfsDirRelease)
     
    24312433# define RTVfsDirOpen                                   RT_MANGLER(RTVfsDirOpen)
    24322434# define RTVfsDirOpenDir                                RT_MANGLER(RTVfsDirOpenDir)
     2435# define RTVfsDirCreateDir                              RT_MANGLER(RTVfsDirCreateDir)
    24332436# define RTVfsDirOpenFile                               RT_MANGLER(RTVfsDirOpenFile)
    24342437# define RTVfsDirOpenFileAsIoStream                     RT_MANGLER(RTVfsDirOpenFileAsIoStream)
  • trunk/include/iprt/vfs.h

    r69679 r69716  
    478478
    479479/**
     480 * Creates a directory relative to @a hVfsDir.
     481 *
     482 * @returns IPRT status code
     483 * @param   hVfsDir             The directory the path is relative to.
     484 * @param   pszRelPath          The relative path to the new directory.
     485 * @param   fMode               The file mode for the new directory.
     486 * @param   fFlags              Directory creation flags, RTDIRCREATE_FLAGS_XXX.
     487 * @param   phVfsDir            Where to return the handle to the newly created
     488 *                              directory.  Optional.
     489 * @sa      RTDirCreate, RTDirRelDirCreate
     490 */
     491RTDECL(int) RTVfsDirCreateDir(RTVFSDIR hVfsDir, const char *pszRelPath, RTFMODE fMode, uint32_t fFlags, PRTVFSDIR phVfsDir);
     492
     493/**
    480494 * Create a VFS directory handle from a standard IPRT directory handle (PRTDIR).
    481495 *
     
    15351549RTDECL(int) RTVfsChainOpenFsStream(const char *pszSpec, PRTVFSFSSTREAM  phVfsFss, uint32_t *poffError, PRTERRINFO pErrInfo);
    15361550RTDECL(int) RTVfsChainOpenDir(const char *pszSpec, uint32_t fOpen, PRTVFSDIR phVfsDir, uint32_t *poffError, PRTERRINFO pErrInfo);
     1551RTDECL(int) RTVfsChainOpenParentDir(const char *pszSpec, uint32_t fOpen, PRTVFSDIR phVfsDir, const char **ppszChild,
     1552                                    uint32_t *poffError, PRTERRINFO pErrInfo);
    15371553RTDECL(int) RTVfsChainOpenFile(const char *pszSpec, uint64_t fOpen, PRTVFSFILE phVfsFile, uint32_t *poffError, PRTERRINFO pErrInfo);
    15381554RTDECL(int) RTVfsChainOpenIoStream(const char *pszSpec, uint64_t fOpen, PRTVFSIOSTREAM phVfsIos, uint32_t *poffError, PRTERRINFO pErrInfo);
     
    15661582
    15671583/**
     1584 * Splits the given chain spec into a final path and the preceeding spec.
     1585 *
     1586 * This works on plain paths too.
     1587 *
     1588 * @returns IPRT status code.
     1589 * @param   pszSpec         The chain spec to split.  This will be modified!
     1590 * @param   ppszSpec        Where to return the pointer to the chain spec part.
     1591 *                          This is set to NULL if it's a plain path or a chain
     1592 *                          spec with only a final-path element.
     1593 * @param   ppszFinalPath   Where to return the pointer to the final path.  This
     1594 *                          is set to NULL if no final path.
     1595 * @param   poffError       Where to on error return an offset into @a pszSpec
     1596 *                          of what cause the error.  Optional.
     1597 */
     1598RTDECL(int) RTVfsChainSplitOffFinalPath(char *pszSpec, char **ppszSpec, char **ppszFinalPath, uint32_t *poffError);
     1599
     1600/**
    15681601 * Common code for reporting errors of a RTVfsChainOpen* API.
    15691602 *
  • trunk/include/iprt/vfslowlevel.h

    r69705 r69716  
    566566     * @param   fFlags      RTDIR_F_XXX.
    567567     * @param   phVfsDir    Where to return the handle to the opened directory.
     568     *                      Optional.
    568569     * @sa      RTDirOpen.
    569570     */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette