Since blocks now store their keys, we don't need to store it somewhere else.
This commit is contained in:
parent
961fdd1d0b
commit
273035cf08
@ -38,9 +38,9 @@ Key CryDevice::GetOrCreateRootKey(CryConfig *config) {
|
||||
|
||||
Key CryDevice::CreateRootBlockAndReturnKey() {
|
||||
auto rootBlock = _block_store->create(DIR_BLOCKSIZE);
|
||||
DirBlock rootDir(std::move(rootBlock.block));
|
||||
DirBlock rootDir(std::move(rootBlock));
|
||||
rootDir.InitializeEmptyDir();
|
||||
return rootBlock.key;
|
||||
return rootBlock->key();
|
||||
}
|
||||
|
||||
CryDevice::~CryDevice() {
|
||||
@ -74,7 +74,7 @@ void CryDevice::statfs(const bf::path &path, struct statvfs *fsstat) {
|
||||
throw FuseErrnoException(ENOTSUP);
|
||||
}
|
||||
|
||||
blockstore::BlockWithKey CryDevice::CreateBlock(size_t size) {
|
||||
unique_ptr<blockstore::Block> CryDevice::CreateBlock(size_t size) {
|
||||
return _block_store->create(size);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
|
||||
void statfs(const boost::filesystem::path &path, struct ::statvfs *fsstat) override;
|
||||
|
||||
blockstore::BlockWithKey CreateBlock(size_t size);
|
||||
std::unique_ptr<blockstore::Block> CreateBlock(size_t size);
|
||||
|
||||
private:
|
||||
blockstore::Key GetOrCreateRootKey(CryConfig *config);
|
||||
|
@ -31,18 +31,18 @@ CryDir::~CryDir() {
|
||||
|
||||
unique_ptr<fspp::File> CryDir::createFile(const string &name, mode_t mode) {
|
||||
auto child = _device->CreateBlock(0);
|
||||
_block->AddChild(name, child.key);
|
||||
_block->AddChild(name, child->key());
|
||||
//TODO Di we need a return value in createDir for fspp? If not, change fspp!
|
||||
auto fileblock = make_unique<FileBlock>(std::move(child.block));
|
||||
auto fileblock = make_unique<FileBlock>(std::move(child));
|
||||
fileblock->InitializeEmptyFile();
|
||||
return make_unique<CryFile>(std::move(fileblock));
|
||||
}
|
||||
|
||||
unique_ptr<fspp::Dir> CryDir::createDir(const string &name, mode_t mode) {
|
||||
auto child = _device->CreateBlock(CryDevice::DIR_BLOCKSIZE);
|
||||
_block->AddChild(name, child.key);
|
||||
_block->AddChild(name, child->key());
|
||||
//TODO I don't think we need a return value in createDir for fspp. Change fspp!
|
||||
auto dirblock = make_unique<DirBlock>(std::move(child.block));
|
||||
auto dirblock = make_unique<DirBlock>(std::move(child));
|
||||
dirblock->InitializeEmptyDir();
|
||||
return make_unique<CryDir>(_device, std::move(dirblock));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user