run clang-format across eden

Summary:
```
find . \( -iname '*.cpp' -o -iname '*.h' \) -exec arc lint --apply-patches {} +
```

Differential Revision: D6820436

fbshipit-source-id: 173c0e3b5c023c1c9276f34e17d732f1dd161892
This commit is contained in:
Chad Austin 2018-01-26 11:17:36 -08:00 committed by Facebook Github Bot
parent 13176097df
commit 697eb8a6fd
35 changed files with 129 additions and 135 deletions

View File

@ -119,7 +119,6 @@ ParentCommits ClientConfig::getParentCommits() const {
}
void ClientConfig::setParentCommits(const ParentCommits& parents) const {
std::array<uint8_t, kSnapshotHeaderSize + (2 * Hash::RAW_SIZE)> buffer;
IOBuf buf(IOBuf::WRAP_BUFFER, ByteRange{buffer});
folly::io::RWPrivateCursor cursor{&buf};

View File

@ -38,7 +38,6 @@ inline void operator<<(std::ostream& out, const BindMount& bindMount) {
class ClientConfig {
public:
/**
* Manually construct a ClientConfig object.
*

View File

@ -1176,7 +1176,6 @@ folly::Future<folly::Unit> FuseChannel::fuseCreate(
XLOG(DBG7) << "FUSE_CREATE " << name;
return dispatcher_->create(header->nodeid, name, create->mode, create->flags)
.then([this](Dispatcher::Create info) {
fuse_open_out out = {};
if (info.fh->usesDirectIO()) {
out.open_flags |= FOPEN_DIRECT_IO;

View File

@ -25,8 +25,7 @@ RequestData::RequestData(
FuseChannel* channel,
const fuse_in_header& fuseHeader,
Dispatcher* dispatcher)
: channel_(channel), fuseHeader_(fuseHeader), dispatcher_(dispatcher) {
}
: channel_(channel), fuseHeader_(fuseHeader), dispatcher_(dispatcher) {}
RequestData::~RequestData() {
channel_->finishRequest(fuseHeader_);

View File

@ -25,12 +25,12 @@
#include "eden/fs/utils/ControlMsg.h"
using folly::ByteRange;
using folly::checkUnixError;
using folly::IOBuf;
using folly::StringPiece;
using folly::checkUnixError;
using folly::throwSystemError;
using folly::io::Appender;
using folly::io::Cursor;
using folly::throwSystemError;
using std::string;
DEFINE_int32(

View File

@ -27,10 +27,10 @@ using namespace folly::string_piece_literals;
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;

View File

@ -21,10 +21,10 @@
#include "eden/fs/service/gen-cpp2/eden_types.h"
#include "eden/fs/store/ObjectStore.h"
using folly::Future;
using folly::Unit;
using folly::exception_wrapper;
using folly::Future;
using folly::makeFuture;
using folly::Unit;
using std::make_shared;
using std::vector;

View File

@ -23,8 +23,8 @@
#include "eden/fs/utils/Bug.h"
using folly::Future;
using folly::Unit;
using folly::makeFuture;
using folly::Unit;
using std::make_unique;
using std::shared_ptr;
using std::unique_ptr;

View File

@ -41,20 +41,19 @@
#include "eden/fs/utils/Bug.h"
#include "eden/fs/utils/Clock.h"
using facebook::eden::fusell::FuseChannelData;
using folly::Future;
using folly::StringPiece;
using folly::Unit;
using folly::Unit;
using folly::makeFuture;
using folly::setThreadName;
using folly::StringPiece;
using folly::to;
using std::chrono::system_clock;
using folly::Unit;
using std::make_shared;
using std::make_unique;
using std::shared_ptr;
using std::unique_ptr;
using std::vector;
using facebook::eden::fusell::FuseChannelData;
using std::chrono::system_clock;
DEFINE_int32(fuseNumThreads, 16, "how many fuse dispatcher threads to spawn");
@ -505,13 +504,12 @@ folly::Future<std::vector<CheckoutConflict>> EdenMount::checkout(
// Perform the requested checkout operation after the journal diff
// completes.
return journalDiffFuture.then(
[this, ctx, fromTree, toTree]() {
ctx->start(this->acquireRenameLock());
return this->getRootInode()
->checkout(ctx.get(), fromTree, toTree)
.then([toTree]() mutable { return toTree; });
});
return journalDiffFuture.then([this, ctx, fromTree, toTree]() {
ctx->start(this->acquireRenameLock());
return this->getRootInode()
->checkout(ctx.get(), fromTree, toTree)
.then([toTree]() mutable { return toTree; });
});
})
.then([this, ctx, oldParents, snapshotHash, journalDiffCallback](
std::shared_ptr<const Tree> toTree) {
@ -671,85 +669,86 @@ folly::Future<folly::Unit> EdenMount::startFuse(
folly::EventBase* eventBase,
std::shared_ptr<UnboundedQueueThreadPool> threadPool,
folly::Optional<FuseChannelData> takeoverData) {
return folly::makeFutureWith([this,
eventBase,
threadPool,
takeoverData =
std::move(takeoverData)]() mutable {
if (!doStateTransition(State::UNINITIALIZED, State::STARTING)) {
throw std::runtime_error("mount point has already been started");
}
return folly::makeFutureWith(
[this,
eventBase,
threadPool,
takeoverData = std::move(takeoverData)]() mutable {
if (!doStateTransition(State::UNINITIALIZED, State::STARTING)) {
throw std::runtime_error("mount point has already been started");
}
eventBase_ = eventBase;
threadPool_ = threadPool;
eventBase_ = eventBase;
threadPool_ = threadPool;
folly::File fuseDevice;
folly::Optional<fuse_init_out> connInfo;
folly::File fuseDevice;
folly::Optional<fuse_init_out> connInfo;
if (takeoverData.hasValue()) {
auto& channelData = takeoverData.value();
fuseDevice = std::move(channelData.fd);
connInfo = channelData.connInfo;
} else {
fuseDevice = fusell::privilegedFuseMount(path_.stringPiece());
}
if (takeoverData.hasValue()) {
auto& channelData = takeoverData.value();
fuseDevice = std::move(channelData.fd);
connInfo = channelData.connInfo;
} else {
fuseDevice = fusell::privilegedFuseMount(path_.stringPiece());
}
channel_ = std::make_unique<fusell::FuseChannel>(
std::move(fuseDevice),
path_,
eventBase_,
FLAGS_fuseNumThreads,
dispatcher_.get(),
connInfo);
channel_ = std::make_unique<fusell::FuseChannel>(
std::move(fuseDevice),
path_,
eventBase_,
FLAGS_fuseNumThreads,
dispatcher_.get(),
connInfo);
// we'll use this shortly to wait until the mount is started successfully.
auto initFuture = initFusePromise_.getFuture();
// we'll use this shortly to wait until the mount is started
// successfully.
auto initFuture = initFusePromise_.getFuture();
channel_->getThreadsStoppingFuture().then([this] {
// If threads are stopping before we got as far as setting the state to
// RUNNING, we must have experienced an error
if (doStateTransition(State::STARTING, State::FUSE_ERROR)) {
initFusePromise_.setException(
std::runtime_error("fuse session failed to initialize"));
} else {
// If we were RUNNING and a thread stopped, then record
// that transition to FUSE_DONE.
doStateTransition(State::RUNNING, State::FUSE_DONE);
}
});
channel_->getThreadsStoppingFuture().then([this] {
// If threads are stopping before we got as far as setting the state
// to RUNNING, we must have experienced an error
if (doStateTransition(State::STARTING, State::FUSE_ERROR)) {
initFusePromise_.setException(
std::runtime_error("fuse session failed to initialize"));
} else {
// If we were RUNNING and a thread stopped, then record
// that transition to FUSE_DONE.
doStateTransition(State::RUNNING, State::FUSE_DONE);
}
});
channel_->getSessionCompleteFuture().then([this] {
// In case we are performing a graceful restart,
// extract the fuse device now.
auto channelData = channel_->stealFuseDevice();
channel_.reset();
channel_->getSessionCompleteFuture().then([this] {
// In case we are performing a graceful restart,
// extract the fuse device now.
auto channelData = channel_->stealFuseDevice();
channel_.reset();
std::vector<AbsolutePath> bindMounts;
for (const auto& entry : bindMounts_) {
bindMounts.push_back(entry.pathInMountDir);
}
std::vector<AbsolutePath> bindMounts;
for (const auto& entry : bindMounts_) {
bindMounts.push_back(entry.pathInMountDir);
}
fuseCompletionPromise_.setValue(TakeoverData::MountInfo(
path_,
config_->getClientDirectory(),
bindMounts,
std::move(channelData.fd),
channelData.connInfo,
SerializedFileHandleMap{}, // placeholder
SerializedInodeMap{} // placeholder
));
});
fuseCompletionPromise_.setValue(TakeoverData::MountInfo(
path_,
config_->getClientDirectory(),
bindMounts,
std::move(channelData.fd),
channelData.connInfo,
SerializedFileHandleMap{}, // placeholder
SerializedInodeMap{} // placeholder
));
});
if (takeoverData.hasValue()) {
// When doing takeover, we are immediately ready.
doStateTransition(State::STARTING, State::RUNNING);
initFusePromise_.setValue();
}
if (takeoverData.hasValue()) {
// When doing takeover, we are immediately ready.
doStateTransition(State::STARTING, State::RUNNING);
initFusePromise_.setValue();
}
// wait for init to complete or error; this will throw an exception
// if the init procedure failed.
return initFuture;
});
// wait for init to complete or error; this will throw an exception
// if the init procedure failed.
return initFuture;
});
}
void EdenMount::mountStarted() {

View File

@ -31,11 +31,11 @@
#include "eden/fs/utils/XAttr.h"
using folly::ByteRange;
using folly::checkUnixError;
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;

View File

@ -23,8 +23,8 @@
using folly::Future;
using folly::Promise;
using folly::Unit;
using folly::throwSystemErrorExplicit;
using folly::Unit;
using std::string;
namespace facebook {

View File

@ -23,11 +23,11 @@ namespace eden {
using apache::thrift::CompactSerializer;
using folly::ByteRange;
using folly::fbvector;
using folly::File;
using folly::MutableStringPiece;
using folly::Optional;
using folly::StringPiece;
using folly::fbvector;
using std::make_unique;
using std::string;
using std::unique_ptr;

View File

@ -46,10 +46,10 @@
#include "eden/fs/utils/UnboundedQueueThreadPool.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;

View File

@ -29,12 +29,12 @@
using namespace facebook::eden;
using namespace std::chrono_literals;
using folly::Future;
using folly::makeFuture;
using folly::Optional;
using folly::StringPiece;
using folly::Unit;
using folly::makeFuture;
using std::chrono::system_clock;
using std::string;
using std::chrono::system_clock;
using testing::UnorderedElementsAre;
namespace std {

View File

@ -25,9 +25,9 @@
#include "eden/fs/testharness/TestUtil.h"
using namespace facebook::eden;
using ::testing::UnorderedElementsAre;
using folly::StringPiece;
using std::string;
using ::testing::UnorderedElementsAre;
class DiffResults {
public:

View File

@ -10,8 +10,8 @@
#include "eden/fs/inodes/EdenMount.h"
#include <folly/Range.h>
#include <folly/test/TestUtils.h>
#include <folly/chrono/Conv.h>
#include <folly/test/TestUtils.h>
#include <gtest/gtest.h>
#include "eden/fs/config/ClientConfig.h"

View File

@ -24,8 +24,8 @@
using namespace facebook::eden;
using folly::Future;
using folly::StringPiece;
using folly::makeFuture;
using folly::StringPiece;
using std::string;
class OverlayTest : public ::testing::Test {

View File

@ -18,8 +18,8 @@
#include <string>
using folly::ByteRange;
using folly::StringPiece;
using folly::range;
using folly::StringPiece;
using folly::ssl::OpenSSLHash;
using std::string;

View File

@ -77,10 +77,10 @@ using apache::thrift::ThriftServer;
using facebook::eden::fusell::FuseChannelData;
using folly::File;
using folly::Future;
using folly::makeFuture;
using folly::Optional;
using folly::StringPiece;
using folly::Unit;
using folly::makeFuture;
using std::make_shared;
using std::shared_ptr;
using std::string;
@ -568,7 +568,6 @@ folly::Future<std::shared_ptr<EdenMount>> EdenServer::mount(
doTakeover,
edenMount,
optionalTakeover = std::move(optionalTakeover)]() mutable {
addToMountPoints(edenMount);
return (optionalTakeover ? performTakeoverFuseStart(

View File

@ -43,9 +43,9 @@
#include "eden/fs/store/ObjectStore.h"
using folly::Future;
using folly::makeFuture;
using folly::Optional;
using folly::StringPiece;
using folly::makeFuture;
using std::make_unique;
using std::string;
using std::unique_ptr;

View File

@ -12,8 +12,8 @@
#include "eden/fs/inodes/TreeInode.h"
using folly::Future;
using folly::StringPiece;
using folly::makeFuture;
using folly::StringPiece;
using std::make_unique;
using std::string;
using std::unique_ptr;

View File

@ -24,8 +24,8 @@
using folly::ByteRange;
using folly::Future;
using folly::IOBuf;
using folly::StringPiece;
using folly::makeFuture;
using folly::StringPiece;
using std::make_unique;
using std::string;
using std::unique_ptr;

View File

@ -24,8 +24,8 @@
using folly::ByteRange;
using folly::Future;
using folly::StringPiece;
using folly::makeFuture;
using folly::StringPiece;
using std::make_unique;
using std::unique_ptr;
using KeySpace = facebook::eden::LocalStore::KeySpace;

View File

@ -33,8 +33,8 @@
#include "eden/fs/utils/PathFuncs.h"
#include "eden/fs/utils/TimeUtil.h"
#include "hgext/extlib/cstore/uniondatapackstore.h"
#include "hgext/extlib/ctreemanifest/treemanifest.h"
#include "hgext/extlib/cstore/uniondatapackstore.h" // @manual=//scm/hg:datapack
#include "hgext/extlib/ctreemanifest/treemanifest.h" // @manual=//scm/hg:datapack
using folly::ByteRange;
using folly::Endian;

View File

@ -23,15 +23,15 @@
using folly::Future;
using folly::IOBuf;
using folly::makeFuture;
using folly::make_exception_wrapper;
using folly::makeFuture;
using proxygen::ErrorCode;
using proxygen::HTTPException;
using proxygen::HTTPHeaders;
using proxygen::HTTPMessage;
using proxygen::HTTPTransaction;
using proxygen::URL;
using proxygen::UpgradeProtocol;
using proxygen::URL;
namespace facebook {
namespace eden {

View File

@ -24,8 +24,8 @@ using namespace facebook::eden;
using folly::IOBuf;
using folly::StringPiece;
using folly::test::TemporaryDirectory;
using folly::unhexlify;
using folly::test::TemporaryDirectory;
using std::string;
using KeySpace = facebook::eden::LocalStore::KeySpace;

View File

@ -14,9 +14,9 @@
#include <folly/io/IOBuf.h>
#include <thrift/lib/cpp2/protocol/Serializer.h>
using apache::thrift::CompactSerializer;
using folly::IOBuf;
using std::string;
using apache::thrift::CompactSerializer;
namespace facebook {
namespace eden {

View File

@ -28,13 +28,13 @@
using namespace std::literals::chrono_literals;
using folly::AsyncServerSocket;
using folly::checkUnixError;
using folly::exceptionStr;
using folly::Future;
using folly::makeFuture;
using folly::SocketAddress;
using folly::StringPiece;
using folly::Unit;
using folly::checkUnixError;
using folly::exceptionStr;
using folly::makeFuture;
using std::make_unique;
namespace facebook {

View File

@ -21,14 +21,14 @@
#include "eden/fs/takeover/TakeoverServer.h"
using namespace facebook::eden;
using ::testing::ElementsAre;
using ::testing::ElementsAreArray;
using folly::EventBase;
using folly::Future;
using folly::Promise;
using folly::makeFuture;
using folly::Promise;
using folly::test::TemporaryDirectory;
using std::string;
using ::testing::ElementsAre;
using ::testing::ElementsAreArray;
using namespace std::literals::chrono_literals;
namespace {

View File

@ -23,8 +23,8 @@
using folly::ByteRange;
using folly::Future;
using folly::IOBuf;
using folly::StringPiece;
using folly::makeFuture;
using folly::StringPiece;
using std::make_unique;
using std::unique_ptr;

View File

@ -32,9 +32,9 @@
using folly::ByteRange;
using folly::Future;
using folly::makeFuture;
using folly::StringPiece;
using folly::Unit;
using folly::makeFuture;
using folly::test::TemporaryDirectory;
using folly::test::TemporaryFile;
using std::make_shared;

View File

@ -13,12 +13,12 @@
#include <folly/experimental/logging/xlog.h>
#include <folly/io/async/AsyncTimeout.h>
using folly::exception_wrapper;
using folly::Future;
using folly::make_exception_wrapper;
using folly::makeFuture;
using folly::Promise;
using folly::Unit;
using folly::exception_wrapper;
using folly::makeFuture;
using folly::make_exception_wrapper;
namespace facebook {
namespace eden {

View File

@ -25,18 +25,18 @@
using folly::ByteRange;
using folly::EventBase;
using folly::exception_wrapper;
using folly::File;
using folly::Future;
using folly::IOBuf;
using folly::MutableByteRange;
using folly::Unit;
using folly::exception_wrapper;
using folly::io::Cursor;
using folly::io::RWPrivateCursor;
using folly::makeSystemError;
using folly::make_exception_wrapper;
using folly::makeSystemError;
using folly::MutableByteRange;
using folly::throwSystemError;
using folly::throwSystemErrorExplicit;
using folly::Unit;
using folly::io::Cursor;
using folly::io::RWPrivateCursor;
using std::unique_ptr;
using std::vector;

View File

@ -19,9 +19,9 @@
using facebook::eden::IoFuture;
using facebook::eden::waitForIO;
using folly::checkUnixError;
using folly::EventBase;
using folly::EventHandler;
using folly::checkUnixError;
using namespace std::chrono_literals;
namespace {

View File

@ -23,13 +23,13 @@
#include <gtest/gtest.h>
using folly::ByteRange;
using folly::checkUnixError;
using folly::errnoStr;
using folly::EventBase;
using folly::File;
using folly::IOBuf;
using folly::StringPiece;
using folly::checkUnixError;
using folly::errnoStr;
using folly::makeFuture;
using folly::StringPiece;
using folly::test::TemporaryFile;
using std::make_unique;
using namespace std::chrono_literals;