VirtualBox

Changeset 64623 in vbox for trunk


Ignore:
Timestamp:
Nov 9, 2016 6:30:42 PM (8 years ago)
Author:
vboxsync
Message:

direnum-r3-nt.cpp: Fill in inode info when we can.

Location:
trunk/src/VBox/Runtime
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/include/internal/dir.h

    r62477 r64623  
    125125     * fDataUnread indicates valid data. */
    126126    uint8_t            *pabBuffer;
     127    /** The device number for the directory (serial number). */
     128    RTDEV               uDirDev;
    127129#  endif
    128130# else /* 'POSIX': */
  • trunk/src/VBox/Runtime/r3/nt/direnum-r3-nt.cpp

    r64620 r64623  
    123123         */
    124124        pDir->fDataUnread = false; /* spelling it out */
     125        pDir->uDirDev     = 0;
    125126#ifdef IPRT_WITH_NT_PATH_PASSTHRU
    126127        if (fObjDir)
     
    295296                return VERR_NO_MEMORY;
    296297        }
     298
     299        /*
     300         * Also try determining the device number.
     301         */
     302        PFILE_FS_VOLUME_INFORMATION pVolInfo = (PFILE_FS_VOLUME_INFORMATION)pThis->pabBuffer;
     303        pVolInfo->VolumeSerialNumber = 0;
     304        IO_STATUS_BLOCK Ios = RTNT_IO_STATUS_BLOCK_INITIALIZER;
     305        NTSTATUS rcNt = NtQueryVolumeInformationFile(pThis->hDir, &Ios,
     306                                                     pVolInfo, RT_MIN(_2K, pThis->cbBufferAlloc),
     307                                                     FileFsVolumeInformation);
     308        if (NT_SUCCESS(rcNt) && NT_SUCCESS(Ios.Status))
     309            pThis->uDirDev = pVolInfo->VolumeSerialNumber;
     310        else
     311            pThis->uDirDev = 0;
     312        AssertCompile(sizeof(pThis->uDirDev) == sizeof(pVolInfo->VolumeSerialNumber));
     313        /** @todo Grow RTDEV to 64-bit and add low dword of VolumeCreationTime to the top of uDirDev. */
    297314    }
    298315
     
    735752            pDirEntry->Info.Attr.u.Unix.gid             = ~0U;
    736753            pDirEntry->Info.Attr.u.Unix.cHardlinks      = 1;
    737             pDirEntry->Info.Attr.u.Unix.INodeIdDevice   = 0; /** @todo Use the volume serial number (see GetFileInformationByHandle). */
    738             pDirEntry->Info.Attr.u.Unix.INodeId         = 0; /** @todo Use the fileid (see GetFileInformationByHandle). */
     754            pDirEntry->Info.Attr.u.Unix.INodeIdDevice   = pDir->uDirDev;
     755            pDirEntry->Info.Attr.u.Unix.INodeId         = 0;
     756            if (   pDir->enmInfoClass == FileIdBothDirectoryInformation
     757                && pDir->uCurData.pBothId->FileId.QuadPart != UINT64_MAX)
     758                pDirEntry->Info.Attr.u.Unix.INodeId     = pDir->uCurData.pBothId->FileId.QuadPart;
    739759            pDirEntry->Info.Attr.u.Unix.fFlags          = 0;
    740760            pDirEntry->Info.Attr.u.Unix.GenerationId    = 0;
  • trunk/src/VBox/Runtime/testcase/tstDir.cpp

    r62477 r64623  
    4141     */
    4242    bool fLong      = false;
     43    bool fTimes     = false;
     44    bool fInode     = false;
    4345    bool fShortName = false;
    4446    bool fFiltered  = false;
     
    5557                        fLong = true;
    5658                        break;
     59                    case 'i':
     60                        fLong = fInode = true;
     61                        break;
     62                    case 't':
     63                        fLong = fTimes = true;
     64                        break;
    5765                    case 's':
    58                         fShortName = true;
     66                        fLong = fShortName = true;
    5967                        break;
    6068                    case 'f':
     
    168176                                     fMode & RTFS_DOS_NT_NOT_CONTENT_INDEXED ? 'I' : '-',
    169177                                     fMode & RTFS_DOS_NT_ENCRYPTED      ? 'E' : '-');
    170                             RTPrintf(" %d %4d %4d %10lld %10lld %#llx %#llx %#llx %#llx",
     178                            RTPrintf(" %d %4d %4d %10lld %10lld",
    171179                                     DirEntry.Info.Attr.u.Unix.cHardlinks,
    172180                                     DirEntry.Info.Attr.u.Unix.uid,
    173181                                     DirEntry.Info.Attr.u.Unix.gid,
    174182                                     DirEntry.Info.cbObject,
    175                                      DirEntry.Info.cbAllocated,
    176                                      DirEntry.Info.BirthTime,
    177                                      DirEntry.Info.ChangeTime,
    178                                      DirEntry.Info.ModificationTime,
    179                                      DirEntry.Info.AccessTime);
     183                                     DirEntry.Info.cbAllocated);
     184                            if (fTimes)
     185                                RTPrintf(" %#llx %#llx %#llx %#llx",
     186                                         DirEntry.Info.BirthTime,
     187                                         DirEntry.Info.ChangeTime,
     188                                         DirEntry.Info.ModificationTime,
     189                                         DirEntry.Info.AccessTime);
     190
     191                            if (fInode)
     192                                RTPrintf(" %#x:%#018llx",
     193                                         DirEntry.Info.Attr.u.Unix.INodeIdDevice, DirEntry.Info.Attr.u.Unix.INodeId);
    180194                            if (fShortName)
    181195                                RTPrintf(" %2d %-12ls ", DirEntry.cwcShortName, DirEntry.wszShortName);
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