Changeset 33081 in vbox for trunk/src/VBox/Devices/Storage
- Timestamp:
- Oct 12, 2010 5:54:54 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 66608
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/VDIHDDCore.cpp
r33030 r33081 349 349 { 350 350 pHeader->uVersion = VDI_IMAGE_VERSION; 351 pHeader->u.v1 .cbHeader = sizeof(VDIHEADER1);352 pHeader->u.v1 .u32Type = (uint32_t)vdiTranslateImageFlags2VDI(uImageFlags);353 pHeader->u.v1 .fFlags = (uImageFlags & VD_VDI_IMAGE_FLAGS_ZERO_EXPAND) ? 1 : 0;351 pHeader->u.v1plus.cbHeader = sizeof(VDIHEADER1PLUS); 352 pHeader->u.v1plus.u32Type = (uint32_t)vdiTranslateImageFlags2VDI(uImageFlags); 353 pHeader->u.v1plus.fFlags = (uImageFlags & VD_VDI_IMAGE_FLAGS_ZERO_EXPAND) ? 1 : 0; 354 354 #ifdef VBOX_STRICT 355 355 char achZero[VDI_IMAGE_COMMENT_SIZE] = {0}; 356 Assert(!memcmp(pHeader->u.v1 .szComment, achZero, VDI_IMAGE_COMMENT_SIZE));356 Assert(!memcmp(pHeader->u.v1plus.szComment, achZero, VDI_IMAGE_COMMENT_SIZE)); 357 357 #endif 358 pHeader->u.v1 .szComment[0] = '\0';358 pHeader->u.v1plus.szComment[0] = '\0'; 359 359 if (pszComment) 360 360 { 361 AssertMsg(strlen(pszComment) < sizeof(pHeader->u.v1 .szComment),361 AssertMsg(strlen(pszComment) < sizeof(pHeader->u.v1plus.szComment), 362 362 ("HDD Comment is too long, cb=%d\n", strlen(pszComment))); 363 strncat(pHeader->u.v1 .szComment, pszComment, sizeof(pHeader->u.v1.szComment)-1);363 strncat(pHeader->u.v1plus.szComment, pszComment, sizeof(pHeader->u.v1plus.szComment)-1); 364 364 } 365 365 366 366 /* Mark the legacy geometry not-calculated. */ 367 pHeader->u.v1 .LegacyGeometry.cCylinders = 0;368 pHeader->u.v1 .LegacyGeometry.cHeads = 0;369 pHeader->u.v1 .LegacyGeometry.cSectors = 0;370 pHeader->u.v1 .LegacyGeometry.cbSector = VDI_GEOMETRY_SECTOR_SIZE;371 pHeader->u.v1 .u32Dummy = 0; /* used to be the translation value */372 373 pHeader->u.v1 .cbDisk = cbDisk;374 pHeader->u.v1 .cbBlock = cbBlock;375 pHeader->u.v1 .cBlocks = (uint32_t)(cbDisk / cbBlock);367 pHeader->u.v1plus.LegacyGeometry.cCylinders = 0; 368 pHeader->u.v1plus.LegacyGeometry.cHeads = 0; 369 pHeader->u.v1plus.LegacyGeometry.cSectors = 0; 370 pHeader->u.v1plus.LegacyGeometry.cbSector = VDI_GEOMETRY_SECTOR_SIZE; 371 pHeader->u.v1plus.u32Dummy = 0; /* used to be the translation value */ 372 373 pHeader->u.v1plus.cbDisk = cbDisk; 374 pHeader->u.v1plus.cbBlock = cbBlock; 375 pHeader->u.v1plus.cBlocks = (uint32_t)(cbDisk / cbBlock); 376 376 if (cbDisk % cbBlock) 377 pHeader->u.v1 .cBlocks++;378 pHeader->u.v1 .cbBlockExtra = cbBlockExtra;379 pHeader->u.v1 .cBlocksAllocated = 0;377 pHeader->u.v1plus.cBlocks++; 378 pHeader->u.v1plus.cbBlockExtra = cbBlockExtra; 379 pHeader->u.v1plus.cBlocksAllocated = 0; 380 380 381 381 /* Init offsets. */ 382 pHeader->u.v1 .offBlocks = RT_ALIGN_32(sizeof(VDIPREHEADER) + sizeof(VDIHEADER1), VDI_DATA_ALIGN);383 pHeader->u.v1 .offData = RT_ALIGN_32(pHeader->u.v1.offBlocks + (pHeader->u.v1.cBlocks * sizeof(VDIIMAGEBLOCKPOINTER)), VDI_DATA_ALIGN);382 pHeader->u.v1plus.offBlocks = RT_ALIGN_32(sizeof(VDIPREHEADER) + sizeof(VDIHEADER1PLUS), VDI_DATA_ALIGN); 383 pHeader->u.v1plus.offData = RT_ALIGN_32(pHeader->u.v1plus.offBlocks + (pHeader->u.v1plus.cBlocks * sizeof(VDIIMAGEBLOCKPOINTER)), VDI_DATA_ALIGN); 384 384 385 385 /* Init uuids. */ 386 RTUuidCreate(&pHeader->u.v1 .uuidCreate);387 RTUuidClear(&pHeader->u.v1 .uuidModify);388 RTUuidClear(&pHeader->u.v1 .uuidLinkage);389 RTUuidClear(&pHeader->u.v1 .uuidParentModify);386 RTUuidCreate(&pHeader->u.v1plus.uuidCreate); 387 RTUuidClear(&pHeader->u.v1plus.uuidModify); 388 RTUuidClear(&pHeader->u.v1plus.uuidLinkage); 389 RTUuidClear(&pHeader->u.v1plus.uuidParentModify); 390 390 391 391 /* Mark LCHS geometry not-calculated. */
Note:
See TracChangeset
for help on using the changeset viewer.