mirror of
https://github.com/ksherlock/profuse.git
synced 2024-06-26 19:29:52 +00:00
git-svn-id: https://profuse.googlecode.com/svn/branches/v2@220 aa027e90-d47c-11dd-86d7-074df07e0730
62 lines
812 B
C++
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);
|
|
}
|