mirror of
https://github.com/facebook/sapling.git
synced 2024-10-04 22:07:44 +03:00
Apply clang-format update fixes
Reviewed By: igorsugak Differential Revision: D25861960 fbshipit-source-id: e3c39c080429058a58cdc66d45350e5d1420f98c
This commit is contained in:
parent
239356ffa9
commit
21c95391ca
@ -190,17 +190,20 @@ class EdenConfig : private ConfigSettingManager {
|
||||
*/
|
||||
|
||||
public:
|
||||
ConfigSetting<AbsolutePath> edenDir{"core:edenDirectory",
|
||||
kUnspecifiedDefault,
|
||||
this};
|
||||
ConfigSetting<AbsolutePath> edenDir{
|
||||
"core:edenDirectory",
|
||||
kUnspecifiedDefault,
|
||||
this};
|
||||
|
||||
ConfigSetting<AbsolutePath> systemIgnoreFile{"core:systemIgnoreFile",
|
||||
kUnspecifiedDefault,
|
||||
this};
|
||||
ConfigSetting<AbsolutePath> systemIgnoreFile{
|
||||
"core:systemIgnoreFile",
|
||||
kUnspecifiedDefault,
|
||||
this};
|
||||
|
||||
ConfigSetting<AbsolutePath> userIgnoreFile{"core:ignoreFile",
|
||||
kUnspecifiedDefault,
|
||||
this};
|
||||
ConfigSetting<AbsolutePath> userIgnoreFile{
|
||||
"core:ignoreFile",
|
||||
kUnspecifiedDefault,
|
||||
this};
|
||||
|
||||
/**
|
||||
* How often to check the on-disk lock file to ensure it is still valid.
|
||||
@ -211,13 +214,15 @@ class EdenConfig : private ConfigSettingManager {
|
||||
std::chrono::minutes(5),
|
||||
this};
|
||||
|
||||
ConfigSetting<bool> allowUnixGroupRequests{"thrift:allow-unix-group-requests",
|
||||
false,
|
||||
this};
|
||||
ConfigSetting<bool> allowUnixGroupRequests{
|
||||
"thrift:allow-unix-group-requests",
|
||||
false,
|
||||
this};
|
||||
|
||||
ConfigSetting<AbsolutePath> clientCertificate{"ssl:client-certificate",
|
||||
kUnspecifiedDefault,
|
||||
this};
|
||||
ConfigSetting<AbsolutePath> clientCertificate{
|
||||
"ssl:client-certificate",
|
||||
kUnspecifiedDefault,
|
||||
this};
|
||||
ConfigSetting<std::vector<AbsolutePath>> clientCertificateLocations{
|
||||
"ssl:client-certificate-locations",
|
||||
std::vector<AbsolutePath>{},
|
||||
@ -228,23 +233,26 @@ class EdenConfig : private ConfigSettingManager {
|
||||
/**
|
||||
* Which tier to use when talking to mononoke.
|
||||
*/
|
||||
ConfigSetting<std::string> mononokeTierName{"mononoke:tier",
|
||||
"mononoke-apiserver",
|
||||
this};
|
||||
ConfigSetting<std::string> mononokeTierName{
|
||||
"mononoke:tier",
|
||||
"mononoke-apiserver",
|
||||
this};
|
||||
ConfigSetting<std::string> mononokeHostName{"mononoke:hostname", "", this};
|
||||
ConfigSetting<uint16_t> mononokePort{"mononoke:port", 443, this};
|
||||
ConfigSetting<std::string> mononokeConnectionType{"mononoke:connection-type",
|
||||
"http",
|
||||
this};
|
||||
ConfigSetting<std::string> mononokeConnectionType{
|
||||
"mononoke:connection-type",
|
||||
"http",
|
||||
this};
|
||||
|
||||
/**
|
||||
* Source Control Service (scs) tier
|
||||
*/
|
||||
ConfigSetting<bool> useScs{"scs:use-mononoke-scs", false, this};
|
||||
|
||||
ConfigSetting<std::string> scsTierName{"scs:tier",
|
||||
"mononoke-scs-server",
|
||||
this};
|
||||
ConfigSetting<std::string> scsTierName{
|
||||
"scs:tier",
|
||||
"mononoke-scs-server",
|
||||
this};
|
||||
ConfigSetting<bool> useManifestBasedFetching{
|
||||
"scs:use-manifest-based-fetching",
|
||||
false,
|
||||
@ -275,18 +283,20 @@ class EdenConfig : private ConfigSettingManager {
|
||||
* thresholds.
|
||||
*/
|
||||
|
||||
ConfigSetting<uint64_t> localStoreBlobSizeLimit{"store:blob-size-limit",
|
||||
15'000'000'000,
|
||||
this};
|
||||
ConfigSetting<uint64_t> localStoreBlobSizeLimit{
|
||||
"store:blob-size-limit",
|
||||
15'000'000'000,
|
||||
this};
|
||||
|
||||
ConfigSetting<uint64_t> localStoreBlobMetaSizeLimit{
|
||||
"store:blobmeta-size-limit",
|
||||
1'000'000'000,
|
||||
this};
|
||||
|
||||
ConfigSetting<uint64_t> localStoreTreeSizeLimit{"store:tree-size-limit",
|
||||
3'000'000'000,
|
||||
this};
|
||||
ConfigSetting<uint64_t> localStoreTreeSizeLimit{
|
||||
"store:tree-size-limit",
|
||||
3'000'000'000,
|
||||
this};
|
||||
|
||||
ConfigSetting<uint64_t> localStoreTreeMetaSizeLimit{
|
||||
"store:treemeta-size-limit",
|
||||
@ -298,9 +308,10 @@ class EdenConfig : private ConfigSettingManager {
|
||||
20'000'000,
|
||||
this};
|
||||
|
||||
ConfigSetting<bool> useEdenNativePrefetch{"store:use-eden-native-prefetch",
|
||||
false,
|
||||
this};
|
||||
ConfigSetting<bool> useEdenNativePrefetch{
|
||||
"store:use-eden-native-prefetch",
|
||||
false,
|
||||
this};
|
||||
|
||||
/**
|
||||
* The maximum time duration allowed for a fuse request. If a request exceeds
|
||||
@ -327,9 +338,10 @@ class EdenConfig : private ConfigSettingManager {
|
||||
* If the number of fetching requests of a process reaches this number,
|
||||
* a FetchHeavy event will be sent to Scuba.
|
||||
*/
|
||||
ConfigSetting<uint32_t> fetchHeavyThreshold{"store:fetch-heavy-threshold",
|
||||
2000,
|
||||
this};
|
||||
ConfigSetting<uint32_t> fetchHeavyThreshold{
|
||||
"store:fetch-heavy-threshold",
|
||||
2000,
|
||||
this};
|
||||
|
||||
/**
|
||||
* The maximum time duration that the kernel should allow for a fuse request.
|
||||
@ -372,9 +384,10 @@ class EdenConfig : private ConfigSettingManager {
|
||||
/**
|
||||
* Scribe category is the first argument passed to the scribe_cat binary.
|
||||
*/
|
||||
ConfigSetting<std::string> scribeCategory{"telemetry:scribe-category",
|
||||
"",
|
||||
this};
|
||||
ConfigSetting<std::string> scribeCategory{
|
||||
"telemetry:scribe-category",
|
||||
"",
|
||||
this};
|
||||
|
||||
/**
|
||||
* Legacy to be deleted, once all running eden's are compatible with
|
||||
@ -401,9 +414,10 @@ class EdenConfig : private ConfigSettingManager {
|
||||
/**
|
||||
* Controls whether if EdenFS caches blobs in local store.
|
||||
*/
|
||||
ConfigSetting<bool> enableBlobCaching{"experimental:enable-blob-caching",
|
||||
false,
|
||||
this};
|
||||
ConfigSetting<bool> enableBlobCaching{
|
||||
"experimental:enable-blob-caching",
|
||||
false,
|
||||
this};
|
||||
|
||||
/**
|
||||
* Controls whether EdenFS uses EdenApi to import data from remote.
|
||||
@ -414,9 +428,10 @@ class EdenConfig : private ConfigSettingManager {
|
||||
* The maximum number of tree prefetch operations to allow in parallel for any
|
||||
* checkout. Setting this to 0 will disable prefetch operations.
|
||||
*/
|
||||
ConfigSetting<uint64_t> maxTreePrefetches{"store:max-tree-prefetches",
|
||||
5,
|
||||
this};
|
||||
ConfigSetting<uint64_t> maxTreePrefetches{
|
||||
"store:max-tree-prefetches",
|
||||
5,
|
||||
this};
|
||||
/**
|
||||
* A command to run to warn the user of a generic problem encountered
|
||||
* while trying to process a request.
|
||||
|
@ -182,20 +182,22 @@ TEST_F(CheckoutConfigTest, testBadSnapshot) {
|
||||
StringPiece{"eden\0\0\0\x0exyza", 12},
|
||||
"unsupported eden SNAPSHOT file format \\(version 14\\)");
|
||||
testBadSnapshot(
|
||||
StringPiece{"eden\00\00\00\01"
|
||||
"\x99\x88\x77\x66\x55\x44\x33\x22\x11\x00"
|
||||
"\xaa\xbb\xcc\xdd\xee\xff\xab\xcd\xef\x99"
|
||||
"\xab\xcd\xef\x98\x76\x54\x32\x10\x01\x23"
|
||||
"\x45\x67\x89\xab\xcd\xef\x00\x11\x22",
|
||||
47},
|
||||
StringPiece{
|
||||
"eden\00\00\00\01"
|
||||
"\x99\x88\x77\x66\x55\x44\x33\x22\x11\x00"
|
||||
"\xaa\xbb\xcc\xdd\xee\xff\xab\xcd\xef\x99"
|
||||
"\xab\xcd\xef\x98\x76\x54\x32\x10\x01\x23"
|
||||
"\x45\x67\x89\xab\xcd\xef\x00\x11\x22",
|
||||
47},
|
||||
"unexpected length for eden SNAPSHOT file");
|
||||
testBadSnapshot(
|
||||
StringPiece{"eden\00\00\00\01"
|
||||
"\x99\x88\x77\x66\x55\x44\x33\x22\x11\x00"
|
||||
"\xaa\xbb\xcc\xdd\xee\xff\xab\xcd\xef\x99"
|
||||
"\xab\xcd\xef\x98\x76\x54\x32\x10\x01\x23"
|
||||
"\x45\x67\x89\xab\xcd\xef\x00\x11\x22\x33\x44",
|
||||
49},
|
||||
StringPiece{
|
||||
"eden\00\00\00\01"
|
||||
"\x99\x88\x77\x66\x55\x44\x33\x22\x11\x00"
|
||||
"\xaa\xbb\xcc\xdd\xee\xff\xab\xcd\xef\x99"
|
||||
"\xab\xcd\xef\x98\x76\x54\x32\x10\x01\x23"
|
||||
"\x45\x67\x89\xab\xcd\xef\x00\x11\x22\x33\x44",
|
||||
49},
|
||||
"unexpected length for eden SNAPSHOT file");
|
||||
|
||||
// The error type and message for this will probably change in the future
|
||||
@ -203,11 +205,12 @@ TEST_F(CheckoutConfigTest, testBadSnapshot) {
|
||||
// ASCII string containing the snapshot hash).
|
||||
testBadSnapshot<std::invalid_argument>("ede", "incorrect data size for Hash");
|
||||
testBadSnapshot<std::invalid_argument>(
|
||||
StringPiece{"xden\00\00\00\01"
|
||||
"\x99\x88\x77\x66\x55\x44\x33\x22\x11\x00"
|
||||
"\xaa\xbb\xcc\xdd\xee\xff\xab\xcd\xef\x99"
|
||||
"\xab\xcd\xef\x98\x76\x54\x32\x10\x01\x23"
|
||||
"\x45\x67\x89\xab\xcd\xef\x00\x11\x22\x33",
|
||||
48},
|
||||
StringPiece{
|
||||
"xden\00\00\00\01"
|
||||
"\x99\x88\x77\x66\x55\x44\x33\x22\x11\x00"
|
||||
"\xaa\xbb\xcc\xdd\xee\xff\xab\xcd\xef\x99"
|
||||
"\xab\xcd\xef\x98\x76\x54\x32\x10\x01\x23"
|
||||
"\x45\x67\x89\xab\xcd\xef\x00\x11\x22\x33",
|
||||
48},
|
||||
"incorrect data size for Hash");
|
||||
}
|
||||
|
@ -427,12 +427,13 @@ TEST_F(EdenConfigTest, variablesExpandInPathOptions) {
|
||||
|
||||
auto userConfigPath = rootTestDir_ + "user-edenrc"_pc;
|
||||
auto getConfig = [&]() {
|
||||
auto config = EdenConfig{"testusername"_sp,
|
||||
uid_t{42},
|
||||
AbsolutePath("/testhomedir"),
|
||||
userConfigPath,
|
||||
systemConfigDir,
|
||||
systemConfigDir + "system-edenrc"_pc};
|
||||
auto config = EdenConfig{
|
||||
"testusername"_sp,
|
||||
uid_t{42},
|
||||
AbsolutePath("/testhomedir"),
|
||||
userConfigPath,
|
||||
systemConfigDir,
|
||||
systemConfigDir + "system-edenrc"_pc};
|
||||
config.loadUserConfig();
|
||||
return EdenConfig{config};
|
||||
};
|
||||
@ -487,12 +488,13 @@ TEST_F(EdenConfigTest, missing_config_files_never_change) {
|
||||
|
||||
ensureDirectoryExists(systemConfigDir);
|
||||
|
||||
EdenConfig config{"username",
|
||||
42,
|
||||
userConfigDir,
|
||||
userConfigPath,
|
||||
systemConfigDir,
|
||||
systemConfigPath};
|
||||
EdenConfig config{
|
||||
"username",
|
||||
42,
|
||||
userConfigDir,
|
||||
userConfigPath,
|
||||
systemConfigDir,
|
||||
systemConfigPath};
|
||||
config.loadUserConfig();
|
||||
EXPECT_EQ(FileChangeReason::NONE, config.hasUserConfigFileChanged().reason);
|
||||
}
|
||||
|
@ -54,11 +54,11 @@ std::vector<DirList::ExtractedEntry> DirList::extract() const {
|
||||
char* p = buf_.get();
|
||||
while (p != cur_) {
|
||||
auto entry = reinterpret_cast<fuse_dirent*>(p);
|
||||
result.emplace_back(
|
||||
ExtractedEntry{std::string{entry->name, entry->name + entry->namelen},
|
||||
entry->ino,
|
||||
static_cast<dtype_t>(entry->type),
|
||||
static_cast<off_t>(entry->off)});
|
||||
result.emplace_back(ExtractedEntry{
|
||||
std::string{entry->name, entry->name + entry->namelen},
|
||||
entry->ino,
|
||||
static_cast<dtype_t>(entry->type),
|
||||
static_cast<off_t>(entry->off)});
|
||||
|
||||
p += FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + entry->namelen);
|
||||
}
|
||||
|
@ -258,162 +258,193 @@ constexpr auto kFuseHandlers = [] {
|
||||
// Rely on assignment out of bounds to a constexpr array giving a
|
||||
// compiler error.
|
||||
std::array<HandlerEntry, 64> handlers;
|
||||
handlers[FUSE_LOOKUP] = {"FUSE_LOOKUP",
|
||||
&FuseChannel::fuseLookup,
|
||||
&argrender::lookup,
|
||||
&ChannelThreadStats::lookup,
|
||||
Read};
|
||||
handlers[FUSE_FORGET] = {"FUSE_FORGET",
|
||||
&FuseChannel::fuseForget,
|
||||
&argrender::forget,
|
||||
&ChannelThreadStats::forget};
|
||||
handlers[FUSE_GETATTR] = {"FUSE_GETATTR",
|
||||
&FuseChannel::fuseGetAttr,
|
||||
&argrender::getattr,
|
||||
&ChannelThreadStats::getattr,
|
||||
Read};
|
||||
handlers[FUSE_SETATTR] = {"FUSE_SETATTR",
|
||||
&FuseChannel::fuseSetAttr,
|
||||
&argrender::setattr,
|
||||
&ChannelThreadStats::setattr,
|
||||
Write};
|
||||
handlers[FUSE_READLINK] = {"FUSE_READLINK",
|
||||
&FuseChannel::fuseReadLink,
|
||||
&argrender::readlink,
|
||||
&ChannelThreadStats::readlink,
|
||||
Read};
|
||||
handlers[FUSE_SYMLINK] = {"FUSE_SYMLINK",
|
||||
&FuseChannel::fuseSymlink,
|
||||
&argrender::symlink,
|
||||
&ChannelThreadStats::symlink,
|
||||
Write};
|
||||
handlers[FUSE_MKNOD] = {"FUSE_MKNOD",
|
||||
&FuseChannel::fuseMknod,
|
||||
&argrender::mknod,
|
||||
&ChannelThreadStats::mknod,
|
||||
Write};
|
||||
handlers[FUSE_MKDIR] = {"FUSE_MKDIR",
|
||||
&FuseChannel::fuseMkdir,
|
||||
&argrender::mkdir,
|
||||
&ChannelThreadStats::mkdir,
|
||||
Write};
|
||||
handlers[FUSE_UNLINK] = {"FUSE_UNLINK",
|
||||
&FuseChannel::fuseUnlink,
|
||||
&argrender::unlink,
|
||||
&ChannelThreadStats::unlink,
|
||||
Write};
|
||||
handlers[FUSE_RMDIR] = {"FUSE_RMDIR",
|
||||
&FuseChannel::fuseRmdir,
|
||||
&argrender::rmdir,
|
||||
&ChannelThreadStats::rmdir,
|
||||
Write};
|
||||
handlers[FUSE_RENAME] = {"FUSE_RENAME",
|
||||
&FuseChannel::fuseRename,
|
||||
&argrender::rename,
|
||||
&ChannelThreadStats::rename,
|
||||
Write};
|
||||
handlers[FUSE_LINK] = {"FUSE_LINK",
|
||||
&FuseChannel::fuseLink,
|
||||
&argrender::link,
|
||||
&ChannelThreadStats::link,
|
||||
Write};
|
||||
handlers[FUSE_OPEN] = {"FUSE_OPEN",
|
||||
&FuseChannel::fuseOpen,
|
||||
&argrender::open,
|
||||
&ChannelThreadStats::open};
|
||||
handlers[FUSE_READ] = {"FUSE_READ",
|
||||
&FuseChannel::fuseRead,
|
||||
&argrender::read,
|
||||
&ChannelThreadStats::read,
|
||||
Read};
|
||||
handlers[FUSE_WRITE] = {"FUSE_WRITE",
|
||||
&FuseChannel::fuseWrite,
|
||||
&argrender::write,
|
||||
&ChannelThreadStats::write,
|
||||
Write};
|
||||
handlers[FUSE_STATFS] = {"FUSE_STATFS",
|
||||
&FuseChannel::fuseStatFs,
|
||||
&argrender::statfs,
|
||||
&ChannelThreadStats::statfs,
|
||||
Read};
|
||||
handlers[FUSE_RELEASE] = {"FUSE_RELEASE",
|
||||
&FuseChannel::fuseRelease,
|
||||
&argrender::release,
|
||||
&ChannelThreadStats::release};
|
||||
handlers[FUSE_FSYNC] = {"FUSE_FSYNC",
|
||||
&FuseChannel::fuseFsync,
|
||||
&argrender::fsync,
|
||||
&ChannelThreadStats::fsync,
|
||||
Write};
|
||||
handlers[FUSE_SETXATTR] = {"FUSE_SETXATTR",
|
||||
&FuseChannel::fuseSetXAttr,
|
||||
&argrender::setxattr,
|
||||
&ChannelThreadStats::setxattr,
|
||||
Write};
|
||||
handlers[FUSE_GETXATTR] = {"FUSE_GETXATTR",
|
||||
&FuseChannel::fuseGetXAttr,
|
||||
&argrender::getxattr,
|
||||
&ChannelThreadStats::getxattr,
|
||||
Read};
|
||||
handlers[FUSE_LISTXATTR] = {"FUSE_LISTXATTR",
|
||||
&FuseChannel::fuseListXAttr,
|
||||
&argrender::listxattr,
|
||||
&ChannelThreadStats::listxattr,
|
||||
Read};
|
||||
handlers[FUSE_REMOVEXATTR] = {"FUSE_REMOVEXATTR",
|
||||
&FuseChannel::fuseRemoveXAttr,
|
||||
&argrender::removexattr,
|
||||
&ChannelThreadStats::removexattr,
|
||||
Write};
|
||||
handlers[FUSE_FLUSH] = {"FUSE_FLUSH",
|
||||
&FuseChannel::fuseFlush,
|
||||
&argrender::flush,
|
||||
&ChannelThreadStats::flush};
|
||||
handlers[FUSE_LOOKUP] = {
|
||||
"FUSE_LOOKUP",
|
||||
&FuseChannel::fuseLookup,
|
||||
&argrender::lookup,
|
||||
&ChannelThreadStats::lookup,
|
||||
Read};
|
||||
handlers[FUSE_FORGET] = {
|
||||
"FUSE_FORGET",
|
||||
&FuseChannel::fuseForget,
|
||||
&argrender::forget,
|
||||
&ChannelThreadStats::forget};
|
||||
handlers[FUSE_GETATTR] = {
|
||||
"FUSE_GETATTR",
|
||||
&FuseChannel::fuseGetAttr,
|
||||
&argrender::getattr,
|
||||
&ChannelThreadStats::getattr,
|
||||
Read};
|
||||
handlers[FUSE_SETATTR] = {
|
||||
"FUSE_SETATTR",
|
||||
&FuseChannel::fuseSetAttr,
|
||||
&argrender::setattr,
|
||||
&ChannelThreadStats::setattr,
|
||||
Write};
|
||||
handlers[FUSE_READLINK] = {
|
||||
"FUSE_READLINK",
|
||||
&FuseChannel::fuseReadLink,
|
||||
&argrender::readlink,
|
||||
&ChannelThreadStats::readlink,
|
||||
Read};
|
||||
handlers[FUSE_SYMLINK] = {
|
||||
"FUSE_SYMLINK",
|
||||
&FuseChannel::fuseSymlink,
|
||||
&argrender::symlink,
|
||||
&ChannelThreadStats::symlink,
|
||||
Write};
|
||||
handlers[FUSE_MKNOD] = {
|
||||
"FUSE_MKNOD",
|
||||
&FuseChannel::fuseMknod,
|
||||
&argrender::mknod,
|
||||
&ChannelThreadStats::mknod,
|
||||
Write};
|
||||
handlers[FUSE_MKDIR] = {
|
||||
"FUSE_MKDIR",
|
||||
&FuseChannel::fuseMkdir,
|
||||
&argrender::mkdir,
|
||||
&ChannelThreadStats::mkdir,
|
||||
Write};
|
||||
handlers[FUSE_UNLINK] = {
|
||||
"FUSE_UNLINK",
|
||||
&FuseChannel::fuseUnlink,
|
||||
&argrender::unlink,
|
||||
&ChannelThreadStats::unlink,
|
||||
Write};
|
||||
handlers[FUSE_RMDIR] = {
|
||||
"FUSE_RMDIR",
|
||||
&FuseChannel::fuseRmdir,
|
||||
&argrender::rmdir,
|
||||
&ChannelThreadStats::rmdir,
|
||||
Write};
|
||||
handlers[FUSE_RENAME] = {
|
||||
"FUSE_RENAME",
|
||||
&FuseChannel::fuseRename,
|
||||
&argrender::rename,
|
||||
&ChannelThreadStats::rename,
|
||||
Write};
|
||||
handlers[FUSE_LINK] = {
|
||||
"FUSE_LINK",
|
||||
&FuseChannel::fuseLink,
|
||||
&argrender::link,
|
||||
&ChannelThreadStats::link,
|
||||
Write};
|
||||
handlers[FUSE_OPEN] = {
|
||||
"FUSE_OPEN",
|
||||
&FuseChannel::fuseOpen,
|
||||
&argrender::open,
|
||||
&ChannelThreadStats::open};
|
||||
handlers[FUSE_READ] = {
|
||||
"FUSE_READ",
|
||||
&FuseChannel::fuseRead,
|
||||
&argrender::read,
|
||||
&ChannelThreadStats::read,
|
||||
Read};
|
||||
handlers[FUSE_WRITE] = {
|
||||
"FUSE_WRITE",
|
||||
&FuseChannel::fuseWrite,
|
||||
&argrender::write,
|
||||
&ChannelThreadStats::write,
|
||||
Write};
|
||||
handlers[FUSE_STATFS] = {
|
||||
"FUSE_STATFS",
|
||||
&FuseChannel::fuseStatFs,
|
||||
&argrender::statfs,
|
||||
&ChannelThreadStats::statfs,
|
||||
Read};
|
||||
handlers[FUSE_RELEASE] = {
|
||||
"FUSE_RELEASE",
|
||||
&FuseChannel::fuseRelease,
|
||||
&argrender::release,
|
||||
&ChannelThreadStats::release};
|
||||
handlers[FUSE_FSYNC] = {
|
||||
"FUSE_FSYNC",
|
||||
&FuseChannel::fuseFsync,
|
||||
&argrender::fsync,
|
||||
&ChannelThreadStats::fsync,
|
||||
Write};
|
||||
handlers[FUSE_SETXATTR] = {
|
||||
"FUSE_SETXATTR",
|
||||
&FuseChannel::fuseSetXAttr,
|
||||
&argrender::setxattr,
|
||||
&ChannelThreadStats::setxattr,
|
||||
Write};
|
||||
handlers[FUSE_GETXATTR] = {
|
||||
"FUSE_GETXATTR",
|
||||
&FuseChannel::fuseGetXAttr,
|
||||
&argrender::getxattr,
|
||||
&ChannelThreadStats::getxattr,
|
||||
Read};
|
||||
handlers[FUSE_LISTXATTR] = {
|
||||
"FUSE_LISTXATTR",
|
||||
&FuseChannel::fuseListXAttr,
|
||||
&argrender::listxattr,
|
||||
&ChannelThreadStats::listxattr,
|
||||
Read};
|
||||
handlers[FUSE_REMOVEXATTR] = {
|
||||
"FUSE_REMOVEXATTR",
|
||||
&FuseChannel::fuseRemoveXAttr,
|
||||
&argrender::removexattr,
|
||||
&ChannelThreadStats::removexattr,
|
||||
Write};
|
||||
handlers[FUSE_FLUSH] = {
|
||||
"FUSE_FLUSH",
|
||||
&FuseChannel::fuseFlush,
|
||||
&argrender::flush,
|
||||
&ChannelThreadStats::flush};
|
||||
handlers[FUSE_INIT] = {"FUSE_INIT"};
|
||||
handlers[FUSE_OPENDIR] = {"FUSE_OPENDIR",
|
||||
&FuseChannel::fuseOpenDir,
|
||||
&argrender::opendir,
|
||||
&ChannelThreadStats::opendir};
|
||||
handlers[FUSE_READDIR] = {"FUSE_READDIR",
|
||||
&FuseChannel::fuseReadDir,
|
||||
&argrender::readdir,
|
||||
&ChannelThreadStats::readdir,
|
||||
Read};
|
||||
handlers[FUSE_RELEASEDIR] = {"FUSE_RELEASEDIR",
|
||||
&FuseChannel::fuseReleaseDir,
|
||||
&argrender::releasedir,
|
||||
&ChannelThreadStats::releasedir};
|
||||
handlers[FUSE_FSYNCDIR] = {"FUSE_FSYNCDIR",
|
||||
&FuseChannel::fuseFsyncDir,
|
||||
&argrender::fsyncdir,
|
||||
&ChannelThreadStats::fsyncdir,
|
||||
Write};
|
||||
handlers[FUSE_OPENDIR] = {
|
||||
"FUSE_OPENDIR",
|
||||
&FuseChannel::fuseOpenDir,
|
||||
&argrender::opendir,
|
||||
&ChannelThreadStats::opendir};
|
||||
handlers[FUSE_READDIR] = {
|
||||
"FUSE_READDIR",
|
||||
&FuseChannel::fuseReadDir,
|
||||
&argrender::readdir,
|
||||
&ChannelThreadStats::readdir,
|
||||
Read};
|
||||
handlers[FUSE_RELEASEDIR] = {
|
||||
"FUSE_RELEASEDIR",
|
||||
&FuseChannel::fuseReleaseDir,
|
||||
&argrender::releasedir,
|
||||
&ChannelThreadStats::releasedir};
|
||||
handlers[FUSE_FSYNCDIR] = {
|
||||
"FUSE_FSYNCDIR",
|
||||
&FuseChannel::fuseFsyncDir,
|
||||
&argrender::fsyncdir,
|
||||
&ChannelThreadStats::fsyncdir,
|
||||
Write};
|
||||
handlers[FUSE_GETLK] = {"FUSE_GETLK"};
|
||||
handlers[FUSE_SETLK] = {"FUSE_SETLK"};
|
||||
handlers[FUSE_SETLKW] = {"FUSE_SETLKW"};
|
||||
handlers[FUSE_ACCESS] = {"FUSE_ACCESS",
|
||||
&FuseChannel::fuseAccess,
|
||||
&argrender::access,
|
||||
&ChannelThreadStats::access,
|
||||
Read};
|
||||
handlers[FUSE_CREATE] = {"FUSE_CREATE",
|
||||
&FuseChannel::fuseCreate,
|
||||
&argrender::create,
|
||||
&ChannelThreadStats::create,
|
||||
Write};
|
||||
handlers[FUSE_ACCESS] = {
|
||||
"FUSE_ACCESS",
|
||||
&FuseChannel::fuseAccess,
|
||||
&argrender::access,
|
||||
&ChannelThreadStats::access,
|
||||
Read};
|
||||
handlers[FUSE_CREATE] = {
|
||||
"FUSE_CREATE",
|
||||
&FuseChannel::fuseCreate,
|
||||
&argrender::create,
|
||||
&ChannelThreadStats::create,
|
||||
Write};
|
||||
handlers[FUSE_INTERRUPT] = {"FUSE_INTERRUPT"};
|
||||
handlers[FUSE_BMAP] = {"FUSE_BMAP",
|
||||
&FuseChannel::fuseBmap,
|
||||
&argrender::bmap,
|
||||
&ChannelThreadStats::bmap};
|
||||
handlers[FUSE_BMAP] = {
|
||||
"FUSE_BMAP",
|
||||
&FuseChannel::fuseBmap,
|
||||
&argrender::bmap,
|
||||
&ChannelThreadStats::bmap};
|
||||
handlers[FUSE_DESTROY] = {"FUSE_DESTROY"};
|
||||
handlers[FUSE_IOCTL] = {"FUSE_IOCTL"};
|
||||
handlers[FUSE_POLL] = {"FUSE_POLL"};
|
||||
handlers[FUSE_NOTIFY_REPLY] = {"FUSE_NOTIFY_REPLY"};
|
||||
handlers[FUSE_BATCH_FORGET] = {"FUSE_BATCH_FORGET",
|
||||
&FuseChannel::fuseBatchForget,
|
||||
&argrender::batchforget,
|
||||
&ChannelThreadStats::forgetmulti};
|
||||
handlers[FUSE_BATCH_FORGET] = {
|
||||
"FUSE_BATCH_FORGET",
|
||||
&FuseChannel::fuseBatchForget,
|
||||
&argrender::batchforget,
|
||||
&ChannelThreadStats::forgetmulti};
|
||||
handlers[FUSE_FALLOCATE] = {"FUSE_FALLOCATE", Write};
|
||||
#ifdef __linux__
|
||||
handlers[FUSE_READDIRPLUS] = {"FUSE_READDIRPLUS", Read};
|
||||
@ -1406,8 +1437,9 @@ void FuseChannel::readInitPacket(bool caseSensitive) {
|
||||
static_assert(FUSE_COMPAT_22_INIT_OUT_SIZE <= sizeof(connInfo));
|
||||
sendReply(
|
||||
init.header,
|
||||
ByteRange{reinterpret_cast<const uint8_t*>(&connInfo),
|
||||
FUSE_COMPAT_22_INIT_OUT_SIZE});
|
||||
ByteRange{
|
||||
reinterpret_cast<const uint8_t*>(&connInfo),
|
||||
FUSE_COMPAT_22_INIT_OUT_SIZE});
|
||||
}
|
||||
#elif defined(__APPLE__)
|
||||
static_assert(
|
||||
@ -1479,8 +1511,9 @@ void FuseChannel::processSession() {
|
||||
}
|
||||
|
||||
const auto* header = reinterpret_cast<fuse_in_header*>(buf.data());
|
||||
const ByteRange arg{reinterpret_cast<const uint8_t*>(header + 1),
|
||||
arg_size - sizeof(fuse_in_header)};
|
||||
const ByteRange arg{
|
||||
reinterpret_cast<const uint8_t*>(header + 1),
|
||||
arg_size - sizeof(fuse_in_header)};
|
||||
|
||||
XLOG(DBG7) << "fuse request opcode=" << header->opcode << " "
|
||||
<< fuseOpcodeName(header->opcode) << " unique=" << header->unique
|
||||
@ -1631,9 +1664,8 @@ void FuseChannel::processSession() {
|
||||
*(liveRequestWatches_.get()));
|
||||
return (this->*handlerEntry->handler)(
|
||||
*request, request->getReq(), arg);
|
||||
})
|
||||
.ensure([request] {})
|
||||
.within(requestTimeout_),
|
||||
}).ensure([request] {
|
||||
}).within(requestTimeout_),
|
||||
notifications_)
|
||||
.ensure([this, request, requestId, headerCopy] {
|
||||
traceBus_->publish(
|
||||
@ -1911,8 +1943,8 @@ folly::Future<folly::Unit> FuseChannel::fuseRename(
|
||||
const auto rename = reinterpret_cast<const fuse_rename_in*>(arg.data());
|
||||
const auto oldNameStr = reinterpret_cast<const char*>(rename + 1);
|
||||
const PathComponentPiece oldName{oldNameStr};
|
||||
const PathComponentPiece newName{oldNameStr + oldName.stringPiece().size() +
|
||||
1};
|
||||
const PathComponentPiece newName{
|
||||
oldNameStr + oldName.stringPiece().size() + 1};
|
||||
|
||||
InodeNumber parent{header.nodeid};
|
||||
InodeNumber newParent{rename->newdir};
|
||||
|
@ -58,10 +58,11 @@ struct FuseTraceEvent : TraceEventBase {
|
||||
|
||||
static FuseTraceEvent
|
||||
start(uint64_t unique, const fuse_in_header& request, std::string arguments) {
|
||||
return FuseTraceEvent{Type::START,
|
||||
unique,
|
||||
request,
|
||||
std::make_unique<std::string>(std::move(arguments))};
|
||||
return FuseTraceEvent{
|
||||
Type::START,
|
||||
unique,
|
||||
request,
|
||||
std::make_unique<std::string>(std::move(arguments))};
|
||||
}
|
||||
|
||||
static FuseTraceEvent finish(uint64_t unique, const fuse_in_header& request) {
|
||||
@ -367,8 +368,8 @@ class FuseChannel {
|
||||
static_assert(std::is_trivial_v<T>);
|
||||
sendReply(
|
||||
request,
|
||||
folly::ByteRange{reinterpret_cast<const uint8_t*>(&payload),
|
||||
sizeof(T)});
|
||||
folly::ByteRange{
|
||||
reinterpret_cast<const uint8_t*>(&payload), sizeof(T)});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -172,7 +172,7 @@ class PrivHelperTest : public ::testing::Test {
|
||||
PrivHelperConn::createConnPair(clientConn, serverConn);
|
||||
|
||||
serverThread_ =
|
||||
std::thread([ this, conn = std::move(serverConn) ]() mutable noexcept {
|
||||
std::thread([this, conn = std::move(serverConn)]() mutable noexcept {
|
||||
server_.initPartial(std::move(conn), getuid(), getgid());
|
||||
server_.run();
|
||||
});
|
||||
|
@ -29,9 +29,10 @@ CheckoutContext::CheckoutContext(
|
||||
: checkoutMode_{checkoutMode},
|
||||
mount_{mount},
|
||||
parentsLock_(std::move(parentsLock)),
|
||||
fetchContext_{clientPid,
|
||||
ObjectFetchContext::Cause::Thrift,
|
||||
thriftMethodName} {}
|
||||
fetchContext_{
|
||||
clientPid,
|
||||
ObjectFetchContext::Cause::Thrift,
|
||||
thriftMethodName} {}
|
||||
|
||||
CheckoutContext::~CheckoutContext() {}
|
||||
|
||||
|
@ -502,8 +502,8 @@ folly::Future<std::optional<LookupResult>> EdenDispatcher::lookup(
|
||||
auto incFsRefcount = [inode = std::move(inode)] {
|
||||
inode->incFsRefcount();
|
||||
};
|
||||
return LookupResult{std::move(inodeMetadata),
|
||||
std::move(incFsRefcount)};
|
||||
return LookupResult{
|
||||
std::move(inodeMetadata), std::move(incFsRefcount)};
|
||||
});
|
||||
})
|
||||
.thenError(
|
||||
|
@ -180,12 +180,14 @@ std::shared_ptr<EdenMount> EdenMount::create(
|
||||
std::shared_ptr<BlobCache> blobCache,
|
||||
std::shared_ptr<ServerState> serverState,
|
||||
std::unique_ptr<Journal> journal) {
|
||||
return std::shared_ptr<EdenMount>{new EdenMount{std::move(config),
|
||||
std::move(objectStore),
|
||||
std::move(blobCache),
|
||||
std::move(serverState),
|
||||
std::move(journal)},
|
||||
EdenMountDeleter{}};
|
||||
return std::shared_ptr<EdenMount>{
|
||||
new EdenMount{
|
||||
std::move(config),
|
||||
std::move(objectStore),
|
||||
std::move(blobCache),
|
||||
std::move(serverState),
|
||||
std::move(journal)},
|
||||
EdenMountDeleter{}};
|
||||
}
|
||||
|
||||
EdenMount::EdenMount(
|
||||
@ -439,14 +441,15 @@ FOLLY_NODISCARD folly::Future<folly::Unit> EdenMount::removeBindMount(
|
||||
|
||||
folly::SemiFuture<Unit> EdenMount::performBindMounts() {
|
||||
auto mountPath = getPath();
|
||||
return folly::makeSemiFutureWith(
|
||||
[argv = std::vector<std::string>{FLAGS_edenfsctlPath,
|
||||
"redirect",
|
||||
"fixup",
|
||||
"--mount",
|
||||
mountPath.c_str()}] {
|
||||
return SpawnedProcess(argv).future_wait();
|
||||
})
|
||||
return folly::makeSemiFutureWith([argv =
|
||||
std::vector<std::string>{
|
||||
FLAGS_edenfsctlPath,
|
||||
"redirect",
|
||||
"fixup",
|
||||
"--mount",
|
||||
mountPath.c_str()}] {
|
||||
return SpawnedProcess(argv).future_wait();
|
||||
})
|
||||
.deferValue([mountPath](ProcessStatus returnCode) {
|
||||
if (returnCode.exitStatus() == 0) {
|
||||
return folly::unit;
|
||||
@ -637,7 +640,7 @@ folly::Future<folly::Unit> EdenMount::unmount() {
|
||||
getPath().stringPiece());
|
||||
#endif
|
||||
})
|
||||
.thenTry([this](Try<Unit> && result) noexcept->folly::Future<Unit> {
|
||||
.thenTry([this](Try<Unit>&& result) noexcept -> folly::Future<Unit> {
|
||||
auto mountingUnmountingState = mountingUnmountingState_.wlock();
|
||||
XDCHECK(mountingUnmountingState->channelUnmountPromise.has_value());
|
||||
folly::SharedPromise<folly::Unit>* unsafeUnmountPromise =
|
||||
@ -1516,8 +1519,8 @@ bool EdenMount::MountingUnmountingState::channelMountStarted() const noexcept {
|
||||
return channelMountPromise.has_value();
|
||||
}
|
||||
|
||||
bool EdenMount::MountingUnmountingState::channelUnmountStarted() const
|
||||
noexcept {
|
||||
bool EdenMount::MountingUnmountingState::channelUnmountStarted()
|
||||
const noexcept {
|
||||
return channelUnmountPromise.has_value();
|
||||
}
|
||||
|
||||
|
@ -30,9 +30,9 @@ InodeBase::InodeBase(EdenMount* mount)
|
||||
mount_{mount},
|
||||
// The root inode always starts with an implicit reference from FUSE.
|
||||
numFsReferences_{1},
|
||||
location_{
|
||||
LocationInfo{nullptr,
|
||||
PathComponentPiece{"", detail::SkipPathSanityCheck()}}} {
|
||||
location_{LocationInfo{
|
||||
nullptr,
|
||||
PathComponentPiece{"", detail::SkipPathSanityCheck()}}} {
|
||||
XLOG(DBG5) << "root inode " << this << " (" << ino_ << ") created for mount "
|
||||
<< mount_->getPath();
|
||||
|
||||
|
@ -103,8 +103,8 @@ FileInode* InodePtr::asFileOrNull() const {
|
||||
}
|
||||
|
||||
FileInodePtr InodePtr::asFilePtrOrNull() const& {
|
||||
return FileInodePtr{dynamic_cast<FileInode*>(this->value_),
|
||||
FileInodePtr::NORMAL_INCREMENT};
|
||||
return FileInodePtr{
|
||||
dynamic_cast<FileInode*>(this->value_), FileInodePtr::NORMAL_INCREMENT};
|
||||
}
|
||||
|
||||
FileInodePtr InodePtr::asFilePtrOrNull() && {
|
||||
@ -128,8 +128,8 @@ TreeInode* InodePtr::asTreeOrNull() const {
|
||||
}
|
||||
|
||||
TreeInodePtr InodePtr::asTreePtrOrNull() const& {
|
||||
return TreeInodePtr{dynamic_cast<TreeInode*>(this->value_),
|
||||
TreeInodePtr::NORMAL_INCREMENT};
|
||||
return TreeInodePtr{
|
||||
dynamic_cast<TreeInode*>(this->value_), TreeInodePtr::NORMAL_INCREMENT};
|
||||
}
|
||||
|
||||
TreeInodePtr InodePtr::asTreePtrOrNull() && {
|
||||
|
@ -121,7 +121,8 @@ class InodeTable {
|
||||
*/
|
||||
template <typename PopFn>
|
||||
void populateIfNotSet(InodeNumber ino, PopFn&& populate) {
|
||||
modifyOrInsert<void>(ino, [&](auto&) {}, populate, [&](auto&) {});
|
||||
modifyOrInsert<void>(
|
||||
ino, [&](auto&) {}, populate, [&](auto&) {});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -294,9 +294,10 @@ void Overlay::saveOverlayDir(InodeNumber inodeNumber, const DirContents& dir) {
|
||||
if (!isMaterialized) {
|
||||
auto entHash = ent.getHash();
|
||||
auto bytes = entHash.getBytes();
|
||||
oent.hash_ref() = std::string{reinterpret_cast<const char*>(bytes.data()),
|
||||
oent.hash_ref() = std::string{
|
||||
reinterpret_cast<const char*>(bytes.data()),
|
||||
|
||||
bytes.size()};
|
||||
bytes.size()};
|
||||
}
|
||||
|
||||
odir.entries_ref()->emplace(
|
||||
|
@ -45,9 +45,7 @@ void RequestContext::finishRequest() {
|
||||
stats_ = nullptr;
|
||||
|
||||
if (channelThreadLocalStats_) {
|
||||
{
|
||||
auto temp = std::move(requestMetricsScope_);
|
||||
}
|
||||
{ auto temp = std::move(requestMetricsScope_); }
|
||||
channelThreadLocalStats_.reset();
|
||||
}
|
||||
|
||||
|
@ -20,11 +20,12 @@ std::vector<ChildEntry> parseDirContents(const DirContents& contents) {
|
||||
std::vector<ChildEntry> results;
|
||||
results.reserve(contents.size());
|
||||
for (const auto& [name, entry] : contents) {
|
||||
results.push_back(ChildEntry{name,
|
||||
entry.getDtype(),
|
||||
entry.getInodeNumber(),
|
||||
entry.getOptionalHash(),
|
||||
entry.getInodePtr()});
|
||||
results.push_back(ChildEntry{
|
||||
name,
|
||||
entry.getDtype(),
|
||||
entry.getInodeNumber(),
|
||||
entry.getOptionalHash(),
|
||||
entry.getInodePtr()});
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
@ -2863,9 +2863,10 @@ unique_ptr<CheckoutAction> TreeInode::processCheckoutEntry(
|
||||
// and TreeInode::checkoutUpdateEntry.
|
||||
contents.erase(it);
|
||||
} else {
|
||||
entry = DirEntry{modeFromTreeEntryType(newScmEntry->getType()),
|
||||
getOverlay()->allocateInodeNumber(),
|
||||
newScmEntry->getHash()};
|
||||
entry = DirEntry{
|
||||
modeFromTreeEntryType(newScmEntry->getType()),
|
||||
getOverlay()->allocateInodeNumber(),
|
||||
newScmEntry->getHash()};
|
||||
}
|
||||
|
||||
wasDirectoryListModified = true;
|
||||
@ -2978,7 +2979,7 @@ Future<InvalidationRequired> TreeInode::checkoutUpdateEntry(
|
||||
name = PathComponent{name},
|
||||
parentInode = inodePtrFromThis(),
|
||||
treeInode,
|
||||
newScmEntry](auto &&) -> folly::Future<InvalidationRequired> {
|
||||
newScmEntry](auto&&) -> folly::Future<InvalidationRequired> {
|
||||
// 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.
|
||||
|
@ -857,15 +857,16 @@ TEST(DiffTest, ignoreInSubdirectories) {
|
||||
// Test with a .gitignore in subdirectories and file exists both in mount and in
|
||||
// the Tree (so we should report the file modificiation)
|
||||
TEST(DiffTest, ignoreInSubdirectoriesInMountAndInTree) {
|
||||
DiffTest test({{".gitignore", "**/foo/bar.txt\n"},
|
||||
{"foo/.gitignore", "stuff\ntest\nwhatever\n"},
|
||||
{"foo/foo/.gitignore", "!/bar.txt\ntest\n"},
|
||||
{"abc/def/.gitignore", "*.log\n"},
|
||||
{"abc/def/other.txt", "test\n"},
|
||||
{"a/.gitignore", "b/c/d.txt\n"},
|
||||
{"a/b/c/x.txt", "test\n"},
|
||||
{"b/c/x.txt", "test\n"},
|
||||
{"abc/def/test.log", "test\n"}});
|
||||
DiffTest test(
|
||||
{{".gitignore", "**/foo/bar.txt\n"},
|
||||
{"foo/.gitignore", "stuff\ntest\nwhatever\n"},
|
||||
{"foo/foo/.gitignore", "!/bar.txt\ntest\n"},
|
||||
{"abc/def/.gitignore", "*.log\n"},
|
||||
{"abc/def/other.txt", "test\n"},
|
||||
{"a/.gitignore", "b/c/d.txt\n"},
|
||||
{"a/b/c/x.txt", "test\n"},
|
||||
{"b/c/x.txt", "test\n"},
|
||||
{"abc/def/test.log", "test\n"}});
|
||||
|
||||
// Add some untracked files, some of which match the ignore patterns
|
||||
test.getMount().addFile("foo/bar.txt", "new\n");
|
||||
@ -934,15 +935,16 @@ TEST(DiffTest, ignoreInSubdirectoriesInMountAndInTree) {
|
||||
// Test with a .gitignore in subdirectories and file exists not in mount but
|
||||
// exists in the Tree (so we should report the file deletion)
|
||||
TEST(DiffTest, ignoreInSubdirectoriesNotInMountButInTree) {
|
||||
DiffTest test({{".gitignore", "**/foo/bar.txt\n"},
|
||||
{"foo/.gitignore", "stuff\ntest\nwhatever\n"},
|
||||
{"foo/foo/.gitignore", "!/bar.txt\ntest\n"},
|
||||
{"abc/def/.gitignore", "*.log\n"},
|
||||
{"abc/def/other.txt", "test\n"},
|
||||
{"a/.gitignore", "b/c/d.txt\n"},
|
||||
{"a/b/c/x.txt", "test\n"},
|
||||
{"b/c/x.txt", "test\n"},
|
||||
{"abc/def/test.log", "test\n"}});
|
||||
DiffTest test(
|
||||
{{".gitignore", "**/foo/bar.txt\n"},
|
||||
{"foo/.gitignore", "stuff\ntest\nwhatever\n"},
|
||||
{"foo/foo/.gitignore", "!/bar.txt\ntest\n"},
|
||||
{"abc/def/.gitignore", "*.log\n"},
|
||||
{"abc/def/other.txt", "test\n"},
|
||||
{"a/.gitignore", "b/c/d.txt\n"},
|
||||
{"a/b/c/x.txt", "test\n"},
|
||||
{"b/c/x.txt", "test\n"},
|
||||
{"abc/def/test.log", "test\n"}});
|
||||
|
||||
// Add some untracked files, some of which match the ignore patterns
|
||||
test.getMount().addFile("foo/bar.txt", "new\n");
|
||||
|
@ -157,8 +157,9 @@ class FileInodeTest : public ::testing::Test {
|
||||
// Set up a directory structure that we will use for most
|
||||
// of the tests below
|
||||
FakeTreeBuilder builder;
|
||||
builder.setFiles({{"dir/a.txt", "This is a.txt.\n"},
|
||||
{"dir/sub/b.txt", "This is b.txt.\n"}});
|
||||
builder.setFiles(
|
||||
{{"dir/a.txt", "This is a.txt.\n"},
|
||||
{"dir/sub/b.txt", "This is b.txt.\n"}});
|
||||
mount_.initialize(builder);
|
||||
}
|
||||
|
||||
|
@ -65,9 +65,10 @@ class GlobNodeTest : public ::testing::TestWithParam<
|
||||
protected:
|
||||
void SetUp() override {
|
||||
// The file contents are coupled with AHash, BHash and WatHash below.
|
||||
builder_.setFiles({{"dir/a.txt", "a"},
|
||||
{"dir/sub/b.txt", "b"},
|
||||
{".watchmanconfig", "wat"}});
|
||||
builder_.setFiles(
|
||||
{{"dir/a.txt", "a"},
|
||||
{"dir/sub/b.txt", "b"},
|
||||
{".watchmanconfig", "wat"}});
|
||||
mount_.initialize(builder_, /*startReady=*/GetParam().first);
|
||||
prefetchHashes_ = nullptr;
|
||||
}
|
||||
|
@ -45,11 +45,12 @@ TEST(InodeLoader, load) {
|
||||
auto results =
|
||||
collectAll(applyToInodes(
|
||||
rootInode,
|
||||
std::vector<std::string>{"dir/sub/b.txt",
|
||||
"dir/a.txt",
|
||||
"not/exist/a",
|
||||
"not/exist/b",
|
||||
"dir/sub/b.txt"},
|
||||
std::vector<std::string>{
|
||||
"dir/sub/b.txt",
|
||||
"dir/a.txt",
|
||||
"not/exist/a",
|
||||
"not/exist/b",
|
||||
"dir/sub/b.txt"},
|
||||
[](InodePtr inode) { return inode->getPath(); }))
|
||||
.get();
|
||||
|
||||
|
@ -57,11 +57,12 @@ TEST(OverlayGoldMasterTest, can_load_overlay_v2) {
|
||||
// this overlay format even if we change how the overlay is saved in the
|
||||
// future.
|
||||
auto tmpdir = makeTempDir("eden_test");
|
||||
SpawnedProcess tarProcess({"/usr/bin/tar",
|
||||
"-xzf",
|
||||
"eden/test-data/overlay-v2.tgz",
|
||||
"-C",
|
||||
tmpdir.path().string()});
|
||||
SpawnedProcess tarProcess(
|
||||
{"/usr/bin/tar",
|
||||
"-xzf",
|
||||
"eden/test-data/overlay-v2.tgz",
|
||||
"-C",
|
||||
tmpdir.path().string()});
|
||||
EXPECT_EQ(tarProcess.wait().str(), "exited with status 0");
|
||||
|
||||
auto overlay = Overlay::create(
|
||||
@ -637,10 +638,12 @@ TEST_P(
|
||||
const PathNames pathNamesToTest[] = {
|
||||
// Test a few different path name variations, to ensure traversal order
|
||||
// doesn't matter.
|
||||
PathNames{.corruptedByTruncationName = "A_corrupted_by_truncation"_pc,
|
||||
.tempName = "B_temp"_pc},
|
||||
PathNames{.corruptedByTruncationName = "B_corrupted_by_truncation"_pc,
|
||||
.tempName = "A_temp"_pc},
|
||||
PathNames{
|
||||
.corruptedByTruncationName = "A_corrupted_by_truncation"_pc,
|
||||
.tempName = "B_temp"_pc},
|
||||
PathNames{
|
||||
.corruptedByTruncationName = "B_corrupted_by_truncation"_pc,
|
||||
.tempName = "A_temp"_pc},
|
||||
};
|
||||
|
||||
for (auto pathNames : pathNamesToTest) {
|
||||
@ -939,7 +942,7 @@ void debugDumpOverlayInodes(
|
||||
auto& dirContents = *dir;
|
||||
out << " Entries (" << dirContents.size() << " total):\n";
|
||||
|
||||
auto dtypeToString = [](dtype_t dtype) noexcept->const char* {
|
||||
auto dtypeToString = [](dtype_t dtype) noexcept -> const char* {
|
||||
switch (dtype) {
|
||||
case dtype_t::Dir:
|
||||
return "d";
|
||||
|
@ -260,10 +260,11 @@ std::optional<JournalDeltaInfo> Journal::getLatest() {
|
||||
} else {
|
||||
if (deltaState->isFileChangeInBack()) {
|
||||
const FileChangeJournalDelta& back = deltaState->fileChangeDeltas.back();
|
||||
return JournalDeltaInfo{deltaState->currentHash,
|
||||
deltaState->currentHash,
|
||||
back.sequenceID,
|
||||
back.time};
|
||||
return JournalDeltaInfo{
|
||||
deltaState->currentHash,
|
||||
deltaState->currentHash,
|
||||
back.sequenceID,
|
||||
back.time};
|
||||
} else {
|
||||
const HashUpdateJournalDelta& back = deltaState->hashUpdateDeltas.back();
|
||||
return JournalDeltaInfo{
|
||||
|
@ -106,15 +106,16 @@ class SpawnedEdenInstance::StartupStatusChecker : private AsyncTimeout {
|
||||
|
||||
private:
|
||||
void timeoutExpired() noexcept override {
|
||||
folly::makeFutureWith([this]() { return checkRunning(); })
|
||||
.thenTry([this](Try<bool> result) {
|
||||
client_.reset();
|
||||
if (result.hasValue() && result.value()) {
|
||||
edenRunning();
|
||||
} else {
|
||||
reschedule();
|
||||
}
|
||||
});
|
||||
folly::makeFutureWith([this]() {
|
||||
return checkRunning();
|
||||
}).thenTry([this](Try<bool> result) {
|
||||
client_.reset();
|
||||
if (result.hasValue() && result.value()) {
|
||||
edenRunning();
|
||||
} else {
|
||||
reschedule();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void edenRunning() {
|
||||
|
@ -191,8 +191,7 @@ HRESULT PrjfsChannelInner::startEnumeration(
|
||||
addDirectoryEnumeration(std::move(guid), std::move(dirents));
|
||||
context->sendSuccess();
|
||||
});
|
||||
})
|
||||
.within(requestTimeout_);
|
||||
}).within(requestTimeout_);
|
||||
|
||||
context->catchErrors(std::move(fut), notifications_)
|
||||
.ensure([context = std::move(context)] {});
|
||||
@ -357,8 +356,7 @@ HRESULT PrjfsChannelInner::getPlaceholderInfo(
|
||||
|
||||
return folly::makeFuture(folly::unit);
|
||||
});
|
||||
})
|
||||
.within(requestTimeout_);
|
||||
}).within(requestTimeout_);
|
||||
|
||||
context->catchErrors(std::move(fut), notifications_)
|
||||
.ensure([context = std::move(context)] {});
|
||||
@ -387,8 +385,7 @@ HRESULT PrjfsChannelInner::queryFileName(
|
||||
context->sendError(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND));
|
||||
}
|
||||
});
|
||||
})
|
||||
.within(requestTimeout_);
|
||||
}).within(requestTimeout_);
|
||||
|
||||
context->catchErrors(std::move(fut), notifications_)
|
||||
.ensure([context = std::move(context)] {});
|
||||
@ -573,8 +570,7 @@ HRESULT PrjfsChannelInner::getFileData(
|
||||
context->sendSuccess();
|
||||
}
|
||||
});
|
||||
})
|
||||
.within(requestTimeout_);
|
||||
}).within(requestTimeout_);
|
||||
|
||||
context->catchErrors(std::move(fut), notifications_)
|
||||
.ensure([context = std::move(context)] {});
|
||||
|
@ -649,8 +649,8 @@ void EdenServer::unloadInodes() {
|
||||
{
|
||||
const auto mountPoints = mountPoints_.wlock();
|
||||
for (auto& entry : *mountPoints) {
|
||||
roots.emplace_back(Root{std::string{entry.first},
|
||||
entry.second.edenMount->getRootInode()});
|
||||
roots.emplace_back(Root{
|
||||
std::string{entry.first}, entry.second.edenMount->getRootInode()});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -677,17 +677,21 @@ class EdenServer : private TakeoverHandler {
|
||||
*/
|
||||
folly::EventBase* mainEventBase_;
|
||||
|
||||
PeriodicFnTask<&EdenServer::reloadConfig> reloadConfigTask_{this,
|
||||
"reload_config"};
|
||||
PeriodicFnTask<&EdenServer::reloadConfig> reloadConfigTask_{
|
||||
this,
|
||||
"reload_config"};
|
||||
PeriodicFnTask<&EdenServer::checkLockValidity> checkValidityTask_{
|
||||
this,
|
||||
"check_lock_validity"};
|
||||
PeriodicFnTask<&EdenServer::flushStatsNow> flushStatsTask_{this,
|
||||
"flush_stats"};
|
||||
PeriodicFnTask<&EdenServer::reportMemoryStats> memoryStatsTask_{this,
|
||||
"mem_stats"};
|
||||
PeriodicFnTask<&EdenServer::manageLocalStore> localStoreTask_{this,
|
||||
"local_store"};
|
||||
PeriodicFnTask<&EdenServer::flushStatsNow> flushStatsTask_{
|
||||
this,
|
||||
"flush_stats"};
|
||||
PeriodicFnTask<&EdenServer::reportMemoryStats> memoryStatsTask_{
|
||||
this,
|
||||
"mem_stats"};
|
||||
PeriodicFnTask<&EdenServer::manageLocalStore> localStoreTask_{
|
||||
this,
|
||||
"local_store"};
|
||||
|
||||
PeriodicFnTask<&EdenServer::refreshBackingStore> backingStoreTask_{
|
||||
this,
|
||||
|
@ -366,9 +366,10 @@ void ForegroundStartupLogger::successImpl() {}
|
||||
}
|
||||
|
||||
FileStartupLogger::FileStartupLogger(folly::StringPiece startupLogPath)
|
||||
: logFile_{startupLogPath,
|
||||
O_APPEND | O_CLOEXEC | O_CREAT | O_WRONLY,
|
||||
0644} {}
|
||||
: logFile_{
|
||||
startupLogPath,
|
||||
O_APPEND | O_CLOEXEC | O_CREAT | O_WRONLY,
|
||||
0644} {}
|
||||
|
||||
void FileStartupLogger::writeMessageImpl(
|
||||
folly::LogLevel,
|
||||
|
@ -327,11 +327,12 @@ TEST_F(DaemonStartupLoggerTest, daemonClosesStandardFileDescriptors) {
|
||||
opts.pipeStdin();
|
||||
opts.pipeStdout();
|
||||
opts.pipeStderr();
|
||||
auto process = SpawnedProcess{{{
|
||||
executablePath().stringPiece().str(),
|
||||
"daemonClosesStandardFileDescriptorsChild",
|
||||
}},
|
||||
std::move(opts)};
|
||||
auto process = SpawnedProcess{
|
||||
{{
|
||||
executablePath().stringPiece().str(),
|
||||
"daemonClosesStandardFileDescriptorsChild",
|
||||
}},
|
||||
std::move(opts)};
|
||||
|
||||
auto stdinFd = process.stdinFd();
|
||||
auto stdoutFd = process.stdoutFd();
|
||||
|
@ -73,11 +73,12 @@ void BackingStoreLogger::logImport(
|
||||
break;
|
||||
}
|
||||
|
||||
logger_->logEvent(ServerDataFetch{std::move(cause_string),
|
||||
pid,
|
||||
std::move(cmdline),
|
||||
std::move(importPathString),
|
||||
std::move(typeString)});
|
||||
logger_->logEvent(ServerDataFetch{
|
||||
std::move(cause_string),
|
||||
pid,
|
||||
std::move(cmdline),
|
||||
std::move(importPathString),
|
||||
std::move(typeString)});
|
||||
}
|
||||
|
||||
} // namespace eden
|
||||
|
@ -81,31 +81,34 @@ class KeySpace {
|
||||
Ephemeral{&EdenConfig::localStoreTreeSizeLimit}};
|
||||
// Proxy hashes are required to fetch objects from hg from a hash.
|
||||
// Deleting them breaks re-importing after an inode is unloaded.
|
||||
static constexpr KeySpaceRecord HgProxyHashFamily{3,
|
||||
"hgproxyhash",
|
||||
Persistent{}};
|
||||
static constexpr KeySpaceRecord HgProxyHashFamily{
|
||||
3,
|
||||
"hgproxyhash",
|
||||
Persistent{}};
|
||||
static constexpr KeySpaceRecord HgCommitToTreeFamily{
|
||||
4,
|
||||
"hgcommit2tree",
|
||||
Ephemeral{&EdenConfig::localStoreHgCommit2TreeSizeLimit}};
|
||||
static constexpr KeySpaceRecord BlobSizeFamily{5, "blobsize", Deprecated{}};
|
||||
|
||||
static constexpr KeySpaceRecord ScsProxyHashFamily{6,
|
||||
"scsproxyhash",
|
||||
Persistent{}};
|
||||
static constexpr KeySpaceRecord ScsProxyHashFamily{
|
||||
6,
|
||||
"scsproxyhash",
|
||||
Persistent{}};
|
||||
static constexpr KeySpaceRecord TreeMetaDataFamily{
|
||||
7,
|
||||
"treemeta",
|
||||
Ephemeral{&EdenConfig::localStoreTreeMetaSizeLimit}};
|
||||
|
||||
static constexpr const KeySpaceRecord* kAll[] = {&BlobFamily,
|
||||
&BlobMetaDataFamily,
|
||||
&TreeFamily,
|
||||
&HgProxyHashFamily,
|
||||
&HgCommitToTreeFamily,
|
||||
&BlobSizeFamily,
|
||||
&ScsProxyHashFamily,
|
||||
&TreeMetaDataFamily};
|
||||
static constexpr const KeySpaceRecord* kAll[] = {
|
||||
&BlobFamily,
|
||||
&BlobMetaDataFamily,
|
||||
&TreeFamily,
|
||||
&HgProxyHashFamily,
|
||||
&HgCommitToTreeFamily,
|
||||
&BlobSizeFamily,
|
||||
&ScsProxyHashFamily,
|
||||
&TreeMetaDataFamily};
|
||||
static constexpr size_t kTotalCount = std::size(kAll);
|
||||
|
||||
private:
|
||||
|
@ -39,13 +39,14 @@ std::shared_ptr<ObjectStore> ObjectStore::create(
|
||||
std::shared_ptr<ProcessNameCache> processNameCache,
|
||||
std::shared_ptr<StructuredLogger> structuredLogger,
|
||||
std::shared_ptr<const EdenConfig> edenConfig) {
|
||||
return std::shared_ptr<ObjectStore>{new ObjectStore{std::move(localStore),
|
||||
std::move(backingStore),
|
||||
std::move(stats),
|
||||
executor,
|
||||
processNameCache,
|
||||
structuredLogger,
|
||||
edenConfig}};
|
||||
return std::shared_ptr<ObjectStore>{new ObjectStore{
|
||||
std::move(localStore),
|
||||
std::move(backingStore),
|
||||
std::move(stats),
|
||||
executor,
|
||||
processNameCache,
|
||||
structuredLogger,
|
||||
edenConfig}};
|
||||
}
|
||||
|
||||
ObjectStore::ObjectStore(
|
||||
|
@ -64,11 +64,12 @@ TreeEntry fromRawTreeEntry(
|
||||
ScsProxyHash::store(proxyHash, fullPath, commitHash.value(), writeBatch);
|
||||
}
|
||||
|
||||
return TreeEntry{proxyHash,
|
||||
std::move(name),
|
||||
fromRawTreeEntryType(entry.ttype),
|
||||
size,
|
||||
contentSha1};
|
||||
return TreeEntry{
|
||||
proxyHash,
|
||||
std::move(name),
|
||||
fromRawTreeEntryType(entry.ttype),
|
||||
size,
|
||||
contentSha1};
|
||||
}
|
||||
|
||||
FOLLY_MAYBE_UNUSED std::unique_ptr<Tree> fromRawTree(
|
||||
|
@ -20,8 +20,9 @@ constexpr folly::StringPiece HgImportPyError::kSeparator;
|
||||
HgImportPyError::HgImportPyError(StringPiece errorType, StringPiece message)
|
||||
: fullMessage_{folly::to<string>(errorType, kSeparator, message)},
|
||||
errorType_{fullMessage_.data(), errorType.size()},
|
||||
message_{fullMessage_.data() + errorType.size() + kSeparator.size(),
|
||||
fullMessage_.data() + fullMessage_.size()} {}
|
||||
message_{
|
||||
fullMessage_.data() + errorType.size() + kSeparator.size(),
|
||||
fullMessage_.data() + fullMessage_.size()} {}
|
||||
|
||||
} // namespace eden
|
||||
} // namespace facebook
|
||||
|
@ -23,8 +23,8 @@ TEST(ImportPriorityTest, value) {
|
||||
ImportPriority{static_cast<ImportPriorityKind>(INT16_MAX)});
|
||||
|
||||
// The maximum possible priority
|
||||
auto maximum = ImportPriority{static_cast<ImportPriorityKind>(INT16_MAX),
|
||||
0xFFFFFFFFFFFF};
|
||||
auto maximum = ImportPriority{
|
||||
static_cast<ImportPriorityKind>(INT16_MAX), 0xFFFFFFFFFFFF};
|
||||
EXPECT_EQ(maximum.value(), 0x7FFFFFFFFFFFFFFF);
|
||||
|
||||
// the minimum possible priority
|
||||
|
@ -178,8 +178,9 @@ IOBuf TakeoverData::serializeVersion1() {
|
||||
// blob because we know that the endianness of the target
|
||||
// machine must match the current system for a graceful
|
||||
// takeover.
|
||||
app.push(folly::StringPiece{reinterpret_cast<const char*>(&mount.connInfo),
|
||||
sizeof(mount.connInfo)});
|
||||
app.push(folly::StringPiece{
|
||||
reinterpret_cast<const char*>(&mount.connInfo),
|
||||
sizeof(mount.connInfo)});
|
||||
// SerializedFileHandleMap has been removed so its size is always 0.
|
||||
app.writeBE<uint32_t>(0);
|
||||
|
||||
|
@ -67,15 +67,16 @@ EdenThreadStatsBase::EdenThreadStatsBase() {}
|
||||
|
||||
EdenThreadStatsBase::Histogram EdenThreadStatsBase::createHistogram(
|
||||
const std::string& name) {
|
||||
return Histogram{this,
|
||||
name,
|
||||
static_cast<int64_t>(kBucketSize.count()),
|
||||
kMinValue.count(),
|
||||
kMaxValue.count(),
|
||||
fb303::COUNT,
|
||||
50,
|
||||
90,
|
||||
99};
|
||||
return Histogram{
|
||||
this,
|
||||
name,
|
||||
static_cast<int64_t>(kBucketSize.count()),
|
||||
kMinValue.count(),
|
||||
kMaxValue.count(),
|
||||
fb303::COUNT,
|
||||
50,
|
||||
90,
|
||||
99};
|
||||
}
|
||||
|
||||
EdenThreadStatsBase::Timeseries EdenThreadStatsBase::createTimeseries(
|
||||
|
@ -232,10 +232,11 @@ class HgImporterThreadStats : public EdenThreadStatsBase {
|
||||
class JournalThreadStats : public EdenThreadStatsBase {
|
||||
public:
|
||||
Timeseries truncatedReads{this, "journal.truncated_reads", fb303::SUM};
|
||||
Timeseries filesAccumulated{this,
|
||||
"journal.files_accumulated",
|
||||
fb303::COUNT,
|
||||
fb303::SUM};
|
||||
Timeseries filesAccumulated{
|
||||
this,
|
||||
"journal.files_accumulated",
|
||||
fb303::COUNT,
|
||||
fb303::SUM};
|
||||
};
|
||||
|
||||
} // namespace eden
|
||||
|
@ -173,17 +173,19 @@ FakeBackingStore::TreeEntryData::TreeEntryData(
|
||||
folly::StringPiece name,
|
||||
const Blob& blob,
|
||||
FakeBlobType type)
|
||||
: entry{blob.getHash(),
|
||||
PathComponent{name},
|
||||
treeEntryTypeFromBlobType(type)} {}
|
||||
: entry{
|
||||
blob.getHash(),
|
||||
PathComponent{name},
|
||||
treeEntryTypeFromBlobType(type)} {}
|
||||
|
||||
FakeBackingStore::TreeEntryData::TreeEntryData(
|
||||
folly::StringPiece name,
|
||||
const StoredBlob* blob,
|
||||
FakeBlobType type)
|
||||
: entry{blob->get().getHash(),
|
||||
PathComponent{name},
|
||||
treeEntryTypeFromBlobType(type)} {}
|
||||
: entry{
|
||||
blob->get().getHash(),
|
||||
PathComponent{name},
|
||||
treeEntryTypeFromBlobType(type)} {}
|
||||
|
||||
FakeBackingStore::TreeEntryData::TreeEntryData(
|
||||
folly::StringPiece name,
|
||||
@ -270,8 +272,8 @@ Hash FakeBackingStore::computeTreeHash(
|
||||
}
|
||||
|
||||
Hash::Storage computedHashBytes;
|
||||
digest.hash_final(folly::MutableByteRange{computedHashBytes.data(),
|
||||
computedHashBytes.size()});
|
||||
digest.hash_final(folly::MutableByteRange{
|
||||
computedHashBytes.data(), computedHashBytes.size()});
|
||||
return Hash{computedHashBytes};
|
||||
}
|
||||
|
||||
|
@ -530,8 +530,9 @@ FileDescriptor FileDescriptor::open(
|
||||
#endif
|
||||
((opts.readContents && opts.writeContents)
|
||||
? O_RDWR
|
||||
: (opts.writeContents ? O_WRONLY
|
||||
: opts.readContents ? O_RDONLY : 0)) |
|
||||
: (opts.writeContents ? O_WRONLY
|
||||
: opts.readContents ? O_RDONLY
|
||||
: 0)) |
|
||||
(opts.create ? O_CREAT : 0) | (opts.exclusiveCreate ? O_EXCL : 0) |
|
||||
(opts.truncate ? O_TRUNC : 0);
|
||||
|
||||
|
@ -193,9 +193,8 @@ folly::Expected<RelativePath, int> joinAndNormalize(
|
||||
if (path.startsWith(kDirSeparator)) {
|
||||
return folly::makeUnexpected(EPERM);
|
||||
}
|
||||
const std::string joined = base.value().empty()
|
||||
? path.str()
|
||||
: path.empty() ? base.value().str()
|
||||
const std::string joined = base.value().empty() ? path.str()
|
||||
: path.empty() ? base.value().str()
|
||||
: folly::to<std::string>(base, kDirSeparator, path);
|
||||
const CanonicalData cdata{canonicalPathData(joined)};
|
||||
const auto& parts{cdata.components};
|
||||
@ -257,10 +256,11 @@ std::pair<PathComponentPiece, RelativePathPiece> splitFirst(
|
||||
auto dirSeparator = detail::findPathSeparator(piece);
|
||||
|
||||
if (dirSeparator != std::string::npos) {
|
||||
return {PathComponentPiece{folly::StringPiece{
|
||||
piece.begin(), piece.begin() + dirSeparator}},
|
||||
RelativePathPiece{folly::StringPiece{
|
||||
piece.begin() + dirSeparator + 1, piece.end()}}};
|
||||
return {
|
||||
PathComponentPiece{
|
||||
folly::StringPiece{piece.begin(), piece.begin() + dirSeparator}},
|
||||
RelativePathPiece{
|
||||
folly::StringPiece{piece.begin() + dirSeparator + 1, piece.end()}}};
|
||||
} else {
|
||||
return {PathComponentPiece{piece}, RelativePathPiece{}};
|
||||
}
|
||||
|
@ -805,8 +805,8 @@ class PathComponentIterator {
|
||||
|
||||
/// Returns the piece for the current iterator position.
|
||||
PathComponentPiece piece() const {
|
||||
return PathComponentPiece{folly::StringPiece{start_, end_},
|
||||
SkipPathSanityCheck{}};
|
||||
return PathComponentPiece{
|
||||
folly::StringPiece{start_, end_}, SkipPathSanityCheck{}};
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1099,7 +1099,7 @@ folly::Future<std::string> SpawnedProcess::readPipe(int fd) {
|
||||
}
|
||||
|
||||
auto p = std::make_shared<folly::Promise<std::string>>();
|
||||
std::thread thr([ this, fd, p ]() noexcept {
|
||||
std::thread thr([this, fd, p]() noexcept {
|
||||
std::string result;
|
||||
p->setWith([&] {
|
||||
auto& pipe = pipes_[fd];
|
||||
|
@ -17,10 +17,11 @@ using namespace facebook::eden;
|
||||
|
||||
TEST(GuidTest, assignedGuid) {
|
||||
// {811305DA-F51E-4E2D-9201-0D12A1E7F8D5}
|
||||
static const GUID testGuid = {0x811305da,
|
||||
0xf51e,
|
||||
0x4e2d,
|
||||
{0x92, 0x1, 0xd, 0x12, 0xa1, 0xe7, 0xf8, 0xd5}};
|
||||
static const GUID testGuid = {
|
||||
0x811305da,
|
||||
0xf51e,
|
||||
0x4e2d,
|
||||
{0x92, 0x1, 0xd, 0x12, 0xa1, 0xe7, 0xf8, 0xd5}};
|
||||
|
||||
Guid guid{testGuid};
|
||||
|
||||
@ -45,10 +46,11 @@ TEST(GuidTest, generatedGuid) {
|
||||
|
||||
TEST(GuidTest, compareGuids) {
|
||||
// {811305DA-F51E-4E2D-9201-0D12A1E7F8D5}
|
||||
static const GUID testGuid = {0x811305da,
|
||||
0xf51e,
|
||||
0x4e2d,
|
||||
{0x92, 0x1, 0xd, 0x12, 0xa1, 0xe7, 0xf8, 0xd5}};
|
||||
static const GUID testGuid = {
|
||||
0x811305da,
|
||||
0xf51e,
|
||||
0x4e2d,
|
||||
{0x92, 0x1, 0xd, 0x12, 0xa1, 0xe7, 0xf8, 0xd5}};
|
||||
|
||||
Guid guid1{testGuid};
|
||||
Guid guid2;
|
||||
@ -64,10 +66,11 @@ TEST(GuidTest, compareGuids) {
|
||||
|
||||
TEST(GuidTest, pointerGuids) {
|
||||
// {811305DA-F51E-4E2D-9201-0D12A1E7F8D5}
|
||||
static const GUID testGuid = {0x811305da,
|
||||
0xf51e,
|
||||
0x4e2d,
|
||||
{0x92, 0x1, 0xd, 0x12, 0xa1, 0xe7, 0xf8, 0xd5}};
|
||||
static const GUID testGuid = {
|
||||
0x811305da,
|
||||
0xf51e,
|
||||
0x4e2d,
|
||||
{0x92, 0x1, 0xd, 0x12, 0xa1, 0xe7, 0xf8, 0xd5}};
|
||||
|
||||
Guid guid1{testGuid};
|
||||
const GUID* ptrGuid1 = guid1;
|
||||
@ -82,10 +85,11 @@ TEST(GuidTest, pointerGuids) {
|
||||
}
|
||||
|
||||
TEST(GuidTest, formatGuid) {
|
||||
static const GUID testGuid = {0x811305da,
|
||||
0xf51e,
|
||||
0x4e2d,
|
||||
{0x92, 0x1, 0xd, 0x12, 0xa1, 0xe7, 0xf8, 0xd5}};
|
||||
static const GUID testGuid = {
|
||||
0x811305da,
|
||||
0xf51e,
|
||||
0x4e2d,
|
||||
{0x92, 0x1, 0xd, 0x12, 0xa1, 0xe7, 0xf8, 0xd5}};
|
||||
Guid guid1{testGuid};
|
||||
auto s = fmt::format(FMT_STRING("{}"), guid1);
|
||||
EXPECT_EQ(s, "{811305DA-F51E-4E2D-9201-0D12A1E7F8D5}");
|
||||
|
@ -156,11 +156,8 @@ static PyMethodDef methods[] = {
|
||||
static const int version = 1;
|
||||
|
||||
#ifdef IS_PY3K
|
||||
static struct PyModuleDef base85_module = {PyModuleDef_HEAD_INIT,
|
||||
"base85",
|
||||
base85_doc,
|
||||
-1,
|
||||
methods};
|
||||
static struct PyModuleDef base85_module =
|
||||
{PyModuleDef_HEAD_INIT, "base85", base85_doc, -1, methods};
|
||||
|
||||
PyMODINIT_FUNC PyInit_base85(void) {
|
||||
PyObject* m;
|
||||
|
@ -203,11 +203,8 @@ static PyMethodDef methods[] = {
|
||||
static const int version = 1;
|
||||
|
||||
#ifdef IS_PY3K
|
||||
static struct PyModuleDef bdiff_module = {PyModuleDef_HEAD_INIT,
|
||||
"bdiff",
|
||||
mdiff_doc,
|
||||
-1,
|
||||
methods};
|
||||
static struct PyModuleDef bdiff_module =
|
||||
{PyModuleDef_HEAD_INIT, "bdiff", mdiff_doc, -1, methods};
|
||||
|
||||
PyMODINIT_FUNC PyInit_bdiff(void) {
|
||||
PyObject* m;
|
||||
|
@ -163,11 +163,8 @@ static PyMethodDef methods[] = {
|
||||
static const int version = 1;
|
||||
|
||||
#ifdef IS_PY3K
|
||||
static struct PyModuleDef mpatch_module = {PyModuleDef_HEAD_INIT,
|
||||
"mpatch",
|
||||
mpatch_doc,
|
||||
-1,
|
||||
methods};
|
||||
static struct PyModuleDef mpatch_module =
|
||||
{PyModuleDef_HEAD_INIT, "mpatch", mpatch_doc, -1, methods};
|
||||
|
||||
PyMODINIT_FUNC PyInit_mpatch(void) {
|
||||
PyObject* m;
|
||||
|
@ -1049,11 +1049,8 @@ static PyMethodDef methods[] = {
|
||||
static const int version = 2;
|
||||
|
||||
#ifdef IS_PY3K
|
||||
static struct PyModuleDef osutil_module = {PyModuleDef_HEAD_INIT,
|
||||
"osutil",
|
||||
osutil_doc,
|
||||
-1,
|
||||
methods};
|
||||
static struct PyModuleDef osutil_module =
|
||||
{PyModuleDef_HEAD_INIT, "osutil", osutil_doc, -1, methods};
|
||||
|
||||
PyMODINIT_FUNC PyInit_osutil(void) {
|
||||
PyObject* m;
|
||||
|
@ -876,11 +876,8 @@ static int check_python_version(void) {
|
||||
}
|
||||
|
||||
#ifdef IS_PY3K
|
||||
static struct PyModuleDef parsers_module = {PyModuleDef_HEAD_INIT,
|
||||
"parsers",
|
||||
parsers_doc,
|
||||
-1,
|
||||
methods};
|
||||
static struct PyModuleDef parsers_module =
|
||||
{PyModuleDef_HEAD_INIT, "parsers", parsers_doc, -1, methods};
|
||||
|
||||
PyMODINIT_FUNC PyInit_parsers(void) {
|
||||
PyObject* mod;
|
||||
|
@ -41,22 +41,23 @@ static const int8_t hextable[256] = {
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
|
||||
|
||||
static char chartable[16] = {'0',
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
'6',
|
||||
'7',
|
||||
'8',
|
||||
'9',
|
||||
'a',
|
||||
'b',
|
||||
'c',
|
||||
'd',
|
||||
'e',
|
||||
'f'};
|
||||
static char chartable[16] = {
|
||||
'0',
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
'6',
|
||||
'7',
|
||||
'8',
|
||||
'9',
|
||||
'a',
|
||||
'b',
|
||||
'c',
|
||||
'd',
|
||||
'e',
|
||||
'f'};
|
||||
|
||||
/*
|
||||
* Turn a hex-encoded string into binary. Returns false on failure.
|
||||
|
@ -201,9 +201,10 @@ inline static linelog_result appendline(
|
||||
linelog_annotateresult* ar,
|
||||
const linelog_inst* inst,
|
||||
linelog_offset offset) {
|
||||
linelog_lineinfo info = {.rev = inst ? inst->rev : 0,
|
||||
.linenum = inst ? inst->offset /* linenum */ : 0,
|
||||
.offset = offset};
|
||||
linelog_lineinfo info = {
|
||||
.rev = inst ? inst->rev : 0,
|
||||
.linenum = inst ? inst->offset /* linenum */ : 0,
|
||||
.offset = offset};
|
||||
returnonerror(reservelines(ar, ar->linecount + 1));
|
||||
ar->lines[ar->linecount++] = info;
|
||||
return LINELOG_RESULT_OK;
|
||||
@ -349,9 +350,10 @@ static linelog_result replacelines(
|
||||
linelog_offset a1newaddr = inst0.offset;
|
||||
appendinst(a1inst); /* [3] */
|
||||
if (!a1instisjge0) { /* [4] */
|
||||
linelog_inst ret = {/* .opcode = */ JGE,
|
||||
0,
|
||||
/* .offset = */ a1addr + 1};
|
||||
linelog_inst ret = {
|
||||
/* .opcode = */ JGE,
|
||||
0,
|
||||
/* .offset = */ a1addr + 1};
|
||||
appendinst(ret);
|
||||
}
|
||||
#undef appendinst
|
||||
|
Loading…
Reference in New Issue
Block a user