libcryfs/src/filesystem/CryDevice.h

53 lines
2.0 KiB
C
Raw Normal View History

#pragma once
2015-10-15 13:06:51 +02:00
#ifndef MESSMER_CRYFS_FILESYSTEM_CRYDEVICE_H_
#define MESSMER_CRYFS_FILESYSTEM_CRYDEVICE_H_
2015-02-17 01:02:15 +01:00
#include <messmer/blockstore/interface/BlockStore.h>
#include "../config/CryConfigFile.h"
#include <boost/filesystem.hpp>
2015-02-17 01:02:15 +01:00
#include <messmer/fspp/fs_interface/Device.h>
#include "parallelaccessfsblobstore/ParallelAccessFsBlobStore.h"
#include "parallelaccessfsblobstore/DirBlobRef.h"
#include "parallelaccessfsblobstore/FileBlobRef.h"
#include "parallelaccessfsblobstore/SymlinkBlobRef.h"
namespace cryfs {
2015-10-19 02:46:47 +02:00
class CryDevice final: public fspp::Device {
public:
static constexpr uint32_t BLOCKSIZE_BYTES = 32 * 1024;
2015-03-06 02:06:31 +01:00
2015-10-19 02:46:47 +02:00
CryDevice(CryConfigFile config, cpputils::unique_ref<blockstore::BlockStore> blockStore);
void statfs(const boost::filesystem::path &path, struct ::statvfs *fsstat) override;
cpputils::unique_ref<parallelaccessfsblobstore::FileBlobRef> CreateFileBlob();
cpputils::unique_ref<parallelaccessfsblobstore::DirBlobRef> CreateDirBlob();
cpputils::unique_ref<parallelaccessfsblobstore::SymlinkBlobRef> CreateSymlinkBlob(const boost::filesystem::path &target);
cpputils::unique_ref<parallelaccessfsblobstore::FsBlobRef> LoadBlob(const blockstore::Key &key); //TODO Do I still need this function?
cpputils::unique_ref<parallelaccessfsblobstore::FsBlobRef> LoadBlob(const boost::filesystem::path &path);
cpputils::unique_ref<parallelaccessfsblobstore::DirBlobRef> LoadDirBlob(const boost::filesystem::path &path);
void RemoveBlob(const blockstore::Key &key);
boost::optional<cpputils::unique_ref<fspp::Node>> Load(const boost::filesystem::path &path) override;
2015-04-11 01:42:20 +02:00
private:
cpputils::unique_ref<parallelaccessfsblobstore::ParallelAccessFsBlobStore> _fsBlobStore;
blockstore::Key _rootKey;
2015-10-19 02:46:47 +02:00
blockstore::Key GetOrCreateRootKey(CryConfigFile *config);
blockstore::Key CreateRootBlobAndReturnKey();
static cpputils::unique_ref<blockstore::BlockStore> CreateEncryptedBlockStore(const CryConfig &config, cpputils::unique_ref<blockstore::BlockStore> baseBlockStore);
DISALLOW_COPY_AND_ASSIGN(CryDevice);
};
}
2014-12-07 08:57:23 +01:00
#endif