mirror of
https://github.com/ksherlock/profuse.git
synced 2025-01-10 23:29:42 +00:00
git-svn-id: https://profuse.googlecode.com/svn/branches/v2@101 aa027e90-d47c-11dd-86d7-074df07e0730
This commit is contained in:
parent
2462938c3a
commit
8212b02088
@ -18,7 +18,7 @@ BlockDevice::~BlockDevice()
|
||||
{
|
||||
}
|
||||
|
||||
BlockDevice::zeroBlock(unsigned block)
|
||||
void BlockDevice::zeroBlock(unsigned block)
|
||||
{
|
||||
uint8_t bp[512];
|
||||
std::memset(bp, 0, 512);
|
||||
@ -55,9 +55,15 @@ bool DiskImage::readOnly()
|
||||
throw Exception(__METHOD__ ": File not set.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
unsigned DiskImage::blocks()
|
||||
{
|
||||
#undef __METHOD__
|
||||
#define __METHOD__ "DiskImage::blocks"
|
||||
|
||||
if (_file) return _file->blocks();
|
||||
|
||||
throw Exception(__METHOD__ ": File not set.");
|
||||
}
|
||||
|
||||
void DiskImage::read(unsigned block, void *bp)
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ public:
|
||||
virtual bool readOnly() = 0;
|
||||
virtual void sync() = 0;
|
||||
|
||||
virtual unsigned blocks();
|
||||
virtual unsigned blocks() = 0;
|
||||
|
||||
void zeroBlock(unsigned block);
|
||||
};
|
||||
@ -37,7 +37,7 @@ public:
|
||||
virtual void sync();
|
||||
|
||||
virtual bool readOnly();
|
||||
|
||||
virtual unsigned blocks();
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -26,7 +26,7 @@ DiskCopy42Image::~DiskCopy42Image()
|
||||
if (_changed)
|
||||
{
|
||||
MappedFile *f = file();
|
||||
void *data = file->fileData();
|
||||
void *data = f->fileData();
|
||||
|
||||
if (f)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
#include <ioctl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/uio.h>
|
||||
@ -89,6 +89,8 @@ void RawDevice::devSize(int fd)
|
||||
|
||||
#endif
|
||||
|
||||
// TODO -- FreeBSD/NetBSD/OpenBSD
|
||||
|
||||
RawDevice::RawDevice(const char *name, bool readOnly) :
|
||||
{
|
||||
// open read-only, verify if device is readable, and then try to upgrade to read/write?
|
||||
@ -133,7 +135,7 @@ void RawDevice::read(unsigned block, void *bp)
|
||||
|
||||
// TODO -- EINTR?
|
||||
if (ok != 512)
|
||||
throw Exception(__METHOD__ : ": Error reading block.",
|
||||
throw Exception(__METHOD__ ": Error reading block.",
|
||||
ok < 0 : errno, 0);
|
||||
|
||||
|
||||
|
@ -34,7 +34,7 @@ private:
|
||||
unsigned _blocks;
|
||||
|
||||
unsigned _blockSize;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include "UniversalDiskImage.h"
|
||||
#include "MappedFile.h"
|
||||
#include "Buffer.h"
|
||||
#inluce "Endian.h"
|
||||
#include "Endian.h"
|
||||
|
||||
using namespace ProFUSE;
|
||||
using namespace LittleEndian;
|
||||
@ -13,7 +13,7 @@ UniversalDiskImage::UniversalDiskImage(const char *name, bool readOnly) :
|
||||
const void *data = file()->fileData();
|
||||
|
||||
// flags. bit 31 = locked.
|
||||
_flags = Read32(data, 0x10;
|
||||
_flags = Read32(data, 0x10);
|
||||
}
|
||||
|
||||
UniversalDiskImage::UniversalDiskImage(MappedFile *file) :
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
|
||||
#include "BlockDevice.h"
|
||||
#include <stdint.h>
|
||||
|
||||
namespace ProFUSE {
|
||||
|
||||
@ -19,7 +20,7 @@ private:
|
||||
UniversalDiskImage(MappedFile *);
|
||||
static void Validate(MappedFile *);
|
||||
|
||||
uint32_t flags;
|
||||
uint32_t _flags;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user