libcryfs/CryDevice.h

43 lines
1021 B
C
Raw Normal View History

#pragma once
#ifndef CRYFS_LIB_CRYDEVICE_H_
#define CRYFS_LIB_CRYDEVICE_H_
2015-02-17 01:02:15 +01:00
#include <messmer/blockstore/interface/BlockStore.h>
#include "CryConfig.h"
#include <boost/filesystem.hpp>
2015-02-17 01:02:15 +01:00
#include <messmer/fspp/fs_interface/Device.h>
2015-02-17 01:02:15 +01:00
#include "messmer/cpp-utils/macros.h"
namespace cryfs {
namespace bf = boost::filesystem;
2014-11-16 00:05:28 +01:00
class CryDevice: public fspp::Device {
public:
2014-12-09 17:19:59 +01:00
static constexpr size_t DIR_BLOCKSIZE = 4096;
CryDevice(std::unique_ptr<CryConfig> config, std::unique_ptr<blockstore::BlockStore> blockStore);
virtual ~CryDevice();
void statfs(const boost::filesystem::path &path, struct ::statvfs *fsstat) override;
std::unique_ptr<blockstore::Block> CreateBlock(size_t size);
private:
blockstore::Key GetOrCreateRootKey(CryConfig *config);
blockstore::Key CreateRootBlockAndReturnKey();
2014-11-16 00:05:28 +01:00
std::unique_ptr<fspp::Node> Load(const bf::path &path) override;
2014-12-09 17:19:59 +01:00
std::unique_ptr<blockstore::BlockStore> _block_store;
blockstore::Key _root_key;
DISALLOW_COPY_AND_ASSIGN(CryDevice);
};
}
2014-12-07 08:57:23 +01:00
#endif