mirror of
https://github.com/ksherlock/profuse.git
synced 2025-02-13 14:32:01 +00:00
git-svn-id: https://profuse.googlecode.com/svn/branches/v2@225 aa027e90-d47c-11dd-86d7-074df07e0730
This commit is contained in:
parent
e53674e015
commit
545dd02842
@ -27,7 +27,7 @@ using ProFUSE::POSIXException;
|
||||
|
||||
BlockCache::BlockCache(BlockDevice *device)
|
||||
{
|
||||
_device = _device;
|
||||
_device = device;
|
||||
_blocks = device->blocks();
|
||||
_readOnly = device->readOnly();
|
||||
}
|
||||
|
@ -40,9 +40,12 @@ DavexDiskImage::DavexDiskImage(const char *name, bool readOnly) :
|
||||
DavexDiskImage::DavexDiskImage(MappedFile *file) :
|
||||
DiskImage(file)
|
||||
{
|
||||
// at this point, file is no longer valid.
|
||||
|
||||
|
||||
// 512-bytes header
|
||||
setBlocks((file->length() / 512) - 1);
|
||||
setAdaptor(new POAdaptor(512 + (uint8_t *)file->address()));
|
||||
setBlocks((length() / 512) - 1);
|
||||
setAdaptor(new POAdaptor(512 + (uint8_t *)address()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -202,8 +202,10 @@ ProDOSOrderDiskImage::ProDOSOrderDiskImage(const char *name, bool readOnly) :
|
||||
ProDOSOrderDiskImage::ProDOSOrderDiskImage(MappedFile *file) :
|
||||
DiskImage(file)
|
||||
{
|
||||
setBlocks(file->length() / 512);
|
||||
setAdaptor(new POAdaptor(file->address()));
|
||||
// at this point, file is no longer valid.
|
||||
|
||||
setBlocks(length() / 512);
|
||||
setAdaptor(new POAdaptor(address()));
|
||||
}
|
||||
|
||||
ProDOSOrderDiskImage *ProDOSOrderDiskImage::Create(const char *name, size_t blocks)
|
||||
@ -252,8 +254,10 @@ DOSOrderDiskImage::DOSOrderDiskImage(const char *name, bool readOnly) :
|
||||
DOSOrderDiskImage::DOSOrderDiskImage(MappedFile *file) :
|
||||
DiskImage(file)
|
||||
{
|
||||
setBlocks(file->length() / 512);
|
||||
setAdaptor(new DOAdaptor(file->address()));
|
||||
// at this point, file is no longer valid.
|
||||
|
||||
setBlocks(length() / 512);
|
||||
setAdaptor(new DOAdaptor(address()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -44,6 +44,8 @@ protected:
|
||||
void setAdaptor(Adaptor *);
|
||||
|
||||
void *address() const { return _file.address(); }
|
||||
size_t length() const { return _file.length(); }
|
||||
|
||||
MappedFile *file() { return &_file; }
|
||||
|
||||
private:
|
||||
|
@ -32,7 +32,9 @@ UniversalDiskImage::UniversalDiskImage(MappedFile *file) :
|
||||
DiskImage(file)
|
||||
{
|
||||
|
||||
uint8_t * data = (uint8_t *)file->address();
|
||||
// at this point, file is no longer valid.
|
||||
|
||||
uint8_t * data = (uint8_t *)address();
|
||||
|
||||
|
||||
|
||||
|
@ -100,7 +100,7 @@ VolumeEntry::VolumeEntry(Device::BlockDevice *device)
|
||||
_device = device;
|
||||
_cache = BlockCache::Create(device);
|
||||
|
||||
device->read(2, buffer.get());
|
||||
_cache->read(2, buffer.get());
|
||||
|
||||
init(buffer.get());
|
||||
|
||||
@ -108,7 +108,6 @@ VolumeEntry::VolumeEntry(Device::BlockDevice *device)
|
||||
|
||||
//printf("%u %u\n", blocks(), _lastBlock - _firstBlock);
|
||||
|
||||
// why the fuck didn't this work????
|
||||
blockCount = blocks();
|
||||
|
||||
if (blockCount > 1)
|
||||
@ -117,7 +116,7 @@ VolumeEntry::VolumeEntry(Device::BlockDevice *device)
|
||||
|
||||
for (unsigned i = 0; i < blockCount; ++i)
|
||||
{
|
||||
device->read(2 + i, buffer.get() + 512 * i);
|
||||
_cache->read(2 + i, buffer.get() + 512 * i);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user