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() {
|
Key CryDevice::CreateRootBlockAndReturnKey() {
|
||||||
auto rootBlock = _block_store->create(DIR_BLOCKSIZE);
|
auto rootBlock = _block_store->create(DIR_BLOCKSIZE);
|
||||||
DirBlock rootDir(std::move(rootBlock.block));
|
DirBlock rootDir(std::move(rootBlock));
|
||||||
rootDir.InitializeEmptyDir();
|
rootDir.InitializeEmptyDir();
|
||||||
return rootBlock.key;
|
return rootBlock->key();
|
||||||
}
|
}
|
||||||
|
|
||||||
CryDevice::~CryDevice() {
|
CryDevice::~CryDevice() {
|
||||||
@ -74,7 +74,7 @@ void CryDevice::statfs(const bf::path &path, struct statvfs *fsstat) {
|
|||||||
throw FuseErrnoException(ENOTSUP);
|
throw FuseErrnoException(ENOTSUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
blockstore::BlockWithKey CryDevice::CreateBlock(size_t size) {
|
unique_ptr<blockstore::Block> CryDevice::CreateBlock(size_t size) {
|
||||||
return _block_store->create(size);
|
return _block_store->create(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ public:
|
|||||||
|
|
||||||
void statfs(const boost::filesystem::path &path, struct ::statvfs *fsstat) override;
|
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:
|
private:
|
||||||
blockstore::Key GetOrCreateRootKey(CryConfig *config);
|
blockstore::Key GetOrCreateRootKey(CryConfig *config);
|
||||||
|
@ -31,18 +31,18 @@ CryDir::~CryDir() {
|
|||||||
|
|
||||||
unique_ptr<fspp::File> CryDir::createFile(const string &name, mode_t mode) {
|
unique_ptr<fspp::File> CryDir::createFile(const string &name, mode_t mode) {
|
||||||
auto child = _device->CreateBlock(0);
|
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!
|
//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();
|
fileblock->InitializeEmptyFile();
|
||||||
return make_unique<CryFile>(std::move(fileblock));
|
return make_unique<CryFile>(std::move(fileblock));
|
||||||
}
|
}
|
||||||
|
|
||||||
unique_ptr<fspp::Dir> CryDir::createDir(const string &name, mode_t mode) {
|
unique_ptr<fspp::Dir> CryDir::createDir(const string &name, mode_t mode) {
|
||||||
auto child = _device->CreateBlock(CryDevice::DIR_BLOCKSIZE);
|
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!
|
//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();
|
dirblock->InitializeEmptyDir();
|
||||||
return make_unique<CryDir>(_device, std::move(dirblock));
|
return make_unique<CryDir>(_device, std::move(dirblock));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user