rework config management

* Add standard way to do str2val and val2str conversion
* Add support for a config file
* Add support for reading and writing settings via ioctl
This commit is contained in:
Antonio SJ Musumeci 2019-09-24 10:27:46 -04:00
parent 8d989777f8
commit 54c41c4994
90 changed files with 3292 additions and 2619 deletions

View file

@ -19,7 +19,6 @@
#include "fs_base_chown.hpp"
#include "fs_path.hpp"
#include "rv.hpp"
#include "rwlock.hpp"
#include "ugid.hpp"
#include <fuse.h>
@ -34,7 +33,7 @@ namespace l
{
static
int
chown_loop_core(const string *basepath_,
chown_loop_core(const string &basepath_,
const char *fusepath_,
const uid_t uid_,
const gid_t gid_,
@ -52,10 +51,10 @@ namespace l
static
int
chown_loop(const vector<const string*> &basepaths_,
const char *fusepath_,
const uid_t uid_,
const gid_t gid_)
chown_loop(const vector<string> &basepaths_,
const char *fusepath_,
const uid_t uid_,
const gid_t gid_)
{
int error;
@ -78,9 +77,9 @@ namespace l
const gid_t gid_)
{
int rv;
vector<const string*> basepaths;
vector<string> basepaths;
rv = actionFunc_(branches_,fusepath_,minfreespace_,basepaths);
rv = actionFunc_(branches_,fusepath_,minfreespace_,&basepaths);
if(rv == -1)
return -errno;
@ -95,12 +94,11 @@ namespace FUSE
uid_t uid_,
gid_t gid_)
{
const fuse_context *fc = fuse_get_context();
const Config &config = Config::get(fc);
const ugid::Set ugid(fc->uid,fc->gid);
const rwlock::ReadGuard readlock(&config.branches_lock);
const fuse_context *fc = fuse_get_context();
const Config &config = Config::ro();
const ugid::Set ugid(fc->uid,fc->gid);
return l::chown(config.chown,
return l::chown(config.func.chown.policy,
config.branches,
config.minfreespace,
fusepath_,