mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-22 07:56:32 -05:00
add support for POSIX ACLs
This commit is contained in:
parent
ee0d87d712
commit
80d56ac94e
11 changed files with 78 additions and 31 deletions
|
|
@ -14,17 +14,17 @@
|
|||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "config.hpp"
|
||||
#include "errno.hpp"
|
||||
#include "fs.hpp"
|
||||
#include "rwlock.hpp"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#define MINFREESPACE_DEFAULT (4294967295ULL)
|
||||
#define POLICYINIT(X) X(policies[FuseFunc::Enum::X])
|
||||
|
||||
|
|
@ -48,6 +48,7 @@ Config::Config()
|
|||
xattr(0),
|
||||
statfs(StatFS::BASE),
|
||||
statfs_ignore(StatFSIgnore::NONE),
|
||||
posix_acl(false),
|
||||
POLICYINIT(access),
|
||||
POLICYINIT(chmod),
|
||||
POLICYINIT(chown),
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ public:
|
|||
int xattr;
|
||||
StatFS::Enum statfs;
|
||||
StatFSIgnore::Enum statfs_ignore;
|
||||
bool posix_acl;
|
||||
|
||||
public:
|
||||
const Policy *policies[FuseFunc::Enum::END];
|
||||
|
|
|
|||
|
|
@ -346,6 +346,8 @@ namespace l
|
|||
l::getxattr_controlfile_pid(attrvalue);
|
||||
else if(attr[2] == "direct_io")
|
||||
l::getxattr_controlfile_bool(config.direct_io,attrvalue);
|
||||
else if(attr[2] == "posix_acl")
|
||||
l::getxattr_controlfile_bool(config.posix_acl,attrvalue);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
|
|
|
|||
|
|
@ -19,6 +19,17 @@
|
|||
|
||||
#include <fuse.h>
|
||||
|
||||
namespace l
|
||||
{
|
||||
void
|
||||
want_if_capable(fuse_conn_info *conn_,
|
||||
const int flag_)
|
||||
{
|
||||
if(conn_->capable & flag_)
|
||||
conn_->want |= flag_;
|
||||
}
|
||||
}
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
void *
|
||||
|
|
@ -26,11 +37,13 @@ namespace FUSE
|
|||
{
|
||||
ugid::init();
|
||||
|
||||
conn_->want |= FUSE_CAP_ASYNC_READ;
|
||||
conn_->want |= FUSE_CAP_ATOMIC_O_TRUNC;
|
||||
conn_->want |= FUSE_CAP_BIG_WRITES;
|
||||
conn_->want |= FUSE_CAP_DONT_MASK;
|
||||
conn_->want |= FUSE_CAP_IOCTL_DIR;
|
||||
l::want_if_capable(conn_,FUSE_CAP_ASYNC_READ);
|
||||
l::want_if_capable(conn_,FUSE_CAP_ATOMIC_O_TRUNC);
|
||||
l::want_if_capable(conn_,FUSE_CAP_BIG_WRITES);
|
||||
l::want_if_capable(conn_,FUSE_CAP_DONT_MASK);
|
||||
l::want_if_capable(conn_,FUSE_CAP_IOCTL_DIR);
|
||||
if(Config::get().posix_acl)
|
||||
l::want_if_capable(conn_,FUSE_CAP_POSIX_ACL);
|
||||
|
||||
return &Config::get_writable();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ namespace l
|
|||
("user.mergerfs.nullrw")
|
||||
("user.mergerfs.pid")
|
||||
("user.mergerfs.policies")
|
||||
("user.mergerfs.posix_acl")
|
||||
("user.mergerfs.security_capability")
|
||||
("user.mergerfs.srcmounts")
|
||||
("user.mergerfs.statfs")
|
||||
|
|
|
|||
|
|
@ -305,6 +305,8 @@ parse_and_process_kv_arg(Config &config,
|
|||
rv = parse_and_process_statfsignore(value,config.statfs_ignore);
|
||||
else if(key == "fsname")
|
||||
rv = parse_and_process(value,config.fsname);
|
||||
else if(key == "posix_acl")
|
||||
rv = parse_and_process(value,config.posix_acl);
|
||||
}
|
||||
|
||||
if(rv == -1)
|
||||
|
|
@ -433,6 +435,7 @@ usage(void)
|
|||
" as 'read only' or 'no create'. 'nc' will ignore\n"
|
||||
" available space for branches tagged as\n"
|
||||
" 'no create'. default = none\n"
|
||||
" -o posix_acl=<bool> enable POSIX ACL support\n"
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue