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

@ -21,6 +21,7 @@
#include "fs_path.hpp"
#include "policy.hpp"
#include "policy_error.hpp"
#include "rwlock.hpp"
#include <string>
#include <vector>
@ -32,10 +33,12 @@ namespace ff
{
static
int
create(const Branches &branches_,
const uint64_t minfreespace,
vector<const string*> &paths)
create(const Branches &branches_,
const uint64_t minfreespace,
vector<string> *paths)
{
rwlock::ReadGuard guard(&branches_.lock);
int rv;
int error;
fs::info_t info;
@ -56,7 +59,7 @@ namespace ff
if(info.spaceavail < minfreespace)
error_and_continue(error,ENOSPC);
paths.push_back(&branch->path);
paths->push_back(branch->path);
return 0;
}
@ -70,7 +73,7 @@ Policy::Func::ff(const Category::Enum::Type type,
const Branches &branches_,
const char *fusepath,
const uint64_t minfreespace,
vector<const string*> &paths)
vector<string> *paths)
{
if(type == Category::Enum::create)
return ff::create(branches_,minfreespace,paths);