Compare commits
13 Commits
v1.0.0-pre
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04d0c03641 | ||
|
|
69e39dc188 | ||
|
|
91c4e1784d | ||
|
|
c3094cf652 | ||
|
|
1e156ff368 | ||
|
|
ca6a607d01 | ||
|
|
990463cdd2 | ||
|
|
176db5c7d1 | ||
|
|
19334034e0 | ||
|
|
3f94ad6838 | ||
|
|
2322591f88 | ||
|
|
b4a2ffc149 | ||
|
|
1f24141807 |
@@ -1,3 +1,6 @@
|
|||||||
|
2018-01-05 Alexey Kolpakov <mail@alhimik.me>
|
||||||
|
Port to .Net Standard 2
|
||||||
|
|
||||||
2016-06-08 Justin Needham <jneedhamspkt@gmail.com>
|
2016-06-08 Justin Needham <jneedhamspkt@gmail.com>
|
||||||
Migrate from gmcs to mcs for Mono 4.*
|
Migrate from gmcs to mcs for Mono 4.*
|
||||||
* configure.ac: gmcs --> mcs
|
* configure.ac: gmcs --> mcs
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0-beta3" />
|
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Mono.Fuse.NETStandard\Mono.Fuse.NETStandard.csproj" />
|
<ProjectReference Include="..\Mono.Fuse.NETStandard\Mono.Fuse.NETStandard.csproj" />
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RedirectFS", "example\Redir
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RedirectFS-FH", "example\RedirectFS-FH\RedirectFS-FH.csproj", "{1D5F7569-C773-422B-B783-3F1775816D45}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RedirectFS-FH", "example\RedirectFS-FH\RedirectFS-FH.csproj", "{1D5F7569-C773-422B-B783-3F1775816D45}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{85A3668F-D9E7-4794-8723-4F3767008CB9}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "example", "example", "{85A3668F-D9E7-4794-8723-4F3767008CB9}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
|||||||
@@ -1316,7 +1316,7 @@ namespace Mono.Fuse.NETStandard {
|
|||||||
}
|
}
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
bytesWritten = bytesNeeded;
|
bytesWritten = bytesNeeded;
|
||||||
if (size < (ulong) bytesNeeded) {
|
else if (size < (ulong) bytesNeeded) {
|
||||||
errno = Errno.ERANGE;
|
errno = Errno.ERANGE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
<AssemblyTitle>Mono.Fuse.NETStandard.dll</AssemblyTitle>
|
||||||
|
<AssemblyName>Mono.Fuse.NETStandard</AssemblyName>
|
||||||
<PackageId>Mono.Fuse.NETStandard</PackageId>
|
<PackageId>Mono.Fuse.NETStandard</PackageId>
|
||||||
<PackageVersion>1.0.0-pre1</PackageVersion>
|
<PackageVersion>1.1.0</PackageVersion>
|
||||||
|
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||||
|
<PackageProjectUrl>https://github.com/alhimik45/Mono.Fuse.NETStandard</PackageProjectUrl>
|
||||||
|
<RepositoryUrl>https://github.com/alhimik45/Mono.Fuse.NETStandard</RepositoryUrl>
|
||||||
|
<RepositoryType>git</RepositoryType>
|
||||||
<Authors>Jonathan Pryor, Alexey Kolpakov</Authors>
|
<Authors>Jonathan Pryor, Alexey Kolpakov</Authors>
|
||||||
<Description>Port of Mono.Fuse package to NET Standart: C# bindings for FUSE</Description>
|
<Description>Port of Mono.Fuse package to NET Standart: C# bindings for FUSE</Description>
|
||||||
<PackageTags>mono fuse filesystem linux unix</PackageTags>
|
<PackageTags>mono fuse filesystem linux unix</PackageTags>
|
||||||
@@ -15,6 +21,6 @@
|
|||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0-beta3" />
|
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
88
README
88
README
@@ -1,88 +0,0 @@
|
|||||||
This is a Mono/.NET binding for FUSE.
|
|
||||||
|
|
||||||
Short HOWTO:
|
|
||||||
|
|
||||||
Within one terminal:
|
|
||||||
sudo /sbin/modprobe fuse # need FUSE kernel module to use.
|
|
||||||
./configure
|
|
||||||
make
|
|
||||||
cd example/HelloFS
|
|
||||||
mkdir t
|
|
||||||
./hellofs t
|
|
||||||
|
|
||||||
Within another terminal
|
|
||||||
cd example/HelloFS
|
|
||||||
ls t
|
|
||||||
cat t/hello
|
|
||||||
|
|
||||||
This should display files controlled by HelloFS.exe.
|
|
||||||
|
|
||||||
To unmount the filesystem, you need to use the `fusermount' program:
|
|
||||||
cd example/HelloFS
|
|
||||||
fusermount -u t
|
|
||||||
|
|
||||||
KILLING THE FUSE PROGRAM IS NOT ENOUGH. The program will die, but
|
|
||||||
FUSE and the kernel will still think that the directory is mounted.
|
|
||||||
Result: you can't remount the directory, and trying to do anything
|
|
||||||
with it will result in IO errors.
|
|
||||||
|
|
||||||
For full trace output, set the MONO_TRACE_LISTENER environment
|
|
||||||
variable and add the -odebug command-line argument:
|
|
||||||
|
|
||||||
cd example/HelloFS
|
|
||||||
MONO_TRACE_LISTENER=Console.Out### ./hellofs -odebug t
|
|
||||||
|
|
||||||
MONO_TRACE_LISTENER controls the Mono.Fuse trace output, while
|
|
||||||
-odebug controls the libfuse-generated trace output.
|
|
||||||
|
|
||||||
`hellofs' also takes its own command-line aruments. By default,
|
|
||||||
it exports two files, `data' and `hello'. `hello' contains the
|
|
||||||
string "Hello World!", while `data' is a 100 MB (base 10) file that
|
|
||||||
generates its content on-demand.
|
|
||||||
|
|
||||||
If you pass the --data.im-in-memory flag, a `data.im' file will be
|
|
||||||
available which is a 100MB (base 10) file with the same contents as
|
|
||||||
`data', but it is backed by a 100MB byte[] instead of generating its
|
|
||||||
contents on demand:
|
|
||||||
|
|
||||||
cd example/HelloFS
|
|
||||||
./hellofs --data.im-in-memory t
|
|
||||||
|
|
||||||
The 100MB byte[] is allocated the first time the contents of
|
|
||||||
`data.im' are read.
|
|
||||||
|
|
||||||
`data.im' is useful to see the difference in performance between
|
|
||||||
generate-on-demand and cached behaviors:
|
|
||||||
|
|
||||||
cd example/HelloFS
|
|
||||||
./hellofs --data.im-in-memory t
|
|
||||||
|
|
||||||
# On-demand copy
|
|
||||||
time cp t/data f.txt
|
|
||||||
real 0m8.469s
|
|
||||||
user 0m0.020s
|
|
||||||
sys 0m1.128s
|
|
||||||
|
|
||||||
# In-memory copy
|
|
||||||
# Note that the first `data.im' access is longer
|
|
||||||
# because it needed to allocate the array.
|
|
||||||
# Subsequent calls are shorter:
|
|
||||||
time \cp -f t/data.im f.txt
|
|
||||||
real 0m12.393s
|
|
||||||
user 0m0.004s
|
|
||||||
sys 0m1.172s
|
|
||||||
time \cp -f t/data.im f.txt
|
|
||||||
real 0m5.233s
|
|
||||||
user 0m0.016s
|
|
||||||
sys 0m1.136s
|
|
||||||
|
|
||||||
# And for comparison, cp without FUSE:
|
|
||||||
time cp f.txt f2.txt
|
|
||||||
real 0m10.252s
|
|
||||||
user 0m0.016s
|
|
||||||
sys 0m1.000s
|
|
||||||
|
|
||||||
And yes, on my machine it's faster to go through FUSE than to go
|
|
||||||
through the filesystem (though usually the filesystem outperforms
|
|
||||||
the on-demand generation). My machine is probably misconfigured. :-/
|
|
||||||
Your mileage will vary.
|
|
||||||
7
README.md
Normal file
7
README.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[](https://www.nuget.org/packages/Mono.Fuse.NETStandard/)
|
||||||
|
|
||||||
|
This is a .NET Standard binding for FUSE, port of [mono-fuse](https://github.com/jonpryor/mono-fuse) library.
|
||||||
|
|
||||||
|
For documentation see [here](http://www.jprl.com/Projects/mono-fuse/docs/).
|
||||||
|
|
||||||
|
To run examples clone this repository, run `build-libs.sh` and then run projects from `example/` folder.
|
||||||
@@ -22,7 +22,7 @@ build_managed () {
|
|||||||
|
|
||||||
build_native () {
|
build_native () {
|
||||||
dotnet run -p CreateNativeMap/CreateNativeMap.csproj -c "$CONFIGURATION" --library=MonoFuseHelper "Mono.Fuse.NETStandard/bin/$CONFIGURATION/netstandard2.0/Mono.Fuse.NETStandard.dll" buildlibs/map
|
dotnet run -p CreateNativeMap/CreateNativeMap.csproj -c "$CONFIGURATION" --library=MonoFuseHelper "Mono.Fuse.NETStandard/bin/$CONFIGURATION/netstandard2.0/Mono.Fuse.NETStandard.dll" buildlibs/map
|
||||||
INCLUDES="-I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/fuse -Ibuildlibs/"
|
INCLUDES="-I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/fuse -I/usr/lib/glib-2.0/include -Ibuildlibs/"
|
||||||
libtool --mode=compile gcc -D_FILE_OFFSET_BITS=64 $INCLUDES -g -O2 -MT buildlibs/mfh.lo -MD -MP -c -o buildlibs/mfh.lo MonoFuseHelper/mfh.c
|
libtool --mode=compile gcc -D_FILE_OFFSET_BITS=64 $INCLUDES -g -O2 -MT buildlibs/mfh.lo -MD -MP -c -o buildlibs/mfh.lo MonoFuseHelper/mfh.c
|
||||||
libtool --mode=compile gcc -D_FILE_OFFSET_BITS=64 $INCLUDES -g -O2 -MT buildlibs/map.lo -MD -MP -c -o buildlibs/map.lo buildlibs/map.c
|
libtool --mode=compile gcc -D_FILE_OFFSET_BITS=64 $INCLUDES -g -O2 -MT buildlibs/map.lo -MD -MP -c -o buildlibs/map.lo buildlibs/map.c
|
||||||
libtool --mode=link gcc -g -O2 -no-undefined -avoid-version -o buildlibs/libMonoFuseHelper.la -rpath /usr/local/lib buildlibs/mfh.lo buildlibs/map.lo -lglib-2.0 -lfuse -pthread
|
libtool --mode=link gcc -g -O2 -no-undefined -avoid-version -o buildlibs/libMonoFuseHelper.la -rpath /usr/local/lib buildlibs/mfh.lo buildlibs/map.lo -lglib-2.0 -lfuse -pthread
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ namespace Mono.Fuse.NETStandard.Samples {
|
|||||||
|
|
||||||
public HelloFs ()
|
public HelloFs ()
|
||||||
{
|
{
|
||||||
Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
|
|
||||||
Trace.WriteLine ("(HelloFS creating)");
|
Trace.WriteLine ("(HelloFS creating)");
|
||||||
hello_attrs ["foo"] = Encoding.UTF8.GetBytes ("bar");
|
hello_attrs ["foo"] = Encoding.UTF8.GetBytes ("bar");
|
||||||
}
|
}
|
||||||
@@ -167,10 +166,15 @@ namespace Mono.Fuse.NETStandard.Samples {
|
|||||||
return 0;
|
return 0;
|
||||||
_value = hello_attrs [name];
|
_value = hello_attrs [name];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (value != null)
|
||||||
|
{
|
||||||
if (value.Length < _value.Length) {
|
if (value.Length < _value.Length) {
|
||||||
return Errno.ERANGE;
|
return Errno.ERANGE;
|
||||||
}
|
}
|
||||||
Array.Copy (_value, value, _value.Length);
|
|
||||||
|
Array.Copy(_value, value, _value.Length);
|
||||||
|
}
|
||||||
bytesWritten = _value.Length;
|
bytesWritten = _value.Length;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,15 @@
|
|||||||
<RootNamespace>Mono.Fuse.NETStandard.Samples</RootNamespace>
|
<RootNamespace>Mono.Fuse.NETStandard.Samples</RootNamespace>
|
||||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\..\nativelibs\linux-x64\libMonoFuseHelper.so">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\Mono.Fuse.NETStandard\Mono.Fuse.NETStandard.csproj" />
|
<ProjectReference Include="..\..\Mono.Fuse.NETStandard\Mono.Fuse.NETStandard.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0-beta3" />
|
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -337,7 +337,7 @@ namespace Mono.Fuse.NETStandard.Samples {
|
|||||||
|
|
||||||
protected override Errno OnGetPathExtendedAttribute (string path, string name, byte[] value, out int bytesWritten)
|
protected override Errno OnGetPathExtendedAttribute (string path, string name, byte[] value, out int bytesWritten)
|
||||||
{
|
{
|
||||||
int r = bytesWritten = (int) Syscall.lgetxattr (basedir+path, name, value, (ulong) value.Length);
|
int r = bytesWritten = (int) Syscall.lgetxattr (basedir+path, name, value, (ulong) (value?.Length ?? 0));
|
||||||
if (r == -1)
|
if (r == -1)
|
||||||
return Stdlib.GetLastError ();
|
return Stdlib.GetLastError ();
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -10,10 +10,15 @@
|
|||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\..\nativelibs\linux-x64\libMonoFuseHelper.so">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\Mono.Fuse.NETStandard\Mono.Fuse.NETStandard.csproj" />
|
<ProjectReference Include="..\..\Mono.Fuse.NETStandard\Mono.Fuse.NETStandard.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0-beta3" />
|
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -284,7 +284,7 @@ namespace Mono.Fuse.NETStandard.Samples {
|
|||||||
|
|
||||||
protected override Errno OnGetPathExtendedAttribute (string path, string name, byte[] value, out int bytesWritten)
|
protected override Errno OnGetPathExtendedAttribute (string path, string name, byte[] value, out int bytesWritten)
|
||||||
{
|
{
|
||||||
int r = bytesWritten = (int) Syscall.lgetxattr (basedir+path, name, value, (ulong) value.Length);
|
int r = bytesWritten = (int) Syscall.lgetxattr (basedir+path, name, value, (ulong) (value?.Length ?? 0));
|
||||||
if (r == -1)
|
if (r == -1)
|
||||||
return Stdlib.GetLastError ();
|
return Stdlib.GetLastError ();
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -10,10 +10,15 @@
|
|||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\..\nativelibs\linux-x64\libMonoFuseHelper.so">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\Mono.Fuse.NETStandard\Mono.Fuse.NETStandard.csproj" />
|
<ProjectReference Include="..\..\Mono.Fuse.NETStandard\Mono.Fuse.NETStandard.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0-beta3" />
|
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
Reference in New Issue
Block a user