profuse/Device/BlockDevice.cpp
ksherlock 629efe6da5 block cache support.
git-svn-id: https://profuse.googlecode.com/svn/branches/v2@220 aa027e90-d47c-11dd-86d7-074df07e0730
2010-05-18 19:59:18 +00:00

62 lines
812 B
C++

#include <cerrno>
#include <cstdlib>
#include <cstring>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <Device/BlockDevice.h>
#include <Cache/ConcreteBlockCache.h>
#include <ProFUSE/Exception.h>
using namespace Device;
using ProFUSE::Exception;
using ProFUSE::POSIXException;
#pragma mark -
#pragma mark BlockDevice
BlockDevice::BlockDevice()
{
}
BlockDevice::~BlockDevice()
{
}
void BlockDevice::zeroBlock(unsigned block)
{
uint8_t bp[512];
std::memset(bp, 0, 512);
write(block, bp);
}
bool BlockDevice::mapped()
{
return false;
}
void BlockDevice::sync(unsigned block)
{
sync();
}
void BlockDevice::sync(TrackSector ts)
{
sync();
}
BlockCache *BlockDevice::createBlockCache(unsigned size)
{
return new ConcreteBlockCache(this, size);
}