mirror of
https://github.com/ksherlock/profuse.git
synced 2025-01-02 16:29:57 +00:00
shared_ptr changes.
git-svn-id: https://profuse.googlecode.com/svn/branches/v2@346 aa027e90-d47c-11dd-86d7-074df07e0730
This commit is contained in:
parent
78d35bba08
commit
2243d8d136
@ -78,7 +78,7 @@ unsigned BlockDevice::ImageType(const char *type, unsigned defv)
|
|||||||
return defv;
|
return defv;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockDevice *BlockDevice::Open(const char *name, File::FileFlags flags, unsigned imageType)
|
BlockDevicePointer BlockDevice::Open(const char *name, File::FileFlags flags, unsigned imageType)
|
||||||
{
|
{
|
||||||
#undef __METHOD__
|
#undef __METHOD__
|
||||||
#define __METHOD__ "BlockDevice::Open"
|
#define __METHOD__ "BlockDevice::Open"
|
||||||
@ -128,7 +128,7 @@ BlockDevice *BlockDevice::Open(const char *name, File::FileFlags flags, unsigned
|
|||||||
}
|
}
|
||||||
|
|
||||||
// throw an error?
|
// throw an error?
|
||||||
return NULL;
|
return BlockDevicePointer();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ static std::string filename(const std::string& src)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BlockDevice *BlockDevice::Create(const char *fname, const char *vname, unsigned blocks, unsigned imageType)
|
BlockDevicePointer BlockDevice::Create(const char *fname, const char *vname, unsigned blocks, unsigned imageType)
|
||||||
{
|
{
|
||||||
std::string xname;
|
std::string xname;
|
||||||
|
|
||||||
@ -191,7 +191,7 @@ BlockDevice *BlockDevice::Create(const char *fname, const char *vname, unsigned
|
|||||||
return DavexDiskImage::Create(fname, blocks, vname);
|
return DavexDiskImage::Create(fname, blocks, vname);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return BlockDevicePointer();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ public:
|
|||||||
// static methods.
|
// static methods.
|
||||||
static unsigned ImageType(const char *type, unsigned defv = 0);
|
static unsigned ImageType(const char *type, unsigned defv = 0);
|
||||||
|
|
||||||
static BlockDevice *Open(const char *name, File::FileFlags flags, unsigned imageType = 0);
|
static BlockDevicePointer Open(const char *name, File::FileFlags flags, unsigned imageType = 0);
|
||||||
static BlockDevice *Create(const char *fname, const char *vname, unsigned blocks, unsigned imageType = 0);
|
static BlockDevicePointer Create(const char *fname, const char *vname, unsigned blocks, unsigned imageType = 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,20 +85,20 @@ void DavexDiskImage::Validate(MappedFile *f)
|
|||||||
throw Exception(__METHOD__ ": Invalid file format.");
|
throw Exception(__METHOD__ ": Invalid file format.");
|
||||||
}
|
}
|
||||||
|
|
||||||
DavexDiskImage *DavexDiskImage::Open(MappedFile *file)
|
BlockDevicePointer DavexDiskImage::Open(MappedFile *file)
|
||||||
{
|
{
|
||||||
#undef __METHOD__
|
#undef __METHOD__
|
||||||
#define __METHOD__ "DavexDiskImage::Open"
|
#define __METHOD__ "DavexDiskImage::Open"
|
||||||
Validate(file);
|
Validate(file);
|
||||||
|
|
||||||
return new DavexDiskImage(file);
|
return BlockDevicePointer(new DavexDiskImage(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
DavexDiskImage *DavexDiskImage::Create(const char *name, size_t blocks)
|
BlockDevicePointer DavexDiskImage::Create(const char *name, size_t blocks)
|
||||||
{
|
{
|
||||||
return Create(name, blocks, "Untitled");
|
return Create(name, blocks, "Untitled");
|
||||||
}
|
}
|
||||||
DavexDiskImage *DavexDiskImage::Create(const char *name, size_t blocks, const char *vname)
|
BlockDevicePointer DavexDiskImage::Create(const char *name, size_t blocks, const char *vname)
|
||||||
{
|
{
|
||||||
#undef __METHOD__
|
#undef __METHOD__
|
||||||
#define __METHOD__ "DavexDiskImage::Create"
|
#define __METHOD__ "DavexDiskImage::Create"
|
||||||
@ -154,7 +154,7 @@ DavexDiskImage *DavexDiskImage::Create(const char *name, size_t blocks, const ch
|
|||||||
std::memcpy(file->address(), header.buffer(), 512);
|
std::memcpy(file->address(), header.buffer(), 512);
|
||||||
file->sync();
|
file->sync();
|
||||||
|
|
||||||
return new DavexDiskImage(file);
|
return BlockDevicePointer(new DavexDiskImage(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,9 +16,9 @@ public:
|
|||||||
|
|
||||||
virtual ~DavexDiskImage();
|
virtual ~DavexDiskImage();
|
||||||
|
|
||||||
static DavexDiskImage *Create(const char *name, size_t blocks);
|
static BlockDevicePointer Create(const char *name, size_t blocks);
|
||||||
static DavexDiskImage *Create(const char *name, size_t blocks, const char *vname);
|
static BlockDevicePointer Create(const char *name, size_t blocks, const char *vname);
|
||||||
static DavexDiskImage *Open(MappedFile *);
|
static BlockDevicePointer Open(MappedFile *);
|
||||||
|
|
||||||
virtual BlockCachePointer createBlockCache();
|
virtual BlockCachePointer createBlockCache();
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ namespace Device {
|
|||||||
class BlockDevice;
|
class BlockDevice;
|
||||||
class BlockCache;
|
class BlockCache;
|
||||||
|
|
||||||
|
|
||||||
typedef std::tr1::shared_ptr<BlockDevice> BlockDevicePointer;
|
typedef std::tr1::shared_ptr<BlockDevice> BlockDevicePointer;
|
||||||
typedef std::tr1::shared_ptr<BlockCache> BlockCachePointer;
|
typedef std::tr1::shared_ptr<BlockCache> BlockCachePointer;
|
||||||
|
|
||||||
|
@ -75,10 +75,10 @@ uint32_t DiskCopy42Image::Checksum(void *data, size_t size)
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
DiskCopy42Image *DiskCopy42Image::Open(MappedFile *f)
|
BlockDevicePointer DiskCopy42Image::Open(MappedFile *f)
|
||||||
{
|
{
|
||||||
Validate(f);
|
Validate(f);
|
||||||
return new DiskCopy42Image(f);
|
return BlockDevicePointer(new DiskCopy42Image(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t DiskFormat(size_t blocks)
|
static uint8_t DiskFormat(size_t blocks)
|
||||||
@ -101,12 +101,12 @@ static uint8_t FormatByte(size_t blocks)
|
|||||||
default: return 0x22;
|
default: return 0x22;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DiskCopy42Image *DiskCopy42Image::Create(const char *name, size_t blocks)
|
BlockDevicePointer DiskCopy42Image::Create(const char *name, size_t blocks)
|
||||||
{
|
{
|
||||||
return Create(name, blocks, "Untitled");
|
return Create(name, blocks, "Untitled");
|
||||||
}
|
}
|
||||||
|
|
||||||
DiskCopy42Image *DiskCopy42Image::Create(const char *name, size_t blocks, const char *vname)
|
BlockDevicePointer DiskCopy42Image::Create(const char *name, size_t blocks, const char *vname)
|
||||||
{
|
{
|
||||||
MappedFile *file = MappedFile::Create(name, blocks * 512 + oUserData);
|
MappedFile *file = MappedFile::Create(name, blocks * 512 + oUserData);
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ DiskCopy42Image *DiskCopy42Image::Create(const char *name, size_t blocks, const
|
|||||||
std::memcpy(file->address(), header.buffer(), oUserData);
|
std::memcpy(file->address(), header.buffer(), oUserData);
|
||||||
file->sync();
|
file->sync();
|
||||||
|
|
||||||
return new DiskCopy42Image(file);
|
return BlockDevicePointer(new DiskCopy42Image(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiskCopy42Image::Validate(MappedFile *file)
|
void DiskCopy42Image::Validate(MappedFile *file)
|
||||||
|
@ -12,10 +12,10 @@ class DiskCopy42Image : public DiskImage {
|
|||||||
public:
|
public:
|
||||||
virtual ~DiskCopy42Image();
|
virtual ~DiskCopy42Image();
|
||||||
|
|
||||||
static DiskCopy42Image *Create(const char *name, size_t blocks);
|
static BlockDevicePointer Create(const char *name, size_t blocks);
|
||||||
static DiskCopy42Image *Create(const char *name, size_t blocks, const char *vname);
|
static BlockDevicePointer Create(const char *name, size_t blocks, const char *vname);
|
||||||
|
|
||||||
static DiskCopy42Image *Open(MappedFile *);
|
static BlockDevicePointer Open(MappedFile *);
|
||||||
|
|
||||||
static uint32_t Checksum(void *data, size_t size);
|
static uint32_t Checksum(void *data, size_t size);
|
||||||
|
|
||||||
|
@ -112,16 +112,16 @@ ProDOSOrderDiskImage::ProDOSOrderDiskImage(MappedFile *file) :
|
|||||||
setAdaptor(new POAdaptor(address()));
|
setAdaptor(new POAdaptor(address()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ProDOSOrderDiskImage *ProDOSOrderDiskImage::Create(const char *name, size_t blocks)
|
BlockDevicePointer ProDOSOrderDiskImage::Create(const char *name, size_t blocks)
|
||||||
{
|
{
|
||||||
MappedFile *file = MappedFile::Create(name, blocks * 512);
|
MappedFile *file = MappedFile::Create(name, blocks * 512);
|
||||||
return new ProDOSOrderDiskImage(file);
|
return BlockDevicePointer(new ProDOSOrderDiskImage(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
ProDOSOrderDiskImage *ProDOSOrderDiskImage::Open(MappedFile *file)
|
BlockDevicePointer ProDOSOrderDiskImage::Open(MappedFile *file)
|
||||||
{
|
{
|
||||||
Validate(file);
|
Validate(file);
|
||||||
return new ProDOSOrderDiskImage(file);
|
return BlockDevicePointer(new ProDOSOrderDiskImage(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProDOSOrderDiskImage::Validate(MappedFile *f)
|
void ProDOSOrderDiskImage::Validate(MappedFile *f)
|
||||||
@ -165,16 +165,16 @@ DOSOrderDiskImage::DOSOrderDiskImage(MappedFile *file) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DOSOrderDiskImage *DOSOrderDiskImage::Create(const char *name, size_t blocks)
|
BlockDevicePointer DOSOrderDiskImage::Create(const char *name, size_t blocks)
|
||||||
{
|
{
|
||||||
MappedFile *file = MappedFile::Create(name, blocks * 512);
|
MappedFile *file = MappedFile::Create(name, blocks * 512);
|
||||||
return new DOSOrderDiskImage(file);
|
return BlockDevicePointer(new DOSOrderDiskImage(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
DOSOrderDiskImage *DOSOrderDiskImage::Open(MappedFile *file)
|
BlockDevicePointer DOSOrderDiskImage::Open(MappedFile *file)
|
||||||
{
|
{
|
||||||
Validate(file);
|
Validate(file);
|
||||||
return new DOSOrderDiskImage(file);
|
return BlockDevicePointer(new DOSOrderDiskImage(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DOSOrderDiskImage::Validate(MappedFile *f)
|
void DOSOrderDiskImage::Validate(MappedFile *f)
|
||||||
|
@ -57,8 +57,8 @@ class ProDOSOrderDiskImage : public DiskImage {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
static ProDOSOrderDiskImage *Create(const char *name, size_t blocks);
|
static BlockDevicePointer Create(const char *name, size_t blocks);
|
||||||
static ProDOSOrderDiskImage *Open(MappedFile *);
|
static BlockDevicePointer Open(MappedFile *);
|
||||||
|
|
||||||
|
|
||||||
virtual BlockCachePointer createBlockCache();
|
virtual BlockCachePointer createBlockCache();
|
||||||
@ -75,8 +75,8 @@ class DOSOrderDiskImage : public DiskImage {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
static DOSOrderDiskImage *Create(const char *name, size_t blocks);
|
static BlockDevicePointer Create(const char *name, size_t blocks);
|
||||||
static DOSOrderDiskImage *Open(MappedFile *);
|
static BlockDevicePointer Open(MappedFile *);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DOSOrderDiskImage();
|
DOSOrderDiskImage();
|
||||||
|
@ -196,9 +196,9 @@ RawDevice::~RawDevice()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RawDevice *RawDevice::Open(const char *name, File::FileFlags flags)
|
BlockDevicePointer RawDevice::Open(const char *name, File::FileFlags flags)
|
||||||
{
|
{
|
||||||
return new RawDevice(name, flags);
|
return BlockDevicePointer(new RawDevice(name, flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static RawDevice *Open(const char *name, File::FileFlags flags);
|
static BlockDevicePointer Open(const char *name, File::FileFlags flags);
|
||||||
|
|
||||||
|
|
||||||
virtual ~RawDevice();
|
virtual ~RawDevice();
|
||||||
|
@ -41,7 +41,7 @@ UniversalDiskImage::UniversalDiskImage(MappedFile *file) :
|
|||||||
setAdaptor(new POAdaptor(_dataOffset + data));
|
setAdaptor(new POAdaptor(_dataOffset + data));
|
||||||
}
|
}
|
||||||
|
|
||||||
UniversalDiskImage *UniversalDiskImage::Create(const char *name, size_t blocks)
|
BlockDevicePointer UniversalDiskImage::Create(const char *name, size_t blocks)
|
||||||
{
|
{
|
||||||
// 64-byte header.
|
// 64-byte header.
|
||||||
MappedFile *file = MappedFile::Create(name, blocks * 512 + 64);
|
MappedFile *file = MappedFile::Create(name, blocks * 512 + 64);
|
||||||
@ -81,13 +81,13 @@ UniversalDiskImage *UniversalDiskImage::Create(const char *name, size_t blocks)
|
|||||||
std::memcpy(file->address(), header.buffer(), 64);
|
std::memcpy(file->address(), header.buffer(), 64);
|
||||||
|
|
||||||
|
|
||||||
return new UniversalDiskImage(file);
|
return BlockDevicePointer(new UniversalDiskImage(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
UniversalDiskImage *UniversalDiskImage::Open(MappedFile *file)
|
BlockDevicePointer UniversalDiskImage::Open(MappedFile *file)
|
||||||
{
|
{
|
||||||
Validate(file);
|
Validate(file);
|
||||||
return new UniversalDiskImage(file);
|
return BlockDevicePointer(new UniversalDiskImage(file));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static UniversalDiskImage *Create(const char *name, size_t blocks);
|
static BlockDevicePointer Create(const char *name, size_t blocks);
|
||||||
static UniversalDiskImage *Open(MappedFile *);
|
static BlockDevicePointer Open(MappedFile *);
|
||||||
|
|
||||||
virtual bool readOnly();
|
virtual bool readOnly();
|
||||||
|
|
||||||
|
@ -71,12 +71,11 @@ VolumeEntry::VolumeEntry()
|
|||||||
|
|
||||||
setInode(1);
|
setInode(1);
|
||||||
|
|
||||||
_inodeGenerator = 1;
|
_inodeGenerator = 1;
|
||||||
_cache = NULL;
|
|
||||||
_device = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VolumeEntry::VolumeEntry(const char *name, Device::BlockDevice *device)
|
VolumeEntry::VolumeEntry(const char *name, Device::BlockDevicePointer device) :
|
||||||
|
_device(device)
|
||||||
{
|
{
|
||||||
#undef __METHOD__
|
#undef __METHOD__
|
||||||
#define __METHOD__ "VolumeEntry::VolumeEntry"
|
#define __METHOD__ "VolumeEntry::VolumeEntry"
|
||||||
@ -114,8 +113,8 @@ VolumeEntry::VolumeEntry(const char *name, Device::BlockDevice *device)
|
|||||||
_accessTime = 0;
|
_accessTime = 0;
|
||||||
_lastBoot = Date::Today();
|
_lastBoot = Date::Today();
|
||||||
|
|
||||||
_cache = BlockCache::Create(device);
|
|
||||||
_device = device;
|
_device = device;
|
||||||
|
_cache = BlockCache::Create(device);
|
||||||
|
|
||||||
_address = 512 * 2;
|
_address = 512 * 2;
|
||||||
|
|
||||||
@ -136,10 +135,10 @@ VolumeEntry::VolumeEntry(const char *name, Device::BlockDevice *device)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VolumeEntry::VolumeEntry(Device::BlockDevice *device)
|
VolumeEntry::VolumeEntry(Device::BlockDevicePointer device)
|
||||||
{
|
{
|
||||||
unsigned blockCount;
|
unsigned blockCount;
|
||||||
unsigned deviceBlocks = device->blocks();
|
//unsigned deviceBlocks = device->blocks();
|
||||||
ProFUSE::auto_array<uint8_t> buffer(new uint8_t[512]);
|
ProFUSE::auto_array<uint8_t> buffer(new uint8_t[512]);
|
||||||
|
|
||||||
|
|
||||||
@ -245,10 +244,7 @@ VolumeEntry::~VolumeEntry()
|
|||||||
{
|
{
|
||||||
if (*iter) delete *iter;
|
if (*iter) delete *iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete _cache;
|
|
||||||
// _device is deleted by _cache.
|
|
||||||
//delete _device;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,10 +19,10 @@ namespace Pascal {
|
|||||||
|
|
||||||
|
|
||||||
// create new
|
// create new
|
||||||
VolumeEntry(const char *name, Device::BlockDevice *);
|
VolumeEntry(const char *name, Device::BlockDevicePointer);
|
||||||
|
|
||||||
// open existing
|
// open existing
|
||||||
VolumeEntry(Device::BlockDevice *);
|
VolumeEntry(Device::BlockDevicePointer);
|
||||||
virtual ~VolumeEntry();
|
virtual ~VolumeEntry();
|
||||||
|
|
||||||
const char *name() const { return _fileName; }
|
const char *name() const { return _fileName; }
|
||||||
@ -93,8 +93,8 @@ namespace Pascal {
|
|||||||
std::vector<FileEntry *> _files;
|
std::vector<FileEntry *> _files;
|
||||||
unsigned _inodeGenerator;
|
unsigned _inodeGenerator;
|
||||||
|
|
||||||
Device::BlockDevice *_device;
|
Device::BlockDevicePointer _device;
|
||||||
Device::BlockCache *_cache;
|
Device::BlockCachePointer _cache;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
10
bin/apfm.cpp
10
bin/apfm.cpp
@ -5,7 +5,6 @@
|
|||||||
* E -
|
* E -
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
@ -23,6 +22,7 @@
|
|||||||
#include <Pascal/Date.h>
|
#include <Pascal/Date.h>
|
||||||
#include <Pascal/TextWriter.h>
|
#include <Pascal/TextWriter.h>
|
||||||
|
|
||||||
|
#include <Device/Device.h>
|
||||||
#include <Device/BlockDevice.h>
|
#include <Device/BlockDevice.h>
|
||||||
|
|
||||||
#include <File/File.h>
|
#include <File/File.h>
|
||||||
@ -963,7 +963,7 @@ int action_put(int argc, char **argv, Pascal::VolumeEntry *volume)
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
std::auto_ptr<Pascal::VolumeEntry> volume;
|
std::auto_ptr<Pascal::VolumeEntry> volume;
|
||||||
std::auto_ptr<Device::BlockDevice> device;
|
Device::BlockDevicePointer device;
|
||||||
|
|
||||||
unsigned fmt = 0;
|
unsigned fmt = 0;
|
||||||
|
|
||||||
@ -1025,10 +1025,10 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
unsigned actionCode = command(action);
|
unsigned actionCode = command(action);
|
||||||
|
|
||||||
device.reset( Device::BlockDevice::Open(file, commandFlags(actionCode), fmt) );
|
device = Device::BlockDevice::Open(file, commandFlags(actionCode), fmt);
|
||||||
|
|
||||||
volume.reset( new Pascal::VolumeEntry(device.get()));
|
volume.reset( new Pascal::VolumeEntry(device));
|
||||||
device.release();
|
device.reset();
|
||||||
|
|
||||||
switch (actionCode)
|
switch (actionCode)
|
||||||
{
|
{
|
||||||
|
@ -17,17 +17,18 @@
|
|||||||
#include <fuse/fuse_opt.h>
|
#include <fuse/fuse_opt.h>
|
||||||
#include <fuse/fuse_lowlevel.h>
|
#include <fuse/fuse_lowlevel.h>
|
||||||
|
|
||||||
|
|
||||||
#include <Pascal/Pascal.h>
|
#include <Pascal/Pascal.h>
|
||||||
#include <ProFUSE/Exception.h>
|
#include <ProFUSE/Exception.h>
|
||||||
|
|
||||||
#include <Device/BlockDevice.h>
|
|
||||||
|
|
||||||
#include <File/File.h>
|
#include <File/File.h>
|
||||||
|
|
||||||
|
#include <Device/Device.h>
|
||||||
|
#include <Device/BlockDevice.h>
|
||||||
|
|
||||||
std::string fDiskImage;
|
std::string fDiskImage;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void usage()
|
void usage()
|
||||||
{
|
{
|
||||||
std::printf("profuse_pascal 0.1\n\n");
|
std::printf("profuse_pascal 0.1\n\n");
|
||||||
@ -196,9 +197,11 @@ int main(int argc, char **argv)
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
std::auto_ptr<Device::BlockDevice> device;
|
//std::tr1::shared_ptr<Device::BlockDevice> device;
|
||||||
|
|
||||||
device.reset( Device::BlockDevice::Open(fDiskImage.c_str(), File::ReadOnly, format) );
|
Device::BlockDevicePointer device;
|
||||||
|
|
||||||
|
device = Device::BlockDevice::Open(fDiskImage.c_str(), File::ReadOnly, format);
|
||||||
|
|
||||||
|
|
||||||
if (!device.get())
|
if (!device.get())
|
||||||
@ -207,8 +210,8 @@ int main(int argc, char **argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
volume.reset( new Pascal::VolumeEntry(device.get()) );
|
volume.reset( new Pascal::VolumeEntry(device) );
|
||||||
device.release();
|
device.reset();
|
||||||
}
|
}
|
||||||
catch (ProFUSE::POSIXException &e)
|
catch (ProFUSE::POSIXException &e)
|
||||||
{
|
{
|
||||||
|
@ -214,7 +214,7 @@ int main(int argc, char **argv)
|
|||||||
struct stat st;
|
struct stat st;
|
||||||
bool rawDevice;
|
bool rawDevice;
|
||||||
|
|
||||||
std::auto_ptr<BlockDevice> device;
|
BlockDevicePointer device;
|
||||||
std::auto_ptr<VolumeEntry> volume;
|
std::auto_ptr<VolumeEntry> volume;
|
||||||
|
|
||||||
// Check for block device. if so, verify.
|
// Check for block device. if so, verify.
|
||||||
@ -228,7 +228,7 @@ int main(int argc, char **argv)
|
|||||||
fprintf(stderr, "`%s' is a raw device. Are you sure you want to initialize it? ", fname);
|
fprintf(stderr, "`%s' is a raw device. Are you sure you want to initialize it? ", fname);
|
||||||
if (!yes_or_no()) return -1;
|
if (!yes_or_no()) return -1;
|
||||||
|
|
||||||
device.reset( RawDevice::Open(fname, File::ReadWrite) );
|
device = RawDevice::Open(fname, File::ReadWrite);
|
||||||
blocks = device->blocks();
|
blocks = device->blocks();
|
||||||
rawDevice = true;
|
rawDevice = true;
|
||||||
|
|
||||||
@ -260,7 +260,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!rawDevice)
|
if (!rawDevice)
|
||||||
device.reset( BlockDevice::Create(fname, volumeName.c_str(), blocks, format));
|
device = BlockDevice::Create(fname, volumeName.c_str(), blocks, format);
|
||||||
|
|
||||||
if (!device.get())
|
if (!device.get())
|
||||||
{
|
{
|
||||||
@ -271,7 +271,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if (!bootFile.empty())
|
if (!bootFile.empty())
|
||||||
{
|
{
|
||||||
MappedFile bf(bootFile.c_str(), File::ReadOnly , std::nothrow);
|
MappedFile bf(bootFile.c_str(), File::ReadOnly, std::nothrow);
|
||||||
|
|
||||||
if (!bf.isValid())
|
if (!bf.isValid())
|
||||||
{
|
{
|
||||||
@ -299,9 +299,8 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
|
|
||||||
volume.reset(
|
volume.reset(
|
||||||
new VolumeEntry(volumeName.c_str(), device.get())
|
new VolumeEntry(volumeName.c_str(), device)
|
||||||
);
|
);
|
||||||
device.release();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#define NEWFS_VERSION "0.1"
|
#define NEWFS_VERSION "0.1"
|
||||||
|
|
||||||
using namespace ProFUSE;
|
using namespace ProFUSE;
|
||||||
|
using namespace Device;
|
||||||
|
|
||||||
void usage()
|
void usage()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user