Browse Source

Merge pull request #138 from trapexit/defaults

include default_permissions in default arguments
pull/139/head
Antonio SJ Musumeci 9 years ago
parent
commit
9afd0654b7
  1. 2
      README.md
  2. 8
      src/getattr.cpp
  3. 18
      src/init.cpp
  4. 6
      src/ioctl.cpp
  5. 2
      src/listxattr.cpp
  6. 11
      src/option_parser.cpp
  7. 13
      src/setxattr.cpp

2
README.md

@ -20,7 +20,7 @@ Why create **mergerfs** when those exist? **mhddfs** has not been updated in som
###options###
* **defaults** is a shortcut for **auto_cache**. **big_writes**, **atomic_o_trunc**, **splice_read**, **splice_write**, and **splice_move** are in effect also enabled (by asking **FUSE** internally for such features) but if unavailable will be ignored. These options seem to provide the best performance.
* **defaults** is a shortcut for FUSE's **atomic_o_trunc**, **auto_cache*, **big_writes**, **default_permissions**, **splice_move**, **splice_read**, and **splice_write**. These options seem to provide the best performance.
* **minfreespace** (defaults to **4G**) is the minimum space value used for the **lfs**, **fwfs**, and **epmfs** policies. Understands 'K', 'M', and 'G' to represent kilobyte, megabyte, and gigabyte respectively.
* All FUSE functions which have a category (see below) are option keys. The syntax being **func.<func>=<policy>**. Example: **func.getattr=newest**.
* To set all function policies in a category use **category.<category>=<policy>**. Example: **category.create=mfs**.

8
src/getattr.cpp

@ -45,14 +45,16 @@ static
int
_getattr_controlfile(struct stat &buf)
{
time_t now = time(NULL);
static const uid_t uid = ::getuid();
static const gid_t gid = ::getgid();
static const time_t now = ::time(NULL);
buf.st_dev = 0;
buf.st_ino = 0;
buf.st_mode = (S_IFREG|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH);
buf.st_nlink = 1;
buf.st_uid = ::getuid();
buf.st_gid = ::getgid();
buf.st_uid = uid;
buf.st_gid = gid;
buf.st_rdev = 0;
buf.st_size = 0;
buf.st_blksize = 1024;

18
src/init.cpp

@ -36,27 +36,9 @@ namespace mergerfs
{
ugid::init();
#ifdef FUSE_CAP_ASYNC_READ
conn->want |= FUSE_CAP_ASYNC_READ;
#endif
#ifdef FUSE_CAP_IOCTL_DIR
conn->want |= FUSE_CAP_IOCTL_DIR;
#endif
#ifdef FUSE_CAP_ATOMIC_O_TRUNC
conn->want |= FUSE_CAP_ATOMIC_O_TRUNC;
#endif
#ifdef FUSE_CAP_BIG_WRITES
conn->want |= FUSE_CAP_BIG_WRITES;
#endif
#ifdef FUSE_CAP_SPLICE_WRITE
conn->want |= FUSE_CAP_SPLICE_WRITE;
#endif
#ifdef FUSE_CAP_SPLICE_READ
conn->want |= FUSE_CAP_SPLICE_READ;
#endif
#ifdef FUSE_CAP_SPLICE_MOVE
conn->want |= FUSE_CAP_SPLICE_MOVE;
#endif
return &Config::get_writable();
}

6
src/ioctl.cpp

@ -41,9 +41,9 @@ using namespace mergerfs;
static
int
_ioctl(const int fd,
const int cmd,
void *data)
_ioctl(const int fd,
const int cmd,
void *data)
{
int rv;

2
src/listxattr.cpp

@ -56,7 +56,7 @@ _listxattr_controlfile(char *list,
("user.mergerfs.policies")
("user.mergerfs.version");
xattrs.reserve(512);
xattrs.reserve(1024);
for(size_t i = 0; i < strs.size(); i++)
xattrs += (strs[i] + '\0');
for(size_t i = Category::Enum::BEGIN; i < Category::Enum::END; i++)

11
src/option_parser.cpp

@ -94,12 +94,13 @@ static
void
set_default_options(fuse_args &args)
{
// set_option(args,"big_writes");
// set_option(args,"splice_read");
// set_option(args,"splice_write");
// set_option(args,"splice_move");
set_option(args,"atomic_o_trunc");
set_option(args,"auto_cache");
// set_option(args,"atomic_o_trunc");
set_option(args,"big_writes");
set_option(args,"default_permissions");
set_option(args,"splice_move");
set_option(args,"splice_read");
set_option(args,"splice_write");
}
static

13
src/setxattr.cpp

@ -313,15 +313,10 @@ namespace mergerfs
const Config &config = Config::get(fc);
if(fusepath == config.controlfile)
{
if((fc->uid != ::getuid()) && (fc->gid != ::getgid()))
return -EPERM;
return _setxattr_controlfile(Config::get_writable(),
attrname,
string(attrval,attrvalsize),
flags);
}
return _setxattr_controlfile(Config::get_writable(),
attrname,
string(attrval,attrvalsize),
flags);
const ugid::Set ugid(fc->uid,fc->gid);
const rwlock::ReadGuard readlock(&config.srcmountslock);

Loading…
Cancel
Save