Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
url = https://github.com/securefolderfs-community/nwebdav.git
[submodule "lib/Tmds.Fuse"]
path = lib/Tmds.Fuse
url = https://github.com/securefolderfs-community/Tmds.Fuse
url = https://github.com/securefolderfs-community/Tmds.Fuse
[submodule "lib/FuseSharp"]
path = lib/FuseSharp
url = git@github.com:securefolderfs-community/FuseSharp.git
2 changes: 2 additions & 0 deletions SecureFolderFS.Public.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<Project Path="lib/nwebdav/src/NWebDav.Server.HttpListener/NWebDav.Server.HttpListener.csproj" />
<Project Path="lib/nwebdav/src/NWebDav.Server/NWebDav.Server.csproj" />
<Project Path="lib/Tmds.Fuse/src/Tmds.Fuse/Tmds.Fuse.csproj" />
<Project Path="lib/FuseSharp/src/FuseSharp/FuseSharp/FuseSharp.csproj" />
</Folder>
<Folder Name="/SolutionItems/">
<File Path="../SecureFolderFS.Uno/Directory.Build.props" />
Expand All @@ -19,6 +20,7 @@
<Project Path="src/Core/SecureFolderFS.Core.Dokany/SecureFolderFS.Core.Dokany.csproj" />
<Project Path="src/Core/SecureFolderFS.Core.FileSystem/SecureFolderFS.Core.FileSystem.csproj" />
<Project Path="src/Core/SecureFolderFS.Core.FUSE/SecureFolderFS.Core.FUSE.csproj" />
<Project Path="src/Core/SecureFolderFS.Core.MacFuse/SecureFolderFS.Core.MacFuse.csproj" />
<Project Path="src/Core/SecureFolderFS.Core.MobileFS/SecureFolderFS.Core.MobileFS.csproj" />
<Project Path="src/Core/SecureFolderFS.Core.WebDav/SecureFolderFS.Core.WebDav.csproj" />
<Project Path="src/Core/SecureFolderFS.Core.WinFsp/SecureFolderFS.Core.WinFsp.csproj" />
Expand Down
10 changes: 10 additions & 0 deletions SecureFolderFS.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
<Platform Solution="Release|x64" Project="x64" />
<Platform Solution="Release|x86" Project="x86" />
</Project>
<Project Path="lib/FuseSharp/src/FuseSharp/FuseSharp/FuseSharp.csproj">
<Platform Solution="Release|arm64" Project="ARM64" />
<Platform Solution="Release|x64" Project="x64" />
<Platform Solution="Release|x86" Project="x86" />
</Project>
</Folder>
<Folder Name="/SolutionItems/">
<File Path="../SecureFolderFS.Uno/Directory.Build.props" />
Expand Down Expand Up @@ -57,6 +62,11 @@
<Platform Solution="Release|x64" Project="x64" />
<Platform Solution="Release|x86" Project="x86" />
</Project>
<Project Path="src/Core/SecureFolderFS.Core.MacFuse/SecureFolderFS.Core.MacFuse.csproj">
<Platform Solution="Release|arm64" Project="ARM64" />
<Platform Solution="Release|x64" Project="x64" />
<Platform Solution="Release|x86" Project="x86" />
</Project>
<Project Path="src/Core/SecureFolderFS.Core.MobileFS/SecureFolderFS.Core.MobileFS.csproj" />
<Project Path="src/Core/SecureFolderFS.Core.WebDav/SecureFolderFS.Core.WebDav.csproj">
<Platform Solution="Release|arm64" Project="ARM64" />
Expand Down
1 change: 1 addition & 0 deletions lib/FuseSharp
Submodule FuseSharp added at fc1f76
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
Expand Down
73 changes: 73 additions & 0 deletions src/Core/SecureFolderFS.Core.MacFuse/AppModels/MacFuseOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
using SecureFolderFS.Core.FileSystem.AppModels;
using SecureFolderFS.Shared.Extensions;
using SecureFolderFS.Storage.VirtualFileSystem;

namespace SecureFolderFS.Core.MacFuse.AppModels
{
/// <inheritdoc cref="VirtualFileSystemOptions"/>
public sealed class MacFuseOptions : VirtualFileSystemOptions
{
/// <summary>
/// Gets the path where the file system should be mounted. If a null value is given, default mount point will be used.
/// </summary>
public string? MountPoint { get; init; }

/// <summary>
/// Gets whether the root user should have access to the filesystem.
/// </summary>
/// <remarks>
/// <para>
/// Requires the <i>allow_other</i> macFUSE tunable to be enabled (sysctl vfs.generic.macfuse.tunables.allow_other=1).
/// </para>
/// <para>
/// This option is mutually exclusive with <see cref="AllowOtherUserAccess"/>.
/// </para>
/// </remarks>
public bool AllowRootUserAccess { get; init; }

/// <summary>
/// Gets whether other users, including root, should have access to the filesystem.
/// </summary>
/// <remarks>
/// <para>
/// Requires the <i>allow_other</i> macFUSE tunable to be enabled (sysctl vfs.generic.macfuse.tunables.allow_other=1).
/// </para>
/// <para>
/// This option is mutually exclusive with <see cref="AllowRootUserAccess"/>.
/// </para>
/// </remarks>
public bool AllowOtherUserAccess { get; init; }

/// <summary>
/// Gets whether to print debugging information to the console.
/// </summary>
public bool PrintDebugInformation { get; init; }

/// <inheritdoc/>
public override string? GetDescription()
{
return MountPoint;
}

public static MacFuseOptions ToOptions(IDictionary<string, object> options)
{
return new()
{
VolumeName = (string?)options.Get(nameof(VolumeName)) ?? throw new ArgumentNullException(nameof(VolumeName)),
HealthStatistics = (IHealthStatistics?)options.Get(nameof(HealthStatistics)) ?? new HealthStatistics(),
FileSystemStatistics = (IFileSystemStatistics?)options.Get(nameof(FileSystemStatistics)) ?? new FileSystemStatistics(),
IsReadOnly = (bool?)options.Get(nameof(IsReadOnly)) ?? false,
IsCachingChunks = (bool?)options.Get(nameof(IsCachingChunks)) ?? true,
IsCachingFileNames = (bool?)options.Get(nameof(IsCachingFileNames)) ?? false,
IsCachingDirectoryIds = (bool?)options.Get(nameof(IsCachingDirectoryIds)) ?? true,
RecycleBinSize = (long?)options.Get(nameof(RecycleBinSize)) ?? 0L,

// macFUSE specific
MountPoint = (string?)options.Get(nameof(MountPoint)),
AllowRootUserAccess = (bool?)options.Get(nameof(AllowRootUserAccess)) ?? false,
AllowOtherUserAccess = (bool?)options.Get(nameof(AllowOtherUserAccess)) ?? false,
PrintDebugInformation = (bool?)options.Get(nameof(PrintDebugInformation)) ?? false
};
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using FuseSharp;
using SecureFolderFS.Core.FileSystem;
using SecureFolderFS.Core.MacFuse.AppModels;
using SecureFolderFS.Core.MacFuse.OpenHandles;

namespace SecureFolderFS.Core.MacFuse.Callbacks
{
internal abstract class BaseMacFuseCallbacks : FuseFileSystemBase
{
protected FileSystemSpecifics specifics;
protected readonly MacFuseHandlesManager handlesManager;

protected BaseMacFuseCallbacks(FileSystemSpecifics specifics, MacFuseHandlesManager handlesManager)
{
this.specifics = specifics;
this.handlesManager = handlesManager;
}

/// <remarks>
/// Null before the filesystem has been mounted.
/// </remarks>
public MacFuseOptions? FuseOptions { get; set; }

protected abstract string? GetCiphertextPath(ReadOnlySpan<byte> plaintextName);
}
}
Loading
Loading