| 18 | */ |
| 19 | |
| 20 | CachedBlockDevice::CachedBlockDevice(BlockDevice& bd,uint32_t numCachedBlocks) : |
| 21 | _device(bd), _numCachedBlocks(numCachedBlocks), _blockSize(bd.getBlockSizeInBytes()) { |
| 22 | uint32_t i; |
| 23 | |
| 24 | _cachedBlocks=new uint8_t *[numCachedBlocks]; |
| 25 | _cacheIndex=new CacheEntry[numCachedBlocks]; |
| 26 | |
| 27 | for(i=0;i<numCachedBlocks;i++) { |
| 28 | _cachedBlocks[i]=new uint8_t[_blockSize]; |
| 29 | _cacheIndex[i].BlockIndex=FREE_CACHE_ENTRY; |
| 30 | _cacheIndex[i].CacheIndex=i; |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Destructor. Free memory allocated by the cache. |
nothing calls this directly
no test coverage detected