Browse Source

branch2.cpp

toml4
Antonio SJ Musumeci 10 months ago
parent
commit
1b57f55403
  1. 3
      config.toml
  2. 7
      src/branch2.cpp

3
config.toml

@ -97,6 +97,7 @@ enabled = true
name = 'branch1' name = 'branch1'
type = 'literal' type = 'literal'
path = '/mnt/branch1' path = '/mnt/branch1'
mode = 'RW'
[[branches.tier.branch]] [[branches.tier.branch]]
active = true active = true
path = '/mnt/disk*' path = '/mnt/disk*'
@ -107,6 +108,8 @@ if-not-mountpoint = 'fail' # 'fail' | 'deactivate' ?
# TIER 1 # TIER 1
[[branches.tier]] [[branches.tier]]
[[branches.tier.branch]] [[branches.tier.branch]]
enabled = true
name = 'branch0' name = 'branch0'
type = 'literal' type = 'literal'
path = 'foo' path = 'foo'
mode = 'RO'

7
src/branch2.cpp

@ -2,6 +2,10 @@
#include <iostream> #include <iostream>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
Branch2::Branch2() Branch2::Branch2()
: mode(Mode::RW) : mode(Mode::RW)
@ -18,4 +22,7 @@ Branch2::Branch2(toml::value const &v_)
mode = Mode::_from_string(toml::find<std::string>(v_,"mode").c_str()); mode = Mode::_from_string(toml::find<std::string>(v_,"mode").c_str());
min_free_space = 0; min_free_space = 0;
path = toml::find<std::string>(v_,"path"); path = toml::find<std::string>(v_,"path");
int const flags = O_DIRECTORY | O_PATH;
fd = openat(AT_FDCWD,path.string().c_str(),O_DI
} }
Loading…
Cancel
Save