mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-12-01 12:26:34 -05:00
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:
parent
19a7d43b31
commit
93f7d7d927
18 changed files with 424 additions and 127 deletions
|
|
@ -18,30 +18,49 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace fs
|
||||
{
|
||||
static
|
||||
inline
|
||||
int
|
||||
open(const std::string &path,
|
||||
const int flags)
|
||||
open(const char *path_,
|
||||
const int flags_)
|
||||
{
|
||||
return ::open(path.c_str(),flags);
|
||||
return ::open(path_,flags_);
|
||||
}
|
||||
|
||||
static
|
||||
inline
|
||||
int
|
||||
open(const std::string &path,
|
||||
const int flags,
|
||||
const mode_t mode)
|
||||
open(const char *path_,
|
||||
const int flags_,
|
||||
const mode_t mode_)
|
||||
{
|
||||
return ::open(path.c_str(),flags,mode);
|
||||
return ::open(path_,flags_,mode_);
|
||||
}
|
||||
|
||||
static
|
||||
inline
|
||||
int
|
||||
open(const std::string &path_,
|
||||
const int flags_)
|
||||
{
|
||||
return fs::open(path_.c_str(),flags_);
|
||||
}
|
||||
|
||||
static
|
||||
inline
|
||||
int
|
||||
open(const std::string &path_,
|
||||
const int flags_,
|
||||
const mode_t mode_)
|
||||
{
|
||||
return fs::open(path_.c_str(),flags_,mode_);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue