2009-11-21 01:45:08 +00:00
|
|
|
|
|
|
|
#include <cerrno>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <cstring>
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <sys/mman.h>
|
|
|
|
|
2009-12-16 01:33:28 +00:00
|
|
|
|
|
|
|
#include <Device/BlockDevice.h>
|
2010-05-18 03:30:45 +00:00
|
|
|
|
2009-12-16 01:33:28 +00:00
|
|
|
|
|
|
|
#include <ProFUSE/Exception.h>
|
|
|
|
|
|
|
|
|
|
|
|
using namespace Device;
|
|
|
|
|
|
|
|
using ProFUSE::Exception;
|
|
|
|
using ProFUSE::POSIXException;
|
2009-11-21 01:45:08 +00:00
|
|
|
|
2009-12-11 00:59:53 +00:00
|
|
|
#pragma mark -
|
|
|
|
#pragma mark BlockDevice
|
2009-11-21 01:45:08 +00:00
|
|
|
|
2009-12-14 00:14:59 +00:00
|
|
|
BlockDevice::BlockDevice()
|
|
|
|
{
|
|
|
|
}
|
2009-11-21 01:45:08 +00:00
|
|
|
BlockDevice::~BlockDevice()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-11-24 04:36:48 +00:00
|
|
|
void BlockDevice::zeroBlock(unsigned block)
|
2009-11-22 21:56:32 +00:00
|
|
|
{
|
|
|
|
uint8_t bp[512];
|
|
|
|
std::memset(bp, 0, 512);
|
|
|
|
|
|
|
|
write(block, bp);
|
|
|
|
}
|
|
|
|
|
2009-12-11 00:59:53 +00:00
|
|
|
|
|
|
|
|
2009-12-21 13:57:48 +00:00
|
|
|
bool BlockDevice::mapped()
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void BlockDevice::sync(unsigned block)
|
|
|
|
{
|
|
|
|
sync();
|
|
|
|
}
|
|
|
|
|
|
|
|
void BlockDevice::sync(TrackSector ts)
|
|
|
|
{
|
|
|
|
sync();
|
|
|
|
}
|
|
|
|
|