|
@ -19,6 +19,8 @@ |
|
|
|
|
|
|
|
|
#include "fuse.h"
|
|
|
#include "fuse.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace l |
|
|
namespace l |
|
|
{ |
|
|
{ |
|
@ -41,40 +43,24 @@ namespace l |
|
|
static |
|
|
static |
|
|
void |
|
|
void |
|
|
want_if_capable(fuse_conn_info *conn_, |
|
|
want_if_capable(fuse_conn_info *conn_, |
|
|
const int flag_) |
|
|
|
|
|
|
|
|
const int flag_, |
|
|
|
|
|
const char *str_) |
|
|
{ |
|
|
{ |
|
|
if(capable(conn_,flag_)) |
|
|
if(capable(conn_,flag_)) |
|
|
want(conn_,flag_); |
|
|
want(conn_,flag_); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static |
|
|
|
|
|
void |
|
|
|
|
|
want_if_capable(fuse_conn_info *conn_, |
|
|
|
|
|
const int flag_, |
|
|
|
|
|
bool *want_) |
|
|
|
|
|
{ |
|
|
|
|
|
if(*want_ && l::capable(conn_,flag_)) |
|
|
|
|
|
{ |
|
|
|
|
|
l::want(conn_,flag_); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
*want_ = false; |
|
|
|
|
|
|
|
|
else |
|
|
|
|
|
fprintf(stderr,"mergerfs: warning - want to enable %s but not available\n",str_); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
static |
|
|
static |
|
|
void |
|
|
void |
|
|
want_if_capable_max_pages(fuse_conn_info *conn_, |
|
|
want_if_capable_max_pages(fuse_conn_info *conn_, |
|
|
State &s_) |
|
|
|
|
|
|
|
|
uint64_t max_pages_) |
|
|
{ |
|
|
{ |
|
|
if(l::capable(conn_,FUSE_CAP_MAX_PAGES)) |
|
|
if(l::capable(conn_,FUSE_CAP_MAX_PAGES)) |
|
|
{ |
|
|
{ |
|
|
l::want(conn_,FUSE_CAP_MAX_PAGES); |
|
|
l::want(conn_,FUSE_CAP_MAX_PAGES); |
|
|
conn_->max_pages = s_->fuse_msg_size; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
s_->fuse_msg_size = FUSE_DEFAULT_MAX_PAGES_PER_REQ; |
|
|
|
|
|
|
|
|
conn_->max_pages = max_pages_; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -90,28 +76,35 @@ namespace FUSE::INIT |
|
|
bool wb_cache; |
|
|
bool wb_cache; |
|
|
bool readdirplus; |
|
|
bool readdirplus; |
|
|
bool cache_symlinks; |
|
|
bool cache_symlinks; |
|
|
|
|
|
uint64_t max_pages; |
|
|
|
|
|
|
|
|
|
|
|
async_read = toml::find_or(s->toml,"fuse","async-read",true); |
|
|
|
|
|
posix_acl = toml::find_or(s->toml,"fuse","posix-acl",false); |
|
|
|
|
|
wb_cache = toml::find_or(s->toml,"cache","writeback",false); |
|
|
|
|
|
readdirplus = toml::find_or(s->toml,"func","readdir","readdirplus",false); |
|
|
|
|
|
cache_symlinks = toml::find_or(s->toml,"cache","symlinks",false); |
|
|
|
|
|
max_pages = toml::find_or(s->toml,"fuse","message-size",256); |
|
|
|
|
|
|
|
|
async_read = toml::find_or(s->config_toml,"fuse","async-read",true); |
|
|
|
|
|
posix_acl = toml::find_or(s->config_toml,"fuse","posix-acl",false); |
|
|
|
|
|
wb_cache = toml::find_or(s->config_toml,"cache","writeback",false); |
|
|
|
|
|
readdirplus = toml::find_or(s->config_toml,"func","readdir","readdirplus",false); |
|
|
|
|
|
cache_symlinks = toml::find_or(s->config_toml,"cache","symlinks",false); |
|
|
|
|
|
|
|
|
|
|
|
ugid::init(); |
|
|
ugid::init(); |
|
|
|
|
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_ASYNC_DIO); |
|
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_ASYNC_READ,&async_read); |
|
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_ATOMIC_O_TRUNC); |
|
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_BIG_WRITES); |
|
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_CACHE_SYMLINKS,&cache_symlinks); |
|
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_DONT_MASK); |
|
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_IOCTL_DIR); |
|
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_PARALLEL_DIROPS); |
|
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_READDIR_PLUS,&readdirplus); |
|
|
|
|
|
//l::want_if_capable(conn_,FUSE_CAP_READDIR_PLUS_AUTO);
|
|
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_POSIX_ACL,&posix_acl); |
|
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_WRITEBACK_CACHE,&wb_cache); |
|
|
|
|
|
l::want_if_capable_max_pages(conn_,s); |
|
|
|
|
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_ASYNC_DIO,"ASYNC_DIO"); |
|
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_ATOMIC_O_TRUNC,"ATOMIC_O_TRUNC"); |
|
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_BIG_WRITES,"BIG_WRITES"); |
|
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_DONT_MASK,"DONT_MASK"); |
|
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_IOCTL_DIR,"IOCTL_DIR"); |
|
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_PARALLEL_DIROPS,"PARALLEL_DIROPS"); |
|
|
|
|
|
l::want_if_capable_max_pages(conn_,max_pages); |
|
|
|
|
|
//l::want_if_capable(conn_,FUSE_CAP_READDIR_PLUS_AUTO,"READIR_PLUS_AUTO");
|
|
|
|
|
|
if(async_read) |
|
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_ASYNC_READ,"ASYNC_READ"); |
|
|
|
|
|
if(cache_symlinks) |
|
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_CACHE_SYMLINKS,"CACHE_SYMLINKS"); |
|
|
|
|
|
if(readdirplus) |
|
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_READDIR_PLUS,"READDIR_PLUS"); |
|
|
|
|
|
if(posix_acl) |
|
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_POSIX_ACL,"POSIX_ACL"); |
|
|
|
|
|
if(wb_cache) |
|
|
|
|
|
l::want_if_capable(conn_,FUSE_CAP_WRITEBACK_CACHE,"WRITEBACK_CACHE"); |
|
|
conn_->want &= ~FUSE_CAP_POSIX_LOCKS; |
|
|
conn_->want &= ~FUSE_CAP_POSIX_LOCKS; |
|
|
conn_->want &= ~FUSE_CAP_FLOCK_LOCKS; |
|
|
conn_->want &= ~FUSE_CAP_FLOCK_LOCKS; |
|
|
|
|
|
|
|
|