mirror of
https://github.com/ksherlock/profuse.git
synced 2025-01-22 23:30:54 +00:00
more block checking
git-svn-id: https://profuse.googlecode.com/svn/branches/v2@259 aa027e90-d47c-11dd-86d7-074df07e0730
This commit is contained in:
parent
4a98605123
commit
ef4f906d70
@ -64,6 +64,12 @@ void MappedBlockCache::release(unsigned block, int flags)
|
||||
|
||||
void MappedBlockCache::write(unsigned block, const void *vp)
|
||||
{
|
||||
#undef __METHOD__
|
||||
#define __METHOD__ "MappedBlockCache::write"
|
||||
|
||||
if (block >= blocks())
|
||||
throw Exception(__METHOD__ ": Invalid block.");
|
||||
|
||||
_dirty = true;
|
||||
std::memcpy(_data + block * 512, vp, 512);
|
||||
}
|
||||
@ -71,6 +77,13 @@ void MappedBlockCache::write(unsigned block, const void *vp)
|
||||
|
||||
void MappedBlockCache::zeroBlock(unsigned block)
|
||||
{
|
||||
#undef __METHOD__
|
||||
#define __METHOD__ "MappedBlockCache::zeroBlock"
|
||||
|
||||
if (block >= blocks())
|
||||
throw Exception(__METHOD__ ": Invalid block.");
|
||||
|
||||
|
||||
_dirty = true;
|
||||
std::memset(_data + block * 512, 0, 512);
|
||||
}
|
||||
|
@ -22,11 +22,11 @@ class MappedBlockCache : public BlockCache {
|
||||
virtual void markDirty(unsigned block);
|
||||
|
||||
private:
|
||||
void sync(unsigned block);
|
||||
|
||||
void sync(unsigned block);
|
||||
|
||||
uint8_t *_data;
|
||||
bool _dirty;
|
||||
|
||||
uint8_t *_data;
|
||||
bool _dirty;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
Loading…
x
Reference in New Issue
Block a user