Loading ifs/configure.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,8 @@ #ifndef FS_CONFIGURE_H #define FS_CONFIGURE_H #define ADAFS_MOUNTDIR "/tmp/mountdir" // To enabled logging with info level //#define LOG_INFO #define LOG_DEBUG Loading ifs/include/preload/open_file_map.hpp +1 −2 Original line number Diff line number Diff line Loading @@ -42,8 +42,7 @@ public: class OpenFileMap { private: typedef std::map<int, OpenFile> FileMap; FileMap files_; std::map<int, OpenFile*> files_; std::mutex files_mutex_; Loading ifs/include/preload/preload_util.hpp +2 −1 Original line number Diff line number Diff line Loading @@ -5,11 +5,12 @@ #ifndef IFS_PRELOAD_UTIL_HPP #define IFS_PRELOAD_UTIL_HPP #include "../../configure.hpp" #include <string> using namespace std; static const std::string root_path = "/home/evie/ownCloud/Promotion/gogs_git/ada-fs/ifs/.hidden_playground/rootdir"s; static const std::string mountdir = ADAFS_MOUNTDIR; bool is_fs_path(const char* path); Loading ifs/src/adafs_ops/data.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -6,14 +6,13 @@ using namespace std; static const std::string root_path = "/home/evie/ownCloud/Promotion/gogs_git/ada-fs/ifs/.hidden_playground/rootdir"s; static const std::string mountdir = ADAFS_MOUNTDIR; // TODO better solution std::string path_to_fspath(const std::string& path) { // root path is absolute as is the path comes in here which is hierarchically under root_path // XXX check if this can be done easier string fs_path; set_difference(path.begin(), path.end(), root_path.begin(), root_path.end(), std::back_inserter(fs_path)); set_difference(path.begin(), path.end(), mountdir.begin(), mountdir.end(), std::back_inserter(fs_path)); if (fs_path.at(1) == '/') { fs_path = fs_path.substr(1, fs_path.size()); } Loading ifs/src/preload/open_file_map.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ OpenFile* OpenFileMap::get(int fd) { if (f == files_.end()) { return nullptr; } else { return &f->second; return f->second; } } Loading @@ -66,7 +66,7 @@ bool OpenFileMap::exist(const int fd) { int OpenFileMap::add(const char* path, const bool append) { OpenFile file{path, append}; lock_guard<mutex> lock(files_mutex_); files_.insert(make_pair(file.fd(), file)); files_.insert(make_pair(file.fd(), &file)); return file.fd(); } Loading @@ -76,7 +76,7 @@ bool OpenFileMap::remove(const int fd) { if (f == files_.end()) { return false; } files_.at(fd).annul_fd(); // free file descriptor files_.at(fd)->annul_fd(); // free file descriptor files_.erase(fd); return true; } Loading Loading
ifs/configure.hpp +2 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,8 @@ #ifndef FS_CONFIGURE_H #define FS_CONFIGURE_H #define ADAFS_MOUNTDIR "/tmp/mountdir" // To enabled logging with info level //#define LOG_INFO #define LOG_DEBUG Loading
ifs/include/preload/open_file_map.hpp +1 −2 Original line number Diff line number Diff line Loading @@ -42,8 +42,7 @@ public: class OpenFileMap { private: typedef std::map<int, OpenFile> FileMap; FileMap files_; std::map<int, OpenFile*> files_; std::mutex files_mutex_; Loading
ifs/include/preload/preload_util.hpp +2 −1 Original line number Diff line number Diff line Loading @@ -5,11 +5,12 @@ #ifndef IFS_PRELOAD_UTIL_HPP #define IFS_PRELOAD_UTIL_HPP #include "../../configure.hpp" #include <string> using namespace std; static const std::string root_path = "/home/evie/ownCloud/Promotion/gogs_git/ada-fs/ifs/.hidden_playground/rootdir"s; static const std::string mountdir = ADAFS_MOUNTDIR; bool is_fs_path(const char* path); Loading
ifs/src/adafs_ops/data.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -6,14 +6,13 @@ using namespace std; static const std::string root_path = "/home/evie/ownCloud/Promotion/gogs_git/ada-fs/ifs/.hidden_playground/rootdir"s; static const std::string mountdir = ADAFS_MOUNTDIR; // TODO better solution std::string path_to_fspath(const std::string& path) { // root path is absolute as is the path comes in here which is hierarchically under root_path // XXX check if this can be done easier string fs_path; set_difference(path.begin(), path.end(), root_path.begin(), root_path.end(), std::back_inserter(fs_path)); set_difference(path.begin(), path.end(), mountdir.begin(), mountdir.end(), std::back_inserter(fs_path)); if (fs_path.at(1) == '/') { fs_path = fs_path.substr(1, fs_path.size()); } Loading
ifs/src/preload/open_file_map.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ OpenFile* OpenFileMap::get(int fd) { if (f == files_.end()) { return nullptr; } else { return &f->second; return f->second; } } Loading @@ -66,7 +66,7 @@ bool OpenFileMap::exist(const int fd) { int OpenFileMap::add(const char* path, const bool append) { OpenFile file{path, append}; lock_guard<mutex> lock(files_mutex_); files_.insert(make_pair(file.fd(), file)); files_.insert(make_pair(file.fd(), &file)); return file.fd(); } Loading @@ -76,7 +76,7 @@ bool OpenFileMap::remove(const int fd) { if (f == files_.end()) { return false; } files_.at(fd).annul_fd(); // free file descriptor files_.at(fd)->annul_fd(); // free file descriptor files_.erase(fd); return true; } Loading