Changeset 43602 in vbox for trunk/src/VBox/Storage
- Timestamp:
- Oct 10, 2012 3:57:27 PM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 81297
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Storage/VDI.cpp
r42915 r43602 326 326 static void vdiInitHeader(PVDIHEADER pHeader, uint32_t uImageFlags, 327 327 const char *pszComment, uint64_t cbDisk, 328 uint32_t cbBlock, uint32_t cbBlockExtra) 328 uint32_t cbBlock, uint32_t cbBlockExtra, 329 uint32_t cbDataAlign) 329 330 { 330 331 pHeader->uVersion = VDI_IMAGE_VERSION; … … 360 361 361 362 /* Init offsets. */ 362 pHeader->u.v1plus.offBlocks = RT_ALIGN_32(sizeof(VDIPREHEADER) + sizeof(VDIHEADER1PLUS), VDI_DATA_ALIGN);363 pHeader->u.v1plus.offData = RT_ALIGN_32(pHeader->u.v1plus.offBlocks + (pHeader->u.v1plus.cBlocks * sizeof(VDIIMAGEBLOCKPOINTER)), VDI_DATA_ALIGN);363 pHeader->u.v1plus.offBlocks = RT_ALIGN_32(sizeof(VDIPREHEADER) + sizeof(VDIHEADER1PLUS), cbDataAlign); 364 pHeader->u.v1plus.offData = RT_ALIGN_32(pHeader->u.v1plus.offBlocks + (pHeader->u.v1plus.cBlocks * sizeof(VDIIMAGEBLOCKPOINTER)), cbDataAlign); 364 365 365 366 /* Init uuids. */ … … 521 522 unsigned uOpenFlags, PFNVDPROGRESS pfnProgress, 522 523 void *pvUser, unsigned uPercentStart, 523 unsigned uPercentSpan )524 unsigned uPercentSpan, PVDINTERFACECONFIG pIfCfg) 524 525 { 525 526 int rc; … … 527 528 uint64_t cbFill; 528 529 uint64_t uOff; 530 uint32_t cbDataAlign = VDI_DATA_ALIGN; 529 531 530 532 AssertPtr(pPCHSGeometry); … … 544 546 } 545 547 548 if (pIfCfg) 549 { 550 rc = VDCFGQueryU32Def(pIfCfg, "DataAlignment", &cbDataAlign, VDI_DATA_ALIGN); 551 if (RT_FAILURE(rc)) 552 { 553 rc = vdIfError(pImage->pIfError, rc, RT_SRC_POS, 554 N_("VDI: Getting data alignment for '%s' failed (%Rrc)"), pImage->pszFilename); 555 goto out; 556 } 557 } 558 546 559 vdiInitPreHeader(&pImage->PreHeader); 547 vdiInitHeader(&pImage->Header, uImageFlags, pszComment, cbSize, VDI_IMAGE_DEFAULT_BLOCK_SIZE, 0); 560 vdiInitHeader(&pImage->Header, uImageFlags, pszComment, cbSize, VDI_IMAGE_DEFAULT_BLOCK_SIZE, 0, 561 cbDataAlign); 548 562 /* Save PCHS geometry. Not much work, and makes the flow of information 549 563 * quite a bit clearer - relying on the higher level isn't obvious. */ … … 1476 1490 } 1477 1491 1492 PVDINTERFACECONFIG pIfCfg = VDIfConfigGet(pVDIfsOperation); 1493 1478 1494 /* Check the image flags. */ 1479 1495 if ((uImageFlags & ~VD_VDI_IMAGE_FLAGS_MASK) != 0) … … 1525 1541 rc = vdiCreateImage(pImage, cbSize, uImageFlags, pszComment, 1526 1542 pPCHSGeometry, pLCHSGeometry, pUuid, uOpenFlags, 1527 pfnProgress, pvUser, uPercentStart, uPercentSpan); 1543 pfnProgress, pvUser, uPercentStart, uPercentSpan, 1544 pIfCfg); 1528 1545 if (RT_SUCCESS(rc)) 1529 1546 {
Note:
See TracChangeset
for help on using the changeset viewer.