- Timestamp:
- Oct 4, 2010 12:29:41 PM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 66365
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/VmdkHDDCore.cpp
r32883 r32884 1200 1200 static int vmdkAllocGrainDirectory(PVMDKIMAGE pImage, PVMDKEXTENT pExtent) 1201 1201 { 1202 int rc = VINF_SUCCESS; 1202 1203 size_t cbGD = pExtent->cGDEntries * sizeof(uint32_t); 1203 1204 uint32_t *pGD = NULL, *pRGD = NULL; … … 1262 1263 1263 1264 rc = vmdkAllocGrainDirectory(pImage, pExtent); 1264 if (RT_FAIL ED(rc))1265 if (RT_FAILURE(rc)) 1265 1266 goto out; 1266 1267 … … 1269 1270 rc = vmdkFileReadSync(pImage, pExtent->pFile, 1270 1271 VMDK_SECTOR2BYTE(pExtent->uSectorGD), 1271 p GD, cbGD, NULL);1272 pExtent->pGD, cbGD, NULL); 1272 1273 AssertRC(rc); 1273 1274 if (RT_FAILURE(rc)) … … 1276 1277 goto out; 1277 1278 } 1278 for (i = 0, pGDTmp = p GD; i < pExtent->cGDEntries; i++, pGDTmp++)1279 for (i = 0, pGDTmp = pExtent->pGD; i < pExtent->cGDEntries; i++, pGDTmp++) 1279 1280 *pGDTmp = RT_LE2H_U32(*pGDTmp); 1280 1281 1281 1282 if (pExtent->uSectorRGD) 1282 1283 { 1283 pExtent->pRGD = pRGD;1284 1284 /* The VMDK 1.1 spec seems to talk about compressed grain directories, 1285 1285 * but in reality they are not compressed. */ 1286 1286 rc = vmdkFileReadSync(pImage, pExtent->pFile, 1287 1287 VMDK_SECTOR2BYTE(pExtent->uSectorRGD), 1288 p RGD, cbGD, NULL);1288 pExtent->pRGD, cbGD, NULL); 1289 1289 AssertRC(rc); 1290 1290 if (RT_FAILURE(rc)) … … 1293 1293 goto out; 1294 1294 } 1295 for (i = 0, pRGDTmp = p RGD; i < pExtent->cGDEntries; i++, pRGDTmp++)1295 for (i = 0, pRGDTmp = pExtent->pRGD; i < pExtent->cGDEntries; i++, pRGDTmp++) 1296 1296 *pRGDTmp = RT_LE2H_U32(*pRGDTmp); 1297 1297 … … 1312 1312 } 1313 1313 1314 for (i = 0, pGDTmp = p GD, pRGDTmp =pRGD;1314 for (i = 0, pGDTmp = pExtent->pGD, pRGDTmp = pExtent->pRGD; 1315 1315 i < pExtent->cGDEntries; 1316 1316 i++, pGDTmp++, pRGDTmp++) … … 1379 1379 goto out; 1380 1380 } 1381 for (i = 0, pGDTmp = p GD; i < pExtent->cGDEntries; i++, pGDTmp++)1381 for (i = 0, pGDTmp = pExtent->pGD; i < pExtent->cGDEntries; i++, pGDTmp++) 1382 1382 { 1383 1383 /* If no grain table is allocated skip the entry. */ … … 1498 1498 1499 1499 rc = vmdkAllocGrainDirectory(pImage, pExtent); 1500 if (RT_FAIL ED(rc))1500 if (RT_FAILURE(rc)) 1501 1501 goto out; 1502 1502 … … 1506 1506 uint64_t uOffsetSectors; 1507 1507 1508 if (p RGD)1508 if (pExtent->pRGD) 1509 1509 { 1510 1510 uOffsetSectors = pExtent->uSectorRGD + VMDK_BYTE2SECTOR(cbGDRounded); 1511 1511 for (i = 0; i < pExtent->cGDEntries; i++) 1512 1512 { 1513 p RGD[i] = uOffsetSectors;1513 pExtent->pRGD[i] = uOffsetSectors; 1514 1514 uGTSectorLE = RT_H2LE_U64(uOffsetSectors); 1515 1515 /* Write the redundant grain directory entry to disk. */ … … 1529 1529 for (i = 0; i < pExtent->cGDEntries; i++) 1530 1530 { 1531 p GD[i] = uOffsetSectors;1531 pExtent->pGD[i] = uOffsetSectors; 1532 1532 uGTSectorLE = RT_H2LE_U64(uOffsetSectors); 1533 1533 /* Write the grain directory entry to disk. */
Note:
See TracChangeset
for help on using the changeset viewer.