mirror of
https://github.com/ksherlock/profuse.git
synced 2026-03-13 08:41:50 +00:00
use shared_ptr for device, cache
git-svn-id: https://profuse.googlecode.com/svn/branches/v2@345 aa027e90-d47c-11dd-86d7-074df07e0730
This commit is contained in:
@@ -23,16 +23,15 @@ using ProFUSE::Exception;
|
||||
using ProFUSE::POSIXException;
|
||||
|
||||
|
||||
BlockCache::BlockCache(BlockDevice *device)
|
||||
BlockCache::BlockCache(BlockDevicePointer device) :
|
||||
_device(device)
|
||||
{
|
||||
_device = device;
|
||||
_blocks = device->blocks();
|
||||
_readOnly = device->readOnly();
|
||||
}
|
||||
|
||||
BlockCache::~BlockCache()
|
||||
{
|
||||
delete _device;
|
||||
}
|
||||
|
||||
void BlockCache::write(unsigned block, const void *bp)
|
||||
@@ -50,9 +49,9 @@ void BlockCache::read(unsigned block, void *bp)
|
||||
}
|
||||
|
||||
|
||||
BlockCache *BlockCache::Create(BlockDevice *device)
|
||||
BlockCachePointer BlockCache::Create(BlockDevicePointer device)
|
||||
{
|
||||
if (!device) return NULL;
|
||||
if (!device.get()) return BlockCachePointer();
|
||||
|
||||
return device->createBlockCache();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user