diff --git a/src/cryfs/filesystem/CryDevice.cpp b/src/cryfs/filesystem/CryDevice.cpp index 4b7b53c5..3fead795 100644 --- a/src/cryfs/filesystem/CryDevice.cpp +++ b/src/cryfs/filesystem/CryDevice.cpp @@ -45,8 +45,6 @@ namespace bf = boost::filesystem; namespace cryfs { -constexpr uint32_t CryDevice::BLOCKSIZE_BYTES; - CryDevice::CryDevice(CryConfigFile configFile, unique_ref blockStore) : _fsBlobStore( make_unique_ref( @@ -55,7 +53,7 @@ CryDevice::CryDevice(CryConfigFile configFile, unique_ref blockStore make_unique_ref( make_unique_ref( 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; diff --git a/src/cryfs/filesystem/CryDevice.h b/src/cryfs/filesystem/CryDevice.h index c448ef21..ed2b22a5 100644 --- a/src/cryfs/filesystem/CryDevice.h +++ b/src/cryfs/filesystem/CryDevice.h @@ -37,8 +37,6 @@ public: private: - static constexpr uint32_t BLOCKSIZE_BYTES = 32 * 1024; - cpputils::unique_ref _fsBlobStore; blockstore::Key _rootKey; diff --git a/src/cryfs/filesystem/cachingfsblobstore/CachingFsBlobStore.h b/src/cryfs/filesystem/cachingfsblobstore/CachingFsBlobStore.h index ba7f6344..6915b03f 100644 --- a/src/cryfs/filesystem/cachingfsblobstore/CachingFsBlobStore.h +++ b/src/cryfs/filesystem/cachingfsblobstore/CachingFsBlobStore.h @@ -24,6 +24,7 @@ namespace cryfs { cpputils::unique_ref createSymlinkBlob(const boost::filesystem::path &target); boost::optional> load(const blockstore::Key &key); void remove(cpputils::unique_ref 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(); } diff --git a/src/cryfs/filesystem/parallelaccessfsblobstore/ParallelAccessFsBlobStore.h b/src/cryfs/filesystem/parallelaccessfsblobstore/ParallelAccessFsBlobStore.h index 384eb2d3..cca1b3e4 100644 --- a/src/cryfs/filesystem/parallelaccessfsblobstore/ParallelAccessFsBlobStore.h +++ b/src/cryfs/filesystem/parallelaccessfsblobstore/ParallelAccessFsBlobStore.h @@ -26,6 +26,7 @@ namespace cryfs { cpputils::unique_ref createSymlinkBlob(const boost::filesystem::path &target); boost::optional> load(const blockstore::Key &key); void remove(cpputils::unique_ref 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(); }