#pragma once #ifndef CRYFS_LIB_CRYDEVICE_H_ #define CRYFS_LIB_CRYDEVICE_H_ #include #include #include "CryConfig.h" #include #include #include "messmer/cpp-utils/macros.h" namespace cryfs { class DirBlob; namespace bf = boost::filesystem; class CryDevice: public fspp::Device { public: static constexpr uint32_t BLOCKSIZE_BYTES = 4096; CryDevice(std::unique_ptr config, std::unique_ptr blockStore); virtual ~CryDevice(); void statfs(const boost::filesystem::path &path, struct ::statvfs *fsstat) override; std::unique_ptr CreateBlob(); std::unique_ptr LoadBlob(const blockstore::Key &key); private: blockstore::Key GetOrCreateRootKey(CryConfig *config); blockstore::Key CreateRootBlobAndReturnKey(); std::unique_ptr Load(const bf::path &path) override; std::unique_ptr LoadDirBlob(const bf::path &path); std::unique_ptr _blobStore; blockstore::Key _rootKey; DISALLOW_COPY_AND_ASSIGN(CryDevice); }; } #endif