rename ProFUSE:: -> Common::
git-svn-id: https://profuse.googlecode.com/svn/branches/v2@389 aa027e90-d47c-11dd-86d7-074df07e0730
This commit is contained in:
parent
02e3c4c532
commit
b4db3e59ab
|
@ -11,16 +11,14 @@
|
|||
#include <Cache/BlockCache.h>
|
||||
#include <Device/BlockDevice.h>
|
||||
|
||||
#include <ProFUSE/Exception.h>
|
||||
#include <ProFUSE/auto.h>
|
||||
#include <Common/Exception.h>
|
||||
#include <Common/auto.h>
|
||||
|
||||
|
||||
|
||||
|
||||
using namespace Device;
|
||||
|
||||
using ProFUSE::Exception;
|
||||
using ProFUSE::POSIXException;
|
||||
|
||||
|
||||
BlockCache::BlockCache(BlockDevicePointer device) :
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
#include <Device/BlockDevice.h>
|
||||
#include <Cache/ConcreteBlockCache.h>
|
||||
|
||||
#include <ProFUSE/Exception.h>
|
||||
#include <ProFUSE/auto.h>
|
||||
#include <Common/Exception.h>
|
||||
#include <Common/auto.h>
|
||||
|
||||
|
||||
/*
|
||||
|
@ -51,8 +51,6 @@
|
|||
|
||||
using namespace Device;
|
||||
|
||||
using ProFUSE::Exception;
|
||||
using ProFUSE::POSIXException;
|
||||
|
||||
|
||||
//typedef std::vector<ConcreteBlockCache::Entry *>::iterator EntryIter;
|
||||
|
|
|
@ -10,14 +10,12 @@
|
|||
#include <Cache/MappedBlockCache.h>
|
||||
#include <Device/BlockDevice.h>
|
||||
|
||||
#include <ProFUSE/Exception.h>
|
||||
|
||||
#include <Common/Exception.h>
|
||||
#include <POSIX/Exception.h>
|
||||
|
||||
|
||||
using namespace Device;
|
||||
|
||||
using ProFUSE::Exception;
|
||||
using ProFUSE::POSIXException;
|
||||
|
||||
BlockCachePointer MappedBlockCache::Create(BlockDevicePointer device, void *data)
|
||||
{
|
||||
|
@ -124,12 +122,12 @@ void MappedBlockCache::sync(unsigned block)
|
|||
end = (void *)((ptrdiff_t)end / pagesize * pagesize);
|
||||
|
||||
if (::msync(start, pagesize, MS_SYNC) != 0)
|
||||
throw POSIXException(__METHOD__ ": msync", errno);
|
||||
throw POSIX::Exception(__METHOD__ ": msync", errno);
|
||||
|
||||
if (start != end)
|
||||
{
|
||||
if (::msync(end, pagesize, MS_SYNC) != 0)
|
||||
throw POSIXException(__METHOD__ ": msync", errno);
|
||||
throw POSIX::Exception(__METHOD__ ": msync", errno);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include <cstdio>
|
||||
#include <Device/Adaptor.h>
|
||||
|
||||
#include <ProFUSE/Exception.h>
|
||||
#include <Common/Exception.h>
|
||||
|
||||
using namespace Device;
|
||||
|
||||
|
@ -142,7 +142,7 @@ uint8_t NibbleAdaptor::encode62(uint8_t val)
|
|||
};
|
||||
|
||||
if (val > 0x3f)
|
||||
throw ProFUSE::Exception(__METHOD__ ": Invalid 6-2 value.");
|
||||
throw ::Exception(__METHOD__ ": Invalid 6-2 value.");
|
||||
|
||||
return table[val];
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ uint8_t NibbleAdaptor::decode62(uint8_t val)
|
|||
};
|
||||
|
||||
if ((val < 0x90) || (table[val - 0x90] == 0xff))
|
||||
throw ProFUSE::Exception(__METHOD__ ": Invalid 6-2 encoding.");
|
||||
throw ::Exception(__METHOD__ ": Invalid 6-2 encoding.");
|
||||
|
||||
return table[val - 0x90];
|
||||
}
|
||||
|
@ -238,10 +238,10 @@ NibbleAdaptor::NibbleAdaptor(void *address, unsigned length)
|
|||
checksum = decode44(buffer[offset + 9], buffer[offset + 10]);
|
||||
|
||||
if (volume ^ track ^ sector ^ checksum)
|
||||
throw ProFUSE::Exception(__METHOD__ ": Invalid address checksum.");
|
||||
throw ::Exception(__METHOD__ ": Invalid address checksum.");
|
||||
|
||||
if (track > 35 || sector > 16)
|
||||
throw ProFUSE::Exception(__METHOD__ ": Invalid track/sector.");
|
||||
throw ::Exception(__METHOD__ ": Invalid track/sector.");
|
||||
|
||||
offset += 3 + 8 + 3;
|
||||
|
||||
|
@ -294,7 +294,7 @@ NibbleAdaptor::NibbleAdaptor(void *address, unsigned length)
|
|||
{
|
||||
int offset = distance(_index.begin(), iter);
|
||||
std::fprintf(stderr, "Error: track %u sector %u missing.\n", offset / 16, offset % 16);
|
||||
//throw ProFUSE::Exception(__METHOD__ ": Sector missing.");
|
||||
//throw ::Exception(__METHOD__ ": Sector missing.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -361,7 +361,7 @@ void NibbleAdaptor::readTrackSector(TrackSector ts, void *bp)
|
|||
#define __METHOD__ "NibbleAdaptor::readTrackSector"
|
||||
|
||||
if (ts.track > 35 || ts.sector > 16)
|
||||
throw ProFUSE::Exception(__METHOD__ ": Invalid track/sector.");
|
||||
throw ::Exception(__METHOD__ ": Invalid track/sector.");
|
||||
|
||||
|
||||
CircleBuffer buffer(_address, _length);
|
||||
|
@ -374,7 +374,7 @@ void NibbleAdaptor::readTrackSector(TrackSector ts, void *bp)
|
|||
|
||||
if (offset == -1)
|
||||
{
|
||||
throw ProFUSE::Exception(__METHOD__ ": Missing track/sector.");
|
||||
throw ::Exception(__METHOD__ ": Missing track/sector.");
|
||||
}
|
||||
|
||||
// first 86 bytes are in the auxbuffer, backwards.
|
||||
|
@ -418,7 +418,7 @@ void NibbleAdaptor::readTrackSector(TrackSector ts, void *bp)
|
|||
|
||||
if (checksum != decode62(buffer[index++]))
|
||||
std::fprintf(stderr, "Invalid checksum on track %u, sector %u\n", ts.track, ts.sector);
|
||||
//throw ProFUSE::Exception(__METHOD__ ": Invalid field checksum.");
|
||||
//throw ::Exception(__METHOD__ ": Invalid field checksum.");
|
||||
|
||||
}
|
||||
|
||||
|
@ -428,7 +428,7 @@ void NibbleAdaptor::writeTrackSector(TrackSector ts, const void *bp)
|
|||
#define __METHOD__ "NibbleAdaptor::writeTrackSector"
|
||||
|
||||
if (ts.track > 35 || ts.sector > 16)
|
||||
throw ProFUSE::Exception(__METHOD__ ": Invalid track/sector.");
|
||||
throw ::Exception(__METHOD__ ": Invalid track/sector.");
|
||||
|
||||
uint8_t auxBuffer[86];
|
||||
uint8_t checksum = 0;
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
#include <Device/BlockDevice.h>
|
||||
#include <Cache/ConcreteBlockCache.h>
|
||||
|
||||
#include <ProFUSE/Exception.h>
|
||||
#include <Common/Exception.h>
|
||||
#include <POSIX/Exception.h>
|
||||
|
||||
#include <Device/DiskImage.h>
|
||||
#include <Device/UniversalDiskImage.h>
|
||||
|
@ -26,8 +27,6 @@
|
|||
|
||||
using namespace Device;
|
||||
|
||||
using ProFUSE::Exception;
|
||||
using ProFUSE::POSIXException;
|
||||
|
||||
|
||||
unsigned BlockDevice::ImageType(MappedFile *f, unsigned defv)
|
||||
|
@ -124,7 +123,7 @@ BlockDevicePointer BlockDevice::Open(const char *name, File::FileFlags flags, un
|
|||
|
||||
if (::stat(name, &st) != 0)
|
||||
{
|
||||
throw POSIXException(__METHOD__ ": stat error", errno);
|
||||
throw POSIX::Exception(__METHOD__ ": stat error", errno);
|
||||
}
|
||||
|
||||
// /dev/xxx ignore the type.
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
#include <Device/Device.h>
|
||||
#include <Device/TrackSector.h>
|
||||
|
||||
#include <ProFUSE/Exception.h>
|
||||
#include <ProFUSE/smart_pointers.h>
|
||||
#include <Common/Exception.h>
|
||||
#include <Common/smart_pointers.h>
|
||||
|
||||
#include <File/File.h>
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
using namespace Device;
|
||||
using namespace LittleEndian;
|
||||
|
||||
using ProFUSE::Exception;
|
||||
using ProFUSE::POSIXException;
|
||||
|
||||
/*
|
||||
http://www.umich.edu/~archive/apple2/technotes/ftn/FTN.E0.8004
|
||||
|
@ -86,7 +84,7 @@ bool DavexDiskImage::Validate(MappedFile *f)
|
|||
|
||||
|
||||
if (!Validate(f, std::nothrow))
|
||||
throw Exception(__METHOD__ ": Invalid file format.");
|
||||
throw ::Exception(__METHOD__ ": Invalid file format.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#ifndef __DEVICE_DEVICE_H__
|
||||
#define __DEVICE_DEVICE_H__
|
||||
|
||||
#include <ProFUSE/smart_pointers.h>
|
||||
#include <Common/smart_pointers.h>
|
||||
|
||||
namespace Device {
|
||||
|
||||
|
|
|
@ -16,9 +16,6 @@ using namespace Device;
|
|||
using namespace BigEndian;
|
||||
|
||||
|
||||
using ProFUSE::Exception;
|
||||
using ProFUSE::POSIXException;
|
||||
|
||||
|
||||
|
||||
enum {
|
||||
|
@ -221,7 +218,7 @@ bool DiskCopy42Image::Validate(MappedFile *file)
|
|||
|
||||
|
||||
if (!Validate(file, std::nothrow))
|
||||
throw Exception(__METHOD__ ": Invalid file format.");
|
||||
throw ::Exception(__METHOD__ ": Invalid file format.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -14,13 +14,11 @@
|
|||
|
||||
#include <Cache/MappedBlockCache.h>
|
||||
|
||||
#include <ProFUSE/Exception.h>
|
||||
#include <Common/Exception.h>
|
||||
|
||||
|
||||
using namespace Device;
|
||||
|
||||
using ProFUSE::Exception;
|
||||
using ProFUSE::POSIXException;
|
||||
|
||||
|
||||
/*
|
||||
|
@ -74,7 +72,7 @@ void DiskImage::read(unsigned block, void *bp)
|
|||
#define __METHOD__ "DiskImage::read"
|
||||
|
||||
if (block >= _blocks)
|
||||
throw Exception(__METHOD__ ": Invalid block.");
|
||||
throw ::Exception(__METHOD__ ": Invalid block.");
|
||||
|
||||
_adaptor->readBlock(block, bp);
|
||||
}
|
||||
|
@ -85,7 +83,7 @@ void DiskImage::write(unsigned block, const void *bp)
|
|||
#define __METHOD__ "DiskImage::write"
|
||||
|
||||
if (block >= _blocks)
|
||||
throw Exception(__METHOD__ ": Invalid block.");
|
||||
throw ::Exception(__METHOD__ ": Invalid block.");
|
||||
|
||||
_adaptor->writeBlock(block, bp);
|
||||
}
|
||||
|
@ -97,7 +95,7 @@ void DiskImage::sync()
|
|||
|
||||
if (_file.isValid()) return _file.sync();
|
||||
|
||||
throw Exception(__METHOD__ ": File not set.");
|
||||
throw ::Exception(__METHOD__ ": File not set.");
|
||||
}
|
||||
|
||||
|
||||
|
@ -147,10 +145,10 @@ bool ProDOSOrderDiskImage::Validate(MappedFile *f)
|
|||
#undef __METHOD__
|
||||
#define __METHOD__ "ProDOSOrderDiskImage::Validate"
|
||||
|
||||
if (!f || !f->isValid()) throw Exception(__METHOD__ ": File not set.");
|
||||
if (!f || !f->isValid()) throw ::Exception(__METHOD__ ": File not set.");
|
||||
|
||||
if (!Validate(f, std::nothrow))
|
||||
throw Exception(__METHOD__ ": Invalid file format.");
|
||||
throw ::Exception(__METHOD__ ": Invalid file format.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -218,11 +216,11 @@ bool DOSOrderDiskImage::Validate(MappedFile *f)
|
|||
#undef __METHOD__
|
||||
#define __METHOD__ "DOSOrderDiskImage::Validate"
|
||||
|
||||
if (!f || !f->isValid()) throw Exception(__METHOD__ ": File not set.");
|
||||
if (!f || !f->isValid()) throw ::Exception(__METHOD__ ": File not set.");
|
||||
|
||||
|
||||
if (!Validate(f, std::nothrow))
|
||||
throw Exception(__METHOD__ ": Invalid file format.");
|
||||
throw ::Exception(__METHOD__ ": Invalid file format.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <ProFUSE/Exception.h>
|
||||
|
||||
#include <Device/BlockDevice.h>
|
||||
|
||||
#include <Device/Adaptor.h>
|
||||
|
|
|
@ -31,12 +31,11 @@
|
|||
|
||||
#include <Device/RawDevice.h>
|
||||
|
||||
#include <ProFUSE/Exception.h>
|
||||
#include <Common/Exception.h>
|
||||
#include <POSIX/Exception.h>
|
||||
|
||||
using namespace Device;
|
||||
|
||||
using ProFUSE::Exception;
|
||||
using ProFUSE::POSIXException;
|
||||
|
||||
#ifdef __SUN__
|
||||
void RawDevice::devSize(int fd)
|
||||
|
@ -47,7 +46,7 @@ void RawDevice::devSize(int fd)
|
|||
struct dk_minfo minfo;
|
||||
|
||||
if (::ioctl(fd, DKIOCGMEDIAINFO, &minfo) < 0)
|
||||
throw POSIXException(__METHOD__ ": Unable to determine device size.", errno);
|
||||
throw POSIX::Exception(__METHOD__ ": Unable to determine device size.", errno);
|
||||
|
||||
_size = minfo.dki_lbsize * minfo.dki_capacity;
|
||||
_blockSize = 512; // not really, but whatever.
|
||||
|
@ -66,11 +65,11 @@ void RawDevice::devSize(int fd)
|
|||
uint64_t blockCount; // 64 bit
|
||||
|
||||
if (::ioctl(fd, DKIOCGETBLOCKSIZE, &blockSize) < 0)
|
||||
throw POSIXException(__METHOD__ ": Unable to determine block size.", errno);
|
||||
throw POSIX::Exception(__METHOD__ ": Unable to determine block size.", errno);
|
||||
|
||||
|
||||
if (::ioctl(fd, DKIOCGETBLOCKCOUNT, &blockCount) < 0)
|
||||
throw POSIXException(__METHOD__ ": Unable to determine block count.", errno);
|
||||
throw POSIX::Exception(__METHOD__ ": Unable to determine block count.", errno);
|
||||
|
||||
_blockSize = blockSize;
|
||||
_size = _blockSize * blockCount;
|
||||
|
@ -90,7 +89,7 @@ void RawDevice::devSize(int fd)
|
|||
int blocks;
|
||||
|
||||
if (::ioctl(fd, BLKGETSIZE, &blocks) < 0)
|
||||
throw POSIXException(__METHOD__ ": Unable to determine device size.", errno);
|
||||
throw POSIX::Exception(__METHOD__ ": Unable to determine device size.", errno);
|
||||
|
||||
_size = 512 * blocks;
|
||||
_blockSize = 512; //
|
||||
|
@ -113,10 +112,10 @@ void RawDevice::devSize(int fd)
|
|||
off_t mediaSize;
|
||||
|
||||
if (::ioctl(fd, DIOCGSECTORSIZE, &blockSize)
|
||||
throw POSIXException(__METHOD__ ": Unable to determine block size.", errno);
|
||||
throw POSIX::Exception(__METHOD__ ": Unable to determine block size.", errno);
|
||||
|
||||
if (::ioctl(fd, DIOCGMEDIASIZE, &mediaSize)
|
||||
throw POSIXException(__METHOD__ ": Unable to determine media size.", errno);
|
||||
throw POSIX::Exception(__METHOD__ ": Unable to determine media size.", errno);
|
||||
|
||||
_blockSize = blockSize;
|
||||
_size = mediaSize;
|
||||
|
@ -138,7 +137,7 @@ void RawDevice::devSize(int fd)
|
|||
|
||||
|
||||
if (::ioctl(fd, DIOCGETP, &entry) < 0)
|
||||
throw POSIXException(__METHOD__ ": Unable to determine device size.", errno);
|
||||
throw POSIX::Exception(__METHOD__ ": Unable to determine device size.", errno);
|
||||
|
||||
_size = entry.size
|
||||
_blockSize = 512; // not really but whatever.
|
||||
|
@ -157,7 +156,7 @@ RawDevice::RawDevice(const char *name, File::FileFlags flags) :
|
|||
|
||||
if (!_file.isValid())
|
||||
{
|
||||
throw Exception(__METHOD__ ": Invalid file handle.");
|
||||
throw ::Exception(__METHOD__ ": Invalid file handle.");
|
||||
}
|
||||
|
||||
_readOnly = flags == File::ReadOnly;
|
||||
|
@ -178,7 +177,7 @@ RawDevice::RawDevice(File& file, File::FileFlags flags) :
|
|||
|
||||
if (!_file.isValid())
|
||||
{
|
||||
throw Exception(__METHOD__ ": Invalid file handle.");
|
||||
throw ::Exception(__METHOD__ ": Invalid file handle.");
|
||||
}
|
||||
|
||||
_readOnly = flags == File::ReadOnly;
|
||||
|
@ -208,8 +207,8 @@ void RawDevice::read(unsigned block, void *bp)
|
|||
#undef __METHOD__
|
||||
#define __METHOD__ "RawDevice::read"
|
||||
|
||||
if (block >= _blocks) throw Exception(__METHOD__ ": Invalid block number.");
|
||||
if (bp == 0) throw Exception(__METHOD__ ": Invalid address.");
|
||||
if (block >= _blocks) throw ::Exception(__METHOD__ ": Invalid block number.");
|
||||
if (bp == 0) throw ::Exception(__METHOD__ ": Invalid address.");
|
||||
|
||||
// sun -- use pread
|
||||
// apple - read full native block(s) ?
|
||||
|
@ -220,8 +219,8 @@ void RawDevice::read(unsigned block, void *bp)
|
|||
// TODO -- EINTR?
|
||||
if (ok != 512)
|
||||
throw ok < 0
|
||||
? POSIXException(__METHOD__ ": Error reading block.", errno)
|
||||
: Exception(__METHOD__ ": Error reading block.");
|
||||
? POSIX::Exception(__METHOD__ ": Error reading block.", errno)
|
||||
: ::Exception(__METHOD__ ": Error reading block.");
|
||||
}
|
||||
|
||||
|
||||
|
@ -231,8 +230,8 @@ void RawDevice::read(TrackSector ts, void *bp)
|
|||
#define __METHOD__ "RawDevice::read"
|
||||
|
||||
unsigned block = ts.track * 8 + ts.sector / 2;
|
||||
if (block >= _blocks) throw Exception(__METHOD__ ": Invalid block number.");
|
||||
if (bp == 0) throw Exception(__METHOD__ ": Invalid address.");
|
||||
if (block >= _blocks) throw ::Exception(__METHOD__ ": Invalid block number.");
|
||||
if (bp == 0) throw ::Exception(__METHOD__ ": Invalid address.");
|
||||
|
||||
// sun -- use pread
|
||||
// apple - read full native block(s) ?
|
||||
|
@ -243,8 +242,8 @@ void RawDevice::read(TrackSector ts, void *bp)
|
|||
// TODO -- EINTR?
|
||||
if (ok != 256)
|
||||
throw ok < 0
|
||||
? POSIXException(__METHOD__ ": Error reading block.", errno)
|
||||
: Exception(__METHOD__ ": Error reading block.");
|
||||
? POSIX::Exception(__METHOD__ ": Error reading block.", errno)
|
||||
: ::Exception(__METHOD__ ": Error reading block.");
|
||||
}
|
||||
|
||||
|
||||
|
@ -253,10 +252,10 @@ void RawDevice::write(unsigned block, const void *bp)
|
|||
#undef __METHOD__
|
||||
#define __METHOD__ "RawDevice::write"
|
||||
|
||||
if (block > _blocks) throw Exception(__METHOD__ ": Invalid block number.");
|
||||
if (block > _blocks) throw ::Exception(__METHOD__ ": Invalid block number.");
|
||||
|
||||
if (_readOnly)
|
||||
throw Exception(__METHOD__ ": File is readonly.");
|
||||
throw ::Exception(__METHOD__ ": File is readonly.");
|
||||
|
||||
|
||||
off_t offset = block * 512;
|
||||
|
@ -264,8 +263,8 @@ void RawDevice::write(unsigned block, const void *bp)
|
|||
|
||||
if (ok != 512)
|
||||
throw ok < 0
|
||||
? POSIXException(__METHOD__ ": Error writing block.", errno)
|
||||
: Exception(__METHOD__ ": Error writing block.");
|
||||
? POSIX::Exception(__METHOD__ ": Error writing block.", errno)
|
||||
: ::Exception(__METHOD__ ": Error writing block.");
|
||||
}
|
||||
|
||||
|
||||
|
@ -275,10 +274,10 @@ void RawDevice::write(TrackSector ts, const void *bp)
|
|||
#define __METHOD__ "RawDevice::write"
|
||||
|
||||
unsigned block = ts.track * 8 + ts.sector / 2;
|
||||
if (block > _blocks) throw Exception(__METHOD__ ": Invalid block number.");
|
||||
if (block > _blocks) throw ::Exception(__METHOD__ ": Invalid block number.");
|
||||
|
||||
if (_readOnly)
|
||||
throw Exception(__METHOD__ ": File is readonly.");
|
||||
throw ::Exception(__METHOD__ ": File is readonly.");
|
||||
|
||||
|
||||
off_t offset = (ts.track * 16 + ts.sector) * 256;
|
||||
|
@ -286,8 +285,8 @@ void RawDevice::write(TrackSector ts, const void *bp)
|
|||
|
||||
if (ok != 256)
|
||||
throw ok < 0
|
||||
? POSIXException(__METHOD__ ": Error writing block.", errno)
|
||||
: Exception(__METHOD__ ": Error writing block.");
|
||||
? POSIX::Exception(__METHOD__ ": Error writing block.", errno)
|
||||
: ::Exception(__METHOD__ ": Error writing block.");
|
||||
}
|
||||
|
||||
|
||||
|
@ -316,6 +315,6 @@ void RawDevice::sync()
|
|||
if (_readOnly) return;
|
||||
|
||||
if (::fsync(_file.fd()) < 0)
|
||||
throw POSIXException(__METHOD__ ": fsync error.", errno);
|
||||
throw POSIX::Exception(__METHOD__ ": fsync error.", errno);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,39 +20,8 @@
|
|||
#include <File/File.h>
|
||||
#include <File/MappedFile.h>
|
||||
|
||||
#include <ProFUSE/Exception.h>
|
||||
|
||||
|
||||
using ProFUSE::Exception;
|
||||
using ProFUSE::POSIXException;
|
||||
|
||||
|
||||
class NuFXException : public Exception
|
||||
{
|
||||
public:
|
||||
|
||||
NuFXException(const char *cp, NuError error);
|
||||
NuFXException(const std::string& string, NuError error);
|
||||
|
||||
virtual const char *errorString();
|
||||
|
||||
};
|
||||
|
||||
|
||||
inline NuFXException::NuFXException(const char *cp, NuError error) :
|
||||
Exception(cp, error)
|
||||
{
|
||||
}
|
||||
|
||||
inline NuFXException::NuFXException(const std::string& string, NuError error) :
|
||||
Exception(string, error)
|
||||
{
|
||||
}
|
||||
|
||||
const char *NuFXException::errorString()
|
||||
{
|
||||
return ::NuStrError((NuError)error());
|
||||
}
|
||||
#include <Common/Exception.h>
|
||||
#include <NuFX/Exception.h>
|
||||
|
||||
|
||||
using namespace Device;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <Endian/Endian.h>
|
||||
#include <Endian/IOBuffer.h>
|
||||
|
||||
#include <ProFUSE/Exception.h>
|
||||
#include <Common/Exception.h>
|
||||
|
||||
#include <Cache/MappedBlockCache.h>
|
||||
#include <Cache/ConcreteBlockCache.h>
|
||||
|
@ -11,10 +11,6 @@
|
|||
using namespace Device;
|
||||
using namespace LittleEndian;
|
||||
|
||||
using ProFUSE::Exception;
|
||||
using ProFUSE::POSIXException;
|
||||
|
||||
|
||||
|
||||
|
||||
UniversalDiskImage::UniversalDiskImage(MappedFile *file) :
|
||||
|
@ -138,7 +134,7 @@ bool UniversalDiskImage::Validate(MappedFile *file)
|
|||
#define __METHOD__ "UniversalDiskImage::Validate"
|
||||
|
||||
if (!Validate(file, std::nothrow))
|
||||
throw Exception(__METHOD__ ": Invalid file format.");
|
||||
throw ::Exception(__METHOD__ ": Invalid file format.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -2,12 +2,8 @@
|
|||
#include <cerrno>
|
||||
|
||||
#include <File/File.h>
|
||||
#include <ProFUSE/Exception.h>
|
||||
|
||||
|
||||
|
||||
using ProFUSE::Exception;
|
||||
using ProFUSE::POSIXException;
|
||||
#include <Common/Exception.h>
|
||||
#include <POSIX/Exception.h>
|
||||
|
||||
|
||||
File::File()
|
||||
|
@ -49,7 +45,7 @@ File::File(const char *name, int flags)
|
|||
|
||||
_fd = ::open(name, flags);
|
||||
if (_fd < 0)
|
||||
throw POSIXException( __METHOD__ ": open", errno);
|
||||
throw POSIX::Exception( __METHOD__ ": open", errno);
|
||||
}
|
||||
|
||||
File::File(const char *name, int flags, mode_t mode)
|
||||
|
@ -59,7 +55,7 @@ File::File(const char *name, int flags, mode_t mode)
|
|||
|
||||
_fd = ::open(name, flags, mode);
|
||||
if (_fd < 0)
|
||||
throw POSIXException( __METHOD__ ": open", errno);
|
||||
throw POSIX::Exception( __METHOD__ ": open", errno);
|
||||
}
|
||||
|
||||
|
||||
|
@ -70,7 +66,7 @@ File::File(const char *name, FileFlags flags)
|
|||
|
||||
_fd = ::open(name, flags == ReadOnly ? O_RDONLY : O_RDWR);
|
||||
if (_fd < 0)
|
||||
throw POSIXException( __METHOD__ ": open", errno);
|
||||
throw POSIX::Exception( __METHOD__ ": open", errno);
|
||||
}
|
||||
|
||||
|
||||
|
@ -99,7 +95,7 @@ void File::close()
|
|||
// destructor shouldn't throw.
|
||||
/*
|
||||
if (::close(fd) != 0)
|
||||
throw POSIXException(__METHOD__ ": close", errno);
|
||||
throw POSIX::Exception(__METHOD__ ": close", errno);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,10 +4,8 @@
|
|||
#include <sys/stat.h>
|
||||
|
||||
#include <File/MappedFile.h>
|
||||
#include <ProFUSE/Exception.h>
|
||||
|
||||
|
||||
using ProFUSE::POSIXException;
|
||||
#include <Common/Exception.h>
|
||||
#include <POSIX/Exception.h>
|
||||
|
||||
MappedFile::MappedFile()
|
||||
{
|
||||
|
@ -81,16 +79,16 @@ void MappedFile::init(const File &f, bool readOnly, size_t size)
|
|||
|
||||
// close enough
|
||||
if (f.fd() < 0)
|
||||
throw POSIXException( __METHOD__, EBADF);
|
||||
throw POSIX::Exception( __METHOD__, EBADF);
|
||||
|
||||
|
||||
if (!size)
|
||||
{
|
||||
if (::fstat(f.fd(), &st) != 0)
|
||||
throw POSIXException(__METHOD__ ": fstat", errno);
|
||||
throw POSIX::Exception(__METHOD__ ": fstat", errno);
|
||||
|
||||
if (!S_ISREG(st.st_mode))
|
||||
throw POSIXException(__METHOD__, ENODEV);
|
||||
throw POSIX::Exception(__METHOD__, ENODEV);
|
||||
|
||||
size = st.st_size;
|
||||
}
|
||||
|
@ -99,7 +97,7 @@ void MappedFile::init(const File &f, bool readOnly, size_t size)
|
|||
_address = ::mmap(0, _length, prot, flags, f.fd(), 0);
|
||||
|
||||
if (_address == MAP_FAILED)
|
||||
throw POSIXException(__METHOD__ ": mmap", errno);
|
||||
throw POSIX::Exception(__METHOD__ ": mmap", errno);
|
||||
|
||||
_readOnly = readOnly;
|
||||
}
|
||||
|
@ -127,7 +125,7 @@ void MappedFile::close()
|
|||
// destructor shouldn't throw.
|
||||
/*
|
||||
if (::munmap(address, length) != 0)
|
||||
throw POSIXException(__METHOD__ ": munmap", errno);
|
||||
throw POSIX::Exception(__METHOD__ ": munmap", errno);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
@ -140,7 +138,7 @@ void MappedFile::sync()
|
|||
if (_address != MAP_FAILED)
|
||||
{
|
||||
if (::msync(_address, _length, MS_SYNC) != 0)
|
||||
throw POSIXException(__METHOD__ ": msync", errno);
|
||||
throw POSIX::Exception(__METHOD__ ": msync", errno);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,14 +171,14 @@ MappedFile *MappedFile::Create(const char *name, size_t size)
|
|||
|
||||
if (!fd.isValid())
|
||||
{
|
||||
throw POSIXException(__METHOD__ ": Unable to create file.", errno);
|
||||
throw POSIX::Exception(__METHOD__ ": Unable to create file.", errno);
|
||||
}
|
||||
|
||||
// TODO -- is ftruncate portable?
|
||||
if (::ftruncate(fd.fd(), size) < 0)
|
||||
{
|
||||
// TODO -- unlink?
|
||||
throw POSIXException(__METHOD__ ": Unable to truncate file.", errno);
|
||||
throw POSIX::Exception(__METHOD__ ": Unable to truncate file.", errno);
|
||||
}
|
||||
|
||||
return new MappedFile(fd, File::ReadWrite, size);
|
||||
|
|
88
Makefile
88
Makefile
|
@ -11,6 +11,7 @@ endif
|
|||
|
||||
ifdef HAVE_NUFX
|
||||
DEVICE_OBJECTS += Device/SDKImage.o
|
||||
EXCEPTION_OBJECTS += NuFX/Exception.o
|
||||
LDFLAGS += -L/usr/local/lib/
|
||||
LIBS += -lnufx -lz
|
||||
CPPFLAGS += -DHAVE_NUFX=1
|
||||
|
@ -24,8 +25,11 @@ OBJECTS += ${wildcard Device/*.o}
|
|||
OBJECTS += ${wildcard Endian/*.o}
|
||||
OBJECTS += ${wildcard File/*.o}
|
||||
OBJECTS += ${wildcard Pascal/*.o}
|
||||
OBJECTS += ${wildcard ProFUSE/*.o}
|
||||
OBJECTS += ${wildcard Common/*.o}
|
||||
OBJECTS += ${wildcard ProDOS/*.o}
|
||||
OBJECTS += ${wildcard POSIX/*.o}
|
||||
OBJECTS += ${wildcard NuFX/*.o}
|
||||
|
||||
|
||||
TARGETS = o/apfm o/newfs_pascal o/fuse_pascal o/profuse o/xattr
|
||||
|
||||
|
@ -67,13 +71,19 @@ PASCAL_OBJECTS += Pascal/TextWriter.o
|
|||
PASCAL_OBJECTS += Pascal/Entry.o
|
||||
PASCAL_OBJECTS += Pascal/VolumeEntry.o
|
||||
|
||||
PROFUSE_OBJECTS += ProFUSE/Exception.o
|
||||
PROFUSE_OBJECTS += ProFUSE/Lock.o
|
||||
COMMON_OBJECTS += Common/Lock.o
|
||||
|
||||
PRODOS_OBJECTS += ProDOS/DateTime.o
|
||||
PRODOS_OBJECTS += ProDOS/Disk.o
|
||||
PRODOS_OBJECTS += ProDOS/File.o
|
||||
|
||||
EXCEPTION_OBJECTS += Common/Exception.o
|
||||
EXCEPTION_OBJECTS += ProDOS/Exception.o
|
||||
EXCEPTION_OBJECTS += POSIX/Exception.o
|
||||
|
||||
|
||||
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
|
||||
|
@ -93,7 +103,8 @@ o/newfs_pascal: bin/newfs_pascal.o \
|
|||
${DEVICE_OBJECTS} \
|
||||
${ENDIAN_OBJECTS} \
|
||||
${FILE_OBJECTS} \
|
||||
${PROFUSE_OBJECTS} \
|
||||
${COMMON_OBJECTS} \
|
||||
${EXCEPTION_OBJECTS} \
|
||||
${PASCAL_OBJECTS}
|
||||
$(CC) $(LDFLAGS) $^ $(LIBS) -o $@
|
||||
|
||||
|
@ -102,7 +113,8 @@ o/apfm: bin/apfm.o \
|
|||
${DEVICE_OBJECTS} \
|
||||
${ENDIAN_OBJECTS} \
|
||||
${FILE_OBJECTS} \
|
||||
${PROFUSE_OBJECTS} \
|
||||
${COMMON_OBJECTS} \
|
||||
${EXCEPTION_OBJECTS} \
|
||||
${PASCAL_OBJECTS}
|
||||
$(CC) $(LDFLAGS) $^ $(LIBS) -o $@
|
||||
|
||||
|
@ -112,7 +124,8 @@ o/fuse_pascal: bin/fuse_pascal.o bin/fuse_pascal_ops.o \
|
|||
${DEVICE_OBJECTS} \
|
||||
${ENDIAN_OBJECTS} \
|
||||
${FILE_OBJECTS} \
|
||||
${PROFUSE_OBJECTS} \
|
||||
${COMMON_OBJECTS} \
|
||||
${EXCEPTION_OBJECTS} \
|
||||
${PASCAL_OBJECTS}
|
||||
$(CC) $(LDFLAGS) $^ $(LIBS) $(FUSE_LIBS) -o $@
|
||||
|
||||
|
@ -123,7 +136,8 @@ o/profuse: bin/profuse.o bin/profuse_dirent.o bin/profuse_file.o \
|
|||
${DEVICE_OBJECTS} \
|
||||
${ENDIAN_OBJECTS} \
|
||||
${FILE_OBJECTS} \
|
||||
${PROFUSE_OBJECTS} \
|
||||
${COMMON_OBJECTS} \
|
||||
${EXCEPTION_OBJECTS} \
|
||||
${PRODOS_OBJECTS}
|
||||
$(CC) $(LDFLAGS) $^ $(LIBS) $(FUSE_LIBS) -o $@
|
||||
|
||||
|
@ -133,59 +147,59 @@ clean:
|
|||
|
||||
xattr.o: bin/xattr.cpp
|
||||
|
||||
newfs_pascal.o: bin/newfs_pascal.cpp Device/BlockDevice.h ProFUSE/Exception.h \
|
||||
newfs_pascal.o: bin/newfs_pascal.cpp Device/BlockDevice.h Common/Exception.h \
|
||||
Device/TrackSector.h Cache/BlockCache.h Device/RawDevice.h File/File.h \
|
||||
Pascal/Pascal.h Pascal/Date.h
|
||||
|
||||
fuse_pascal.o: bin/fuse_pascal.cpp Pascal/Pascal.h Pascal/Date.h \
|
||||
ProFUSE/Exception.h Device/BlockDevice.h Device/TrackSector.h \
|
||||
Common/Exception.h Device/BlockDevice.h Device/TrackSector.h \
|
||||
Cache/BlockCache.h
|
||||
|
||||
fuse_pascal_ops.o: bin/fuse_pascal_ops.cpp Pascal/Pascal.h Pascal/Date.h \
|
||||
ProFUSE/auto.h ProFUSE/Exception.h
|
||||
Common/auto.h Common/Exception.h
|
||||
|
||||
apfm.o: bin/apfm.cpp Pascal/Pascal.h Pascal/Date.h Device/BlockDevice.h \
|
||||
ProFUSE/Exception.h Device/TrackSector.h Cache/BlockCache.h
|
||||
Common/Exception.h Device/TrackSector.h Cache/BlockCache.h
|
||||
|
||||
File/File.o: File/File.cpp File/File.h ProFUSE/Exception.h
|
||||
File/File.o: File/File.cpp File/File.h Common/Exception.h
|
||||
|
||||
File/MappedFile.o: File/MappedFile.cpp File/MappedFile.h File/File.h \
|
||||
ProFUSE/Exception.h
|
||||
Common/Exception.h
|
||||
|
||||
Device/Adaptor.o: Device/Adaptor.cpp Device/Adaptor.h Device/TrackSector.h \
|
||||
ProFUSE/Exception.h
|
||||
Common/Exception.h
|
||||
|
||||
Device/BlockDevice.o: Device/BlockDevice.cpp Device/BlockDevice.h \
|
||||
ProFUSE/Exception.h Device/TrackSector.h Cache/BlockCache.h \
|
||||
Common/Exception.h Device/TrackSector.h Cache/BlockCache.h \
|
||||
Cache/ConcreteBlockCache.h Device/DiskImage.h Device/Adaptor.h \
|
||||
File/MappedFile.h File/File.h Device/UniversalDiskImage.h \
|
||||
Device/DiskCopy42Image.h Device/DavexDiskImage.h Device/RawDevice.h
|
||||
|
||||
Device/DavexDiskImage.o: Device/DavexDiskImage.cpp \
|
||||
Device/DavexDiskImage.h \
|
||||
Device/BlockDevice.h ProFUSE/Exception.h Device/TrackSector.h \
|
||||
Device/BlockDevice.h Common/Exception.h Device/TrackSector.h \
|
||||
Cache/BlockCache.h Device/DiskImage.h Device/Adaptor.h \
|
||||
File/MappedFile.h File/File.h Endian/Endian.h Endian/IOBuffer.h \
|
||||
Endian/IOBuffer.cpp.h Cache/MappedBlockCache.h
|
||||
|
||||
Device/DiskCopy42Image.o: Device/DiskCopy42Image.cpp \
|
||||
Device/DiskCopy42Image.h \
|
||||
Device/BlockDevice.h ProFUSE/Exception.h Device/TrackSector.h \
|
||||
Device/BlockDevice.h Common/Exception.h Device/TrackSector.h \
|
||||
Cache/BlockCache.h Device/DiskImage.h Device/Adaptor.h \
|
||||
File/MappedFile.h File/File.h Endian/Endian.h Endian/IOBuffer.h \
|
||||
Endian/IOBuffer.cpp.h Cache/MappedBlockCache.h
|
||||
|
||||
Device/DiskImage.o: Device/DiskImage.cpp Device/DiskImage.h \
|
||||
ProFUSE/Exception.h \
|
||||
Common/Exception.h \
|
||||
Device/BlockDevice.h Device/TrackSector.h Cache/BlockCache.h \
|
||||
Device/Adaptor.h File/MappedFile.h File/File.h Cache/MappedBlockCache.h
|
||||
|
||||
Device/RawDevice.o: Device/RawDevice.cpp Device/RawDevice.h \
|
||||
Device/BlockDevice.h \
|
||||
ProFUSE/Exception.h Device/TrackSector.h Cache/BlockCache.h File/File.h
|
||||
Common/Exception.h Device/TrackSector.h Cache/BlockCache.h File/File.h
|
||||
|
||||
Device/UniversalDiskImage.o: Device/UniversalDiskImage.cpp \
|
||||
Device/UniversalDiskImage.h Device/BlockDevice.h ProFUSE/Exception.h \
|
||||
Device/UniversalDiskImage.h Device/BlockDevice.h Common/Exception.h \
|
||||
Device/TrackSector.h Cache/BlockCache.h Device/DiskImage.h \
|
||||
Device/Adaptor.h File/MappedFile.h File/File.h Endian/Endian.h \
|
||||
Endian/IOBuffer.h Endian/IOBuffer.cpp.h Cache/MappedBlockCache.h \
|
||||
|
@ -194,45 +208,45 @@ Device/UniversalDiskImage.o: Device/UniversalDiskImage.cpp \
|
|||
Endian/Endian.o: Endian/Endian.cpp Endian/Endian.h
|
||||
|
||||
Cache/BlockCache.o: Cache/BlockCache.cpp Cache/BlockCache.h \
|
||||
Device/BlockDevice.h ProFUSE/Exception.h Device/TrackSector.h \
|
||||
ProFUSE/auto.h
|
||||
Device/BlockDevice.h Common/Exception.h Device/TrackSector.h \
|
||||
Common/auto.h
|
||||
|
||||
Cache/ConcreteBlockCache.o: Cache/ConcreteBlockCache.cpp \
|
||||
Device/BlockDevice.h \
|
||||
ProFUSE/Exception.h Device/TrackSector.h Cache/BlockCache.h \
|
||||
Cache/ConcreteBlockCache.h ProFUSE/auto.h
|
||||
Common/Exception.h Device/TrackSector.h Cache/BlockCache.h \
|
||||
Cache/ConcreteBlockCache.h Common/auto.h
|
||||
|
||||
Cache/MappedBlockCache.o: Cache/MappedBlockCache.cpp \
|
||||
Cache/MappedBlockCache.h \
|
||||
Cache/BlockCache.h Device/BlockDevice.h ProFUSE/Exception.h \
|
||||
Cache/BlockCache.h Device/BlockDevice.h Common/Exception.h \
|
||||
Device/TrackSector.h
|
||||
|
||||
ProFUSE/Exception.o: ProFUSE/Exception.cpp ProFUSE/Exception.h
|
||||
Common/Exception.o: Common/Exception.cpp Common/Exception.h
|
||||
|
||||
ProFUSE/Lock.o: ProFUSE/Lock.cpp ProFUSE/Lock.h
|
||||
Common/Lock.o: Common/Lock.cpp Common/Lock.h
|
||||
|
||||
|
||||
Pascal/Date.o: Pascal/Date.cpp Pascal/Date.h
|
||||
|
||||
Pascal/Entry.o: Pascal/Entry.cpp Pascal/Entry.h Pascal/Date.h \
|
||||
ProFUSE/Exception.h Endian/Endian.h Endian/IOBuffer.h \
|
||||
Common/Exception.h Endian/Endian.h Endian/IOBuffer.h \
|
||||
Endian/IOBuffer.cpp.h Device/BlockDevice.h Device/TrackSector.h \
|
||||
Cache/BlockCache.h
|
||||
|
||||
Pascal/FileEntry.o: Pascal/FileEntry.cpp Pascal/Pascal.h Pascal/Date.h \
|
||||
Pascal/Entry.h Pascal/FileEntry.h Pascal/VolumeEntry.h ProFUSE/auto.h \
|
||||
ProFUSE/Exception.h Endian/Endian.h Endian/IOBuffer.h \
|
||||
Pascal/Entry.h Pascal/FileEntry.h Pascal/VolumeEntry.h Common/auto.h \
|
||||
Common/Exception.h Endian/Endian.h Endian/IOBuffer.h \
|
||||
Endian/IOBuffer.cpp.h Device/BlockDevice.h Device/TrackSector.h \
|
||||
Cache/BlockCache.h Pascal/TextWriter.h
|
||||
|
||||
Pascal/VolumeEntry.o: Pascal/VolumeEntry.cpp Pascal/Pascal.h Pascal/Date.h \
|
||||
Pascal/Entry.h Pascal/FileEntry.h Pascal/VolumeEntry.h ProFUSE/auto.h \
|
||||
ProFUSE/Exception.h Endian/Endian.h Endian/IOBuffer.h \
|
||||
Pascal/Entry.h Pascal/FileEntry.h Pascal/VolumeEntry.h Common/auto.h \
|
||||
Common/Exception.h Endian/Endian.h Endian/IOBuffer.h \
|
||||
Endian/IOBuffer.cpp.h Device/BlockDevice.h Device/TrackSector.h \
|
||||
Cache/BlockCache.h
|
||||
|
||||
Pascal/TextWriter.o: Pascal/TextWriter.cpp Pascal/TextWriter.h \
|
||||
Pascal/FileEntry.h Pascal/Entry.h Pascal/Date.h ProFUSE/Exception.h
|
||||
Pascal/FileEntry.h Pascal/Entry.h Pascal/Date.h Common/Exception.h
|
||||
|
||||
|
||||
|
||||
|
@ -243,3 +257,11 @@ ProDOS/Disk.o: ProDOS/Disk.cpp ProDOS/Disk.h
|
|||
ProDOS/File.o: ProDOS/File.cpp ProDOS/File.h
|
||||
|
||||
|
||||
ProDOS/Exception.o: ProDOS/Exception.cpp ProDOS/Exception.h Common/Exception.h
|
||||
|
||||
NuFX/Exception.o: NuFX/Exception.cpp NuFX/Exception.h Common/Exception.h
|
||||
|
||||
POSIX/Exception.o: POSIX/Exception.cpp POSIX/Exception.h Common/Exception.h
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <Pascal/Entry.h>
|
||||
|
||||
#include <ProFUSE/Exception.h>
|
||||
#include <Common/Exception.h>
|
||||
|
||||
#include <Endian/Endian.h>
|
||||
#include <Endian/IOBuffer.h>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef __PASCAL_ENTRY_H__
|
||||
#define __PASCAL_ENTRY_H__
|
||||
|
||||
#include <ProFUSE/smart_pointers.h>
|
||||
#include <Common/smart_pointers.h>
|
||||
|
||||
|
||||
namespace Device {
|
||||
|
|
|
@ -8,8 +8,9 @@
|
|||
#include <Pascal/Pascal.h>
|
||||
#include <Pascal/TextWriter.h>
|
||||
|
||||
#include <ProFUSE/auto.h>
|
||||
#include <ProFUSE/Exception.h>
|
||||
#include <Common/auto.h>
|
||||
#include <Common/Exception.h>
|
||||
#include <ProDOS/Exception.h>
|
||||
|
||||
#include <Endian/Endian.h>
|
||||
#include <Endian/IOBuffer.h>
|
||||
|
@ -77,7 +78,7 @@ FileEntry::FileEntry(const char *name, unsigned fileKind)
|
|||
unsigned length = ValidName(name);
|
||||
|
||||
if (!length)
|
||||
throw ProFUSE::Exception(__METHOD__ ": Invalid file name.");
|
||||
throw ::Exception(__METHOD__ ": Invalid file name.");
|
||||
|
||||
_fileKind = fileKind;
|
||||
_status = 0;
|
||||
|
@ -126,7 +127,7 @@ void FileEntry::setName(const char *name)
|
|||
unsigned length = ValidName(name);
|
||||
|
||||
if (!length)
|
||||
throw ProFUSE::ProDOSException(__METHOD__ ": Invalid file name.", ProFUSE::badPathSyntax);
|
||||
throw ProDOS::Exception(__METHOD__ ": Invalid file name.", ProDOS::badPathSyntax);
|
||||
|
||||
_fileNameLength = length;
|
||||
for (unsigned i = 0; i < length; ++i)
|
||||
|
@ -523,7 +524,7 @@ int FileEntry::textRead(uint8_t *buffer, unsigned size, unsigned offset)
|
|||
unsigned l;
|
||||
unsigned count = 0;
|
||||
|
||||
ProFUSE::auto_array<uint8_t> tmp;
|
||||
::auto_array<uint8_t> tmp;
|
||||
unsigned tmpSize = 0;
|
||||
|
||||
if (!_pageSize) textInit();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <Pascal/TextWriter.h>
|
||||
#include <Pascal/FileEntry.h>
|
||||
|
||||
#include <ProFUSE/Exception.h>
|
||||
#include <Common/Exception.h>
|
||||
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
|
@ -89,7 +89,7 @@ void TextWriter::writeLine(const char *line, unsigned length)
|
|||
|
||||
if (length > 1024)
|
||||
{
|
||||
throw ProFUSE::Exception(__METHOD__ ": String is too long.");
|
||||
throw ::Exception(__METHOD__ ": String is too long.");
|
||||
}
|
||||
if (_offset + length > 1024)
|
||||
{
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
|
||||
#include <Pascal/Pascal.h>
|
||||
|
||||
#include <ProFUSE/auto.h>
|
||||
#include <ProFUSE/Exception.h>
|
||||
#include <Common/auto.h>
|
||||
#include <Common/Exception.h>
|
||||
#include <ProDOS/Exception.h>
|
||||
|
||||
#include <Endian/Endian.h>
|
||||
#include <Endian/IOBuffer.h>
|
||||
|
@ -21,9 +22,6 @@ using namespace Pascal;
|
|||
|
||||
using namespace Device;
|
||||
|
||||
using ProFUSE::Exception;
|
||||
using ProFUSE::ProDOSException;
|
||||
using ProFUSE::POSIXException;
|
||||
|
||||
enum {
|
||||
kMaxFiles = 77
|
||||
|
@ -111,13 +109,13 @@ VolumeEntry::VolumeEntry(Device::BlockDevicePointer device, const char *name) :
|
|||
|
||||
deviceBlocks = std::min(0xffffu, deviceBlocks);
|
||||
if (deviceBlocks < 6)
|
||||
throw Exception(__METHOD__ ": device too small.");
|
||||
throw ::Exception(__METHOD__ ": device too small.");
|
||||
|
||||
|
||||
length = ValidName(name);
|
||||
|
||||
if (!length)
|
||||
throw ProDOSException(__METHOD__ ": Invalid volume name.", ProFUSE::badPathSyntax);
|
||||
throw ProDOS::Exception(__METHOD__ ": Invalid volume name.", ProDOS::badPathSyntax);
|
||||
|
||||
_firstBlock = 0;
|
||||
_lastBlock = 6;
|
||||
|
@ -164,7 +162,7 @@ VolumeEntry::VolumeEntry(Device::BlockDevicePointer device)
|
|||
{
|
||||
unsigned blockCount;
|
||||
//unsigned deviceBlocks = device->blocks();
|
||||
ProFUSE::auto_array<uint8_t> buffer(new uint8_t[512]);
|
||||
::auto_array<uint8_t> buffer(new uint8_t[512]);
|
||||
|
||||
|
||||
// read the header block, then load up all the header
|
||||
|
@ -234,7 +232,7 @@ VolumeEntry::VolumeEntry(Device::BlockDevicePointer device)
|
|||
error = true;
|
||||
|
||||
if (error)
|
||||
throw ProDOSException(__METHOD__ ": Invalid file entry.", ProFUSE::dirError);
|
||||
throw ProDOS::Exception(__METHOD__ ": Invalid file entry.", ProDOS::dirError);
|
||||
|
||||
block = e->_lastBlock;
|
||||
|
||||
|
@ -274,7 +272,7 @@ void VolumeEntry::init(void *vp)
|
|||
|
||||
// verify filenamelength <= 7
|
||||
if (_fileNameLength > 7)
|
||||
throw ProDOSException(__METHOD__ ": invalid name length", ProFUSE::badPathSyntax);
|
||||
throw ProDOS::Exception(__METHOD__ ": invalid name length", ProDOS::badPathSyntax);
|
||||
|
||||
// verify fileKind == 0
|
||||
// verify _fileCount reasonable
|
||||
|
@ -367,7 +365,7 @@ int VolumeEntry::unlink(const char *name)
|
|||
}
|
||||
|
||||
// need to update the header blocks.
|
||||
ProFUSE::auto_array<uint8_t> buffer(readDirectoryHeader());
|
||||
::auto_array<uint8_t> buffer(readDirectoryHeader());
|
||||
|
||||
|
||||
// update the filecount.
|
||||
|
@ -596,7 +594,7 @@ FileEntryPointer VolumeEntry::create(const char *name, unsigned blocks)
|
|||
|
||||
entry = FileEntry::Create(name, kUntypedFile);
|
||||
|
||||
ProFUSE::auto_array<uint8_t> buffer(readDirectoryHeader());
|
||||
::auto_array<uint8_t> buffer(readDirectoryHeader());
|
||||
|
||||
for (iter = _files.begin(); iter != _files.end(); ++iter)
|
||||
{
|
||||
|
@ -740,13 +738,13 @@ int VolumeEntry::krunch()
|
|||
if (first != prevBlock) gap = true;
|
||||
|
||||
if (first < prevBlock)
|
||||
return ProFUSE::damagedBitMap;
|
||||
return ProDOS::damagedBitMap;
|
||||
|
||||
if (last < first)
|
||||
return ProFUSE::damagedBitMap;
|
||||
return ProDOS::damagedBitMap;
|
||||
|
||||
if (first < volumeBlocks())
|
||||
return ProFUSE::damagedBitMap;
|
||||
return ProDOS::damagedBitMap;
|
||||
|
||||
|
||||
prevBlock = last;
|
||||
|
@ -758,7 +756,7 @@ int VolumeEntry::krunch()
|
|||
|
||||
|
||||
// need to update the header blocks.
|
||||
ProFUSE::auto_array<uint8_t> buffer(readDirectoryHeader());
|
||||
::auto_array<uint8_t> buffer(readDirectoryHeader());
|
||||
IOBuffer b(buffer.get(), 512 * blocks());
|
||||
|
||||
|
||||
|
@ -956,7 +954,7 @@ void VolumeEntry::writeDirectoryHeader(void *buffer)
|
|||
|
||||
uint8_t *VolumeEntry::readBlocks(unsigned startingBlock, unsigned count)
|
||||
{
|
||||
ProFUSE::auto_array<uint8_t> buffer(new uint8_t[512 * count]);
|
||||
::auto_array<uint8_t> buffer(new uint8_t[512 * count]);
|
||||
|
||||
for (unsigned i = 0; i < count; ++i)
|
||||
_cache->read(startingBlock + i, buffer.get() + 512 * i);
|
||||
|
@ -1001,7 +999,7 @@ void VolumeEntry::writeEntry(FileEntry *e)
|
|||
else
|
||||
{
|
||||
// crosses page boundaries.
|
||||
ProFUSE::auto_array<uint8_t> buffer(readBlocks(startBlock, 2));
|
||||
::auto_array<uint8_t> buffer(readBlocks(startBlock, 2));
|
||||
|
||||
IOBuffer b(buffer.get() + offset, 0x1a);
|
||||
|
||||
|
|
|
@ -1067,7 +1067,7 @@ int main(int argc, char **argv)
|
|||
usage();
|
||||
return 3;
|
||||
}
|
||||
catch (ProFUSE::Exception& e)
|
||||
catch (Exception& e)
|
||||
{
|
||||
std::fprintf(stderr, "%s\n", e.what());
|
||||
std::fprintf(stderr, "%s\n", e.errorString());
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include <fuse/fuse_lowlevel.h>
|
||||
|
||||
#include <Pascal/Pascal.h>
|
||||
#include <ProFUSE/Exception.h>
|
||||
#include <Common/Exception.h>
|
||||
|
||||
#include <File/File.h>
|
||||
|
||||
|
@ -216,17 +216,13 @@ int main(int argc, char **argv)
|
|||
|
||||
volume = Pascal::VolumeEntry::Open(device);
|
||||
}
|
||||
catch (ProFUSE::POSIXException &e)
|
||||
catch (::Exception &e)
|
||||
{
|
||||
std::fprintf(stderr, "%s\n", e.what());
|
||||
std::fprintf(stderr, "%s\n", std::strerror(e.error()));
|
||||
return -1;
|
||||
}
|
||||
catch (ProFUSE::Exception &e)
|
||||
{
|
||||
std::fprintf(stderr, "%s\n", e.what());
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -26,8 +26,9 @@
|
|||
|
||||
|
||||
#include <Pascal/Pascal.h>
|
||||
#include <ProFUSE/auto.h>
|
||||
#include <ProFUSE/Exception.h>
|
||||
#include <Common/auto.h>
|
||||
#include <Common/Exception.h>
|
||||
#include <POSIX/Exception.h>
|
||||
|
||||
#define NO_ATTR() \
|
||||
{ \
|
||||
|
@ -264,7 +265,7 @@ static void pascal_readdir(fuse_req_t req, fuse_ino_t ino, size_t size, off_t of
|
|||
DEBUGNAME()
|
||||
|
||||
VolumeEntry *volume = (VolumeEntry *)fuse_req_userdata(req);
|
||||
ProFUSE::auto_array<uint8_t> buffer(new uint8_t[size]);
|
||||
::auto_array<uint8_t> buffer(new uint8_t[size]);
|
||||
unsigned count = volume->fileCount();
|
||||
|
||||
|
||||
|
@ -502,13 +503,14 @@ static void pascal_read(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
|
|||
|
||||
try
|
||||
{
|
||||
ProFUSE::auto_array<uint8_t> buffer(new uint8_t[size]);
|
||||
::auto_array<uint8_t> buffer(new uint8_t[size]);
|
||||
unsigned rsize = file->read(buffer.get(), size, off);
|
||||
|
||||
fuse_reply_buf(req, (char *)(buffer.get()), rsize);
|
||||
return;
|
||||
}
|
||||
catch (ProFUSE::POSIXException &e)
|
||||
|
||||
catch (POSIX::Exception &e)
|
||||
{
|
||||
printf("posix error...\n");
|
||||
ERROR(true, e.error());
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <Device/RawDevice.h>
|
||||
|
||||
|
||||
#include <ProFUSE/Exception.h>
|
||||
#include <Common/Exception.h>
|
||||
|
||||
#include <Pascal/Pascal.h>
|
||||
|
||||
|
@ -302,17 +302,13 @@ int main(int argc, char **argv)
|
|||
|
||||
|
||||
}
|
||||
catch (ProFUSE::POSIXException& e)
|
||||
catch (::Exception& e)
|
||||
{
|
||||
std::fprintf(stderr, "%s\n", e.what());
|
||||
std::fprintf(stderr, "%s\n", ::strerror(e.error()));
|
||||
return -2;
|
||||
}
|
||||
catch (ProFUSE::Exception& e)
|
||||
{
|
||||
std::fprintf(stderr, "%s\n", e.what());
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -280,7 +280,7 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
catch (ProFUSE::Exception &e)
|
||||
catch (::Exception &e)
|
||||
{
|
||||
std::fprintf(stderr, "%s\n", e.what());
|
||||
std::fprintf(stderr, "%s\n", e.errorString());
|
||||
|
|
Loading…
Reference in New Issue