VirtualBox

Changeset 69753 in vbox for trunk/src/VBox/Runtime/r3


Ignore:
Timestamp:
Nov 19, 2017 2:27:58 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
119153
Message:

iprt/dir: Morphing PRTDIR into a handle named RTDIR. (Been wanting to correct this for years. Don't know why I makde it a pointer rather than an abstrct handle like everything else.)

Location:
trunk/src/VBox/Runtime/r3
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/dir.cpp

    r69716 r69753  
    4747
    4848
    49 static DECLCALLBACK(bool) rtDirFilterWinNtMatch(PRTDIR pDir, const char *pszName);
    50 static DECLCALLBACK(bool) rtDirFilterWinNtMatchNoWildcards(PRTDIR pDir, const char *pszName);
     49static DECLCALLBACK(bool) rtDirFilterWinNtMatch(PRTDIRINTERNAL pDir, const char *pszName);
     50static DECLCALLBACK(bool) rtDirFilterWinNtMatchNoWildcards(PRTDIRINTERNAL pDir, const char *pszName);
    5151DECLINLINE(bool) rtDirFilterWinNtMatchEon(PCRTUNICP puszFilter);
    5252static bool rtDirFilterWinNtMatchDosStar(unsigned iDepth, RTUNICP uc, const char *pszNext, PCRTUNICP puszFilter);
     
    117117 * @param   pszName     The path to match to the filter.
    118118 */
    119 static DECLCALLBACK(bool) rtDirFilterWinNtMatchNoWildcards(PRTDIR pDir, const char *pszName)
     119static DECLCALLBACK(bool) rtDirFilterWinNtMatchNoWildcards(PRTDIRINTERNAL pDir, const char *pszName)
    120120{
    121121    /*
     
    447447 * @param   pszName     The path to match to the filter.
    448448 */
    449 static DECLCALLBACK(bool) rtDirFilterWinNtMatch(PRTDIR pDir, const char *pszName)
     449static DECLCALLBACK(bool) rtDirFilterWinNtMatch(PRTDIRINTERNAL pDir, const char *pszName)
    450450{
    451451    return rtDirFilterWinNtMatchBase(0, pszName, pDir->puszFilter);
     
    460460 * @param   pDir        The directory handle (not yet opened).
    461461 */
    462 static PFNRTDIRFILTER rtDirFilterWinNtInit(PRTDIR pDir)
     462static PFNRTDIRFILTER rtDirFilterWinNtInit(PRTDIRINTERNAL pDir)
    463463{
    464464    /*
     
    506506 *
    507507 * @returns IPRT status code.
    508  * @param   ppDir               Where to store the directory handle.
     508 * @param   phDir               Where to store the directory handle.
    509509 * @param   pszPath             The specified path.
    510510 * @param   pszFilter           Pointer to where the filter start in the path.
     
    517517 *                              we're to use (consume) hRelativeDir.
    518518 */
    519 static int rtDirOpenCommon(PRTDIR *ppDir, const char *pszPath, const char *pszFilter, RTDIRFILTER enmFilter, uint32_t fFlags,
    520                            uintptr_t hRelativeDir, void *pvNativeRelative)
     519static int rtDirOpenCommon(RTDIR *phDir, const char *pszPath, const char *pszFilter, RTDIRFILTER enmFilter,
     520                           uint32_t fFlags, uintptr_t hRelativeDir, void *pvNativeRelative)
    521521{
    522522    /*
     
    576576                             + cbFilter
    577577                             + cchRealPath + 1 + 4;
    578     PRTDIR pDir = (PRTDIR)RTMemAllocZ(cbAllocated);
     578    PRTDIRINTERNAL pDir = (PRTDIRINTERNAL)RTMemAllocZ(cbAllocated);
    579579    if (!pDir)
    580580        return VERR_NO_MEMORY;
     
    631631    rc = rtDirNativeOpen(pDir, szRealPath, hRelativeDir, pvNativeRelative);
    632632    if (RT_SUCCESS(rc))
    633         *ppDir = pDir;
     633        *phDir = pDir;
    634634    else
    635635        RTMemFree(pDir);
     
    639639
    640640
    641 RTDECL(int) RTDirOpen(PRTDIR *ppDir, const char *pszPath)
     641RTDECL(int) RTDirOpen(RTDIR *phDir, const char *pszPath)
    642642{
    643643    /*
    644644     * Validate input.
    645645     */
    646     AssertMsgReturn(VALID_PTR(ppDir), ("%p\n", ppDir), VERR_INVALID_POINTER);
     646    AssertMsgReturn(VALID_PTR(phDir), ("%p\n", phDir), VERR_INVALID_POINTER);
    647647    AssertMsgReturn(VALID_PTR(pszPath), ("%p\n", pszPath), VERR_INVALID_POINTER);
    648648
     
    650650     * Take common cause with RTDirOpenFiltered().
    651651     */
    652     int rc = rtDirOpenCommon(ppDir, pszPath, NULL, RTDIRFILTER_NONE, 0 /*fFlags*/, ~(uintptr_t)0, NULL);
    653     LogFlow(("RTDirOpen(%p:{%p}, %p:{%s}): return %Rrc\n", ppDir, *ppDir, pszPath, pszPath, rc));
     652    int rc = rtDirOpenCommon(phDir, pszPath, NULL, RTDIRFILTER_NONE, 0 /*fFlags*/, ~(uintptr_t)0, NULL);
     653    LogFlow(("RTDirOpen(%p:{%p}, %p:{%s}): return %Rrc\n", phDir, *phDir, pszPath, pszPath, rc));
    654654    return rc;
    655655}
    656656
    657657
    658 DECLHIDDEN(int) rtDirOpenRelativeOrHandle(PRTDIR *ppDir, const char *pszPath, RTDIRFILTER enmFilter, uint32_t fFlags,
     658DECLHIDDEN(int) rtDirOpenRelativeOrHandle(RTDIR *phDir, const char *pszPath, RTDIRFILTER enmFilter, uint32_t fFlags,
    659659                                          uintptr_t hRelativeDir, void *pvNativeRelative)
    660660{
     
    662662     * Validate input.
    663663     */
    664     AssertMsgReturn(VALID_PTR(ppDir), ("%p\n", ppDir), VERR_INVALID_POINTER);
     664    AssertMsgReturn(VALID_PTR(phDir), ("%p\n", phDir), VERR_INVALID_POINTER);
    665665    AssertMsgReturn(VALID_PTR(pszPath), ("%p\n", pszPath), VERR_INVALID_POINTER);
    666666    AssertReturn(!(fFlags & ~RTDIR_F_VALID_MASK), VERR_INVALID_FLAGS);
     
    695695     * and initialize the handle, and finally call the backend.
    696696     */
    697     int rc = rtDirOpenCommon(ppDir, pszPath, pszFilter, enmFilter, fFlags, hRelativeDir, pvNativeRelative);
     697    int rc = rtDirOpenCommon(phDir, pszPath, pszFilter, enmFilter, fFlags, hRelativeDir, pvNativeRelative);
    698698
    699699    LogFlow(("RTDirOpenFiltered(%p:{%p}, %p:{%s}, %d, %#x, %p, %p): return %Rrc\n",
    700              ppDir,*ppDir, pszPath, pszPath, enmFilter, fFlags, hRelativeDir, pvNativeRelative, rc));
     700             phDir,*phDir, pszPath, pszPath, enmFilter, fFlags, hRelativeDir, pvNativeRelative, rc));
    701701    return rc;
    702702}
    703703
    704704
    705 RTDECL(int) RTDirOpenFiltered(PRTDIR *ppDir, const char *pszPath, RTDIRFILTER enmFilter, uint32_t fFlags)
    706 {
    707     return rtDirOpenRelativeOrHandle(ppDir, pszPath, enmFilter, fFlags, ~(uintptr_t)0, NULL);
    708 }
    709 
    710 
    711 RTDECL(bool) RTDirIsValid(PRTDIR hDir)
     705RTDECL(int) RTDirOpenFiltered(RTDIR *phDir, const char *pszPath, RTDIRFILTER enmFilter, uint32_t fFlags)
     706{
     707    return rtDirOpenRelativeOrHandle(phDir, pszPath, enmFilter, fFlags, ~(uintptr_t)0, NULL);
     708}
     709
     710
     711RTDECL(bool) RTDirIsValid(RTDIR hDir)
    712712{
    713713    return RT_VALID_PTR(hDir)
  • trunk/src/VBox/Runtime/r3/dir2.cpp

    r69111 r69753  
    6262     * Enumerate the directory content and dispose of it.
    6363     */
    64     PRTDIR pDir;
    65     int rc = RTDirOpen(&pDir, pszBuf);
     64    RTDIR hDir;
     65    int rc = RTDirOpen(&hDir, pszBuf);
    6666    if (RT_FAILURE(rc))
    6767        return rc;
    68     while (RT_SUCCESS(rc = RTDirRead(pDir, pDirEntry, NULL)))
     68    while (RT_SUCCESS(rc = RTDirRead(hDir, pDirEntry, NULL)))
    6969    {
    70         if (   pDirEntry->szName[0] != '.'
    71             || pDirEntry->cbName > 2
    72             || (   pDirEntry->cbName == 2
    73                 && pDirEntry->szName[1] != '.')
    74            )
     70        if (!RTDirEntryIsStdDotLink(pDirEntry))
    7571        {
    7672            /* Construct the full name of the entry. */
     
    130126    if (rc == VERR_NO_MORE_FILES)
    131127        rc = VINF_SUCCESS;
    132     RTDirClose(pDir);
     128    RTDirClose(hDir);
    133129    return rc;
    134130}
  • trunk/src/VBox/Runtime/r3/generic/dirrel-r3-generic.cpp

    r69716 r69753  
    5353 * @param   pszRelPath          The relative path.
    5454 */
    55 static int rtDirRelBuildFullPath(PRTDIR pThis, char *pszPathDst, size_t cbPathDst, const char *pszRelPath)
     55static int rtDirRelBuildFullPath(PRTDIRINTERNAL pThis, char *pszPathDst, size_t cbPathDst, const char *pszRelPath)
    5656{
    5757    AssertMsgReturn(!RTPathStartsWithRoot(pszRelPath), ("pszRelPath='%s'\n", pszRelPath), VERR_PATH_IS_NOT_RELATIVE);
     
    121121 * @sa      RTFileOpen
    122122 */
    123 RTDECL(int)  RTDirRelFileOpen(PRTDIR hDir, const char *pszRelFilename, uint64_t fOpen, PRTFILE phFile)
    124 {
    125     PRTDIR pThis = hDir;
     123RTDECL(int)  RTDirRelFileOpen(RTDIR hDir, const char *pszRelFilename, uint64_t fOpen, PRTFILE phFile)
     124{
     125    PRTDIRINTERNAL pThis = hDir;
    126126    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    127127    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
     
    158158 * @sa      RTDirOpen
    159159 */
    160 RTDECL(int) RTDirRelDirOpen(PRTDIR hDir, const char *pszDir, PRTDIR *phDir)
    161 {
    162     PRTDIR pThis = hDir;
     160RTDECL(int) RTDirRelDirOpen(RTDIR hDir, const char *pszDir, RTDIR *phDir)
     161{
     162    PRTDIRINTERNAL pThis = hDir;
    163163    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    164164    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
     
    188188 * @sa      RTDirOpenFiltered
    189189 */
    190 RTDECL(int) RTDirRelDirOpenFiltered(PRTDIR hDir, const char *pszDirAndFilter, RTDIRFILTER enmFilter,
    191                                     uint32_t fFlags, PRTDIR *phDir)
    192 {
    193     PRTDIR pThis = hDir;
     190RTDECL(int) RTDirRelDirOpenFiltered(RTDIR hDir, const char *pszDirAndFilter, RTDIRFILTER enmFilter,
     191                                    uint32_t fFlags, RTDIR *phDir)
     192{
     193    PRTDIRINTERNAL pThis = hDir;
    194194    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    195195    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
     
    216216 * @sa      RTDirCreate
    217217 */
    218 RTDECL(int) RTDirRelDirCreate(PRTDIR hDir, const char *pszRelPath, RTFMODE fMode, uint32_t fCreate, PRTDIR *phSubDir)
    219 {
    220     PRTDIR pThis = hDir;
     218RTDECL(int) RTDirRelDirCreate(RTDIR hDir, const char *pszRelPath, RTFMODE fMode, uint32_t fCreate, RTDIR *phSubDir)
     219{
     220    PRTDIRINTERNAL pThis = hDir;
    221221    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    222222    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
     
    243243 * @sa      RTDirRemove
    244244 */
    245 RTDECL(int) RTDirRelDirRemove(PRTDIR hDir, const char *pszRelPath)
    246 {
    247     PRTDIR pThis = hDir;
     245RTDECL(int) RTDirRelDirRemove(RTDIR hDir, const char *pszRelPath)
     246{
     247    PRTDIRINTERNAL pThis = hDir;
    248248    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    249249    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
     
    287287 * @sa      RTPathQueryInfoEx
    288288 */
    289 RTDECL(int) RTDirRelPathQueryInfo(PRTDIR hDir, const char *pszRelPath, PRTFSOBJINFO pObjInfo,
     289RTDECL(int) RTDirRelPathQueryInfo(RTDIR hDir, const char *pszRelPath, PRTFSOBJINFO pObjInfo,
    290290                                  RTFSOBJATTRADD enmAddAttr, uint32_t fFlags)
    291291{
    292     PRTDIR pThis = hDir;
     292    PRTDIRINTERNAL pThis = hDir;
    293293    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    294294    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
     
    316316 * @sa      RTPathSetMode
    317317 */
    318 RTDECL(int) RTDirRelPathSetMode(PRTDIR hDir, const char *pszRelPath, RTFMODE fMode, uint32_t fFlags)
    319 {
    320     PRTDIR pThis = hDir;
     318RTDECL(int) RTDirRelPathSetMode(RTDIR hDir, const char *pszRelPath, RTFMODE fMode, uint32_t fFlags)
     319{
     320    PRTDIRINTERNAL pThis = hDir;
    321321    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    322322    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
     
    364364 * @sa      RTPathSetTimesEx
    365365 */
    366 RTDECL(int) RTDirRelPathSetTimes(PRTDIR hDir, const char *pszRelPath, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime,
     366RTDECL(int) RTDirRelPathSetTimes(RTDIR hDir, const char *pszRelPath, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime,
    367367                                 PCRTTIMESPEC pChangeTime, PCRTTIMESPEC pBirthTime, uint32_t fFlags)
    368368{
    369     PRTDIR pThis = hDir;
     369    PRTDIRINTERNAL pThis = hDir;
    370370    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    371371    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
     
    393393 * @sa      RTPathSetOwnerEx
    394394 */
    395 RTDECL(int) RTDirRelPathSetOwner(PRTDIR hDir, const char *pszRelPath, uint32_t uid, uint32_t gid, uint32_t fFlags)
    396 {
    397     PRTDIR pThis = hDir;
     395RTDECL(int) RTDirRelPathSetOwner(RTDIR hDir, const char *pszRelPath, uint32_t uid, uint32_t gid, uint32_t fFlags)
     396{
     397    PRTDIRINTERNAL pThis = hDir;
    398398    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    399399    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
     
    429429 * @sa      RTPathRename
    430430 */
    431 RTDECL(int) RTDirRelPathRename(PRTDIR hDirSrc, const char *pszSrc, PRTDIR hDirDst, const char *pszDst, unsigned fRename)
    432 {
    433     PRTDIR pThis = hDirSrc;
    434     AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    435     AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
    436 
    437     PRTDIR pThat = hDirDst;
     431RTDECL(int) RTDirRelPathRename(RTDIR hDirSrc, const char *pszSrc, RTDIR hDirDst, const char *pszDst, unsigned fRename)
     432{
     433    PRTDIRINTERNAL pThis = hDirSrc;
     434    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
     435    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
     436
     437    PRTDIRINTERNAL pThat = hDirDst;
    438438    if (pThat != pThis)
    439439    {
     
    465465 * @sa      RTPathUnlink
    466466 */
    467 RTDECL(int) RTDirRelPathUnlink(PRTDIR hDir, const char *pszRelPath, uint32_t fUnlink)
    468 {
    469     PRTDIR pThis = hDir;
     467RTDECL(int) RTDirRelPathUnlink(RTDIR hDir, const char *pszRelPath, uint32_t fUnlink)
     468{
     469    PRTDIRINTERNAL pThis = hDir;
    470470    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    471471    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
     
    507507 * @sa      RTSymlinkCreate
    508508 */
    509 RTDECL(int) RTDirRelSymlinkCreate(PRTDIR hDir, const char *pszSymlink, const char *pszTarget,
     509RTDECL(int) RTDirRelSymlinkCreate(RTDIR hDir, const char *pszSymlink, const char *pszTarget,
    510510                                  RTSYMLINKTYPE enmType, uint32_t fCreate)
    511511{
    512     PRTDIR pThis = hDir;
     512    PRTDIRINTERNAL pThis = hDir;
    513513    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    514514    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
     
    540540 * @sa      RTSymlinkRead
    541541 */
    542 RTDECL(int) RTDirRelSymlinkRead(PRTDIR hDir, const char *pszSymlink, char *pszTarget, size_t cbTarget, uint32_t fRead)
    543 {
    544     PRTDIR pThis = hDir;
     542RTDECL(int) RTDirRelSymlinkRead(RTDIR hDir, const char *pszSymlink, char *pszTarget, size_t cbTarget, uint32_t fRead)
     543{
     544    PRTDIRINTERNAL pThis = hDir;
    545545    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    546546    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
  • trunk/src/VBox/Runtime/r3/linux/RTProcIsRunningByName-linux.cpp

    r69111 r69753  
    5454     * Enumerate /proc.
    5555     */
    56     PRTDIR pDir;
    57     int rc = RTDirOpen(&pDir, "/proc");
     56    RTDIR hDir;
     57    int rc = RTDirOpen(&hDir, "/proc");
    5858    AssertMsgRCReturn(rc, ("RTDirOpen on /proc failed: rc=%Rrc\n", rc), false);
    5959    if (RT_SUCCESS(rc))
    6060    {
    6161        RTDIRENTRY DirEntry;
    62         while (RT_SUCCESS(RTDirRead(pDir, &DirEntry, NULL)))
     62        while (RT_SUCCESS(RTDirRead(hDir, &DirEntry, NULL)))
    6363        {
    6464            /*
     
    104104                    {
    105105                        /* Found it! */
    106                         RTDirClose(pDir);
     106                        RTDirClose(hDir);
    107107                        return true;
    108108                    }
  • trunk/src/VBox/Runtime/r3/linux/krnlmod-linux.cpp

    r67286 r69753  
    172172    uint32_t cKmodsLoaded = 0;
    173173
    174     PRTDIR pDir = NULL;
    175     int rc = RTDirOpen(&pDir, "/sys/module");
     174    RTDIR hDir = NULL;
     175    int rc = RTDirOpen(&hDir, "/sys/module");
    176176    if (RT_SUCCESS(rc))
    177177    {
    178178        RTDIRENTRY DirEnt;
    179         rc = RTDirRead(pDir, &DirEnt, NULL);
     179        rc = RTDirRead(hDir, &DirEnt, NULL);
    180180        while (RT_SUCCESS(rc))
    181181        {
    182             if (   RTStrCmp(DirEnt.szName, ".")
    183                 && RTStrCmp(DirEnt.szName, ".."))
     182            if (!RTDirEntryIsStdDotLink(&DirEntry))
    184183                cKmodsLoaded++;
    185             rc = RTDirRead(pDir, &DirEnt, NULL);
     184            rc = RTDirRead(hDir, &DirEnt, NULL);
    186185        }
    187186
    188         RTDirClose(pDir);
     187        RTDirClose(hDir);
    189188    }
    190189
     
    207206    }
    208207
    209     PRTDIR pDir = NULL;
     208    RTDIR hDir = NULL;
    210209    int rc = RTDirOpen(&pDir, "/sys/module");
    211210    if (RT_SUCCESS(rc))
     
    214213        RTDIRENTRY DirEnt;
    215214
    216         rc = RTDirRead(pDir, &DirEnt, NULL);
     215        rc = RTDirRead(hDir, &DirEnt, NULL);
    217216        while (RT_SUCCESS(rc))
    218217        {
    219             if (   RTStrCmp(DirEnt.szName, ".")
    220                 && RTStrCmp(DirEnt.szName, ".."))
     218            if (!RTDirEntryIsStdDotLink(&DirEnt))
    221219            {
    222220                rc = rtKrnlModLinuxInfoCreate(DirEnt.szName, &pahKrnlModInfo[idxKrnlModInfo]);
     
    226224
    227225            if (RT_SUCCESS(rc))
    228                 rc = RTDirRead(pDir, &DirEnt, NULL);
     226                rc = RTDirRead(hDir, &DirEnt, NULL);
    229227        }
    230228
     
    241239            *pcEntries = cKmodsLoaded;
    242240
    243         RTDirClose(pDir);
     241        RTDirClose(hDir);
    244242    }
    245243
  • trunk/src/VBox/Runtime/r3/nt/direnum-r3-nt.cpp

    r69716 r69753  
    4848*   Defined Constants And Macros                                                                                                 *
    4949*********************************************************************************************************************************/
    50 /** Whether to return a single record (TRUE) or multiple (FALSE)o. */
     50/** Whether to return a single record (TRUE) or multiple (FALSE). */
    5151#define RTDIR_NT_SINGLE_RECORD  FALSE
    5252
     
    7777{
    7878    NOREF(pszPath);
    79     return sizeof(RTDIR);
    80 }
    81 
    82 
    83 int rtDirNativeOpen(PRTDIR pDir, char *pszPathBuf, uintptr_t hRelativeDir, void *pvNativeRelative)
     79    return sizeof(RTDIRINTERNAL);
     80}
     81
     82
     83int rtDirNativeOpen(PRTDIRINTERNAL pDir, char *pszPathBuf, uintptr_t hRelativeDir, void *pvNativeRelative)
    8484{
    8585    /*
     
    155155
    156156
    157 RTDECL(int) RTDirClose(PRTDIR pDir)
    158 {
     157RTDECL(int) RTDirClose(RTDIR hDir)
     158{
     159    PRTDIRINTERNAL pDir = hDir;
     160
    159161    /*
    160162     * Validate input.
     
    196198 * @param   pThis       The directory instance data.
    197199 */
    198 static int rtDirNtCheckRecord(PRTDIR pThis)
     200static int rtDirNtCheckRecord(PRTDIRINTERNAL pThis)
    199201{
    200202#ifdef RTDIR_NT_STRICT
     
    232234 * @param   pThis       The directory instance data.
    233235 */
    234 static int rtDirNtAdvanceBuffer(PRTDIR pThis)
     236static int rtDirNtAdvanceBuffer(PRTDIRINTERNAL pThis)
    235237{
    236238    int rc;
     
    275277 * @param   pThis       The directory instance data.
    276278 */
    277 static int rtDirNtFetchMore(PRTDIR pThis)
     279static int rtDirNtFetchMore(PRTDIRINTERNAL pThis)
    278280{
    279281    Assert(!pThis->fDataUnread);
     
    496498 * @param   pwsName     The file name, not terminated.
    497499 */
    498 static int rtDirNtConvertName(PRTDIR pThis, uint32_t cbName, PCRTUTF16 pwsName)
     500static int rtDirNtConvertName(PRTDIRINTERNAL pThis, uint32_t cbName, PCRTUTF16 pwsName)
    499501{
    500502    int rc = RTUtf16ToUtf8Ex(pwsName, cbName / 2, &pThis->pszName, pThis->cbNameAlloc, &pThis->cchName);
     
    525527 * @param   pThis       The directory instance data.
    526528 */
    527 static int rtDirNtConvertCurName(PRTDIR pThis)
     529static int rtDirNtConvertCurName(PRTDIRINTERNAL pThis)
    528530{
    529531    switch (pThis->enmInfoClass)
     
    544546
    545547
    546 RTDECL(int) RTDirRead(PRTDIR pDir, PRTDIRENTRY pDirEntry, size_t *pcbDirEntry)
    547 {
     548RTDECL(int) RTDirRead(RTDIR hDir, PRTDIRENTRY pDirEntry, size_t *pcbDirEntry)
     549{
     550    PRTDIRINTERNAL pDir = hDir;
    548551    int rc;
    549552
     
    642645
    643646
    644 RTDECL(int) RTDirReadEx(PRTDIR pDir, PRTDIRENTRYEX pDirEntry, size_t *pcbDirEntry,
     647RTDECL(int) RTDirReadEx(RTDIR hDir, PRTDIRENTRYEX pDirEntry, size_t *pcbDirEntry,
    645648                        RTFSOBJATTRADD enmAdditionalAttribs, uint32_t fFlags)
    646649{
     650    PRTDIRINTERNAL pDir = hDir;
    647651    int rc;
    648652
     
    823827
    824828
    825 RTR3DECL(int) RTDirQueryInfo(PRTDIR pDir, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs)
    826 {
     829RTR3DECL(int) RTDirQueryInfo(RTDIR hDir, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAdditionalAttribs)
     830{
     831    PRTDIRINTERNAL pDir = hDir;
    827832    AssertPtrReturn(pDir, VERR_INVALID_POINTER);
    828833    AssertReturn(pDir->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
  • trunk/src/VBox/Runtime/r3/nt/dirrel-r3-nt.cpp

    r69720 r69753  
    6363 * @param   pszRelPath          The relative path.
    6464 */
    65 static int rtDirRelBuildFullPath(PRTDIR pThis, char *pszPathDst, size_t cbPathDst, const char *pszRelPath)
     65static int rtDirRelBuildFullPath(PRTDIRINTERNAL pThis, char *pszPathDst, size_t cbPathDst, const char *pszRelPath)
    6666{
    6767    AssertMsgReturn(!RTPathStartsWithRoot(pszRelPath), ("pszRelPath='%s'\n", pszRelPath), VERR_PATH_IS_NOT_RELATIVE);
     
    116116
    117117
    118 RTDECL(int)  RTDirRelFileOpen(PRTDIR hDir, const char *pszRelFilename, uint64_t fOpen, PRTFILE phFile)
    119 {
    120     PRTDIR pThis = hDir;
     118RTDECL(int)  RTDirRelFileOpen(RTDIR hDir, const char *pszRelFilename, uint64_t fOpen, PRTFILE phFile)
     119{
     120    PRTDIRINTERNAL pThis = hDir;
    121121    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    122122    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
     
    188188
    189189
    190 RTDECL(int) RTDirRelDirOpen(PRTDIR hDir, const char *pszDir, PRTDIR *phDir)
     190RTDECL(int) RTDirRelDirOpen(RTDIR hDir, const char *pszDir, RTDIR *phDir)
    191191{
    192192    return RTDirRelDirOpenFiltered(hDir, pszDir, RTDIRFILTER_NONE, 0 /*fFlags*/, phDir);
     
    194194
    195195
    196 RTDECL(int) RTDirRelDirOpenFiltered(PRTDIR hDir, const char *pszDirAndFilter, RTDIRFILTER enmFilter,
    197                                     uint32_t fFlags, PRTDIR *phDir)
    198 {
    199     PRTDIR pThis = hDir;
     196RTDECL(int) RTDirRelDirOpenFiltered(RTDIR hDir, const char *pszDirAndFilter, RTDIRFILTER enmFilter,
     197                                    uint32_t fFlags, RTDIR *phDir)
     198{
     199    PRTDIRINTERNAL pThis = hDir;
    200200    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    201201    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
     
    217217
    218218
    219 RTDECL(int) RTDirRelDirCreate(PRTDIR hDir, const char *pszRelPath, RTFMODE fMode, uint32_t fCreate, PRTDIR *phSubDir)
    220 {
    221     PRTDIR pThis = hDir;
     219RTDECL(int) RTDirRelDirCreate(RTDIR hDir, const char *pszRelPath, RTFMODE fMode, uint32_t fCreate, RTDIR *phSubDir)
     220{
     221    PRTDIRINTERNAL pThis = hDir;
    222222    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    223223    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
     
    308308
    309309
    310 RTDECL(int) RTDirRelDirRemove(PRTDIR hDir, const char *pszRelPath)
    311 {
    312     PRTDIR pThis = hDir;
     310RTDECL(int) RTDirRelDirRemove(RTDIR hDir, const char *pszRelPath)
     311{
     312    PRTDIRINTERNAL pThis = hDir;
    313313    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    314314    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
     
    372372
    373373
    374 RTDECL(int) RTDirRelPathQueryInfo(PRTDIR hDir, const char *pszRelPath, PRTFSOBJINFO pObjInfo,
     374RTDECL(int) RTDirRelPathQueryInfo(RTDIR hDir, const char *pszRelPath, PRTFSOBJINFO pObjInfo,
    375375                                  RTFSOBJATTRADD enmAddAttr, uint32_t fFlags)
    376376{
    377     PRTDIR pThis = hDir;
     377    PRTDIRINTERNAL pThis = hDir;
    378378    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    379379    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
     
    409409 * @sa      RTPathSetMode
    410410 */
    411 RTDECL(int) RTDirRelPathSetMode(PRTDIR hDir, const char *pszRelPath, RTFMODE fMode, uint32_t fFlags)
    412 {
    413     PRTDIR pThis = hDir;
     411RTDECL(int) RTDirRelPathSetMode(RTDIR hDir, const char *pszRelPath, RTFMODE fMode, uint32_t fFlags)
     412{
     413    PRTDIRINTERNAL pThis = hDir;
    414414    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    415415    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
     
    458458 * @sa      RTPathSetTimesEx
    459459 */
    460 RTDECL(int) RTDirRelPathSetTimes(PRTDIR hDir, const char *pszRelPath, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime,
     460RTDECL(int) RTDirRelPathSetTimes(RTDIR hDir, const char *pszRelPath, PCRTTIMESPEC pAccessTime, PCRTTIMESPEC pModificationTime,
    461461                                 PCRTTIMESPEC pChangeTime, PCRTTIMESPEC pBirthTime, uint32_t fFlags)
    462462{
    463     PRTDIR pThis = hDir;
     463    PRTDIRINTERNAL pThis = hDir;
    464464    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    465465    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
     
    490490 * @sa      RTPathSetOwnerEx
    491491 */
    492 RTDECL(int) RTDirRelPathSetOwner(PRTDIR hDir, const char *pszRelPath, uint32_t uid, uint32_t gid, uint32_t fFlags)
    493 {
    494     PRTDIR pThis = hDir;
     492RTDECL(int) RTDirRelPathSetOwner(RTDIR hDir, const char *pszRelPath, uint32_t uid, uint32_t gid, uint32_t fFlags)
     493{
     494    PRTDIRINTERNAL pThis = hDir;
    495495    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    496496    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
     
    527527 * @sa      RTPathRename
    528528 */
    529 RTDECL(int) RTDirRelPathRename(PRTDIR hDirSrc, const char *pszSrc, PRTDIR hDirDst, const char *pszDst, unsigned fRename)
    530 {
    531     PRTDIR pThis = hDirSrc;
    532     AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    533     AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
    534 
    535     PRTDIR pThat = hDirDst;
     529RTDECL(int) RTDirRelPathRename(RTDIR hDirSrc, const char *pszSrc, RTDIR hDirDst, const char *pszDst, unsigned fRename)
     530{
     531    PRTDIRINTERNAL pThis = hDirSrc;
     532    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
     533    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
     534
     535    PRTDIRINTERNAL pThat = hDirDst;
    536536    if (pThat != pThis)
    537537    {
     
    566566 * @sa      RTPathUnlink
    567567 */
    568 RTDECL(int) RTDirRelPathUnlink(PRTDIR hDir, const char *pszRelPath, uint32_t fUnlink)
    569 {
    570     PRTDIR pThis = hDir;
     568RTDECL(int) RTDirRelPathUnlink(RTDIR hDir, const char *pszRelPath, uint32_t fUnlink)
     569{
     570    PRTDIRINTERNAL pThis = hDir;
    571571    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    572572    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
     
    611611 * @sa      RTSymlinkCreate
    612612 */
    613 RTDECL(int) RTDirRelSymlinkCreate(PRTDIR hDir, const char *pszSymlink, const char *pszTarget,
     613RTDECL(int) RTDirRelSymlinkCreate(RTDIR hDir, const char *pszSymlink, const char *pszTarget,
    614614                                  RTSYMLINKTYPE enmType, uint32_t fCreate)
    615615{
    616     PRTDIR pThis = hDir;
     616    PRTDIRINTERNAL pThis = hDir;
    617617    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    618618    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
     
    647647 * @sa      RTSymlinkRead
    648648 */
    649 RTDECL(int) RTDirRelSymlinkRead(PRTDIR hDir, const char *pszSymlink, char *pszTarget, size_t cbTarget, uint32_t fRead)
    650 {
    651     PRTDIR pThis = hDir;
     649RTDECL(int) RTDirRelSymlinkRead(RTDIR hDir, const char *pszSymlink, char *pszTarget, size_t cbTarget, uint32_t fRead)
     650{
     651    PRTDIRINTERNAL pThis = hDir;
    652652    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    653653    AssertReturn(pThis->u32Magic == RTDIR_MAGIC, VERR_INVALID_HANDLE);
  • trunk/src/VBox/Runtime/r3/posix/dir-posix.cpp

    r69691 r69753  
    215215        cbNameMax = _XOPEN_NAME_MAX;
    216216# endif
    217     size_t cbDir = RT_OFFSETOF(RTDIR, Data.d_name[cbNameMax + 1]);
    218     if (cbDir < sizeof(RTDIR))          /* Ditto. */
    219         cbDir = sizeof(RTDIR);
     217    size_t cbDir = RT_OFFSETOF(RTDIRINTERNAL, Data.d_name[cbNameMax + 1]);
     218    if (cbDir < sizeof(RTDIRINTERNAL))  /* Ditto. */
     219        cbDir = sizeof(RTDIRINTERNAL);
    220220    cbDir = RT_ALIGN_Z(cbDir, 8);
    221221
     
    224224
    225225
    226 int rtDirNativeOpen(PRTDIR pDir, char *pszPathBuf, uintptr_t hRelativeDir, void *pvNativeRelative)
     226int rtDirNativeOpen(PRTDIRINTERNAL pDir, char *pszPathBuf, uintptr_t hRelativeDir, void *pvNativeRelative)
    227227{
    228228    NOREF(pszPathBuf); /* only used on windows */
     
    255255
    256256
    257 RTDECL(int) RTDirClose(PRTDIR pDir)
    258 {
     257RTDECL(int) RTDirClose(RTDIR hDir)
     258{
     259    PRTDIRINTERNAL pDir = hDir;
     260
    259261    /*
    260262     * Validate input.
     
    291293 * @param   pDir        the open directory. Fully validated.
    292294 */
    293 static int rtDirReadMore(PRTDIR pDir)
     295static int rtDirReadMore(PRTDIRINTERNAL pDir)
    294296{
    295297    /** @todo try avoid the rematching on buffer overflow errors. */
     
    377379
    378380
    379 RTDECL(int) RTDirRead(PRTDIR pDir, PRTDIRENTRY pDirEntry, size_t *pcbDirEntry)
    380 {
     381RTDECL(int) RTDirRead(RTDIR hDir, PRTDIRENTRY pDirEntry, size_t *pcbDirEntry)
     382{
     383    PRTDIRINTERNAL pDir = hDir;
     384
    381385    /*
    382386     * Validate and digest input.
     
    474478
    475479
    476 RTDECL(int) RTDirReadEx(PRTDIR pDir, PRTDIRENTRYEX pDirEntry, size_t *pcbDirEntry, RTFSOBJATTRADD enmAdditionalAttribs, uint32_t fFlags)
    477 {
     480RTDECL(int) RTDirReadEx(RTDIR hDir, PRTDIRENTRYEX pDirEntry, size_t *pcbDirEntry,
     481                        RTFSOBJATTRADD enmAdditionalAttribs, uint32_t fFlags)
     482{
     483    PRTDIRINTERNAL pDir = hDir;
     484
    478485    /*
    479486     * Validate and digest input.
  • trunk/src/VBox/Runtime/r3/win/direnum-win.cpp

    r69691 r69753  
    4747{
    4848    NOREF(pszPath);
    49     return sizeof(RTDIR);
    50 }
    51 
    52 
    53 int rtDirNativeOpen(PRTDIR pDir, char *pszPathBuf, uintptr_t hRelativeDir, void *pvNativeRelative))
     49    return sizeof(RTDIRINTERNAL);
     50}
     51
     52
     53int rtDirNativeOpen(PRTDIRINTERNAL pDir, char *pszPathBuf, uintptr_t hRelativeDir, void *pvNativeRelative))
    5454{
    5555    RT_NOREF(hRelativeDir, pvNativeRelative);
     
    107107
    108108
    109 RTDECL(int) RTDirClose(PRTDIR pDir)
     109RTDECL(int) RTDirClose(PRTDIRINTERNAL pDir)
    110110{
    111111    /*
     
    138138
    139139
    140 RTDECL(int) RTDirRead(PRTDIR pDir, PRTDIRENTRY pDirEntry, size_t *pcbDirEntry)
    141 {
     140RTDECL(int) RTDirRead(RTDIR hDir, PRTDIRENTRY pDirEntry, size_t *pcbDirEntry)
     141{
     142    PPRTDIRINTERNAL pDir = hDir;
     143
    142144    /*
    143145     * Validate input.
     
    222224
    223225
    224 RTDECL(int) RTDirReadEx(PRTDIR pDir, PRTDIRENTRYEX pDirEntry, size_t *pcbDirEntry, RTFSOBJATTRADD enmAdditionalAttribs, uint32_t fFlags)
    225 {
     226RTDECL(int) RTDirReadEx(RTDIR hDir, PRTDIRENTRYEX pDirEntry, size_t *pcbDirEntry, RTFSOBJATTRADD enmAdditionalAttribs, uint32_t fFlags)
     227{
     228    PPRTDIRINTERNAL pDir = hDir;
    226229    /** @todo Symlinks: Find[First|Next]FileW will return info about
    227230        the link, so RTPATH_F_FOLLOW_LINK is not handled correctly. */
Note: See TracChangeset for help on using the changeset viewer.

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