Make blocksize configurable
This commit is contained in:
parent
4dbb380263
commit
d7f34c0dfb
@ -45,8 +45,6 @@ namespace bf = boost::filesystem;
|
||||
|
||||
namespace cryfs {
|
||||
|
||||
constexpr uint32_t CryDevice::BLOCKSIZE_BYTES;
|
||||
|
||||
CryDevice::CryDevice(CryConfigFile configFile, unique_ref<BlockStore> blockStore)
|
||||
: _fsBlobStore(
|
||||
make_unique_ref<ParallelAccessFsBlobStore>(
|
||||
@ -55,7 +53,7 @@ CryDevice::CryDevice(CryConfigFile configFile, unique_ref<BlockStore> blockStore
|
||||
make_unique_ref<BlobStoreOnBlocks>(
|
||||
make_unique_ref<CachingBlockStore>(
|
||||
CreateEncryptedBlockStore(*configFile.config(), std::move(blockStore))
|
||||
), BLOCKSIZE_BYTES)))
|
||||
), configFile.config()->BlocksizeBytes())))
|
||||
)
|
||||
),
|
||||
_rootKey(GetOrCreateRootKey(&configFile)),
|
||||
@ -140,7 +138,7 @@ void CryDevice::statfs(const bf::path &path, struct statvfs *fsstat) {
|
||||
callFsActionCallbacks();
|
||||
uint64_t numUsedBlocks = _fsBlobStore->numBlocks();
|
||||
uint64_t numFreeBlocks = _fsBlobStore->estimateSpaceForNumBlocksLeft();
|
||||
fsstat->f_bsize = BLOCKSIZE_BYTES;
|
||||
fsstat->f_bsize = _fsBlobStore->blocksizeBytes();
|
||||
fsstat->f_blocks = numUsedBlocks + numFreeBlocks;
|
||||
fsstat->f_bfree = numFreeBlocks;
|
||||
fsstat->f_bavail = numFreeBlocks;
|
||||
|
@ -37,8 +37,6 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
static constexpr uint32_t BLOCKSIZE_BYTES = 32 * 1024;
|
||||
|
||||
cpputils::unique_ref<parallelaccessfsblobstore::ParallelAccessFsBlobStore> _fsBlobStore;
|
||||
|
||||
blockstore::Key _rootKey;
|
||||
|
@ -24,6 +24,7 @@ namespace cryfs {
|
||||
cpputils::unique_ref<SymlinkBlobRef> createSymlinkBlob(const boost::filesystem::path &target);
|
||||
boost::optional<cpputils::unique_ref<FsBlobRef>> load(const blockstore::Key &key);
|
||||
void remove(cpputils::unique_ref<FsBlobRef> blob);
|
||||
uint64_t blocksizeBytes() const;
|
||||
uint64_t numBlocks() const;
|
||||
uint64_t estimateSpaceForNumBlocksLeft() const;
|
||||
|
||||
@ -80,6 +81,10 @@ namespace cryfs {
|
||||
_cache.push(key, std::move(baseBlob));
|
||||
}
|
||||
|
||||
inline uint64_t CachingFsBlobStore::blocksizeBytes() const {
|
||||
return _baseBlobStore->blocksizeBytes();
|
||||
}
|
||||
|
||||
inline uint64_t CachingFsBlobStore::numBlocks() const {
|
||||
return _baseBlobStore->numBlocks();
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ namespace cryfs {
|
||||
cpputils::unique_ref<SymlinkBlobRef> createSymlinkBlob(const boost::filesystem::path &target);
|
||||
boost::optional<cpputils::unique_ref<FsBlobRef>> load(const blockstore::Key &key);
|
||||
void remove(cpputils::unique_ref<FsBlobRef> blob);
|
||||
uint64_t blocksizeBytes() const;
|
||||
uint64_t numBlocks() const;
|
||||
uint64_t estimateSpaceForNumBlocksLeft() const;
|
||||
|
||||
@ -57,6 +58,10 @@ namespace cryfs {
|
||||
};
|
||||
}
|
||||
|
||||
inline uint64_t ParallelAccessFsBlobStore::blocksizeBytes() const {
|
||||
return _baseBlobStore->blocksizeBytes();
|
||||
}
|
||||
|
||||
inline uint64_t ParallelAccessFsBlobStore::numBlocks() const {
|
||||
return _baseBlobStore->numBlocks();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user