mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04:00
Merge branch 'master' into readdir_rewind_fix
This commit is contained in:
commit
cbea2ba91b
330 changed files with 6970 additions and 3229 deletions
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#define _DEFAULT_SOURCE
|
||||
|
||||
#include "branch.hpp"
|
||||
#include "branches.hpp"
|
||||
#include "errno.hpp"
|
||||
#include "fs_closedir.hpp"
|
||||
#include "fs_devid.hpp"
|
||||
|
|
@ -27,10 +27,9 @@
|
|||
#include "fs_readdir.hpp"
|
||||
#include "fs_stat.hpp"
|
||||
#include "hashset.hpp"
|
||||
#include "rwlock.hpp"
|
||||
|
||||
#include <fuse.h>
|
||||
#include <fuse_dirents.h>
|
||||
#include "fuse.h"
|
||||
#include "fuse_dirents.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
|
@ -40,6 +39,7 @@
|
|||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
|
||||
namespace l
|
||||
{
|
||||
static
|
||||
|
|
@ -57,9 +57,9 @@ namespace l
|
|||
|
||||
static
|
||||
int
|
||||
readdir(const BranchVec &branches_,
|
||||
const char *dirname_,
|
||||
fuse_dirents_t *buf_)
|
||||
readdir(const Branches::CPtr &branches_,
|
||||
const char *dirname_,
|
||||
fuse_dirents_t *buf_)
|
||||
{
|
||||
dev_t dev;
|
||||
HashSet names;
|
||||
|
|
@ -69,13 +69,13 @@ namespace l
|
|||
|
||||
fuse_dirents_reset(buf_);
|
||||
|
||||
for(size_t i = 0, ei = branches_.size(); i != ei; i++)
|
||||
for(const auto &branch : *branches_)
|
||||
{
|
||||
int rv;
|
||||
int dirfd;
|
||||
DIR *dh;
|
||||
|
||||
basepath = fs::path::make(branches_[i].path,dirname_);
|
||||
basepath = fs::path::make(branch.path,dirname_);
|
||||
|
||||
dh = fs::opendir(basepath);
|
||||
if(!dh)
|
||||
|
|
@ -83,8 +83,6 @@ namespace l
|
|||
|
||||
dirfd = fs::dirfd(dh);
|
||||
dev = fs::devid(dirfd);
|
||||
if(dev == (dev_t)-1)
|
||||
dev = i;
|
||||
|
||||
rv = 0;
|
||||
for(struct dirent *de = fs::readdir(dh); de && !rv; de = fs::readdir(dh))
|
||||
|
|
@ -112,25 +110,14 @@ namespace l
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
readdir(const Branches &branches_,
|
||||
const char *dirname_,
|
||||
fuse_dirents_t *buf_)
|
||||
{
|
||||
rwlock::ReadGuard guard(branches_.lock);
|
||||
|
||||
return l::readdir(branches_.vec,dirname_,buf_);
|
||||
}
|
||||
}
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
readdir_posix(const Branches &branches_,
|
||||
const char *dirname_,
|
||||
fuse_dirents_t *buf_)
|
||||
readdir_posix(const Branches::CPtr &branches_,
|
||||
const char *dirname_,
|
||||
fuse_dirents_t *buf_)
|
||||
{
|
||||
return l::readdir(branches_,dirname_,buf_);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue