mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-19 16:16:48 +00:00
Compare commits
151
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11a5706dc3 | ||
|
|
fe6518c4a6 | ||
|
|
64d37be555 | ||
|
|
e06fc110ad | ||
|
|
d9ea3fff4b | ||
|
|
02544b649f | ||
|
|
efa630db5c | ||
|
|
4820724f9d | ||
|
|
7f215c5ffd | ||
|
|
587d2dbd43 | ||
|
|
e95b409276 | ||
|
|
7f9f7c5278 | ||
|
|
f92daf0a9e | ||
|
|
d86224571b | ||
|
|
f400eec2ad | ||
|
|
7566c0485a | ||
|
|
f748d63dd0 | ||
|
|
915b60a957 | ||
|
|
1d0f5b1180 | ||
|
|
1e8aa240e2 | ||
|
|
e5a4793332 | ||
|
|
bb7daa6173 | ||
|
|
02b87df975 | ||
|
|
133539e4b6 | ||
|
|
77805d4742 | ||
|
|
f48648b056 | ||
|
|
798222f37f | ||
|
|
641bf41023 | ||
|
|
b3f9c20279 | ||
|
|
a8357acbc6 | ||
|
|
539c90b029 | ||
|
|
c531289541 | ||
|
|
8f5ef638ec | ||
|
|
8efdb641e7 | ||
|
|
abc05c4c0f | ||
|
|
435632b737 | ||
|
|
d3c1ebf19f | ||
|
|
82c72cf6a0 | ||
|
|
1d6fe14c5d | ||
|
|
2d9300aadc | ||
|
|
01c4e72ff4 | ||
|
|
6390c34585 | ||
|
|
2de22c8893 | ||
|
|
517ca11335 | ||
|
|
921a21f5a0 | ||
|
|
1287daf86e | ||
|
|
90c511fbde | ||
|
|
b4ab6daf88 | ||
|
|
6578b589c6 | ||
|
|
e5bf3e265f | ||
|
|
b9d2895429 | ||
|
|
2d8aad7c77 | ||
|
|
f398ea2393 | ||
|
|
d4c39b46d6 | ||
|
|
94bf1ef7dc | ||
|
|
14ef951f87 | ||
|
|
9def5089d3 | ||
|
|
45bb98343f | ||
|
|
988ec2f7aa | ||
|
|
72dd01fd46 | ||
|
|
8f45dd01c1 | ||
|
|
8106ec2664 | ||
|
|
87b4971c26 | ||
|
|
73bd437213 | ||
|
|
d8b27f1a89 | ||
|
|
aecc6f3d84 | ||
|
|
59560b5e2b | ||
|
|
7429c3a779 | ||
|
|
5d3206f255 | ||
|
|
12e8345183 | ||
|
|
22c58fce90 | ||
|
|
f23ede2ccb | ||
|
|
df7b9fd538 | ||
|
|
9bbd5397f6 | ||
|
|
d0080985ac | ||
|
|
2bfa459323 | ||
|
|
cf07e9cb89 | ||
|
|
075cbfc23f | ||
|
|
9826e97693 | ||
|
|
9843f48627 | ||
|
|
21c41c1e85 | ||
|
|
d26d7c439f | ||
|
|
5e607d5dc1 | ||
|
|
c39ddb09d1 | ||
|
|
addcdd6246 | ||
|
|
9f43af18cc | ||
|
|
8399ca0694 | ||
|
|
4c358f9a3e | ||
|
|
9640e1bf4d | ||
|
|
79eafe549d | ||
|
|
3ca304aad6 | ||
|
|
f81058ddc8 | ||
|
|
335f4cf62b | ||
|
|
d8750e4343 | ||
|
|
3742a3a937 | ||
|
|
a507019415 | ||
|
|
9486554e4e | ||
|
|
9a2a4076ba | ||
|
|
9de89cd29b | ||
|
|
c0635b4240 | ||
|
|
857cde4634 | ||
|
|
353032a9ad | ||
|
|
7dae8d6746 | ||
|
|
f97b780546 | ||
|
|
c2bf982be6 | ||
|
|
2f75003e0e | ||
|
|
70411b35a6 | ||
|
|
34386ea0fc | ||
|
|
3c7adb71e5 | ||
|
|
e116f195c4 | ||
|
|
aa762bbcf8 | ||
|
|
d58b3e5e26 | ||
|
|
39479f747f | ||
|
|
969037a293 | ||
|
|
22f6277deb | ||
|
|
864526c668 | ||
|
|
04e2342848 | ||
|
|
20e9053715 | ||
|
|
d8399f375a | ||
|
|
a8c38a6f86 | ||
|
|
4b2c92db90 | ||
|
|
6c1190566b | ||
|
|
ce4a88b27c | ||
|
|
8f9da0d5b1 | ||
|
|
ea15534e52 | ||
|
|
e81dbc2adc | ||
|
|
1df1a94231 | ||
|
|
4e68e1eed9 | ||
|
|
26b5585911 | ||
|
|
12cbd2f88a | ||
|
|
73db2ca9b7 | ||
|
|
c56b0e644f | ||
|
|
b72f8587c3 | ||
|
|
c25340aba5 | ||
|
|
a7de2c5212 | ||
|
|
851b982518 | ||
|
|
f30ad6d45b | ||
|
|
16110672fc | ||
|
|
750866d842 | ||
|
|
7f039a5e7e | ||
|
|
52fe5a5e40 | ||
|
|
af5928cbe2 | ||
|
|
6c45d23ecb | ||
|
|
2b2877b8f3 | ||
|
|
882ad29b87 | ||
|
|
8340bc9370 | ||
|
|
92e89a9e99 | ||
|
|
5da92025e0 | ||
|
|
ad8c19118e | ||
|
|
d4d3aee354 | ||
|
|
4b580522c1 |
+15
-1
@@ -861,11 +861,25 @@ fuse_syslog_fuse_init_out(const struct fuse_init_out *arg_)
|
||||
output = fmt::format("fuse_init_out:"
|
||||
" major={};"
|
||||
" minor={};"
|
||||
" max_readahead={};"
|
||||
" max_background={};"
|
||||
" congestion_threshold={};"
|
||||
" max_write={};"
|
||||
" time_gran={};"
|
||||
" max_pages={};"
|
||||
" map_alignment={};"
|
||||
" max_stack_depth={};"
|
||||
" flags=(",
|
||||
arg_->major,
|
||||
arg_->minor,
|
||||
arg_->max_pages);
|
||||
arg_->max_readahead,
|
||||
arg_->max_background,
|
||||
arg_->congestion_threshold,
|
||||
arg_->max_write,
|
||||
arg_->time_gran,
|
||||
arg_->max_pages,
|
||||
arg_->map_alignment,
|
||||
arg_->max_stack_depth);
|
||||
|
||||
for(uint64_t i = 0; i < (sizeof(flags)*8); i++)
|
||||
{
|
||||
|
||||
@@ -4165,14 +4165,14 @@ fuse_new_common(struct fuse_chan *ch,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct fuse*
|
||||
fuse_new(struct fuse_chan *ch,
|
||||
struct fuse_args *args,
|
||||
const struct fuse_operations *op,
|
||||
size_t op_size)
|
||||
{
|
||||
return fuse_new_common(ch,args,op,op_size);
|
||||
}
|
||||
// struct fuse*
|
||||
// fuse_new(struct fuse_chan *ch,
|
||||
// struct fuse_args *args,
|
||||
// const struct fuse_operations *op,
|
||||
// size_t op_size)
|
||||
// {
|
||||
// return fuse_new_common(ch,args,op,op_size);
|
||||
// }
|
||||
|
||||
void
|
||||
fuse_destroy(struct fuse *f)
|
||||
|
||||
@@ -69,6 +69,7 @@ struct fuse_ll
|
||||
int broken_splice_nonblock;
|
||||
uint64_t notify_ctr;
|
||||
struct fuse_notify_req notify_list;
|
||||
int passthrough_max_stack_depth;
|
||||
};
|
||||
|
||||
struct fuse_cmd
|
||||
|
||||
@@ -1117,7 +1117,7 @@ do_init(fuse_req_t req,
|
||||
struct fuse_in_header *hdr_)
|
||||
{
|
||||
struct fuse_init_out outarg = {0};
|
||||
struct fuse_init_in *arg = (struct fuse_init_in *) &hdr_[1];
|
||||
struct fuse_init_in *arg = (struct fuse_init_in*)&hdr_[1];
|
||||
struct fuse_ll *f = req->f;
|
||||
size_t bufsize = fuse_chan_bufsize(req->ch);
|
||||
uint64_t inargflags;
|
||||
@@ -1288,7 +1288,7 @@ do_init(fuse_req_t req,
|
||||
if(f->conn.want & FUSE_CAP_PASSTHROUGH)
|
||||
{
|
||||
outargflags |= FUSE_PASSTHROUGH;
|
||||
outarg.max_stack_depth = 2;
|
||||
outarg.max_stack_depth = (f->passthrough_max_stack_depth + 1);
|
||||
}
|
||||
|
||||
if(inargflags & FUSE_INIT_EXT)
|
||||
@@ -1800,6 +1800,7 @@ enum {
|
||||
|
||||
static const struct fuse_opt fuse_ll_opts[] =
|
||||
{
|
||||
{ "passthrough-max-stack-depth=%u", offsetof(struct fuse_ll, passthrough_max_stack_depth), 0 },
|
||||
{ "debug", offsetof(struct fuse_ll, debug), 1 },
|
||||
{ "-d", offsetof(struct fuse_ll, debug), 1 },
|
||||
{ "max_readahead=%u", offsetof(struct fuse_ll, conn.max_readahead), 0 },
|
||||
|
||||
@@ -65,6 +65,7 @@ namespace l
|
||||
IFERT("kernel-permissions-check");
|
||||
IFERT("mount");
|
||||
IFERT("nullrw");
|
||||
IFERT("passthrough-max-stack-depth");
|
||||
IFERT("pid");
|
||||
IFERT("pin-threads");
|
||||
IFERT("process-thread-count");
|
||||
@@ -204,6 +205,7 @@ Config::Config()
|
||||
_map["nfsopenhack"] = &nfsopenhack;
|
||||
_map["nullrw"] = &nullrw;
|
||||
_map["passthrough"] = &passthrough;
|
||||
_map["passthrough-max-stack-depth"] = &passthrough_max_stack_depth;
|
||||
_map["pid"] = &pid;
|
||||
_map["parallel-direct-writes"] = ¶llel_direct_writes;
|
||||
_map["pin-threads"] = &fuse_pin_threads;
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
#include <sys/stat.h>
|
||||
|
||||
typedef ToFromWrapper<bool> ConfigBOOL;
|
||||
typedef ToFromWrapper<uint32_t> ConfigUINT32;
|
||||
typedef ToFromWrapper<uint64_t> ConfigUINT64;
|
||||
typedef ToFromWrapper<int64_t> ConfigS64;
|
||||
typedef ToFromWrapper<int> ConfigINT;
|
||||
@@ -124,6 +125,7 @@ public:
|
||||
NFSOpenHack nfsopenhack;
|
||||
ConfigBOOL nullrw;
|
||||
Passthrough passthrough = Passthrough::ENUM::OFF;
|
||||
ConfigUINT32 passthrough_max_stack_depth = 1;
|
||||
ConfigBOOL parallel_direct_writes;
|
||||
ConfigGetPid pid;
|
||||
ConfigBOOL posix_acl;
|
||||
|
||||
@@ -65,6 +65,53 @@ str::from(const std::string_view val_,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
str::from(const std::string_view val_,
|
||||
uint32_t *rv_)
|
||||
{
|
||||
uint64_t tmp;
|
||||
const int base = 10;
|
||||
|
||||
auto [ptr,ec] = std::from_chars(val_.begin(),
|
||||
val_.end(),
|
||||
tmp,
|
||||
base);
|
||||
|
||||
if(ec != std::errc{})
|
||||
return -EINVAL;
|
||||
*rv_ = tmp;
|
||||
if(ptr == val_.end())
|
||||
return 0;
|
||||
|
||||
switch(*ptr)
|
||||
{
|
||||
case 'b':
|
||||
case 'B':
|
||||
*rv_ *= 1ULL;
|
||||
break;
|
||||
|
||||
case 'k':
|
||||
case 'K':
|
||||
*rv_ *= 1024ULL;
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
case 'M':
|
||||
*rv_ *= (1024ULL * 1024ULL);
|
||||
break;
|
||||
|
||||
case 'g':
|
||||
case 'G':
|
||||
*rv_ *= (1024ULL * 1024ULL * 1024ULL);
|
||||
break;
|
||||
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
str::from(const std::string_view val_,
|
||||
int64_t *rv_)
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace str
|
||||
{
|
||||
int from(const std::string_view, bool *);
|
||||
int from(const std::string_view, int *);
|
||||
int from(const std::string_view, uint32_t *);
|
||||
int from(const std::string_view, uint64_t *);
|
||||
int from(const std::string_view, int64_t *);
|
||||
int from(const std::string_view, std::string *);
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#include "mergerfs_fsck.hpp"
|
||||
#include "mergerfs_collect_info.hpp"
|
||||
|
||||
#include "CLI11.hpp"
|
||||
|
||||
#include "fs_path.hpp"
|
||||
#include "fs_readahead.hpp"
|
||||
#include "fs_umount2.hpp"
|
||||
|
||||
+87
-66
@@ -53,6 +53,12 @@ enum
|
||||
MERGERFS_OPT_VERSION
|
||||
};
|
||||
|
||||
struct OptParseState
|
||||
{
|
||||
std::vector<std::string> opts;
|
||||
std::vector<std::string> branches;
|
||||
Config::ErrVec *errs;
|
||||
};
|
||||
|
||||
static
|
||||
void
|
||||
@@ -79,30 +85,29 @@ _set_kv_option(const std::string &key_,
|
||||
|
||||
static
|
||||
void
|
||||
_set_fuse_threads(Config &cfg_)
|
||||
_set_fuse_threads()
|
||||
{
|
||||
fuse_config_set_read_thread_count(cfg_.fuse_read_thread_count);
|
||||
fuse_config_set_process_thread_count(cfg_.fuse_process_thread_count);
|
||||
fuse_config_set_process_thread_queue_depth(cfg_.fuse_process_thread_queue_depth);
|
||||
fuse_config_set_pin_threads(cfg_.fuse_pin_threads);
|
||||
fuse_config_set_read_thread_count(cfg.fuse_read_thread_count);
|
||||
fuse_config_set_process_thread_count(cfg.fuse_process_thread_count);
|
||||
fuse_config_set_process_thread_queue_depth(cfg.fuse_process_thread_queue_depth);
|
||||
fuse_config_set_pin_threads(cfg.fuse_pin_threads);
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
_set_fsname(Config &cfg_,
|
||||
fuse_args *args_)
|
||||
_set_fsname(fuse_args *args_)
|
||||
{
|
||||
if(cfg_.fsname->empty())
|
||||
if(cfg.fsname->empty())
|
||||
{
|
||||
std::vector<std::string> paths;
|
||||
|
||||
cfg_.branches->to_paths(paths);
|
||||
cfg.branches->to_paths(paths);
|
||||
|
||||
if(paths.size() > 0)
|
||||
cfg_.fsname = str::remove_common_prefix_and_join(paths,':');
|
||||
cfg.fsname = str::remove_common_prefix_and_join(paths,':');
|
||||
}
|
||||
|
||||
::_set_kv_option("fsname",cfg_.fsname,args_);
|
||||
::_set_kv_option("fsname",cfg.fsname,args_);
|
||||
}
|
||||
|
||||
static
|
||||
@@ -114,10 +119,9 @@ _set_subtype(fuse_args *args_)
|
||||
|
||||
static
|
||||
void
|
||||
_set_default_options(fuse_args *args_,
|
||||
Config &cfg_)
|
||||
_set_default_options(fuse_args *args_)
|
||||
{
|
||||
if(cfg_.kernel_permissions_check)
|
||||
if(cfg.kernel_permissions_check)
|
||||
::_set_option("default_permissions",args_);
|
||||
|
||||
if(geteuid() == 0)
|
||||
@@ -158,8 +162,7 @@ _should_ignore(const std::string &key_)
|
||||
|
||||
static
|
||||
int
|
||||
_parse_and_process_kv_arg(Config &cfg_,
|
||||
Config::ErrVec *errs_,
|
||||
_parse_and_process_kv_arg(Config::ErrVec *errs_,
|
||||
const std::string &key_,
|
||||
const std::string &val_)
|
||||
{
|
||||
@@ -169,7 +172,7 @@ _parse_and_process_kv_arg(Config &cfg_,
|
||||
|
||||
rv = 0;
|
||||
if(key == "config")
|
||||
return ((cfg_.from_file(val_,errs_) < 0) ? 1 : 0);
|
||||
return ((cfg.from_file(val_,errs_) < 0) ? 1 : 0);
|
||||
ef(key == "attr_timeout")
|
||||
key = "cache.attr";
|
||||
ef(key == "entry_timeout")
|
||||
@@ -189,10 +192,10 @@ _parse_and_process_kv_arg(Config &cfg_,
|
||||
ef(::_should_ignore(key_))
|
||||
return 0;
|
||||
|
||||
if(cfg_.has_key(key) == false)
|
||||
if(cfg.has_key(key) == false)
|
||||
return 1;
|
||||
|
||||
rv = cfg_.set_raw(key,val);
|
||||
rv = cfg.set_raw(key,val);
|
||||
if(rv)
|
||||
errs_->push_back({rv,key+'='+val});
|
||||
|
||||
@@ -201,9 +204,8 @@ _parse_and_process_kv_arg(Config &cfg_,
|
||||
|
||||
static
|
||||
int
|
||||
_process_opt(Config &cfg_,
|
||||
Config::ErrVec *errs_,
|
||||
const std::string &arg_)
|
||||
_process_opt(Config::ErrVec *errs_,
|
||||
const std::string &arg_)
|
||||
{
|
||||
std::string key;
|
||||
std::string val;
|
||||
@@ -212,20 +214,19 @@ _process_opt(Config &cfg_,
|
||||
key = str::trim(key);
|
||||
val = str::trim(val);
|
||||
|
||||
return ::_parse_and_process_kv_arg(cfg_,errs_,key,val);
|
||||
return ::_parse_and_process_kv_arg(errs_,key,val);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
_process_branches(Config &cfg_,
|
||||
Config::ErrVec *errs_,
|
||||
const char *arg_)
|
||||
_process_branches(Config::ErrVec *errs_,
|
||||
const char *arg_)
|
||||
{
|
||||
int rv;
|
||||
std::string arg;
|
||||
|
||||
arg = arg_;
|
||||
rv = cfg_.set_raw("branches",arg);
|
||||
rv = cfg.set_raw("branches",arg);
|
||||
if(rv)
|
||||
errs_->push_back({rv,"branches="+arg});
|
||||
|
||||
@@ -234,15 +235,14 @@ _process_branches(Config &cfg_,
|
||||
|
||||
static
|
||||
int
|
||||
_process_mount(Config &cfg_,
|
||||
Config::ErrVec *errs_,
|
||||
const char *arg_)
|
||||
_process_mount(Config::ErrVec *errs_,
|
||||
const char *arg_)
|
||||
{
|
||||
int rv;
|
||||
std::string arg;
|
||||
|
||||
arg = arg_;
|
||||
rv = cfg_.set_raw("mount",arg);
|
||||
rv = cfg.set_raw("mount",arg);
|
||||
if(rv)
|
||||
errs_->push_back({rv,"mount="+arg});
|
||||
|
||||
@@ -251,26 +251,26 @@ _process_mount(Config &cfg_,
|
||||
|
||||
static
|
||||
void
|
||||
_postprocess_passthrough(Config &cfg_)
|
||||
_postprocess_passthrough()
|
||||
{
|
||||
if(cfg_.passthrough == Passthrough::ENUM::OFF)
|
||||
if(cfg.passthrough == Passthrough::ENUM::OFF)
|
||||
return;
|
||||
|
||||
if(cfg_.cache_files == CacheFiles::ENUM::OFF)
|
||||
if(cfg.cache_files == CacheFiles::ENUM::OFF)
|
||||
{
|
||||
SysLog::warning("'cache.files' can not be 'off' when using 'passthrough'."
|
||||
" Setting 'cache.files=full'");
|
||||
cfg_.cache_files = CacheFiles::ENUM::FULL;
|
||||
cfg.cache_files = CacheFiles::ENUM::FULL;
|
||||
}
|
||||
|
||||
if(cfg_.writeback_cache == true)
|
||||
if(cfg.writeback_cache == true)
|
||||
{
|
||||
SysLog::warning("'cache.writeback' can not be enabled when using 'passthrough'."
|
||||
" Setting 'cache.writeback=false'");
|
||||
cfg_.writeback_cache = false;
|
||||
cfg.writeback_cache = false;
|
||||
}
|
||||
|
||||
if(cfg_.moveonenospc.enabled == true)
|
||||
if(cfg.moveonenospc.enabled == true)
|
||||
{
|
||||
SysLog::warning("`moveonenospc` will not function when `passthrough` is enabled");
|
||||
}
|
||||
@@ -292,18 +292,16 @@ _option_processor(void *data_,
|
||||
int key_,
|
||||
fuse_args *outargs_)
|
||||
{
|
||||
Config::ErrVec *errs = (Config::ErrVec*)data_;
|
||||
OptParseState &state = *(OptParseState*)data_;
|
||||
|
||||
switch(key_)
|
||||
{
|
||||
case FUSE_OPT_KEY_OPT:
|
||||
return ::_process_opt(cfg,errs,arg_);
|
||||
return ::_process_opt(state.errs,arg_);
|
||||
|
||||
case FUSE_OPT_KEY_NONOPT:
|
||||
if(cfg.branches->empty())
|
||||
return ::_process_branches(cfg,errs,arg_);
|
||||
else
|
||||
return ::_process_mount(cfg,errs,arg_);
|
||||
state.branches.push_back(arg_);
|
||||
return 0;
|
||||
|
||||
case MERGERFS_OPT_HELP:
|
||||
::_usage();
|
||||
@@ -341,15 +339,14 @@ _option_processor(void *data_,
|
||||
|
||||
static
|
||||
void
|
||||
_check_for_mount_loop(Config &cfg_,
|
||||
Config::ErrVec *errs_)
|
||||
_check_for_mount_loop(Config::ErrVec *errs_)
|
||||
{
|
||||
fs::path mount;
|
||||
std::vector<fs::path> branches;
|
||||
std::error_code ec;
|
||||
|
||||
mount = *cfg_.mountpoint;
|
||||
branches = cfg_.branches->to_paths();
|
||||
mount = *cfg.mountpoint;
|
||||
branches = cfg.branches->to_paths();
|
||||
for(const auto &branch : branches)
|
||||
{
|
||||
if(std::filesystem::equivalent(branch,mount,ec))
|
||||
@@ -365,25 +362,25 @@ _check_for_mount_loop(Config &cfg_,
|
||||
|
||||
static
|
||||
void
|
||||
_print_warnings(Config &cfg_)
|
||||
_print_warnings()
|
||||
{
|
||||
if(cfg_.passthrough != Passthrough::ENUM::OFF)
|
||||
if(cfg.passthrough != Passthrough::ENUM::OFF)
|
||||
{
|
||||
if(cfg_.cache_files == CacheFiles::ENUM::OFF)
|
||||
if(cfg.cache_files == CacheFiles::ENUM::OFF)
|
||||
{
|
||||
SysLog::warning("'cache.files' can not be 'off' when using 'passthrough'."
|
||||
" Setting 'cache.files=auto-full'");
|
||||
cfg_.cache_files = CacheFiles::ENUM::AUTO_FULL;
|
||||
cfg.cache_files = CacheFiles::ENUM::AUTO_FULL;
|
||||
}
|
||||
|
||||
if(cfg_.writeback_cache == true)
|
||||
if(cfg.writeback_cache == true)
|
||||
{
|
||||
SysLog::warning("'cache.writeback' can not be enabled when using 'passthrough'."
|
||||
" Setting 'cache.writeback=false'");
|
||||
cfg_.writeback_cache = false;
|
||||
cfg.writeback_cache = false;
|
||||
}
|
||||
|
||||
if(cfg_.moveonenospc.enabled == true)
|
||||
if(cfg.moveonenospc.enabled == true)
|
||||
{
|
||||
SysLog::warning("`moveonenospc` will not function when `passthrough` is enabled");
|
||||
}
|
||||
@@ -392,10 +389,10 @@ _print_warnings(Config &cfg_)
|
||||
|
||||
static
|
||||
void
|
||||
_cleanup_options(Config &cfg_)
|
||||
_cleanup_options()
|
||||
{
|
||||
if(!cfg_.symlinkify)
|
||||
cfg_.symlinkify_timeout = -1;
|
||||
if(!cfg.symlinkify)
|
||||
cfg.symlinkify_timeout = -1;
|
||||
}
|
||||
|
||||
namespace options
|
||||
@@ -413,25 +410,49 @@ namespace options
|
||||
FUSE_OPT_KEY("--version",MERGERFS_OPT_VERSION),
|
||||
{NULL,-1U,0}
|
||||
};
|
||||
OptParseState state{.errs=errs_};
|
||||
|
||||
fuse_opt_parse(args_,
|
||||
errs_,
|
||||
&state,
|
||||
opts,
|
||||
::_option_processor);
|
||||
|
||||
if(state.branches.size() < 2)
|
||||
errs_->push_back({0,"mountpoint not set"});
|
||||
if(state.branches.size() < 1)
|
||||
errs_->push_back({0,"branches not set"});
|
||||
if(!errs_->empty())
|
||||
return;
|
||||
|
||||
_process_mount(errs_,
|
||||
state.branches.back().c_str());
|
||||
|
||||
state.branches.pop_back();
|
||||
_process_branches(errs_,
|
||||
str::join(state.branches,':').c_str());
|
||||
|
||||
if(cfg.branches->empty())
|
||||
errs_->push_back({0,"branches not set"});
|
||||
if(cfg.mountpoint->empty())
|
||||
errs_->push_back({0,"mountpoint not set"});
|
||||
::_check_for_mount_loop(errs_);
|
||||
if(!errs_->empty())
|
||||
return;
|
||||
|
||||
::_postprocess_passthrough(cfg);
|
||||
::_check_for_mount_loop(cfg,errs_);
|
||||
::_set_default_options(args_,cfg);
|
||||
::_set_fsname(cfg,args_);
|
||||
fuse_opt_add_arg(args_,
|
||||
cfg.mountpoint.to_string().c_str());
|
||||
|
||||
::_postprocess_passthrough();
|
||||
::_set_default_options(args_);
|
||||
::_set_fsname(args_);
|
||||
::_set_subtype(args_);
|
||||
::_set_fuse_threads(cfg);
|
||||
::_print_warnings(cfg);
|
||||
::_cleanup_options(cfg);
|
||||
::_set_fuse_threads();
|
||||
::_print_warnings();
|
||||
::_cleanup_options();
|
||||
|
||||
_set_option(fmt::format("passthrough-max-stack-depth={}",
|
||||
cfg.passthrough_max_stack_depth.to_string()),
|
||||
args_);
|
||||
|
||||
cfg.finish_initializing();
|
||||
}
|
||||
|
||||
@@ -36,6 +36,12 @@ str::to(const int int_)
|
||||
return fmt::format("{}",int_);
|
||||
}
|
||||
|
||||
std::string
|
||||
str::to(const uint32_t i_)
|
||||
{
|
||||
return fmt::format("{}",i_);
|
||||
}
|
||||
|
||||
std::string
|
||||
str::to(const uint64_t uint64_)
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace str
|
||||
{
|
||||
std::string to(const bool);
|
||||
std::string to(const int);
|
||||
std::string to(const uint32_t);
|
||||
std::string to(const uint64_t);
|
||||
std::string to(const int64_t);
|
||||
std::string to(const std::string&);
|
||||
|
||||
Reference in New Issue
Block a user