Comments (10)
Will take a look tomorrow, @kivikakk! Sorry not to get to this today!
from libprojfs.
This is fantastic; thank you for pushing the envelope on this @kivikakk!
And I was 100% wrong about my dim, fuzzy recollections of putting C in C#; as you said, it's not possible. (There's an unsafe
keyword and matching .csproj
file declaration, but you were totally correct, that doesn't let you embed unsafe code the way I'd mis-remembered.)
So I guess that leads me to think we have a range of options here, each with pros and cons, so I made up this chart -- please amend and correct as you think best!
Pros | Cons | |
---|---|---|
As-is (VFS API in libprojfs) | No extra work now. | Very poor separation of concerns (ties libprojfs to VFSForGit). Inconvenient dual-licensing of projfs_vfsapi.h . |
Second .so (i.e., this WIP) |
Able to lift as-is code largely unchanged. Better separation of concerns. |
Extra Linux library to build/install/manage. May complicate VFSForGit build or licensing (e.g., with the Autoconf Archive macros). Minor additional runtime overhead (very minor, if any, though). |
Rewrite as C# (just projfs_vfsapi.c ) |
Single Linux library. Good separation of concerns. No licensing issues. |
Requires rewriting/refactoring into C#. |
Having written this out, and thought about your point that indeed there's no C-in-C# (unlike C-in-C++), I confess I'm leaning slightly toward the rewrite option -- but only after we fine-tune the API some more. (For instance, we can likely eliminate the CompleteCommand
stuff if we don't have any async operations, the way the Windows projectedfslib does.) And I may well be overlooking some important advantage of one of the other options!!
What say you, having done this first pass of work? Thoughts, comments, criticism?
from libprojfs.
See github/VFSForGit#2 for a spike of the rewrite option.
from libprojfs.
Upstream PR is at microsoft/VFSForGit#848.
from libprojfs.
A question to ponder before our chat tomorrow: what should we do with t[57]*.t
? It seems like, for the most part, these should all be removed from libprojfs
, and all relevant ones reimplemented against PrjFSLib.Linux.Managed
(which is absorbing the API).
from libprojfs.
Indeed -- to be honest, I think we should just remove them and all the --enable-vfs-api
tooling. (I'm very slightly verklempt to see it go, but mostly delighted; this is far better! :-) And I have a pretty good working knowledge of how I wired that stuff in, so pulling it out should be something I can tackle as a quick item.
As for re-implementing tests (or more generally, implementing new more appropriate ones), I think we're on our own to some degree. The Mac kext and user-space library are getting their own unit tests in microsoft/VFSForGit#561 and microsoft/VFSForGit#562, but those either don't exist yet or don't help us on Linux. What might be a better framework to study is the stuff in GVFS/GVFS.NativeTests which is used, IIUC, to perform native Windows API tests within the larger GVFS functional (integration?) unit tests. But again, it's not an exact parallel, and we likely don't need or want the C++. Maybe even better is the mock filesystem framework in GVFS/GVFS.UnitTests/Mock/FileSystem.
I suppose the interesting question is, what to we actually want to test? I would think things like the process name lookup (GetProcCmdline()
) and error code translation (ConvertErrnoToResult()
) and of course the actual event callbacks, especially the file hydration and use of WriteFileContents()
.
Does it then make sense to build a dedicated set of C# mock filesystem and handler tests just for ProjFS.Linux
? Or integrate into the larger framework? I think we may need advice from our Microsoft colleagues on this, to be honest.
from libprojfs.
Indeed -- to be honest, I think we should just remove them and all the
--enable-vfs-api
tooling. (I'm very slightly verklempt to see it go, but mostly delighted; this is far better! :-)
Yes, I was hesitant to suggest it if only because I know how much work went into it! But I do think it's moreorless the only thing that makes sense. We'll implement new (appropriate) tests against the C# stuff.
Now! I was on my way to write that email to John et al. when I dug around and found GVFS.UnitTests.Platform.Mac
. I copied it across to a .Linux
variant and fixed it up — you can see this at github/VFSForGit@2a97cfe...vfs-api-tests. (I merged my VFS API work and your Linux GVFS initial build work at github/VFSForGit@2a97cfe (no conflicts!). Hopefully we can get them both actually merged upstream soon and then this compare URL will be a lot more sensible.)
Moreover, the tests actually run and pass on Linux:
$ dotnet ../BuildOutput/GVFS.UnitTests/bin/x64/Debug/netcoreapp2.1/linux-x64/GVFS.UnitTests.dll --test=GVFS.UnitTests.Platform.Linux.LinuxFileSystemVirtualizerTests
NUnitLite 3.10.1 (.NET Standard 2.0)
Copyright (c) 2018 Charlie Poole, Rob Prouse
Runtime Environment
OS Version: Linux 4.9.0-7-amd64 #1 SMP Debian 4.9.110-3+deb9u2 (2018-08-13)
CLR Version: 4.0.30319.42000
Test Files
/home/kivikakk/BuildOutput/GVFS.UnitTests/bin/x64/Debug/netcoreapp2.1/linux-x64/GVFS.UnitTests.dll
Test Filters
Test: GVFS.UnitTests.Platform.Linux.LinuxFileSystemVirtualizerTests
Run Settings
Number of Test Workers: 4
Work Directory: /home/kivikakk/VFSForGit
Internal Trace: Off
Test Run Summary
Overall result: Passed
Test Count: 11, Passed: 11, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0
Start time: 2019-02-27 07:10:42Z
End time: 2019-02-27 07:10:42Z
Duration: 0.288 seconds
Results (nunit3) saved as /home/kivikakk/VFSForGit/TestResult.xml
Completed test pass in 00:00:00.4906198
$
So this is an excellent start! I don't actually have anything for an email to MS yet — I can use this as prior art to cook up test suites for other bits, as it turns out to be simple (and not awful like I remember).
from libprojfs.
I suppose the interesting question is, what to we actually want to test? I would think things like the process name lookup (
GetProcCmdline()
) and error code translation (ConvertErrnoToResult()
) and of course the actual event callbacks, especially the file hydration and use ofWriteFileContents()
.Does it then make sense to build a dedicated set of C# mock filesystem and handler tests just for
ProjFS.Linux
? Or integrate into the larger framework? I think we may need advice from our Microsoft colleagues on this, to be honest.
Finishing up my workday, but this does still need to be addressed. I plan to dig more tomorrow to see what best I can come up with, and then maybe email to inquire about what they think the best route might be — or open an issue, to keep the discussion public!
from libprojfs.
This is fantastic, as usual, @kivikakk! I'm sorry I missed MacFileSystemVirtualizerTests.cs
on my first spelunking for prior art; it looks precisely right for this purpose!
It's fantastic that this actually runs and passes. ✅ 😃
from libprojfs.
Closed by microsoft/VFSForGit#848 and #53.
from libprojfs.
Related Issues (20)
- Avoid FUSE fork using xattrs and flock(2)
- Add Azure Pipelines CI badge to README
- support building against recent libfuse v2.x or older v3.x HOT 1
- Check for xattr support at mount time HOT 1
- Event notifications on file/dir rename operations
- Test use of flock(2) HOT 3
- Store GVFS metadata in xattrs on placeholder/empty files HOT 1
- projection/hydration of files on open() and related file ops
- Use `.vfsforgit*` instead of `.gvfs*` directories for GVFS provider.
- Add all file operation event notifications required by VFSForGit HOT 1
- Implement pre-modification state flag for hydrated files HOT 1
- Refactor test suite to support projection
- Set initial projection state on backing store at first mount HOT 1
- Detect and set projection state on read-only files
- spoof events on libfuse hidden files, or use top-level hidden directory
- replace flock with internal per-inode lock HOT 1
- expand mirror test suite to cover all file/dir/fs ops HOT 6
- Project status update? HOT 1
- Docker setup failed HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libprojfs.