Changeset 19824 in vbox for trunk/src/VBox/Devices/Storage
- Timestamp:
- May 19, 2009 2:06:34 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Storage/VHDHDDCore.cpp
r19737 r19824 1046 1046 1047 1047 /* 1048 * Clip write range. 1049 */ 1050 cbToWrite = RT_MIN(cbToWrite, (pImage->cbDataBlock - (cBATEntryIndex * VHD_SECTOR_SIZE))); 1051 1052 /* 1048 1053 * If the block is not allocated the content of the entry is ~0 1049 1054 * and we need to allocate a new block. Note that while blocks are … … 1051 1056 * own bitmap entry, indicating whether it has been written or not. 1052 1057 * So that means for the purposes of the higher level that the 1053 * granularity is invisible. 1058 * granularity is invisible. This means there's no need to return 1059 * VERR_VD_BLOCK_FREE unless the block hasn't been allocated yet. 1054 1060 */ 1055 1061 if (pImage->pBlockAllocationTable[cBlockAllocationTableEntry] == ~0U) 1056 1062 { 1063 /* Check if the block allocation should be suppressed. */ 1064 if (fWrite & VD_WRITE_NO_ALLOC) 1065 { 1066 *pcbPreRead = cBATEntryIndex * VHD_SECTOR_SIZE; 1067 *pcbPostRead = pImage->cSectorsPerDataBlock * VHD_SECTOR_SIZE - cbToWrite - *pcbPreRead; 1068 return VERR_VD_BLOCK_FREE; 1069 } 1070 1057 1071 size_t cbNewBlock = (pImage->cbDataBlock + pImage->cbDataBlockBitmap) * sizeof(uint8_t); 1058 1072 uint8_t *pNewBlock = (uint8_t *)RTMemAllocZ(cbNewBlock); … … 1079 1093 uVhdOffset = ((uint64_t)pImage->pBlockAllocationTable[cBlockAllocationTableEntry] + pImage->cDataBlockBitmapSectors + cBATEntryIndex) * VHD_SECTOR_SIZE; 1080 1094 1081 /* 1082 * Clip write range. 1083 */ 1084 cbToWrite = RT_MIN(cbToWrite, (pImage->cbDataBlock - (cBATEntryIndex * VHD_SECTOR_SIZE))); 1095 /* Write data. */ 1085 1096 RTFileWriteAt(pImage->File, uVhdOffset, pvBuf, cbToWrite, NULL); 1086 1097
Note:
See TracChangeset
for help on using the changeset viewer.