VirtualBox

Changeset 24889 in vbox for trunk/src


Ignore:
Timestamp:
Nov 24, 2009 11:09:45 AM (15 years ago)
Author:
vboxsync
Message:

IPRT: Added RTFileQueryFsSizes.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/posix/fileio-posix.cpp

    r24585 r24889  
    4747# include <unistd.h>
    4848# include <sys/time.h>
     49# include <sys/statvfs.h>
    4950#endif
    5051#ifdef RT_OS_LINUX
     
    718719
    719720
     721RTR3DECL(int) RTFileQueryFsSizes(RTFILE hFile, PRTFOFF pcbTotal, RTFOFF *pcbFree,
     722                                 uint32_t *pcbBlock, uint32_t *pcbSector)
     723{
     724    struct statvfs StatVFS;
     725    RT_ZERO(StatVFS);
     726    if (fstatvfs(hFile, &StatVFS))
     727        return RTErrConvertFromErrno(errno);
     728
     729    /*
     730     * Calc the returned values.
     731     */
     732    if (pcbTotal)
     733        *pcbTotal = (RTFOFF)StatVFS.f_blocks * StatVFS.f_frsize;
     734    if (pcbFree)
     735        *pcbFree = (RTFOFF)StatVFS.f_bavail * StatVFS.f_frsize;
     736    if (pcbBlock)
     737        *pcbBlock = StatVFS.f_frsize;
     738    /* no idea how to get the sector... */
     739    if (pcbSector)
     740        *pcbSector = 512;
     741
     742    return VINF_SUCCESS;
     743}
     744
     745
     746
    720747RTR3DECL(int) RTFileRename(const char *pszSrc, const char *pszDst, unsigned fRename)
    721748{
  • trunk/src/VBox/Runtime/r3/win/fileio-win.cpp

    r24341 r24889  
    790790
    791791
     792RTR3DECL(int) RTFileQueryFsSizes(RTFILE hFile, PRTFOFF pcbTotal, RTFOFF *pcbFree,
     793                                 uint32_t *pcbBlock, uint32_t *pcbSector)
     794{
     795    return VERR_NOT_SUPPORTED;
     796}
     797
     798
    792799RTR3DECL(int)  RTFileDelete(const char *pszFilename)
    793800{
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