2010-03-19 18:12:22 +00:00
|
|
|
#ifndef __MAPPED_BLOCK_CACHE_H__
|
|
|
|
#define __MAPPED_BLOCK_CACHE_H__
|
|
|
|
|
2010-03-21 22:27:20 +00:00
|
|
|
#include <Cache/BlockCache.h>
|
2010-03-19 18:12:22 +00:00
|
|
|
|
|
|
|
namespace Device {
|
|
|
|
|
|
|
|
class MappedBlockCache : public BlockCache {
|
|
|
|
public:
|
|
|
|
|
2011-02-22 02:59:33 +00:00
|
|
|
static BlockCachePointer Create(BlockDevicePointer device, void *data);
|
|
|
|
|
2010-03-19 18:12:22 +00:00
|
|
|
virtual ~MappedBlockCache();
|
|
|
|
|
2010-03-21 22:27:20 +00:00
|
|
|
virtual void sync();
|
2010-03-19 18:12:22 +00:00
|
|
|
virtual void write(unsigned block, const void *vp);
|
|
|
|
|
2010-05-20 22:30:00 +00:00
|
|
|
virtual void zeroBlock(unsigned block);
|
|
|
|
|
2010-03-19 18:12:22 +00:00
|
|
|
|
|
|
|
virtual void *acquire(unsigned block);
|
|
|
|
virtual void release(unsigned block, int flags);
|
|
|
|
virtual void markDirty(unsigned block);
|
|
|
|
|
|
|
|
private:
|
2011-02-22 02:59:33 +00:00
|
|
|
|
|
|
|
MappedBlockCache(BlockDevicePointer device, void *data);
|
|
|
|
|
2010-05-22 16:11:41 +00:00
|
|
|
void sync(unsigned block);
|
2010-03-21 22:27:20 +00:00
|
|
|
|
2010-05-22 16:11:41 +00:00
|
|
|
uint8_t *_data;
|
|
|
|
bool _dirty;
|
2010-03-19 18:12:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
2010-03-22 00:32:27 +00:00
|
|
|
#endif
|
2010-03-19 18:12:22 +00:00
|
|
|
|