mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04:00
Create functions can set branches RO on EROFS
This commit is contained in:
parent
36a4b7a23a
commit
707d298d7c
14 changed files with 230 additions and 56 deletions
|
|
@ -21,10 +21,12 @@
|
|||
#include "errno.hpp"
|
||||
#include "from_string.hpp"
|
||||
#include "fs_glob.hpp"
|
||||
#include "fs_is_rofs.hpp"
|
||||
#include "fs_realpathize.hpp"
|
||||
#include "nonstd/optional.hpp"
|
||||
#include "num.hpp"
|
||||
#include "str.hpp"
|
||||
#include "syslog.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
|
@ -415,6 +417,24 @@ Branches::to_string(void) const
|
|||
return _impl->to_string();
|
||||
}
|
||||
|
||||
void
|
||||
Branches::find_and_set_mode_ro()
|
||||
{
|
||||
for(auto &branch : *_impl)
|
||||
{
|
||||
if(branch.mode != Branch::Mode::RW)
|
||||
continue;
|
||||
|
||||
if(!fs::is_rofs_but_not_mounted_ro(branch.path))
|
||||
continue;
|
||||
|
||||
syslog_warning("Branch %s found to be readonly - setting its mode to RO",
|
||||
branch.path.c_str());
|
||||
|
||||
branch.mode = Branch::Mode::RO;
|
||||
}
|
||||
}
|
||||
|
||||
SrcMounts::SrcMounts(Branches &b_)
|
||||
: _branches(b_)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue