VirtualBox

Changeset 69977 in vbox


Ignore:
Timestamp:
Dec 7, 2017 1:02:36 PM (7 years ago)
Author:
vboxsync
Message:

IPRT/vfs: Implemented RTVFsFileSetSize, RTVfsFileGetMaxSize and RTvfsFileQueryMaxSize.

Location:
trunk
Files:
18 edited

Legend:

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

    r69105 r69977  
    11371137/** @} */
    11381138
    1139 /** @name RTFileSetAllocationSize flags
     1139/**
     1140 * Sets the current size of the file ensuring that all required blocks
     1141 * are allocated on the underlying medium.
     1142 *
     1143 * @returns IPRT status code.
     1144 * @retval  VERR_NOT_SUPPORTED if either this operation is not supported on the
     1145 *          current host in an efficient manner or the given combination of
     1146 *          flags is not supported.
     1147 * @param   hFile           The handle to the file.
     1148 * @param   cbSize          The new size of the file to allocate.
     1149 * @param   fFlags          Combination of RTFILE_ALLOC_SIZE_F_*
     1150 */
     1151RTDECL(int) RTFileSetAllocationSize(RTFILE hFile, uint64_t cbSize, uint32_t fFlags);
     1152
     1153/** @name RTFILE_ALLOC_SIZE_F_XXX - RTFileSetAllocationSize flags
    11401154 * @{ */
    11411155/** Default flags. */
    11421156#define RTFILE_ALLOC_SIZE_F_DEFAULT         0
    1143 /** Do not change the size of the file if the given size is
    1144  * bigger than the current file size. Useful to preallocate
    1145  * blocks beyond the current size for appending data in an efficient
    1146  * manner. Might not be supported on all hosts and will return
     1157/** Do not change the size of the file if the given size is bigger than the
     1158 * current file size.
     1159 *
     1160 * Useful to preallocate blocks beyond the current size for appending data in an
     1161 * efficient manner. Might not be supported on all hosts and will return
    11471162 * VERR_NOT_SUPPORTED in that case. */
    11481163#define RTFILE_ALLOC_SIZE_F_KEEP_SIZE       RT_BIT(0)
     
    11511166/** @} */
    11521167
    1153 /**
    1154  * Sets the current size of the file ensuring that all required blocks
    1155  * are allocated on the underlying medium.
    1156  *
    1157  * @returns IPRT status code.
    1158  * @retval  VERR_NOT_SUPPORTED if either this operation is not supported on the current host
    1159  *                             in an efficient manner or the given combination of flags is
    1160  *                             not supported.
    1161  * @param   hFile           The handle to the file.
    1162  * @param   cbSize          The new size of the file to allocate.
    1163  * @param   fFlags          Combination of RTFILE_ALLOC_SIZE_F_*
    1164  */
    1165 RTDECL(int) RTFileSetAllocationSize(RTFILE hFile, uint64_t cbSize, uint32_t fFlags);
    11661168
    11671169#ifdef IN_RING3
  • trunk/include/iprt/mangling.h

    r69892 r69977  
    24742474# define RTVfsFileGetOpenFlags                          RT_MANGLER(RTVfsFileGetOpenFlags)
    24752475# define RTVfsFileGetSize                               RT_MANGLER(RTVfsFileGetSize)
     2476# define RTVfsFileGetMaxSize                            RT_MANGLER(RTVfsFileGetMaxSize)
    24762477# define RTVfsFileOpen                                  RT_MANGLER(RTVfsFileOpen)
    24772478# define RTVfsFileOpenNormal                            RT_MANGLER(RTVfsFileOpenNormal)
    24782479# define RTVfsFilePoll                                  RT_MANGLER(RTVfsFilePoll)
    24792480# define RTVfsFileQueryInfo                             RT_MANGLER(RTVfsFileQueryInfo)
     2481# define RTVfsFileQueryMaxSize                          RT_MANGLER(RTVfsFileQueryMaxSize)
    24802482# define RTVfsFileRead                                  RT_MANGLER(RTVfsFileRead)
    24812483# define RTVfsFileReadAt                                RT_MANGLER(RTVfsFileReadAt)
     
    24842486# define RTVfsFileRetainDebug                           RT_MANGLER(RTVfsFileRetainDebug)
    24852487# define RTVfsFileSeek                                  RT_MANGLER(RTVfsFileSeek)
     2488# define RTVfsFileSetSize                               RT_MANGLER(RTVfsFileSetSize)
    24862489# define RTVfsFileSgRead                                RT_MANGLER(RTVfsFileSgRead)
    24872490# define RTVfsFileSgWrite                               RT_MANGLER(RTVfsFileSgWrite)
  • trunk/include/iprt/vfs.h

    r69844 r69977  
    14041404RTDECL(int)         RTVfsFileSeek(RTVFSFILE hVfsFile, RTFOFF offSeek, uint32_t uMethod, uint64_t *poffActual);
    14051405
    1406 RTDECL(int)         RTVfsFileSetSize(RTVFSFILE hVfsFile, uint64_t cbSize);
     1406/**
     1407 * Sets the size of a file.
     1408 *
     1409 * This may also be used for preallocating space
     1410 * (RTVFSFILE_SIZE_F_PREALLOC_KEEP_SIZE).
     1411 *
     1412 * @returns IPRT status code.
     1413 * @retval  VERR_ACCESS_DENIED if handle isn't writable.
     1414 * @retval  VERR_WRITE_PROTECT if read-only file system.
     1415 * @retval  VERR_FILE_TOO_BIG if cbSize is larger than what the file system can
     1416 *          theoretically deal with.
     1417 * @retval  VERR_DISK_FULL if the file system if full.
     1418 * @retval  VERR_NOT_SUPPORTED if fFlags indicates some operation that's not
     1419 *          supported by the file system / host operating system.
     1420 *
     1421 * @param   hVfsFile        The VFS file handle.
     1422 * @param   cbSize          The new file size.
     1423 * @param   fFlags          RTVFSFILE_SIZE_F_NORMAL, RTVFSFILE_SIZE_F_GROW, or
     1424 *                          RTVFSFILE_SIZE_F_GROW_KEEP_SIZE.
     1425 *
     1426 * @sa      RTFileSetSize, RTFileSetAllocationSize
     1427 */
     1428RTDECL(int)         RTVfsFileSetSize(RTVFSFILE hVfsFile, uint64_t cbSize, uint32_t fFlags);
     1429
     1430/** @name RTVFSFILE_SIZE_F_XXX - RTVfsFileSetSize flags.
     1431 * @{ */
     1432/** Normal truncate or grow (zero'ed) like RTFileSetSize . */
     1433#define RTVFSFILE_SIZE_F_NORMAL             UINT32_C(0x00000001)
     1434/** Only grow the file, ignore call if cbSize would trunacte the file.
     1435 * This is what RTFileSetAllocationSize does by default.  */
     1436#define RTVFSFILE_SIZE_F_GROW               UINT32_C(0x00000002)
     1437/** Only grow the file, ignore call if cbSize would trunacte the file.
     1438 * This is what RTFileSetAllocationSize does by default.  */
     1439#define RTVFSFILE_SIZE_F_GROW_KEEP_SIZE     UINT32_C(0x00000003)
     1440/** Action mask. */
     1441#define RTVFSFILE_SIZE_F_ACTION_MASK        UINT32_C(0x00000003)
     1442/** Validate the flags.
     1443 * Will reference @a a_fFlags more than once.  */
     1444#define RTVFSFILE_SIZE_F_IS_VALID(a_fFlags) \
     1445    ( !((a_fFlags) & ~RTVFSFILE_SIZE_F_ACTION_MASK) && ((a_fFlags) & RTVFSFILE_SIZE_F_ACTION_MASK) != 0 )
     1446/** @} */
     1447
     1448
     1449/** Mask of valid flags. */
     1450#define RTFILE_ALLOC_SIZE_F_VALID           (RTFILE_ALLOC_SIZE_F_KEEP_SIZE)
     1451/** @} */
     1452
     1453
    14071454RTDECL(int)         RTVfsFileGetSize(RTVFSFILE hVfsFile, uint64_t *pcbSize);
    14081455RTDECL(RTFOFF)      RTVfsFileGetMaxSize(RTVFSFILE hVfsFile);
    1409 RTDECL(int)         RTVfsFileGetMaxSizeEx(RTVFSFILE hVfsFile, PRTFOFF pcbMax);
     1456RTDECL(int)         RTVfsFileQueryMaxSize(RTVFSFILE hVfsFile, uint64_t *pcbMax);
    14101457
    14111458/**
  • trunk/include/iprt/vfslowlevel.h

    r69955 r69977  
    10041004
    10051005    /**
    1006      * Get the current file/stream size.
     1006     * Get the current file size.
    10071007     *
    10081008     * @returns IPRT status code.
     
    10121012     */
    10131013    DECLCALLBACKMEMBER(int, pfnQuerySize)(void *pvThis, uint64_t *pcbFile);
     1014
     1015    /**
     1016     * Change the file size.
     1017     *
     1018     * @returns IPRT status code.
     1019     * @retval  VERR_ACCESS_DENIED if handle isn't writable.
     1020     * @retval  VERR_WRITE_PROTECT if read-only file system.
     1021     * @retval  VERR_FILE_TOO_BIG if cbSize is larger than what the file system can
     1022     *          theoretically deal with.
     1023     * @retval  VERR_DISK_FULL if the file system if full.
     1024     * @retval  VERR_NOT_SUPPORTED if fFlags indicates some operation that's not
     1025     *          supported by the file system / host operating system.
     1026     *
     1027     * @param   pvThis      The implementation specific file data.
     1028     * @param   pcbFile     Where to store the current file size.
     1029     * @param   fFlags      RTVFSFILE_SET_SIZE_F_XXX.
     1030     * @note    Optional.  If NULL, VERR_WRITE_PROTECT will be returned.
     1031     * @sa      RTFileSetSize, RTFileSetAllocationSize
     1032     */
     1033    DECLCALLBACKMEMBER(int, pfnSetSize)(void *pvThis, uint64_t cbFile, uint32_t fFlags);
     1034
     1035    /**
     1036     * Determine the maximum file size.
     1037     *
     1038     * This won't take amount of freespace into account, just the limitations of the
     1039     * underlying file system / host operating system.
     1040     *
     1041     * @returns IPRT status code.
     1042     * @param   pvThis      The implementation specific file data.
     1043     * @param   pcbMax      Where to return the max file size.
     1044     * @note    Optional.  If NULL, VERR_NOT_IMPLEMENTED will be returned.
     1045     * @sa      RTFileGetMaxSizeEx
     1046     */
     1047    DECLCALLBACKMEMBER(int, pfnQueryMaxSize)(void *pvThis, uint64_t *pcbMax);
    10141048
    10151049    /** @todo There will be more methods here. */
     
    10221056
    10231057/** The RTVFSFILEOPS structure version. */
    1024 #define RTVFSFILEOPS_VERSION        RT_MAKE_U32_FROM_U8(0xff,0x7f,1,0)
     1058#define RTVFSFILEOPS_VERSION        RT_MAKE_U32_FROM_U8(0xff,0x7f,2,0)
    10251059
    10261060/**
  • trunk/src/VBox/Runtime/common/dvm/dvmvfs.cpp

    r69967 r69977  
    480480    rtDvmVfsFile_Seek,
    481481    rtDvmVfsFile_QuerySize,
     482    NULL /*SetSize*/,
     483    NULL /*QueryMaxSize*/,
    482484    RTVFSFILEOPS_VERSION
    483485};
  • trunk/src/VBox/Runtime/common/fs/fatvfs.cpp

    r69844 r69977  
    25132513    PRTFSFATFILESHRD pShared = pThis->pShared;
    25142514    *pcbFile = pShared->Core.cbObject;
     2515    return VINF_SUCCESS;
     2516}
     2517
     2518
     2519/**
     2520 * @interface_method_impl{RTVFSFILEOPS,pfnSetSize}
     2521 */
     2522static DECLCALLBACK(int) rtFsFatFile_SetSize(void *pvThis, uint64_t cbFile, uint32_t fFlags)
     2523{
     2524    PRTFSFATFILE     pThis   = (PRTFSFATFILE)pvThis;
     2525    PRTFSFATFILESHRD pShared = pThis->pShared;
     2526    AssertReturn(!fFlags, VERR_NOT_SUPPORTED);
     2527    if (cbFile > UINT32_MAX)
     2528        return VERR_FILE_TOO_BIG;
     2529    return rtFsFatObj_SetSize(&pShared->Core, (uint32_t)cbFile);
     2530}
     2531
     2532
     2533/**
     2534 * @interface_method_impl{RTVFSFILEOPS,pfnQueryMaxSize}
     2535 */
     2536static DECLCALLBACK(int) rtFsFatFile_QueryMaxSize(void *pvThis, uint64_t *pcbMax)
     2537{
     2538    RT_NOREF(pvThis);
     2539    *pcbMax = UINT32_MAX;
    25152540    return VINF_SUCCESS;
    25162541}
     
    25542579    rtFsFatFile_Seek,
    25552580    rtFsFatFile_QuerySize,
     2581    rtFsFatFile_SetSize,
     2582    rtFsFatFile_QueryMaxSize,
    25562583    RTVFSFILEOPS_VERSION
    25572584};
  • trunk/src/VBox/Runtime/common/fs/isomaker.cpp

    r69955 r69977  
    73817381    rtFsIsoMakerOutFile_Seek,
    73827382    rtFsIsoMakerOutFile_QuerySize,
     7383    NULL /*SetSize*/,
     7384    NULL /*QueryMaxSize*/,
    73837385    RTVFSFILEOPS_VERSION
    73847386};
  • trunk/src/VBox/Runtime/common/fs/isovfs.cpp

    r69955 r69977  
    21612161    rtFsIsoFile_Seek,
    21622162    rtFsIsoFile_QuerySize,
     2163    NULL /*SetSize*/,
     2164    NULL /*QueryMaxSize*/,
    21632165    RTVFSFILEOPS_VERSION
    21642166};
  • trunk/src/VBox/Runtime/common/fs/ntfsvfs.cpp

    r69962 r69977  
    23372337
    23382338/**
     2339 * @interface_method_impl{RTVFSFILEOPS,pfnSetSize}
     2340 */
     2341static DECLCALLBACK(int) rtFsNtfsFile_SetSize(void *pvThis, uint64_t cbFile, uint32_t fFlags)
     2342{
     2343    NOREF(pvThis); NOREF(cbFile); NOREF(fFlags);
     2344    return VERR_NOT_IMPLEMENTED;
     2345}
     2346
     2347
     2348/**
     2349 * @interface_method_impl{RTVFSFILEOPS,pfnQueryMaxSize}
     2350 */
     2351static DECLCALLBACK(int) rtFsNtfsFile_QueryMaxSize(void *pvThis, uint64_t *pcbMax)
     2352{
     2353    RT_NOREF(pvThis);
     2354    *pcbMax = INT64_MAX;
     2355    return VINF_SUCCESS;
     2356}
     2357
     2358
     2359/**
    23392360 * NTFS file operations.
    23402361 */
     
    23732394    rtFsNtfsFile_Seek,
    23742395    rtFsNtfsFile_QuerySize,
     2396    rtFsNtfsFile_SetSize,
     2397    rtFsNtfsFile_QueryMaxSize,
    23752398    RTVFSFILEOPS_VERSION
    23762399};
  • trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp

    r69955 r69977  
    41964196
    41974197
     4198RTDECL(int)         RTVfsFileSetSize(RTVFSFILE hVfsFile, uint64_t cbSize, uint32_t fFlags)
     4199{
     4200    RTVFSFILEINTERNAL *pThis = hVfsFile;
     4201    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
     4202    AssertReturn(pThis->uMagic == RTVFSFILE_MAGIC, VERR_INVALID_HANDLE);
     4203    AssertReturn(RTVFSFILE_SIZE_F_IS_VALID(fFlags), VERR_INVALID_FLAGS);
     4204    AssertReturn(pThis->Stream.fFlags & RTFILE_O_WRITE, VERR_ACCESS_DENIED);
     4205
     4206    int rc;
     4207    if (pThis->pOps->pfnSetSize)
     4208    {
     4209        RTVfsLockAcquireWrite(pThis->Stream.Base.hLock);
     4210        rc = pThis->pOps->pfnSetSize(pThis->Stream.Base.pvThis, cbSize, fFlags);
     4211        RTVfsLockReleaseWrite(pThis->Stream.Base.hLock);
     4212    }
     4213    else
     4214        rc = VERR_WRITE_PROTECT;
     4215    return rc;
     4216}
     4217
     4218
     4219RTDECL(RTFOFF)      RTVfsFileGetMaxSize(RTVFSFILE hVfsFile)
     4220{
     4221    uint64_t cbMax;
     4222    int rc = RTVfsFileQueryMaxSize(hVfsFile, &cbMax);
     4223    return RT_SUCCESS(rc) ? (RTFOFF)RT_MIN(cbMax, (uint64_t)RTFOFF_MAX) : -1;
     4224}
     4225
     4226
     4227RTDECL(int)         RTVfsFileQueryMaxSize(RTVFSFILE hVfsFile, uint64_t *pcbMax)
     4228{
     4229    RTVFSFILEINTERNAL *pThis = hVfsFile;
     4230    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
     4231    AssertReturn(pThis->uMagic == RTVFSFILE_MAGIC, VERR_INVALID_HANDLE);
     4232    AssertPtrReturn(pcbMax, VERR_INVALID_POINTER);
     4233    *pcbMax = RTFOFF_MAX;
     4234
     4235    int rc;
     4236    if (pThis->pOps->pfnQueryMaxSize)
     4237    {
     4238        RTVfsLockAcquireWrite(pThis->Stream.Base.hLock);
     4239        rc = pThis->pOps->pfnQueryMaxSize(pThis->Stream.Base.pvThis, pcbMax);
     4240        RTVfsLockReleaseWrite(pThis->Stream.Base.hLock);
     4241    }
     4242    else
     4243        rc = VERR_WRITE_PROTECT;
     4244    return rc;
     4245}
     4246
     4247
    41984248RTDECL(uint64_t) RTVfsFileGetOpenFlags(RTVFSFILE hVfsFile)
    41994249{
  • trunk/src/VBox/Runtime/common/vfs/vfsmemory.cpp

    r69942 r69977  
    676676    PRTVFSMEMFILE pThis = (PRTVFSMEMFILE)pvThis;
    677677    *pcbFile = pThis->Base.ObjInfo.cbObject;
     678    return VINF_SUCCESS;
     679}
     680
     681
     682/**
     683 * @interface_method_impl{RTVFSFILEOPS,pfnSetSize}
     684 */
     685static DECLCALLBACK(int) rtVfsMemFile_SetSize(void *pvThis, uint64_t cbFile, uint32_t fFlags)
     686{
     687    NOREF(pvThis); NOREF(cbFile); NOREF(fFlags);
     688    AssertMsgFailed(("Lucky you! You get to implement this (or bug bird about it).\n"));
     689    return VERR_NOT_IMPLEMENTED;
     690}
     691
     692
     693/**
     694 * @interface_method_impl{RTVFSFILEOPS,pfnQueryMaxSize}
     695 */
     696static DECLCALLBACK(int) rtVfsMemFile_QueryMaxSize(void *pvThis, uint64_t *pcbMax)
     697{
     698    RT_NOREF(pvThis);
     699    *pcbMax = ~(size_t)0 >> 1;
    678700    return VINF_SUCCESS;
    679701}
     
    717739    rtVfsMemFile_Seek,
    718740    rtVfsMemFile_QuerySize,
     741    rtVfsMemFile_SetSize,
     742    rtVfsMemFile_QueryMaxSize,
    719743    RTVFSFILEOPS_VERSION
    720744};
  • trunk/src/VBox/Runtime/common/vfs/vfsprogress.cpp

    r69219 r69977  
    404404    return RTVfsFileGetSize(pThis->hVfsFile, pcbFile);
    405405}
     406
     407
     408/**
     409 * @interface_method_impl{RTVFSFILEOPS,pfnSetSize}
     410 */
     411static DECLCALLBACK(int) rtVfsProgressFile_SetSize(void *pvThis, uint64_t cbFile, uint32_t fFlags)
     412{
     413    PRTVFSPROGRESSFILE pThis = (PRTVFSPROGRESSFILE)pvThis;
     414    return RTVfsFileSetSize(pThis->hVfsFile, cbFile, fFlags);
     415}
     416
     417
     418/**
     419 * @interface_method_impl{RTVFSFILEOPS,pfnQueryMaxSize}
     420 */
     421static DECLCALLBACK(int) rtVfsProgressFile_QueryMaxSize(void *pvThis, uint64_t *pcbMax)
     422{
     423    PRTVFSPROGRESSFILE pThis = (PRTVFSPROGRESSFILE)pvThis;
     424    return RTVfsFileQueryMaxSize(pThis->hVfsFile, pcbMax);
     425}
     426
    406427
    407428
     
    443464    rtVfsProgressFile_Seek,
    444465    rtVfsProgressFile_QuerySize,
     466    rtVfsProgressFile_SetSize,
     467    rtVfsProgressFile_QueryMaxSize,
    445468    RTVFSFILEOPS_VERSION
    446469};
  • trunk/src/VBox/Runtime/common/vfs/vfsreadahead.cpp

    r69111 r69977  
    486486    RTCritSectEnter(&pThis->IoCritSect); /* paranoia */
    487487    int rc = RTVfsFileGetSize(pThis->hFile, pcbFile);
     488    RTCritSectLeave(&pThis->IoCritSect);
     489
     490    return rc;
     491}
     492
     493
     494/**
     495 * @interface_method_impl{RTVFSFILEOPS,pfnSetSize}
     496 */
     497static DECLCALLBACK(int) rtVfsReadAhead_SetSize(void *pvThis, uint64_t cbFile, uint32_t fFlags)
     498{
     499    PRTVFSREADAHEAD pThis = (PRTVFSREADAHEAD)pvThis;
     500    AssertReturn(pThis->hFile != NIL_RTVFSFILE, VERR_NOT_SUPPORTED);
     501
     502    RTCritSectEnter(&pThis->IoCritSect); /* paranoia */
     503    int rc = RTVfsFileSetSize(pThis->hFile, cbFile, fFlags);
     504    RTCritSectLeave(&pThis->IoCritSect);
     505
     506    return rc;
     507}
     508
     509
     510/**
     511 * @interface_method_impl{RTVFSFILEOPS,pfnQueryMaxSize}
     512 */
     513static DECLCALLBACK(int) rtVfsReadAhead_QueryMaxSize(void *pvThis, uint64_t *pcbMax)
     514{
     515    PRTVFSREADAHEAD pThis = (PRTVFSREADAHEAD)pvThis;
     516    AssertReturn(pThis->hFile != NIL_RTVFSFILE, VERR_NOT_SUPPORTED);
     517
     518    RTCritSectEnter(&pThis->IoCritSect); /* paranoia */
     519    int rc = RTVfsFileQueryMaxSize(pThis->hFile, pcbMax);
    488520    RTCritSectLeave(&pThis->IoCritSect);
    489521
     
    555587    rtVfsReadAhead_Seek,
    556588    rtVfsReadAhead_QuerySize,
     589    rtVfsReadAhead_SetSize,
     590    rtVfsReadAhead_QueryMaxSize,
    557591    RTVFSFILEOPS_VERSION
    558592};
  • trunk/src/VBox/Runtime/common/vfs/vfsstdfile.cpp

    r69592 r69977  
    384384    PRTVFSSTDFILE pThis = (PRTVFSSTDFILE)pvThis;
    385385    return RTFileGetSize(pThis->hFile, pcbFile);
     386}
     387
     388
     389/**
     390 * @interface_method_impl{RTVFSFILEOPS,pfnSetSize}
     391 */
     392static DECLCALLBACK(int) rtVfsStdFile_SetSize(void *pvThis, uint64_t cbFile, uint32_t fFlags)
     393{
     394    PRTVFSSTDFILE pThis = (PRTVFSSTDFILE)pvThis;
     395    switch (fFlags & RTVFSFILE_SIZE_F_ACTION_MASK)
     396    {
     397        case RTVFSFILE_SIZE_F_NORMAL:
     398            return RTFileSetSize(pThis->hFile, cbFile);
     399        case RTVFSFILE_SIZE_F_GROW:
     400            return RTFileSetAllocationSize(pThis->hFile, cbFile, RTFILE_ALLOC_SIZE_F_DEFAULT);
     401        case RTVFSFILE_SIZE_F_GROW_KEEP_SIZE:
     402            return RTFileSetAllocationSize(pThis->hFile, cbFile, RTFILE_ALLOC_SIZE_F_KEEP_SIZE);
     403        default:
     404            return VERR_NOT_SUPPORTED;
     405    }
     406}
     407
     408
     409/**
     410 * @interface_method_impl{RTVFSFILEOPS,pfnQueryMaxSize}
     411 */
     412static DECLCALLBACK(int) rtVfsStdFile_QueryMaxSize(void *pvThis, uint64_t *pcbMax)
     413{
     414    PRTVFSSTDFILE pThis = (PRTVFSSTDFILE)pvThis;
     415    RTFOFF cbMax = 0;
     416    int rc = RTFileGetMaxSizeEx(pThis->hFile, &cbMax);
     417    if (RT_SUCCESS(rc))
     418        *pcbMax = cbMax;
     419    return rc;
    386420}
    387421
     
    424458    rtVfsStdFile_Seek,
    425459    rtVfsStdFile_QuerySize,
     460    rtVfsStdFile_SetSize,
     461    rtVfsStdFile_QueryMaxSize,
    426462    RTVFSFILEOPS_VERSION
    427463};
  • trunk/src/VBox/Runtime/common/zip/tarvfswriter.cpp

    r67279 r69977  
    827827    rtZipTarWriterPush_Seek,
    828828    rtZipTarWriterPush_QuerySize,
     829    NULL /*SetSize*/,
     830    NULL /*QueryMaxSize*/,
    829831    RTVFSFILEOPS_VERSION
    830832};
  • trunk/src/VBox/Runtime/common/zip/xarvfs.cpp

    r69111 r69977  
    11711171    rtZipXarFssFile_Seek,
    11721172    rtZipXarFssFile_QuerySize,
     1173    NULL /*SetSize*/,
     1174    NULL /*QueryMaxSize*/,
    11731175    RTVFSFILEOPS_VERSION,
    11741176};
  • trunk/src/VBox/Storage/VDIfVfs.cpp

    r69942 r69977  
    365365    vdIfVfsFile_Seek,
    366366    vdIfVfsFile_QuerySize,
     367    NULL /*SetSize*/,
     368    NULL /*QueryMaxSize*/,
    367369    RTVFSFILEOPS_VERSION,
    368370};
  • trunk/src/VBox/Storage/VDVfs.cpp

    r69942 r69977  
    540540    vdVfsFile_Seek,
    541541    vdVfsFile_QuerySize,
     542    NULL /*SetSize*/,
     543    NULL /*QueryMaxSize*/,
    542544    RTVFSFILEOPS_VERSION
    543545};
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