2014-05-12 12:41:46 -04:00
|
|
|
/*
|
2016-01-14 16:50:22 -05:00
|
|
|
Copyright (c) 2016, 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.
|
2014-05-12 12:41:46 -04:00
|
|
|
*/
|
|
|
|
|
2017-06-30 11:15:20 -04:00
|
|
|
#pragma once
|
2014-05-12 12:41:46 -04:00
|
|
|
|
2014-09-26 18:31:22 -04:00
|
|
|
#include <fuse.h>
|
|
|
|
|
2014-05-12 12:41:46 -04:00
|
|
|
#include <sys/stat.h>
|
2015-06-16 22:12:55 -04:00
|
|
|
#include <stdint.h>
|
2014-05-12 12:41:46 -04:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "policy.hpp"
|
2015-02-19 09:09:24 -05:00
|
|
|
#include "fusefunc.hpp"
|
2014-05-12 12:41:46 -04:00
|
|
|
|
|
|
|
namespace mergerfs
|
|
|
|
{
|
2015-07-21 14:19:17 -04:00
|
|
|
class Config
|
2014-05-12 12:41:46 -04:00
|
|
|
{
|
2015-07-21 14:19:17 -04:00
|
|
|
public:
|
|
|
|
Config();
|
|
|
|
|
|
|
|
public:
|
|
|
|
int set_func_policy(const std::string &fusefunc_,
|
|
|
|
const std::string &policy_);
|
|
|
|
int set_category_policy(const std::string &category,
|
|
|
|
const std::string &policy);
|
|
|
|
|
|
|
|
public:
|
|
|
|
std::string destmount;
|
|
|
|
std::vector<std::string> srcmounts;
|
|
|
|
mutable pthread_rwlock_t srcmountslock;
|
2016-07-10 12:44:29 -04:00
|
|
|
uint64_t minfreespace;
|
2015-09-15 18:49:18 -04:00
|
|
|
bool moveonenospc;
|
2016-12-20 17:06:34 -05:00
|
|
|
bool direct_io;
|
2017-02-18 13:45:43 -05:00
|
|
|
bool dropcacheonclose;
|
2017-04-24 06:57:29 -04:00
|
|
|
bool symlinkify;
|
|
|
|
time_t symlinkify_timeout;
|
2017-05-26 16:51:30 -04:00
|
|
|
bool nullrw;
|
2017-06-29 23:57:15 -04:00
|
|
|
bool ignorepponrename;
|
2018-09-30 19:47:44 -04:00
|
|
|
bool security_capability;
|
2015-07-21 14:19:17 -04:00
|
|
|
|
|
|
|
public:
|
|
|
|
const Policy *policies[FuseFunc::Enum::END];
|
|
|
|
const Policy *&access;
|
|
|
|
const Policy *&chmod;
|
|
|
|
const Policy *&chown;
|
|
|
|
const Policy *&create;
|
|
|
|
const Policy *&getattr;
|
|
|
|
const Policy *&getxattr;
|
|
|
|
const Policy *&link;
|
|
|
|
const Policy *&listxattr;
|
|
|
|
const Policy *&mkdir;
|
|
|
|
const Policy *&mknod;
|
|
|
|
const Policy *&open;
|
|
|
|
const Policy *&readlink;
|
|
|
|
const Policy *&removexattr;
|
|
|
|
const Policy *&rename;
|
|
|
|
const Policy *&rmdir;
|
|
|
|
const Policy *&setxattr;
|
|
|
|
const Policy *&symlink;
|
|
|
|
const Policy *&truncate;
|
|
|
|
const Policy *&unlink;
|
|
|
|
const Policy *&utimens;
|
|
|
|
|
|
|
|
public:
|
|
|
|
const std::string controlfile;
|
|
|
|
|
|
|
|
public:
|
2017-04-11 08:53:46 -04:00
|
|
|
static
|
|
|
|
const
|
|
|
|
Config &
|
|
|
|
get(void)
|
|
|
|
{
|
|
|
|
const fuse_context *fc = fuse_get_context();
|
|
|
|
|
|
|
|
return get(fc);
|
|
|
|
}
|
|
|
|
|
2015-07-21 14:19:17 -04:00
|
|
|
static
|
|
|
|
const Config &
|
|
|
|
get(const fuse_context *fc)
|
2014-05-12 12:41:46 -04:00
|
|
|
{
|
2015-07-21 14:19:17 -04:00
|
|
|
return *((Config*)fc->private_data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static
|
|
|
|
Config &
|
|
|
|
get_writable(void)
|
|
|
|
{
|
|
|
|
return (*((Config*)fuse_get_context()->private_data));
|
|
|
|
}
|
|
|
|
};
|
2014-05-12 12:41:46 -04:00
|
|
|
}
|