Changeset 69977 in vbox
- Timestamp:
- Dec 7, 2017 1:02:36 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 18 edited
-
include/iprt/file.h (modified) (2 diffs)
-
include/iprt/mangling.h (modified) (2 diffs)
-
include/iprt/vfs.h (modified) (1 diff)
-
include/iprt/vfslowlevel.h (modified) (3 diffs)
-
src/VBox/Runtime/common/dvm/dvmvfs.cpp (modified) (1 diff)
-
src/VBox/Runtime/common/fs/fatvfs.cpp (modified) (2 diffs)
-
src/VBox/Runtime/common/fs/isomaker.cpp (modified) (1 diff)
-
src/VBox/Runtime/common/fs/isovfs.cpp (modified) (1 diff)
-
src/VBox/Runtime/common/fs/ntfsvfs.cpp (modified) (2 diffs)
-
src/VBox/Runtime/common/vfs/vfsbase.cpp (modified) (1 diff)
-
src/VBox/Runtime/common/vfs/vfsmemory.cpp (modified) (2 diffs)
-
src/VBox/Runtime/common/vfs/vfsprogress.cpp (modified) (2 diffs)
-
src/VBox/Runtime/common/vfs/vfsreadahead.cpp (modified) (2 diffs)
-
src/VBox/Runtime/common/vfs/vfsstdfile.cpp (modified) (2 diffs)
-
src/VBox/Runtime/common/zip/tarvfswriter.cpp (modified) (1 diff)
-
src/VBox/Runtime/common/zip/xarvfs.cpp (modified) (1 diff)
-
src/VBox/Storage/VDIfVfs.cpp (modified) (1 diff)
-
src/VBox/Storage/VDVfs.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/file.h
r69105 r69977 1137 1137 /** @} */ 1138 1138 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 */ 1151 RTDECL(int) RTFileSetAllocationSize(RTFILE hFile, uint64_t cbSize, uint32_t fFlags); 1152 1153 /** @name RTFILE_ALLOC_SIZE_F_XXX - RTFileSetAllocationSize flags 1140 1154 * @{ */ 1141 1155 /** Default flags. */ 1142 1156 #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 1147 1162 * VERR_NOT_SUPPORTED in that case. */ 1148 1163 #define RTFILE_ALLOC_SIZE_F_KEEP_SIZE RT_BIT(0) … … 1151 1166 /** @} */ 1152 1167 1153 /**1154 * Sets the current size of the file ensuring that all required blocks1155 * 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 host1159 * in an efficient manner or the given combination of flags is1160 * 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);1166 1168 1167 1169 #ifdef IN_RING3 -
trunk/include/iprt/mangling.h
r69892 r69977 2474 2474 # define RTVfsFileGetOpenFlags RT_MANGLER(RTVfsFileGetOpenFlags) 2475 2475 # define RTVfsFileGetSize RT_MANGLER(RTVfsFileGetSize) 2476 # define RTVfsFileGetMaxSize RT_MANGLER(RTVfsFileGetMaxSize) 2476 2477 # define RTVfsFileOpen RT_MANGLER(RTVfsFileOpen) 2477 2478 # define RTVfsFileOpenNormal RT_MANGLER(RTVfsFileOpenNormal) 2478 2479 # define RTVfsFilePoll RT_MANGLER(RTVfsFilePoll) 2479 2480 # define RTVfsFileQueryInfo RT_MANGLER(RTVfsFileQueryInfo) 2481 # define RTVfsFileQueryMaxSize RT_MANGLER(RTVfsFileQueryMaxSize) 2480 2482 # define RTVfsFileRead RT_MANGLER(RTVfsFileRead) 2481 2483 # define RTVfsFileReadAt RT_MANGLER(RTVfsFileReadAt) … … 2484 2486 # define RTVfsFileRetainDebug RT_MANGLER(RTVfsFileRetainDebug) 2485 2487 # define RTVfsFileSeek RT_MANGLER(RTVfsFileSeek) 2488 # define RTVfsFileSetSize RT_MANGLER(RTVfsFileSetSize) 2486 2489 # define RTVfsFileSgRead RT_MANGLER(RTVfsFileSgRead) 2487 2490 # define RTVfsFileSgWrite RT_MANGLER(RTVfsFileSgWrite) -
trunk/include/iprt/vfs.h
r69844 r69977 1404 1404 RTDECL(int) RTVfsFileSeek(RTVFSFILE hVfsFile, RTFOFF offSeek, uint32_t uMethod, uint64_t *poffActual); 1405 1405 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 */ 1428 RTDECL(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 1407 1454 RTDECL(int) RTVfsFileGetSize(RTVFSFILE hVfsFile, uint64_t *pcbSize); 1408 1455 RTDECL(RTFOFF) RTVfsFileGetMaxSize(RTVFSFILE hVfsFile); 1409 RTDECL(int) RTVfsFile GetMaxSizeEx(RTVFSFILE hVfsFile, PRTFOFFpcbMax);1456 RTDECL(int) RTVfsFileQueryMaxSize(RTVFSFILE hVfsFile, uint64_t *pcbMax); 1410 1457 1411 1458 /** -
trunk/include/iprt/vfslowlevel.h
r69955 r69977 1004 1004 1005 1005 /** 1006 * Get the current file /streamsize.1006 * Get the current file size. 1007 1007 * 1008 1008 * @returns IPRT status code. … … 1012 1012 */ 1013 1013 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); 1014 1048 1015 1049 /** @todo There will be more methods here. */ … … 1022 1056 1023 1057 /** 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) 1025 1059 1026 1060 /** -
trunk/src/VBox/Runtime/common/dvm/dvmvfs.cpp
r69967 r69977 480 480 rtDvmVfsFile_Seek, 481 481 rtDvmVfsFile_QuerySize, 482 NULL /*SetSize*/, 483 NULL /*QueryMaxSize*/, 482 484 RTVFSFILEOPS_VERSION 483 485 }; -
trunk/src/VBox/Runtime/common/fs/fatvfs.cpp
r69844 r69977 2513 2513 PRTFSFATFILESHRD pShared = pThis->pShared; 2514 2514 *pcbFile = pShared->Core.cbObject; 2515 return VINF_SUCCESS; 2516 } 2517 2518 2519 /** 2520 * @interface_method_impl{RTVFSFILEOPS,pfnSetSize} 2521 */ 2522 static 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 */ 2536 static DECLCALLBACK(int) rtFsFatFile_QueryMaxSize(void *pvThis, uint64_t *pcbMax) 2537 { 2538 RT_NOREF(pvThis); 2539 *pcbMax = UINT32_MAX; 2515 2540 return VINF_SUCCESS; 2516 2541 } … … 2554 2579 rtFsFatFile_Seek, 2555 2580 rtFsFatFile_QuerySize, 2581 rtFsFatFile_SetSize, 2582 rtFsFatFile_QueryMaxSize, 2556 2583 RTVFSFILEOPS_VERSION 2557 2584 }; -
trunk/src/VBox/Runtime/common/fs/isomaker.cpp
r69955 r69977 7381 7381 rtFsIsoMakerOutFile_Seek, 7382 7382 rtFsIsoMakerOutFile_QuerySize, 7383 NULL /*SetSize*/, 7384 NULL /*QueryMaxSize*/, 7383 7385 RTVFSFILEOPS_VERSION 7384 7386 }; -
trunk/src/VBox/Runtime/common/fs/isovfs.cpp
r69955 r69977 2161 2161 rtFsIsoFile_Seek, 2162 2162 rtFsIsoFile_QuerySize, 2163 NULL /*SetSize*/, 2164 NULL /*QueryMaxSize*/, 2163 2165 RTVFSFILEOPS_VERSION 2164 2166 }; -
trunk/src/VBox/Runtime/common/fs/ntfsvfs.cpp
r69962 r69977 2337 2337 2338 2338 /** 2339 * @interface_method_impl{RTVFSFILEOPS,pfnSetSize} 2340 */ 2341 static 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 */ 2351 static 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 /** 2339 2360 * NTFS file operations. 2340 2361 */ … … 2373 2394 rtFsNtfsFile_Seek, 2374 2395 rtFsNtfsFile_QuerySize, 2396 rtFsNtfsFile_SetSize, 2397 rtFsNtfsFile_QueryMaxSize, 2375 2398 RTVFSFILEOPS_VERSION 2376 2399 }; -
trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp
r69955 r69977 4196 4196 4197 4197 4198 RTDECL(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 4219 RTDECL(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 4227 RTDECL(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 4198 4248 RTDECL(uint64_t) RTVfsFileGetOpenFlags(RTVFSFILE hVfsFile) 4199 4249 { -
trunk/src/VBox/Runtime/common/vfs/vfsmemory.cpp
r69942 r69977 676 676 PRTVFSMEMFILE pThis = (PRTVFSMEMFILE)pvThis; 677 677 *pcbFile = pThis->Base.ObjInfo.cbObject; 678 return VINF_SUCCESS; 679 } 680 681 682 /** 683 * @interface_method_impl{RTVFSFILEOPS,pfnSetSize} 684 */ 685 static 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 */ 696 static DECLCALLBACK(int) rtVfsMemFile_QueryMaxSize(void *pvThis, uint64_t *pcbMax) 697 { 698 RT_NOREF(pvThis); 699 *pcbMax = ~(size_t)0 >> 1; 678 700 return VINF_SUCCESS; 679 701 } … … 717 739 rtVfsMemFile_Seek, 718 740 rtVfsMemFile_QuerySize, 741 rtVfsMemFile_SetSize, 742 rtVfsMemFile_QueryMaxSize, 719 743 RTVFSFILEOPS_VERSION 720 744 }; -
trunk/src/VBox/Runtime/common/vfs/vfsprogress.cpp
r69219 r69977 404 404 return RTVfsFileGetSize(pThis->hVfsFile, pcbFile); 405 405 } 406 407 408 /** 409 * @interface_method_impl{RTVFSFILEOPS,pfnSetSize} 410 */ 411 static 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 */ 421 static DECLCALLBACK(int) rtVfsProgressFile_QueryMaxSize(void *pvThis, uint64_t *pcbMax) 422 { 423 PRTVFSPROGRESSFILE pThis = (PRTVFSPROGRESSFILE)pvThis; 424 return RTVfsFileQueryMaxSize(pThis->hVfsFile, pcbMax); 425 } 426 406 427 407 428 … … 443 464 rtVfsProgressFile_Seek, 444 465 rtVfsProgressFile_QuerySize, 466 rtVfsProgressFile_SetSize, 467 rtVfsProgressFile_QueryMaxSize, 445 468 RTVFSFILEOPS_VERSION 446 469 }; -
trunk/src/VBox/Runtime/common/vfs/vfsreadahead.cpp
r69111 r69977 486 486 RTCritSectEnter(&pThis->IoCritSect); /* paranoia */ 487 487 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 */ 497 static 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 */ 513 static 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); 488 520 RTCritSectLeave(&pThis->IoCritSect); 489 521 … … 555 587 rtVfsReadAhead_Seek, 556 588 rtVfsReadAhead_QuerySize, 589 rtVfsReadAhead_SetSize, 590 rtVfsReadAhead_QueryMaxSize, 557 591 RTVFSFILEOPS_VERSION 558 592 }; -
trunk/src/VBox/Runtime/common/vfs/vfsstdfile.cpp
r69592 r69977 384 384 PRTVFSSTDFILE pThis = (PRTVFSSTDFILE)pvThis; 385 385 return RTFileGetSize(pThis->hFile, pcbFile); 386 } 387 388 389 /** 390 * @interface_method_impl{RTVFSFILEOPS,pfnSetSize} 391 */ 392 static 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 */ 412 static 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; 386 420 } 387 421 … … 424 458 rtVfsStdFile_Seek, 425 459 rtVfsStdFile_QuerySize, 460 rtVfsStdFile_SetSize, 461 rtVfsStdFile_QueryMaxSize, 426 462 RTVFSFILEOPS_VERSION 427 463 }; -
trunk/src/VBox/Runtime/common/zip/tarvfswriter.cpp
r67279 r69977 827 827 rtZipTarWriterPush_Seek, 828 828 rtZipTarWriterPush_QuerySize, 829 NULL /*SetSize*/, 830 NULL /*QueryMaxSize*/, 829 831 RTVFSFILEOPS_VERSION 830 832 }; -
trunk/src/VBox/Runtime/common/zip/xarvfs.cpp
r69111 r69977 1171 1171 rtZipXarFssFile_Seek, 1172 1172 rtZipXarFssFile_QuerySize, 1173 NULL /*SetSize*/, 1174 NULL /*QueryMaxSize*/, 1173 1175 RTVFSFILEOPS_VERSION, 1174 1176 }; -
trunk/src/VBox/Storage/VDIfVfs.cpp
r69942 r69977 365 365 vdIfVfsFile_Seek, 366 366 vdIfVfsFile_QuerySize, 367 NULL /*SetSize*/, 368 NULL /*QueryMaxSize*/, 367 369 RTVFSFILEOPS_VERSION, 368 370 }; -
trunk/src/VBox/Storage/VDVfs.cpp
r69942 r69977 540 540 vdVfsFile_Seek, 541 541 vdVfsFile_QuerySize, 542 NULL /*SetSize*/, 543 NULL /*QueryMaxSize*/, 542 544 RTVFSFILEOPS_VERSION 543 545 };
Note:
See TracChangeset
for help on using the changeset viewer.

