mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04:00
only allow manipulation of runtime settings via xattrs. closes #22
This commit is contained in:
parent
45cec2d301
commit
7b0d703f00
35 changed files with 50 additions and 419 deletions
30
src/read.cpp
30
src/read.cpp
|
|
@ -31,27 +31,8 @@
|
|||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
#include "config.hpp"
|
||||
#include "ugid.hpp"
|
||||
#include "fileinfo.hpp"
|
||||
|
||||
using std::string;
|
||||
|
||||
static
|
||||
int
|
||||
_read_controlfile(const string readstr,
|
||||
char *buf,
|
||||
const size_t count)
|
||||
{
|
||||
size_t n;
|
||||
|
||||
n = std::min(count,readstr.length());
|
||||
|
||||
memcpy(buf,readstr.data(),n);
|
||||
|
||||
return (int)n;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
_read(const int fd,
|
||||
|
|
@ -75,16 +56,9 @@ namespace mergerfs
|
|||
char *buf,
|
||||
size_t count,
|
||||
off_t offset,
|
||||
struct fuse_file_info *fi)
|
||||
struct fuse_file_info *ffi)
|
||||
{
|
||||
const config::Config &config = config::get();
|
||||
|
||||
if(fusepath == config.controlfile)
|
||||
return _read_controlfile(config.controlfiledata(),
|
||||
buf,
|
||||
count);
|
||||
|
||||
return _read(((FileInfo*)fi->fh)->fd,
|
||||
return _read(((FileInfo*)ffi->fh)->fd,
|
||||
buf,
|
||||
count,
|
||||
offset);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue