mirror of
https://github.com/facebook/sapling.git
synced 2025-01-08 22:56:44 +03:00
run clang-format across all C++ files
Summary: Per discussion with bolinfest, this brings Eden in line with clang-format. This diff was generated with `find . \( -iname '*.cpp' -o -iname '*.h' \) -exec bash -c "yes | arc lint {}" \;` Reviewed By: bolinfest Differential Revision: D6232695 fbshipit-source-id: d54942bf1c69b5b0dcd4df629f1f2d5538c9e28c
This commit is contained in:
parent
f79672e8ec
commit
8b9261f2a1
@ -64,7 +64,7 @@ enum : uint32_t {
|
||||
kSnapshotHeaderSize = 8,
|
||||
kSnapshotFormatVersion = 1,
|
||||
};
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace facebook {
|
||||
namespace eden {
|
||||
@ -198,8 +198,8 @@ ClientConfig::ConfigData ClientConfig::loadConfigData(
|
||||
rcFiles.push_back(userConfigPath.c_str());
|
||||
|
||||
// A function that prevents merging a repo stanza over a pre-existing one
|
||||
auto accept = [](
|
||||
const InterpolatedPropertyTree& tree, folly::StringPiece section) {
|
||||
auto accept = [](const InterpolatedPropertyTree& tree,
|
||||
folly::StringPiece section) {
|
||||
if (section.startsWith("repository ") && tree.hasSection(section)) {
|
||||
return InterpolatedPropertyTree::MergeDisposition::SkipAll;
|
||||
}
|
||||
@ -291,5 +291,5 @@ AbsolutePathPiece ClientConfig::getRepoHooks() const {
|
||||
return repoHooks_.hasValue() ? repoHooks_.value()
|
||||
: AbsolutePathPiece{"/etc/eden/hooks"};
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -150,5 +150,5 @@ class ClientConfig {
|
||||
std::string repoSource_;
|
||||
folly::Optional<AbsolutePath> repoHooks_;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -37,7 +37,7 @@ void replaceAll(
|
||||
pos += replace.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
std::string InterpolatedPropertyTree::interpolate(
|
||||
const std::string& input) const {
|
||||
@ -109,5 +109,5 @@ void InterpolatedPropertyTree::updateFromIniFile(
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -83,5 +83,5 @@ class InterpolatedPropertyTree {
|
||||
// resultant string
|
||||
std::string interpolate(const std::string& input) const;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -7,10 +7,10 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*/
|
||||
#include "eden/fs/config/ClientConfig.h"
|
||||
#include <folly/FileUtil.h>
|
||||
#include <folly/experimental/TestUtil.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include "eden/fs/config/ClientConfig.h"
|
||||
#include "eden/fs/utils/PathFuncs.h"
|
||||
#include "eden/fs/utils/test/TestChecks.h"
|
||||
|
||||
@ -79,7 +79,7 @@ class ClientConfigTest : public ::testing::Test {
|
||||
template <typename ExceptionType = std::runtime_error>
|
||||
void testBadSnapshot(StringPiece contents, const char* errorRegex);
|
||||
};
|
||||
}
|
||||
} // namespace
|
||||
|
||||
TEST_F(ClientConfigTest, testLoadFromClientDirectory) {
|
||||
auto configData = ClientConfig::loadConfigData(
|
||||
|
@ -7,10 +7,10 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*/
|
||||
#include "eden/fs/config/InterpolatedPropertyTree.h"
|
||||
#include <folly/FileUtil.h>
|
||||
#include <folly/experimental/TestUtil.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include "eden/fs/config/InterpolatedPropertyTree.h"
|
||||
|
||||
namespace {
|
||||
using folly::test::TemporaryDirectory;
|
||||
@ -120,8 +120,8 @@ TEST_F(InterpTest, testMerge) {
|
||||
EXPECT_EQ("value", tree.get("section", "name", "nope"));
|
||||
|
||||
// A function that prevents merging a repo stanza over a pre-existing one
|
||||
auto accept = [](
|
||||
const InterpolatedPropertyTree& ipt, folly::StringPiece section) {
|
||||
auto accept = [](const InterpolatedPropertyTree& ipt,
|
||||
folly::StringPiece section) {
|
||||
if (section.startsWith("repo ") && ipt.hasSection(section)) {
|
||||
return InterpolatedPropertyTree::MergeDisposition::SkipAll;
|
||||
}
|
||||
@ -169,4 +169,4 @@ TEST_F(InterpTest, testMerge) {
|
||||
folly::StringKeyedUnorderedMap<std::string>({{"name", "two"}}) ==
|
||||
tree.getSection("repo two"));
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
@ -29,6 +29,6 @@ folly::fbvector<struct iovec> BufVec::getIov() const {
|
||||
|
||||
return vec;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -53,6 +53,6 @@ class BufVec {
|
||||
*/
|
||||
folly::fbvector<struct iovec> getIov() const;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -35,6 +35,6 @@ class DirHandle : public FileHandleBase {
|
||||
*/
|
||||
virtual folly::Future<folly::Unit> fsyncdir(bool datasync) = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -56,6 +56,6 @@ bool DirList::add(StringPiece name, const struct stat& st, off_t off) {
|
||||
StringPiece DirList::getBuf() const {
|
||||
return StringPiece(buf_.get(), cur_ - buf_.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -46,6 +46,6 @@ class DirList {
|
||||
|
||||
folly::StringPiece getBuf() const;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -51,7 +51,8 @@ std::shared_ptr<DirHandle> Dispatcher::getDirHandle(uint64_t dh) {
|
||||
}
|
||||
|
||||
static std::string flagsToLabel(
|
||||
const std::unordered_map<int32_t, const char*>& labels, uint32_t flags) {
|
||||
const std::unordered_map<int32_t, const char*>& labels,
|
||||
uint32_t flags) {
|
||||
std::vector<const char*> bits;
|
||||
for (auto& it : labels) {
|
||||
if (it.first == 0) {
|
||||
@ -97,12 +98,13 @@ static std::unordered_map<int32_t, const char*> capsLabels = {
|
||||
void Dispatcher::disp_init(void* userdata, struct fuse_conn_info* conn) {
|
||||
auto disp = reinterpret_cast<Dispatcher*>(userdata);
|
||||
|
||||
conn->want |= conn->capable & (
|
||||
conn->want |=
|
||||
conn->capable &
|
||||
(
|
||||
#ifdef FUSE_CAP_IOCTL_DIR
|
||||
FUSE_CAP_IOCTL_DIR |
|
||||
FUSE_CAP_IOCTL_DIR |
|
||||
#endif
|
||||
FUSE_CAP_ATOMIC_O_TRUNC |
|
||||
FUSE_CAP_BIG_WRITES | FUSE_CAP_ASYNC_READ);
|
||||
FUSE_CAP_ATOMIC_O_TRUNC | FUSE_CAP_BIG_WRITES | FUSE_CAP_ASYNC_READ);
|
||||
|
||||
disp->initConnection(*conn);
|
||||
disp->connInfo_ = *conn;
|
||||
@ -163,7 +165,7 @@ disp_forget_multi(fuse_req_t req, size_t count, fuse_forget_data* forgets) {
|
||||
auto* dispatcher = request.getDispatcher();
|
||||
request.catchErrors(
|
||||
request.startRequest(dispatcher->getStats(), &EdenStats::forgetmulti)
|
||||
.then([ =, &request, forget = std::move(forget) ] {
|
||||
.then([=, &request, forget = std::move(forget)] {
|
||||
for (auto& f : forget) {
|
||||
dispatcher->forget(f.ino, f.nlookup);
|
||||
}
|
||||
@ -177,16 +179,15 @@ folly::Future<Dispatcher::Attr> Dispatcher::getattr(fuse_ino_t /*ino*/) {
|
||||
throwSystemErrorExplicit(ENOENT);
|
||||
}
|
||||
|
||||
static void disp_getattr(fuse_req_t req,
|
||||
fuse_ino_t ino,
|
||||
struct fuse_file_info* fi) {
|
||||
static void
|
||||
disp_getattr(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi) {
|
||||
auto& request = RequestData::create(req);
|
||||
auto* dispatcher = request.getDispatcher();
|
||||
|
||||
if (fi) {
|
||||
request.setRequestFuture(
|
||||
request.startRequest(dispatcher->getStats(), &EdenStats::getattr)
|
||||
.then([ =, &request, fi = *fi ] {
|
||||
.then([=, &request, fi = *fi] {
|
||||
return dispatcher->getGenericFileHandle(fi.fh)->getattr();
|
||||
})
|
||||
.then([](Dispatcher::Attr&& attr) {
|
||||
@ -210,18 +211,19 @@ folly::Future<Dispatcher::Attr> Dispatcher::setattr(
|
||||
FUSELL_NOT_IMPL();
|
||||
}
|
||||
|
||||
static void disp_setattr(fuse_req_t req,
|
||||
fuse_ino_t ino,
|
||||
struct stat* attr,
|
||||
int to_set,
|
||||
struct fuse_file_info* fi) {
|
||||
static void disp_setattr(
|
||||
fuse_req_t req,
|
||||
fuse_ino_t ino,
|
||||
struct stat* attr,
|
||||
int to_set,
|
||||
struct fuse_file_info* fi) {
|
||||
auto& request = RequestData::create(req);
|
||||
auto* dispatcher = request.getDispatcher();
|
||||
|
||||
if (fi) {
|
||||
request.setRequestFuture(
|
||||
request.startRequest(dispatcher->getStats(), &EdenStats::setattr)
|
||||
.then([ =, &request, fi = *fi ]() {
|
||||
.then([=, &request, fi = *fi]() {
|
||||
return dispatcher->getGenericFileHandle(fi.fh)->setattr(
|
||||
*attr, to_set);
|
||||
})
|
||||
@ -264,11 +266,12 @@ folly::Future<fuse_entry_param> Dispatcher::mknod(
|
||||
FUSELL_NOT_IMPL();
|
||||
}
|
||||
|
||||
static void disp_mknod(fuse_req_t req,
|
||||
fuse_ino_t parent,
|
||||
const char* name,
|
||||
mode_t mode,
|
||||
dev_t rdev) {
|
||||
static void disp_mknod(
|
||||
fuse_req_t req,
|
||||
fuse_ino_t parent,
|
||||
const char* name,
|
||||
mode_t mode,
|
||||
dev_t rdev) {
|
||||
auto& request = RequestData::create(req);
|
||||
auto* dispatcher = request.getDispatcher();
|
||||
request.setRequestFuture(
|
||||
@ -283,14 +286,12 @@ static void disp_mknod(fuse_req_t req,
|
||||
}
|
||||
|
||||
folly::Future<fuse_entry_param>
|
||||
Dispatcher::mkdir(fuse_ino_t, PathComponentPiece, mode_t) {
|
||||
Dispatcher::mkdir(fuse_ino_t, PathComponentPiece, mode_t) {
|
||||
FUSELL_NOT_IMPL();
|
||||
}
|
||||
|
||||
static void disp_mkdir(fuse_req_t req,
|
||||
fuse_ino_t parent,
|
||||
const char* name,
|
||||
mode_t mode) {
|
||||
static void
|
||||
disp_mkdir(fuse_req_t req, fuse_ino_t parent, const char* name, mode_t mode) {
|
||||
auto& request = RequestData::create(req);
|
||||
auto* dispatcher = request.getDispatcher();
|
||||
request.setRequestFuture(
|
||||
@ -338,10 +339,11 @@ Dispatcher::symlink(fuse_ino_t, PathComponentPiece, folly::StringPiece) {
|
||||
FUSELL_NOT_IMPL();
|
||||
}
|
||||
|
||||
static void disp_symlink(fuse_req_t req,
|
||||
const char* link,
|
||||
fuse_ino_t parent,
|
||||
const char* name) {
|
||||
static void disp_symlink(
|
||||
fuse_req_t req,
|
||||
const char* link,
|
||||
fuse_ino_t parent,
|
||||
const char* name) {
|
||||
auto& request = RequestData::create(req);
|
||||
auto* dispatcher = request.getDispatcher();
|
||||
request.setRequestFuture(
|
||||
@ -362,36 +364,36 @@ folly::Future<folly::Unit> Dispatcher::rename(
|
||||
FUSELL_NOT_IMPL();
|
||||
}
|
||||
|
||||
static void disp_rename(fuse_req_t req,
|
||||
fuse_ino_t parent,
|
||||
const char* name,
|
||||
fuse_ino_t newparent,
|
||||
const char* newname) {
|
||||
static void disp_rename(
|
||||
fuse_req_t req,
|
||||
fuse_ino_t parent,
|
||||
const char* name,
|
||||
fuse_ino_t newparent,
|
||||
const char* newname) {
|
||||
auto& request = RequestData::create(req);
|
||||
auto* dispatcher = request.getDispatcher();
|
||||
request.setRequestFuture(request
|
||||
.startRequest(
|
||||
dispatcher->getStats(), &EdenStats::rename)
|
||||
.then([=, &request] {
|
||||
return dispatcher->rename(
|
||||
parent,
|
||||
PathComponentPiece(name),
|
||||
newparent,
|
||||
PathComponentPiece(newname));
|
||||
})
|
||||
.then(
|
||||
[]() { RequestData::get().replyError(0); }));
|
||||
request.setRequestFuture(
|
||||
request.startRequest(dispatcher->getStats(), &EdenStats::rename)
|
||||
.then([=, &request] {
|
||||
return dispatcher->rename(
|
||||
parent,
|
||||
PathComponentPiece(name),
|
||||
newparent,
|
||||
PathComponentPiece(newname));
|
||||
})
|
||||
.then([]() { RequestData::get().replyError(0); }));
|
||||
}
|
||||
|
||||
folly::Future<fuse_entry_param>
|
||||
Dispatcher::link(fuse_ino_t, fuse_ino_t, PathComponentPiece) {
|
||||
Dispatcher::link(fuse_ino_t, fuse_ino_t, PathComponentPiece) {
|
||||
FUSELL_NOT_IMPL();
|
||||
}
|
||||
|
||||
static void disp_link(fuse_req_t req,
|
||||
fuse_ino_t ino,
|
||||
fuse_ino_t newparent,
|
||||
const char* newname) {
|
||||
static void disp_link(
|
||||
fuse_req_t req,
|
||||
fuse_ino_t ino,
|
||||
fuse_ino_t newparent,
|
||||
const char* newname) {
|
||||
auto& request = RequestData::create(req);
|
||||
auto* dispatcher = request.getDispatcher();
|
||||
request.setRequestFuture(
|
||||
@ -411,16 +413,15 @@ folly::Future<std::shared_ptr<FileHandle>> Dispatcher::open(
|
||||
FUSELL_NOT_IMPL();
|
||||
}
|
||||
|
||||
static void disp_open(fuse_req_t req,
|
||||
fuse_ino_t ino,
|
||||
struct fuse_file_info* fi) {
|
||||
static void
|
||||
disp_open(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi) {
|
||||
auto& request = RequestData::create(req);
|
||||
auto* dispatcher = request.getDispatcher();
|
||||
request.setRequestFuture(
|
||||
request.startRequest(dispatcher->getStats(), &EdenStats::open)
|
||||
.then([ =, &request, fi = *fi ] { return dispatcher->open(ino, fi); })
|
||||
.then([ req, dispatcher, orig_info = *fi ](
|
||||
std::shared_ptr<FileHandle> fh) {
|
||||
.then([=, &request, fi = *fi] { return dispatcher->open(ino, fi); })
|
||||
.then([req, dispatcher, orig_info = *fi](
|
||||
std::shared_ptr<FileHandle> fh) {
|
||||
if (!fh) {
|
||||
throw std::runtime_error("Dispatcher::open failed to set fh");
|
||||
}
|
||||
@ -448,7 +449,7 @@ static void disp_read(
|
||||
auto* dispatcher = request.getDispatcher();
|
||||
request.setRequestFuture(
|
||||
request.startRequest(dispatcher->getStats(), &EdenStats::read)
|
||||
.then([ =, &request, fi = *fi ] {
|
||||
.then([=, &request, fi = *fi] {
|
||||
auto fh = dispatcher->getFileHandle(fi.fh);
|
||||
return fh->read(size, off);
|
||||
})
|
||||
@ -469,7 +470,7 @@ static void disp_write(
|
||||
auto* dispatcher = request.getDispatcher();
|
||||
request.setRequestFuture(
|
||||
request.startRequest(dispatcher->getStats(), &EdenStats::write)
|
||||
.then([ =, &request, fi = *fi ] {
|
||||
.then([=, &request, fi = *fi] {
|
||||
auto fh = dispatcher->getFileHandle(fi.fh);
|
||||
|
||||
return fh->write(folly::StringPiece(buf, size), off);
|
||||
@ -483,7 +484,7 @@ disp_flush(fuse_req_t req, fuse_ino_t /*ino*/, struct fuse_file_info* fi) {
|
||||
auto* dispatcher = request.getDispatcher();
|
||||
request.setRequestFuture(
|
||||
request.startRequest(dispatcher->getStats(), &EdenStats::flush)
|
||||
.then([ =, &request, fi = *fi ] {
|
||||
.then([=, &request, fi = *fi] {
|
||||
auto fh = dispatcher->getFileHandle(fi.fh);
|
||||
|
||||
return fh->flush(fi.lock_owner);
|
||||
@ -497,7 +498,7 @@ disp_release(fuse_req_t req, fuse_ino_t /*ino*/, struct fuse_file_info* fi) {
|
||||
auto* dispatcher = request.getDispatcher();
|
||||
request.setRequestFuture(
|
||||
request.startRequest(dispatcher->getStats(), &EdenStats::release)
|
||||
.then([ =, &request, fi = *fi ] {
|
||||
.then([=, &request, fi = *fi] {
|
||||
dispatcher->getFileHandles().forgetGenericHandle(fi.fh);
|
||||
RequestData::get().replyError(0);
|
||||
}));
|
||||
@ -512,7 +513,7 @@ static void disp_fsync(
|
||||
auto* dispatcher = request.getDispatcher();
|
||||
request.setRequestFuture(
|
||||
request.startRequest(dispatcher->getStats(), &EdenStats::fsync)
|
||||
.then([ =, &request, fi = *fi ] {
|
||||
.then([=, &request, fi = *fi] {
|
||||
auto fh = dispatcher->getFileHandle(fi.fh);
|
||||
return fh->fsync(datasync);
|
||||
})
|
||||
@ -525,17 +526,15 @@ folly::Future<std::shared_ptr<DirHandle>> Dispatcher::opendir(
|
||||
FUSELL_NOT_IMPL();
|
||||
}
|
||||
|
||||
static void disp_opendir(fuse_req_t req,
|
||||
fuse_ino_t ino,
|
||||
struct fuse_file_info* fi) {
|
||||
static void
|
||||
disp_opendir(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info* fi) {
|
||||
auto& request = RequestData::create(req);
|
||||
auto* dispatcher = request.getDispatcher();
|
||||
request.setRequestFuture(
|
||||
request.startRequest(dispatcher->getStats(), &EdenStats::opendir)
|
||||
.then([ =, &request, fi = *fi ] {
|
||||
return dispatcher->opendir(ino, fi);
|
||||
})
|
||||
.then([ dispatcher, orig_info = *fi ](std::shared_ptr<DirHandle> dh) {
|
||||
.then(
|
||||
[=, &request, fi = *fi] { return dispatcher->opendir(ino, fi); })
|
||||
.then([dispatcher, orig_info = *fi](std::shared_ptr<DirHandle> dh) {
|
||||
if (!dh) {
|
||||
throw std::runtime_error("Dispatcher::opendir failed to set dh");
|
||||
}
|
||||
@ -558,7 +557,7 @@ static void disp_readdir(
|
||||
auto* dispatcher = request.getDispatcher();
|
||||
request.setRequestFuture(
|
||||
request.startRequest(dispatcher->getStats(), &EdenStats::readdir)
|
||||
.then([ =, &request, fi = *fi ] {
|
||||
.then([=, &request, fi = *fi] {
|
||||
auto dh = dispatcher->getDirHandle(fi.fh);
|
||||
return dh->readdir(DirList(size), off);
|
||||
})
|
||||
@ -574,7 +573,7 @@ disp_releasedir(fuse_req_t req, fuse_ino_t /*ino*/, struct fuse_file_info* fi) {
|
||||
auto* dispatcher = request.getDispatcher();
|
||||
request.setRequestFuture(
|
||||
request.startRequest(dispatcher->getStats(), &EdenStats::releasedir)
|
||||
.then([ =, &request, fi = *fi ] {
|
||||
.then([=, &request, fi = *fi] {
|
||||
dispatcher->getFileHandles().forgetGenericHandle(fi.fh);
|
||||
RequestData::get().replyError(0);
|
||||
}));
|
||||
@ -589,7 +588,7 @@ static void disp_fsyncdir(
|
||||
auto* dispatcher = request.getDispatcher();
|
||||
request.setRequestFuture(
|
||||
request.startRequest(dispatcher->getStats(), &EdenStats::fsyncdir)
|
||||
.then([ =, &request, fi = *fi ] {
|
||||
.then([=, &request, fi = *fi] {
|
||||
auto dh = dispatcher->getDirHandle(fi.fh);
|
||||
return dh->fsyncdir(datasync);
|
||||
})
|
||||
@ -625,17 +624,18 @@ folly::Future<folly::Unit> Dispatcher::setxattr(
|
||||
FUSELL_NOT_IMPL();
|
||||
}
|
||||
|
||||
static void disp_setxattr(fuse_req_t req,
|
||||
fuse_ino_t ino,
|
||||
const char* name,
|
||||
const char* value,
|
||||
size_t size,
|
||||
int flags
|
||||
static void disp_setxattr(
|
||||
fuse_req_t req,
|
||||
fuse_ino_t ino,
|
||||
const char* name,
|
||||
const char* value,
|
||||
size_t size,
|
||||
int flags
|
||||
#ifdef __APPLE__
|
||||
,
|
||||
uint32_t position
|
||||
,
|
||||
uint32_t position
|
||||
#endif
|
||||
) {
|
||||
) {
|
||||
auto& request = RequestData::create(req);
|
||||
auto* dispatcher = request.getDispatcher();
|
||||
|
||||
@ -669,15 +669,16 @@ folly::Future<std::string> Dispatcher::getxattr(
|
||||
throwSystemErrorExplicit(kENOATTR);
|
||||
}
|
||||
|
||||
static void disp_getxattr(fuse_req_t req,
|
||||
fuse_ino_t ino,
|
||||
const char* name,
|
||||
size_t size
|
||||
static void disp_getxattr(
|
||||
fuse_req_t req,
|
||||
fuse_ino_t ino,
|
||||
const char* name,
|
||||
size_t size
|
||||
#ifdef __APPLE__
|
||||
,
|
||||
uint32_t position
|
||||
,
|
||||
uint32_t position
|
||||
#endif
|
||||
) {
|
||||
) {
|
||||
auto& request = RequestData::create(req);
|
||||
auto* dispatcher = request.getDispatcher();
|
||||
|
||||
@ -779,20 +780,21 @@ Dispatcher::create(fuse_ino_t, PathComponentPiece, mode_t, int) {
|
||||
FUSELL_NOT_IMPL();
|
||||
}
|
||||
|
||||
static void disp_create(fuse_req_t req,
|
||||
fuse_ino_t parent,
|
||||
const char* name,
|
||||
mode_t mode,
|
||||
struct fuse_file_info* fi) {
|
||||
static void disp_create(
|
||||
fuse_req_t req,
|
||||
fuse_ino_t parent,
|
||||
const char* name,
|
||||
mode_t mode,
|
||||
struct fuse_file_info* fi) {
|
||||
auto& request = RequestData::create(req);
|
||||
auto* dispatcher = request.getDispatcher();
|
||||
request.setRequestFuture(
|
||||
request.startRequest(dispatcher->getStats(), &EdenStats::create)
|
||||
.then([ =, &request, fi = *fi ] {
|
||||
.then([=, &request, fi = *fi] {
|
||||
return dispatcher->create(
|
||||
parent, PathComponentPiece(name), mode, fi.flags);
|
||||
})
|
||||
.then([ dispatcher, orig_info = *fi ](Dispatcher::Create info) {
|
||||
.then([dispatcher, orig_info = *fi](Dispatcher::Create info) {
|
||||
fuse_file_info fi = orig_info;
|
||||
fi.direct_io = info.fh->usesDirectIO();
|
||||
fi.keep_cache = info.fh->preserveCache();
|
||||
@ -813,10 +815,8 @@ Dispatcher::bmap(fuse_ino_t /*ino*/, size_t /*blocksize*/, uint64_t /*idx*/) {
|
||||
FUSELL_NOT_IMPL();
|
||||
}
|
||||
|
||||
static void disp_bmap(fuse_req_t req,
|
||||
fuse_ino_t ino,
|
||||
size_t blocksize,
|
||||
uint64_t idx) {
|
||||
static void
|
||||
disp_bmap(fuse_req_t req, fuse_ino_t ino, size_t blocksize, uint64_t idx) {
|
||||
auto& request = RequestData::create(req);
|
||||
auto* dispatcher = request.getDispatcher();
|
||||
request.setRequestFuture(
|
||||
@ -849,13 +849,14 @@ static void disp_ioctl(
|
||||
|
||||
request.setRequestFuture(
|
||||
request.startRequest(dispatcher->getStats(), &EdenStats::ioctl)
|
||||
.then([ =, &request, fi = *fi ] {
|
||||
.then([=, &request, fi = *fi] {
|
||||
auto fh = dispatcher->getGenericFileHandle(fi.fh);
|
||||
|
||||
return fh->ioctl(cmd,
|
||||
arg,
|
||||
folly::ByteRange((uint8_t*)in_buf, in_bufsz),
|
||||
out_bufsz);
|
||||
return fh->ioctl(
|
||||
cmd,
|
||||
arg,
|
||||
folly::ByteRange((uint8_t*)in_buf, in_bufsz),
|
||||
out_bufsz);
|
||||
})
|
||||
.then([](FileHandleBase::Ioctl&& result) {
|
||||
auto iov = result.buf.getIov();
|
||||
@ -875,7 +876,7 @@ static void disp_poll(
|
||||
auto* dispatcher = request.getDispatcher();
|
||||
request.setRequestFuture(
|
||||
request.startRequest(dispatcher->getStats(), &EdenStats::poll)
|
||||
.then([ =, &request, fi = *fi ] {
|
||||
.then([=, &request, fi = *fi] {
|
||||
auto fh = dispatcher->getGenericFileHandle(fi.fh);
|
||||
|
||||
std::unique_ptr<PollHandle> poll_handle;
|
||||
@ -939,11 +940,13 @@ const fuse_lowlevel_ops dispatcher_ops = {
|
||||
#endif
|
||||
};
|
||||
|
||||
const fuse_conn_info& Dispatcher::getConnInfo() const { return connInfo_; }
|
||||
const fuse_conn_info& Dispatcher::getConnInfo() const {
|
||||
return connInfo_;
|
||||
}
|
||||
|
||||
ThreadLocalEdenStats* Dispatcher::getStats() const {
|
||||
return stats_;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -29,7 +29,6 @@ namespace fusell {
|
||||
folly::throwSystemErrorExplicit(ENOSYS, __PRETTY_FUNCTION__); \
|
||||
} while (0)
|
||||
|
||||
|
||||
class Dispatcher;
|
||||
class RequestData;
|
||||
class FileHandle;
|
||||
@ -125,8 +124,9 @@ class Dispatcher {
|
||||
* @param ino the inode number
|
||||
* @param nlookup the number of lookups to forget
|
||||
*/
|
||||
virtual folly::Future<folly::Unit> forget(fuse_ino_t ino,
|
||||
unsigned long nlookup);
|
||||
virtual folly::Future<folly::Unit> forget(
|
||||
fuse_ino_t ino,
|
||||
unsigned long nlookup);
|
||||
|
||||
/**
|
||||
* The stat information and the cache TTL for the kernel
|
||||
@ -165,9 +165,8 @@ class Dispatcher {
|
||||
* Changed in version 2.5:
|
||||
* file information filled in for ftruncate
|
||||
*/
|
||||
virtual folly::Future<Attr> setattr(fuse_ino_t ino,
|
||||
const struct stat& attr,
|
||||
int to_set);
|
||||
virtual folly::Future<Attr>
|
||||
setattr(fuse_ino_t ino, const struct stat& attr, int to_set);
|
||||
|
||||
/**
|
||||
* Read symbolic link
|
||||
@ -305,10 +304,11 @@ class Dispatcher {
|
||||
/**
|
||||
* Set an extended attribute
|
||||
*/
|
||||
virtual folly::Future<folly::Unit> setxattr(fuse_ino_t ino,
|
||||
folly::StringPiece name,
|
||||
folly::StringPiece value,
|
||||
int flags);
|
||||
virtual folly::Future<folly::Unit> setxattr(
|
||||
fuse_ino_t ino,
|
||||
folly::StringPiece name,
|
||||
folly::StringPiece value,
|
||||
int flags);
|
||||
/**
|
||||
* Get an extended attribute
|
||||
*/
|
||||
@ -328,8 +328,9 @@ class Dispatcher {
|
||||
* @param ino the inode number
|
||||
* @param name of the extended attribute
|
||||
*/
|
||||
virtual folly::Future<folly::Unit> removexattr(fuse_ino_t ino,
|
||||
folly::StringPiece name);
|
||||
virtual folly::Future<folly::Unit> removexattr(
|
||||
fuse_ino_t ino,
|
||||
folly::StringPiece name);
|
||||
|
||||
/**
|
||||
* Check file access permissions
|
||||
@ -386,11 +387,10 @@ class Dispatcher {
|
||||
* @param blocksize unit of block index
|
||||
* @param idx block index within file
|
||||
*/
|
||||
virtual folly::Future<uint64_t> bmap(fuse_ino_t ino,
|
||||
size_t blocksize,
|
||||
uint64_t idx);
|
||||
virtual folly::Future<uint64_t>
|
||||
bmap(fuse_ino_t ino, size_t blocksize, uint64_t idx);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -25,7 +25,7 @@ constexpr auto kDurations = folly::make_array(
|
||||
std::chrono::seconds(600),
|
||||
std::chrono::seconds(3600),
|
||||
std::chrono::seconds(0));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
namespace facebook {
|
||||
namespace eden {
|
||||
@ -70,6 +70,6 @@ void EdenStats::recordLatency(
|
||||
(this->*item)->addValue(now, elapsed.count());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -128,6 +128,6 @@ class EdenStats
|
||||
folly::TimeseriesHistogram<int64_t> createHistogram(const std::string& name);
|
||||
#endif
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -15,10 +15,16 @@ namespace facebook {
|
||||
namespace eden {
|
||||
namespace fusell {
|
||||
|
||||
bool FileHandle::usesDirectIO() const { return false; }
|
||||
bool FileHandle::preserveCache() const { return false; }
|
||||
bool FileHandle::isSeekable() const { return true; }
|
||||
bool FileHandle::usesDirectIO() const {
|
||||
return false;
|
||||
}
|
||||
bool FileHandle::preserveCache() const {
|
||||
return false;
|
||||
}
|
||||
bool FileHandle::isSeekable() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -90,6 +90,6 @@ class FileHandle : public FileHandleBase {
|
||||
*/
|
||||
virtual folly::Future<folly::Unit> fsync(bool datasync) = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -29,6 +29,6 @@ folly::Future<unsigned> FileHandleBase::poll(
|
||||
std::unique_ptr<PollHandle> /*ph*/) {
|
||||
FUSELL_NOT_IMPL();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -8,10 +8,10 @@
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include <folly/futures/Future.h>
|
||||
#include "BufVec.h"
|
||||
#include "Dispatcher.h"
|
||||
#include "PollHandle.h"
|
||||
#include <folly/futures/Future.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace eden {
|
||||
@ -44,8 +44,9 @@ class FileHandleBase {
|
||||
* @param attr the attributes
|
||||
* @param to_set bit mask of attributes which should be set
|
||||
*/
|
||||
virtual folly::Future<Dispatcher::Attr> setattr(const struct stat& attr,
|
||||
int to_set) = 0;
|
||||
virtual folly::Future<Dispatcher::Attr> setattr(
|
||||
const struct stat& attr,
|
||||
int to_set) = 0;
|
||||
|
||||
/* The result of an ioctl operation */
|
||||
struct Ioctl {
|
||||
@ -63,10 +64,11 @@ class FileHandleBase {
|
||||
* @param inputData is a copy of the arg data from userspace
|
||||
* @param outputSize is the maximum size of the output data
|
||||
*/
|
||||
virtual folly::Future<Ioctl> ioctl(int cmd,
|
||||
const void* arg,
|
||||
folly::ByteRange inputData,
|
||||
size_t outputSize);
|
||||
virtual folly::Future<Ioctl> ioctl(
|
||||
int cmd,
|
||||
const void* arg,
|
||||
folly::ByteRange inputData,
|
||||
size_t outputSize);
|
||||
|
||||
/**
|
||||
* Poll for IO readiness
|
||||
@ -86,6 +88,6 @@ class FileHandleBase {
|
||||
*/
|
||||
virtual folly::Future<unsigned> poll(std::unique_ptr<PollHandle> ph);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -160,6 +160,6 @@ SerializedFileHandleMap FileHandleMap::loadFileHandleMap(
|
||||
return CompactSerializer::deserialize<SerializedFileHandleMap>(
|
||||
serializedData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -89,11 +89,10 @@ class FileHandleMap {
|
||||
static SerializedFileHandleMap loadFileHandleMap(folly::StringPiece fileName);
|
||||
|
||||
private:
|
||||
|
||||
folly::Synchronized<
|
||||
std::unordered_map<uint64_t, std::shared_ptr<FileHandleBase>>>
|
||||
handles_;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -227,6 +227,6 @@ void FuseChannel::processSession() {
|
||||
fuse_session_process(session_, buf.data(), res, ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -101,6 +101,6 @@ class FuseChannel {
|
||||
Dispatcher* const dispatcher_{nullptr};
|
||||
folly::File fuseDevice_;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -26,6 +26,6 @@ void PollHandle::notify() {
|
||||
fuse_lowlevel_notify_poll(h_.get());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -8,8 +8,8 @@
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#include "fuse_headers.h"
|
||||
#include <memory>
|
||||
#include "fuse_headers.h"
|
||||
|
||||
namespace facebook {
|
||||
namespace eden {
|
||||
@ -37,6 +37,6 @@ class PollHandle {
|
||||
// Requests that the kernel poll the associated file
|
||||
void notify();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -38,7 +38,9 @@ void RequestData::interrupter(fuse_req_t /*req*/, void* data) {
|
||||
|
||||
// Guarantee to preserve the current context
|
||||
auto saved = folly::RequestContext::saveContext();
|
||||
SCOPE_EXIT { folly::RequestContext::setContext(saved); };
|
||||
SCOPE_EXIT {
|
||||
folly::RequestContext::setContext(saved);
|
||||
};
|
||||
|
||||
// Adopt the context of the target request
|
||||
folly::RequestContext::setContext(request.requestContext_.lock());
|
||||
@ -150,8 +152,9 @@ void RequestData::replyEntry(const struct fuse_entry_param& e) {
|
||||
checkKernelError(fuse_reply_entry(stealReq(), &e));
|
||||
}
|
||||
|
||||
bool RequestData::replyCreate(const struct fuse_entry_param& e,
|
||||
const struct fuse_file_info& fi) {
|
||||
bool RequestData::replyCreate(
|
||||
const struct fuse_entry_param& e,
|
||||
const struct fuse_file_info& fi) {
|
||||
int err = fuse_reply_create(stealReq(), &e, &fi);
|
||||
if (err == -ENOENT) {
|
||||
return false;
|
||||
@ -239,6 +242,6 @@ void RequestData::genericErrorHandler(const std::exception& err) {
|
||||
XLOG(DBG5) << folly::exceptionStr(err);
|
||||
RequestData::get().replyError(EIO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -121,8 +121,9 @@ class RequestData : public folly::RequestData {
|
||||
void replyEntry(const struct fuse_entry_param& e);
|
||||
|
||||
// Reply with a directory entry and open params
|
||||
bool replyCreate(const struct fuse_entry_param& e,
|
||||
const struct fuse_file_info& fi);
|
||||
bool replyCreate(
|
||||
const struct fuse_entry_param& e,
|
||||
const struct fuse_file_info& fi);
|
||||
|
||||
void replyAttr(const struct stat& attr, double attr_timeout);
|
||||
void replyReadLink(const std::string& link);
|
||||
@ -140,6 +141,6 @@ class RequestData : public folly::RequestData {
|
||||
private:
|
||||
std::unique_ptr<Cancel> interrupter_;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -220,6 +220,6 @@ void privilegedBindMount(
|
||||
gPrivHelper->sendAndRecv(&msg, nullptr);
|
||||
PrivHelperConn::parseEmptyResponse(&msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // facebook::eden::fusell
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -89,6 +89,6 @@ void privilegedFuseUnmount(folly::StringPiece mountPath);
|
||||
void privilegedBindMount(
|
||||
folly::StringPiece clientPath,
|
||||
folly::StringPiece mountPath);
|
||||
}
|
||||
}
|
||||
} // facebook::eden::fusell
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -24,12 +24,12 @@
|
||||
#include <unistd.h>
|
||||
#include "eden/fs/utils/ControlMsg.h"
|
||||
|
||||
using folly::io::Appender;
|
||||
using folly::io::Cursor;
|
||||
using folly::ByteRange;
|
||||
using folly::checkUnixError;
|
||||
using folly::IOBuf;
|
||||
using folly::StringPiece;
|
||||
using folly::checkUnixError;
|
||||
using folly::io::Appender;
|
||||
using folly::io::Cursor;
|
||||
using folly::throwSystemError;
|
||||
using std::string;
|
||||
|
||||
@ -420,6 +420,6 @@ void PrivHelperConn::rethrowErrorResponse(const Message* msg) {
|
||||
|
||||
PrivHelperError::PrivHelperError(StringPiece remoteExType, StringPiece msg)
|
||||
: message_(folly::to<string>(remoteExType, ": ", msg)) {}
|
||||
}
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -181,6 +181,6 @@ class PrivHelperError : public std::exception {
|
||||
private:
|
||||
std::string message_;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // facebook::eden::fusell
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -297,7 +297,7 @@ folly::Expected<unsigned long, int> getFSID(const char* path) {
|
||||
}
|
||||
return folly::makeExpected<int>(data.f_fsid);
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void PrivHelperServer::bindUnmount(const char* mountPath) {
|
||||
// Check the current filesystem information for this path,
|
||||
@ -363,6 +363,6 @@ void PrivHelperServer::run() {
|
||||
// Unmount all active mount points
|
||||
cleanupMountPoints();
|
||||
}
|
||||
}
|
||||
}
|
||||
} // facebook::eden::fusell
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -68,6 +68,6 @@ class PrivHelperServer {
|
||||
std::set<std::string> mountPoints_;
|
||||
std::unordered_multimap<std::string, std::string> bindMountPoints_;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // facebook::eden::fusell
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -175,5 +175,5 @@ UserInfo UserInfo::lookup() {
|
||||
info.initHomedir(&pwd);
|
||||
return info;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -108,5 +108,5 @@ class UserInfo {
|
||||
std::string username_;
|
||||
AbsolutePath homeDirectory_;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -7,8 +7,8 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*/
|
||||
#include "PrivHelperTestServer.h"
|
||||
#include "eden/fs/fuse/privhelper/PrivHelper.h"
|
||||
#include "PrivHelperTestServer.h"
|
||||
#include "eden/fs/fuse/privhelper/PrivHelperConn.h"
|
||||
#include "eden/fs/fuse/privhelper/UserInfo.h"
|
||||
|
||||
@ -25,10 +25,10 @@
|
||||
using namespace facebook::eden::fusell;
|
||||
using facebook::eden::UserInfo;
|
||||
using folly::ByteRange;
|
||||
using folly::checkUnixError;
|
||||
using folly::File;
|
||||
using folly::IOBuf;
|
||||
using folly::StringPiece;
|
||||
using folly::checkUnixError;
|
||||
using folly::test::TemporaryDirectory;
|
||||
using folly::test::TemporaryFile;
|
||||
using std::string;
|
||||
|
@ -100,6 +100,6 @@ bool PrivHelperTestServer::checkIfMarkerFileHasContents(
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -53,6 +53,6 @@ class PrivHelperTestServer : public PrivHelperServer {
|
||||
const std::string pathToMarkerFile,
|
||||
const std::string contents) const;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace fusell
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -121,5 +121,5 @@ TEST(UserInfo, lookup) {
|
||||
// but we can't confirm their correctness.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -21,10 +21,10 @@
|
||||
#include "eden/fs/service/gen-cpp2/eden_types.h"
|
||||
#include "eden/fs/store/ObjectStore.h"
|
||||
|
||||
using folly::exception_wrapper;
|
||||
using folly::Future;
|
||||
using folly::makeFuture;
|
||||
using folly::Unit;
|
||||
using folly::exception_wrapper;
|
||||
using folly::makeFuture;
|
||||
using std::make_shared;
|
||||
using std::vector;
|
||||
|
||||
@ -344,5 +344,5 @@ bool CheckoutAction::hasConflict() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -180,5 +180,5 @@ class CheckoutAction {
|
||||
*/
|
||||
folly::Promise<folly::Unit> promise_;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -96,5 +96,5 @@ void CheckoutContext::addError(
|
||||
conflict.message = folly::exceptionStr(ew).toStdString();
|
||||
conflicts_.wlock()->push_back(std::move(conflict));
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -21,7 +21,7 @@ class exception_wrapper;
|
||||
template <typename T>
|
||||
class Future;
|
||||
class Unit;
|
||||
}
|
||||
} // namespace folly
|
||||
|
||||
namespace facebook {
|
||||
namespace eden {
|
||||
@ -108,5 +108,5 @@ class CheckoutContext {
|
||||
// Therefore access to the conflicts list must be synchronized.
|
||||
folly::Synchronized<std::vector<CheckoutConflict>> conflicts_;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -21,9 +21,9 @@
|
||||
#include "eden/fs/store/ObjectStore.h"
|
||||
#include "eden/fs/utils/Bug.h"
|
||||
|
||||
using folly::makeFuture;
|
||||
using folly::Future;
|
||||
using folly::Unit;
|
||||
using folly::makeFuture;
|
||||
using std::make_unique;
|
||||
using std::shared_ptr;
|
||||
using std::unique_ptr;
|
||||
@ -142,24 +142,23 @@ folly::Future<folly::Unit> diffRemovedTree(
|
||||
}
|
||||
}
|
||||
|
||||
return folly::collectAll(subFutures).then([
|
||||
currentPath = RelativePath{std::move(currentPath)},
|
||||
tree = std::move(tree),
|
||||
context
|
||||
](vector<folly::Try<Unit>> results) {
|
||||
// Call diffError() for each error that occurred
|
||||
for (size_t n = 0; n < results.size(); ++n) {
|
||||
auto& result = results[n];
|
||||
if (result.hasException()) {
|
||||
const auto& entry = tree->getEntryAt(n);
|
||||
context->callback->diffError(
|
||||
currentPath + entry.getName(), result.exception());
|
||||
}
|
||||
}
|
||||
// Return successfully after recording the errors. (If we failed then
|
||||
// our caller would also record us as an error, which we don't want.)
|
||||
return makeFuture();
|
||||
});
|
||||
return folly::collectAll(subFutures)
|
||||
.then([currentPath = RelativePath{std::move(currentPath)},
|
||||
tree = std::move(tree),
|
||||
context](vector<folly::Try<Unit>> results) {
|
||||
// Call diffError() for each error that occurred
|
||||
for (size_t n = 0; n < results.size(); ++n) {
|
||||
auto& result = results[n];
|
||||
if (result.hasException()) {
|
||||
const auto& entry = tree->getEntryAt(n);
|
||||
context->callback->diffError(
|
||||
currentPath + entry.getName(), result.exception());
|
||||
}
|
||||
}
|
||||
// Return successfully after recording the errors. (If we failed then
|
||||
// our caller would also record us as an error, which we don't want.)
|
||||
return makeFuture();
|
||||
});
|
||||
}
|
||||
} // unnamed namespace
|
||||
|
||||
@ -392,5 +391,5 @@ unique_ptr<DeferredDiffEntry> DeferredDiffEntry::createModifiedEntry(
|
||||
return make_unique<ModifiedBlobDiffEntry>(
|
||||
context, std::move(path), scmEntry, currentBlobHash);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -17,7 +17,7 @@ namespace folly {
|
||||
template <typename T>
|
||||
class Future;
|
||||
class Unit;
|
||||
}
|
||||
} // namespace folly
|
||||
|
||||
namespace facebook {
|
||||
namespace eden {
|
||||
@ -104,5 +104,5 @@ class DeferredDiffEntry {
|
||||
const DiffContext* const context_;
|
||||
RelativePath const path_;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -50,5 +50,5 @@ class DiffContext {
|
||||
private:
|
||||
GitIgnoreStack rootIgnore_{nullptr};
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -31,7 +31,7 @@ class TreeInode;
|
||||
namespace fusell {
|
||||
class InodeBase;
|
||||
class MountPoint;
|
||||
}
|
||||
} // namespace fusell
|
||||
|
||||
/**
|
||||
* Returns the single-char representation of the status used by `hg status`.
|
||||
@ -146,5 +146,5 @@ class Dirstate {
|
||||
|
||||
folly::Synchronized<DirstateData> data_;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -63,5 +63,5 @@ class DirstatePersistence {
|
||||
|
||||
AbsolutePath storageFile_;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -26,8 +26,8 @@
|
||||
#include "eden/fs/inodes/TreeInode.h"
|
||||
|
||||
using namespace folly;
|
||||
using facebook::eden::PathComponentPiece;
|
||||
using facebook::eden::PathComponent;
|
||||
using facebook::eden::PathComponentPiece;
|
||||
using facebook::eden::RelativePath;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
@ -63,7 +63,7 @@ fuse_entry_param computeEntryParam(
|
||||
entry.entry_timeout = attr.timeout;
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
folly::Future<fusell::Dispatcher::Attr> EdenDispatcher::getattr(
|
||||
fuse_ino_t ino) {
|
||||
@ -136,8 +136,8 @@ folly::Future<fusell::Dispatcher::Create> EdenDispatcher::create(
|
||||
mode,
|
||||
flags);
|
||||
return inodeMap_->lookupTreeInode(parent)
|
||||
.then([ childName = PathComponent{name}, mode, flags ](
|
||||
const TreeInodePtr& parentInode) {
|
||||
.then([childName = PathComponent{name}, mode, flags](
|
||||
const TreeInodePtr& parentInode) {
|
||||
return parentInode->create(childName, mode, flags);
|
||||
})
|
||||
.then([=](TreeInode::CreateResult created) {
|
||||
@ -170,8 +170,7 @@ folly::Future<fuse_entry_param> EdenDispatcher::mknod(
|
||||
mode,
|
||||
rdev);
|
||||
return inodeMap_->lookupTreeInode(parent).then(
|
||||
[ childName = PathComponent{name}, mode, rdev ](
|
||||
const TreeInodePtr& inode) {
|
||||
[childName = PathComponent{name}, mode, rdev](const TreeInodePtr& inode) {
|
||||
auto child = inode->mknod(childName, mode, rdev);
|
||||
return child->getattr().then([child](fusell::Dispatcher::Attr attr) {
|
||||
child->incFuseRefcount();
|
||||
@ -190,7 +189,7 @@ EdenDispatcher::mkdir(fuse_ino_t parent, PathComponentPiece name, mode_t mode) {
|
||||
name,
|
||||
mode);
|
||||
return inodeMap_->lookupTreeInode(parent).then(
|
||||
[ childName = PathComponent{name}, mode ](const TreeInodePtr& inode) {
|
||||
[childName = PathComponent{name}, mode](const TreeInodePtr& inode) {
|
||||
auto child = inode->mkdir(childName, mode);
|
||||
return child->getattr().then([child](fusell::Dispatcher::Attr attr) {
|
||||
child->incFuseRefcount();
|
||||
@ -204,7 +203,7 @@ folly::Future<folly::Unit> EdenDispatcher::unlink(
|
||||
PathComponentPiece name) {
|
||||
FB_LOGF(mount_->getStraceLogger(), DBG7, "unlink({}, {})", parent, name);
|
||||
return inodeMap_->lookupTreeInode(parent).then(
|
||||
[ this, childName = PathComponent{name} ](const TreeInodePtr& inode) {
|
||||
[this, childName = PathComponent{name}](const TreeInodePtr& inode) {
|
||||
inode->unlink(childName);
|
||||
});
|
||||
}
|
||||
@ -213,8 +212,8 @@ folly::Future<folly::Unit> EdenDispatcher::rmdir(
|
||||
fuse_ino_t parent,
|
||||
PathComponentPiece name) {
|
||||
FB_LOGF(mount_->getStraceLogger(), DBG7, "rmdir({}, {})", parent, name);
|
||||
return inodeMap_->lookupTreeInode(parent)
|
||||
.then([childName = PathComponent{name}](const TreeInodePtr& inode) {
|
||||
return inodeMap_->lookupTreeInode(parent).then(
|
||||
[childName = PathComponent{name}](const TreeInodePtr& inode) {
|
||||
return inode->rmdir(childName);
|
||||
});
|
||||
}
|
||||
@ -226,8 +225,8 @@ folly::Future<fuse_entry_param> EdenDispatcher::symlink(
|
||||
FB_LOGF(
|
||||
mount_->getStraceLogger(), DBG7, "rmdir({}, {}, {})", parent, name, link);
|
||||
return inodeMap_->lookupTreeInode(parent).then(
|
||||
[ linkContents = link.str(),
|
||||
childName = PathComponent{name} ](const TreeInodePtr& inode) {
|
||||
[linkContents = link.str(),
|
||||
childName = PathComponent{name}](const TreeInodePtr& inode) {
|
||||
auto symlinkInode = inode->symlink(childName, linkContents);
|
||||
symlinkInode->incFuseRefcount();
|
||||
return symlinkInode->getattr().then([symlinkInode](Attr&& attr) {
|
||||
@ -253,11 +252,10 @@ folly::Future<folly::Unit> EdenDispatcher::rename(
|
||||
auto parentFuture = inodeMap_->lookupTreeInode(parent);
|
||||
auto newParentFuture = inodeMap_->lookupTreeInode(newParent);
|
||||
// Do the rename once we have looked up both parents.
|
||||
return parentFuture.then([
|
||||
npFuture = std::move(newParentFuture),
|
||||
name = PathComponent{namePiece},
|
||||
newName = PathComponent{newNamePiece}
|
||||
](const TreeInodePtr& parent) mutable {
|
||||
return parentFuture.then([npFuture = std::move(newParentFuture),
|
||||
name = PathComponent{namePiece},
|
||||
newName = PathComponent{newNamePiece}](
|
||||
const TreeInodePtr& parent) mutable {
|
||||
return npFuture.then(
|
||||
[parent, name, newName](const TreeInodePtr& newParent) {
|
||||
parent->rename(name, newParent, newName);
|
||||
@ -286,8 +284,10 @@ folly::Future<fuse_entry_param> EdenDispatcher::link(
|
||||
|
||||
Future<string> EdenDispatcher::getxattr(fuse_ino_t ino, StringPiece name) {
|
||||
FB_LOGF(mount_->getStraceLogger(), DBG7, "getxattr({}, {})", ino, name);
|
||||
return inodeMap_->lookupInode(ino).then([attrName = name.str()](
|
||||
const InodePtr& inode) { return inode->getxattr(attrName); });
|
||||
return inodeMap_->lookupInode(ino).then(
|
||||
[attrName = name.str()](const InodePtr& inode) {
|
||||
return inode->getxattr(attrName);
|
||||
});
|
||||
}
|
||||
|
||||
Future<vector<string>> EdenDispatcher::listxattr(fuse_ino_t ino) {
|
||||
@ -295,5 +295,5 @@ Future<vector<string>> EdenDispatcher::listxattr(fuse_ino_t ino) {
|
||||
return inodeMap_->lookupInode(ino).then(
|
||||
[](const InodePtr& inode) { return inode->listxattr(); });
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -33,9 +33,8 @@ class EdenDispatcher : public fusell::Dispatcher {
|
||||
void initConnection(fuse_conn_info& conn) override;
|
||||
|
||||
folly::Future<Attr> getattr(fuse_ino_t ino) override;
|
||||
folly::Future<Attr> setattr(fuse_ino_t ino,
|
||||
const struct stat& attr,
|
||||
int to_set) override;
|
||||
folly::Future<Attr>
|
||||
setattr(fuse_ino_t ino, const struct stat& attr, int to_set) override;
|
||||
folly::Future<std::shared_ptr<fusell::DirHandle>> opendir(
|
||||
fuse_ino_t ino,
|
||||
const struct fuse_file_info& fi) override;
|
||||
@ -43,8 +42,8 @@ class EdenDispatcher : public fusell::Dispatcher {
|
||||
fuse_ino_t parent,
|
||||
PathComponentPiece name) override;
|
||||
|
||||
folly::Future<folly::Unit> forget(fuse_ino_t ino,
|
||||
unsigned long nlookup) override;
|
||||
folly::Future<folly::Unit> forget(fuse_ino_t ino, unsigned long nlookup)
|
||||
override;
|
||||
folly::Future<std::shared_ptr<fusell::FileHandle>> open(
|
||||
fuse_ino_t ino,
|
||||
const struct fuse_file_info& fi) override;
|
||||
@ -93,5 +92,5 @@ class EdenDispatcher : public fusell::Dispatcher {
|
||||
// mount_ first.
|
||||
InodeMap* const inodeMap_;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -509,7 +509,7 @@ Future<Unit> EdenMount::diff(InodeDiffCallback* callback, bool listIgnored) {
|
||||
|
||||
// stateHolder() exists to ensure that the DiffContext and GitIgnoreStack
|
||||
// exists until the diff completes.
|
||||
auto stateHolder = [ctx = std::move(context)](){};
|
||||
auto stateHolder = [ctx = std::move(context)]() {};
|
||||
|
||||
auto rootInode = getRootInode();
|
||||
return getRootTreeFuture()
|
||||
@ -689,5 +689,5 @@ struct stat EdenMount::initStatData() const {
|
||||
|
||||
return st;
|
||||
}
|
||||
}
|
||||
} // facebook::eden
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -31,14 +31,14 @@ class File;
|
||||
|
||||
template <typename T>
|
||||
class Future;
|
||||
}
|
||||
} // namespace folly
|
||||
|
||||
namespace facebook {
|
||||
namespace eden {
|
||||
namespace fusell {
|
||||
class FuseChannel;
|
||||
class MountPoint;
|
||||
}
|
||||
} // namespace fusell
|
||||
|
||||
class BindMount;
|
||||
class CheckoutConflict;
|
||||
@ -674,5 +674,5 @@ class EdenMountDeleter {
|
||||
mount->destroy();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -112,5 +112,5 @@ folly::Future<folly::Unit> FileHandle::fsync(bool datasync) {
|
||||
inode_->fsync(datasync);
|
||||
return folly::Unit{};
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -40,5 +40,5 @@ class FileHandle : public fusell::FileHandle {
|
||||
private:
|
||||
FileInodePtr inode_;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -27,15 +27,15 @@
|
||||
#include "eden/fs/utils/Bug.h"
|
||||
#include "eden/fs/utils/XAttr.h"
|
||||
|
||||
using folly::checkUnixError;
|
||||
using folly::ByteRange;
|
||||
using folly::Future;
|
||||
using folly::makeFuture;
|
||||
using folly::StringPiece;
|
||||
using folly::Unit;
|
||||
using folly::checkUnixError;
|
||||
using folly::makeFuture;
|
||||
using std::shared_ptr;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
using folly::ByteRange;
|
||||
|
||||
namespace facebook {
|
||||
namespace eden {
|
||||
@ -62,9 +62,7 @@ FileInode::State::State(
|
||||
folly::File&& file,
|
||||
const timespec& lastCheckoutTime,
|
||||
dev_t rdev)
|
||||
: mode(m),
|
||||
rdev(rdev),
|
||||
file(std::move(file)) {
|
||||
: mode(m), rdev(rdev), file(std::move(file)) {
|
||||
timeStamps.setTimestampValues(lastCheckoutTime);
|
||||
}
|
||||
/*
|
||||
@ -129,7 +127,7 @@ folly::Future<fusell::Dispatcher::Attr> FileInode::setInodeAttr(
|
||||
}
|
||||
|
||||
return materializeForWrite(openFlags).then(
|
||||
[ self = inodePtrFromThis(), attr, to_set ]() {
|
||||
[self = inodePtrFromThis(), attr, to_set]() {
|
||||
self->materializeInParent();
|
||||
|
||||
auto result =
|
||||
@ -185,9 +183,8 @@ folly::Future<std::string> FileInode::readlink() {
|
||||
}
|
||||
|
||||
// The symlink contents are simply the file contents!
|
||||
return ensureDataLoaded().then([self = inodePtrFromThis()]() {
|
||||
return self->readAll();
|
||||
});
|
||||
return ensureDataLoaded().then(
|
||||
[self = inodePtrFromThis()]() { return self->readAll(); });
|
||||
}
|
||||
|
||||
void FileInode::fileHandleDidClose() {
|
||||
@ -233,10 +230,8 @@ folly::Future<bool> FileInode::isSameAs(const Hash& blobID, mode_t mode) {
|
||||
return makeFuture(result.value());
|
||||
}
|
||||
|
||||
return getMount()
|
||||
->getObjectStore()
|
||||
->getBlobMetadata(blobID)
|
||||
.then([self = inodePtrFromThis()](const BlobMetadata& metadata) {
|
||||
return getMount()->getObjectStore()->getBlobMetadata(blobID).then(
|
||||
[self = inodePtrFromThis()](const BlobMetadata& metadata) {
|
||||
return self->getSHA1().value() == metadata.sha1;
|
||||
});
|
||||
}
|
||||
@ -722,5 +717,5 @@ void FileInode::updateOverlayHeader() const {
|
||||
Overlay::updateTimestampToHeader(state->file.fd(), state->timeStamps);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -276,5 +276,5 @@ class FileInode : public InodeBase {
|
||||
|
||||
friend class ::facebook::eden::FileHandle;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -374,5 +374,5 @@ void InodeBase::updateJournal() {
|
||||
std::make_unique<JournalDelta>(JournalDelta{path.value()}));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -516,7 +516,7 @@ class InodeBase {
|
||||
*/
|
||||
folly::Synchronized<LocationInfo> location_;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
||||
#include "eden/fs/inodes/InodePtr-defs.h"
|
||||
|
@ -45,5 +45,5 @@ class InodeDiffCallback {
|
||||
RelativePathPiece path,
|
||||
const folly::exception_wrapper& ew) = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -64,5 +64,5 @@ std::string InodeError::computeMessage() const {
|
||||
return path + ": " + message_ + ": " +
|
||||
folly::errnoStr(errnum()).toStdString();
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -85,5 +85,5 @@ class InodeError : public std::system_error {
|
||||
std::string message_;
|
||||
mutable folly::Synchronized<std::string> fullMessage_;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -22,8 +22,8 @@
|
||||
|
||||
using folly::Future;
|
||||
using folly::Promise;
|
||||
using folly::throwSystemErrorExplicit;
|
||||
using folly::Unit;
|
||||
using folly::throwSystemErrorExplicit;
|
||||
using std::string;
|
||||
|
||||
namespace facebook {
|
||||
@ -176,14 +176,11 @@ void InodeMap::setupParentLookupPromise(
|
||||
bool isUnlinked,
|
||||
fuse_ino_t childInodeNumber) {
|
||||
promise.getFuture()
|
||||
.then([
|
||||
name = PathComponent(childName),
|
||||
this,
|
||||
isUnlinked,
|
||||
childInodeNumber
|
||||
](const InodePtr& inode) {
|
||||
startChildLookup(inode, name, isUnlinked, childInodeNumber);
|
||||
})
|
||||
.then(
|
||||
[name = PathComponent(childName), this, isUnlinked, childInodeNumber](
|
||||
const InodePtr& inode) {
|
||||
startChildLookup(inode, name, isUnlinked, childInodeNumber);
|
||||
})
|
||||
.onError([this, childInodeNumber](const folly::exception_wrapper& ex) {
|
||||
// Fail all pending lookups on the child
|
||||
inodeLoadFailed(childInodeNumber, ex);
|
||||
@ -693,5 +690,5 @@ fuse_ino_t InodeMap::allocateInodeNumber(Members& data) {
|
||||
++data.nextInodeNumber_;
|
||||
return number;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -587,5 +587,5 @@ class InodeMapLock {
|
||||
friend class InodeMap;
|
||||
folly::Synchronized<InodeMap::Members>::LockedPtr data_;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -69,5 +69,5 @@ void InodePtrImpl<InodeType>::resetNoDecRef() {
|
||||
CHECK_NOTNULL(value_);
|
||||
value_ = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -90,7 +90,7 @@ FileInodePtr InodePtr::asFilePtr() const& {
|
||||
return asSubclassPtr<FileInodePtr>();
|
||||
}
|
||||
|
||||
FileInodePtr InodePtr::asFilePtr()&& {
|
||||
FileInodePtr InodePtr::asFilePtr() && {
|
||||
return extractSubclassPtr<FileInodePtr>();
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ FileInodePtr InodePtr::asFilePtrOrNull() const& {
|
||||
FileInodePtr::NORMAL_INCREMENT};
|
||||
}
|
||||
|
||||
FileInodePtr InodePtr::asFilePtrOrNull()&& {
|
||||
FileInodePtr InodePtr::asFilePtrOrNull() && {
|
||||
return extractSubclassPtrOrNull<FileInodePtr>();
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ TreeInodePtr InodePtr::asTreePtr() const& {
|
||||
return asSubclassPtr<TreeInodePtr>();
|
||||
}
|
||||
|
||||
TreeInodePtr InodePtr::asTreePtr()&& {
|
||||
TreeInodePtr InodePtr::asTreePtr() && {
|
||||
return extractSubclassPtr<TreeInodePtr>();
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ TreeInodePtr InodePtr::asTreePtrOrNull() const& {
|
||||
TreeInodePtr::NORMAL_INCREMENT};
|
||||
}
|
||||
|
||||
TreeInodePtr InodePtr::asTreePtrOrNull()&& {
|
||||
TreeInodePtr InodePtr::asTreePtrOrNull() && {
|
||||
return extractSubclassPtrOrNull<TreeInodePtr>();
|
||||
}
|
||||
|
||||
@ -137,5 +137,5 @@ template class InodePtrImpl<FileInode>;
|
||||
template class InodePtrImpl<TreeInode>;
|
||||
template FileInodePtr InodePtr::asSubclassPtrOrNull<FileInodePtr>() const&;
|
||||
template TreeInodePtr InodePtr::asSubclassPtrOrNull<TreeInodePtr>() const&;
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -368,5 +368,5 @@ template <typename InodeTypeParam>
|
||||
bool operator!=(std::nullptr_t, const InodePtrImpl<InodeTypeParam>& ptr) {
|
||||
return bool(ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -31,5 +31,5 @@ using DotEdenInodePtr = InodePtrImpl<DotEdenInode>;
|
||||
using FileInodePtr = InodePtrImpl<FileInode>;
|
||||
using TreeInodePtr = InodePtrImpl<TreeInode>;
|
||||
class InodePtr;
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -23,12 +23,12 @@ namespace eden {
|
||||
|
||||
using apache::thrift::CompactSerializer;
|
||||
using folly::ByteRange;
|
||||
using folly::fbstring;
|
||||
using folly::fbvector;
|
||||
using folly::File;
|
||||
using folly::MutableStringPiece;
|
||||
using folly::Optional;
|
||||
using folly::StringPiece;
|
||||
using folly::fbstring;
|
||||
using folly::fbvector;
|
||||
using std::make_unique;
|
||||
using std::string;
|
||||
using std::unique_ptr;
|
||||
@ -77,7 +77,7 @@ void formatSubdirPath(MutableStringPiece subdirPath, fuse_ino_t inode) {
|
||||
subdirPath[0] = hexdigit[(inode >> 4) & 0xf];
|
||||
subdirPath[1] = hexdigit[inode & 0xf];
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
constexpr folly::StringPiece Overlay::kHeaderIdentifierDir;
|
||||
constexpr folly::StringPiece Overlay::kHeaderIdentifierFile;
|
||||
@ -543,5 +543,5 @@ void Overlay::updateTimestampToHeader(
|
||||
"writeNoInt wrote only ", wrote, " of ", newHeader.size(), " bytes");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -139,5 +139,5 @@ class Overlay {
|
||||
*/
|
||||
folly::File infoFile_;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -97,5 +97,5 @@ class ParentInodeInfo {
|
||||
bool isUnlinked_;
|
||||
folly::Synchronized<TreeInode::Dir>::LockedPtr parentContents_;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -43,10 +43,10 @@
|
||||
#include "eden/fs/utils/TimeUtil.h"
|
||||
|
||||
using folly::Future;
|
||||
using folly::makeFuture;
|
||||
using folly::Optional;
|
||||
using folly::StringPiece;
|
||||
using folly::Unit;
|
||||
using folly::makeFuture;
|
||||
using std::make_unique;
|
||||
using std::shared_ptr;
|
||||
using std::unique_ptr;
|
||||
@ -297,7 +297,7 @@ class LookupProcessor {
|
||||
RelativePath path_;
|
||||
size_t pathIndex_{0};
|
||||
};
|
||||
}
|
||||
} // namespace
|
||||
|
||||
Future<InodePtr> TreeInode::getChildRecursive(RelativePathPiece path) {
|
||||
auto pathStr = path.stringPiece();
|
||||
@ -376,12 +376,12 @@ void TreeInode::registerInodeLoadComplete(
|
||||
// This method should never be called with the contents_ lock held. If the
|
||||
// future is already ready we will try to acquire the contents_ lock now.
|
||||
future
|
||||
.then([ self = inodePtrFromThis(), childName = PathComponent{name} ](
|
||||
unique_ptr<InodeBase> && childInode) {
|
||||
.then([self = inodePtrFromThis(), childName = PathComponent{name}](
|
||||
unique_ptr<InodeBase>&& childInode) {
|
||||
self->inodeLoadComplete(childName, std::move(childInode));
|
||||
})
|
||||
.onError([ self = inodePtrFromThis(), number ](
|
||||
const folly::exception_wrapper& ew) {
|
||||
.onError([self = inodePtrFromThis(),
|
||||
number](const folly::exception_wrapper& ew) {
|
||||
self->getInodeMap()->inodeLoadFailed(number, ew);
|
||||
});
|
||||
}
|
||||
@ -721,7 +721,7 @@ TreeInode::create(PathComponentPiece name, mode_t mode, int /*flags*/) {
|
||||
// Now that we have the file handle, let's look up the attributes.
|
||||
auto getattrResult = handle->getattr();
|
||||
return getattrResult.then(
|
||||
[ =, handle = std::move(handle) ](fusell::Dispatcher::Attr attr) mutable {
|
||||
[=, handle = std::move(handle)](fusell::Dispatcher::Attr attr) mutable {
|
||||
CreateResult result(getMount());
|
||||
|
||||
// Return all of the results back to the kernel.
|
||||
@ -961,16 +961,16 @@ TreeInodePtr TreeInode::mkdir(PathComponentPiece name, mode_t mode) {
|
||||
|
||||
folly::Future<folly::Unit> TreeInode::unlink(PathComponentPiece name) {
|
||||
return getOrLoadChild(name).then(
|
||||
[ self = inodePtrFromThis(),
|
||||
childName = PathComponent{name} ](const InodePtr& child) {
|
||||
[self = inodePtrFromThis(),
|
||||
childName = PathComponent{name}](const InodePtr& child) {
|
||||
return self->removeImpl<FileInodePtr>(std::move(childName), child, 1);
|
||||
});
|
||||
}
|
||||
|
||||
folly::Future<folly::Unit> TreeInode::rmdir(PathComponentPiece name) {
|
||||
return getOrLoadChild(name).then(
|
||||
[ self = inodePtrFromThis(),
|
||||
childName = PathComponent{name} ](const InodePtr& child) {
|
||||
[self = inodePtrFromThis(),
|
||||
childName = PathComponent{name}](const InodePtr& child) {
|
||||
return self->removeImpl<TreeInodePtr>(std::move(childName), child, 1);
|
||||
});
|
||||
}
|
||||
@ -1057,11 +1057,9 @@ folly::Future<folly::Unit> TreeInode::removeImpl(
|
||||
// the left side of "." will always get evaluated before the right
|
||||
// side.
|
||||
auto childFuture = getOrLoadChild(name);
|
||||
return childFuture.then([
|
||||
self = inodePtrFromThis(),
|
||||
childName = PathComponent{std::move(name)},
|
||||
attemptNum
|
||||
](const InodePtr& loadedChild) {
|
||||
return childFuture.then([self = inodePtrFromThis(),
|
||||
childName = PathComponent{std::move(name)},
|
||||
attemptNum](const InodePtr& loadedChild) {
|
||||
return self->removeImpl<InodePtrType>(
|
||||
childName, loadedChild, attemptNum + 1);
|
||||
});
|
||||
@ -1356,12 +1354,10 @@ Future<Unit> TreeInode::rename(
|
||||
// Once we finish the loads, we have to re-run all the rename() logic.
|
||||
// Other renames or unlinks may have occurred in the meantime, so all of the
|
||||
// validation above has to be redone.
|
||||
auto onLoadFinished = [
|
||||
self = inodePtrFromThis(),
|
||||
nameCopy = name.copy(),
|
||||
destParent,
|
||||
destNameCopy = destName.copy()
|
||||
]() {
|
||||
auto onLoadFinished = [self = inodePtrFromThis(),
|
||||
nameCopy = name.copy(),
|
||||
destParent,
|
||||
destNameCopy = destName.copy()]() {
|
||||
return self->rename(nameCopy, destParent, destNameCopy);
|
||||
};
|
||||
|
||||
@ -1388,7 +1384,7 @@ bool isAncestor(const RenameLock& renameLock, TreeInode* a, TreeInode* b) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
Future<Unit> TreeInode::doRename(
|
||||
TreeRenameLocks&& locks,
|
||||
@ -1659,22 +1655,21 @@ Future<Unit> TreeInode::diff(
|
||||
}
|
||||
|
||||
if (inodeFuture.hasValue()) {
|
||||
return inodeFuture.value().then([
|
||||
self = inodePtrFromThis(),
|
||||
context,
|
||||
currentPath = RelativePath{currentPath},
|
||||
tree = std::move(tree),
|
||||
parentIgnore,
|
||||
isIgnored
|
||||
](InodePtr && loadedInode) mutable {
|
||||
return self->loadGitIgnoreThenDiff(
|
||||
std::move(loadedInode),
|
||||
context,
|
||||
currentPath,
|
||||
std::move(tree),
|
||||
parentIgnore,
|
||||
isIgnored);
|
||||
});
|
||||
return inodeFuture.value().then(
|
||||
[self = inodePtrFromThis(),
|
||||
context,
|
||||
currentPath = RelativePath{currentPath},
|
||||
tree = std::move(tree),
|
||||
parentIgnore,
|
||||
isIgnored](InodePtr&& loadedInode) mutable {
|
||||
return self->loadGitIgnoreThenDiff(
|
||||
std::move(loadedInode),
|
||||
context,
|
||||
currentPath,
|
||||
std::move(tree),
|
||||
parentIgnore,
|
||||
isIgnored);
|
||||
});
|
||||
} else {
|
||||
return loadGitIgnoreThenDiff(
|
||||
std::move(inode),
|
||||
@ -1729,15 +1724,13 @@ Future<Unit> TreeInode::loadGitIgnoreThenDiff(
|
||||
// compiler may decide to move data away before evaluating
|
||||
// data->ensureDataLoaded().
|
||||
auto dataFuture = fileInode->ensureDataLoaded();
|
||||
return dataFuture.then([
|
||||
self = inodePtrFromThis(),
|
||||
context,
|
||||
currentPath = RelativePath{currentPath},
|
||||
tree = std::move(tree),
|
||||
parentIgnore,
|
||||
isIgnored,
|
||||
fileInode = std::move(fileInode)
|
||||
]() mutable {
|
||||
return dataFuture.then([self = inodePtrFromThis(),
|
||||
context,
|
||||
currentPath = RelativePath{currentPath},
|
||||
tree = std::move(tree),
|
||||
parentIgnore,
|
||||
isIgnored,
|
||||
fileInode = std::move(fileInode)]() mutable {
|
||||
auto ignoreFileContents = fileInode->readAll();
|
||||
auto ignore = make_unique<GitIgnoreStack>(parentIgnore, ignoreFileContents);
|
||||
return self->computeDiff(
|
||||
@ -2008,28 +2001,28 @@ Future<Unit> TreeInode::computeDiff(
|
||||
// Note that we explicitly move-capture the deferredFutures vector into this
|
||||
// callback, to ensure that the DeferredDiffEntry objects do not get
|
||||
// destroyed before they complete.
|
||||
return folly::collectAll(deferredFutures).then([
|
||||
self = std::move(self),
|
||||
currentPath = RelativePath{std::move(currentPath)},
|
||||
context,
|
||||
// Capture ignore to ensure it remains valid until all of our children's
|
||||
// diff operations complete.
|
||||
ignore = std::move(ignore),
|
||||
deferredJobs = std::move(deferredEntries)
|
||||
](vector<folly::Try<Unit>> results) {
|
||||
// Call diffError() for any jobs that failed.
|
||||
for (size_t n = 0; n < results.size(); ++n) {
|
||||
auto& result = results[n];
|
||||
if (result.hasException()) {
|
||||
context->callback->diffError(
|
||||
deferredJobs[n]->getPath(), result.exception());
|
||||
}
|
||||
}
|
||||
// Report success here, even if some of our deferred jobs failed.
|
||||
// We will have reported those errors to the callback already, and so we
|
||||
// don't want our parent to report a new error at our path.
|
||||
return makeFuture();
|
||||
});
|
||||
return folly::collectAll(deferredFutures)
|
||||
.then([self = std::move(self),
|
||||
currentPath = RelativePath{std::move(currentPath)},
|
||||
context,
|
||||
// Capture ignore to ensure it remains valid until all of our
|
||||
// children's diff operations complete.
|
||||
ignore = std::move(ignore),
|
||||
deferredJobs =
|
||||
std::move(deferredEntries)](vector<folly::Try<Unit>> results) {
|
||||
// Call diffError() for any jobs that failed.
|
||||
for (size_t n = 0; n < results.size(); ++n) {
|
||||
auto& result = results[n];
|
||||
if (result.hasException()) {
|
||||
context->callback->diffError(
|
||||
deferredJobs[n]->getPath(), result.exception());
|
||||
}
|
||||
}
|
||||
// Report success here, even if some of our deferred jobs failed.
|
||||
// We will have reported those errors to the callback already, and so we
|
||||
// don't want our parent to report a new error at our path.
|
||||
return makeFuture();
|
||||
});
|
||||
}
|
||||
|
||||
Future<Unit> TreeInode::checkout(
|
||||
@ -2056,29 +2049,30 @@ Future<Unit> TreeInode::checkout(
|
||||
actionFutures.emplace_back(action->run(ctx, getStore()));
|
||||
}
|
||||
// Wait for all of the actions, and record any errors.
|
||||
return folly::collectAll(actionFutures).then([
|
||||
ctx,
|
||||
self = inodePtrFromThis(),
|
||||
toTree = std::move(toTree),
|
||||
actions = std::move(actions)
|
||||
](vector<folly::Try<Unit>> actionResults) {
|
||||
// Record any errors that occurred
|
||||
size_t numErrors = 0;
|
||||
for (size_t n = 0; n < actionResults.size(); ++n) {
|
||||
auto& result = actionResults[n];
|
||||
if (!result.hasException()) {
|
||||
continue;
|
||||
}
|
||||
++numErrors;
|
||||
ctx->addError(self.get(), actions[n]->getEntryName(), result.exception());
|
||||
}
|
||||
return folly::collectAll(actionFutures)
|
||||
.then([ctx,
|
||||
self = inodePtrFromThis(),
|
||||
toTree = std::move(toTree),
|
||||
actions =
|
||||
std::move(actions)](vector<folly::Try<Unit>> actionResults) {
|
||||
// Record any errors that occurred
|
||||
size_t numErrors = 0;
|
||||
for (size_t n = 0; n < actionResults.size(); ++n) {
|
||||
auto& result = actionResults[n];
|
||||
if (!result.hasException()) {
|
||||
continue;
|
||||
}
|
||||
++numErrors;
|
||||
ctx->addError(
|
||||
self.get(), actions[n]->getEntryName(), result.exception());
|
||||
}
|
||||
|
||||
// Update our state in the overlay
|
||||
self->saveOverlayPostCheckout(ctx, toTree.get());
|
||||
// Update our state in the overlay
|
||||
self->saveOverlayPostCheckout(ctx, toTree.get());
|
||||
|
||||
XLOG(DBG4) << "checkout: finished update of " << self->getLogPath() << ": "
|
||||
<< numErrors << " errors";
|
||||
});
|
||||
XLOG(DBG4) << "checkout: finished update of " << self->getLogPath()
|
||||
<< ": " << numErrors << " errors";
|
||||
});
|
||||
}
|
||||
|
||||
void TreeInode::computeCheckoutActions(
|
||||
@ -2350,49 +2344,48 @@ Future<Unit> TreeInode::checkoutUpdateEntry(
|
||||
// Fortunately, calling checkout() with an empty destination tree does
|
||||
// exactly what we want. checkout() will even remove the directory before it
|
||||
// returns if the directory is empty.
|
||||
return treeInode->checkout(ctx, std::move(oldTree), nullptr).then([
|
||||
ctx,
|
||||
name = PathComponent{name},
|
||||
parentInode = inodePtrFromThis(),
|
||||
treeInode,
|
||||
newScmEntry
|
||||
]() {
|
||||
// Make sure the treeInode was completely removed by the checkout.
|
||||
// If there were still untracked files inside of it, it won't have
|
||||
// been deleted, and we have a conflict that we cannot resolve.
|
||||
if (!treeInode->isUnlinked()) {
|
||||
ctx->addConflict(ConflictType::DIRECTORY_NOT_EMPTY, treeInode.get());
|
||||
return;
|
||||
}
|
||||
return treeInode->checkout(ctx, std::move(oldTree), nullptr)
|
||||
.then([ctx,
|
||||
name = PathComponent{name},
|
||||
parentInode = inodePtrFromThis(),
|
||||
treeInode,
|
||||
newScmEntry]() {
|
||||
// Make sure the treeInode was completely removed by the checkout.
|
||||
// If there were still untracked files inside of it, it won't have
|
||||
// been deleted, and we have a conflict that we cannot resolve.
|
||||
if (!treeInode->isUnlinked()) {
|
||||
ctx->addConflict(ConflictType::DIRECTORY_NOT_EMPTY, treeInode.get());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!newScmEntry) {
|
||||
// We're done
|
||||
return;
|
||||
}
|
||||
if (!newScmEntry) {
|
||||
// We're done
|
||||
return;
|
||||
}
|
||||
|
||||
// Add the new entry
|
||||
auto contents = parentInode->contents_.wlock();
|
||||
DCHECK_EQ(TreeEntryType::BLOB, newScmEntry->getType());
|
||||
auto newTreeEntry =
|
||||
make_unique<Entry>(newScmEntry->getMode(), newScmEntry->getHash());
|
||||
auto ret = contents->entries.emplace(name, std::move(newTreeEntry));
|
||||
if (!ret.second) {
|
||||
// Hmm. Someone else already created a new entry in this location
|
||||
// before we had a chance to add our new entry. We don't block new file
|
||||
// or directory creations during a checkout operation, so this is
|
||||
// possible. Just report an error in this case.
|
||||
contents.unlock();
|
||||
ctx->addError(
|
||||
parentInode.get(),
|
||||
name,
|
||||
InodeError(
|
||||
EEXIST,
|
||||
parentInode,
|
||||
// Add the new entry
|
||||
auto contents = parentInode->contents_.wlock();
|
||||
DCHECK_EQ(TreeEntryType::BLOB, newScmEntry->getType());
|
||||
auto newTreeEntry =
|
||||
make_unique<Entry>(newScmEntry->getMode(), newScmEntry->getHash());
|
||||
auto ret = contents->entries.emplace(name, std::move(newTreeEntry));
|
||||
if (!ret.second) {
|
||||
// Hmm. Someone else already created a new entry in this location
|
||||
// before we had a chance to add our new entry. We don't block new
|
||||
// file or directory creations during a checkout operation, so this is
|
||||
// possible. Just report an error in this case.
|
||||
contents.unlock();
|
||||
ctx->addError(
|
||||
parentInode.get(),
|
||||
name,
|
||||
"new file created with this name while checkout operation "
|
||||
"was in progress"));
|
||||
}
|
||||
});
|
||||
InodeError(
|
||||
EEXIST,
|
||||
parentInode,
|
||||
name,
|
||||
"new file created with this name while checkout operation "
|
||||
"was in progress"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void TreeInode::saveOverlayPostCheckout(
|
||||
@ -2557,7 +2550,7 @@ folly::Future<folly::Unit> recursivelyLoadMaterializedChildren(
|
||||
}
|
||||
return folly::makeFuture();
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
folly::Future<InodePtr> TreeInode::loadChildLocked(
|
||||
Dir& /* contents */,
|
||||
@ -2935,5 +2928,5 @@ void TreeInode::setAtime(struct timespec& atime) {
|
||||
auto contents = contents_.wlock();
|
||||
contents->timeStamps.atime = atime;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -758,5 +758,5 @@ class TreeInode : public InodeBase {
|
||||
|
||||
folly::Synchronized<Dir> contents_;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -141,5 +141,5 @@ folly::Future<fusell::Dispatcher::Attr> TreeInodeDirHandle::getattr() {
|
||||
fuse_ino_t TreeInodeDirHandle::getInodeNumber() {
|
||||
return inode_->getNodeId();
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -31,5 +31,5 @@ class TreeInodeDirHandle : public fusell::DirHandle {
|
||||
private:
|
||||
TreeInodePtr inode_;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -25,9 +25,9 @@
|
||||
|
||||
using namespace facebook::eden;
|
||||
using folly::Future;
|
||||
using folly::makeFuture;
|
||||
using folly::StringPiece;
|
||||
using folly::Unit;
|
||||
using folly::makeFuture;
|
||||
using std::string;
|
||||
using testing::UnorderedElementsAre;
|
||||
|
||||
|
@ -19,9 +19,9 @@
|
||||
#include "eden/fs/utils/test/TestChecks.h"
|
||||
|
||||
using namespace facebook::eden;
|
||||
using ::testing::UnorderedElementsAre;
|
||||
using folly::StringPiece;
|
||||
using std::string;
|
||||
using ::testing::UnorderedElementsAre;
|
||||
|
||||
class DiffResults {
|
||||
public:
|
||||
@ -167,9 +167,7 @@ class DiffTest {
|
||||
});
|
||||
}
|
||||
|
||||
DiffResults resetCommitAndDiff(
|
||||
FakeTreeBuilder& builder,
|
||||
bool loadInodes);
|
||||
DiffResults resetCommitAndDiff(FakeTreeBuilder& builder, bool loadInodes);
|
||||
|
||||
void checkNoChanges() {
|
||||
auto result = diff();
|
||||
|
@ -7,11 +7,11 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*/
|
||||
#include "eden/fs/inodes/DirstatePersistence.h"
|
||||
#include <folly/FileUtil.h>
|
||||
#include <folly/experimental/TestUtil.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <thrift/lib/cpp2/protocol/Serializer.h>
|
||||
#include "eden/fs/inodes/DirstatePersistence.h"
|
||||
#include "eden/fs/inodes/gen-cpp2/overlay_types.h"
|
||||
|
||||
using namespace facebook::eden;
|
||||
|
@ -8,9 +8,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "eden/fs/inodes/Dirstate.h"
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include "eden/fs/inodes/Dirstate.h"
|
||||
#include "eden/fs/service/PrettyPrinters.h"
|
||||
#include "eden/fs/testharness/FakeTreeBuilder.h"
|
||||
#include "eden/fs/testharness/TestMount.h"
|
||||
@ -207,7 +207,8 @@ TEST(Dirstate, createDirstateWithTouchedFile) {
|
||||
TEST(Dirstate, addDirectoriesWithMixOfFiles) {
|
||||
FakeTreeBuilder builder;
|
||||
builder.setFiles({
|
||||
{"rootfile.txt", ""}, {"dir1/a.txt", "original contents"},
|
||||
{"rootfile.txt", ""},
|
||||
{"dir1/a.txt", "original contents"},
|
||||
});
|
||||
TestMount testMount{builder};
|
||||
|
||||
@ -249,7 +250,8 @@ TEST(Dirstate, addDirectoriesWithMixOfFiles) {
|
||||
verifyExpectedDirstate(
|
||||
dirstate,
|
||||
{
|
||||
{"dir1/b.txt", StatusCode::ADDED}, {"dir2/c.txt", StatusCode::ADDED},
|
||||
{"dir1/b.txt", StatusCode::ADDED},
|
||||
{"dir2/c.txt", StatusCode::ADDED},
|
||||
});
|
||||
|
||||
scmRemoveFile(dirstate, "dir1/a.txt", /* force */ false);
|
||||
@ -282,7 +284,7 @@ TEST(Dirstate, addDirectoriesWithMixOfFiles) {
|
||||
DirstateAddRemoveError{RelativePath("dir3"),
|
||||
"dir3: No such file or directory"}
|
||||
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
TEST(Dirstate, createDirstateWithFileAndThenHgRemoveIt) {
|
||||
|
@ -7,10 +7,10 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*/
|
||||
#include "eden/fs/inodes/EdenMount.h"
|
||||
#include <folly/Range.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include "eden/fs/config/ClientConfig.h"
|
||||
#include "eden/fs/inodes/EdenMount.h"
|
||||
#include "eden/fs/inodes/TreeInode.h"
|
||||
#include "eden/fs/journal/Journal.h"
|
||||
#include "eden/fs/journal/JournalDelta.h"
|
||||
@ -119,5 +119,5 @@ TEST(EdenMount, testLastCheckoutTime) {
|
||||
EXPECT_EQ(sec.count(), stDir.mtime.tv_sec);
|
||||
EXPECT_EQ(nsec.count(), stDir.mtime.tv_nsec);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -7,11 +7,11 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*/
|
||||
#include "eden/fs/fuse/FileHandleMap.h"
|
||||
#include <folly/experimental/TestUtil.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include "eden/fs/fuse/DirHandle.h"
|
||||
#include "eden/fs/fuse/FileHandle.h"
|
||||
#include "eden/fs/fuse/FileHandleMap.h"
|
||||
#include "eden/fs/fuse/gen-cpp2/handlemap_types.h"
|
||||
|
||||
using namespace facebook::eden;
|
||||
@ -81,7 +81,7 @@ class FakeFileHandle : public FileHandle {
|
||||
private:
|
||||
fuse_ino_t inode_;
|
||||
};
|
||||
}
|
||||
} // namespace
|
||||
|
||||
FileHandleMapEntry makeEntry(fuse_ino_t inode, uint64_t handleId, bool isDir) {
|
||||
FileHandleMapEntry entry;
|
||||
|
@ -38,8 +38,8 @@ std::ostream& operator<<(
|
||||
os << folly::sformat("{}.{:09d}", secs.count(), nsecs.count());
|
||||
return os;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace chrono
|
||||
} // namespace std
|
||||
|
||||
template <typename Clock = std::chrono::system_clock>
|
||||
typename Clock::time_point timespecToTimePoint(const timespec& ts) {
|
||||
@ -143,7 +143,7 @@ fusell::Dispatcher::Attr basicAttrChecks(const FileInodePtr& inode) {
|
||||
folly::to<std::string>("Originally from ", __FILE__, ":", __LINE__)); \
|
||||
basicAttrChecks(inode, ##__VA_ARGS__); \
|
||||
})
|
||||
}
|
||||
} // namespace
|
||||
|
||||
class FileInodeTest : public ::testing::Test {
|
||||
protected:
|
||||
|
@ -7,9 +7,9 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*/
|
||||
#include "eden/fs/inodes/InodeBase.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include "eden/fs/inodes/FileInode.h"
|
||||
#include "eden/fs/inodes/InodeBase.h"
|
||||
#include "eden/fs/inodes/TreeInode.h"
|
||||
#include "eden/fs/testharness/FakeTreeBuilder.h"
|
||||
#include "eden/fs/testharness/TestMount.h"
|
||||
|
@ -7,10 +7,10 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*/
|
||||
#include "eden/fs/inodes/InodePtr.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include "eden/fs/inodes/FileInode.h"
|
||||
#include "eden/fs/inodes/InodeBase.h"
|
||||
#include "eden/fs/inodes/InodePtr.h"
|
||||
#include "eden/fs/inodes/TreeInode.h"
|
||||
#include "eden/fs/testharness/FakeTreeBuilder.h"
|
||||
#include "eden/fs/testharness/TestMount.h"
|
||||
@ -34,8 +34,8 @@ class InodePtrTestHelper {
|
||||
return inode->ptrRefcount_.load(std::memory_order_acquire);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
||||
#define EXPECT_REFCOUNT(expected, inodePtr) \
|
||||
EXPECT_EQ(expected, InodePtrTestHelper::getRefcount(inodePtr))
|
||||
|
@ -7,10 +7,10 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
*/
|
||||
#include "eden/fs/inodes/Overlay.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include "eden/fs/inodes/EdenMount.h"
|
||||
#include "eden/fs/inodes/FileInode.h"
|
||||
#include "eden/fs/inodes/Overlay.h"
|
||||
#include "eden/fs/inodes/TreeInode.h"
|
||||
#include "eden/fs/service/PrettyPrinters.h"
|
||||
#include "eden/fs/testharness/FakeBackingStore.h"
|
||||
@ -22,8 +22,8 @@
|
||||
|
||||
using namespace facebook::eden;
|
||||
using folly::Future;
|
||||
using folly::makeFuture;
|
||||
using folly::StringPiece;
|
||||
using folly::makeFuture;
|
||||
using std::string;
|
||||
|
||||
class OverlayTest : public ::testing::Test {
|
||||
|
@ -61,5 +61,5 @@ void Journal::cancelAllSubscribers() {
|
||||
bool Journal::isSubscriberValid(uint64_t id) const {
|
||||
return subscribers_.find(id) != subscribers_.end();
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -82,5 +82,5 @@ class Journal {
|
||||
/** The subscribers */
|
||||
std::unordered_map<uint64_t, folly::Function<void()>> subscribers_;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -171,5 +171,5 @@ std::unique_ptr<JournalDelta> JournalDelta::merge(
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -73,5 +73,5 @@ class JournalDelta {
|
||||
Journal::SequenceNumber limitSequence = 0,
|
||||
bool pruneAfterLimit = false) const;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -36,5 +36,5 @@ class Blob {
|
||||
const Hash hash_;
|
||||
const folly::IOBuf contents_;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -17,11 +17,11 @@
|
||||
#include <folly/ssl/OpenSSLHash.h>
|
||||
#include <string>
|
||||
|
||||
using std::string;
|
||||
using folly::ByteRange;
|
||||
using folly::StringPiece;
|
||||
using folly::range;
|
||||
using folly::ssl::OpenSSLHash;
|
||||
using std::string;
|
||||
|
||||
namespace facebook {
|
||||
namespace eden {
|
||||
@ -31,7 +31,7 @@ const Hash kZeroHash;
|
||||
namespace {
|
||||
Hash::Storage hexToBytes(StringPiece hex);
|
||||
Hash::Storage byteRangeToArray(ByteRange bytes);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
Hash::Hash() : bytes_{{0}} {}
|
||||
|
||||
@ -107,7 +107,7 @@ Hash::Storage byteRangeToArray(ByteRange bytes) {
|
||||
std::copy(bytes.begin(), bytes.end(), arr.data());
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
Hash Hash::sha1(const folly::IOBuf* buf) {
|
||||
Storage hashBytes;
|
||||
@ -129,5 +129,5 @@ std::ostream& operator<<(std::ostream& os, const Hash& hash) {
|
||||
void toAppend(const Hash& hash, std::string* result) {
|
||||
folly::toAppend(hash.toString(), result);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -81,8 +81,8 @@ std::ostream& operator<<(std::ostream& os, const Hash& hash);
|
||||
|
||||
/* Define toAppend() so folly::to<string>(Hash) will work */
|
||||
void toAppend(const Hash& hash, std::string* result);
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
||||
namespace std {
|
||||
template <>
|
||||
@ -91,4 +91,4 @@ struct hash<facebook::eden::Hash> {
|
||||
return hash.getHashCode();
|
||||
}
|
||||
};
|
||||
}
|
||||
} // namespace std
|
||||
|
@ -30,5 +30,5 @@ std::ostream& operator<<(std::ostream& os, const ParentCommits& parents) {
|
||||
os << "]";
|
||||
return os;
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -77,5 +77,5 @@ class ParentCommits {
|
||||
* This makes it possible to easily use ParentCommits in glog statements.
|
||||
*/
|
||||
std::ostream& operator<<(std::ostream& os, const ParentCommits& parents);
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -19,5 +19,5 @@ bool operator==(const Tree& tree1, const Tree& tree2) {
|
||||
bool operator!=(const Tree& tree1, const Tree& tree2) {
|
||||
return !(tree1 == tree2);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -64,5 +64,5 @@ class Tree {
|
||||
|
||||
bool operator==(const Tree& tree1, const Tree& tree2);
|
||||
bool operator!=(const Tree& tree1, const Tree& tree2);
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -70,5 +70,5 @@ bool operator==(const TreeEntry& entry1, const TreeEntry& entry2) {
|
||||
bool operator!=(const TreeEntry& entry1, const TreeEntry& entry2) {
|
||||
return !(entry1 == entry2);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -102,5 +102,5 @@ class TreeEntry {
|
||||
std::ostream& operator<<(std::ostream& os, TreeEntryType type);
|
||||
bool operator==(const TreeEntry& entry1, const TreeEntry& entry2);
|
||||
bool operator!=(const TreeEntry& entry1, const TreeEntry& entry2);
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -60,5 +60,5 @@ std::unique_ptr<Blob> deserializeGitBlob(const Hash& hash, const IOBuf* data) {
|
||||
|
||||
return std::make_unique<Blob>(hash, std::move(contents));
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -28,5 +28,5 @@ class Blob;
|
||||
std::unique_ptr<Blob> deserializeGitBlob(
|
||||
const Hash& hash,
|
||||
const folly::IOBuf* data);
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -92,5 +92,5 @@ string GitIgnore::matchString(MatchResult result) {
|
||||
}
|
||||
return folly::to<string>("unexpected result", int(result));
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user