checkpoint

This commit is contained in:
Antonio SJ Musumeci 2022-05-15 20:53:29 -04:00
parent dc8baee8a6
commit 5e48ba69b5
161 changed files with 44 additions and 6708 deletions

View file

@ -1,35 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_access_func.hpp"
#include "fuse_access_func_factory.hpp"
#include "toml.hpp"
FUSE::ACCESS::Func::Func(const toml::value &toml_)
{
_access = FuncFactory(toml_);
}
int
FUSE::ACCESS::Func::operator()(const gfs::path &fusepath_,
const int mask_)
{
return (*_access)(fusepath_,mask_);
}

View file

@ -1,40 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_access_func_base.hpp"
#include "toml.hpp"
namespace FUSE::ACCESS
{
class Func
{
public:
Func(const toml::value &);
public:
int operator()(const gfs::path &fusepath,
const int mask);
private:
FuncBase::Ptr _access;
};
}

View file

@ -1,37 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fs_path.hpp"
#include <memory>
namespace FUSE::ACCESS
{
class FuncBase
{
public:
typedef std::shared_ptr<FuncBase> Ptr;
public:
virtual int operator()(const gfs::path &fusepath,
const int mask) = 0;
};
}

View file

@ -1,37 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_access_func_factory.hpp"
#include "fuse_access_func_ff.hpp"
#include <stdexcept>
namespace FUSE::ACCESS
{
FuncBase::Ptr
FuncFactory(const toml::value &toml_)
{
std::string str;
str = toml::find_or(toml_,"func","access","policy","ff");
if(str == "ff")
return std::make_shared<FuncFF>(toml_);
throw std::runtime_error("");
}
}

View file

@ -1,30 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_access_func_base.hpp"
#include "toml.hpp"
namespace FUSE::ACCESS
{
FuncBase::Ptr
FuncFactory(const toml::value &);
}

View file

@ -1,52 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_access_func_ff.hpp"
#include "fs_eaccess.hpp"
FUSE::ACCESS::FuncFF::FuncFF(const toml::value &toml_)
: _branches(toml_)
{
}
int
FUSE::ACCESS::FuncFF::operator()(const gfs::path &fusepath_,
const int mode_)
{
int rv;
gfs::path fullpath;
for(const auto &branch_group : _branches)
{
for(const auto &branch : branch_group)
{
fullpath = branch.path / fusepath_;
rv = fs::eaccess(fullpath,mode_);
if(rv != 0)
continue;
return 0;
}
}
return -errno;
}

View file

@ -1,40 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_access_func_base.hpp"
#include "branches.hpp"
namespace FUSE::ACCESS
{
class FuncFF : public FuncBase
{
public:
FuncFF(const toml::value&);
public:
int operator()(const gfs::path &fusepath,
const int mode) final;
private:
Branches2 _branches;
};
}

View file

@ -1,35 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_chmod_func.hpp"
#include "fuse_chmod_func_factory.hpp"
#include "toml.hpp"
FUSE::CHMOD::Func::Func(const toml::value &toml_)
{
_chmod = FuncFactory(toml_);
}
int
FUSE::CHMOD::Func::operator()(const gfs::path &fusepath_,
const mode_t mode_)
{
return (*_chmod)(fusepath_,mode_);
}

View file

@ -1,42 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_chmod_func_base.hpp"
#include "toml.hpp"
#include <sys/stat.h>
namespace FUSE::CHMOD
{
class Func
{
public:
Func(const toml::value &);
public:
int operator()(const gfs::path &fusepath,
const mode_t mode);
private:
FuncBase::Ptr _chmod;
};
}

View file

@ -1,49 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_chmod_func_all.hpp"
#include "fuse_chmod_err.hpp"
#include "fs_lchmod.hpp"
FUSE::CHMOD::FuncALL::FuncALL(const toml::value &toml_)
: _branches(toml_)
{
}
int
FUSE::CHMOD::FuncALL::operator()(const gfs::path &fusepath_,
const mode_t mode_)
{
Err rv;
gfs::path fullpath;
for(const auto &branch_group : _branches)
{
for(const auto &branch : branch_group)
{
fullpath = branch.path / fusepath_;
rv = fs::lchmod(fullpath,mode_);
}
}
return rv;
}

View file

@ -1,40 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_chmod_func_base.hpp"
#include "branches.hpp"
namespace FUSE::CHMOD
{
class FuncALL : public FuncBase
{
public:
FuncALL(const toml::value &);
public:
int operator()(const gfs::path &fusepath,
const mode_t mode) final;
private:
Branches2 _branches;
};
}

View file

@ -1,37 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fs_path.hpp"
#include <memory>
namespace FUSE::CHMOD
{
class FuncBase
{
public:
typedef std::shared_ptr<FuncBase> Ptr;
public:
virtual int operator()(const gfs::path &fusepath,
const mode_t mode) = 0;
};
}

View file

@ -1,38 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_chmod_func_factory.hpp"
#include "fuse_chmod_func_all.hpp"
#include <stdexcept>
namespace FUSE::CHMOD
{
FuncBase::Ptr
FuncFactory(const toml::value &toml_)
{
std::string str;
str = toml::find_or(toml_,"func","chmod","policy","all");
if(str == "all")
return std::make_shared<FuncALL>(toml_);
throw std::runtime_error("");
}
}

View file

@ -1,30 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_chmod_func_base.hpp"
#include "toml.hpp"
namespace FUSE::CHMOD
{
FuncBase::Ptr
FuncFactory(const toml::value &);
}

View file

@ -1,36 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_chown_func.hpp"
#include "fuse_chown_func_factory.hpp"
#include "toml.hpp"
FUSE::CHOWN::Func::Func(const toml::value &toml_)
{
_chown = FuncFactory(toml_);
}
int
FUSE::CHOWN::Func::operator()(const gfs::path &fusepath_,
const uid_t uid_,
const gid_t gid_)
{
return (*_chown)(fusepath_,uid_,gid_);
}

View file

@ -1,43 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_chown_func_base.hpp"
#include "toml.hpp"
#include <sys/stat.h>
namespace FUSE::CHOWN
{
class Func
{
public:
Func(const toml::value &);
public:
int operator()(const gfs::path &fusepath,
const uid_t uid,
const gid_t gid);
private:
FuncBase::Ptr _chown;
};
}

View file

@ -1,51 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_chown_func_all.hpp"
#include "fuse_chown_err.hpp"
#include "fs_lchown.hpp"
FUSE::CHOWN::FuncALL::FuncALL(const toml::value &toml_)
: _branches(toml_)
{
}
int
FUSE::CHOWN::FuncALL::operator()(const gfs::path &fusepath_,
const uid_t uid_,
const gid_t gid_)
{
Err rv;
gfs::path fusepath;
gfs::path fullpath;
for(const auto &branch_group : _branches)
{
for(const auto &branch : branch_group)
{
fullpath = branch.path / fusepath_;
rv = fs::lchown(fullpath,uid_,gid_);
}
}
return rv;
}

View file

@ -1,41 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_chown_func_base.hpp"
#include "branches.hpp"
namespace FUSE::CHOWN
{
class FuncALL : public FuncBase
{
public:
FuncALL(const toml::value &);
public:
int operator()(const gfs::path &fusepath,
const uid_t uid,
const gid_t gid) final;
private:
Branches2 _branches;
};
}

View file

@ -1,40 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fs_path.hpp"
#include <memory>
#include <unistd.h>
namespace FUSE::CHOWN
{
class FuncBase
{
public:
typedef std::shared_ptr<FuncBase> Ptr;
public:
virtual int operator()(const gfs::path &fusepath,
const uid_t uid,
const gid_t gid) = 0;
};
}

View file

@ -1,38 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_chown_func_factory.hpp"
#include "fuse_chown_func_all.hpp"
#include <stdexcept>
namespace FUSE::CHOWN
{
FuncBase::Ptr
FuncFactory(const toml::value &toml_)
{
std::string str;
str = toml::find_or(toml_,"func","chown","policy","all");
if(str == "all")
return std::make_shared<FuncALL>(toml_);
throw std::runtime_error("");
}
}

View file

@ -1,30 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_chown_func_base.hpp"
#include "toml.hpp"
namespace FUSE::CHOWN
{
FuncBase::Ptr
FuncFactory(const toml::value &);
}

View file

@ -1,37 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_create_func.hpp"
#include "fuse_create_func_factory.hpp"
#include "toml.hpp"
FUSE::CREATE::Func::Func(const toml::value &toml_)
{
_create = FuncFactory(toml_);
}
int
FUSE::CREATE::Func::operator()(const gfs::path &fusepath_,
const mode_t mode_,
const mode_t umask_,
fuse_file_info_t *ffi_)
{
return (*_create)(fusepath_,mode_,umask_,ffi_);
}

View file

@ -1,42 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_create_func_base.hpp"
#include "toml.hpp"
namespace FUSE::CREATE
{
class Func
{
public:
Func(const toml::value &);
public:
int operator()(const gfs::path &fusepath,
const mode_t mode,
const mode_t umask,
fuse_file_info_t *ffi);
private:
FuncBase::Ptr _create;
};
}

View file

@ -1,41 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fs_path.hpp"
#include "fuse.h"
#include <memory>
namespace FUSE::CREATE
{
class FuncBase
{
public:
typedef std::shared_ptr<FuncBase> Ptr;
public:
virtual int operator()(const gfs::path &fusepath,
const mode_t mode,
const mode_t umask,
fuse_file_info_t *ffi) = 0;
};
}

View file

@ -1,68 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_create_func_epff.hpp"
#include "fileinfo.hpp"
#include "fs_acl.hpp"
#include "fs_open.hpp"
FUSE::CREATE::FuncEPFF::FuncEPFF(const toml::value &toml_)
: _branches(toml_)
{
}
int
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 fullpath;
mode = mode_;
for(const auto &branch_group : _branches)
{
for(const auto &branch : branch_group)
{
fullpath = branch.path / fusepath_;
rv = fs::acl::dir_has_defaults(fullpath);
if(rv == -ENOENT)
continue;
if(rv >= 0)
mode &= umask_;
rv = fs::open(fullpath,ffi_->flags,mode);
if(rv == -ENOENT)
continue;
if(rv < 0)
return rv;
ffi_->fh = reinterpret_cast<uint64_t>(new FileInfo(rv,fusepath_));
return 0;
}
}
return -ENOENT;
}

View file

@ -1,44 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_create_func_base.hpp"
#include "branches.hpp"
#include "fs_path.hpp"
namespace FUSE::CREATE
{
class FuncEPFF : public FuncBase
{
public:
FuncEPFF(const toml::value&);
public:
int operator()(const gfs::path &fusepath,
const mode_t mode,
const mode_t umask,
fuse_file_info_t *ffi) final;
private:
Branches2 _branches;
};
}

View file

@ -1,40 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_create_func_factory.hpp"
#include "fuse_create_func_ff.hpp"
#include "fuse_create_func_epff.hpp"
#include <stdexcept>
namespace FUSE::CREATE
{
FuncBase::Ptr
FuncFactory(const toml::value &toml_)
{
std::string str;
str = toml::find_or(toml_,"func","create","policy","ff");
if(str == "ff")
return std::make_shared<FuncFF>(toml_);
if(str == "epff")
return std::make_shared<FuncEPFF>(toml_);
throw std::runtime_error("");
}
}

View file

@ -1,30 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_create_func_base.hpp"
#include "toml.hpp"
namespace FUSE::CREATE
{
FuncBase::Ptr
FuncFactory(const toml::value &);
}

View file

@ -1,89 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_create_func_ff.hpp"
#include "fileinfo.hpp"
#include "fs_acl.hpp"
#include "fs_clonepath.hpp"
#include "fs_clonepath_branches.hpp"
#include "fs_open.hpp"
#include "ugid.hpp"
namespace gfs = ghc::filesystem;
FUSE::CREATE::FuncFF::FuncFF(const toml::value &toml_)
: _branches(toml_)
{
}
int
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 fullpath;
mode = mode_;
for(const auto &branch_group : _branches)
{
for(const auto &branch : branch_group)
{
fullpath = branch.path / fusepath_;
rv = fs::acl::dir_has_defaults(fullpath);
if(rv == -ENOENT)
{
rv = fs::clonepath_as_root(_branches,branch.path,fusepath_);
if(rv >= 0)
rv = fs::acl::dir_has_defaults(fullpath);
}
if(rv >= 0)
mode &= ~umask_;
rv = fs::open(fullpath,ffi_->flags,mode);
if(rv == -ENOENT)
{
rv = fs::clonepath_as_root(_branches,branch.path,fusepath_);
if(rv >= 0)
{
rv = fs::acl::dir_has_defaults(fullpath);
if(rv >= 0)
mode &= ~umask_;
rv = fs::open(fullpath,ffi_->flags,mode);
}
}
if(rv < 0)
return rv;
ffi_->fh = reinterpret_cast<uint64_t>(new FileInfo(rv,fusepath_));
return 0;
}
}
return -ENOENT;
}

View file

@ -1,42 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_create_func_base.hpp"
#include "branches.hpp"
namespace FUSE::CREATE
{
class FuncFF : public FuncBase
{
public:
FuncFF(const toml::value&);
public:
int operator()(const gfs::path &fusepath,
const mode_t mode,
const mode_t umask,
fuse_file_info_t *ffi) final;
private:
Branches2 _branches;
};
}

View file

@ -27,6 +27,7 @@
#include <sys/stat.h>
namespace FUSE::GETATTR
{
class Func

View file

@ -1,78 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_getattr_func_aggregate.hpp"
#include "timespec.hpp"
#include <limits.h>
namespace gfs = ghc::filesystem;
FUSE::GETATTR::FuncAggregate::FuncAggregate(const toml::value &toml_)
: _branches(toml_)
{
Stat::Func statfunc = Stat::no_follow;
_statfunc = toml::find_or(toml_,"func","getattr","follow-symlinks",statfunc);
}
int
FUSE::GETATTR::FuncAggregate::operator()(const gfs::path &fusepath_,
struct stat *st_,
fuse_timeouts_t *timeout_)
{
int rv;
gfs::path fullpath;
struct stat st = {0};
st_->st_mtime = std::numeric_limits<time_t>::min();
for(const auto &branch_group : _branches)
{
for(const auto &branch : branch_group)
{
fullpath = branch.path / fusepath_;
rv = _statfunc(fullpath,&st);
if(rv != 0)
continue;
if(st_->st_mtime == std::numeric_limits<time_t>::min())
{
*st_ = st;
}
else
{
st_->st_nlink += st.st_nlink;
if(st_->st_atim < st.st_atim)
st_->st_atim = st.st_atim;
if(st_->st_mtim < st.st_mtim)
st_->st_mtim = st.st_mtim;
if(st_->st_ctim < st.st_ctim)
st_->st_ctim = st.st_ctim;
}
}
}
if(st_->st_mtime == std::numeric_limits<time_t>::min())
return -ENOENT;
return 0;
}

View file

@ -1,44 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_getattr_func_base.hpp"
#include "branches.hpp"
#include "stat_func.hpp"
#include "toml.hpp"
namespace FUSE::GETATTR
{
class FuncAggregate : public FuncBase
{
public:
FuncAggregate(const toml::value&);
public:
int operator()(const gfs::path &fusepath,
struct stat *st,
fuse_timeouts_t *timeout) final;
private:
Stat::Func _statfunc;
Branches2 _branches;
};
}

View file

@ -1,98 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_getattr_func_check_ff.hpp"
#include <cstdio>
namespace gfs = ghc::filesystem;
namespace l
{
static
void
alert(const gfs::path &fullpath_,
const char *attr_,
const uint64_t val1_,
const uint64_t val2_)
{
fprintf(stderr,
"%s: %s - %lx != %lx",
fullpath_.c_str(),
attr_,
val1_,
val2_);
}
}
FUSE::GETATTR::FuncCheckFF::FuncCheckFF(const toml::value &toml_)
: _branches(toml_)
{
Stat::Func statfunc = Stat::no_follow;
_statfunc = toml::find_or(toml_,"func","getattr","follow-symlinks",statfunc);
}
int
FUSE::GETATTR::FuncCheckFF::operator()(const gfs::path &fusepath_,
struct stat *st_,
fuse_timeouts_t *timeout_)
{
int rv;
size_t i, ei;
size_t j, ej;
gfs::path fullpath;
struct stat st = {0};
for(i = 0, ei = _branches.size(); i < ei; i++)
{
for(j = 0, ej = _branches[i].size(); j < ej; j++)
{
fullpath = _branches[i][j].path / fusepath_;
rv = _statfunc(fullpath,&st);
if(rv != 0)
continue;
j++;
*st_ = st;
goto main_loop;
}
}
main_loop:
for(; i < ei; i++)
{
for(; j < ej; j++)
{
fullpath = _branches[i][j].path / fusepath_;
rv = _statfunc(fullpath,&st);
if(rv != 0)
continue;
if(st.st_mode != st_->st_mode)
l::alert(fullpath,"mode",st_->st_mode,st.st_mode);
}
}
return 0;
}

View file

@ -1,44 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_getattr_func_base.hpp"
#include "branches.hpp"
#include "stat_func.hpp"
#include "toml.hpp"
namespace FUSE::GETATTR
{
class FuncCheckFF : public FuncBase
{
public:
FuncCheckFF(const toml::value&);
public:
int operator()(const gfs::path &fusepath,
struct stat *st,
fuse_timeouts_t *timeout) final;
private:
Stat::Func _statfunc;
Branches2 _branches;
};
}

View file

@ -1,48 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_getattr_func_factory.hpp"
#include "fuse_getattr_func_base.hpp"
#include "fuse_getattr_func_ff.hpp"
#include "fuse_getattr_func_newest.hpp"
#include "fuse_getattr_func_aggregate.hpp"
#include "fuse_getattr_func_check_ff.hpp"
#include <stdexcept>
namespace FUSE::GETATTR
{
FuncBase::Ptr
FuncFactory(const toml::value &toml_)
{
std::string str;
str = toml::find_or(toml_,"func","getattr","policy","ff");
if(str == "ff")
return std::make_shared<FuncFF>(toml_);
if(str == "newest")
return std::make_shared<FuncNewest>(toml_);
if(str == "aggregate")
return std::make_shared<FuncAggregate>(toml_);
if(str == "check-ff")
return std::make_shared<FuncCheckFF>(toml_);
throw std::runtime_error("");
}
}

View file

@ -1,29 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_getattr_func_base.hpp"
#include "toml.hpp"
namespace FUSE::GETATTR
{
FuncBase::Ptr
FuncFactory(const toml::value &);
}

View file

@ -1,56 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_getattr_func_ff.hpp"
namespace gfs = ghc::filesystem;
FUSE::GETATTR::FuncFF::FuncFF(const toml::value &toml_)
: _branches(toml_)
{
Stat::Func statfunc = Stat::no_follow;
_statfunc = toml::find_or(toml_,"func","getattr","follow-symlinks",statfunc);
}
int
FUSE::GETATTR::FuncFF::operator()(const gfs::path &fusepath_,
struct stat *st_,
fuse_timeouts_t *timeout_)
{
int rv;
gfs::path fullpath;
for(const auto &branch_group : _branches)
{
for(const auto &branch : branch_group)
{
fullpath = branch.path / fusepath_;
rv = _statfunc(fullpath,st_);
if(rv == -ENOENT)
continue;
return rv;
}
}
return -ENOENT;
}

View file

@ -1,44 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_getattr_func.hpp"
#include "branches.hpp"
#include "stat_func.hpp"
#include "toml.hpp"
namespace FUSE::GETATTR
{
class FuncFF : public FuncBase
{
public:
FuncFF(const toml::value&);
public:
int operator()(const gfs::path &fusepath,
struct stat *st,
fuse_timeouts_t *timeout) final;
private:
Stat::Func _statfunc;
Branches2 _branches;
};
}

View file

@ -1,65 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_getattr_func_newest.hpp"
#include <limits.h>
namespace gfs = ghc::filesystem;
FUSE::GETATTR::FuncNewest::FuncNewest(const toml::value &toml_)
: _branches(toml_)
{
Stat::Func statfunc = Stat::no_follow;
_statfunc = toml::find_or(toml_,"func","getattr","follow-symlinks",statfunc);
}
int
FUSE::GETATTR::FuncNewest::operator()(const gfs::path &fusepath_,
struct stat *st_,
fuse_timeouts_t *timeout_)
{
int rv;
struct stat st;
gfs::path fullpath;
st_->st_mtime = std::numeric_limits<time_t>::min();
for(const auto &branch_group : _branches)
{
for(const auto &branch : branch_group)
{
fullpath = branch.path / fusepath_;
rv = _statfunc(fullpath,&st);
if(rv != 0)
continue;
if(st_->st_mtime < st.st_mtime)
continue;
*st_ = st;
}
}
if(st_->st_mtime == std::numeric_limits<time_t>::min())
return -ENOENT;
return 0;
}

View file

@ -1,44 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_getattr_func_base.hpp"
#include "branches.hpp"
#include "stat_func.hpp"
#include "toml.hpp"
namespace FUSE::GETATTR
{
class FuncNewest : public FuncBase
{
public:
FuncNewest(const toml::value&);
public:
int operator()(const gfs::path &fusepath,
struct stat *st,
fuse_timeouts_t *timeout) final;
private:
Stat::Func _statfunc;
Branches2 _branches;
};
}

View file

@ -1,37 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_getxattr_func.hpp"
#include "fuse_getxattr_func_factory.hpp"
#include "state.hpp"
FUSE::GETXATTR::Func::Func(const toml::value &toml_)
{
_getxattr = FuncFactory(toml_);
}
int
FUSE::GETXATTR::Func::operator()(const gfs::path &fusepath_,
const char *attrname_,
char *buf_,
size_t count_)
{
return (*_getxattr)(fusepath_,attrname_,buf_,count_);
}

View file

@ -1,47 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_getxattr_func_base.hpp"
#include "fuse_timeouts.h"
#include "toml.hpp"
#include <memory>
#include <sys/stat.h>
namespace FUSE::GETXATTR
{
class Func
{
public:
Func(const toml::value &);
public:
int operator()(const gfs::path &fusepath,
const char *attrname,
char *buf,
size_t count);
private:
FuncBase::Ptr _getxattr;
};
}

View file

@ -1,40 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fs_path.hpp"
#include <memory>
#include <sys/stat.h>
namespace FUSE::GETXATTR
{
class FuncBase
{
public:
typedef std::shared_ptr<FuncBase> Ptr;
public:
virtual int operator()(const gfs::path &fusepath,
const char *attrname,
char *buf,
size_t count) = 0;
};
}

View file

@ -1,38 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_getxattr_func_factory.hpp"
#include "fuse_getxattr_func_ff.hpp"
#include <stdexcept>
namespace FUSE::GETXATTR
{
FuncBase::Ptr
FuncFactory(const toml::value &toml_)
{
std::string str;
str = toml::find_or(toml_,"func","getxattr","policy","ff");
if(str == "ff")
return std::make_shared<FuncFF>(toml_);
throw std::runtime_error("");
}
}

View file

@ -1,29 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_getxattr_func_base.hpp"
#include "toml.hpp"
namespace FUSE::GETXATTR
{
FuncBase::Ptr
FuncFactory(const toml::value &);
}

View file

@ -1,57 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_getxattr_func_ff.hpp"
#include "fs_lgetxattr.hpp"
namespace gfs = ghc::filesystem;
FUSE::GETXATTR::FuncFF::FuncFF(const toml::value &toml_)
: _branches(toml_)
{
}
int
FUSE::GETXATTR::FuncFF::operator()(const gfs::path &fusepath_,
const char *attrname_,
char *buf_,
size_t count_)
{
int rv;
gfs::path fullpath;
for(const auto &branch_group : _branches)
{
for(const auto &branch : branch_group)
{
fullpath = branch.path / fusepath_;
rv = fs::lgetxattr(fullpath,attrname_,buf_,count_);
if(rv == -ENOENT)
continue;
return rv;
}
}
return -ENOENT;
}

View file

@ -1,44 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_getxattr_func.hpp"
#include "branches.hpp"
#include "stat_func.hpp"
#include "toml.hpp"
namespace FUSE::GETXATTR
{
class FuncFF : public FuncBase
{
public:
FuncFF(const toml::value&);
public:
int operator()(const gfs::path &fusepath,
const char *attrname,
char *buf,
size_t count) final;
private:
Branches2 _branches;
};
}

View file

@ -1,38 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_ioctl_func.hpp"
#include "fuse_ioctl_func_factory.hpp"
#include "toml.hpp"
FUSE::IOCTL::Func::Func(const toml::value &toml_)
{
_ioctl = FuncFactory(toml_);
}
int
FUSE::IOCTL::Func::operator()(const fuse_file_info_t *ffi_,
const unsigned long cmd_,
const unsigned int flags_,
void *data_,
uint32_t *out_bufsz_)
{
return (*_ioctl)(ffi_,cmd_,flags_,data_,out_bufsz_);
}

View file

@ -1,43 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_ioctl_func_base.hpp"
#include "toml.hpp"
namespace FUSE::IOCTL
{
class Func
{
public:
Func(const toml::value &);
public:
int operator()(const fuse_file_info_t *ffi_,
const unsigned long cmd,
const unsigned int flags,
void *data,
uint32_t *out_bufsz);
private:
FuncBase::Ptr _ioctl;
};
}

View file

@ -1,55 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_ioctl_func_all.hpp"
#include "fuse_ioctl_err.hpp"
#include "fs_ioctl.hpp"
namespace gfs = ghc::filesystem;
FUSE::IOCTL::FuncALL::FuncALL(const toml::value &toml_)
: _branches(toml_)
{
}
int
FUSE::IOCTL::FuncALL::operator()(const fuse_file_info_t *ffi_,
const unsigned long cmd_,
const unsigned int flags_,
void *data_,
uint32_t *out_bufsz_)
{
Err rv;
gfs::path fusepath;
gfs::path fullpath;
for(const auto &branch_group : _branches)
{
for(const auto &branch : branch_group)
{
fullpath = branch.path / fusepath;
}
}
return rv;
}

View file

@ -1,43 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_ioctl_func_base.hpp"
#include "branches.hpp"
namespace FUSE::IOCTL
{
class FuncALL : public FuncBase
{
public:
FuncALL(const toml::value &);
public:
int operator()(const fuse_file_info_t *ffi,
const unsigned long cmd,
const unsigned int flags,
void *data,
uint32_t *out_bufsz) final;
private:
Branches2 _branches;
};
}

View file

@ -1,40 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse.h"
#include <memory>
namespace FUSE::IOCTL
{
class FuncBase
{
public:
typedef std::shared_ptr<FuncBase> Ptr;
public:
virtual int operator()(const fuse_file_info_t *ffi,
const unsigned long cmd,
const unsigned int flags,
void *data,
uint32_t *out_bufsz) = 0;
};
}

View file

@ -1,38 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_ioctl_func_factory.hpp"
#include "fuse_ioctl_func_all.hpp"
#include <stdexcept>
namespace FUSE::IOCTL
{
FuncBase::Ptr
FuncFactory(const toml::value &toml_)
{
std::string str;
str = toml::find_or(toml_,"func","ioctl","policy","all");
if(str == "all")
return std::make_shared<FuncALL>(toml_);
throw std::runtime_error("");
}
}

View file

@ -1,30 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_ioctl_func_base.hpp"
#include "toml.hpp"
namespace FUSE::IOCTL
{
FuncBase::Ptr
FuncFactory(const toml::value &);
}

View file

@ -1,28 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_link_func.hpp"
#include "fuse_link_func_factory.hpp"
#include "toml.hpp"
FUSE::LINK::Func::Func(const toml::value &toml_)
{
_link = FuncFactory(toml_);
}

View file

@ -1,46 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_link_func_base.hpp"
#include "toml.hpp"
#include "fuse.h"
namespace FUSE::LINK
{
class Func
{
public:
Func(const toml::value &);
public:
int
operator()(const gfs::path &oldpath_,
const gfs::path &newpath_)
{
return (*_link)(oldpath_,newpath_);
}
private:
FuncBase::Ptr _link;
};
}

View file

@ -1,70 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_link_func_all.hpp"
#include "fuse_link_err.hpp"
#include "fs_clonepath_branches.hpp"
#include "fs_exists.hpp"
#include "fs_link.hpp"
namespace gfs = ghc::filesystem;
FUSE::LINK::FuncALL::FuncALL(const toml::value &toml_)
: _branches(toml_)
{
}
int
FUSE::LINK::FuncALL::operator()(const gfs::path &oldpath_,
const gfs::path &newpath_)
{
int rv;
Err err;
gfs::path fulloldpath;
gfs::path fullnewpath;
for(const auto &branch_group : _branches)
{
for(const auto &branch : branch_group)
{
fulloldpath = branch.path / oldpath_;
fullnewpath = branch.path / newpath_;
rv = fs::link(fulloldpath,fullnewpath);
if(rv == -ENOENT)
{
if(!fs::exists(fulloldpath))
continue;
rv = fs::clonepath_as_root(_branches,branch.path,newpath_.parent_path());
if(rv < 0)
continue;
rv = fs::link(fulloldpath,fullnewpath);
}
err = rv;
}
}
return err;
}

View file

@ -1,40 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_link_func_base.hpp"
#include "branches.hpp"
namespace FUSE::LINK
{
class FuncALL : public FuncBase
{
public:
FuncALL(const toml::value&);
public:
int operator()(const gfs::path &oldpath,
const gfs::path &newpath) final;
private:
Branches2 _branches;
};
}

View file

@ -1,40 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fs_path.hpp"
#include "fuse.h"
#include <memory>
namespace FUSE::LINK
{
class FuncBase
{
public:
typedef std::shared_ptr<FuncBase> Ptr;
public:
virtual int operator()(const gfs::path &oldpath,
const gfs::path &newpath) = 0;
};
}

View file

@ -1,38 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_link_func_factory.hpp"
#include "fuse_link_func_all.hpp"
#include <stdexcept>
namespace FUSE::LINK
{
FuncBase::Ptr
FuncFactory(const toml::value &toml_)
{
std::string str;
str = toml::find_or(toml_,"func","link","policy","all");
if(str == "all")
return std::make_shared<FuncALL>(toml_);
throw std::runtime_error("");
}
}

View file

@ -1,30 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_link_func_base.hpp"
#include "toml.hpp"
namespace FUSE::LINK
{
FuncBase::Ptr
FuncFactory(const toml::value &);
}

View file

@ -1,34 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_listxattr_func.hpp"
#include "fuse_listxattr_func_factory.hpp"
FUSE::LISTXATTR::Func::Func(const toml::value &toml_)
{
_listxattr = FuncFactory(toml_);
}
int
FUSE::LISTXATTR::Func::operator()(const gfs::path &fusepath_,
char *list_,
const size_t size_)
{
return (*_listxattr)(fusepath_,list_,size_);
}

View file

@ -1,43 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "from_toml.hpp"
#include "fuse_listxattr_func_base.hpp"
#include <memory>
#include <sys/stat.h>
namespace FUSE::LISTXATTR
{
class Func
{
public:
Func(const toml::value &);
public:
int operator()(const gfs::path &fusepath,
char *buf,
size_t count);
private:
FuncBase::Ptr _listxattr;
};
}

View file

@ -1,38 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fs_path.hpp"
#include <memory>
namespace FUSE::LISTXATTR
{
class FuncBase
{
public:
typedef std::shared_ptr<FuncBase> Ptr;
public:
virtual int operator()(const gfs::path &fusepath,
char *list,
const size_t size) = 0;
};
}

View file

@ -1,38 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_listxattr_func_factory.hpp"
#include "fuse_listxattr_func_ff.hpp"
#include <stdexcept>
namespace FUSE::LISTXATTR
{
FuncBase::Ptr
FuncFactory(const toml::value &toml_)
{
std::string str;
str = toml::find_or(toml_,"func","listxattr","policy","ff");
if(str == "ff")
return std::make_shared<FuncFF>(toml_);
throw std::runtime_error("");
}
}

View file

@ -1,29 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_listxattr_func_base.hpp"
#include "toml.hpp"
namespace FUSE::LISTXATTR
{
FuncBase::Ptr
FuncFactory(const toml::value &);
}

View file

@ -1,53 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_listxattr_func_ff.hpp"
#include "fs_llistxattr.hpp"
FUSE::LISTXATTR::FuncFF::FuncFF(const toml::value &toml_)
: _branches(toml_)
{
}
int
FUSE::LISTXATTR::FuncFF::operator()(const gfs::path &fusepath_,
char *list_,
const size_t size_)
{
int rv;
gfs::path fullpath;
for(const auto &branch_group : _branches)
{
for(const auto &branch : branch_group)
{
fullpath = branch.path / fusepath_;
rv = fs::llistxattr(fullpath,list_,size_);
if(rv == -ENOENT)
continue;
return rv;
}
}
return -ENOENT;
}

View file

@ -1,42 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_listxattr_func.hpp"
#include "branches.hpp"
#include "toml.hpp"
namespace FUSE::LISTXATTR
{
class FuncFF : public FuncBase
{
public:
FuncFF(const toml::value&);
public:
int operator()(const gfs::path &fusepath,
char *list,
const size_t size) final;
private:
Branches2 _branches;
};
}

View file

@ -1,36 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_mkdir_func.hpp"
#include "fuse_mkdir_func_factory.hpp"
#include "toml.hpp"
FUSE::MKDIR::Func::Func(const toml::value &toml_)
{
_mkdir = FuncFactory(toml_);
}
int
FUSE::MKDIR::Func::operator()(const gfs::path &fusepath_,
const mode_t mode_,
const mode_t umask_)
{
return (*_mkdir)(fusepath_,mode_,umask_);
}

View file

@ -1,41 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_mkdir_func_base.hpp"
#include "toml.hpp"
namespace FUSE::MKDIR
{
class Func
{
public:
Func(const toml::value &);
public:
int operator()(const gfs::path &fusepath,
const mode_t mode,
const mode_t umask);
private:
FuncBase::Ptr _mkdir;
};
}

View file

@ -1,40 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fs_path.hpp"
#include "fuse.h"
#include <memory>
namespace FUSE::MKDIR
{
class FuncBase
{
public:
typedef std::shared_ptr<FuncBase> Ptr;
public:
virtual int operator()(const gfs::path &fusepath,
const mode_t mode,
const mode_t umask) = 0;
};
}

View file

@ -1,55 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_mkdir_func_epff.hpp"
#include "fuse_mkdir_mkdir.hpp"
namespace gfs = ghc::filesystem;
FUSE::MKDIR::FuncEPFF::FuncEPFF(const toml::value &toml_)
: _branches(toml_)
{
}
int
FUSE::MKDIR::FuncEPFF::operator()(const gfs::path &fusepath_,
const mode_t mode_,
const mode_t umask_)
{
int rv;
gfs::path fullpath;
for(const auto &branch_group : _branches)
{
for(const auto &branch : branch_group)
{
fullpath = branch.path / fusepath_;
rv = FUSE::MKDIR::mkdir(fullpath,mode_,umask_);
if(rv == -ENOENT)
continue;
return rv;
}
}
return -ENOENT;
}

View file

@ -1,41 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_mkdir_func_base.hpp"
#include "branches.hpp"
namespace FUSE::MKDIR
{
class FuncEPFF : public FuncBase
{
public:
FuncEPFF(const toml::value&);
public:
int operator()(const gfs::path &fusepath,
const mode_t mode,
const mode_t umask) final;
private:
Branches2 _branches;
};
}

View file

@ -1,40 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_mkdir_func_factory.hpp"
#include "fuse_mkdir_func_ff.hpp"
#include "fuse_mkdir_func_epff.hpp"
#include <stdexcept>
namespace FUSE::MKDIR
{
FuncBase::Ptr
FuncFactory(const toml::value &toml_)
{
std::string str;
str = toml::find_or(toml_,"func","mkdir","policy","ff");
if(str == "ff")
return std::make_shared<FuncFF>(toml_);
if(str == "epff")
return std::make_shared<FuncEPFF>(toml_);
throw std::runtime_error("");
}
}

View file

@ -1,30 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_mkdir_func_base.hpp"
#include "toml.hpp"
namespace FUSE::MKDIR
{
FuncBase::Ptr
FuncFactory(const toml::value &);
}

View file

@ -1,61 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_mkdir_func_ff.hpp"
#include "fuse_mkdir_mkdir.hpp"
#include "fs_clonepath_branches.hpp"
namespace gfs = ghc::filesystem;
FUSE::MKDIR::FuncFF::FuncFF(const toml::value &toml_)
: _branches(toml_)
{
}
int
FUSE::MKDIR::FuncFF::operator()(const gfs::path &fusepath_,
const mode_t mode_,
const mode_t umask_)
{
int rv;
gfs::path fullpath;
for(const auto &branch_group : _branches)
{
for(const auto &branch : branch_group)
{
fullpath = branch.path / fusepath_;
rv = FUSE::MKDIR::mkdir(fullpath,mode_,umask_);
if(rv == -ENOENT)
{
rv = fs::clonepath_as_root(_branches,branch.path,fusepath_);
if(rv >= 0)
rv = FUSE::MKDIR::mkdir(fullpath,mode_,umask_);
}
return rv;
}
}
return -ENOENT;
}

View file

@ -1,41 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_mkdir_func_base.hpp"
#include "branches.hpp"
namespace FUSE::MKDIR
{
class FuncFF : public FuncBase
{
public:
FuncFF(const toml::value&);
public:
int operator()(const gfs::path &fusepath,
const mode_t mode,
const mode_t umask) final;
private:
Branches2 _branches;
};
}

View file

@ -154,9 +154,11 @@ namespace FUSE::MKNOD
dev_t rdev_)
{
State s;
gfs::path fusepath;
const fuse_context *fc = fuse_get_context();
const ugid::Set ugid(fc->uid,fc->gid);
return s->mknod(fusepath_,mode_,fc->umask,rdev_);
fusepath = &fusepath_[1];
return s->mknod(fusepath,mode_,fc->umask,rdev_);
}
}

View file

@ -1,37 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_mknod_func.hpp"
#include "fuse_mknod_func_factory.hpp"
#include "toml.hpp"
FUSE::MKNOD::Func::Func(const toml::value &toml_)
{
_mknod = FuncFactory(toml_);
}
int
FUSE::MKNOD::Func::operator()(const char *fusepath_,
const mode_t mode_,
const mode_t umask_,
const dev_t dev_)
{
return (*_mknod)(fusepath_,mode_,umask_,dev_);
}

View file

@ -1,42 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_mknod_func_base.hpp"
#include "toml.hpp"
namespace FUSE::MKNOD
{
class Func
{
public:
Func(const toml::value &);
public:
int operator()(const char *fusepath,
const mode_t mode,
const mode_t umask,
const dev_t dev);
private:
FuncBase::Ptr _mknod;
};
}

View file

@ -1,42 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include <memory>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
namespace FUSE::MKNOD
{
class FuncBase
{
public:
typedef std::shared_ptr<FuncBase> Ptr;
public:
virtual int operator()(const char *fusepath,
const mode_t mode,
const mode_t umask,
const dev_t dev) = 0;
};
}

View file

@ -1,69 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_mknod_func_epff.hpp"
#include "fileinfo.hpp"
#include "fs_acl.hpp"
#include "fs_mknod.hpp"
namespace gfs = ghc::filesystem;
FUSE::MKNOD::FuncEPFF::FuncEPFF(const toml::value &toml_)
: _branches(toml_)
{
}
int
FUSE::MKNOD::FuncEPFF::operator()(const char *fusepath_,
const mode_t mode_,
const mode_t umask_,
const dev_t dev_)
{
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;
rv = fs::acl::dir_has_defaults(fullpath);
if(rv == -ENOENT)
continue;
if(rv >= 0)
mode &= umask_;
rv = fs::mknod(fullpath,mode,dev_);
if(rv == -ENOENT)
continue;
return rv;
}
}
return -ENOENT;
}

View file

@ -1,42 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_mknod_func_base.hpp"
#include "branches.hpp"
namespace FUSE::MKNOD
{
class FuncEPFF : public FuncBase
{
public:
FuncEPFF(const toml::value&);
public:
int operator()(const char *fusepath,
const mode_t mode,
const mode_t umask,
const dev_t dev) final;
private:
Branches2 _branches;
};
}

View file

@ -1,40 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_mknod_func_factory.hpp"
#include "fuse_mknod_func_ff.hpp"
#include "fuse_mknod_func_epff.hpp"
#include <stdexcept>
namespace FUSE::MKNOD
{
FuncBase::Ptr
FuncFactory(const toml::value &toml_)
{
std::string str;
str = toml::find_or(toml_,"func","mknod","policy","ff");
if(str == "ff")
return std::make_shared<FuncFF>(toml_);
if(str == "epff")
return std::make_shared<FuncEPFF>(toml_);
throw std::runtime_error("");
}
}

View file

@ -1,30 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_mknod_func_base.hpp"
#include "toml.hpp"
namespace FUSE::MKNOD
{
FuncBase::Ptr
FuncFactory(const toml::value &);
}

View file

@ -1,86 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_mknod_func_ff.hpp"
#include "fileinfo.hpp"
#include "fs_acl.hpp"
#include "fs_clonepath.hpp"
#include "fs_clonepath_branches.hpp"
#include "fs_mknod.hpp"
#include "ugid.hpp"
namespace gfs = ghc::filesystem;
FUSE::MKNOD::FuncFF::FuncFF(const toml::value &toml_)
: _branches(toml_)
{
}
int
FUSE::MKNOD::FuncFF::operator()(const char *fusepath_,
const mode_t mode_,
const mode_t umask_,
const dev_t dev_)
{
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;
rv = fs::acl::dir_has_defaults(fullpath);
if(rv == -ENOENT)
{
rv = fs::clonepath_as_root(_branches,branch.path,fusepath);
if(rv >= 0)
rv = fs::acl::dir_has_defaults(fullpath);
}
if(rv >= 0)
mode &= ~umask_;
rv = fs::mknod(fullpath,mode,dev_);
if(rv == -ENOENT)
{
rv = fs::clonepath_as_root(_branches,branch.path,fusepath);
if(rv >= 0)
{
rv = fs::acl::dir_has_defaults(fullpath);
if(rv >= 0)
mode &= ~umask_;
rv = fs::mknod(fullpath,mode,dev_);
}
}
return rv;
}
}
return -ENOENT;
}

View file

@ -1,42 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_mknod_func_base.hpp"
#include "branches.hpp"
namespace FUSE::MKNOD
{
class FuncFF : public FuncBase
{
public:
FuncFF(const toml::value&);
public:
int operator()(const char *fusepath,
const mode_t mode,
const mode_t umask,
const dev_t dev) final;
private:
Branches2 _branches;
};
}

View file

@ -1,41 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_open_func.hpp"
#include "fuse_open_func_factory.hpp"
#include "state.hpp"
FUSE::OPEN::Func::Func(const toml::value &toml_)
{
_open = FuncFactory(toml_);
}
void
FUSE::OPEN::Func::operator=(const toml::value &toml_)
{
_open = FuncFactory(toml_);
}
int
FUSE::OPEN::Func::operator()(const char *fusepath_,
fuse_file_info_t *ffi_)
{
return (*_open)(fusepath_,ffi_);
}

View file

@ -1,47 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_open_func_base.hpp"
#include "fuse.h"
#include "toml.hpp"
#include <memory>
namespace FUSE::OPEN
{
class Func
{
public:
Func(const toml::value &);
public:
int operator()(const char *fusepath,
fuse_file_info_t *ffi);
void operator=(const toml::value&);
private:
FuncBase::Ptr _open;
};
}

View file

@ -1,37 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse.h"
#include <memory>
namespace FUSE::OPEN
{
class FuncBase
{
public:
typedef std::shared_ptr<FuncBase> Ptr;
public:
virtual int operator()(const char *fusepath,
fuse_file_info_t *ffi) = 0;
};
}

View file

@ -1,39 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_open_func_factory.hpp"
#include "fuse_open_func_ff.hpp"
#include <stdexcept>
namespace FUSE::OPEN
{
FuncBase::Ptr
FuncFactory(const toml::value &toml_)
{
std::string str;
str = toml::find_or(toml_,"func","open","policy","ff");
if(str == "ff")
return std::make_shared<FuncFF>(toml_);
throw std::runtime_error("");
}
}

View file

@ -1,29 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_open_func_base.hpp"
#include "toml.hpp"
namespace FUSE::OPEN
{
FuncBase::Ptr
FuncFactory(const toml::value &);
}

View file

@ -1,62 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_open_func_ff.hpp"
#include "fs_open.hpp"
#include "fileinfo.hpp"
namespace gfs = ghc::filesystem;
FUSE::OPEN::FuncFF::FuncFF(const toml::value &toml_)
: _branches(toml_)
{
}
int
FUSE::OPEN::FuncFF::operator()(const char *fusepath_,
fuse_file_info_t *ffi_)
{
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;
rv = fs::open(fullpath,ffi_->flags);
if(rv == -ENOENT)
continue;
if(rv < 0)
return rv;
ffi_->fh = reinterpret_cast<uint64_t>(new FileInfo(rv,fusepath_));
return 0;
}
}
return -ENOENT;
}

View file

@ -1,42 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_open_func.hpp"
#include "branches.hpp"
#include "toml.hpp"
namespace FUSE::OPEN
{
class FuncFF : public FuncBase
{
public:
FuncFF(const toml::value&);
public:
int operator()(const char *fusepath,
fuse_file_info_t *ffi) final;
private:
Branches2 _branches;
};
}

View file

@ -1,42 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_readlink_func.hpp"
#include "fuse_readlink_func_factory.hpp"
#include "state.hpp"
FUSE::READLINK::Func::Func(const toml::value &toml_)
{
_readlink = FuncFactory(toml_);
}
void
FUSE::READLINK::Func::operator=(const toml::value &toml_)
{
_readlink = FuncFactory(toml_);
}
int
FUSE::READLINK::Func::operator()(const char *fusepath_,
char *buf_,
const size_t bufsiz_)
{
return (*_readlink)(fusepath_,buf_,bufsiz_);
}

View file

@ -1,47 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "from_toml.hpp"
#include "fuse_readlink_func_base.hpp"
#include "fuse_timeouts.h"
#include <memory>
#include <sys/stat.h>
namespace FUSE::READLINK
{
class Func
{
public:
Func(const toml::value &);
public:
int operator()(const char *fusepath,
char *buf_,
const size_t bufsiz_);
void operator=(const toml::value&);
private:
FuncBase::Ptr _readlink;
};
}

View file

@ -1,36 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include <memory>
namespace FUSE::READLINK
{
class FuncBase
{
public:
typedef std::shared_ptr<FuncBase> Ptr;
public:
virtual int operator()(const char *fusepath,
char *buf,
const size_t bufsiz) = 0;
};
}

View file

@ -1,39 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "fuse_readlink_func_factory.hpp"
#include "fuse_readlink_func_ff.hpp"
#include <stdexcept>
namespace FUSE::READLINK
{
FuncBase::Ptr
FuncFactory(const toml::value &toml_)
{
std::string str;
str = toml::find_or(toml_,"func","readlink","policy","ff");
if(str == "ff")
return std::make_shared<FuncFF>(toml_);
throw std::runtime_error("");
}
}

View file

@ -1,29 +0,0 @@
/*
ISC License
Copyright (c) 2022, Antonio SJ Musumeci <trapexit@spawn.link>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once
#include "fuse_readlink_func_base.hpp"
#include "toml.hpp"
namespace FUSE::READLINK
{
FuncBase::Ptr
FuncFactory(const toml::value &);
}

Some files were not shown because too many files have changed in this diff Show more