Commit Graph

262 Commits

Author SHA1 Message Date
Chad Austin
7a3ac07f7f move EdenError to utils/
Summary:
I want to use EdenError from some code outside of service/, so move
EdenError into utils.

Reviewed By: genevievehelsel

Differential Revision: D25447438

fbshipit-source-id: 2d1ddfa379238369679e84708518a9ba106f76b9
2021-02-23 19:58:03 -08:00
Xavier Deguillard
8853701e91 path: forbid building non-utf8 paths
Summary:
The world has moved on utf-8 as the default encoding for files and data, but
EdenFS still accepts non utf-8 filenames to be written to it. In fact, most of
the time when a non utf-8 file is written to the working copy, and even though
EdenFS handles it properly, Mercurial ends up freaking out and crash. In all of
these cases, non-utf8 files were not intentional, and thus refusing to create
them wouldn't be a loss of functionality.

Note that this diff makes the asumption that Mercurial's manifest only accept
utf8 path, and thus we only have to protect against files being created in the
working copy that aren't utf8.

The unfortunate part of this diff is that it makes importing trees a bit more
expensive as testing that a path is utf8 valid is not free.

Reviewed By: chadaustin

Differential Revision: D25442975

fbshipit-source-id: 89341a004272736a61639751da43c2e9c673d5b3
2021-02-23 11:35:12 -08:00
Shai Szulanski
dba656e44d Rename Try::throwIfFailed -> throwUnlessValue
Summary: Update name to match usage of Try as tri-state, since this method also throws if the Try is empty

Reviewed By: yfeldblum

Differential Revision: D25737810

fbshipit-source-id: a4166153362f07353d212216fbaf7105867eef2a
2021-01-11 13:05:17 -08:00
Andres Suarez
21c95391ca Apply clang-format update fixes
Reviewed By: igorsugak

Differential Revision: D25861960

fbshipit-source-id: e3c39c080429058a58cdc66d45350e5d1420f98c
2021-01-10 10:06:29 -08:00
Xavier Deguillard
978cd4549c hg: ignore invalid filename when importing manifest
Summary:
Mercurial support files with `\` in their name, which can't be represented on
Windows due to `\` being the path separator. Currently, EdenFS will throw
errors at the user when such file are encountered, let's simply warn, and
continue.

Reviewed By: chadaustin

Differential Revision: D25430523

fbshipit-source-id: 4167b4cd81380226aead8e4f4850a7738087fd95
2021-01-05 14:08:14 -08:00
Xavier Deguillard
a3115dacd8 utils: add a constexpr utf8 checker
Summary:
In a future diff, paths will be validated to make sure they are valid utf8. The
path sanity checker needs to be constexpr to construct global paths, but the
utf8 functions aren't, so let's write one that is.

Reviewed By: chadaustin

Differential Revision: D25562681

fbshipit-source-id: e48ec835c2cc9dc01090918cc7ee8f61b6c05a20
2020-12-16 01:03:32 -08:00
Xavier Deguillard
34edb7b618 win: re-use guid for the lifetime of the checkout
Summary:
On Windows, the GUID of the mount point identifies the virtualization instance,
that GUID is then propagated automatically to the created placeholders when
these are created as a response to a getPlaceholderInfo callback.

When the placeholders are created by EdenFS when invalidating directories we
have to pass GUID. The documentation isn't clear about whether that GUID needs
to be identical to the mount point GUID, but for a very long time these have
been mismatching due to the mount point GUID being generated at startup time
and not re-used.

One of the most common issue that users have reported is that sometimes
operations on the repository start failing with the error "The provider that
supports file system virtualization is temporarily unavailable". Looking at the
output of `fsutil reparsepoint query` for all the directories from the file
that triggers the error to the root of the repositories, shows that one of the
folder and its descendant don't share the same GUID, removing it solves the
issue.

It's not clear to me why this issue doesn't always reproduce when restarting
EdenFS, but a simple step that we can take to solve this is to always re-use
the GUID, and that hopefully will lead to the GUID always being the same and
the error to go away.

Reviewed By: fanzeyi

Differential Revision: D25513122

fbshipit-source-id: 0058dedbd7fd8ccae1c9527612ac220bc6775c69
2020-12-15 08:07:49 -08:00
Xavier Deguillard
88dcfa7bb3 utils: add an RcuPtr class
Summary:
RCU is a synchronization mechanism that allows for very fast reads, at the
expense of slower writes. This is achieved by having the reader sometimes
reading a stale pointer when concurrent to a write, at which point the writer
will delay reclaiming the old data to a later moment where it is known that no
reader can hold a pointer to the old data.

Doing that allows for the read operations to be significantly faster than using
a Synchronized lock. Folly's documentation claims a read lock/unlock of RCU
runs in ~4ns, while the same for Synchronized is ~26ns.

Due to the writers cost, RCU is perfectly suited for places where reads needs
to be as fast as possible, and writes are very infrequent. One typical example
is when caching an application's configuration, we can expect reading the
configuration values more frequently than it is being reloaded, and in the case
where the configuration mismatch, a stale configuration can be tolerated by the
application.

In EdenFS, we can use RCU on Windows to make sure that unmounting a repository
will wait on all the pending callbacks.

Reviewed By: kmancini

Differential Revision: D25351536

fbshipit-source-id: 050ca0337e67ae195f4f16062dddb60f584af692
2020-12-11 14:10:58 -08:00
Xavier Deguillard
754d132783 Back out "prjfs: handle concurrent file/directory removal"
Summary: Something is wrong with this which causes Unity to freak out.

Reviewed By: fanzeyi

Differential Revision: D25453230

fbshipit-source-id: 89f61fd97817403fa65071ddac022a226b775e53
2020-12-10 07:42:38 -08:00
Xavier Deguillard
2bfdf6f481 prjfs: handle concurrent file/directory removal
Summary:
A while back, we saw that concurrent directory creation would lead to EdenFS
being confused and failing to record some of the created directories. This then
caused EdenFS to no longer being in sync with what was on disk. To handle this
case, we've had to manually creating these directories recursively.

What I didn't realize at the time was that these concurrent notifications could
also happen on removal this time, and if a directory removal notification wins
the race against the removal of its last children, that directory wouldn't be
removed and EdenFS would once again be confused about the state of the
repository.

Fixing this is a bit trickier than directory creation as it's more racier.
Consider a directory that is being removed, and then immediately recreated with
a file in it in a different process. The naive approach of simply force
removing all of the children of a directory when handling the removal
notification would clash with the file creation. We could argue that nobody
should be doing this, but there would be an unhandled race, and thus a bug
where data would potentially be lost[0].

We can however fix this bug slightly differently. For file/directory removal,
we can actually hook onto the pre-callback, ie: one that happens before the
file/directory is no longer visible on disk. This inherently eliminate the race
altogether as the callback will be guaranteed to run when none of its children
are present, and if a race happens with a file creation in it, we can simply
fail the removal properly.

The only tricky bit is for the renaming logic, as renaming a file is logically
a removal followed by a creation. For that reason, I've moved part of the
renaming bits to the pre-callback too.

In theory, this change may negatively affect workloads that do concurrent
directory removal as the duration during which a file/directory is visible
ondisk now includes the EdenFS callback while it didn't before. Such workflows
should be fairly rare and/or redirected to avoid EdenFS altogether if
performance matters.

[0]: This left-over file that EdenFS wouldn't be aware of would also later
cause the checkout code to fail due to invalidation failures triggered when
trying to invalidate that directory. This would be fairly hard to debug.

Reviewed By: fanzeyi

Differential Revision: D25112381

fbshipit-source-id: 9300499ce872ad93d0a687f0e61b7e2a9caf9556
2020-12-04 14:25:44 -08:00
generatedunixname89002005325676
c22e5de544 Daily arc lint --take CLANGFORMAT
Reviewed By: zertosh

Differential Revision: D25049451

fbshipit-source-id: 6b9d1b95dca0f2454e94918bb78e545e084e5d14
2020-11-18 04:32:26 -08:00
Chad Austin
20d032231c improve PathComponent parse failure error messaging
Summary:
Be more specific about which PathComponent string failed to validate
in order to help diagnose downstream issues like glob syntax errors.

Reviewed By: genevievehelsel

Differential Revision: D24966004

fbshipit-source-id: cd3bc0aeaeb389caa13c86b91149d48c5afdb306
2020-11-17 12:53:39 -08:00
Xavier Deguillard
4038c01e9f utils: remove //eden/fs/utils/test:linux_test
Summary:
The skip_on_mode_mac argument to cpp_unittest doesn't exist on Windows, and to
be consistent with the rest of the code, we can simply ifdef the code that
either doesn't compile, or doesn't run.

Note: For some reason the accessIncrementsAccessCount test fails when running
on Windows, but only if running after accessAddsProcessToProcessNameCache...

Reviewed By: chadaustin

Differential Revision: D24496450

fbshipit-source-id: fe18fe1d791a27fbe4bd03bd3e8c811feeb23f5f
2020-11-16 08:29:04 -08:00
Xavier Deguillard
27f08fc126 utils: remove ServiceAddress
Summary: This is unused, except in tests, so let's just remove it.

Reviewed By: chadaustin

Differential Revision: D24930011

fbshipit-source-id: cb132962e1dff9d12ce12e7eb75bd34a026c58b7
2020-11-13 15:19:38 -08:00
Xavier Deguillard
d2f78cafdf pathfuncs: silence warning
Summary:
The components iterator return pieces of the original path, using a reference
makes little sense and the compiler complains.

Reviewed By: genevievehelsel

Differential Revision: D24873851

fbshipit-source-id: 40d414dcb4a0539167ab4760dfc0095af8245b3a
2020-11-11 20:00:39 -08:00
Xavier Deguillard
adcc8f07ea utils: add a quoting test for SpawnedProcess
Summary:
While doing notifications, I struggled a bit to get them working and thought
the special quoting on Windows didn't work as expected. It turns out the error
was cmd related and using a modern shell (PowerShell) fixed it.

Having a test for the quoting is a good idea nonetheless, so let's have one.

Reviewed By: genevievehelsel

Differential Revision: D24864357

fbshipit-source-id: 6b1ac50f3b7b1ef469378d5de21f56c24c0945f9
2020-11-11 09:37:56 -08:00
Xavier Deguillard
34598d4337 remove dependency on glog
Summary:
The EdenFS codebase uses folly/logging/xlog to log, but we were still relying
on glog for the various CHECK macros. Since xlog also contains equivalent CHECK
macros, let's just rely on them instead.

This is mostly codemodded + arc lint + various fixes to get it compile.

Reviewed By: chadaustin

Differential Revision: D24871174

fbshipit-source-id: 4d2a691df235d6dbd0fbd8f7c19d5a956e86b31c
2020-11-10 16:31:15 -08:00
Xavier Deguillard
4626f30206 utils: actually return an HRESULT from exceptionToHResult
Summary: These errors are Win32 errors, we need to wrap them into a HRESULT.

Reviewed By: chadaustin

Differential Revision: D24809646

fbshipit-source-id: 9f42b9d0c43474967dc26cb2c14cbee463768b79
2020-11-10 09:59:25 -08:00
Xavier Deguillard
0a3bc0c7d6 utils: fix SpawnedProcess.pipe test on @mode/win
Summary:
When built with buck, cmake isn't available, switch to a method of echoing that
should be available on every system: powershell.

Reviewed By: genevievehelsel

Differential Revision: D24493404

fbshipit-source-id: 5986b846a211be59f1057b1e7ecd924f3f7380a5
2020-10-26 20:56:17 -07:00
Chad Austin
496c69e182 allow masking trace events
Summary:
Sometimes you only want to trace writes into the EdenFS checkout, so
add the ability to run `eden strace` with `--reads`, `--writes`, or
both in order to see only those events.

Reviewed By: wez

Differential Revision: D24468539

fbshipit-source-id: a1b3c730987cf86ce3d39952c6a5e9c5edaddfc2
2020-10-23 19:53:00 -07:00
Xavier Deguillard
a75af7a63d PathFuncs: allow paths on Windows to be '\' separated
Summary:
Previously, when that code was ported on Windows, paths separator were
converted from '\' to '/' when a wide string was provided, all the other paths
were treated as is.

The main issue with this strategy is that not all paths can be converted, the
non-stored ones for instance are immutable, which leads to some subtle bugs
down the line. For instance, the paths: "Z:/foo/bar/baz" and "Z:\foo/bar\baz"
would not be equal as the path separator isn't the same, but both of these are
actually the same path underneath.

To solve this, this diff first introduce a Windows path separator, and then
modifies the path comparison functions to ignore the path separator and only
compare the components.

I'm definitively not a fan of the pattern I use for searching for both / and \
in paths, suggestions are welcome for how to improve that.

Reviewed By: chadaustin

Differential Revision: D24376980

fbshipit-source-id: 0702bf775c7c3937b2138abd5a63d339ac80aaed
2020-10-22 16:24:17 -07:00
Xavier Deguillard
fafb9177c8 path: verify that composed paths are comprised of valid PathComponent
Summary:
The path iterator functions are skipping sanity checking of paths as they
assume that the path has already been validated. Unfortunately, that isn't the
case as the only sanity checking we are doing is on the beginning and end of
the string that is passed in. Notably, `RelativePathPiece{"./foo"}` would not
fail the sanity checking even though it it's not made of valid components.

Reviewed By: chadaustin

Differential Revision: D24439804

fbshipit-source-id: 852b3a1180b185cb0bfb96bf5bcdc98b231f32c5
2020-10-22 16:24:17 -07:00
Xavier Deguillard
566ca81dc0 utils: truncate nul bytes after obtaining a temp file name
Summary:
As the string is created with MAX_PATH wide characters, a lot of them are going
to stay nul. A future diff adds a sanity check to the PathComponent that
validates that it doesn't contain any nul bytes, which chokes on these paths.

Reviewed By: chadaustin

Differential Revision: D24479715

fbshipit-source-id: e51c4b1c53a3f375664c0c0a1e325ebe302b0cd3
2020-10-22 16:24:17 -07:00
Xavier Deguillard
acb4d6e672 utils: compile the tests with @mode/win
Summary: This merely filters out the files that don't compile on mode/win.

Reviewed By: chadaustin

Differential Revision: D24456917

fbshipit-source-id: d314ca2936e064133f2fc6a6199b38d17f2d9ef7
2020-10-22 12:52:13 -07:00
Chad Austin
9f651a8f28 Remove dead includes in eden
Reviewed By: simpkins

Differential Revision: D23864216

fbshipit-source-id: e1e3803ee47398639bf3cf85e3347d54ecaff424
2020-10-09 15:25:47 -07:00
Xavier Deguillard
41e1078dd3 utils: properly collect process name on Windows
Summary:
This allows `edenfsctl debug processfetch` to display what processes triggered
some IO in EdenFS which will be useful to debug rogue processes walking the
entire repo.

Reviewed By: chadaustin

Differential Revision: D23997665

fbshipit-source-id: 7d92755d0068a4b1819eb0c84b30cbdaa24296f7
2020-10-05 15:46:02 -07:00
Xavier Deguillard
d8d841ae80 prjfs: add partial support for debug processfetch on Windows
Summary:
This will enable to gather a bit more debugging regarding what processes are
fetching data. The one missing bit on Windows is to collect the process name,
for now, a "NOT IMPLEMENTED" placeholder is put in place.

Reviewed By: wez

Differential Revision: D23946258

fbshipit-source-id: 9f7642c7b9207c5b48ffff0f4eb0333af00bc7d5
2020-10-05 15:46:02 -07:00
Margot Leibold
be7839f2a1 Do not heap allocate HostInfoProperties
Summary: HostInfoProperties is allocated for every HostInfo and is accessed on every request. There's no reason this should be a unique_ptr, and the pointer indirection is expensive.

Reviewed By: jmswen

Differential Revision: D24009296

fbshipit-source-id: 2034d1c6e61e0dec51ca6ac7bd14ab12e74966d4
2020-10-05 14:43:47 -07:00
Chad Austin
725fd88ef0 fix tests on macOS
Summary:
The SpawnedProcess tests were failing on my macOS machine because pwd
and getcwd returned slightly different paths. Normalize them before
comparing.

Reviewed By: genevievehelsel

Differential Revision: D24094634

fbshipit-source-id: aacf802280b1dd1de19797604bfe359d7e60cbf8
2020-10-05 12:33:58 -07:00
Xavier Deguillard
1457079384 utils: fix zero-initialization in Guid.h
Summary:
In c++, to zero-initialize, empty braces is sufficient for a non-class type.
{0} will only zero-initialize the first field, which is not the intent here.

Reviewed By: wez

Differential Revision: D24068481

fbshipit-source-id: 2de87da983a05f25e0222bf5338533a7b96fb36a
2020-10-02 10:50:54 -07:00
Xavier Deguillard
ee771fa740 utils: move multibyteToWideString to a cpp file
Summary:
There is no good reason for this function to be in a header, let's move it to
StringConv.cpp

Reviewed By: genevievehelsel

Differential Revision: D24000882

fbshipit-source-id: 5bb6bc3b9ef37232d38b8e35da693e12c0453ea1
2020-09-30 16:29:13 -07:00
Xavier Deguillard
b961901bb9 utils: remove UnixClock::getElapsedTimeInNs
Summary:
Replace it by simply using std::chrono facilities to achieve the exact same
behavior.

Reviewed By: chadaustin

Differential Revision: D24027637

fbshipit-source-id: d22eefec5d408ead0b4cfaa20e716f4c10cce0b5
2020-09-30 15:50:08 -07:00
Xavier Deguillard
695c24f493 fs: ifdef linux/macos only files
Summary:
These don't compile on Windows, and in order to get mode/win to compile, we
need to avoid compiling their contents. Ideally, we could do that in the
TARGETS files with the select statement, but that's not available in fbcode.
Thus, we do the next best thing: ifdef the file entirely.

Reviewed By: wez

Differential Revision: D23871728

fbshipit-source-id: b4d9df6503eaa008e649afd7bdc665cd37a9585d
2020-09-23 12:20:41 -07:00
Wez Furlong
1c716a1575 edenfs: fixup PathMap copy and move ctor for case sensitivity
Summary:
*shakes fist at C++ copy-constructors*

We weren't guaranteeing that case-insensitive status was being propagated on
copies or moves, which meant that eg: `lookup("workspace")` would be treated as
case-sensitive when mounted case insensitively.

Reviewed By: xavierd

Differential Revision: D23857218

fbshipit-source-id: 67e33a8455a0a85e5885389b5bb38b20ef043894
2020-09-23 09:46:57 -07:00
Xavier Deguillard
c6b9788af8 win: move win/utils onto utils/
Summary: This will make it easier to build with Buck.

Reviewed By: fanzeyi

Differential Revision: D23827754

fbshipit-source-id: bf3bf4d607a08b9831f9dfea172b2e923a219561
2020-09-22 09:09:56 -07:00
Wez Furlong
b39f678b85 edenfs: remove use of fork from StartupLogger
Summary:
on macOS we cannot safely use `fork`.

This commit replaces the use of `fork` in the startup logger subsystem.
This was a little tricky to untangle; originally (prior to any of
the `fork` removal efforts in this diff stack), the startup flow was
to spawn a set of processes via fork:

```
edenfs (setuid)
 \-----edenfs (privhelper, as root)
  \------edenfs (daemonized)
```

The forked children take advantage of being able to implicitly pass state to
the child processes from the parent.  That data flow needs to become explicit
when removing the fork which makes some things a little awkward.

With fork removed:

* `edenfs` unconditionally spawns `edenfs_privhelper` while it has
  root privs and before most of the process has been initialized.
* That same `edenfs` process will then spawn a child `edenfs`
  process which starts from scratch, but that which needs to
  run as the real server instance
* The original `edenfs` instance needs to linger for a while
  to remain connected to the controlling tty to pass back the
  startup state to the user, before terminating.

This commit deletes the check that `edenfs` is started originally
as root; previously the logic relied on the forked startup logger
continuing past the `daemonizeIfRequested` call and simply deferring
the check until after folly::init.  With these changes we can't
easily perform such a check without adding some extra gymnastics
to pass the state around; the place where that is checked is in
the spawned child of the original edenfs, which is not a privileged
process and doesn't know the original euid.  I don't believe this
to be a great loss as we tuck `edenfs` away under the libexec dir.

Reviewed By: chadaustin

Differential Revision: D23696569

fbshipit-source-id: 55b95daf022601a4699274d696af419f0a11f6f2
2020-09-18 17:22:39 -07:00
Wez Furlong
2941822299 eden: use SpawnedProcess to start privhelper
Summary:
On macOS we cannot safely use `fork` to spawn processes while other threads may initialize objc classes.

This commit replaces the use of `fork` in the privhelper startup with
`SpawnedProcess` instead.  We need to take care with this as we are generally
installed setuid root and we'd like to avoid being tricked into running an
arbitrary child process as root.

This commit defines a separate executable called `edenfs_privhelper` that
contains just the privhelper server code.

We need to be careful about locating this executable; to avoid invoking an
arbitrary process while we have root privileges we require that the privhelper
be a sibling to the edenfs executable and carry out some additional ownership
verification so that we can tell that the owner of edenfs also controls
edenfs_privhelper.

To facilitate this, I've added an `executablePath` function to PathFuncs; it
returns the path to the current executable image.

To make the integration test scenario simpler, I've added the edenfs_executable
binary definition alongside that of the edenfs binary in the buck and cmake
build systems.  This causes the binaries to be siblings in-situ in the build
tree and avoids the need to move things into place in the test harness.

Reviewed By: chadaustin

Differential Revision: D23653343

fbshipit-source-id: 3c2539a5e0e11cee88960db49c885ce0366d314e
2020-09-18 17:22:39 -07:00
Wez Furlong
0f2f5b9330 edenfs: change PathMap CaseSensitivity to runtime option
Summary:
This commit moves a compile-time template parameter
to be a runtime boolean parameter.

There's a bit of fan-out that, while I don't think it is
super awesome, isn't super terrible either.

The case sensitivity value is read from the checkout config
added in the prior diff in this stack.

Reviewed By: xavierd

Differential Revision: D23751192

fbshipit-source-id: 46f6fe25bfa6666305096ad9c416b510cd3aac8f
2020-09-18 08:43:14 -07:00
Wez Furlong
ec25f05c6d eden: allow ECHILD to be non-fatal in SpawnedProcess
Summary:
I had originally make the logic around ECHILD very strict,
thinking it impossible to have a situation where it may arise,
but it turns out that our daemonization makes this happen all
the time.

This commit treats an ECHILD return from waitpid as equivalent
to a success waitpid result and success child process termination.

Reviewed By: chadaustin

Differential Revision: D23683107

fbshipit-source-id: 7867d636afd8ee79b9f100454f84e7ef480109d8
2020-09-17 09:08:58 -07:00
Wez Furlong
745d047762 edenfs: move WinError to eden/fs/utils
Summary: This resolves a dependency cycle introduced in D23037325 (f4f159537f) and D23480435 (34821976e0)

Reviewed By: xavierd

Differential Revision: D23735176

fbshipit-source-id: a4849d512e4181afbb007d7e850aadf092c6eb90
2020-09-17 09:08:58 -07:00
Xavier Deguillard
2ff478ea62 utils: move win/utils/Stub.h to utils/NotImplemented.h
Summary:
Since the Stub.h now only contains NOT_IMPLEMENTED, let's move it to its own
header outside of the win directory.

Reviewed By: genevievehelsel

Differential Revision: D23696244

fbshipit-source-id: 2dfc3204707e043ee6c89595668c484e0fa8c0d0
2020-09-16 12:31:46 -07:00
Xavier Deguillard
d48209e3ed build: compile takeover/ on Windows
Summary:
While the code isn't compiled, this makes the thrift definition available to
the rest of the code, eliminating the need for having a stub for
SerializedInodeMap on Windows.

Reviewed By: genevievehelsel

Differential Revision: D23696242

fbshipit-source-id: 8a42dd2ed16887f3b7d161511e07aaa35fd1b968
2020-09-16 12:31:46 -07:00
Chad Austin
be7a6b5cb3 introduce an assertZeroBits function to double-check the compiler
Summary:
While hacking on some code, I ran into a situation where some
zero-initialized stat structs weren't actually being zeroed. This was
either a compiler bug or a situation where the build system was not
correctly rebuilding everything after my changes, and I did not have
enough disassembly available to investigate.

Either way, since this code assumes zero bits in some nonobvious ways,
explicitly assert they are.

Reviewed By: xavierd

Differential Revision: D23644819

fbshipit-source-id: eb6bff9ff997379113db1e1bf9d6a0a538f10f0b
2020-09-13 01:37:14 -07:00
Zeyi (Rice) Fan
01315a9bbc fix SpawnedProcess ERROR_BAD_LENGTH
Summary: This fixes the `The program issued a command but the command length is incorrect` error we have been seeing in EdenFS Windows.

Reviewed By: wez

Differential Revision: D23589264

fbshipit-source-id: 72478a653ff07fca81c163bab12c0fd33f6a0a67
2020-09-08 18:25:04 -07:00
Xavier Deguillard
cd0af7689a utils: compile ProcessAccessLog and ProcessNameCache on Windows
Summary:
Even though these might not be fully ported on Windows, they do compile and
tests are passing, so let's compile them.

Reviewed By: chadaustin

Differential Revision: D23505509

fbshipit-source-id: 567e8668ca489daf89c1c6576973bbaaabbb6c88
2020-09-04 16:14:25 -07:00
Xavier Deguillard
a5c85ec822 fuse: move and rename RequestData
Summary:
Most of the RequestData code is platform generic, but bits of it are currently
strongly tied to FUSE. By splitting these 2 parts, we will be able to use the
RequestContext class in Windows too and not having to re-implement all the
logic there.

Reviewed By: chadaustin

Differential Revision: D23482072

fbshipit-source-id: 857fd9ca4264d0f308ec10cc487e9ff3eeb5ee16
2020-09-04 16:14:24 -07:00
Xavier Deguillard
5c6ab8afac utils: rename ProcessAccessLog::AccessType enum
Summary:
Removing Fuse from the enum name makes it non tied to Fuse and thus makes it
more portable. This also eliminates the last platform specific bit from
RequestData.

Reviewed By: chadaustin

Differential Revision: D23467773

fbshipit-source-id: 52515522c8ac51d0c4b56dc5e42d4b6593df6623
2020-09-03 17:00:07 -07:00
Wez Furlong
950c81858c eden: fix buffer advance in FileDescriptor::wrapFull
Summary:
The loop took care to advance `b` to match the amount
of data that it had processed, but was still passing `buf`
(the unadjusted start of the buffer) to the syscalls.

This meant that in situations where a `readFull` might
encounter a partial read, it would scribble over the start
of the buffer and leave junk at the end.

For example:

write("hell");
write("o");

could produce "oell?" in the buffer when `readFull` consumes
the other end of the pipe.

Reviewed By: xavierd

Differential Revision: D23486270

fbshipit-source-id: 0848f6789b44421b609b91fe08890768ff59f7f5
2020-09-02 23:38:18 -07:00
Xavier Deguillard
34821976e0 utils: use makeWin32ErrorExplicit instead of system_error
Summary: The latter will not strip new lines from the system error message, while the former does.

Reviewed By: genevievehelsel

Differential Revision: D23480435

fbshipit-source-id: 44742b960935552fa1781ed19f38ff446a8c9403
2020-09-02 19:47:00 -07:00
Xavier Deguillard
7b2c803904 fuse: move BufVec.h to utils/
Summary:
This is not per-se fuse related, thus move it to a common location and remove
the duplicated define in FileInode.h

Reviewed By: chadaustin

Differential Revision: D23465192

fbshipit-source-id: 5fa7709f127c2d3372ee5ea3aeb89e793ea5b9f7
2020-09-02 12:15:48 -07:00