Ensure Host shim is updated for 13.1.0

This commit is contained in:
Alex Barney 2022-01-16 01:04:24 -07:00
parent f315cee9af
commit 330bc2b483
3 changed files with 23 additions and 16 deletions

View file

@ -159,9 +159,9 @@ public static class WindowsPath
return DosDevicePathPrefixLength; return DosDevicePathPrefixLength;
} }
public static bool IsWindowsPath(ReadOnlySpan<byte> path, bool checkForwardSlash) public static bool IsWindowsPath(ReadOnlySpan<byte> path, bool allowForwardSlashForUnc)
{ {
return IsWindowsDrive(path) || IsDosDevicePath(path) || IsUncPath(path, checkForwardSlash, true); return IsWindowsDrive(path) || IsDosDevicePath(path) || IsUncPath(path, allowForwardSlashForUnc, true);
} }
public static int GetWindowsSkipLength(ReadOnlySpan<byte> path) public static int GetWindowsSkipLength(ReadOnlySpan<byte> path)

View file

@ -7,25 +7,32 @@ public static class CommonMountNames
public const char ReservedMountNamePrefixCharacter = '@'; public const char ReservedMountNamePrefixCharacter = '@';
// Filesystem names. // Filesystem names.
/// <summary>"<c>@Host</c>"</summary>
public static ReadOnlySpan<byte> HostRootFileSystemMountName => // "@Host" public static ReadOnlySpan<byte> HostRootFileSystemMountName => // "@Host"
new[] { (byte)'@', (byte)'H', (byte)'o', (byte)'s', (byte)'t' }; new[] { (byte)'@', (byte)'H', (byte)'o', (byte)'s', (byte)'t' };
/// <summary>"<c>@Sdcard</c>"</summary>
public static ReadOnlySpan<byte> SdCardFileSystemMountName => // "@Sdcard" public static ReadOnlySpan<byte> SdCardFileSystemMountName => // "@Sdcard"
new[] { (byte)'@', (byte)'S', (byte)'d', (byte)'c', (byte)'a', (byte)'r', (byte)'d' }; new[] { (byte)'@', (byte)'S', (byte)'d', (byte)'c', (byte)'a', (byte)'r', (byte)'d' };
/// <summary>"<c>@Gc</c>"</summary>
public static ReadOnlySpan<byte> GameCardFileSystemMountName => // "@Gc" public static ReadOnlySpan<byte> GameCardFileSystemMountName => // "@Gc"
new[] { (byte)'@', (byte)'G', (byte)'c' }; new[] { (byte)'@', (byte)'G', (byte)'c' };
/// <summary>"<c>U</c>"</summary>
public static ReadOnlySpan<byte> GameCardFileSystemMountNameUpdateSuffix => // "U" public static ReadOnlySpan<byte> GameCardFileSystemMountNameUpdateSuffix => // "U"
new[] { (byte)'U' }; new[] { (byte)'U' };
/// <summary>"<c>N</c>"</summary>
public static ReadOnlySpan<byte> GameCardFileSystemMountNameNormalSuffix => // "N" public static ReadOnlySpan<byte> GameCardFileSystemMountNameNormalSuffix => // "N"
new[] { (byte)'N' }; new[] { (byte)'N' };
/// <summary>"<c>S</c>"</summary>
public static ReadOnlySpan<byte> GameCardFileSystemMountNameSecureSuffix => // "S" public static ReadOnlySpan<byte> GameCardFileSystemMountNameSecureSuffix => // "S"
new[] { (byte)'S' }; new[] { (byte)'S' };
// Built-in storage names. // Built-in storage names.
/// <summary>"<c>@CalibFile</c>"</summary>
public static ReadOnlySpan<byte> BisCalibrationFilePartitionMountName => // "@CalibFile" public static ReadOnlySpan<byte> BisCalibrationFilePartitionMountName => // "@CalibFile"
new[] new[]
{ {
@ -33,16 +40,20 @@ public static class CommonMountNames
(byte)'l', (byte)'e' (byte)'l', (byte)'e'
}; };
/// <summary>"<c>@Safe</c>"</summary>
public static ReadOnlySpan<byte> BisSafeModePartitionMountName => // "@Safe" public static ReadOnlySpan<byte> BisSafeModePartitionMountName => // "@Safe"
new[] { (byte)'@', (byte)'S', (byte)'a', (byte)'f', (byte)'e' }; new[] { (byte)'@', (byte)'S', (byte)'a', (byte)'f', (byte)'e' };
/// <summary>"<c>@User</c>"</summary>
public static ReadOnlySpan<byte> BisUserPartitionMountName => // "@User" public static ReadOnlySpan<byte> BisUserPartitionMountName => // "@User"
new[] { (byte)'@', (byte)'U', (byte)'s', (byte)'e', (byte)'r' }; new[] { (byte)'@', (byte)'U', (byte)'s', (byte)'e', (byte)'r' };
/// <summary>"<c>@System</c>"</summary>
public static ReadOnlySpan<byte> BisSystemPartitionMountName => // "@System" public static ReadOnlySpan<byte> BisSystemPartitionMountName => // "@System"
new[] { (byte)'@', (byte)'S', (byte)'y', (byte)'s', (byte)'t', (byte)'e', (byte)'m' }; new[] { (byte)'@', (byte)'S', (byte)'y', (byte)'s', (byte)'t', (byte)'e', (byte)'m' };
//Content storage names. //Content storage names.
/// <summary>"<c>@SystemContent</c>"</summary>
public static ReadOnlySpan<byte> ContentStorageSystemMountName => // "@SystemContent" public static ReadOnlySpan<byte> ContentStorageSystemMountName => // "@SystemContent"
new[] new[]
{ {
@ -50,6 +61,7 @@ public static class CommonMountNames
(byte)'o', (byte)'n', (byte)'t', (byte)'e', (byte)'n', (byte)'t' (byte)'o', (byte)'n', (byte)'t', (byte)'e', (byte)'n', (byte)'t'
}; };
/// <summary>"<c>@UserContent</c>"</summary>
public static ReadOnlySpan<byte> ContentStorageUserMountName => // "@UserContent" public static ReadOnlySpan<byte> ContentStorageUserMountName => // "@UserContent"
new[] new[]
{ {
@ -57,6 +69,7 @@ public static class CommonMountNames
(byte)'t', (byte)'e', (byte)'n', (byte)'t' (byte)'t', (byte)'e', (byte)'n', (byte)'t'
}; };
/// <summary>"<c>@SdCardContent</c>"</summary>
public static ReadOnlySpan<byte> ContentStorageSdCardMountName => // "@SdCardContent" public static ReadOnlySpan<byte> ContentStorageSdCardMountName => // "@SdCardContent"
new[] new[]
{ {
@ -65,6 +78,7 @@ public static class CommonMountNames
}; };
// Registered update partition // Registered update partition
/// <summary>"<c>@RegUpdate</c>"</summary>
public static ReadOnlySpan<byte> RegisteredUpdatePartitionMountName => // "@RegUpdate" public static ReadOnlySpan<byte> RegisteredUpdatePartitionMountName => // "@RegUpdate"
new[] new[]
{ {
@ -72,6 +86,7 @@ public static class CommonMountNames
(byte)'t', (byte)'e' (byte)'t', (byte)'e'
}; };
/// <summary>"<c>@Nintendo</c>"</summary>
public static ReadOnlySpan<byte> SdCardNintendoRootDirectoryName => // "Nintendo" public static ReadOnlySpan<byte> SdCardNintendoRootDirectoryName => // "Nintendo"
new[] new[]
{ {

View file

@ -19,11 +19,12 @@ namespace LibHac.Fs.Shim;
/// <summary> /// <summary>
/// Contains functions for mounting file systems from a host computer. /// Contains functions for mounting file systems from a host computer.
/// </summary> /// </summary>
/// <remarks>Based on nnSdk 11.4.0</remarks> /// <remarks>Based on nnSdk 13.4.0</remarks>
[SkipLocalsInit] [SkipLocalsInit]
public static class Host public static class Host
{ {
private static ReadOnlySpan<byte> HostRootFileSystemPath => // "@Host:/" /// <summary>"<c>@Host:/</c>"</summary>
private static ReadOnlySpan<byte> HostRootFileSystemPath =>
new[] { (byte)'@', (byte)'H', (byte)'o', (byte)'s', (byte)'t', (byte)':', (byte)'/' }; new[] { (byte)'@', (byte)'H', (byte)'o', (byte)'s', (byte)'t', (byte)':', (byte)'/' };
private const int HostRootFileSystemPathLength = 7; private const int HostRootFileSystemPathLength = 7;
@ -122,12 +123,6 @@ public static class Host
private static Result OpenHostFileSystem(FileSystemClient fs, ref UniqueRef<IFileSystem> outFileSystem, private static Result OpenHostFileSystem(FileSystemClient fs, ref UniqueRef<IFileSystem> outFileSystem,
U8Span mountName, U8Span path, MountHostOption option) U8Span mountName, U8Span path, MountHostOption option)
{ {
if (mountName.IsNull())
return ResultFs.NullptrArgument.Log();
if (path.IsNull())
return ResultFs.NullptrArgument.Log();
if (WindowsPath.IsWindowsDrive(mountName)) if (WindowsPath.IsWindowsDrive(mountName))
return ResultFs.InvalidMountName.Log(); return ResultFs.InvalidMountName.Log();
@ -167,9 +162,6 @@ public static class Host
Result rc = fs.Impl.CheckMountName(mountName); Result rc = fs.Impl.CheckMountName(mountName);
if (rc.IsFailure()) return rc; if (rc.IsFailure()) return rc;
if (path.IsNull())
return ResultFs.NullptrArgument.Log();
outMountNameGenerator.Reset(new HostCommonMountNameGenerator(path)); outMountNameGenerator.Reset(new HostCommonMountNameGenerator(path));
if (!outMountNameGenerator.HasValue) if (!outMountNameGenerator.HasValue)