Changeset 77256 in vbox
- Timestamp:
- Feb 11, 2019 12:19:52 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/dvm.h
r76585 r77256 121 121 122 122 123 /** @defgroup grp_dvm_vol_flags Volume flags used by DVMVolumeGetFlags.123 /** @defgroup grp_dvm_vol_flags Volume flags used by RTDvmVolumeGetFlags(). 124 124 * @{ */ 125 125 /** Volume flags - Volume is bootable. */ … … 127 127 /** Volume flags - Volume is active. */ 128 128 #define DVMVOLUME_FLAGS_ACTIVE RT_BIT_64(1) 129 /** Volume is contiguous on the underlying medium and RTDvmVolumeQueryRange(). */ 130 #define DVMVOLUME_F_CONTIGUOUS RT_BIT_64(2) 129 131 /** @} */ 130 132 … … 224 226 RTDVMFORMATTYPE_GPT, 225 227 /** BSD labels. */ 226 RTDVMFORMATTYPE_BSD_LAB LE,228 RTDVMFORMATTYPE_BSD_LABEL, 227 229 /** End of valid values. */ 228 230 RTDVMFORMATTYPE_END, … … 354 356 355 357 /** 358 * Queries the range of the given volume on the underyling medium. 359 * 360 * @returns IPRT status code. 361 * @retval VERR_NOT_SUPPORTED if the DVMVOLUME_F_CONTIGUOUS flag is not returned by RTDvmVolumeGetFlags(). 362 * @param hVol The volume handle. 363 * @param poffStart Where to store the start offset in bytes on the underlying medium. 364 * @param poffEnd Where to store the end offset in bytes on the underlying medium (inclusive). 365 */ 366 RTDECL(int) RTDvmVolumeQueryRange(RTDVMVOLUME hVol, uint64_t *poffStart, uint64_t *poffEnd); 367 368 /** 356 369 * Reads data from the given volume. 357 370 * -
trunk/include/iprt/mangling.h
r77047 r77256 829 829 # define RTDvmVolumeGetType RT_MANGLER(RTDvmVolumeGetType) 830 830 # define RTDvmVolumeGetFlags RT_MANGLER(RTDvmVolumeGetFlags) 831 # define RTDvmVolumeQueryRange RT_MANGLER(RTDvmVolumeQueryRange) 831 832 # define RTDvmVolumeRead RT_MANGLER(RTDvmVolumeRead) 832 833 # define RTDvmVolumeWrite RT_MANGLER(RTDvmVolumeWrite) -
trunk/src/VBox/Runtime/common/dvm/dvm.cpp
r76553 r77256 380 380 } 381 381 382 /** @todo shouldn't we close the format too here? */382 pDvmFmtOpsMatch->pfnClose(pThis->hVolMgrFmt); 383 383 } 384 384 } … … 663 663 } 664 664 665 RTDECL(int) RTDvmVolumeQueryRange(RTDVMVOLUME hVol, uint64_t *poffStart, uint64_t *poffEnd) 666 { 667 PRTDVMVOLUMEINTERNAL pThis = hVol; 668 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 669 AssertReturn(pThis->u32Magic == RTDVMVOLUME_MAGIC, VERR_INVALID_HANDLE); 670 AssertPtrReturn(poffStart, VERR_INVALID_POINTER); 671 AssertPtrReturn(poffEnd, VERR_INVALID_POINTER); 672 673 return pThis->pVolMgr->pDvmFmtOps->pfnVolumeQueryRange(pThis->hVolFmt, poffStart, poffEnd); 674 } 675 665 676 RTDECL(int) RTDvmVolumeRead(RTDVMVOLUME hVol, uint64_t off, void *pvBuf, size_t cbRead) 666 677 { -
trunk/src/VBox/Runtime/common/dvm/dvmbsdlabel.cpp
r76553 r77256 480 480 { 481 481 NOREF(hVolFmt); 482 return 0; 482 return DVMVOLUME_F_CONTIGUOUS; 483 } 484 485 static DECLCALLBACK(int) rtDvmFmtBsdLblVolumeQueryRange(RTDVMVOLUMEFMT hVolFmt, uint64_t *poffStart, uint64_t *poffEnd) 486 { 487 PRTDVMVOLUMEFMTINTERNAL pVol = hVolFmt; 488 *poffStart = pVol->offStart; 489 *poffEnd = pVol->offStart + pVol->cbVolume - 1; 490 return VINF_SUCCESS; 483 491 } 484 492 … … 522 530 "BsdLabel", 523 531 /* enmFormat, */ 524 RTDVMFORMATTYPE_BSD_LAB LE,532 RTDVMFORMATTYPE_BSD_LABEL, 525 533 /* pfnProbe */ 526 534 rtDvmFmtBsdLblProbe, … … 551 559 /* pfnVolumeGetFlags */ 552 560 rtDvmFmtBsdLblVolumeGetFlags, 561 /* pfnVolumeQueryRange */ 562 rtDvmFmtBsdLblVolumeQueryRange, 553 563 /* pfnVolumeIsRangeIntersecting */ 554 564 rtDvmFmtBsdLblVolumeIsRangeIntersecting, -
trunk/src/VBox/Runtime/common/dvm/dvmgpt.cpp
r76553 r77256 493 493 static DECLCALLBACK(uint64_t) rtDvmFmtGptVolumeGetFlags(RTDVMVOLUMEFMT hVolFmt) 494 494 { 495 NOREF(hVolFmt); /* No supported flags for now. */ 496 return 0; 495 NOREF(hVolFmt); 496 return DVMVOLUME_F_CONTIGUOUS; 497 } 498 499 static DECLCALLBACK(int) rtDvmFmtGptVolumeQueryRange(RTDVMVOLUMEFMT hVolFmt, uint64_t *poffStart, uint64_t *poffEnd) 500 { 501 PRTDVMVOLUMEFMTINTERNAL pVol = hVolFmt; 502 *poffStart = pVol->offStart; 503 *poffEnd = pVol->offStart + pVol->cbVolume - 1; 504 return VINF_SUCCESS; 497 505 } 498 506 … … 563 571 /* pfnVolumeGetFlags */ 564 572 rtDvmFmtGptVolumeGetFlags, 573 /* pfnVolumeQueryRange */ 574 rtDvmFmtGptVolumeQueryRange, 565 575 /* pfnVolumeIsRangeIntersecting */ 566 576 rtDvmFmtGptVolumeIsRangeIntersecting, -
trunk/src/VBox/Runtime/common/dvm/dvmmbr.cpp
r76553 r77256 641 641 PRTDVMVOLUMEFMTINTERNAL pVol = hVolFmt; 642 642 643 uint64_t fFlags = 0;643 uint64_t fFlags = DVMVOLUME_F_CONTIGUOUS; 644 644 if (pVol->pEntry->bType & 0x80) 645 645 fFlags |= DVMVOLUME_FLAGS_BOOTABLE | DVMVOLUME_FLAGS_ACTIVE; 646 646 647 647 return fFlags; 648 } 649 650 static DECLCALLBACK(int) rtDvmFmtMbrVolumeQueryRange(RTDVMVOLUMEFMT hVolFmt, uint64_t *poffStart, uint64_t *poffEnd) 651 { 652 PRTDVMVOLUMEFMTINTERNAL pVol = hVolFmt; 653 *poffStart = pVol->pEntry->offPart; 654 *poffEnd = pVol->pEntry->offPart + pVol->pEntry->cbPart - 1; 655 return VINF_SUCCESS; 648 656 } 649 657 … … 712 720 /* pfnVolumeGetFlags */ 713 721 rtDvmFmtMbrVolumeGetFlags, 722 /* pfnVolumeQueryRange */ 723 rtDvmFmtMbrVolumeQueryRange, 714 724 /* pfnVOlumeIsRangeIntersecting */ 715 725 rtDvmFmtMbrVolumeIsRangeIntersecting, -
trunk/src/VBox/Runtime/include/internal/dvm.h
r76585 r77256 216 216 217 217 /** 218 * Queries the range of the given volume on the underyling medium. 219 * 220 * @returns IPRT status code. 221 * @param hVolFmt The format specific volume handle. 222 * @param poffStart Where to store the start offset in bytes on the underlying medium. 223 * @param poffEnd Where to store the end offset in bytes on the underlying medium (inclusive). 224 */ 225 DECLCALLBACKMEMBER(int, pfnVolumeQueryRange)(RTDVMVOLUMEFMT hVolFmt, uint64_t *poffStart, uint64_t *poffEnd); 226 227 /** 218 228 * Returns whether the supplied range is at least partially intersecting 219 229 * with the given volume. -
trunk/src/VBox/Runtime/testcase/tstRTDvm.cpp
r76905 r77256 71 71 { 72 72 RTTestIFailed("RTDvmOpen -> %Rrc", rc); 73 RTDvmRelease(hVolMgr); 73 74 return RTTestSummaryAndDestroy(hTest); 74 75 } 75 76 if (rc == VERR_NOT_SUPPORTED) 77 { 78 RTDvmRelease(hVolMgr); 76 79 return VINF_SUCCESS; 80 } 77 81 78 82 RTTestIPrintf(RTTESTLVL_ALWAYS, "%s Successfully opened map with format: %s.\n", szPrefix, RTDvmMapGetFormatName(hVolMgr)); … … 94 98 RTTestIPrintf(RTTESTLVL_ALWAYS, "%s Volume type %s\n", szPrefix, RTDvmVolumeTypeGetDescr(enmVolType)); 95 99 RTTestIPrintf(RTTESTLVL_ALWAYS, "%s Volume size %llu\n", szPrefix, RTDvmVolumeGetSize(hVol)); 96 RTTestIPrintf(RTTESTLVL_ALWAYS, "%s Volume flags %s %s \n\n", szPrefix,100 RTTestIPrintf(RTTESTLVL_ALWAYS, "%s Volume flags %s %s %s\n", szPrefix, 97 101 fVolFlags & DVMVOLUME_FLAGS_BOOTABLE ? "Bootable" : "", 98 fVolFlags & DVMVOLUME_FLAGS_ACTIVE ? "Active" : ""); 102 fVolFlags & DVMVOLUME_FLAGS_ACTIVE ? "Active" : "", 103 fVolFlags & DVMVOLUME_F_CONTIGUOUS ? "Contiguous" : ""); 99 104 100 105 rc = RTDvmVolumeQueryName(hVol, &pszVolName); … … 108 113 else 109 114 rc = VINF_SUCCESS; 115 116 if (fVolFlags & DVMVOLUME_F_CONTIGUOUS) 117 { 118 uint64_t offStart, offEnd; 119 rc = RTDvmVolumeQueryRange(hVol, &offStart, &offEnd); 120 if (RT_SUCCESS(rc)) 121 RTTestIPrintf(RTTESTLVL_ALWAYS, "%s Volume range %llu:%llu\n", szPrefix, offStart, offEnd); 122 else 123 RTTestIFailed("RTDvmVolumeQueryRange -> %Rrc", rc); 124 } 125 126 RTTestIPrintf(RTTESTLVL_ALWAYS, "\n"); 110 127 111 128 /* … … 185 202 RTTESTI_CHECK(rc == VINF_SUCCESS); 186 203 204 RTVfsFileRelease(hVfsDisk); 205 187 206 /* 188 207 * Summary
Note:
See TracChangeset
for help on using the changeset viewer.