From bfd410def2cddb8c9deba1b3d21917b0f26b5c9c Mon Sep 17 00:00:00 2001 From: Antonio SJ Musumeci Date: Sat, 24 Jun 2017 17:03:41 -0400 Subject: [PATCH] use fusepath from fileinfo. closes #417 --- src/fs.cpp | 2 +- src/fs.hpp | 2 +- src/fs_movefile.cpp | 9 --------- src/fs_movefile.hpp | 6 ------ src/fs_path.hpp | 18 ++++++++++++++++++ src/write_buf.cpp | 2 +- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/src/fs.cpp b/src/fs.cpp index 43c5fb91..83dc6b22 100644 --- a/src/fs.cpp +++ b/src/fs.cpp @@ -137,7 +137,7 @@ namespace fs int findonfs(const vector &srcmounts, - const char *fusepath, + const string &fusepath, const int fd, string &basepath) { diff --git a/src/fs.hpp b/src/fs.hpp index 96db9650..b14d6b36 100644 --- a/src/fs.hpp +++ b/src/fs.hpp @@ -49,7 +49,7 @@ namespace fs vector &paths); int findonfs(const vector &srcmounts, - const char *fusepath, + const string &fusepath, const int fd, string &basepath); diff --git a/src/fs_movefile.cpp b/src/fs_movefile.cpp index 6ec330ca..b6174151 100644 --- a/src/fs_movefile.cpp +++ b/src/fs_movefile.cpp @@ -41,15 +41,6 @@ namespace fs const string &fusepath, const size_t additional_size, int &origfd) - { - return fs::movefile(basepaths,fusepath.c_str(),additional_size,origfd); - } - - int - movefile(const vector &basepaths, - const char *fusepath, - const size_t additional_size, - int &origfd) { int rv; int fdin; diff --git a/src/fs_movefile.hpp b/src/fs_movefile.hpp index 381e92db..b4f4c2f3 100644 --- a/src/fs_movefile.hpp +++ b/src/fs_movefile.hpp @@ -27,12 +27,6 @@ namespace fs const std::string &fusepath, const size_t additional_size, int &origfd); - - int - movefile(const std::vector &basepaths, - const char *fusepath, - const size_t additional_size, - int &origfd); } #endif diff --git a/src/fs_path.hpp b/src/fs_path.hpp index 9a79c3be..2878f863 100644 --- a/src/fs_path.hpp +++ b/src/fs_path.hpp @@ -38,6 +38,14 @@ namespace fs base += suffix; } + inline + void + append(string &base, + const string &suffix) + { + base += suffix; + } + inline void make(const string *base, @@ -47,6 +55,16 @@ namespace fs output = *base; output += suffix; } + + inline + void + make(const string *base, + const string &suffix, + string &output) + { + output = *base; + output += suffix; + } } }; diff --git a/src/write_buf.cpp b/src/write_buf.cpp index 8b210c25..91c3e3fc 100644 --- a/src/write_buf.cpp +++ b/src/write_buf.cpp @@ -87,7 +87,7 @@ namespace mergerfs const rwlock::ReadGuard readlock(&config.srcmountslock); extra = fuse_buf_size(src); - rv = fs::movefile(config.srcmounts,fusepath,extra,fi->fd); + rv = fs::movefile(config.srcmounts,fi->fusepath,extra,fi->fd); if(rv == -1) return -ENOSPC;