add link_cow feature

When enabled if a regular file is opened which has a link count > 1 it will
copy the file to a temporary file and rename over the original. Effectively
breaking the link. This behavior is similar to cow-shell and other LD_PRELOAD
based "CoW" solutions.
This commit is contained in:
Antonio SJ Musumeci 2018-10-02 14:22:37 -04:00
parent 19a7d43b31
commit 93f7d7d927
18 changed files with 424 additions and 127 deletions

View file

@ -16,17 +16,17 @@
#pragma once
#include "fusefunc.hpp"
#include "policy.hpp"
#include <fuse.h>
#include <sys/stat.h>
#include <stdint.h>
#include <sys/stat.h>
#include <string>
#include <vector>
#include "policy.hpp"
#include "fusefunc.hpp"
namespace mergerfs
{
class Config
@ -37,8 +37,8 @@ namespace mergerfs
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);
int set_category_policy(const std::string &category_,
const std::string &policy_);
public:
std::string destmount;
@ -53,6 +53,7 @@ namespace mergerfs
bool nullrw;
bool ignorepponrename;
bool security_capability;
bool link_cow;
public:
const Policy *policies[FuseFunc::Enum::END];