Merge pull request #61 from mhogomchungu/develop

remove compiler warnings
This commit is contained in:
Sebastian Meßmer 2016-06-02 20:21:54 -07:00
commit 3894157589
7 changed files with 29 additions and 5 deletions

View File

@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(cryfs)
include(utils.cmake)
require_gcc_version(4.8)

View File

@ -227,7 +227,7 @@ namespace cryfs {
CryDevice device(std::move(config), std::move(blockStore));
_sanityCheckFilesystem(&device);
fspp::FilesystemImpl fsimpl(&device);
fspp::fuse::Fuse fuse(&fsimpl);
fspp::fuse::Fuse fuse(&fsimpl, "cryfs", "cryfs@"+options.baseDir().native());
_initLogfile(options);

View File

@ -135,6 +135,7 @@ unique_ref<FsBlobRef> CryDevice::LoadBlob(const bf::path &path) {
}
void CryDevice::statfs(const bf::path &path, struct statvfs *fsstat) {
UNUSED(path);
callFsActionCallbacks();
uint64_t numUsedBlocks = _fsBlobStore->numBlocks();
uint64_t numFreeBlocks = _fsBlobStore->estimateSpaceForNumBlocksLeft();

View File

@ -35,6 +35,7 @@ unique_ref<parallelaccessfsblobstore::FileBlobRef> CryFile::LoadBlob() const {
}
unique_ref<fspp::OpenFile> CryFile::open(int flags) const {
UNUSED(flags);
device()->callFsActionCallbacks();
auto blob = LoadBlob();
return make_unique_ref<CryOpenFile>(device(), parent(), std::move(blob));

View File

@ -41,6 +41,7 @@ CryNode::~CryNode() {
}
void CryNode::access(int mask) const {
UNUSED(mask);
device()->callFsActionCallbacks();
//TODO
return;

View File

@ -217,8 +217,8 @@ Fuse::~Fuse() {
_argv.clear();
}
Fuse::Fuse(Filesystem *fs)
:_fs(fs), _mountdir(), _running(false) {
Fuse::Fuse(Filesystem *fs, const std::string &fstype, const boost::optional<std::string> &fsname)
:_fs(fs), _mountdir(), _running(false), _fstype(fstype), _fsname(fsname) {
}
void Fuse::_logException(const std::exception &e) {
@ -235,11 +235,27 @@ void Fuse::run(const bf::path &mountdir, const vector<string> &fuseOptions) {
ASSERT(_argv.size() == 0, "Filesystem already started");
_argv.reserve(2 + fuseOptions.size());
_argv.push_back(_create_c_string("fspp")); // The first argument is the executable name
_argv.push_back(_create_c_string(_fstype)); // The first argument is the file system name
_argv.push_back(_create_c_string(mountdir.native())); // The second argument is the mountdir
for (const string &option : fuseOptions) {
_argv.push_back(_create_c_string(option));
}
if(_fsname != boost::none) {
auto hasNoOption = [&](const char *opt) {
for (const string& it : fuseOptions) {
if (std::strncmp(it.c_str(), opt, std::strlen(opt))) {
return false;
}
}
return true;
};
if (hasNoOption("subtype=") && hasNoOption("fsname=")) {
_argv.push_back(_create_c_string("-o"));
_argv.push_back(_create_c_string("fsname="+*_fsname));
_argv.push_back(_create_c_string("-o"));
_argv.push_back(_create_c_string("subtype="+_fstype));
}
}
fuse_main(_argv.size(), _argv.data(), operations(), (void*)this);
}

View File

@ -8,6 +8,7 @@
#include <vector>
#include <sys/stat.h>
#include <boost/filesystem.hpp>
#include <boost/optional.hpp>
#include <cpp-utils/macros.h>
namespace fspp {
@ -18,7 +19,7 @@ class Filesystem;
class Fuse final {
public:
explicit Fuse(Filesystem *fs);
explicit Fuse(Filesystem *fs, const std::string &fstype, const boost::optional<std::string> &fsname);
~Fuse();
void run(const boost::filesystem::path &mountdir, const std::vector<std::string> &fuseOptions);
@ -65,6 +66,8 @@ private:
boost::filesystem::path _mountdir;
std::vector<char*> _argv;
bool _running;
std::string _fstype;
boost::optional<std::string> _fsname;
DISALLOW_COPY_AND_ASSIGN(Fuse);
};