mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-12-03 21:30:11 -05:00
checkpoint
This commit is contained in:
parent
5e48ba69b5
commit
551ee1ab05
141 changed files with 8465 additions and 0 deletions
54
src/fuse_truncate_policy_all.cpp
Normal file
54
src/fuse_truncate_policy_all.cpp
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
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_truncate_func_all.hpp"
|
||||
#include "fuse_truncate_err.hpp"
|
||||
|
||||
#include "fs_truncate.hpp"
|
||||
|
||||
|
||||
namespace gfs = ghc::filesystem;
|
||||
|
||||
|
||||
FUSE::TRUNCATE::FuncALL::FuncALL(const toml::value &toml_)
|
||||
: _branches(toml_)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
FUSE::TRUNCATE::FuncALL::operator()(const char *fusepath_,
|
||||
const off_t length_)
|
||||
{
|
||||
Err 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::truncate(fullpath,length_);
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue