diff --git a/src/fh.hpp b/src/fh.hpp index 4187b7f5..707bf891 100644 --- a/src/fh.hpp +++ b/src/fh.hpp @@ -16,6 +16,8 @@ #pragma once +#include "fs_path.hpp" + #include @@ -27,6 +29,16 @@ public: { } + FH(const gfs::path &fusepath_) + : fusepath(fusepath_) + { + } + + FH(const std::string &fusepath_) + : fusepath(fusepath_) + { + } + public: - std::string fusepath; + gfs::path fusepath; }; diff --git a/src/fileinfo.hpp b/src/fileinfo.hpp index 4d4948e4..347f7020 100644 --- a/src/fileinfo.hpp +++ b/src/fileinfo.hpp @@ -18,8 +18,6 @@ #include "fh.hpp" -#include - class FileInfo : public FH { @@ -31,6 +29,20 @@ public: { } + FileInfo(const int fd_, + const std::string &fusepath_) + : FH(fusepath_), + fd(fd_) + { + } + + FileInfo(const int fd_, + const gfs::path &fusepath_) + : FH(fusepath_), + fd(fd_) + { + } + public: int fd; }; diff --git a/src/fuse_chmod_func_all.cpp b/src/fuse_chmod_func_all.cpp index 5f1296e6..d38936b9 100644 --- a/src/fuse_chmod_func_all.cpp +++ b/src/fuse_chmod_func_all.cpp @@ -33,7 +33,6 @@ FUSE::CHMOD::FuncALL::operator()(const gfs::path &fusepath_, const mode_t mode_) { Err rv; - gfs::path fusepath; gfs::path fullpath; for(const auto &branch_group : _branches) diff --git a/src/fuse_create.cpp b/src/fuse_create.cpp index 628e7b98..ce9d71d2 100644 --- a/src/fuse_create.cpp +++ b/src/fuse_create.cpp @@ -199,12 +199,13 @@ namespace FUSE::CREATE fuse_file_info_t *ffi_) { State s; + gfs::path fusepath(fusepath_); const fuse_context *fc = fuse_get_context(); const ugid::Set ugid(fc->uid,fc->gid); if(s->writeback_cache) l::tweak_flags_writeback_cache(&ffi_->flags); - return s->create(fusepath_,mode_,fc->umask,ffi_); + return s->create(fusepath,mode_,fc->umask,ffi_); } } diff --git a/src/fuse_create_func.cpp b/src/fuse_create_func.cpp index 840cd2b2..18d51975 100644 --- a/src/fuse_create_func.cpp +++ b/src/fuse_create_func.cpp @@ -28,7 +28,7 @@ FUSE::CREATE::Func::Func(const toml::value &toml_) } int -FUSE::CREATE::Func::operator()(const char *fusepath_, +FUSE::CREATE::Func::operator()(const gfs::path &fusepath_, const mode_t mode_, const mode_t umask_, fuse_file_info_t *ffi_) diff --git a/src/fuse_create_func.hpp b/src/fuse_create_func.hpp index 6871efc1..7a70403d 100644 --- a/src/fuse_create_func.hpp +++ b/src/fuse_create_func.hpp @@ -31,7 +31,7 @@ namespace FUSE::CREATE Func(const toml::value &); public: - int operator()(const char *fusepath, + int operator()(const gfs::path &fusepath, const mode_t mode, const mode_t umask, fuse_file_info_t *ffi); diff --git a/src/fuse_create_func_base.hpp b/src/fuse_create_func_base.hpp index fcce1e56..624a0d2a 100644 --- a/src/fuse_create_func_base.hpp +++ b/src/fuse_create_func_base.hpp @@ -18,6 +18,8 @@ #pragma once +#include "fs_path.hpp" + #include "fuse.h" #include @@ -31,7 +33,7 @@ namespace FUSE::CREATE typedef std::shared_ptr Ptr; public: - virtual int operator()(const char *fusepath, + virtual int operator()(const gfs::path &fusepath, const mode_t mode, const mode_t umask, fuse_file_info_t *ffi) = 0; diff --git a/src/fuse_create_func_epff.cpp b/src/fuse_create_func_epff.cpp index 33e16f39..186878a0 100644 --- a/src/fuse_create_func_epff.cpp +++ b/src/fuse_create_func_epff.cpp @@ -23,9 +23,6 @@ #include "fs_open.hpp" -namespace gfs = ghc::filesystem; - - FUSE::CREATE::FuncEPFF::FuncEPFF(const toml::value &toml_) : _branches(toml_) { @@ -33,23 +30,21 @@ FUSE::CREATE::FuncEPFF::FuncEPFF(const toml::value &toml_) } int -FUSE::CREATE::FuncEPFF::operator()(const char *fusepath_, +FUSE::CREATE::FuncEPFF::operator()(const gfs::path &fusepath_, const mode_t mode_, const mode_t umask_, fuse_file_info_t *ffi_) { int rv; mode_t mode; - gfs::path fusepath; gfs::path fullpath; mode = mode_; - fusepath = &fusepath_[1]; for(const auto &branch_group : _branches) { for(const auto &branch : branch_group) { - fullpath = branch.path / fusepath; + fullpath = branch.path / fusepath_; rv = fs::acl::dir_has_defaults(fullpath); if(rv == -ENOENT) diff --git a/src/fuse_create_func_epff.hpp b/src/fuse_create_func_epff.hpp index b3049763..628cdb50 100644 --- a/src/fuse_create_func_epff.hpp +++ b/src/fuse_create_func_epff.hpp @@ -22,6 +22,8 @@ #include "branches.hpp" +#include "fs_path.hpp" + namespace FUSE::CREATE { @@ -31,7 +33,7 @@ namespace FUSE::CREATE FuncEPFF(const toml::value&); public: - int operator()(const char *fusepath, + int operator()(const gfs::path &fusepath, const mode_t mode, const mode_t umask, fuse_file_info_t *ffi) final; diff --git a/src/fuse_create_func_ff.cpp b/src/fuse_create_func_ff.cpp index 3d4c98f1..1606f410 100644 --- a/src/fuse_create_func_ff.cpp +++ b/src/fuse_create_func_ff.cpp @@ -36,28 +36,26 @@ FUSE::CREATE::FuncFF::FuncFF(const toml::value &toml_) } int -FUSE::CREATE::FuncFF::operator()(const char *fusepath_, +FUSE::CREATE::FuncFF::operator()(const gfs::path &fusepath_, const mode_t mode_, const mode_t umask_, fuse_file_info_t *ffi_) { int rv; mode_t mode; - gfs::path fusepath; gfs::path fullpath; mode = mode_; - fusepath = &fusepath_[1]; for(const auto &branch_group : _branches) { for(const auto &branch : branch_group) { - fullpath = branch.path / fusepath; + fullpath = branch.path / fusepath_; rv = fs::acl::dir_has_defaults(fullpath); if(rv == -ENOENT) { - rv = fs::clonepath_as_root(_branches,branch.path,fusepath); + rv = fs::clonepath_as_root(_branches,branch.path,fusepath_); if(rv >= 0) rv = fs::acl::dir_has_defaults(fullpath); } @@ -68,7 +66,7 @@ FUSE::CREATE::FuncFF::operator()(const char *fusepath_, rv = fs::open(fullpath,ffi_->flags,mode); if(rv == -ENOENT) { - rv = fs::clonepath_as_root(_branches,branch.path,fusepath); + rv = fs::clonepath_as_root(_branches,branch.path,fusepath_); if(rv >= 0) { rv = fs::acl::dir_has_defaults(fullpath); diff --git a/src/fuse_create_func_ff.hpp b/src/fuse_create_func_ff.hpp index a959d34a..c8f780f9 100644 --- a/src/fuse_create_func_ff.hpp +++ b/src/fuse_create_func_ff.hpp @@ -31,7 +31,7 @@ namespace FUSE::CREATE FuncFF(const toml::value&); public: - int operator()(const char *fusepath, + int operator()(const gfs::path &fusepath, const mode_t mode, const mode_t umask, fuse_file_info_t *ffi) final; diff --git a/src/fuse_getattr.cpp b/src/fuse_getattr.cpp index 93dc3051..d9781309 100644 --- a/src/fuse_getattr.cpp +++ b/src/fuse_getattr.cpp @@ -30,12 +30,13 @@ namespace FUSE::GETATTR struct stat *st_, fuse_timeouts_t *timeout_) { - State s; int rv; + State s; + gfs::path fusepath(fusepath_); const fuse_context *fc = fuse_get_context(); const ugid::Set ugid(fc->uid,fc->gid); - rv = s->getattr(fusepath_,st_,timeout_); + rv = s->getattr(fusepath,st_,timeout_); if(rv < 0) return rv; diff --git a/src/fuse_getattr_func.cpp b/src/fuse_getattr_func.cpp index 3180c51e..707e14c0 100644 --- a/src/fuse_getattr_func.cpp +++ b/src/fuse_getattr_func.cpp @@ -34,7 +34,7 @@ FUSE::GETATTR::Func::operator=(const toml::value &toml_) } int -FUSE::GETATTR::Func::operator()(const char *fusepath_, +FUSE::GETATTR::Func::operator()(const gfs::path &fusepath_, struct stat *st_, fuse_timeouts_t *timeout_) { diff --git a/src/fuse_getattr_func.hpp b/src/fuse_getattr_func.hpp index 9e67c934..99f78770 100644 --- a/src/fuse_getattr_func.hpp +++ b/src/fuse_getattr_func.hpp @@ -35,7 +35,7 @@ namespace FUSE::GETATTR Func(const toml::value &); public: - int operator()(const char *fusepath, + int operator()(const gfs::path &fusepath, struct stat *st, fuse_timeouts_t *timeout); diff --git a/src/fuse_getattr_func_aggregate.cpp b/src/fuse_getattr_func_aggregate.cpp index f27e1dcd..a880ac2f 100644 --- a/src/fuse_getattr_func_aggregate.cpp +++ b/src/fuse_getattr_func_aggregate.cpp @@ -35,7 +35,7 @@ FUSE::GETATTR::FuncAggregate::FuncAggregate(const toml::value &toml_) } int -FUSE::GETATTR::FuncAggregate::operator()(const char *fusepath_, +FUSE::GETATTR::FuncAggregate::operator()(const gfs::path &fusepath_, struct stat *st_, fuse_timeouts_t *timeout_) { @@ -48,8 +48,7 @@ FUSE::GETATTR::FuncAggregate::operator()(const char *fusepath_, { for(const auto &branch : branch_group) { - fullpath = branch.path; - fullpath /= &fusepath_[1]; + fullpath = branch.path / fusepath_; rv = _statfunc(fullpath,&st); if(rv != 0) diff --git a/src/fuse_getattr_func_aggregate.hpp b/src/fuse_getattr_func_aggregate.hpp index ab07d1f7..4f0e395c 100644 --- a/src/fuse_getattr_func_aggregate.hpp +++ b/src/fuse_getattr_func_aggregate.hpp @@ -33,7 +33,7 @@ namespace FUSE::GETATTR FuncAggregate(const toml::value&); public: - int operator()(const char *fusepath, + int operator()(const gfs::path &fusepath, struct stat *st, fuse_timeouts_t *timeout) final; diff --git a/src/fuse_getattr_func_base.hpp b/src/fuse_getattr_func_base.hpp index 333efe2d..a6f4c6f4 100644 --- a/src/fuse_getattr_func_base.hpp +++ b/src/fuse_getattr_func_base.hpp @@ -18,7 +18,7 @@ #pragma once -#include "from_toml.hpp" +#include "fs_path.hpp" #include "fuse_timeouts.h" @@ -34,7 +34,7 @@ namespace FUSE::GETATTR typedef std::shared_ptr Ptr; public: - virtual int operator()(const char *fusepath, + virtual int operator()(const gfs::path &fusepath, struct stat *st, fuse_timeouts_t *timeout) = 0; }; diff --git a/src/fuse_getattr_func_check_ff.cpp b/src/fuse_getattr_func_check_ff.cpp index c6af6f5a..afd5cf81 100644 --- a/src/fuse_getattr_func_check_ff.cpp +++ b/src/fuse_getattr_func_check_ff.cpp @@ -51,7 +51,7 @@ FUSE::GETATTR::FuncCheckFF::FuncCheckFF(const toml::value &toml_) } int -FUSE::GETATTR::FuncCheckFF::operator()(const char *fusepath_, +FUSE::GETATTR::FuncCheckFF::operator()(const gfs::path &fusepath_, struct stat *st_, fuse_timeouts_t *timeout_) { @@ -65,8 +65,7 @@ FUSE::GETATTR::FuncCheckFF::operator()(const char *fusepath_, { for(j = 0, ej = _branches[i].size(); j < ej; j++) { - fullpath = _branches[i][j].path; - fullpath /= &fusepath_[1]; + fullpath = _branches[i][j].path / fusepath_; rv = _statfunc(fullpath,&st); if(rv != 0) @@ -83,8 +82,7 @@ FUSE::GETATTR::FuncCheckFF::operator()(const char *fusepath_, { for(; j < ej; j++) { - fullpath = _branches[i][j].path; - fullpath /= &fusepath_[1]; + fullpath = _branches[i][j].path / fusepath_; rv = _statfunc(fullpath,&st); if(rv != 0) diff --git a/src/fuse_getattr_func_check_ff.hpp b/src/fuse_getattr_func_check_ff.hpp index 084734fe..21a27664 100644 --- a/src/fuse_getattr_func_check_ff.hpp +++ b/src/fuse_getattr_func_check_ff.hpp @@ -33,7 +33,7 @@ namespace FUSE::GETATTR FuncCheckFF(const toml::value&); public: - int operator()(const char *fusepath, + int operator()(const gfs::path &fusepath, struct stat *st, fuse_timeouts_t *timeout) final; diff --git a/src/fuse_getattr_func_ff.cpp b/src/fuse_getattr_func_ff.cpp index e53c33db..03f67fef 100644 --- a/src/fuse_getattr_func_ff.cpp +++ b/src/fuse_getattr_func_ff.cpp @@ -31,20 +31,18 @@ FUSE::GETATTR::FuncFF::FuncFF(const toml::value &toml_) } int -FUSE::GETATTR::FuncFF::operator()(const char *fusepath_, +FUSE::GETATTR::FuncFF::operator()(const gfs::path &fusepath_, struct stat *st_, fuse_timeouts_t *timeout_) { int rv; - gfs::path fusepath; gfs::path fullpath; - fusepath = &fusepath_[1]; for(const auto &branch_group : _branches) { for(const auto &branch : branch_group) { - fullpath = branch.path / fusepath; + fullpath = branch.path / fusepath_; rv = _statfunc(fullpath,st_); if(rv == -ENOENT) diff --git a/src/fuse_getattr_func_ff.hpp b/src/fuse_getattr_func_ff.hpp index 0c171a1d..ec4abcd7 100644 --- a/src/fuse_getattr_func_ff.hpp +++ b/src/fuse_getattr_func_ff.hpp @@ -33,7 +33,7 @@ namespace FUSE::GETATTR FuncFF(const toml::value&); public: - int operator()(const char *fusepath, + int operator()(const gfs::path &fusepath, struct stat *st, fuse_timeouts_t *timeout) final; diff --git a/src/fuse_getattr_func_newest.cpp b/src/fuse_getattr_func_newest.cpp index 7bc59cd8..311c6520 100644 --- a/src/fuse_getattr_func_newest.cpp +++ b/src/fuse_getattr_func_newest.cpp @@ -33,7 +33,7 @@ FUSE::GETATTR::FuncNewest::FuncNewest(const toml::value &toml_) } int -FUSE::GETATTR::FuncNewest::operator()(const char *fusepath_, +FUSE::GETATTR::FuncNewest::operator()(const gfs::path &fusepath_, struct stat *st_, fuse_timeouts_t *timeout_) { @@ -46,8 +46,7 @@ FUSE::GETATTR::FuncNewest::operator()(const char *fusepath_, { for(const auto &branch : branch_group) { - fullpath = branch.path; - fullpath /= &fusepath_[1]; + fullpath = branch.path / fusepath_; rv = _statfunc(fullpath,&st); if(rv != 0) diff --git a/src/fuse_getattr_func_newest.hpp b/src/fuse_getattr_func_newest.hpp index 30ceac2b..ea029b5a 100644 --- a/src/fuse_getattr_func_newest.hpp +++ b/src/fuse_getattr_func_newest.hpp @@ -33,7 +33,7 @@ namespace FUSE::GETATTR FuncNewest(const toml::value&); public: - int operator()(const char *fusepath, + int operator()(const gfs::path &fusepath, struct stat *st, fuse_timeouts_t *timeout) final; diff --git a/src/fuse_getxattr.cpp b/src/fuse_getxattr.cpp index 8d2059bf..6b1b2a04 100644 --- a/src/fuse_getxattr.cpp +++ b/src/fuse_getxattr.cpp @@ -194,13 +194,15 @@ namespace FUSE::GETXATTR size_t count_) { State s; + gfs::path fusepath; + fusepath = &fusepath_[1]; if((s->security_capability == false) && l::is_attrname_security_capability(attrname_)) return -ENOATTR; const fuse_context *fc = fuse_get_context(); const ugid::Set ugid(fc->uid,fc->gid); - return s->getxattr(fusepath_,attrname_,buf_,count_); + return s->getxattr(fusepath,attrname_,buf_,count_); } } diff --git a/src/fuse_getxattr_func.cpp b/src/fuse_getxattr_func.cpp index eee435e3..26ac876b 100644 --- a/src/fuse_getxattr_func.cpp +++ b/src/fuse_getxattr_func.cpp @@ -27,17 +27,11 @@ FUSE::GETXATTR::Func::Func(const toml::value &toml_) _getxattr = FuncFactory(toml_); } -void -FUSE::GETXATTR::Func::operator=(const toml::value &toml_) -{ - _getxattr = FuncFactory(toml_); -} - int -FUSE::GETXATTR::Func::operator()(const char *fusepath_, - const char *attrname_, - char *buf_, - size_t count_) +FUSE::GETXATTR::Func::operator()(const gfs::path &fusepath_, + const char *attrname_, + char *buf_, + size_t count_) { return (*_getxattr)(fusepath_,attrname_,buf_,count_); } diff --git a/src/fuse_getxattr_func.hpp b/src/fuse_getxattr_func.hpp index a45db862..fad00fb4 100644 --- a/src/fuse_getxattr_func.hpp +++ b/src/fuse_getxattr_func.hpp @@ -18,11 +18,12 @@ #pragma once -#include "from_toml.hpp" #include "fuse_getxattr_func_base.hpp" #include "fuse_timeouts.h" +#include "toml.hpp" + #include #include @@ -35,12 +36,10 @@ namespace FUSE::GETXATTR Func(const toml::value &); public: - int operator()(const char *fusepath, - const char *attrname, - char *buf, - size_t count); - - void operator=(const toml::value&); + int operator()(const gfs::path &fusepath, + const char *attrname, + char *buf, + size_t count); private: FuncBase::Ptr _getxattr; diff --git a/src/fuse_getxattr_func_base.hpp b/src/fuse_getxattr_func_base.hpp index e552e270..cf94f41c 100644 --- a/src/fuse_getxattr_func_base.hpp +++ b/src/fuse_getxattr_func_base.hpp @@ -18,7 +18,7 @@ #pragma once -#include "from_toml.hpp" +#include "fs_path.hpp" #include @@ -32,9 +32,9 @@ namespace FUSE::GETXATTR typedef std::shared_ptr Ptr; public: - virtual int operator()(const char *fusepath, - const char *attrname, - char *buf, - size_t count) = 0; + virtual int operator()(const gfs::path &fusepath, + const char *attrname, + char *buf, + size_t count) = 0; }; } diff --git a/src/fuse_getxattr_func_ff.cpp b/src/fuse_getxattr_func_ff.cpp index 80db25a8..6d9de780 100644 --- a/src/fuse_getxattr_func_ff.cpp +++ b/src/fuse_getxattr_func_ff.cpp @@ -31,21 +31,19 @@ FUSE::GETXATTR::FuncFF::FuncFF(const toml::value &toml_) } int -FUSE::GETXATTR::FuncFF::operator()(const char *fusepath_, - const char *attrname_, - char *buf_, - size_t count_) +FUSE::GETXATTR::FuncFF::operator()(const gfs::path &fusepath_, + const char *attrname_, + char *buf_, + size_t count_) { int rv; - gfs::path fusepath; gfs::path fullpath; - fusepath = &fusepath_[1]; for(const auto &branch_group : _branches) { for(const auto &branch : branch_group) { - fullpath = branch.path / fusepath; + fullpath = branch.path / fusepath_; rv = fs::lgetxattr(fullpath,attrname_,buf_,count_); if(rv == -ENOENT) diff --git a/src/fuse_getxattr_func_ff.hpp b/src/fuse_getxattr_func_ff.hpp index dbc8c76d..1ae03be0 100644 --- a/src/fuse_getxattr_func_ff.hpp +++ b/src/fuse_getxattr_func_ff.hpp @@ -33,10 +33,10 @@ namespace FUSE::GETXATTR FuncFF(const toml::value&); public: - int operator()(const char *fusepath, - const char *attrname, - char *buf, - size_t count) final; + int operator()(const gfs::path &fusepath, + const char *attrname, + char *buf, + size_t count) final; private: Branches2 _branches; diff --git a/src/fuse_ioctl.cpp b/src/fuse_ioctl.cpp index c249ed50..a395ea3a 100644 --- a/src/fuse_ioctl.cpp +++ b/src/fuse_ioctl.cpp @@ -217,7 +217,7 @@ namespace l void *data_) { Config::Read cfg; - std::string &fusepath = reinterpret_cast(ffi_->fh)->fusepath; + gfs::path &fusepath = reinterpret_cast(ffi_->fh)->fusepath; return l::file_basepath(cfg->func.open.policy, cfg->branches, @@ -230,7 +230,7 @@ namespace l file_relpath(const fuse_file_info_t *ffi_, void *data_) { - std::string &fusepath = reinterpret_cast(ffi_->fh)->fusepath; + gfs::path &fusepath = reinterpret_cast(ffi_->fh)->fusepath; return l::strcpy(fusepath,data_); } @@ -261,7 +261,7 @@ namespace l void *data_) { Config::Read cfg; - std::string &fusepath = reinterpret_cast(ffi_->fh)->fusepath; + gfs::path &fusepath = reinterpret_cast(ffi_->fh)->fusepath; return l::file_fullpath(cfg->func.open.policy, cfg->branches, @@ -278,7 +278,7 @@ namespace l string concated; StrVec paths; StrVec branches; - string &fusepath = reinterpret_cast(ffi_->fh)->fusepath; + gfs::path &fusepath = reinterpret_cast(ffi_->fh)->fusepath; cfg->branches->to_paths(branches); diff --git a/src/fuse_link.cpp b/src/fuse_link.cpp index d87afaf1..a3d39473 100644 --- a/src/fuse_link.cpp +++ b/src/fuse_link.cpp @@ -22,16 +22,12 @@ #include "fs_path.hpp" #include "fuse_getattr.hpp" #include "fuse_symlink.hpp" -#include "ghc/filesystem.hpp" #include "state.hpp" #include "ugid.hpp" #include "fuse.h" -namespace gfs = ghc::filesystem; - - namespace l { static @@ -151,13 +147,17 @@ namespace FUSE::LINK { int rv; State s; + gfs::path oldpath; + gfs::path newpath; const fuse_context *fc = fuse_get_context(); const ugid::Set ugid(fc->uid,fc->gid); - rv = s->link(oldpath_,newpath_); + oldpath = &oldpath_[1]; + newpath = &newpath_[1]; + rv = s->link(oldpath,newpath); if(rv == -EXDEV) return l::link_exdev(s,oldpath_,newpath_,st_,timeouts_); - return s->getattr(newpath_,st_,timeouts_); + return s->getattr(newpath,st_,timeouts_); } } diff --git a/src/fuse_link_func.hpp b/src/fuse_link_func.hpp index c37a57c1..115f73d8 100644 --- a/src/fuse_link_func.hpp +++ b/src/fuse_link_func.hpp @@ -34,8 +34,8 @@ namespace FUSE::LINK public: int - operator()(const char *oldpath_, - const char *newpath_) + operator()(const gfs::path &oldpath_, + const gfs::path &newpath_) { return (*_link)(oldpath_,newpath_); } diff --git a/src/fuse_link_func_all.cpp b/src/fuse_link_func_all.cpp index dc07fa3f..49eeef94 100644 --- a/src/fuse_link_func_all.cpp +++ b/src/fuse_link_func_all.cpp @@ -34,24 +34,20 @@ FUSE::LINK::FuncALL::FuncALL(const toml::value &toml_) } int -FUSE::LINK::FuncALL::operator()(const char *oldpath_, - const char *newpath_) +FUSE::LINK::FuncALL::operator()(const gfs::path &oldpath_, + const gfs::path &newpath_) { int rv; Err err; - gfs::path oldpath; - gfs::path newpath; gfs::path fulloldpath; gfs::path fullnewpath; - oldpath = &oldpath_[1]; - newpath = &newpath_[1]; for(const auto &branch_group : _branches) { for(const auto &branch : branch_group) { - fulloldpath = branch.path / oldpath; - fullnewpath = branch.path / newpath;; + fulloldpath = branch.path / oldpath_; + fullnewpath = branch.path / newpath_; rv = fs::link(fulloldpath,fullnewpath); if(rv == -ENOENT) @@ -59,7 +55,7 @@ FUSE::LINK::FuncALL::operator()(const char *oldpath_, if(!fs::exists(fulloldpath)) continue; - rv = fs::clonepath_as_root(_branches,branch.path,newpath.parent_path()); + rv = fs::clonepath_as_root(_branches,branch.path,newpath_.parent_path()); if(rv < 0) continue; diff --git a/src/fuse_link_func_all.hpp b/src/fuse_link_func_all.hpp index 335e2dfa..890a51ce 100644 --- a/src/fuse_link_func_all.hpp +++ b/src/fuse_link_func_all.hpp @@ -28,11 +28,11 @@ namespace FUSE::LINK class FuncALL : public FuncBase { public: - FuncALL(const toml::value &); + FuncALL(const toml::value&); public: - int operator()(const char *oldpath, - const char *newpath) final; + int operator()(const gfs::path &oldpath, + const gfs::path &newpath) final; private: Branches2 _branches; diff --git a/src/fuse_link_func_base.hpp b/src/fuse_link_func_base.hpp index be26f9a6..5648a0bd 100644 --- a/src/fuse_link_func_base.hpp +++ b/src/fuse_link_func_base.hpp @@ -18,6 +18,8 @@ #pragma once +#include "fs_path.hpp" + #include "fuse.h" #include @@ -31,8 +33,8 @@ namespace FUSE::LINK typedef std::shared_ptr Ptr; public: - virtual int operator()(const char *oldpath, - const char *newpath) = 0; + virtual int operator()(const gfs::path &oldpath, + const gfs::path &newpath) = 0; }; }