Browse Source

Merge pull request #528 from trapexit/nc

rename NW (no write) to NC (no create)
pull/529/head
trapexit 6 years ago
committed by GitHub
parent
commit
3d33428a4e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      README.md
  2. 12
      src/branch.cpp
  3. 4
      src/branch.hpp
  4. 2
      src/policy_all.cpp
  5. 2
      src/policy_epall.cpp
  6. 2
      src/policy_epff.cpp
  7. 2
      src/policy_eplfs.cpp
  8. 2
      src/policy_eplus.cpp
  9. 2
      src/policy_epmfs.cpp
  10. 2
      src/policy_ff.cpp
  11. 2
      src/policy_lfs.cpp
  12. 2
      src/policy_lus.cpp
  13. 2
      src/policy_mfs.cpp
  14. 2
      src/policy_newest.cpp

4
README.md

@ -87,7 +87,7 @@ The 'branches' (formerly 'srcmounts') argument is a colon (':') delimited list o
To make it easier to include multiple branches mergerfs supports [globbing](http://linux.die.net/man/7/glob). **The globbing tokens MUST be escaped when using via the shell else the shell itself will apply the glob itself.** To make it easier to include multiple branches mergerfs supports [globbing](http://linux.die.net/man/7/glob). **The globbing tokens MUST be escaped when using via the shell else the shell itself will apply the glob itself.**
Each branch can have a suffix of `=RW` (read / write), `=RO` (read only), or `=NW` (no writes). These suffixes work with globs as well and will apply to each path found. `RW` is the default behavior and those paths will be eligible for all policy categories. `RO` will exclude those paths from `create` and `action` policies (just as a filesystem being mounted `ro` would). `NW` will exclude those paths from `create` policies (you can't create but you can change / delete).
Each branch can have a suffix of `=RW` (read / write), `=RO` (read only), or `=NC` (no create). These suffixes work with globs as well and will apply to each path found. `RW` is the default behavior and those paths will be eligible for all policy categories. `RO` will exclude those paths from `create` and `action` policies (just as a filesystem being mounted `ro` would). `NC` will exclude those paths from `create` policies (you can't create but you can change / delete).
``` ```
$ mergerfs -o defaults,allow_other,use_ino /mnt/disk\*:/mnt/cdrom /media/drives $ mergerfs -o defaults,allow_other,use_ino /mnt/disk\*:/mnt/cdrom /media/drives
@ -184,7 +184,7 @@ When using non-path preserving policies paths will be cloned to target drives as
#### Policy descriptions #### Policy descriptions
All **create** policies will filter out branches which are mounted **read only** or tagged as **read only** or **no write**. All **action** policies will filter out branches which are mounted or tagged as **read only**.
All **create** policies will filter out branches which are mounted **read only** or tagged as **read only** or **no create**. All **action** policies will filter out branches which are mounted or tagged as **read only**.
If all branches are filtered an error will be returned. Typically EROFS or ENOSPC. If all branches are filtered an error will be returned. Typically EROFS or ENOSPC.

12
src/branch.cpp

@ -35,10 +35,10 @@ Branch::ro(void) const
} }
bool bool
Branch::ro_or_nw(void) const
Branch::ro_or_nc(void) const
{ {
return ((mode == Branch::RO) || return ((mode == Branch::RO) ||
(mode == Branch::NW));
(mode == Branch::NC));
} }
string string
@ -64,8 +64,8 @@ Branches::to_string(const bool mode_) const
case Branch::RO: case Branch::RO:
tmp += "RO"; tmp += "RO";
break; break;
case Branch::NW:
tmp += "NW";
case Branch::NC:
tmp += "NC";
break; break;
} }
} }
@ -105,8 +105,8 @@ parse(const string &str_,
branch.mode = Branch::RO; branch.mode = Branch::RO;
else if(str::ends_with(str,"=RW")) else if(str::ends_with(str,"=RW"))
branch.mode = Branch::RW; branch.mode = Branch::RW;
else if(str::ends_with(str,"=NW"))
branch.mode = Branch::NW;
else if(str::ends_with(str,"=NC"))
branch.mode = Branch::NC;
if(branch.mode != Branch::INVALID) if(branch.mode != Branch::INVALID)
str.resize(str.size() - 3); str.resize(str.size() - 3);

4
src/branch.hpp

@ -28,14 +28,14 @@ struct Branch
INVALID, INVALID,
RO, RO,
RW, RW,
NW
NC
}; };
Mode mode; Mode mode;
std::string path; std::string path;
bool ro(void) const; bool ro(void) const;
bool ro_or_nw(void) const;
bool ro_or_nc(void) const;
}; };
class Branches : public std::vector<Branch> class Branches : public std::vector<Branch>

2
src/policy_all.cpp

@ -45,7 +45,7 @@ namespace all
{ {
branch = &branches_[i]; branch = &branches_[i];
if(branch->ro_or_nw())
if(branch->ro_or_nc())
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
rv = fs::info(&branch->path,&info); rv = fs::info(&branch->path,&info);
if(rv == -1) if(rv == -1)

2
src/policy_epall.cpp

@ -49,7 +49,7 @@ namespace epall
if(!fs::exists(branch->path,fusepath)) if(!fs::exists(branch->path,fusepath))
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(branch->ro_or_nw())
if(branch->ro_or_nc())
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
rv = fs::info(&branch->path,&info); rv = fs::info(&branch->path,&info);
if(rv == -1) if(rv == -1)

2
src/policy_epff.cpp

@ -50,7 +50,7 @@ namespace epff
if(!fs::exists(branch->path,fusepath)) if(!fs::exists(branch->path,fusepath))
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(branch->ro_or_nw())
if(branch->ro_or_nc())
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
rv = fs::info(&branch->path,&info); rv = fs::info(&branch->path,&info);
if(rv == -1) if(rv == -1)

2
src/policy_eplfs.cpp

@ -55,7 +55,7 @@ namespace eplfs
if(!fs::exists(branch->path,fusepath)) if(!fs::exists(branch->path,fusepath))
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(branch->ro_or_nw())
if(branch->ro_or_nc())
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
rv = fs::info(&branch->path,&info); rv = fs::info(&branch->path,&info);
if(rv == -1) if(rv == -1)

2
src/policy_eplus.cpp

@ -55,7 +55,7 @@ namespace eplus
if(!fs::exists(branch->path,fusepath)) if(!fs::exists(branch->path,fusepath))
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(branch->ro_or_nw())
if(branch->ro_or_nc())
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
rv = fs::info(&branch->path,&info); rv = fs::info(&branch->path,&info);
if(rv == -1) if(rv == -1)

2
src/policy_epmfs.cpp

@ -55,7 +55,7 @@ namespace epmfs
if(!fs::exists(branch->path,fusepath)) if(!fs::exists(branch->path,fusepath))
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(branch->ro_or_nw())
if(branch->ro_or_nc())
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
rv = fs::info(&branch->path,&info); rv = fs::info(&branch->path,&info);
if(rv == -1) if(rv == -1)

2
src/policy_ff.cpp

@ -46,7 +46,7 @@ namespace ff
{ {
branch = &branches_[i]; branch = &branches_[i];
if(branch->ro_or_nw())
if(branch->ro_or_nc())
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
rv = fs::info(&branch->path,&info); rv = fs::info(&branch->path,&info);
if(rv == -1) if(rv == -1)

2
src/policy_lfs.cpp

@ -52,7 +52,7 @@ namespace lfs
{ {
branch = &branches_[i]; branch = &branches_[i];
if(branch->ro_or_nw())
if(branch->ro_or_nc())
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
rv = fs::info(&branch->path,&info); rv = fs::info(&branch->path,&info);
if(rv == -1) if(rv == -1)

2
src/policy_lus.cpp

@ -52,7 +52,7 @@ namespace lus
{ {
branch = &branches_[i]; branch = &branches_[i];
if(branch->ro_or_nw())
if(branch->ro_or_nc())
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
rv = fs::info(&branch->path,&info); rv = fs::info(&branch->path,&info);
if(rv == -1) if(rv == -1)

2
src/policy_mfs.cpp

@ -51,7 +51,7 @@ namespace mfs
{ {
branch = &branches_[i]; branch = &branches_[i];
if(branch->ro_or_nw())
if(branch->ro_or_nc())
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
rv = fs::info(&branch->path,&info); rv = fs::info(&branch->path,&info);
if(rv == -1) if(rv == -1)

2
src/policy_newest.cpp

@ -55,7 +55,7 @@ namespace newest
if(!fs::exists(branch->path,fusepath,st)) if(!fs::exists(branch->path,fusepath,st))
error_and_continue(error,ENOENT); error_and_continue(error,ENOENT);
if(branch->ro_or_nw())
if(branch->ro_or_nc())
error_and_continue(error,EROFS); error_and_continue(error,EROFS);
if(st.st_mtime < newest) if(st.st_mtime < newest)
continue; continue;

Loading…
Cancel
Save