# FuseSharp
FuseSharp is a **FUSE** wrapper for **macOS** (GNU/Linux in the future) developed in C# by Códice Software.
It provides a clean API designed specifically to enable the development of userspace filesystems in .NET applications.
FuseSharp only uses .NET Standard 2.0 features, so it is highly interoperable with other .NET Platforms such as Core, Mono, and Xamarin.Mac.
* [Goal](#goal)
* [Usage scenarios](#usage-scenarios)
* [Setup and usage](#setup-and-usage)
* [Project Overview](#project-overview)
* [Performance tests](#performance-tests)
* [License](#license)
## Goal
The goal of this project is to provide an API which enables C# applications to easily implement a filesystem in user-space. This API is written in C# and solely relies on **.NET Standard 2.0 features**, so it's compatible with the following .NET platforms:
| Platform | Minimum version |
|---------------:|----------------:|
| .NET Core | 2.0 |
| .NET Framework | 4.6.1 |
| Mono | 5.4 |
| Xamarin.Mac | 3.8 |
### Usage scenarios
If you stumbled upon this repository by accident, you might be wondering _"why would I want / need to build a filesystem in user space?"_ The answer is: a filesystem adds a layer of abstraction that empowers and eases use cases you might not have thought of before.
And because said FS is running on user space, you can let FUSE do the heavy lifting, while you will only need to focus on what really matters development-wise.
Did you know there is a filesystem that lets you watch YouTube videos as if they were locally stored in you machine, without having to navigate to the web portal? Or that you can add a transparent encryption layer to a directory tree, to let your users have a secure storage without having to deal with how files are encrypted and decrypted?
Here are some other FUSE-powered filesystem implementations in the wild that might inspire you (mind that **none** of them were developed using FuseSharp, let us know if you implement one yourself with this library!):
* [**SSHFS**](https://github.com/osxfuse/osxfuse/wiki/SSHFS): Mounts a remote directory tree through a SSH connection.
* [**EXT**](https://github.com/osxfuse/osxfuse/wiki/Ext): Provides [EXT filesystem](https://en.wikipedia.org/wiki/Extended_file_system) support for macOS (read by default, but write can be enabled).
* [**NTFS-3G**](https://github.com/osxfuse/osxfuse/wiki/NTFS-3G): Provides [NTFS filesystem](https://en.wikipedia.org/wiki/NTFS) support for macOS (both read and write).
* [**XFS**](https://github.com/osxfuse/osxfuse/wiki/XFS): Provides [XFS filesystem](https://en.wikipedia.org/wiki/XFS) support for macOS.
* [**procfs**](https://github.com/osxfuse/osxfuse/wiki/procfs): Implements a [procfs filesystem](https://en.wikipedia.org/wiki/Procfs) on macOS, which [is not provided by default](http://osxbook.com/book/bonus/chapter11/procfs/).
* [**Accessibility FS**](https://code.google.com/archive/p/macfuse/wikis/MACFUSE_FS_ACCESSIBILITYFS.wiki): A filesystem that exposes the applications that are running in your computer, and the user interface elements said applications expose (including the properties of this GUI components!).
* [**YouTube FS**](https://code.google.com/archive/p/youtubefs/): YoutubeFS enables you to browse your favorite Youtube videos locally on your desktop without going to the youtube website.
* [**fuse-zip**](https://bitbucket.org/agalanin/fuse-zip): Implements a filesystem to navigate, extract, create and modify ZIP and ZIP64 archives based on libzip implemented in C++, working with ZIP archives as real directories.
## Setup and usage
The project is **not** available in NuGet for now. In order to start using it, you must follow these steps:
1. Clone this repository.
2. Install dependencies:
* ``glib`` 2.56.1. It is available for macOS users through ``brew``.
* .NET Core SDK.
* Apple Developer Tools.
3. Compile and install the adaptor library:
* Executing the `buildandcopy` script located at `/src/Adaptor`
4. Compile the FuseSharp library and the example application:
* Executing `dotnet build` at `/src/FuseSharp`, or opening the FuseSharp solution with your IDE of choice and building it.
Once you complete these steps, you can add your `FuseSharp.dll` assembly as a project dependency.
If you distribute an application that uses FuseSharp, bear in mind that, in order to run the application, **the target machine needs to have installed the ``Adaptor.dylib`` library** compiled at step 3.
### Example application
You can also browse and play with the example application located at `src/FuseSharp/example`.
The application is self-explanatory if executed without arguments.
It implements two different User-Space Filesystems:
* Mirror: it creates a mirror FS, mounted at the specified path, mirroring the content of the root path specified.
* Encrypted: it creates an encrypted FS, mounted at the specified path, mirroring and encrypting/decrypting the content of the root path specified on the fly.
To implement your own filesystem, you need to subclass the ``FileSystem`` type, overriding the necessary methods. You can browse the example to see how. Here's a little GIF demonstrating how it works:
![FuseSharp demo demonstration](https://raw.githubusercontent.com/PlasticSCM/FuseSharp/master/img/demo.gif)
Once you have finished your filesystem, mounting it is as easy as this:
```
using (MyOwnFileSystemImpl fs = new MyOwnFileSystemImpl(targetRoot))
using (FileSystemHandler fsh = new FileSystemHandler(fs, args))
{
int result = fsh.start();
}
```
### FileSystemHandler arguments
The arguments used to instantiate a `FileSystemHandler` instance are, in the end, passed down to FUSE. FUSE's arguments documentation is sometimes hard to find, but we have collected and tested the following (apart from the [usual args](https://github.com/osxfuse/osxfuse/wiki/Mount-options)):
| Option | Description | Source |
|--------|-------------|--------|
| ``big_writes`` | FUSE driver option - enabled max_write | [Question about write buffer size](http://fuse.996288.n3.nabble.com/Question-about-write-buffer-size-td13137.html) |
| ``max_write`` | Libfuse option. Max write size in bytes | [Question about write buffer size](http://fuse.996288.n3.nabble.com/Question-about-write-buffer-size-td13137.html) and [To FUSE or not to FUSE](https://www.usenix.org/system/files/conference/fast17/fast17-vangoor.pdf) |
| ``writeback_cache`` | Libfuse option | [Question about write buffer size](http://fuse.996288.n3.nabble.com/Question-about-write-buffer-size-td13137.html) and [To FUSE or not to FUSE](https://www.usenix.org/system/files/conference/fast17/fast17-vangoor.pdf) |
| ``splice_read``, ``splice_write``, ``splice_move`` | Activate splicing for all operations | [To FUSE or not to FUSE](https://www.usenix.org/system/files/conference/fast17/fast17-vangoor.pdf) |
| ``direct_io`` | Some file systems may not know the sizes of files that they provide. This could be because a file's content is being streamed so it's difficult or impossible to know the "size" of the file. The content could be dynamically changing so it may not make sense to advertise a size at getattr time only to find that the size has changed at read or write time. procfs is a good example of a osxfuse file system with such needs. What these file systems would like is to be able to allow reads and writes without the file size mattering. This isn't normally possible in the normal I/O paths in the kernel. In particular, short reads from a user-space file system will be zero filled by osxfuse. The ``direct_io`` option causes osxfuse to use an alternative "direct" I/O path between the kernel and the user-space file system. This path makes the file size irrelevant--a read will go on until the file system keeps returning data. There is
没有合适的资源?快使用搜索试试~ 我知道了~
适用于macOS(以及未来的GNU/Linux)的.NETStandard中的FUSE包装器-C#-C-下载
共32个文件
cs:14个
png:5个
csproj:2个
需积分: 4 0 下载量 186 浏览量
2023-01-10
21:55:16
上传
评论
收藏 266KB ZIP 举报
温馨提示
(更多详情、使用方法,请下载后细读README.md文件) 保险丝\nFuseSharp 是由 Códice Software 在 C# 中开发的适用于macOS (未来的 GNULinux)的FUSE包装器。 它提供了一个干净的 API,专门设计用于在 .NET 应用程序中开发用户空间文件系统。 FuseSharp 仅使用 .NET Standard 2.0 功能,因此它与其他 .NET 平台(例如 Core、Mono 和 Xamarin.Mac)具有高度互操作性。\n\n目标\n使用场景\n设置和使用\n项目概况\n性能测试\n执照\n目标\n该项目的目标是提供一个 API,使 C# 应用程序能够轻松地在用户空间中实现文件系统。此 API 是用 C# 编写的,完全依赖于.NET Standard 2.0 功能,因此它与以下 .NET 平台兼容:\n平台 最低版本\n.NET核心 2.0\n.NET框架 4.6.1\n单核细胞增多症 5.4\nXamarin.Mac 3.8\n使用场景\n如果您偶然发现这个存储库,您可能想知道“为什么我想要需要在用户空间中构建文件系统?” 答案是:文
资源推荐
资源详情
资源评论
收起资源包目录
适用于macOS(以及未来的GNULinux)的.NETStandard中的FUSE包装器.zip (32个子文件)
FuseSharp-master
src
Adaptor
definitions.c 7KB
buildandcopy 570B
definitions.h 5KB
adaptor.c 11KB
adaptor.h 579B
FuseSharp
FuseSharp.sln 2KB
FuseSharp
Arguments.cs 1KB
FileSystemHandler.cs 29KB
DirectoryEntry.cs 598B
FuseSharp.csproj 617B
Process.cs 1KB
FileSystem.cs 6KB
ConnectionInfo.cs 1KB
PathInfo.cs 2KB
Operations.cs 10KB
FileNameMarshaler.cs 1KB
Interop.cs 4KB
Context.cs 724B
example
MirrorFileSystem.cs 12KB
EncryptedFileSystem.cs 12KB
FuseSharp.Example.csproj 639B
Program.cs 3KB
LICENSE 1KB
img
architecture.png 23KB
read-test-graph2.png 9KB
write-test-graph2.png 9KB
read-test-graph1.png 22KB
write-test-graph1.png 23KB
diagrams.vsdx 30KB
demo.gif 184KB
.gitignore 11KB
README.md 16KB
共 32 条
- 1
资源评论
m0_57781768
- 粉丝: 9041
- 资源: 403
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功