mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2025-02-09 13:14:46 +01:00
Use ref readonly
This commit is contained in:
parent
03bf56f26c
commit
32dff54cce
@ -6,7 +6,7 @@ public struct DeliveryCacheDirectoryEntry
|
|||||||
public long Size;
|
public long Size;
|
||||||
public Digest Digest;
|
public Digest Digest;
|
||||||
|
|
||||||
public DeliveryCacheDirectoryEntry(in FileName name, long size, in Digest digest)
|
public DeliveryCacheDirectoryEntry(ref readonly FileName name, long size, ref readonly Digest digest)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
Size = size;
|
Size = size;
|
||||||
|
@ -4,7 +4,7 @@ namespace LibHac.Bcat.Impl.Ipc;
|
|||||||
|
|
||||||
public interface IDeliveryCacheDirectoryService : IDisposable
|
public interface IDeliveryCacheDirectoryService : IDisposable
|
||||||
{
|
{
|
||||||
Result Open(ref DirectoryName name);
|
Result Open(ref readonly DirectoryName name);
|
||||||
Result Read(out int entriesRead, Span<DeliveryCacheDirectoryEntry> entryBuffer);
|
Result Read(out int entriesRead, Span<DeliveryCacheDirectoryEntry> entryBuffer);
|
||||||
Result GetCount(out int count);
|
Result GetCount(out int count);
|
||||||
}
|
}
|
@ -4,7 +4,7 @@ namespace LibHac.Bcat.Impl.Ipc;
|
|||||||
|
|
||||||
public interface IDeliveryCacheFileService : IDisposable
|
public interface IDeliveryCacheFileService : IDisposable
|
||||||
{
|
{
|
||||||
Result Open(ref DirectoryName directoryName, ref FileName fileName);
|
Result Open(ref readonly DirectoryName directoryName, ref readonly FileName fileName);
|
||||||
Result Read(out long bytesRead, long offset, Span<byte> destination);
|
Result Read(out long bytesRead, long offset, Span<byte> destination);
|
||||||
Result GetSize(out long size);
|
Result GetSize(out long size);
|
||||||
Result GetDigest(out Digest digest);
|
Result GetDigest(out Digest digest);
|
||||||
|
@ -23,11 +23,11 @@ internal class DeliveryCacheFileMetaAccessor
|
|||||||
Server = server;
|
Server = server;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result ReadApplicationFileMeta(ulong applicationId, ref DirectoryName directoryName,
|
public Result ReadApplicationFileMeta(ulong applicationId, ref readonly DirectoryName directoryName,
|
||||||
bool allowMissingMetaFile)
|
bool allowMissingMetaFile)
|
||||||
{
|
{
|
||||||
Span<byte> metaPath = stackalloc byte[0x50];
|
Span<byte> metaPath = stackalloc byte[0x50];
|
||||||
Server.GetStorageManager().GetFilesMetaPath(metaPath, applicationId, ref directoryName);
|
Server.GetStorageManager().GetFilesMetaPath(metaPath, applicationId, in directoryName);
|
||||||
|
|
||||||
return Read(new U8Span(metaPath), allowMissingMetaFile);
|
return Read(new U8Span(metaPath), allowMissingMetaFile);
|
||||||
}
|
}
|
||||||
@ -48,7 +48,7 @@ internal class DeliveryCacheFileMetaAccessor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result FindEntry(out DeliveryCacheFileMetaEntry entry, ref FileName fileName)
|
public Result FindEntry(out DeliveryCacheFileMetaEntry entry, ref readonly FileName fileName)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out entry);
|
UnsafeHelpers.SkipParamInit(out entry);
|
||||||
|
|
||||||
|
@ -212,8 +212,8 @@ internal class DeliveryCacheStorageManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GetFilePath(Span<byte> pathBuffer, ulong applicationId, ref DirectoryName directoryName,
|
public void GetFilePath(Span<byte> pathBuffer, ulong applicationId, ref readonly DirectoryName directoryName,
|
||||||
ref FileName fileName)
|
ref readonly FileName fileName)
|
||||||
{
|
{
|
||||||
// returns "mount:/directories/%s/files/%s", directoryName, fileName
|
// returns "mount:/directories/%s/files/%s", directoryName, fileName
|
||||||
lock (_locker)
|
lock (_locker)
|
||||||
@ -228,7 +228,7 @@ internal class DeliveryCacheStorageManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GetFilesMetaPath(Span<byte> pathBuffer, ulong applicationId, ref DirectoryName directoryName)
|
public void GetFilesMetaPath(Span<byte> pathBuffer, ulong applicationId, ref readonly DirectoryName directoryName)
|
||||||
{
|
{
|
||||||
// returns "mount:/directories/%s/files.meta", directoryName
|
// returns "mount:/directories/%s/files.meta", directoryName
|
||||||
lock (_locker)
|
lock (_locker)
|
||||||
@ -253,7 +253,7 @@ internal class DeliveryCacheStorageManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GetDirectoryPath(Span<byte> pathBuffer, ulong applicationId, ref DirectoryName directoryName)
|
public void GetDirectoryPath(Span<byte> pathBuffer, ulong applicationId, ref readonly DirectoryName directoryName)
|
||||||
{
|
{
|
||||||
// returns "mount:/directories/%s", directoryName
|
// returns "mount:/directories/%s", directoryName
|
||||||
lock (_locker)
|
lock (_locker)
|
||||||
|
@ -27,7 +27,7 @@ internal class DeliveryCacheDirectoryService : IDeliveryCacheDirectoryService
|
|||||||
Access = accessControl;
|
Access = accessControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result Open(ref DirectoryName name)
|
public Result Open(ref readonly DirectoryName name)
|
||||||
{
|
{
|
||||||
if (!name.IsValid())
|
if (!name.IsValid())
|
||||||
return ResultBcat.InvalidArgument.Log();
|
return ResultBcat.InvalidArgument.Log();
|
||||||
@ -38,7 +38,7 @@ internal class DeliveryCacheDirectoryService : IDeliveryCacheDirectoryService
|
|||||||
return ResultBcat.AlreadyOpen.Log();
|
return ResultBcat.AlreadyOpen.Log();
|
||||||
|
|
||||||
var metaReader = new DeliveryCacheFileMetaAccessor(Server);
|
var metaReader = new DeliveryCacheFileMetaAccessor(Server);
|
||||||
Result res = metaReader.ReadApplicationFileMeta(ApplicationId, ref name, false);
|
Result res = metaReader.ReadApplicationFileMeta(ApplicationId, in name, false);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
Count = metaReader.Count;
|
Count = metaReader.Count;
|
||||||
@ -59,7 +59,7 @@ internal class DeliveryCacheDirectoryService : IDeliveryCacheDirectoryService
|
|||||||
return ResultBcat.NotOpen.Log();
|
return ResultBcat.NotOpen.Log();
|
||||||
|
|
||||||
var metaReader = new DeliveryCacheFileMetaAccessor(Server);
|
var metaReader = new DeliveryCacheFileMetaAccessor(Server);
|
||||||
Result res = metaReader.ReadApplicationFileMeta(ApplicationId, ref _name, true);
|
Result res = metaReader.ReadApplicationFileMeta(ApplicationId, in _name, true);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
@ -29,7 +29,7 @@ internal class DeliveryCacheFileService : IDeliveryCacheFileService
|
|||||||
Access = accessControl;
|
Access = accessControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result Open(ref DirectoryName directoryName, ref FileName fileName)
|
public Result Open(ref readonly DirectoryName directoryName, ref readonly FileName fileName)
|
||||||
{
|
{
|
||||||
if (!directoryName.IsValid())
|
if (!directoryName.IsValid())
|
||||||
return ResultBcat.InvalidArgument.Log();
|
return ResultBcat.InvalidArgument.Log();
|
||||||
@ -43,14 +43,14 @@ internal class DeliveryCacheFileService : IDeliveryCacheFileService
|
|||||||
return ResultBcat.AlreadyOpen.Log();
|
return ResultBcat.AlreadyOpen.Log();
|
||||||
|
|
||||||
var metaReader = new DeliveryCacheFileMetaAccessor(Server);
|
var metaReader = new DeliveryCacheFileMetaAccessor(Server);
|
||||||
Result res = metaReader.ReadApplicationFileMeta(ApplicationId, ref directoryName, true);
|
Result res = metaReader.ReadApplicationFileMeta(ApplicationId, in directoryName, true);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
res = metaReader.FindEntry(out DeliveryCacheFileMetaEntry entry, ref fileName);
|
res = metaReader.FindEntry(out DeliveryCacheFileMetaEntry entry, in fileName);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
Span<byte> filePath = stackalloc byte[0x80];
|
Span<byte> filePath = stackalloc byte[0x80];
|
||||||
Server.GetStorageManager().GetFilePath(filePath, ApplicationId, ref directoryName, ref fileName);
|
Server.GetStorageManager().GetFilePath(filePath, ApplicationId, in directoryName, in fileName);
|
||||||
|
|
||||||
res = Server.GetFsClient().OpenFile(out _handle, new U8Span(filePath), OpenMode.Read);
|
res = Server.GetFsClient().OpenFile(out _handle, new U8Span(filePath), OpenMode.Read);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
@ -105,7 +105,7 @@ public class Package1
|
|||||||
public ref readonly Package1Pk11Header Pk11Header => ref _pk11Header;
|
public ref readonly Package1Pk11Header Pk11Header => ref _pk11Header;
|
||||||
public ref readonly Array16<byte> Pk11Mac => ref _pk11Mac;
|
public ref readonly Array16<byte> Pk11Mac => ref _pk11Mac;
|
||||||
|
|
||||||
public Result Initialize(KeySet keySet, in SharedRef<IStorage> storage)
|
public Result Initialize(KeySet keySet, ref readonly SharedRef<IStorage> storage)
|
||||||
{
|
{
|
||||||
KeySet = keySet;
|
KeySet = keySet;
|
||||||
_baseStorage.SetByCopy(in storage);
|
_baseStorage.SetByCopy(in storage);
|
||||||
|
@ -37,7 +37,7 @@ public class Package2StorageReader : IDisposable
|
|||||||
/// <param name="keySet">The keyset to use for decrypting the package.</param>
|
/// <param name="keySet">The keyset to use for decrypting the package.</param>
|
||||||
/// <param name="storage">An <see cref="IStorage"/> of the encrypted package2.</param>
|
/// <param name="storage">An <see cref="IStorage"/> of the encrypted package2.</param>
|
||||||
/// <returns>The <see cref="Result"/> of the operation.</returns>
|
/// <returns>The <see cref="Result"/> of the operation.</returns>
|
||||||
public Result Initialize(KeySet keySet, in SharedRef<IStorage> storage)
|
public Result Initialize(KeySet keySet, ref readonly SharedRef<IStorage> storage)
|
||||||
{
|
{
|
||||||
Result res = storage.Get.Read(0, SpanHelpers.AsByteSpan(ref _header));
|
Result res = storage.Get.Read(0, SpanHelpers.AsByteSpan(ref _header));
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -65,7 +65,7 @@ public class Package2StorageReader : IDisposable
|
|||||||
int offset = _header.Meta.GetPayloadFileOffset(index);
|
int offset = _header.Meta.GetPayloadFileOffset(index);
|
||||||
int size = (int)_header.Meta.PayloadSizes[index];
|
int size = (int)_header.Meta.PayloadSizes[index];
|
||||||
|
|
||||||
var payloadSubStorage = new SubStorage(_storage, offset, size);
|
var payloadSubStorage = new SubStorage(in _storage, offset, size);
|
||||||
|
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
{
|
{
|
||||||
@ -178,7 +178,7 @@ public class Package2StorageReader : IDisposable
|
|||||||
int offset = _header.Meta.GetPayloadFileOffset(i);
|
int offset = _header.Meta.GetPayloadFileOffset(i);
|
||||||
int size = (int)_header.Meta.PayloadSizes[i];
|
int size = (int)_header.Meta.PayloadSizes[i];
|
||||||
|
|
||||||
var payloadSubStorage = new SubStorage(_storage, offset, size);
|
var payloadSubStorage = new SubStorage(in _storage, offset, size);
|
||||||
|
|
||||||
offset = 0;
|
offset = 0;
|
||||||
sha.Initialize();
|
sha.Initialize();
|
||||||
@ -224,10 +224,10 @@ public class Package2StorageReader : IDisposable
|
|||||||
int encryptedHeaderSize = Unsafe.SizeOf<Package2Header>() - unencryptedHeaderSize;
|
int encryptedHeaderSize = Unsafe.SizeOf<Package2Header>() - unencryptedHeaderSize;
|
||||||
|
|
||||||
// Get signature and IV
|
// Get signature and IV
|
||||||
storages.Add(new SubStorage(_storage, 0, unencryptedHeaderSize));
|
storages.Add(new SubStorage(in _storage, 0, unencryptedHeaderSize));
|
||||||
|
|
||||||
// Open decrypted meta
|
// Open decrypted meta
|
||||||
var encMetaStorage = new SubStorage(_storage, unencryptedHeaderSize, encryptedHeaderSize);
|
var encMetaStorage = new SubStorage(in _storage, unencryptedHeaderSize, encryptedHeaderSize);
|
||||||
|
|
||||||
// The counter starts counting at the beginning of the meta struct, but the first block in
|
// The counter starts counting at the beginning of the meta struct, but the first block in
|
||||||
// the struct isn't encrypted. Increase the counter by one to skip that block.
|
// the struct isn't encrypted. Increase the counter by one to skip that block.
|
||||||
|
@ -257,7 +257,7 @@ public class KeySet
|
|||||||
|
|
||||||
public void DeriveSdCardKeys() => KeyDerivation.DeriveSdCardKeys(this);
|
public void DeriveSdCardKeys() => KeyDerivation.DeriveSdCardKeys(this);
|
||||||
|
|
||||||
private static RSAParameters CreateRsaParameters(in RsaKey key)
|
private static RSAParameters CreateRsaParameters(ref readonly RsaKey key)
|
||||||
{
|
{
|
||||||
return new RSAParameters
|
return new RSAParameters
|
||||||
{
|
{
|
||||||
@ -266,7 +266,7 @@ public class KeySet
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private static RSAParameters CreateRsaParameters(in RsaFullKey key)
|
private static RSAParameters CreateRsaParameters(ref readonly RsaFullKey key)
|
||||||
{
|
{
|
||||||
return new RSAParameters
|
return new RSAParameters
|
||||||
{
|
{
|
||||||
|
@ -72,7 +72,7 @@ public readonly ref struct ReadOnlyRef<T>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="value">The reference to the target <typeparamref name="T"/> value.</param>
|
/// <param name="value">The reference to the target <typeparamref name="T"/> value.</param>
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public ReadOnlyRef(in T value)
|
public ReadOnlyRef(ref readonly T value)
|
||||||
{
|
{
|
||||||
_ref = ref value;
|
_ref = ref value;
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ public struct SharedRef<T> : IDisposable where T : class, IDisposable
|
|||||||
return sharedRef;
|
return sharedRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SharedRef<T> CreateCopy<TFrom>(in SharedRef<TFrom> other) where TFrom : class, T
|
public static SharedRef<T> CreateCopy<TFrom>(ref readonly SharedRef<TFrom> other) where TFrom : class, T
|
||||||
{
|
{
|
||||||
var sharedRef = new SharedRef<T>();
|
var sharedRef = new SharedRef<T>();
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ public struct SharedRef<T> : IDisposable where T : class, IDisposable
|
|||||||
return sharedRef;
|
return sharedRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SharedRef<T> Create<TFrom>(in WeakRef<TFrom> other) where TFrom : class, T
|
public static SharedRef<T> Create<TFrom>(ref readonly WeakRef<TFrom> other) where TFrom : class, T
|
||||||
{
|
{
|
||||||
ref SharedRef<TFrom> otherShared = ref Unsafe.As<WeakRef<TFrom>, SharedRef<TFrom>>(ref Unsafe.AsRef(in other));
|
ref SharedRef<TFrom> otherShared = ref Unsafe.As<WeakRef<TFrom>, SharedRef<TFrom>>(ref Unsafe.AsRef(in other));
|
||||||
|
|
||||||
@ -228,7 +228,7 @@ public struct SharedRef<T> : IDisposable where T : class, IDisposable
|
|||||||
oldRefCount?.Decrement();
|
oldRefCount?.Decrement();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetByCopy<TFrom>(in SharedRef<TFrom> other) where TFrom : class, T
|
public void SetByCopy<TFrom>(ref readonly SharedRef<TFrom> other) where TFrom : class, T
|
||||||
{
|
{
|
||||||
RefCount oldRefCount = _refCount;
|
RefCount oldRefCount = _refCount;
|
||||||
RefCount otherRef = other._refCount;
|
RefCount otherRef = other._refCount;
|
||||||
@ -293,7 +293,7 @@ public struct WeakRef<T> : IDisposable where T : class, IDisposable
|
|||||||
private T _value;
|
private T _value;
|
||||||
private RefCount _refCount;
|
private RefCount _refCount;
|
||||||
|
|
||||||
public WeakRef(in SharedRef<T> other)
|
public WeakRef(ref readonly SharedRef<T> other)
|
||||||
{
|
{
|
||||||
this = Create(in other);
|
this = Create(in other);
|
||||||
}
|
}
|
||||||
@ -337,7 +337,7 @@ public struct WeakRef<T> : IDisposable where T : class, IDisposable
|
|||||||
return weakRef;
|
return weakRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static WeakRef<T> CreateCopy<TFrom>(in WeakRef<TFrom> other) where TFrom : class, T
|
public static WeakRef<T> CreateCopy<TFrom>(ref readonly WeakRef<TFrom> other) where TFrom : class, T
|
||||||
{
|
{
|
||||||
var weakRef = new WeakRef<T>();
|
var weakRef = new WeakRef<T>();
|
||||||
|
|
||||||
@ -356,7 +356,7 @@ public struct WeakRef<T> : IDisposable where T : class, IDisposable
|
|||||||
return weakRef;
|
return weakRef;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static WeakRef<T> Create<TFrom>(in SharedRef<TFrom> other) where TFrom : class, T
|
public static WeakRef<T> Create<TFrom>(ref readonly SharedRef<TFrom> other) where TFrom : class, T
|
||||||
{
|
{
|
||||||
ref readonly WeakRef<TFrom> otherWeak = ref Unsafe.As<SharedRef<TFrom>, WeakRef<TFrom>>(ref Unsafe.AsRef(in other));
|
ref readonly WeakRef<TFrom> otherWeak = ref Unsafe.As<SharedRef<TFrom>, WeakRef<TFrom>>(ref Unsafe.AsRef(in other));
|
||||||
|
|
||||||
@ -398,14 +398,14 @@ public struct WeakRef<T> : IDisposable where T : class, IDisposable
|
|||||||
temp.DisposeInternal();
|
temp.DisposeInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetCopy<TFrom>(in WeakRef<TFrom> other) where TFrom : class, T
|
public void SetCopy<TFrom>(ref readonly WeakRef<TFrom> other) where TFrom : class, T
|
||||||
{
|
{
|
||||||
WeakRef<T> temp = CreateCopy(in other);
|
WeakRef<T> temp = CreateCopy(in other);
|
||||||
Swap(ref temp);
|
Swap(ref temp);
|
||||||
temp.DisposeInternal();
|
temp.DisposeInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Set<TFrom>(in SharedRef<TFrom> other) where TFrom : class, T
|
public void Set<TFrom>(ref readonly SharedRef<TFrom> other) where TFrom : class, T
|
||||||
{
|
{
|
||||||
WeakRef<T> temp = Create(in other);
|
WeakRef<T> temp = Create(in other);
|
||||||
Swap(ref temp);
|
Swap(ref temp);
|
||||||
|
@ -60,19 +60,19 @@ public static class SpanHelpers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static ReadOnlySpan<T> CreateReadOnlySpan<T>(in T reference, int length)
|
public static ReadOnlySpan<T> CreateReadOnlySpan<T>(ref readonly T reference, int length)
|
||||||
{
|
{
|
||||||
return MemoryMarshal.CreateReadOnlySpan(ref Unsafe.AsRef(in reference), length);
|
return MemoryMarshal.CreateReadOnlySpan(ref Unsafe.AsRef(in reference), length);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static ReadOnlySpan<T> AsReadOnlySpan<T>(in T reference) where T : unmanaged
|
public static ReadOnlySpan<T> AsReadOnlySpan<T>(ref readonly T reference) where T : unmanaged
|
||||||
{
|
{
|
||||||
return new ReadOnlySpan<T>(in reference);
|
return new ReadOnlySpan<T>(in reference);
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static ReadOnlySpan<TSpan> AsReadOnlySpan<TStruct, TSpan>(in TStruct reference)
|
public static ReadOnlySpan<TSpan> AsReadOnlySpan<TStruct, TSpan>(ref readonly TStruct reference)
|
||||||
where TStruct : unmanaged where TSpan : unmanaged
|
where TStruct : unmanaged where TSpan : unmanaged
|
||||||
{
|
{
|
||||||
return CreateReadOnlySpan(in Unsafe.As<TStruct, TSpan>(ref Unsafe.AsRef(in reference)),
|
return CreateReadOnlySpan(in Unsafe.As<TStruct, TSpan>(ref Unsafe.AsRef(in reference)),
|
||||||
@ -80,7 +80,7 @@ public static class SpanHelpers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public static ReadOnlySpan<byte> AsReadOnlyByteSpan<T>(in T reference) where T : unmanaged
|
public static ReadOnlySpan<byte> AsReadOnlyByteSpan<T>(ref readonly T reference) where T : unmanaged
|
||||||
{
|
{
|
||||||
return CreateReadOnlySpan(in Unsafe.As<T, byte>(ref Unsafe.AsRef(in reference)), Unsafe.SizeOf<T>());
|
return CreateReadOnlySpan(in Unsafe.As<T, byte>(ref Unsafe.AsRef(in reference)), Unsafe.SizeOf<T>());
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ public enum AbortReason
|
|||||||
|
|
||||||
public static class Abort
|
public static class Abort
|
||||||
{
|
{
|
||||||
internal static void InvokeAbortObserver(in AbortInfo abortInfo)
|
internal static void InvokeAbortObserver(ref readonly AbortInfo abortInfo)
|
||||||
{
|
{
|
||||||
// Todo
|
// Todo
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public enum AssertionFailureOperation
|
|||||||
Continue
|
Continue
|
||||||
}
|
}
|
||||||
|
|
||||||
public delegate AssertionFailureOperation AssertionFailureHandler(in AssertionInfo assertionInfo);
|
public delegate AssertionFailureOperation AssertionFailureHandler(ref readonly AssertionInfo assertionInfo);
|
||||||
|
|
||||||
public static class Assert
|
public static class Assert
|
||||||
{
|
{
|
||||||
@ -52,13 +52,13 @@ public static class Assert
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AssertionFailureOperation DefaultAssertionFailureHandler(in AssertionInfo assertionInfo)
|
private static AssertionFailureOperation DefaultAssertionFailureHandler(ref readonly AssertionInfo assertionInfo)
|
||||||
{
|
{
|
||||||
return AssertionFailureOperation.Abort;
|
return AssertionFailureOperation.Abort;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ExecuteAssertionFailureOperation(AssertionFailureOperation operation,
|
private static void ExecuteAssertionFailureOperation(AssertionFailureOperation operation,
|
||||||
in AssertionInfo assertionInfo)
|
ref readonly AssertionInfo assertionInfo)
|
||||||
{
|
{
|
||||||
switch (operation)
|
switch (operation)
|
||||||
{
|
{
|
||||||
@ -84,7 +84,7 @@ public static class Assert
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void InvokeAssertionFailureHandler(in AssertionInfo assertionInfo)
|
private static void InvokeAssertionFailureHandler(ref readonly AssertionInfo assertionInfo)
|
||||||
{
|
{
|
||||||
AssertionFailureOperation operation = _assertionFailureHandler(in assertionInfo);
|
AssertionFailureOperation operation = _assertionFailureHandler(in assertionInfo);
|
||||||
ExecuteAssertionFailureOperation(operation, in assertionInfo);
|
ExecuteAssertionFailureOperation(operation, in assertionInfo);
|
||||||
@ -440,7 +440,7 @@ public static class Assert
|
|||||||
// Not null SharedRef<T>
|
// Not null SharedRef<T>
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
|
|
||||||
private static void NotNullImpl<T>(AssertionType assertionType, in SharedRef<T> value,
|
private static void NotNullImpl<T>(AssertionType assertionType, ref readonly SharedRef<T> value,
|
||||||
string valueText, string functionName, string fileName, int lineNumber) where T : class, IDisposable
|
string valueText, string functionName, string fileName, int lineNumber) where T : class, IDisposable
|
||||||
{
|
{
|
||||||
if (AssertImpl.NotNull(in value))
|
if (AssertImpl.NotNull(in value))
|
||||||
@ -575,7 +575,7 @@ public static class Assert
|
|||||||
// Null UniqueRef<T>
|
// Null UniqueRef<T>
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
|
|
||||||
private static void NullImpl<T>(AssertionType assertionType, in UniqueRef<T> value,
|
private static void NullImpl<T>(AssertionType assertionType, ref readonly UniqueRef<T> value,
|
||||||
string valueText, string functionName, string fileName, int lineNumber) where T : class, IDisposable
|
string valueText, string functionName, string fileName, int lineNumber) where T : class, IDisposable
|
||||||
{
|
{
|
||||||
if (AssertImpl.Null(in value))
|
if (AssertImpl.Null(in value))
|
||||||
@ -621,7 +621,7 @@ public static class Assert
|
|||||||
// Null SharedRef<T>
|
// Null SharedRef<T>
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
|
|
||||||
private static void NullImpl<T>(AssertionType assertionType, in SharedRef<T> value,
|
private static void NullImpl<T>(AssertionType assertionType, ref readonly SharedRef<T> value,
|
||||||
string valueText, string functionName, string fileName, int lineNumber) where T : class, IDisposable
|
string valueText, string functionName, string fileName, int lineNumber) where T : class, IDisposable
|
||||||
{
|
{
|
||||||
if (AssertImpl.Null(in value))
|
if (AssertImpl.Null(in value))
|
||||||
|
@ -13,7 +13,7 @@ internal class ObserverManager<TObserver, TItem> where TObserver : IObserverHold
|
|||||||
private LinkedList<TObserver> _observers;
|
private LinkedList<TObserver> _observers;
|
||||||
private ReaderWriterLock _rwLock;
|
private ReaderWriterLock _rwLock;
|
||||||
|
|
||||||
public delegate void Function(ref TObserver observer, in TItem item);
|
public delegate void Function(ref TObserver observer, ref readonly TItem item);
|
||||||
|
|
||||||
public ObserverManager(HorizonClient hos)
|
public ObserverManager(HorizonClient hos)
|
||||||
{
|
{
|
||||||
@ -61,7 +61,7 @@ internal class ObserverManager<TObserver, TItem> where TObserver : IObserverHold
|
|||||||
_observers.Clear();
|
_observers.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InvokeAllObserver(in TItem item, Function function)
|
public void InvokeAllObserver(ref readonly TItem item, Function function)
|
||||||
{
|
{
|
||||||
using ScopedLock<ReaderWriterLock> lk = ScopedLock.Lock(ref _rwLock);
|
using ScopedLock<ReaderWriterLock> lk = ScopedLock.Lock(ref _rwLock);
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ internal class LogObserverManager
|
|||||||
private readonly LinkedList<LogObserverHolder> _observers;
|
private readonly LinkedList<LogObserverHolder> _observers;
|
||||||
private ReaderWriterLock _rwLock;
|
private ReaderWriterLock _rwLock;
|
||||||
|
|
||||||
public delegate void Function(ref LogObserverHolder observer, in LogObserverContext item);
|
public delegate void Function(ref LogObserverHolder observer, ref readonly LogObserverContext item);
|
||||||
|
|
||||||
public LogObserverManager(HorizonClient hos)
|
public LogObserverManager(HorizonClient hos)
|
||||||
{
|
{
|
||||||
@ -129,7 +129,7 @@ internal class LogObserverManager
|
|||||||
_observers.Clear();
|
_observers.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InvokeAllObserver(in LogObserverContext item, Function function)
|
public void InvokeAllObserver(ref readonly LogObserverContext item, Function function)
|
||||||
{
|
{
|
||||||
using ScopedLock<ReaderWriterLock> lk = ScopedLock.Lock(ref _rwLock);
|
using ScopedLock<ReaderWriterLock> lk = ScopedLock.Lock(ref _rwLock);
|
||||||
|
|
||||||
|
@ -7,12 +7,12 @@ namespace LibHac.Diag;
|
|||||||
public static class Log
|
public static class Log
|
||||||
{
|
{
|
||||||
// Todo: Should we split large logs into smaller chunks like Horizon does?
|
// Todo: Should we split large logs into smaller chunks like Horizon does?
|
||||||
public static void LogImpl(this DiagClientImpl diag, in LogMetaData metaData, ReadOnlySpan<byte> message)
|
public static void LogImpl(this DiagClientImpl diag, ref readonly LogMetaData metaData, ReadOnlySpan<byte> message)
|
||||||
{
|
{
|
||||||
diag.PutImpl(in metaData, message);
|
diag.PutImpl(in metaData, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void PutImpl(this DiagClientImpl diag, in LogMetaData metaData, ReadOnlySpan<byte> message)
|
public static void PutImpl(this DiagClientImpl diag, ref readonly LogMetaData metaData, ReadOnlySpan<byte> message)
|
||||||
{
|
{
|
||||||
var logBody = new LogBody
|
var logBody = new LogBody
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@ using LibHac.Diag.Impl;
|
|||||||
|
|
||||||
namespace LibHac.Diag
|
namespace LibHac.Diag
|
||||||
{
|
{
|
||||||
public delegate void LogObserver(in LogMetaData metaData, in LogBody body, object arguments);
|
public delegate void LogObserver(ref readonly LogMetaData metaData, ref readonly LogBody body, object arguments);
|
||||||
|
|
||||||
internal struct LogObserverGlobals
|
internal struct LogObserverGlobals
|
||||||
{
|
{
|
||||||
@ -40,7 +40,8 @@ namespace LibHac.Diag
|
|||||||
diag.Impl.GetLogObserverManager().UnregisterObserver(observerHolder);
|
diag.Impl.GetLogObserverManager().UnregisterObserver(observerHolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void TentativeDefaultLogObserver(in LogMetaData metaData, in LogBody body, object arguments)
|
private static void TentativeDefaultLogObserver(ref readonly LogMetaData metaData, ref readonly LogBody body,
|
||||||
|
object arguments)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -61,7 +62,8 @@ namespace LibHac.Diag
|
|||||||
return g.Manager;
|
return g.Manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void CallAllLogObserver(this DiagClientImpl diag, in LogMetaData metaData, in LogBody body)
|
internal static void CallAllLogObserver(this DiagClientImpl diag, ref readonly LogMetaData metaData,
|
||||||
|
ref readonly LogBody body)
|
||||||
{
|
{
|
||||||
var context = new LogObserverContext
|
var context = new LogObserverContext
|
||||||
{
|
{
|
||||||
@ -73,7 +75,7 @@ namespace LibHac.Diag
|
|||||||
|
|
||||||
manager.InvokeAllObserver(in context, InvokeFunction);
|
manager.InvokeAllObserver(in context, InvokeFunction);
|
||||||
|
|
||||||
static void InvokeFunction(ref LogObserverHolder holder, in LogObserverContext item)
|
static void InvokeFunction(ref LogObserverHolder holder, ref readonly LogObserverContext item)
|
||||||
{
|
{
|
||||||
holder.Observer(in item.MetaData, in item.Body, holder.Arguments);
|
holder.Observer(in item.MetaData, in item.Body, holder.Arguments);
|
||||||
}
|
}
|
||||||
|
@ -401,7 +401,7 @@ namespace LibHac.Fs.Impl
|
|||||||
|
|
||||||
public static class AccessLogImpl
|
public static class AccessLogImpl
|
||||||
{
|
{
|
||||||
internal static T DereferenceOutValue<T>(in T value, Result result) where T : unmanaged
|
internal static T DereferenceOutValue<T>(ref readonly T value, Result result) where T : unmanaged
|
||||||
{
|
{
|
||||||
return result.IsSuccess() ? value : default;
|
return result.IsSuccess() ? value : default;
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ public class FileStorageBasedFileSystem : FileStorage
|
|||||||
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist or is a directory.<br/>
|
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist or is a directory.<br/>
|
||||||
/// <see cref="ResultFs.TargetLocked"/>: When opening as <see cref="OpenMode.Write"/>,
|
/// <see cref="ResultFs.TargetLocked"/>: When opening as <see cref="OpenMode.Write"/>,
|
||||||
/// the file is already opened as <see cref="OpenMode.Write"/>.</returns>
|
/// the file is already opened as <see cref="OpenMode.Write"/>.</returns>
|
||||||
public Result Initialize(ref SharedRef<IFileSystem> baseFileSystem, in Path path, OpenMode mode)
|
public Result Initialize(ref SharedRef<IFileSystem> baseFileSystem, ref readonly Path path, OpenMode mode)
|
||||||
{
|
{
|
||||||
using var baseFile = new UniqueRef<IFile>();
|
using var baseFile = new UniqueRef<IFile>();
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public static class PathExtensions
|
|||||||
/// <returns>A reference to the given <see cref="Path"/>.</returns>
|
/// <returns>A reference to the given <see cref="Path"/>.</returns>
|
||||||
#pragma warning disable LH0001 // DoNotCopyValue
|
#pragma warning disable LH0001 // DoNotCopyValue
|
||||||
#pragma warning disable CS8500 // This takes the address of, gets the size of, or declares a pointer to a managed type
|
#pragma warning disable CS8500 // This takes the address of, gets the size of, or declares a pointer to a managed type
|
||||||
public static unsafe ref Path Ref(this scoped in Path path)
|
public static unsafe ref Path Ref(this scoped ref readonly Path path)
|
||||||
{
|
{
|
||||||
fixed (Path* p = &path)
|
fixed (Path* p = &path)
|
||||||
{
|
{
|
||||||
@ -61,7 +61,7 @@ public static class PathExtensions
|
|||||||
return ref *p;
|
return ref *p;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static unsafe bool IsNullRef(in Path path)
|
public static unsafe bool IsNullRef(ref readonly Path path)
|
||||||
{
|
{
|
||||||
fixed (Path* p = &path)
|
fixed (Path* p = &path)
|
||||||
{
|
{
|
||||||
@ -69,7 +69,7 @@ public static class PathExtensions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static unsafe bool IsNullRef(in int path)
|
public static unsafe bool IsNullRef(ref readonly int path)
|
||||||
{
|
{
|
||||||
fixed (int* p = &path)
|
fixed (int* p = &path)
|
||||||
{
|
{
|
||||||
@ -131,7 +131,7 @@ public ref struct Path
|
|||||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||||
/// <see cref="ResultFs.NotNormalized"/>: The <c>IsNormalized</c> flag of
|
/// <see cref="ResultFs.NotNormalized"/>: The <c>IsNormalized</c> flag of
|
||||||
/// <paramref name="path"/> is not <see langword="true"/>.</returns>
|
/// <paramref name="path"/> is not <see langword="true"/>.</returns>
|
||||||
public Result Initialize(scoped in Path path)
|
public Result Initialize(scoped ref readonly Path path)
|
||||||
{
|
{
|
||||||
if (!path._isNormalized)
|
if (!path._isNormalized)
|
||||||
return ResultFs.NotNormalized.Log();
|
return ResultFs.NotNormalized.Log();
|
||||||
@ -406,7 +406,7 @@ public ref struct Path
|
|||||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||||
/// <see cref="ResultFs.NotNormalized"/>: The <c>IsNormalized</c> flag of
|
/// <see cref="ResultFs.NotNormalized"/>: The <c>IsNormalized</c> flag of
|
||||||
/// <paramref name="other"/> is not <see langword="true"/>.</returns>
|
/// <paramref name="other"/> is not <see langword="true"/>.</returns>
|
||||||
public Result Initialize(scoped in Path other)
|
public Result Initialize(scoped ref readonly Path other)
|
||||||
{
|
{
|
||||||
if (!other._isNormalized)
|
if (!other._isNormalized)
|
||||||
return ResultFs.NotNormalized.Log();
|
return ResultFs.NotNormalized.Log();
|
||||||
@ -433,7 +433,7 @@ public ref struct Path
|
|||||||
/// because <see cref="Stored"/> paths are always normalized upon initialization.</remarks>
|
/// because <see cref="Stored"/> paths are always normalized upon initialization.</remarks>
|
||||||
/// <param name="other">The <see cref="Stored"/> path used to initialize this <see cref="Path"/>.</param>
|
/// <param name="other">The <see cref="Stored"/> path used to initialize this <see cref="Path"/>.</param>
|
||||||
/// <returns><see cref="Result.Success"/>: The operation was successful.</returns>
|
/// <returns><see cref="Result.Success"/>: The operation was successful.</returns>
|
||||||
public Result Initialize(scoped in Stored other)
|
public Result Initialize(scoped ref readonly Stored other)
|
||||||
{
|
{
|
||||||
int otherLength = other.GetLength();
|
int otherLength = other.GetLength();
|
||||||
|
|
||||||
@ -840,7 +840,7 @@ public ref struct Path
|
|||||||
/// <param name="parent">The <see cref="Path"/> to insert.</param>
|
/// <param name="parent">The <see cref="Path"/> to insert.</param>
|
||||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||||
/// <see cref="ResultFs.NotImplemented"/>: The path provided in <paramref name="parent"/> is a Windows path.</returns>
|
/// <see cref="ResultFs.NotImplemented"/>: The path provided in <paramref name="parent"/> is a Windows path.</returns>
|
||||||
public Result InsertParent(scoped in Path parent)
|
public Result InsertParent(scoped ref readonly Path parent)
|
||||||
{
|
{
|
||||||
return InsertParent(parent.GetString());
|
return InsertParent(parent.GetString());
|
||||||
}
|
}
|
||||||
@ -933,7 +933,7 @@ public ref struct Path
|
|||||||
/// path is not normalized yet the <c>IsNormalized</c> flag is still <see langword="true"/>.</remarks>
|
/// path is not normalized yet the <c>IsNormalized</c> flag is still <see langword="true"/>.</remarks>
|
||||||
/// <param name="child">The child <see cref="Path"/> to append to the current path.</param>
|
/// <param name="child">The child <see cref="Path"/> to append to the current path.</param>
|
||||||
/// <returns><see cref="Result.Success"/>: The operation was successful.</returns>
|
/// <returns><see cref="Result.Success"/>: The operation was successful.</returns>
|
||||||
public Result AppendChild(scoped in Path child)
|
public Result AppendChild(scoped ref readonly Path child)
|
||||||
{
|
{
|
||||||
return AppendChild(child.GetString());
|
return AppendChild(child.GetString());
|
||||||
}
|
}
|
||||||
@ -949,7 +949,7 @@ public ref struct Path
|
|||||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||||
/// <see cref="ResultFs.NotNormalized"/>: The <c>IsNormalized</c> flag of either
|
/// <see cref="ResultFs.NotNormalized"/>: The <c>IsNormalized</c> flag of either
|
||||||
/// <paramref name="path1"/> or <paramref name="path2"/> is not <see langword="true"/>.</returns>
|
/// <paramref name="path1"/> or <paramref name="path2"/> is not <see langword="true"/>.</returns>
|
||||||
public Result Combine(scoped in Path path1, scoped in Path path2)
|
public Result Combine(scoped ref readonly Path path1, scoped ref readonly Path path2)
|
||||||
{
|
{
|
||||||
int path1Length = path1.GetLength();
|
int path1Length = path1.GetLength();
|
||||||
int path2Length = path2.GetLength();
|
int path2Length = path2.GetLength();
|
||||||
@ -985,7 +985,7 @@ public ref struct Path
|
|||||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||||
/// <see cref="ResultFs.NotNormalized"/>: The <c>IsNormalized</c> flag of
|
/// <see cref="ResultFs.NotNormalized"/>: The <c>IsNormalized</c> flag of
|
||||||
/// <paramref name="path1"/> is not <see langword="true"/>.</returns>
|
/// <paramref name="path1"/> is not <see langword="true"/>.</returns>
|
||||||
public Result Combine(scoped in Path path1, scoped ReadOnlySpan<byte> path2)
|
public Result Combine(scoped ref readonly Path path1, scoped ReadOnlySpan<byte> path2)
|
||||||
{
|
{
|
||||||
int path1Length = path1.GetLength();
|
int path1Length = path1.GetLength();
|
||||||
int path2Length = StringUtils.GetLength(path2);
|
int path2Length = StringUtils.GetLength(path2);
|
||||||
@ -1010,7 +1010,7 @@ public ref struct Path
|
|||||||
/// <param name="path1">The first path to combine.</param>
|
/// <param name="path1">The first path to combine.</param>
|
||||||
/// <param name="path2">The second path to combine.</param>
|
/// <param name="path2">The second path to combine.</param>
|
||||||
/// <returns><see cref="Result.Success"/>: The operation was successful.</returns>
|
/// <returns><see cref="Result.Success"/>: The operation was successful.</returns>
|
||||||
public Result Combine(scoped ReadOnlySpan<byte> path1, scoped in Path path2)
|
public Result Combine(scoped ReadOnlySpan<byte> path1, scoped ref readonly Path path2)
|
||||||
{
|
{
|
||||||
int path1Length = StringUtils.GetLength(path1);
|
int path1Length = StringUtils.GetLength(path1);
|
||||||
int path2Length = path2.GetLength();
|
int path2Length = path2.GetLength();
|
||||||
|
@ -88,7 +88,7 @@ public static class PathUtility
|
|||||||
return path[length - 1] == DirectorySeparator || path[length - 1] == AltDirectorySeparator;
|
return path[length - 1] == DirectorySeparator || path[length - 1] == AltDirectorySeparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsDirectoryPath(in FspPath path)
|
public static bool IsDirectoryPath(ref readonly FspPath path)
|
||||||
{
|
{
|
||||||
return IsDirectoryPath(SpanHelpers.AsReadOnlyByteSpan(in path));
|
return IsDirectoryPath(SpanHelpers.AsReadOnlyByteSpan(in path));
|
||||||
}
|
}
|
||||||
|
@ -265,8 +265,8 @@ public struct SaveDataCreationInfo2
|
|||||||
public int MetaSize;
|
public int MetaSize;
|
||||||
public Array356<byte> Reserved4;
|
public Array356<byte> Reserved4;
|
||||||
|
|
||||||
public static Result Make(out SaveDataCreationInfo2 creationInfo, in SaveDataAttribute attribute, long size,
|
public static Result Make(out SaveDataCreationInfo2 creationInfo, in SaveDataAttribute attribute,
|
||||||
long journalSize, long blockSize, ulong ownerId, SaveDataFlags flags, SaveDataSpaceId spaceId,
|
long size, long journalSize, long blockSize, ulong ownerId, SaveDataFlags flags, SaveDataSpaceId spaceId,
|
||||||
SaveDataFormatType formatType)
|
SaveDataFormatType formatType)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out creationInfo);
|
UnsafeHelpers.SkipParamInit(out creationInfo);
|
||||||
|
@ -3,28 +3,28 @@
|
|||||||
// ReSharper disable once InconsistentNaming
|
// ReSharper disable once InconsistentNaming
|
||||||
public abstract class IAttributeFileSystem : IFileSystem
|
public abstract class IAttributeFileSystem : IFileSystem
|
||||||
{
|
{
|
||||||
public Result CreateDirectory(in Path path, NxFileAttributes archiveAttribute)
|
public Result CreateDirectory(ref readonly Path path, NxFileAttributes archiveAttribute)
|
||||||
{
|
{
|
||||||
return DoCreateDirectory(in path, archiveAttribute);
|
return DoCreateDirectory(in path, archiveAttribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result GetFileAttributes(out NxFileAttributes attributes, in Path path)
|
public Result GetFileAttributes(out NxFileAttributes attributes, ref readonly Path path)
|
||||||
{
|
{
|
||||||
return DoGetFileAttributes(out attributes, in path);
|
return DoGetFileAttributes(out attributes, in path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result SetFileAttributes(in Path path, NxFileAttributes attributes)
|
public Result SetFileAttributes(ref readonly Path path, NxFileAttributes attributes)
|
||||||
{
|
{
|
||||||
return DoSetFileAttributes(in path, attributes);
|
return DoSetFileAttributes(in path, attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result GetFileSize(out long fileSize, in Path path)
|
public Result GetFileSize(out long fileSize, ref readonly Path path)
|
||||||
{
|
{
|
||||||
return DoGetFileSize(out fileSize, in path);
|
return DoGetFileSize(out fileSize, in path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract Result DoCreateDirectory(in Path path, NxFileAttributes archiveAttribute);
|
protected abstract Result DoCreateDirectory(ref readonly Path path, NxFileAttributes archiveAttribute);
|
||||||
protected abstract Result DoGetFileAttributes(out NxFileAttributes attributes, in Path path);
|
protected abstract Result DoGetFileAttributes(out NxFileAttributes attributes, ref readonly Path path);
|
||||||
protected abstract Result DoSetFileAttributes(in Path path, NxFileAttributes attributes);
|
protected abstract Result DoSetFileAttributes(ref readonly Path path, NxFileAttributes attributes);
|
||||||
protected abstract Result DoGetFileSize(out long fileSize, in Path path);
|
protected abstract Result DoGetFileSize(out long fileSize, ref readonly Path path);
|
||||||
}
|
}
|
@ -26,7 +26,7 @@ public abstract class IFileSystem : IDisposable
|
|||||||
/// <see cref="ResultFs.PathNotFound"/>: The parent directory of the specified path does not exist.<br/>
|
/// <see cref="ResultFs.PathNotFound"/>: The parent directory of the specified path does not exist.<br/>
|
||||||
/// <see cref="ResultFs.PathAlreadyExists"/>: Specified path already exists as either a file or directory.<br/>
|
/// <see cref="ResultFs.PathAlreadyExists"/>: Specified path already exists as either a file or directory.<br/>
|
||||||
/// <see cref="ResultFs.UsableSpaceNotEnough"/>: Insufficient free space to create the file.</returns>
|
/// <see cref="ResultFs.UsableSpaceNotEnough"/>: Insufficient free space to create the file.</returns>
|
||||||
public Result CreateFile(in Path path, long size, CreateFileOptions option)
|
public Result CreateFile(ref readonly Path path, long size, CreateFileOptions option)
|
||||||
{
|
{
|
||||||
if (size < 0)
|
if (size < 0)
|
||||||
return ResultFs.OutOfRange.Log();
|
return ResultFs.OutOfRange.Log();
|
||||||
@ -44,7 +44,7 @@ public abstract class IFileSystem : IDisposable
|
|||||||
/// <see cref="ResultFs.PathNotFound"/>: The parent directory of the specified path does not exist.<br/>
|
/// <see cref="ResultFs.PathNotFound"/>: The parent directory of the specified path does not exist.<br/>
|
||||||
/// <see cref="ResultFs.PathAlreadyExists"/>: Specified path already exists as either a file or directory.<br/>
|
/// <see cref="ResultFs.PathAlreadyExists"/>: Specified path already exists as either a file or directory.<br/>
|
||||||
/// <see cref="ResultFs.UsableSpaceNotEnough"/>: Insufficient free space to create the file.</returns>
|
/// <see cref="ResultFs.UsableSpaceNotEnough"/>: Insufficient free space to create the file.</returns>
|
||||||
public Result CreateFile(in Path path, long size)
|
public Result CreateFile(ref readonly Path path, long size)
|
||||||
{
|
{
|
||||||
return CreateFile(in path, size, CreateFileOptions.None);
|
return CreateFile(in path, size, CreateFileOptions.None);
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ public abstract class IFileSystem : IDisposable
|
|||||||
/// <param name="path">The full path of the file to delete.</param>
|
/// <param name="path">The full path of the file to delete.</param>
|
||||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||||
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist or is a directory.</returns>
|
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist or is a directory.</returns>
|
||||||
public Result DeleteFile(in Path path)
|
public Result DeleteFile(ref readonly Path path)
|
||||||
{
|
{
|
||||||
return DoDeleteFile(in path);
|
return DoDeleteFile(in path);
|
||||||
}
|
}
|
||||||
@ -68,7 +68,7 @@ public abstract class IFileSystem : IDisposable
|
|||||||
/// <see cref="ResultFs.PathNotFound"/>: The parent directory of the specified path does not exist.<br/>
|
/// <see cref="ResultFs.PathNotFound"/>: The parent directory of the specified path does not exist.<br/>
|
||||||
/// <see cref="ResultFs.PathAlreadyExists"/>: Specified path already exists as either a file or directory.<br/>
|
/// <see cref="ResultFs.PathAlreadyExists"/>: Specified path already exists as either a file or directory.<br/>
|
||||||
/// <see cref="ResultFs.UsableSpaceNotEnough"/>: Insufficient free space to create the directory.</returns>
|
/// <see cref="ResultFs.UsableSpaceNotEnough"/>: Insufficient free space to create the directory.</returns>
|
||||||
public Result CreateDirectory(in Path path)
|
public Result CreateDirectory(ref readonly Path path)
|
||||||
{
|
{
|
||||||
return DoCreateDirectory(in path);
|
return DoCreateDirectory(in path);
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ public abstract class IFileSystem : IDisposable
|
|||||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||||
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist or is a file.<br/>
|
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist or is a file.<br/>
|
||||||
/// <see cref="ResultFs.DirectoryNotEmpty"/>: The specified directory is not empty.</returns>
|
/// <see cref="ResultFs.DirectoryNotEmpty"/>: The specified directory is not empty.</returns>
|
||||||
public Result DeleteDirectory(in Path path)
|
public Result DeleteDirectory(ref readonly Path path)
|
||||||
{
|
{
|
||||||
return DoDeleteDirectory(in path);
|
return DoDeleteDirectory(in path);
|
||||||
}
|
}
|
||||||
@ -91,7 +91,7 @@ public abstract class IFileSystem : IDisposable
|
|||||||
/// <param name="path">The full path of the directory to delete.</param>
|
/// <param name="path">The full path of the directory to delete.</param>
|
||||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||||
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist or is a file.</returns>
|
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist or is a file.</returns>
|
||||||
public Result DeleteDirectoryRecursively(in Path path)
|
public Result DeleteDirectoryRecursively(ref readonly Path path)
|
||||||
{
|
{
|
||||||
return DoDeleteDirectoryRecursively(in path);
|
return DoDeleteDirectoryRecursively(in path);
|
||||||
}
|
}
|
||||||
@ -102,7 +102,7 @@ public abstract class IFileSystem : IDisposable
|
|||||||
/// <param name="path">The full path of the directory to clean.</param>
|
/// <param name="path">The full path of the directory to clean.</param>
|
||||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||||
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist or is a file.</returns>
|
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist or is a file.</returns>
|
||||||
public Result CleanDirectoryRecursively(in Path path)
|
public Result CleanDirectoryRecursively(ref readonly Path path)
|
||||||
{
|
{
|
||||||
return DoCleanDirectoryRecursively(in path);
|
return DoCleanDirectoryRecursively(in path);
|
||||||
}
|
}
|
||||||
@ -119,7 +119,7 @@ public abstract class IFileSystem : IDisposable
|
|||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// If <paramref name="currentPath"/> and <paramref name="newPath"/> are the same, this function does nothing and returns successfully.
|
/// If <paramref name="currentPath"/> and <paramref name="newPath"/> are the same, this function does nothing and returns successfully.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public Result RenameFile(in Path currentPath, in Path newPath)
|
public Result RenameFile(ref readonly Path currentPath, ref readonly Path newPath)
|
||||||
{
|
{
|
||||||
return DoRenameFile(in currentPath, in newPath);
|
return DoRenameFile(in currentPath, in newPath);
|
||||||
}
|
}
|
||||||
@ -137,7 +137,7 @@ public abstract class IFileSystem : IDisposable
|
|||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// If <paramref name="currentPath"/> and <paramref name="newPath"/> are the same, this function does nothing and returns <see cref="Result.Success"/>.
|
/// If <paramref name="currentPath"/> and <paramref name="newPath"/> are the same, this function does nothing and returns <see cref="Result.Success"/>.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public Result RenameDirectory(in Path currentPath, in Path newPath)
|
public Result RenameDirectory(ref readonly Path currentPath, ref readonly Path newPath)
|
||||||
{
|
{
|
||||||
return DoRenameDirectory(in currentPath, in newPath);
|
return DoRenameDirectory(in currentPath, in newPath);
|
||||||
}
|
}
|
||||||
@ -149,7 +149,7 @@ public abstract class IFileSystem : IDisposable
|
|||||||
/// <param name="path">The full path to check.</param>
|
/// <param name="path">The full path to check.</param>
|
||||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||||
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist.</returns>
|
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist.</returns>
|
||||||
public Result GetEntryType(out DirectoryEntryType entryType, in Path path)
|
public Result GetEntryType(out DirectoryEntryType entryType, ref readonly Path path)
|
||||||
{
|
{
|
||||||
return DoGetEntryType(out entryType, in path);
|
return DoGetEntryType(out entryType, in path);
|
||||||
}
|
}
|
||||||
@ -186,7 +186,7 @@ public abstract class IFileSystem : IDisposable
|
|||||||
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist or is a directory.<br/>
|
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist or is a directory.<br/>
|
||||||
/// <see cref="ResultFs.TargetLocked"/>: When opening as <see cref="OpenMode.Write"/>,
|
/// <see cref="ResultFs.TargetLocked"/>: When opening as <see cref="OpenMode.Write"/>,
|
||||||
/// the file is already opened as <see cref="OpenMode.Write"/>.</returns>
|
/// the file is already opened as <see cref="OpenMode.Write"/>.</returns>
|
||||||
public Result OpenFile(ref UniqueRef<IFile> file, in Path path, OpenMode mode)
|
public Result OpenFile(ref UniqueRef<IFile> file, ref readonly Path path, OpenMode mode)
|
||||||
{
|
{
|
||||||
if ((mode & OpenMode.ReadWrite) == 0 || (mode & ~OpenMode.All) != 0)
|
if ((mode & OpenMode.ReadWrite) == 0 || (mode & ~OpenMode.All) != 0)
|
||||||
return ResultFs.InvalidModeForFileOpen.Log();
|
return ResultFs.InvalidModeForFileOpen.Log();
|
||||||
@ -225,7 +225,7 @@ public abstract class IFileSystem : IDisposable
|
|||||||
/// <param name="mode">Specifies which sub-entries should be enumerated.</param>
|
/// <param name="mode">Specifies which sub-entries should be enumerated.</param>
|
||||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||||
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist or is a file.</returns>
|
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist or is a file.</returns>
|
||||||
public Result OpenDirectory(ref UniqueRef<IDirectory> outDirectory, in Path path, OpenDirectoryMode mode)
|
public Result OpenDirectory(ref UniqueRef<IDirectory> outDirectory, ref readonly Path path, OpenDirectoryMode mode)
|
||||||
{
|
{
|
||||||
if ((mode & OpenDirectoryMode.All) == 0 ||
|
if ((mode & OpenDirectoryMode.All) == 0 ||
|
||||||
(mode & ~(OpenDirectoryMode.All | OpenDirectoryMode.NoFileSize)) != 0)
|
(mode & ~(OpenDirectoryMode.All | OpenDirectoryMode.NoFileSize)) != 0)
|
||||||
@ -253,7 +253,7 @@ public abstract class IFileSystem : IDisposable
|
|||||||
/// <param name="freeSpace">If the operation returns successfully, the amount of free space available on the drive, in bytes.</param>
|
/// <param name="freeSpace">If the operation returns successfully, the amount of free space available on the drive, in bytes.</param>
|
||||||
/// <param name="path">The path of the drive to query. Unused in almost all cases.</param>
|
/// <param name="path">The path of the drive to query. Unused in almost all cases.</param>
|
||||||
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
|
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
|
||||||
public Result GetFreeSpaceSize(out long freeSpace, in Path path)
|
public Result GetFreeSpaceSize(out long freeSpace, ref readonly Path path)
|
||||||
{
|
{
|
||||||
return DoGetFreeSpaceSize(out freeSpace, in path);
|
return DoGetFreeSpaceSize(out freeSpace, in path);
|
||||||
}
|
}
|
||||||
@ -264,7 +264,7 @@ public abstract class IFileSystem : IDisposable
|
|||||||
/// <param name="totalSpace">If the operation returns successfully, the total size of the drive, in bytes.</param>
|
/// <param name="totalSpace">If the operation returns successfully, the total size of the drive, in bytes.</param>
|
||||||
/// <param name="path">The path of the drive to query. Unused in almost all cases.</param>
|
/// <param name="path">The path of the drive to query. Unused in almost all cases.</param>
|
||||||
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
|
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
|
||||||
public Result GetTotalSpaceSize(out long totalSpace, in Path path)
|
public Result GetTotalSpaceSize(out long totalSpace, ref readonly Path path)
|
||||||
{
|
{
|
||||||
return DoGetTotalSpaceSize(out totalSpace, in path);
|
return DoGetTotalSpaceSize(out totalSpace, in path);
|
||||||
}
|
}
|
||||||
@ -277,7 +277,7 @@ public abstract class IFileSystem : IDisposable
|
|||||||
/// <param name="path">The path of the file or directory.</param>
|
/// <param name="path">The path of the file or directory.</param>
|
||||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||||
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist.</returns>
|
/// <see cref="ResultFs.PathNotFound"/>: The specified path does not exist.</returns>
|
||||||
public Result GetFileTimeStampRaw(out FileTimeStampRaw timeStamp, in Path path)
|
public Result GetFileTimeStampRaw(out FileTimeStampRaw timeStamp, ref readonly Path path)
|
||||||
{
|
{
|
||||||
return DoGetFileTimeStampRaw(out timeStamp, in path);
|
return DoGetFileTimeStampRaw(out timeStamp, in path);
|
||||||
}
|
}
|
||||||
@ -294,9 +294,9 @@ public abstract class IFileSystem : IDisposable
|
|||||||
/// <param name="queryId">The type of query to perform.</param>
|
/// <param name="queryId">The type of query to perform.</param>
|
||||||
/// <param name="path">The full path of the file to query.</param>
|
/// <param name="path">The full path of the file to query.</param>
|
||||||
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
|
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
|
||||||
public Result QueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId, in Path path)
|
public Result QueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId, ref readonly Path path)
|
||||||
{
|
{
|
||||||
return DoQueryEntry(outBuffer, inBuffer, queryId, path);
|
return DoQueryEntry(outBuffer, inBuffer, queryId, in path);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -309,44 +309,44 @@ public abstract class IFileSystem : IDisposable
|
|||||||
return DoGetFileSystemAttribute(out outAttribute);
|
return DoGetFileSystemAttribute(out outAttribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract Result DoCreateFile(in Path path, long size, CreateFileOptions option);
|
protected abstract Result DoCreateFile(ref readonly Path path, long size, CreateFileOptions option);
|
||||||
protected abstract Result DoDeleteFile(in Path path);
|
protected abstract Result DoDeleteFile(ref readonly Path path);
|
||||||
protected abstract Result DoCreateDirectory(in Path path);
|
protected abstract Result DoCreateDirectory(ref readonly Path path);
|
||||||
protected abstract Result DoDeleteDirectory(in Path path);
|
protected abstract Result DoDeleteDirectory(ref readonly Path path);
|
||||||
protected abstract Result DoDeleteDirectoryRecursively(in Path path);
|
protected abstract Result DoDeleteDirectoryRecursively(ref readonly Path path);
|
||||||
protected abstract Result DoCleanDirectoryRecursively(in Path path);
|
protected abstract Result DoCleanDirectoryRecursively(ref readonly Path path);
|
||||||
protected abstract Result DoRenameFile(in Path currentPath, in Path newPath);
|
protected abstract Result DoRenameFile(ref readonly Path currentPath, ref readonly Path newPath);
|
||||||
protected abstract Result DoRenameDirectory(in Path currentPath, in Path newPath);
|
protected abstract Result DoRenameDirectory(ref readonly Path currentPath, ref readonly Path newPath);
|
||||||
protected abstract Result DoGetEntryType(out DirectoryEntryType entryType, in Path path);
|
protected abstract Result DoGetEntryType(out DirectoryEntryType entryType, ref readonly Path path);
|
||||||
|
|
||||||
protected virtual Result DoGetFreeSpaceSize(out long freeSpace, in Path path)
|
protected virtual Result DoGetFreeSpaceSize(out long freeSpace, ref readonly Path path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out freeSpace);
|
UnsafeHelpers.SkipParamInit(out freeSpace);
|
||||||
return ResultFs.NotImplemented.Log();
|
return ResultFs.NotImplemented.Log();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual Result DoGetTotalSpaceSize(out long totalSpace, in Path path)
|
protected virtual Result DoGetTotalSpaceSize(out long totalSpace, ref readonly Path path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out totalSpace);
|
UnsafeHelpers.SkipParamInit(out totalSpace);
|
||||||
return ResultFs.NotImplemented.Log();
|
return ResultFs.NotImplemented.Log();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract Result DoOpenFile(ref UniqueRef<IFile> outFile, in Path path, OpenMode mode);
|
protected abstract Result DoOpenFile(ref UniqueRef<IFile> outFile, ref readonly Path path, OpenMode mode);
|
||||||
protected abstract Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, in Path path, OpenDirectoryMode mode);
|
protected abstract Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, ref readonly Path path, OpenDirectoryMode mode);
|
||||||
protected abstract Result DoCommit();
|
protected abstract Result DoCommit();
|
||||||
|
|
||||||
protected virtual Result DoCommitProvisionally(long counter) => ResultFs.NotImplemented.Log();
|
protected virtual Result DoCommitProvisionally(long counter) => ResultFs.NotImplemented.Log();
|
||||||
protected virtual Result DoRollback() => ResultFs.NotImplemented.Log();
|
protected virtual Result DoRollback() => ResultFs.NotImplemented.Log();
|
||||||
protected virtual Result DoFlush() => ResultFs.NotImplemented.Log();
|
protected virtual Result DoFlush() => ResultFs.NotImplemented.Log();
|
||||||
|
|
||||||
protected virtual Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, in Path path)
|
protected virtual Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, ref readonly Path path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out timeStamp);
|
UnsafeHelpers.SkipParamInit(out timeStamp);
|
||||||
return ResultFs.NotImplemented.Log();
|
return ResultFs.NotImplemented.Log();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
protected virtual Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
||||||
in Path path) => ResultFs.NotImplemented.Log();
|
ref readonly Path path) => ResultFs.NotImplemented.Log();
|
||||||
|
|
||||||
protected virtual Result DoGetFileSystemAttribute(out FileSystemAttribute outAttribute)
|
protected virtual Result DoGetFileSystemAttribute(out FileSystemAttribute outAttribute)
|
||||||
{
|
{
|
||||||
|
@ -49,43 +49,43 @@ public static class Registrar
|
|||||||
base.Dispose();
|
base.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option) =>
|
protected override Result DoCreateFile(ref readonly Path path, long size, CreateFileOptions option) =>
|
||||||
_fileSystem.Get.CreateFile(in path, size, option);
|
_fileSystem.Get.CreateFile(in path, size, option);
|
||||||
|
|
||||||
protected override Result DoDeleteFile(in Path path) => _fileSystem.Get.DeleteFile(in path);
|
protected override Result DoDeleteFile(ref readonly Path path) => _fileSystem.Get.DeleteFile(in path);
|
||||||
|
|
||||||
protected override Result DoCreateDirectory(in Path path) => _fileSystem.Get.CreateDirectory(in path);
|
protected override Result DoCreateDirectory(ref readonly Path path) => _fileSystem.Get.CreateDirectory(in path);
|
||||||
|
|
||||||
protected override Result DoDeleteDirectory(in Path path) => _fileSystem.Get.DeleteDirectory(in path);
|
protected override Result DoDeleteDirectory(ref readonly Path path) => _fileSystem.Get.DeleteDirectory(in path);
|
||||||
|
|
||||||
protected override Result DoDeleteDirectoryRecursively(in Path path) =>
|
protected override Result DoDeleteDirectoryRecursively(ref readonly Path path) =>
|
||||||
_fileSystem.Get.DeleteDirectoryRecursively(in path);
|
_fileSystem.Get.DeleteDirectoryRecursively(in path);
|
||||||
|
|
||||||
protected override Result DoCleanDirectoryRecursively(in Path path) =>
|
protected override Result DoCleanDirectoryRecursively(ref readonly Path path) =>
|
||||||
_fileSystem.Get.CleanDirectoryRecursively(in path);
|
_fileSystem.Get.CleanDirectoryRecursively(in path);
|
||||||
|
|
||||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath) =>
|
protected override Result DoRenameFile(ref readonly Path currentPath, ref readonly Path newPath) =>
|
||||||
_fileSystem.Get.RenameFile(in currentPath, in newPath);
|
_fileSystem.Get.RenameFile(in currentPath, in newPath);
|
||||||
|
|
||||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath) =>
|
protected override Result DoRenameDirectory(ref readonly Path currentPath, ref readonly Path newPath) =>
|
||||||
_fileSystem.Get.RenameDirectory(in currentPath, in newPath);
|
_fileSystem.Get.RenameDirectory(in currentPath, in newPath);
|
||||||
|
|
||||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path) =>
|
protected override Result DoGetEntryType(out DirectoryEntryType entryType, ref readonly Path path) =>
|
||||||
_fileSystem.Get.GetEntryType(out entryType, in path);
|
_fileSystem.Get.GetEntryType(out entryType, in path);
|
||||||
|
|
||||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, in Path path) =>
|
protected override Result DoGetFreeSpaceSize(out long freeSpace, ref readonly Path path) =>
|
||||||
_fileSystem.Get.GetFreeSpaceSize(out freeSpace, in path);
|
_fileSystem.Get.GetFreeSpaceSize(out freeSpace, in path);
|
||||||
|
|
||||||
protected override Result DoGetFileSystemAttribute(out FileSystemAttribute outAttribute) =>
|
protected override Result DoGetFileSystemAttribute(out FileSystemAttribute outAttribute) =>
|
||||||
_fileSystem.Get.GetFileSystemAttribute(out outAttribute);
|
_fileSystem.Get.GetFileSystemAttribute(out outAttribute);
|
||||||
|
|
||||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, in Path path) =>
|
protected override Result DoGetTotalSpaceSize(out long totalSpace, ref readonly Path path) =>
|
||||||
_fileSystem.Get.GetTotalSpaceSize(out totalSpace, in path);
|
_fileSystem.Get.GetTotalSpaceSize(out totalSpace, in path);
|
||||||
|
|
||||||
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, in Path path, OpenMode mode) =>
|
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, ref readonly Path path, OpenMode mode) =>
|
||||||
_fileSystem.Get.OpenFile(ref outFile, in path, mode);
|
_fileSystem.Get.OpenFile(ref outFile, in path, mode);
|
||||||
|
|
||||||
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, in Path path,
|
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, ref readonly Path path,
|
||||||
OpenDirectoryMode mode) =>
|
OpenDirectoryMode mode) =>
|
||||||
_fileSystem.Get.OpenDirectory(ref outDirectory, in path, mode);
|
_fileSystem.Get.OpenDirectory(ref outDirectory, in path, mode);
|
||||||
|
|
||||||
@ -98,11 +98,11 @@ public static class Registrar
|
|||||||
|
|
||||||
protected override Result DoFlush() => _fileSystem.Get.Flush();
|
protected override Result DoFlush() => _fileSystem.Get.Flush();
|
||||||
|
|
||||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, in Path path) =>
|
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, ref readonly Path path) =>
|
||||||
_fileSystem.Get.GetFileTimeStampRaw(out timeStamp, in path);
|
_fileSystem.Get.GetFileTimeStampRaw(out timeStamp, in path);
|
||||||
|
|
||||||
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
||||||
in Path path) => _fileSystem.Get.QueryEntry(outBuffer, inBuffer, queryId, in path);
|
ref readonly Path path) => _fileSystem.Get.QueryEntry(outBuffer, inBuffer, queryId, in path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result Register(this FileSystemClient fs, U8Span name, ref UniqueRef<IFileSystem> fileSystem)
|
public static Result Register(this FileSystemClient fs, U8Span name, ref UniqueRef<IFileSystem> fileSystem)
|
||||||
|
@ -738,7 +738,7 @@ public static class UserFileSystem
|
|||||||
? SaveDataFlags.Restore
|
? SaveDataFlags.Restore
|
||||||
: SaveDataFlags.None;
|
: SaveDataFlags.None;
|
||||||
|
|
||||||
return fs.Impl.WriteSaveDataFileSystemExtraData(SaveDataSpaceId.User, in attribute, in extraData,
|
return fs.Impl.WriteSaveDataFileSystemExtraData(SaveDataSpaceId.User, attribute, in extraData,
|
||||||
in extraDataMask);
|
in extraDataMask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ public class ReadOnlyFileSystem : IFileSystem
|
|||||||
base.Dispose();
|
base.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, in Path path, OpenMode mode)
|
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, ref readonly Path path, OpenMode mode)
|
||||||
{
|
{
|
||||||
// The Read flag must be the only flag set
|
// The Read flag must be the only flag set
|
||||||
if ((mode & OpenMode.All) != OpenMode.Read)
|
if ((mode & OpenMode.All) != OpenMode.Read)
|
||||||
@ -104,40 +104,40 @@ public class ReadOnlyFileSystem : IFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, in Path path,
|
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, ref readonly Path path,
|
||||||
OpenDirectoryMode mode)
|
OpenDirectoryMode mode)
|
||||||
{
|
{
|
||||||
// An IDirectory is already read-only so we don't need a wrapper ReadOnlyDictionary class
|
// An IDirectory is already read-only so we don't need a wrapper ReadOnlyDictionary class
|
||||||
return _baseFileSystem.Get.OpenDirectory(ref outDirectory, in path, mode);
|
return _baseFileSystem.Get.OpenDirectory(ref outDirectory, in path, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
protected override Result DoGetEntryType(out DirectoryEntryType entryType, ref readonly Path path)
|
||||||
{
|
{
|
||||||
return _baseFileSystem.Get.GetEntryType(out entryType, in path);
|
return _baseFileSystem.Get.GetEntryType(out entryType, in path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option) =>
|
protected override Result DoCreateFile(ref readonly Path path, long size, CreateFileOptions option) =>
|
||||||
ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||||
|
|
||||||
protected override Result DoDeleteFile(in Path path) =>
|
protected override Result DoDeleteFile(ref readonly Path path) =>
|
||||||
ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||||
|
|
||||||
protected override Result DoCreateDirectory(in Path path) =>
|
protected override Result DoCreateDirectory(ref readonly Path path) =>
|
||||||
ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||||
|
|
||||||
protected override Result DoDeleteDirectory(in Path path) =>
|
protected override Result DoDeleteDirectory(ref readonly Path path) =>
|
||||||
ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||||
|
|
||||||
protected override Result DoDeleteDirectoryRecursively(in Path path) =>
|
protected override Result DoDeleteDirectoryRecursively(ref readonly Path path) =>
|
||||||
ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||||
|
|
||||||
protected override Result DoCleanDirectoryRecursively(in Path path) =>
|
protected override Result DoCleanDirectoryRecursively(ref readonly Path path) =>
|
||||||
ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||||
|
|
||||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath) =>
|
protected override Result DoRenameFile(ref readonly Path currentPath, ref readonly Path newPath) =>
|
||||||
ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||||
|
|
||||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath) =>
|
protected override Result DoRenameDirectory(ref readonly Path currentPath, ref readonly Path newPath) =>
|
||||||
ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||||
|
|
||||||
protected override Result DoCommit() =>
|
protected override Result DoCommit() =>
|
||||||
@ -146,12 +146,12 @@ public class ReadOnlyFileSystem : IFileSystem
|
|||||||
protected override Result DoCommitProvisionally(long counter) =>
|
protected override Result DoCommitProvisionally(long counter) =>
|
||||||
ResultFs.UnsupportedCommitProvisionallyForReadOnlyFileSystem.Log();
|
ResultFs.UnsupportedCommitProvisionallyForReadOnlyFileSystem.Log();
|
||||||
|
|
||||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, in Path path)
|
protected override Result DoGetFreeSpaceSize(out long freeSpace, ref readonly Path path)
|
||||||
{
|
{
|
||||||
return _baseFileSystem.Get.GetFreeSpaceSize(out freeSpace, in path);
|
return _baseFileSystem.Get.GetFreeSpaceSize(out freeSpace, in path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, in Path path)
|
protected override Result DoGetTotalSpaceSize(out long totalSpace, ref readonly Path path)
|
||||||
{
|
{
|
||||||
Unsafe.SkipInit(out totalSpace);
|
Unsafe.SkipInit(out totalSpace);
|
||||||
return ResultFs.UnsupportedGetTotalSpaceSizeForReadOnlyFileSystem.Log();
|
return ResultFs.UnsupportedGetTotalSpaceSizeForReadOnlyFileSystem.Log();
|
||||||
|
@ -123,7 +123,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||||||
{
|
{
|
||||||
private SharedRef<IFileSystemSf> _baseFs;
|
private SharedRef<IFileSystemSf> _baseFs;
|
||||||
|
|
||||||
private static Result GetPathForServiceObject(out PathSf sfPath, in Path path)
|
private static Result GetPathForServiceObject(out PathSf sfPath, ref readonly Path path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out sfPath);
|
UnsafeHelpers.SkipParamInit(out sfPath);
|
||||||
|
|
||||||
@ -147,7 +147,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||||||
base.Dispose();
|
base.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option)
|
protected override Result DoCreateFile(ref readonly Path path, long size, CreateFileOptions option)
|
||||||
{
|
{
|
||||||
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -155,7 +155,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||||||
return _baseFs.Get.CreateFile(in sfPath, size, (int)option);
|
return _baseFs.Get.CreateFile(in sfPath, size, (int)option);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteFile(in Path path)
|
protected override Result DoDeleteFile(ref readonly Path path)
|
||||||
{
|
{
|
||||||
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -163,7 +163,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||||||
return _baseFs.Get.DeleteFile(in sfPath);
|
return _baseFs.Get.DeleteFile(in sfPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCreateDirectory(in Path path)
|
protected override Result DoCreateDirectory(ref readonly Path path)
|
||||||
{
|
{
|
||||||
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -171,7 +171,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||||||
return _baseFs.Get.CreateDirectory(in sfPath);
|
return _baseFs.Get.CreateDirectory(in sfPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteDirectory(in Path path)
|
protected override Result DoDeleteDirectory(ref readonly Path path)
|
||||||
{
|
{
|
||||||
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -179,7 +179,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||||||
return _baseFs.Get.DeleteDirectory(in sfPath);
|
return _baseFs.Get.DeleteDirectory(in sfPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
protected override Result DoDeleteDirectoryRecursively(ref readonly Path path)
|
||||||
{
|
{
|
||||||
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -187,7 +187,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||||||
return _baseFs.Get.DeleteDirectoryRecursively(in sfPath);
|
return _baseFs.Get.DeleteDirectoryRecursively(in sfPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
protected override Result DoCleanDirectoryRecursively(ref readonly Path path)
|
||||||
{
|
{
|
||||||
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -195,7 +195,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||||||
return _baseFs.Get.CleanDirectoryRecursively(in sfPath);
|
return _baseFs.Get.CleanDirectoryRecursively(in sfPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath)
|
protected override Result DoRenameFile(ref readonly Path currentPath, ref readonly Path newPath)
|
||||||
{
|
{
|
||||||
Result res = GetPathForServiceObject(out PathSf currentSfPath, in currentPath);
|
Result res = GetPathForServiceObject(out PathSf currentSfPath, in currentPath);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -206,7 +206,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||||||
return _baseFs.Get.RenameFile(in currentSfPath, in newSfPath);
|
return _baseFs.Get.RenameFile(in currentSfPath, in newSfPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath)
|
protected override Result DoRenameDirectory(ref readonly Path currentPath, ref readonly Path newPath)
|
||||||
{
|
{
|
||||||
Result res = GetPathForServiceObject(out PathSf currentSfPath, in currentPath);
|
Result res = GetPathForServiceObject(out PathSf currentSfPath, in currentPath);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -217,7 +217,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||||||
return _baseFs.Get.RenameDirectory(in currentSfPath, in newSfPath);
|
return _baseFs.Get.RenameDirectory(in currentSfPath, in newSfPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
protected override Result DoGetEntryType(out DirectoryEntryType entryType, ref readonly Path path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out entryType);
|
UnsafeHelpers.SkipParamInit(out entryType);
|
||||||
|
|
||||||
@ -229,7 +229,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||||||
return _baseFs.Get.GetEntryType(out sfEntryType, in sfPath);
|
return _baseFs.Get.GetEntryType(out sfEntryType, in sfPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, in Path path)
|
protected override Result DoGetFreeSpaceSize(out long freeSpace, ref readonly Path path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out freeSpace);
|
UnsafeHelpers.SkipParamInit(out freeSpace);
|
||||||
|
|
||||||
@ -239,7 +239,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||||||
return _baseFs.Get.GetFreeSpaceSize(out freeSpace, in sfPath);
|
return _baseFs.Get.GetFreeSpaceSize(out freeSpace, in sfPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, in Path path)
|
protected override Result DoGetTotalSpaceSize(out long totalSpace, ref readonly Path path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out totalSpace);
|
UnsafeHelpers.SkipParamInit(out totalSpace);
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||||||
return _baseFs.Get.GetTotalSpaceSize(out totalSpace, in sfPath);
|
return _baseFs.Get.GetTotalSpaceSize(out totalSpace, in sfPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, in Path path, OpenMode mode)
|
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, ref readonly Path path, OpenMode mode)
|
||||||
{
|
{
|
||||||
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -263,7 +263,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, in Path path,
|
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, ref readonly Path path,
|
||||||
OpenDirectoryMode mode)
|
OpenDirectoryMode mode)
|
||||||
{
|
{
|
||||||
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||||
@ -283,7 +283,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||||||
return _baseFs.Get.Commit();
|
return _baseFs.Get.Commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, in Path path)
|
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, ref readonly Path path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out timeStamp);
|
UnsafeHelpers.SkipParamInit(out timeStamp);
|
||||||
|
|
||||||
@ -299,7 +299,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
||||||
in Path path)
|
ref readonly Path path)
|
||||||
{
|
{
|
||||||
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
@ -37,7 +37,7 @@ public static class Host
|
|||||||
/// <param name="option">Options for opening the host file system.</param>
|
/// <param name="option">Options for opening the host file system.</param>
|
||||||
/// <returns>The <see cref="Result"/> of the operation.</returns>
|
/// <returns>The <see cref="Result"/> of the operation.</returns>
|
||||||
private static Result OpenHostFileSystemImpl(FileSystemClient fs, ref UniqueRef<IFileSystem> outFileSystem,
|
private static Result OpenHostFileSystemImpl(FileSystemClient fs, ref UniqueRef<IFileSystem> outFileSystem,
|
||||||
in FspPath path, MountHostOption option)
|
ref readonly FspPath path, MountHostOption option)
|
||||||
{
|
{
|
||||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||||
|
@ -19,7 +19,7 @@ public static class PathBasedFileDataCacheShim
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal static void InvalidatePathBasedFileDataCacheEntry(this FileSystemClientImpl fs,
|
internal static void InvalidatePathBasedFileDataCacheEntry(this FileSystemClientImpl fs,
|
||||||
FileSystemAccessor fsAccessor, in Path path)
|
FileSystemAccessor fsAccessor, ref readonly Path path)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
@ -31,7 +31,7 @@ public static class PathBasedFileDataCacheShim
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal static bool FindPathBasedFileDataCacheEntry(this FileSystemClientImpl fs, out FilePathHash outHash,
|
internal static bool FindPathBasedFileDataCacheEntry(this FileSystemClientImpl fs, out FilePathHash outHash,
|
||||||
out int outHashIndex, FileSystemAccessor fsAccessor, in Path path)
|
out int outHashIndex, FileSystemAccessor fsAccessor, ref readonly Path path)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ namespace LibHac.Fs.Shim
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Result ReadSaveDataFileSystemExtraData(this FileSystemClientImpl fs,
|
public static Result ReadSaveDataFileSystemExtraData(this FileSystemClientImpl fs,
|
||||||
out SaveDataExtraData extraData, SaveDataSpaceId spaceId, in SaveDataAttribute attribute)
|
out SaveDataExtraData extraData, SaveDataSpaceId spaceId, SaveDataAttribute attribute)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out extraData);
|
UnsafeHelpers.SkipParamInit(out extraData);
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ namespace LibHac.Fs.Shim
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Result ReadSaveDataFileSystemExtraData(this FileSystemClientImpl fs,
|
public static Result ReadSaveDataFileSystemExtraData(this FileSystemClientImpl fs,
|
||||||
out SaveDataExtraData extraData, SaveDataSpaceId spaceId, in SaveDataAttribute attribute,
|
out SaveDataExtraData extraData, SaveDataSpaceId spaceId, SaveDataAttribute attribute,
|
||||||
in SaveDataExtraData extraDataMask)
|
in SaveDataExtraData extraDataMask)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out extraData);
|
UnsafeHelpers.SkipParamInit(out extraData);
|
||||||
@ -262,7 +262,7 @@ namespace LibHac.Fs.Shim
|
|||||||
/// to write to, nothing will be written and <see cref="ResultFs.PermissionDenied"/> will be returned.
|
/// to write to, nothing will be written and <see cref="ResultFs.PermissionDenied"/> will be returned.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public static Result WriteSaveDataFileSystemExtraData(this FileSystemClientImpl fs, SaveDataSpaceId spaceId,
|
public static Result WriteSaveDataFileSystemExtraData(this FileSystemClientImpl fs, SaveDataSpaceId spaceId,
|
||||||
in SaveDataAttribute attribute, in SaveDataExtraData extraData, in SaveDataExtraData extraDataMask)
|
SaveDataAttribute attribute, in SaveDataExtraData extraData, in SaveDataExtraData extraDataMask)
|
||||||
{
|
{
|
||||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.GetFileSystemProxyServiceObject();
|
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.GetFileSystemProxyServiceObject();
|
||||||
|
|
||||||
@ -1359,7 +1359,7 @@ namespace LibHac.Fs.Shim
|
|||||||
SaveDataType.System, userId, saveDataId);
|
SaveDataType.System, userId, saveDataId);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
res = fs.Impl.ReadSaveDataFileSystemExtraData(out SaveDataExtraData extraData, spaceId, in attribute);
|
res = fs.Impl.ReadSaveDataFileSystemExtraData(out SaveDataExtraData extraData, spaceId, attribute);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
flags = extraData.Flags;
|
flags = extraData.Flags;
|
||||||
@ -1456,7 +1456,7 @@ namespace LibHac.Fs.Shim
|
|||||||
SaveDataType.System, userId, saveDataId);
|
SaveDataType.System, userId, saveDataId);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
return fs.Impl.WriteSaveDataFileSystemExtraData(spaceId, in attribute, in extraData, in extraDataMask);
|
return fs.Impl.WriteSaveDataFileSystemExtraData(spaceId, attribute, in extraData, in extraDataMask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2253,7 +2253,7 @@ namespace LibHac.Fs.Shim
|
|||||||
extraDataMask.Flags = SaveDataFlags.Restore;
|
extraDataMask.Flags = SaveDataFlags.Restore;
|
||||||
|
|
||||||
res = fs.Impl.ReadSaveDataFileSystemExtraData(out SaveDataExtraData extraData, SaveDataSpaceId.User,
|
res = fs.Impl.ReadSaveDataFileSystemExtraData(out SaveDataExtraData extraData, SaveDataSpaceId.User,
|
||||||
in attribute, in extraDataMask);
|
attribute, in extraDataMask);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
isRestoreFlagSet = extraData.Flags.HasFlag(SaveDataFlags.Restore);
|
isRestoreFlagSet = extraData.Flags.HasFlag(SaveDataFlags.Restore);
|
||||||
@ -2303,7 +2303,7 @@ namespace LibHac.Fs.Shim
|
|||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
res = fs.Impl.ReadSaveDataFileSystemExtraData(out SaveDataExtraData extraData, SaveDataSpaceId.User,
|
res = fs.Impl.ReadSaveDataFileSystemExtraData(out SaveDataExtraData extraData, SaveDataSpaceId.User,
|
||||||
in attribute, in extraDataMask);
|
attribute, in extraDataMask);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
saveSize = extraData.DataSize;
|
saveSize = extraData.DataSize;
|
||||||
|
@ -26,7 +26,7 @@ public static class SdCard
|
|||||||
|
|
||||||
return OpenFileSystem(fs, in fileSystemProxy, ref outFileSystem);
|
return OpenFileSystem(fs, in fileSystemProxy, ref outFileSystem);
|
||||||
|
|
||||||
static Result OpenFileSystem(FileSystemClient fs, in SharedRef<IFileSystemProxy> fileSystemProxy,
|
static Result OpenFileSystem(FileSystemClient fs, ref readonly SharedRef<IFileSystemProxy> fileSystemProxy,
|
||||||
ref SharedRef<IFileSystemSf> outFileSystem)
|
ref SharedRef<IFileSystemSf> outFileSystem)
|
||||||
{
|
{
|
||||||
// Retry a few times if the storage device isn't ready yet
|
// Retry a few times if the storage device isn't ready yet
|
||||||
@ -261,7 +261,7 @@ public static class SdCard
|
|||||||
outMode = (SdCardSpeedMode)speedMode;
|
outMode = (SdCardSpeedMode)speedMode;
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
|
|
||||||
static Result GetSpeedMode(FileSystemClient fs, in SharedRef<IDeviceOperator> deviceOperator,
|
static Result GetSpeedMode(FileSystemClient fs, ref readonly SharedRef<IDeviceOperator> deviceOperator,
|
||||||
out long outSpeedMode)
|
out long outSpeedMode)
|
||||||
{
|
{
|
||||||
outSpeedMode = 0;
|
outSpeedMode = 0;
|
||||||
@ -305,7 +305,7 @@ public static class SdCard
|
|||||||
|
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
|
|
||||||
static Result GetCid(FileSystemClient fs, in SharedRef<IDeviceOperator> deviceOperator, Span<byte> outCidBuffer)
|
static Result GetCid(FileSystemClient fs, ref readonly SharedRef<IDeviceOperator> deviceOperator, Span<byte> outCidBuffer)
|
||||||
{
|
{
|
||||||
// Retry a few times if the storage device isn't ready yet
|
// Retry a few times if the storage device isn't ready yet
|
||||||
const int maxRetries = 10;
|
const int maxRetries = 10;
|
||||||
@ -348,7 +348,7 @@ public static class SdCard
|
|||||||
|
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
|
|
||||||
static Result GetUserAreaSize(FileSystemClient fs, in SharedRef<IDeviceOperator> deviceOperator,
|
static Result GetUserAreaSize(FileSystemClient fs, ref readonly SharedRef<IDeviceOperator> deviceOperator,
|
||||||
out long outSize)
|
out long outSize)
|
||||||
{
|
{
|
||||||
outSize = 0;
|
outSize = 0;
|
||||||
@ -394,7 +394,7 @@ public static class SdCard
|
|||||||
|
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
|
|
||||||
static Result GetProtectedAreaSize(FileSystemClient fs, in SharedRef<IDeviceOperator> deviceOperator,
|
static Result GetProtectedAreaSize(FileSystemClient fs, ref readonly SharedRef<IDeviceOperator> deviceOperator,
|
||||||
out long outSize)
|
out long outSize)
|
||||||
{
|
{
|
||||||
outSize = 0;
|
outSize = 0;
|
||||||
@ -442,7 +442,7 @@ public static class SdCard
|
|||||||
outLogSize = logSize;
|
outLogSize = logSize;
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
|
|
||||||
static Result GetErrorInfo(FileSystemClient fs, in SharedRef<IDeviceOperator> deviceOperator,
|
static Result GetErrorInfo(FileSystemClient fs, ref readonly SharedRef<IDeviceOperator> deviceOperator,
|
||||||
out StorageErrorInfo outErrorInfo, out long outLogSize, Span<byte> logBuffer)
|
out StorageErrorInfo outErrorInfo, out long outLogSize, Span<byte> logBuffer)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out outErrorInfo, out outLogSize);
|
UnsafeHelpers.SkipParamInit(out outErrorInfo, out outLogSize);
|
||||||
@ -482,7 +482,7 @@ public static class SdCard
|
|||||||
|
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
|
|
||||||
static Result Format(FileSystemClient fs, in SharedRef<IFileSystemProxy> fileSystemProxy)
|
static Result Format(FileSystemClient fs, ref readonly SharedRef<IFileSystemProxy> fileSystemProxy)
|
||||||
{
|
{
|
||||||
// Retry a few times if the storage device isn't ready yet
|
// Retry a few times if the storage device isn't ready yet
|
||||||
const int maxRetries = 10;
|
const int maxRetries = 10;
|
||||||
|
@ -106,7 +106,7 @@ public class SubStorage : IStorage
|
|||||||
/// <param name="baseStorage">The base <see cref="IStorage"/>.</param>
|
/// <param name="baseStorage">The base <see cref="IStorage"/>.</param>
|
||||||
/// <param name="offset">The offset in the base storage at which to begin the created SubStorage.</param>
|
/// <param name="offset">The offset in the base storage at which to begin the created SubStorage.</param>
|
||||||
/// <param name="size">The size of the created SubStorage.</param>
|
/// <param name="size">The size of the created SubStorage.</param>
|
||||||
public SubStorage(in SharedRef<IStorage> baseStorage, long offset, long size)
|
public SubStorage(ref readonly SharedRef<IStorage> baseStorage, long offset, long size)
|
||||||
{
|
{
|
||||||
BaseStorage = baseStorage.Get;
|
BaseStorage = baseStorage.Get;
|
||||||
_offset = offset;
|
_offset = offset;
|
||||||
|
@ -23,7 +23,7 @@ public struct ValueSubStorage : IDisposable
|
|||||||
_sharedBaseStorage = new SharedRef<IStorage>();
|
_sharedBaseStorage = new SharedRef<IStorage>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValueSubStorage(in ValueSubStorage other)
|
public ValueSubStorage(ref readonly ValueSubStorage other)
|
||||||
{
|
{
|
||||||
_baseStorage = other._baseStorage;
|
_baseStorage = other._baseStorage;
|
||||||
_offset = other._offset;
|
_offset = other._offset;
|
||||||
@ -45,7 +45,7 @@ public struct ValueSubStorage : IDisposable
|
|||||||
Assert.SdkRequiresLessEqual(0, size);
|
Assert.SdkRequiresLessEqual(0, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValueSubStorage(in ValueSubStorage subStorage, long offset, long size)
|
public ValueSubStorage(ref readonly ValueSubStorage subStorage, long offset, long size)
|
||||||
{
|
{
|
||||||
_baseStorage = subStorage._baseStorage;
|
_baseStorage = subStorage._baseStorage;
|
||||||
_offset = subStorage._offset + offset;
|
_offset = subStorage._offset + offset;
|
||||||
@ -59,7 +59,7 @@ public struct ValueSubStorage : IDisposable
|
|||||||
Assert.SdkRequiresGreaterEqual(subStorage._size, offset + size);
|
Assert.SdkRequiresGreaterEqual(subStorage._size, offset + size);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ValueSubStorage(in SharedRef<IStorage> baseStorage, long offset, long size)
|
public ValueSubStorage(ref readonly SharedRef<IStorage> baseStorage, long offset, long size)
|
||||||
{
|
{
|
||||||
_baseStorage = baseStorage.Get;
|
_baseStorage = baseStorage.Get;
|
||||||
_offset = offset;
|
_offset = offset;
|
||||||
@ -88,7 +88,7 @@ public struct ValueSubStorage : IDisposable
|
|||||||
return new SubStorage(_baseStorage, _offset, _size);
|
return new SubStorage(_baseStorage, _offset, _size);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Set(in ValueSubStorage other)
|
public void Set(ref readonly ValueSubStorage other)
|
||||||
{
|
{
|
||||||
if (!Unsafe.AreSame(ref Unsafe.AsRef(in this), ref Unsafe.AsRef(in other)))
|
if (!Unsafe.AreSame(ref Unsafe.AsRef(in this), ref Unsafe.AsRef(in other)))
|
||||||
{
|
{
|
||||||
|
@ -85,7 +85,7 @@ public readonly struct BaseFileSystemService
|
|||||||
return _serviceImpl.FormatBaseFileSystem(fileSystemId);
|
return _serviceImpl.FormatBaseFileSystem(fileSystemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenBisFileSystem(ref SharedRef<IFileSystemSf> outFileSystem, in FspPath rootPath,
|
public Result OpenBisFileSystem(ref SharedRef<IFileSystemSf> outFileSystem, ref readonly FspPath rootPath,
|
||||||
BisPartitionId partitionId)
|
BisPartitionId partitionId)
|
||||||
{
|
{
|
||||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||||
@ -150,7 +150,7 @@ public readonly struct BaseFileSystemService
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result SetBisRootForHost(BisPartitionId partitionId, in FspPath path)
|
public Result SetBisRootForHost(BisPartitionId partitionId, ref readonly FspPath path)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ public class FileSystemProxyCoreImpl
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Result OpenHostFileSystem(ref SharedRef<IFileSystem> outFileSystem, in Path path)
|
private Result OpenHostFileSystem(ref SharedRef<IFileSystem> outFileSystem, ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var pathHost = new Path();
|
using var pathHost = new Path();
|
||||||
Result res = pathHost.Initialize(in path);
|
Result res = pathHost.Initialize(in path);
|
||||||
@ -88,13 +88,13 @@ public class FileSystemProxyCoreImpl
|
|||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
res = _fsCreators.TargetManagerFileSystemCreator.Create(ref outFileSystem, in pathHost, isSupported,
|
res = _fsCreators.TargetManagerFileSystemCreator.Create(ref outFileSystem, in pathHost, isSupported,
|
||||||
ensureRootPathExists: false, Result.Success);
|
ensureRootPathExists: false, pathNotFoundResult: Result.Success);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenHostFileSystem(ref SharedRef<IFileSystem> outFileSystem, in Path path,
|
public Result OpenHostFileSystem(ref SharedRef<IFileSystem> outFileSystem, ref readonly Path path,
|
||||||
bool openCaseSensitive)
|
bool openCaseSensitive)
|
||||||
{
|
{
|
||||||
if (!path.IsEmpty() && openCaseSensitive)
|
if (!path.IsEmpty() && openCaseSensitive)
|
||||||
@ -105,7 +105,7 @@ public class FileSystemProxyCoreImpl
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Result res = _fsCreators.TargetManagerFileSystemCreator.Create(ref outFileSystem, in path,
|
Result res = _fsCreators.TargetManagerFileSystemCreator.Create(ref outFileSystem, in path,
|
||||||
openCaseSensitive, ensureRootPathExists: false, Result.Success);
|
openCaseSensitive, ensureRootPathExists: false, pathNotFoundResult: Result.Success);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
|||||||
return new DebugConfigurationService(_fsServer, Globals.DebugConfigurationServiceImpl, _currentProcess);
|
return new DebugConfigurationService(_fsServer, Globals.DebugConfigurationServiceImpl, _currentProcess);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenFileSystemWithId(ref SharedRef<IFileSystemSf> outFileSystem, in FspPath path,
|
public Result OpenFileSystemWithId(ref SharedRef<IFileSystemSf> outFileSystem, ref readonly FspPath path,
|
||||||
ulong id, FileSystemProxyType fsType)
|
ulong id, FileSystemProxyType fsType)
|
||||||
{
|
{
|
||||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||||
@ -172,7 +172,7 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenCodeFileSystem(ref SharedRef<IFileSystemSf> fileSystem,
|
public Result OpenCodeFileSystem(ref SharedRef<IFileSystemSf> fileSystem,
|
||||||
out CodeVerificationData verificationData, in FspPath path, ProgramId programId)
|
out CodeVerificationData verificationData, ref readonly FspPath path, ProgramId programId)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out verificationData);
|
UnsafeHelpers.SkipParamInit(out verificationData);
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
|||||||
return ncaFsService.OpenDataStorageByDataId(ref outStorage, dataId, storageId);
|
return ncaFsService.OpenDataStorageByDataId(ref outStorage, dataId, storageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenDataStorageByPath(ref SharedRef<IFileSystemSf> outFileSystem, in FspPath path,
|
public Result OpenDataStorageByPath(ref SharedRef<IFileSystemSf> outFileSystem, ref readonly FspPath path,
|
||||||
FileSystemProxyType fsType)
|
FileSystemProxyType fsType)
|
||||||
{
|
{
|
||||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||||
@ -478,7 +478,7 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
|||||||
return GetBaseFileSystemService().FormatBaseFileSystem(fileSystemId);
|
return GetBaseFileSystemService().FormatBaseFileSystem(fileSystemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenBisFileSystem(ref SharedRef<IFileSystemSf> outFileSystem, in FspPath rootPath,
|
public Result OpenBisFileSystem(ref SharedRef<IFileSystemSf> outFileSystem, ref readonly FspPath rootPath,
|
||||||
BisPartitionId partitionId)
|
BisPartitionId partitionId)
|
||||||
{
|
{
|
||||||
return GetBaseFileSystemService().OpenBisFileSystem(ref outFileSystem, in rootPath, partitionId);
|
return GetBaseFileSystemService().OpenBisFileSystem(ref outFileSystem, in rootPath, partitionId);
|
||||||
@ -494,13 +494,13 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
|||||||
return GetBaseStorageService().InvalidateBisCache();
|
return GetBaseStorageService().InvalidateBisCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenHostFileSystem(ref SharedRef<IFileSystemSf> outFileSystem, in FspPath path)
|
public Result OpenHostFileSystem(ref SharedRef<IFileSystemSf> outFileSystem, ref readonly FspPath path)
|
||||||
{
|
{
|
||||||
return OpenHostFileSystemWithOption(ref outFileSystem, in path, MountHostOption.None);
|
return OpenHostFileSystemWithOption(ref outFileSystem, in path, MountHostOption.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenHostFileSystemWithOption(ref SharedRef<IFileSystemSf> outFileSystem,
|
public Result OpenHostFileSystemWithOption(ref SharedRef<IFileSystemSf> outFileSystem,
|
||||||
in FspPath path, MountHostOption option)
|
ref readonly FspPath path, MountHostOption option)
|
||||||
{
|
{
|
||||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -783,7 +783,7 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result SetSaveDataRootPath(in FspPath path)
|
public Result SetSaveDataRootPath(ref readonly FspPath path)
|
||||||
{
|
{
|
||||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -919,12 +919,13 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
|||||||
return ncaFsService.GetRightsId(out rightsId, programId, storageId);
|
return ncaFsService.GetRightsId(out rightsId, programId, storageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result GetRightsIdByPath(out RightsId rightsId, in FspPath path)
|
public Result GetRightsIdByPath(out RightsId rightsId, ref readonly FspPath path)
|
||||||
{
|
{
|
||||||
return GetRightsIdAndKeyGenerationByPath(out rightsId, out _, in path);
|
return GetRightsIdAndKeyGenerationByPath(out rightsId, out _, in path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result GetRightsIdAndKeyGenerationByPath(out RightsId rightsId, out byte keyGeneration, in FspPath path)
|
public Result GetRightsIdAndKeyGenerationByPath(out RightsId rightsId, out byte keyGeneration,
|
||||||
|
ref readonly FspPath path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out rightsId, out keyGeneration);
|
UnsafeHelpers.SkipParamInit(out rightsId, out keyGeneration);
|
||||||
|
|
||||||
@ -992,7 +993,7 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
|||||||
.RegisterProgramIndexMapInfo(programIndexMapInfoBuffer, programCount);
|
.RegisterProgramIndexMapInfo(programIndexMapInfoBuffer, programCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result SetBisRootForHost(BisPartitionId partitionId, in FspPath path)
|
public Result SetBisRootForHost(BisPartitionId partitionId, ref readonly FspPath path)
|
||||||
{
|
{
|
||||||
return GetBaseFileSystemService().SetBisRootForHost(partitionId, in path);
|
return GetBaseFileSystemService().SetBisRootForHost(partitionId, in path);
|
||||||
}
|
}
|
||||||
|
@ -6,5 +6,5 @@ namespace LibHac.FsSrv.FsCreator;
|
|||||||
|
|
||||||
public interface ILocalFileSystemCreator
|
public interface ILocalFileSystemCreator
|
||||||
{
|
{
|
||||||
Result Create(ref SharedRef<IFileSystem> outFileSystem, in Path rootPath, bool openCaseSensitive, bool ensureRootPathExists, Result pathNotFoundResult);
|
Result Create(ref SharedRef<IFileSystem> outFileSystem, ref readonly Path rootPath, bool openCaseSensitive, bool ensureRootPathExists, Result pathNotFoundResult);
|
||||||
}
|
}
|
@ -6,5 +6,5 @@ namespace LibHac.FsSrv.FsCreator;
|
|||||||
|
|
||||||
public interface ISubDirectoryFileSystemCreator
|
public interface ISubDirectoryFileSystemCreator
|
||||||
{
|
{
|
||||||
Result Create(ref SharedRef<IFileSystem> outSubDirFileSystem, ref SharedRef<IFileSystem> baseFileSystem, in Path path);
|
Result Create(ref SharedRef<IFileSystem> outSubDirFileSystem, ref SharedRef<IFileSystem> baseFileSystem, ref readonly Path path);
|
||||||
}
|
}
|
@ -6,6 +6,6 @@ namespace LibHac.FsSrv.FsCreator;
|
|||||||
|
|
||||||
public interface ITargetManagerFileSystemCreator
|
public interface ITargetManagerFileSystemCreator
|
||||||
{
|
{
|
||||||
Result Create(ref SharedRef<IFileSystem> outFileSystem, in Path rootPath, bool openCaseSensitive, bool ensureRootPathExists, Result pathNotFoundResult);
|
Result Create(ref SharedRef<IFileSystem> outFileSystem, ref readonly Path rootPath, bool openCaseSensitive, bool ensureRootPathExists, Result pathNotFoundResult);
|
||||||
Result NormalizeCaseOfPath(out bool isSupported, ref Path path);
|
Result NormalizeCaseOfPath(out bool isSupported, ref Path path);
|
||||||
}
|
}
|
@ -82,7 +82,7 @@ public class SaveDataResultConvertFileSystem : IResultConvertFileSystem<ISaveDat
|
|||||||
return ConvertSaveDataFsResult(GetFileSystem().RollbackOnlyModified(), _isReconstructible).Ret();
|
return ConvertSaveDataFsResult(GetFileSystem().RollbackOnlyModified(), _isReconstructible).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, in Path path, OpenMode mode)
|
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, ref readonly Path path, OpenMode mode)
|
||||||
{
|
{
|
||||||
using var file = new UniqueRef<IFile>();
|
using var file = new UniqueRef<IFile>();
|
||||||
Result res = ConvertResult(GetFileSystem().OpenFile(ref file.Ref, in path, mode));
|
Result res = ConvertResult(GetFileSystem().OpenFile(ref file.Ref, in path, mode));
|
||||||
@ -95,7 +95,7 @@ public class SaveDataResultConvertFileSystem : IResultConvertFileSystem<ISaveDat
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, in Path path,
|
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, ref readonly Path path,
|
||||||
OpenDirectoryMode mode)
|
OpenDirectoryMode mode)
|
||||||
{
|
{
|
||||||
using var directory = new UniqueRef<IDirectory>();
|
using var directory = new UniqueRef<IDirectory>();
|
||||||
|
@ -8,7 +8,7 @@ namespace LibHac.FsSrv.FsCreator;
|
|||||||
public class SubDirectoryFileSystemCreator : ISubDirectoryFileSystemCreator
|
public class SubDirectoryFileSystemCreator : ISubDirectoryFileSystemCreator
|
||||||
{
|
{
|
||||||
public Result Create(ref SharedRef<IFileSystem> outSubDirFileSystem, ref SharedRef<IFileSystem> baseFileSystem,
|
public Result Create(ref SharedRef<IFileSystem> outSubDirFileSystem, ref SharedRef<IFileSystem> baseFileSystem,
|
||||||
in Path path)
|
ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var directory = new UniqueRef<IDirectory>();
|
using var directory = new UniqueRef<IDirectory>();
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ namespace LibHac.FsSrv.FsCreator;
|
|||||||
|
|
||||||
public class TargetManagerFileSystemCreator : ITargetManagerFileSystemCreator
|
public class TargetManagerFileSystemCreator : ITargetManagerFileSystemCreator
|
||||||
{
|
{
|
||||||
public Result Create(ref SharedRef<IFileSystem> outFileSystem, in Path rootPath, bool openCaseSensitive,
|
public Result Create(ref SharedRef<IFileSystem> outFileSystem, ref readonly Path rootPath, bool openCaseSensitive,
|
||||||
bool ensureRootPathExists, Result pathNotFoundResult)
|
bool ensureRootPathExists, Result pathNotFoundResult)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
@ -12,9 +12,9 @@ public class AsynchronousAccessFileSystem : ForwardingFileSystem
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
// ReSharper disable once RedundantOverriddenMember
|
// ReSharper disable once RedundantOverriddenMember
|
||||||
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, in Path path, OpenMode mode)
|
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, ref readonly Path path, OpenMode mode)
|
||||||
{
|
{
|
||||||
// Todo: Implement
|
// Todo: Implement
|
||||||
return base.DoOpenFile(ref outFile, path, mode);
|
return base.DoOpenFile(ref outFile, in path, mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -36,9 +36,9 @@ public class DeepRetryFileSystem : ForwardingFileSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ReSharper disable once RedundantOverriddenMember
|
// ReSharper disable once RedundantOverriddenMember
|
||||||
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, in Path path, OpenMode mode)
|
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, ref readonly Path path, OpenMode mode)
|
||||||
{
|
{
|
||||||
// Todo: Implement
|
// Todo: Implement
|
||||||
return base.DoOpenFile(ref outFile, path, mode);
|
return base.DoOpenFile(ref outFile, in path, mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -295,7 +295,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||||||
|
|
||||||
private static ReadOnlySpan<byte> RootDir => "/"u8;
|
private static ReadOnlySpan<byte> RootDir => "/"u8;
|
||||||
|
|
||||||
private Result SetUpPath(ref Path fsPath, in PathSf sfPath)
|
private Result SetUpPath(ref Path fsPath, ref readonly PathSf sfPath)
|
||||||
{
|
{
|
||||||
Result res;
|
Result res;
|
||||||
|
|
||||||
@ -316,7 +316,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result CreateFile(in PathSf path, long size, int option)
|
public Result CreateFile(ref readonly PathSf path, long size, int option)
|
||||||
{
|
{
|
||||||
if (size < 0)
|
if (size < 0)
|
||||||
return ResultFs.InvalidSize.Log();
|
return ResultFs.InvalidSize.Log();
|
||||||
@ -331,7 +331,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result DeleteFile(in PathSf path)
|
public Result DeleteFile(ref readonly PathSf path)
|
||||||
{
|
{
|
||||||
using var pathNormalized = new Path();
|
using var pathNormalized = new Path();
|
||||||
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||||
@ -343,7 +343,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result CreateDirectory(in PathSf path)
|
public Result CreateDirectory(ref readonly PathSf path)
|
||||||
{
|
{
|
||||||
using var pathNormalized = new Path();
|
using var pathNormalized = new Path();
|
||||||
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||||
@ -358,7 +358,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result DeleteDirectory(in PathSf path)
|
public Result DeleteDirectory(ref readonly PathSf path)
|
||||||
{
|
{
|
||||||
using var pathNormalized = new Path();
|
using var pathNormalized = new Path();
|
||||||
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||||
@ -373,7 +373,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result DeleteDirectoryRecursively(in PathSf path)
|
public Result DeleteDirectoryRecursively(ref readonly PathSf path)
|
||||||
{
|
{
|
||||||
using var pathNormalized = new Path();
|
using var pathNormalized = new Path();
|
||||||
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||||
@ -388,7 +388,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result CleanDirectoryRecursively(in PathSf path)
|
public Result CleanDirectoryRecursively(ref readonly PathSf path)
|
||||||
{
|
{
|
||||||
using var pathNormalized = new Path();
|
using var pathNormalized = new Path();
|
||||||
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||||
@ -400,7 +400,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result RenameFile(in PathSf currentPath, in PathSf newPath)
|
public Result RenameFile(ref readonly PathSf currentPath, ref readonly PathSf newPath)
|
||||||
{
|
{
|
||||||
using var currentPathNormalized = new Path();
|
using var currentPathNormalized = new Path();
|
||||||
Result res = SetUpPath(ref currentPathNormalized.Ref(), in currentPath);
|
Result res = SetUpPath(ref currentPathNormalized.Ref(), in currentPath);
|
||||||
@ -416,7 +416,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result RenameDirectory(in PathSf currentPath, in PathSf newPath)
|
public Result RenameDirectory(ref readonly PathSf currentPath, ref readonly PathSf newPath)
|
||||||
{
|
{
|
||||||
using var currentPathNormalized = new Path();
|
using var currentPathNormalized = new Path();
|
||||||
Result res = SetUpPath(ref currentPathNormalized.Ref(), in currentPath);
|
Result res = SetUpPath(ref currentPathNormalized.Ref(), in currentPath);
|
||||||
@ -435,7 +435,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result GetEntryType(out uint entryType, in PathSf path)
|
public Result GetEntryType(out uint entryType, ref readonly PathSf path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out entryType);
|
UnsafeHelpers.SkipParamInit(out entryType);
|
||||||
|
|
||||||
@ -450,7 +450,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result GetFreeSpaceSize(out long freeSpace, in PathSf path)
|
public Result GetFreeSpaceSize(out long freeSpace, ref readonly PathSf path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out freeSpace);
|
UnsafeHelpers.SkipParamInit(out freeSpace);
|
||||||
|
|
||||||
@ -465,7 +465,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result GetTotalSpaceSize(out long totalSpace, in PathSf path)
|
public Result GetTotalSpaceSize(out long totalSpace, ref readonly PathSf path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out totalSpace);
|
UnsafeHelpers.SkipParamInit(out totalSpace);
|
||||||
|
|
||||||
@ -480,7 +480,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenFile(ref SharedRef<IFileSf> outFile, in PathSf path, uint mode)
|
public Result OpenFile(ref SharedRef<IFileSf> outFile, ref readonly PathSf path, uint mode)
|
||||||
{
|
{
|
||||||
const int maxTryCount = 2;
|
const int maxTryCount = 2;
|
||||||
|
|
||||||
@ -510,7 +510,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenDirectory(ref SharedRef<IDirectorySf> outDirectory, in PathSf path, uint mode)
|
public Result OpenDirectory(ref SharedRef<IDirectorySf> outDirectory, ref readonly PathSf path, uint mode)
|
||||||
{
|
{
|
||||||
const int maxTryCount = 2;
|
const int maxTryCount = 2;
|
||||||
|
|
||||||
@ -546,7 +546,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||||||
return _baseFileSystem.Get.Commit();
|
return _baseFileSystem.Get.Commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result GetFileTimeStampRaw(out FileTimeStampRaw timeStamp, in PathSf path)
|
public Result GetFileTimeStampRaw(out FileTimeStampRaw timeStamp, ref readonly PathSf path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out timeStamp);
|
UnsafeHelpers.SkipParamInit(out timeStamp);
|
||||||
|
|
||||||
@ -561,7 +561,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result QueryEntry(OutBuffer outBuffer, InBuffer inBuffer, int queryId, in PathSf path)
|
public Result QueryEntry(OutBuffer outBuffer, InBuffer inBuffer, int queryId, ref readonly PathSf path)
|
||||||
{
|
{
|
||||||
static Result PermissionCheck(QueryId queryId, FileSystemInterfaceAdapter fsAdapter)
|
static Result PermissionCheck(QueryId queryId, FileSystemInterfaceAdapter fsAdapter)
|
||||||
{
|
{
|
||||||
|
@ -48,7 +48,7 @@ public static class FileSystemProxyServiceObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenCodeFileSystem(ref SharedRef<IFileSystem> fileSystem,
|
public Result OpenCodeFileSystem(ref SharedRef<IFileSystem> fileSystem,
|
||||||
out CodeVerificationData verificationData, in FspPath path, ProgramId programId)
|
out CodeVerificationData verificationData, ref readonly FspPath path, ProgramId programId)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out verificationData);
|
UnsafeHelpers.SkipParamInit(out verificationData);
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ public interface ISaveDataTransferCoreInterface : IDisposable
|
|||||||
Result QuerySaveDataTotalSize(out long outTotalSize, long dataSize, long journalSize);
|
Result QuerySaveDataTotalSize(out long outTotalSize, long dataSize, long journalSize);
|
||||||
Result CheckSaveDataFile(long saveDataId, SaveDataSpaceId spaceId);
|
Result CheckSaveDataFile(long saveDataId, SaveDataSpaceId spaceId);
|
||||||
Result CreateSaveDataFileSystemCore(in SaveDataAttribute attribute, in SaveDataCreationInfo creationInfo, in SaveDataMetaInfo metaInfo, in Optional<HashSalt> hashSalt, bool leaveUnfinalized);
|
Result CreateSaveDataFileSystemCore(in SaveDataAttribute attribute, in SaveDataCreationInfo creationInfo, in SaveDataMetaInfo metaInfo, in Optional<HashSalt> hashSalt, bool leaveUnfinalized);
|
||||||
Result GetSaveDataInfo(out SaveDataInfo saveInfo, SaveDataSpaceId spaceId, in SaveDataAttribute attribute);
|
Result GetSaveDataInfo(out SaveDataInfo saveInfo, SaveDataSpaceId spaceId, SaveDataAttribute attribute);
|
||||||
Result ReadSaveDataFileSystemExtraDataCore(out SaveDataExtraData extraData, SaveDataSpaceId spaceId, ulong saveDataId, bool isTemporarySaveData);
|
Result ReadSaveDataFileSystemExtraDataCore(out SaveDataExtraData extraData, SaveDataSpaceId spaceId, ulong saveDataId, bool isTemporarySaveData);
|
||||||
Result WriteSaveDataFileSystemExtraDataCore(SaveDataSpaceId spaceId, ulong saveDataId, in SaveDataExtraData extraData, SaveDataType type, bool updateTimeStamp);
|
Result WriteSaveDataFileSystemExtraDataCore(SaveDataSpaceId spaceId, ulong saveDataId, in SaveDataExtraData extraData, SaveDataType type, bool updateTimeStamp);
|
||||||
Result FinalizeSaveDataCreation(ulong saveDataId, SaveDataSpaceId spaceId);
|
Result FinalizeSaveDataCreation(ulong saveDataId, SaveDataSpaceId spaceId);
|
||||||
|
@ -74,7 +74,7 @@ internal class LocationResolverSet : IDisposable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Result SetUpFsPath(ref Fs.Path outPath, in Lr.Path lrPath)
|
private static Result SetUpFsPath(ref Fs.Path outPath, ref readonly Lr.Path lrPath)
|
||||||
{
|
{
|
||||||
var pathFlags = new PathFlags();
|
var pathFlags = new PathFlags();
|
||||||
pathFlags.AllowMountName();
|
pathFlags.AllowMountName();
|
||||||
|
@ -46,18 +46,18 @@ internal class OpenCountFileSystem : ForwardingFileSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ReSharper disable once RedundantOverriddenMember
|
// ReSharper disable once RedundantOverriddenMember
|
||||||
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, in Path path, OpenMode mode)
|
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, ref readonly Path path, OpenMode mode)
|
||||||
{
|
{
|
||||||
// Todo: Implement
|
// Todo: Implement
|
||||||
return base.DoOpenFile(ref outFile, path, mode);
|
return base.DoOpenFile(ref outFile, in path, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReSharper disable once RedundantOverriddenMember
|
// ReSharper disable once RedundantOverriddenMember
|
||||||
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, in Path path,
|
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, ref readonly Path path,
|
||||||
OpenDirectoryMode mode)
|
OpenDirectoryMode mode)
|
||||||
{
|
{
|
||||||
// Todo: Implement
|
// Todo: Implement
|
||||||
return base.DoOpenDirectory(ref outDirectory, path, mode);
|
return base.DoOpenDirectory(ref outDirectory, in path, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Dispose()
|
public override void Dispose()
|
||||||
|
@ -24,7 +24,7 @@ public class SaveDataExtraDataAccessorCacheManager : ISaveDataExtraDataAccessorO
|
|||||||
private readonly SaveDataSpaceId _spaceId;
|
private readonly SaveDataSpaceId _spaceId;
|
||||||
private readonly ulong _saveDataId;
|
private readonly ulong _saveDataId;
|
||||||
|
|
||||||
public Cache(in SharedRef<ISaveDataExtraDataAccessor> accessor, SaveDataSpaceId spaceId, ulong saveDataId)
|
public Cache(ref readonly SharedRef<ISaveDataExtraDataAccessor> accessor, SaveDataSpaceId spaceId, ulong saveDataId)
|
||||||
{
|
{
|
||||||
_accessor = new WeakRef<ISaveDataExtraDataAccessor>(in accessor);
|
_accessor = new WeakRef<ISaveDataExtraDataAccessor>(in accessor);
|
||||||
_spaceId = spaceId;
|
_spaceId = spaceId;
|
||||||
@ -74,7 +74,7 @@ public class SaveDataExtraDataAccessorCacheManager : ISaveDataExtraDataAccessorO
|
|||||||
_accessorList.Clear();
|
_accessorList.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result Register(in SharedRef<ISaveDataExtraDataAccessor> accessor, SaveDataSpaceId spaceId,
|
public Result Register(ref readonly SharedRef<ISaveDataExtraDataAccessor> accessor, SaveDataSpaceId spaceId,
|
||||||
ulong saveDataId)
|
ulong saveDataId)
|
||||||
{
|
{
|
||||||
accessor.Get.RegisterExtraDataAccessorObserver(this, spaceId, saveDataId);
|
accessor.Get.RegisterExtraDataAccessorObserver(this, spaceId, saveDataId);
|
||||||
|
@ -34,58 +34,58 @@ public class SaveDataFileSystemCacheRegister : IFileSystem
|
|||||||
base.Dispose();
|
base.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, in Path path, OpenMode mode)
|
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, ref readonly Path path, OpenMode mode)
|
||||||
{
|
{
|
||||||
return _baseFileSystem.Get.OpenFile(ref outFile, in path, mode);
|
return _baseFileSystem.Get.OpenFile(ref outFile, in path, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, in Path path,
|
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, ref readonly Path path,
|
||||||
OpenDirectoryMode mode)
|
OpenDirectoryMode mode)
|
||||||
{
|
{
|
||||||
return _baseFileSystem.Get.OpenDirectory(ref outDirectory, in path, mode);
|
return _baseFileSystem.Get.OpenDirectory(ref outDirectory, in path, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
protected override Result DoGetEntryType(out DirectoryEntryType entryType, ref readonly Path path)
|
||||||
{
|
{
|
||||||
return _baseFileSystem.Get.GetEntryType(out entryType, in path);
|
return _baseFileSystem.Get.GetEntryType(out entryType, in path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option)
|
protected override Result DoCreateFile(ref readonly Path path, long size, CreateFileOptions option)
|
||||||
{
|
{
|
||||||
return _baseFileSystem.Get.CreateFile(in path, size, option);
|
return _baseFileSystem.Get.CreateFile(in path, size, option);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteFile(in Path path)
|
protected override Result DoDeleteFile(ref readonly Path path)
|
||||||
{
|
{
|
||||||
return _baseFileSystem.Get.DeleteFile(in path);
|
return _baseFileSystem.Get.DeleteFile(in path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCreateDirectory(in Path path)
|
protected override Result DoCreateDirectory(ref readonly Path path)
|
||||||
{
|
{
|
||||||
return _baseFileSystem.Get.CreateDirectory(in path);
|
return _baseFileSystem.Get.CreateDirectory(in path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteDirectory(in Path path)
|
protected override Result DoDeleteDirectory(ref readonly Path path)
|
||||||
{
|
{
|
||||||
return _baseFileSystem.Get.DeleteDirectory(in path);
|
return _baseFileSystem.Get.DeleteDirectory(in path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
protected override Result DoDeleteDirectoryRecursively(ref readonly Path path)
|
||||||
{
|
{
|
||||||
return _baseFileSystem.Get.DeleteDirectoryRecursively(in path);
|
return _baseFileSystem.Get.DeleteDirectoryRecursively(in path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
protected override Result DoCleanDirectoryRecursively(ref readonly Path path)
|
||||||
{
|
{
|
||||||
return _baseFileSystem.Get.CleanDirectoryRecursively(in path);
|
return _baseFileSystem.Get.CleanDirectoryRecursively(in path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath)
|
protected override Result DoRenameFile(ref readonly Path currentPath, ref readonly Path newPath)
|
||||||
{
|
{
|
||||||
return _baseFileSystem.Get.RenameFile(in currentPath, in newPath);
|
return _baseFileSystem.Get.RenameFile(in currentPath, in newPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath)
|
protected override Result DoRenameDirectory(ref readonly Path currentPath, ref readonly Path newPath)
|
||||||
{
|
{
|
||||||
return _baseFileSystem.Get.RenameDirectory(in currentPath, in newPath);
|
return _baseFileSystem.Get.RenameDirectory(in currentPath, in newPath);
|
||||||
}
|
}
|
||||||
@ -105,12 +105,12 @@ public class SaveDataFileSystemCacheRegister : IFileSystem
|
|||||||
return _baseFileSystem.Get.Rollback();
|
return _baseFileSystem.Get.Rollback();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, in Path path)
|
protected override Result DoGetFreeSpaceSize(out long freeSpace, ref readonly Path path)
|
||||||
{
|
{
|
||||||
return _baseFileSystem.Get.GetFreeSpaceSize(out freeSpace, in path);
|
return _baseFileSystem.Get.GetFreeSpaceSize(out freeSpace, in path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, in Path path)
|
protected override Result DoGetTotalSpaceSize(out long totalSpace, ref readonly Path path)
|
||||||
{
|
{
|
||||||
return _baseFileSystem.Get.GetTotalSpaceSize(out totalSpace, in path);
|
return _baseFileSystem.Get.GetTotalSpaceSize(out totalSpace, in path);
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ internal static class Utility
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Result CreateSubDirectoryFileSystem(ref SharedRef<IFileSystem> outSubDirFileSystem,
|
public static Result CreateSubDirectoryFileSystem(ref SharedRef<IFileSystem> outSubDirFileSystem,
|
||||||
ref SharedRef<IFileSystem> baseFileSystem, in Path rootPath)
|
ref SharedRef<IFileSystem> baseFileSystem, ref readonly Path rootPath)
|
||||||
{
|
{
|
||||||
if (rootPath.IsEmpty())
|
if (rootPath.IsEmpty())
|
||||||
{
|
{
|
||||||
@ -26,7 +26,7 @@ internal static class Utility
|
|||||||
|
|
||||||
// Check if the directory exists
|
// Check if the directory exists
|
||||||
using var dir = new UniqueRef<IDirectory>();
|
using var dir = new UniqueRef<IDirectory>();
|
||||||
Result res = baseFileSystem.Get.OpenDirectory(ref dir.Ref, rootPath, OpenDirectoryMode.Directory);
|
Result res = baseFileSystem.Get.OpenDirectory(ref dir.Ref, in rootPath, OpenDirectoryMode.Directory);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
dir.Reset();
|
dir.Reset();
|
||||||
@ -44,7 +44,7 @@ internal static class Utility
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Result WrapSubDirectory(ref SharedRef<IFileSystem> outFileSystem,
|
public static Result WrapSubDirectory(ref SharedRef<IFileSystem> outFileSystem,
|
||||||
ref SharedRef<IFileSystem> baseFileSystem, in Path rootPath, bool createIfMissing)
|
ref SharedRef<IFileSystem> baseFileSystem, ref readonly Path rootPath, bool createIfMissing)
|
||||||
{
|
{
|
||||||
// The path must already exist if we're not automatically creating it
|
// The path must already exist if we're not automatically creating it
|
||||||
if (!createIfMissing)
|
if (!createIfMissing)
|
||||||
@ -57,7 +57,7 @@ internal static class Utility
|
|||||||
Result res = FsSystem.Utility.EnsureDirectory(baseFileSystem.Get, in rootPath);
|
Result res = FsSystem.Utility.EnsureDirectory(baseFileSystem.Get, in rootPath);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
return CreateSubDirectoryFileSystem(ref outFileSystem, ref baseFileSystem, rootPath);
|
return CreateSubDirectoryFileSystem(ref outFileSystem, ref baseFileSystem, in rootPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long ConvertZeroCommitId(in SaveDataExtraData extraData)
|
public static long ConvertZeroCommitId(in SaveDataExtraData extraData)
|
||||||
|
@ -168,7 +168,7 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenCodeFileSystem(ref SharedRef<IFileSystemSf> outFileSystem,
|
public Result OpenCodeFileSystem(ref SharedRef<IFileSystemSf> outFileSystem,
|
||||||
out CodeVerificationData verificationData, in FspPath path, ProgramId programId)
|
out CodeVerificationData verificationData, ref readonly FspPath path, ProgramId programId)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
@ -178,7 +178,7 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenDataStorageByPath(ref SharedRef<IFileSystemSf> outFileSystem, in FspPath path,
|
public Result OpenDataStorageByPath(ref SharedRef<IFileSystemSf> outFileSystem, ref readonly FspPath path,
|
||||||
FileSystemProxyType fsType)
|
FileSystemProxyType fsType)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
@ -225,7 +225,7 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenFileSystemWithId(ref SharedRef<IFileSystemSf> outFileSystem, in FspPath path,
|
public Result OpenFileSystemWithId(ref SharedRef<IFileSystemSf> outFileSystem, ref readonly FspPath path,
|
||||||
ulong id, FileSystemProxyType fsType)
|
ulong id, FileSystemProxyType fsType)
|
||||||
{
|
{
|
||||||
const StorageLayoutType storageFlag = StorageLayoutType.All;
|
const StorageLayoutType storageFlag = StorageLayoutType.All;
|
||||||
@ -384,7 +384,7 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result GetRightsIdAndKeyGenerationByPath(out RightsId outRightsId, out byte outKeyGeneration, in FspPath path)
|
public Result GetRightsIdAndKeyGenerationByPath(out RightsId outRightsId, out byte outKeyGeneration, ref readonly FspPath path)
|
||||||
{
|
{
|
||||||
const ulong checkThroughProgramId = ulong.MaxValue;
|
const ulong checkThroughProgramId = ulong.MaxValue;
|
||||||
UnsafeHelpers.SkipParamInit(out outRightsId, out outKeyGeneration);
|
UnsafeHelpers.SkipParamInit(out outRightsId, out outKeyGeneration);
|
||||||
|
@ -67,23 +67,22 @@ public class NcaFileSystemServiceImpl
|
|||||||
public bool CanMountNca;
|
public bool CanMountNca;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenFileSystem(ref SharedRef<IFileSystem> outFileSystem, in Path path, FileSystemProxyType type,
|
public Result OpenFileSystem(ref SharedRef<IFileSystem> outFileSystem, ref readonly Path path,
|
||||||
ulong id, bool isDirectory)
|
FileSystemProxyType type, ulong id, bool isDirectory)
|
||||||
{
|
{
|
||||||
return OpenFileSystem(ref outFileSystem, out Unsafe.NullRef<CodeVerificationData>(), in path, type, false,
|
return OpenFileSystem(ref outFileSystem, out Unsafe.NullRef<CodeVerificationData>(), in path, type, false, id,
|
||||||
id, isDirectory);
|
isDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenFileSystem(ref SharedRef<IFileSystem> outFileSystem, in Path path, FileSystemProxyType type,
|
public Result OpenFileSystem(ref SharedRef<IFileSystem> outFileSystem, ref readonly Path path,
|
||||||
bool canMountSystemDataPrivate, ulong id, bool isDirectory)
|
FileSystemProxyType type, bool canMountSystemDataPrivate, ulong id, bool isDirectory)
|
||||||
{
|
{
|
||||||
return OpenFileSystem(ref outFileSystem, out Unsafe.NullRef<CodeVerificationData>(), in path, type,
|
return OpenFileSystem(ref outFileSystem, out Unsafe.NullRef<CodeVerificationData>(), in path, type,
|
||||||
canMountSystemDataPrivate, id, isDirectory);
|
canMountSystemDataPrivate, id, isDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenFileSystem(ref SharedRef<IFileSystem> outFileSystem,
|
public Result OpenFileSystem(ref SharedRef<IFileSystem> outFileSystem, out CodeVerificationData verificationData,
|
||||||
out CodeVerificationData verificationData, in Path path, FileSystemProxyType type,
|
ref readonly Path path, FileSystemProxyType type, bool canMountSystemDataPrivate, ulong id, bool isDirectory)
|
||||||
bool canMountSystemDataPrivate, ulong id, bool isDirectory)
|
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out verificationData);
|
UnsafeHelpers.SkipParamInit(out verificationData);
|
||||||
|
|
||||||
@ -192,20 +191,20 @@ public class NcaFileSystemServiceImpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenDataFileSystem(ref SharedRef<IFileSystem> outFileSystem, in Path path,
|
public Result OpenDataFileSystem(ref SharedRef<IFileSystem> outFileSystem, ref readonly Path path,
|
||||||
FileSystemProxyType fsType, ulong programId, bool isDirectory)
|
FileSystemProxyType fsType, ulong programId, bool isDirectory)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenStorageWithPatch(ref SharedRef<IStorage> outStorage, out Hash ncaHeaderDigest,
|
public Result OpenStorageWithPatch(ref SharedRef<IStorage> outStorage, out Hash ncaHeaderDigest,
|
||||||
in Path originalNcaPath, in Path currentNcaPath, FileSystemProxyType fsType, ulong id)
|
ref readonly Path originalNcaPath, ref readonly Path currentNcaPath, FileSystemProxyType fsType, ulong id)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenFileSystemWithPatch(ref SharedRef<IFileSystem> outFileSystem,
|
public Result OpenFileSystemWithPatch(ref SharedRef<IFileSystem> outFileSystem, ref readonly Path originalNcaPath,
|
||||||
in Path originalNcaPath, in Path currentNcaPath, FileSystemProxyType fsType, ulong id)
|
ref readonly Path currentNcaPath, FileSystemProxyType fsType, ulong id)
|
||||||
{
|
{
|
||||||
using var romFsStorage = new SharedRef<IStorage>();
|
using var romFsStorage = new SharedRef<IStorage>();
|
||||||
Result res = OpenStorageWithPatch(ref romFsStorage.Ref, out Unsafe.NullRef<Hash>(), in originalNcaPath,
|
Result res = OpenStorageWithPatch(ref romFsStorage.Ref, out Unsafe.NullRef<Hash>(), in originalNcaPath,
|
||||||
@ -281,7 +280,7 @@ public class NcaFileSystemServiceImpl
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result GetRightsId(out RightsId rightsId, out byte keyGeneration, in Path path, ProgramId programId)
|
public Result GetRightsId(out RightsId rightsId, out byte keyGeneration, ref readonly Path path, ProgramId programId)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
@ -305,7 +304,7 @@ public class NcaFileSystemServiceImpl
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result RegisterUpdatePartition(ulong programId, in Path path)
|
public Result RegisterUpdatePartition(ulong programId, ref readonly Path path)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
@ -511,7 +510,7 @@ public class NcaFileSystemServiceImpl
|
|||||||
return ResultFs.PathNotFound.Log();
|
return ResultFs.PathNotFound.Log();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Result ParseDir(in Path path, ref SharedRef<IFileSystem> outContentFileSystem,
|
private Result ParseDir(ref readonly Path path, ref SharedRef<IFileSystem> outContentFileSystem,
|
||||||
ref SharedRef<IFileSystem> baseFileSystem, FileSystemProxyType fsType, bool preserveUnc)
|
ref SharedRef<IFileSystem> baseFileSystem, FileSystemProxyType fsType, bool preserveUnc)
|
||||||
{
|
{
|
||||||
using var fileSystem = new SharedRef<IFileSystem>();
|
using var fileSystem = new SharedRef<IFileSystem>();
|
||||||
@ -522,7 +521,7 @@ public class NcaFileSystemServiceImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Result ParseDirWithPathCaseNormalizationOnCaseSensitiveHostFs(ref SharedRef<IFileSystem> outFileSystem,
|
private Result ParseDirWithPathCaseNormalizationOnCaseSensitiveHostFs(ref SharedRef<IFileSystem> outFileSystem,
|
||||||
in Path path)
|
ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var pathRoot = new Path();
|
using var pathRoot = new Path();
|
||||||
using var pathData = new Path();
|
using var pathData = new Path();
|
||||||
@ -858,7 +857,7 @@ public class NcaFileSystemServiceImpl
|
|||||||
_romFsRecoveredByInvalidateCacheCount = 0;
|
_romFsRecoveredByInvalidateCacheCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenHostFileSystem(ref SharedRef<IFileSystem> outFileSystem, in Path rootPath, bool openCaseSensitive)
|
public Result OpenHostFileSystem(ref SharedRef<IFileSystem> outFileSystem, ref readonly Path rootPath, bool openCaseSensitive)
|
||||||
{
|
{
|
||||||
return _config.TargetManagerFsCreator.Create(ref outFileSystem, in rootPath, openCaseSensitive, false,
|
return _config.TargetManagerFsCreator.Create(ref outFileSystem, in rootPath, openCaseSensitive, false,
|
||||||
Result.Success);
|
Result.Success);
|
||||||
|
@ -739,7 +739,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
|||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.NonGameCard);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.NonGameCard);
|
||||||
|
|
||||||
Result res = GetSaveDataInfo(out SaveDataInfo info, spaceId, in attribute);
|
Result res = GetSaveDataInfo(out SaveDataInfo info, spaceId, attribute);
|
||||||
if (res.IsFailure()) return res;
|
if (res.IsFailure()) return res;
|
||||||
|
|
||||||
return DeleteSaveDataFileSystemBySaveDataSpaceIdCore(spaceId, info.SaveDataId).Ret();
|
return DeleteSaveDataFileSystemBySaveDataSpaceIdCore(spaceId, info.SaveDataId).Ret();
|
||||||
@ -776,9 +776,12 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
|||||||
res = accessor.Get.GetInterface().GetKey(out SaveDataAttribute key, saveDataId);
|
res = accessor.Get.GetInterface().GetKey(out SaveDataAttribute key, saveDataId);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
Result GetExtraData(out SaveDataExtraData data) =>
|
|
||||||
_serviceImpl.ReadSaveDataFileSystemExtraData(out data, targetSpaceId, saveDataId, key.Type,
|
Result GetExtraData(out SaveDataExtraData data)
|
||||||
_saveDataRootPath.DangerousGetPath());
|
{
|
||||||
|
var path = _saveDataRootPath.DangerousGetPath();
|
||||||
|
return _serviceImpl.ReadSaveDataFileSystemExtraData(out data, targetSpaceId, saveDataId, key.Type, in path);
|
||||||
|
}
|
||||||
|
|
||||||
res = SaveDataAccessibilityChecker.CheckDelete(in key, programInfo, GetExtraData);
|
res = SaveDataAccessibilityChecker.CheckDelete(in key, programInfo, GetExtraData);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -842,7 +845,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result SetSaveDataRootPath(in FspPath path)
|
public Result SetSaveDataRootPath(ref readonly FspPath path)
|
||||||
{
|
{
|
||||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -1165,7 +1168,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result GetSaveDataInfo(out SaveDataInfo info, SaveDataSpaceId spaceId, in SaveDataAttribute attribute)
|
public Result GetSaveDataInfo(out SaveDataInfo info, SaveDataSpaceId spaceId, SaveDataAttribute attribute)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out info);
|
UnsafeHelpers.SkipParamInit(out info);
|
||||||
|
|
||||||
@ -1849,7 +1852,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
|||||||
tempAttribute.ProgramId = ResolveDefaultSaveDataReferenceProgramId(programInfo.ProgramId);
|
tempAttribute.ProgramId = ResolveDefaultSaveDataReferenceProgramId(programInfo.ProgramId);
|
||||||
}
|
}
|
||||||
|
|
||||||
res = GetSaveDataInfo(out SaveDataInfo info, spaceId, in tempAttribute);
|
res = GetSaveDataInfo(out SaveDataInfo info, spaceId, tempAttribute);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
// Make a mask for reading the entire extra data
|
// Make a mask for reading the entire extra data
|
||||||
@ -1898,7 +1901,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
|||||||
tempAttribute.ProgramId = ResolveDefaultSaveDataReferenceProgramId(programInfo.ProgramId);
|
tempAttribute.ProgramId = ResolveDefaultSaveDataReferenceProgramId(programInfo.ProgramId);
|
||||||
}
|
}
|
||||||
|
|
||||||
res = GetSaveDataInfo(out SaveDataInfo info, spaceId, in tempAttribute);
|
res = GetSaveDataInfo(out SaveDataInfo info, spaceId, tempAttribute);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
return ReadSaveDataFileSystemExtraDataCore(out extraDataRef, spaceId, info.SaveDataId, in maskRef).Ret();
|
return ReadSaveDataFileSystemExtraDataCore(out extraDataRef, spaceId, info.SaveDataId, in maskRef).Ret();
|
||||||
@ -1978,7 +1981,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
|||||||
tempAttribute.ProgramId = ResolveDefaultSaveDataReferenceProgramId(programInfo.ProgramId);
|
tempAttribute.ProgramId = ResolveDefaultSaveDataReferenceProgramId(programInfo.ProgramId);
|
||||||
}
|
}
|
||||||
|
|
||||||
res = GetSaveDataInfo(out SaveDataInfo info, spaceId, in tempAttribute);
|
res = GetSaveDataInfo(out SaveDataInfo info, spaceId, tempAttribute);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
return WriteSaveDataFileSystemExtraDataWithMask(info.SaveDataId, spaceId, extraData, extraDataMask).Ret();
|
return WriteSaveDataFileSystemExtraDataWithMask(info.SaveDataId, spaceId, extraData, extraDataMask).Ret();
|
||||||
|
@ -82,12 +82,12 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||||||
spaceId == SaveDataSpaceId.SafeMode;
|
spaceId == SaveDataSpaceId.SafeMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Result WipeData(IFileSystem fileSystem, in Path filePath, RandomDataGenerator random)
|
private static Result WipeData(IFileSystem fileSystem, ref readonly Path filePath, RandomDataGenerator random)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Result WipeMasterHeader(IFileSystem fileSystem, in Path filePath, RandomDataGenerator random)
|
private static Result WipeMasterHeader(IFileSystem fileSystem, ref readonly Path filePath, RandomDataGenerator random)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
@ -156,7 +156,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenSaveDataFileSystem(ref SharedRef<IFileSystem> outFileSystem, SaveDataSpaceId spaceId,
|
public Result OpenSaveDataFileSystem(ref SharedRef<IFileSystem> outFileSystem, SaveDataSpaceId spaceId,
|
||||||
ulong saveDataId, in Path saveDataRootPath, bool openReadOnly, SaveDataType type, bool cacheExtraData)
|
ulong saveDataId, ref readonly Path saveDataRootPath, bool openReadOnly, SaveDataType type, bool cacheExtraData)
|
||||||
{
|
{
|
||||||
using var fileSystem = new SharedRef<IFileSystem>();
|
using var fileSystem = new SharedRef<IFileSystem>();
|
||||||
|
|
||||||
@ -241,33 +241,33 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenSaveDataInternalStorageFileSystem(ref SharedRef<IFileSystem> outFileSystem,
|
public Result OpenSaveDataInternalStorageFileSystem(ref SharedRef<IFileSystem> outFileSystem,
|
||||||
SaveDataSpaceId spaceId, ulong saveDataId, in Path saveDataRootPath, bool useSecondMacKey,
|
SaveDataSpaceId spaceId, ulong saveDataId, ref readonly Path saveDataRootPath, bool useSecondMacKey,
|
||||||
bool isReconstructible)
|
bool isReconstructible)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Result OpenSaveDataImageFile(ref UniqueRef<IFile> outFile, SaveDataSpaceId spaceId, ulong saveDataId,
|
private Result OpenSaveDataImageFile(ref UniqueRef<IFile> outFile, SaveDataSpaceId spaceId, ulong saveDataId,
|
||||||
in Path saveDataRootPath)
|
ref readonly Path saveDataRootPath)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result ExtendSaveDataFileSystemCore(out long extendedTotalSize, ulong saveDataId, SaveDataSpaceId spaceId,
|
public Result ExtendSaveDataFileSystemCore(out long extendedTotalSize, ulong saveDataId, SaveDataSpaceId spaceId,
|
||||||
SaveDataType type, long dataSize, long journalSize, in Path saveDataRootPath, bool isExtensionStart)
|
SaveDataType type, long dataSize, long journalSize, ref readonly Path saveDataRootPath, bool isExtensionStart)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result StartExtendSaveDataFileSystem(out long extendedTotalSize, ulong saveDataId, SaveDataSpaceId spaceId,
|
public Result StartExtendSaveDataFileSystem(out long extendedTotalSize, ulong saveDataId, SaveDataSpaceId spaceId,
|
||||||
SaveDataType type, long dataSize, long journalSize, in Path saveDataRootPath)
|
SaveDataType type, long dataSize, long journalSize, ref readonly Path saveDataRootPath)
|
||||||
{
|
{
|
||||||
return ExtendSaveDataFileSystemCore(out extendedTotalSize, saveDataId, spaceId, type, dataSize, journalSize,
|
return ExtendSaveDataFileSystemCore(out extendedTotalSize, saveDataId, spaceId, type, dataSize, journalSize,
|
||||||
in saveDataRootPath, isExtensionStart: true);
|
in saveDataRootPath, isExtensionStart: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result ResumeExtendSaveDataFileSystem(out long extendedTotalSize, ulong saveDataId, SaveDataSpaceId spaceId,
|
public Result ResumeExtendSaveDataFileSystem(out long extendedTotalSize, ulong saveDataId, SaveDataSpaceId spaceId,
|
||||||
SaveDataType type, in Path saveDataRootPath)
|
SaveDataType type, ref readonly Path saveDataRootPath)
|
||||||
{
|
{
|
||||||
return ExtendSaveDataFileSystemCore(out extendedTotalSize, saveDataId, spaceId, type, dataSize: 0,
|
return ExtendSaveDataFileSystemCore(out extendedTotalSize, saveDataId, spaceId, type, dataSize: 0,
|
||||||
journalSize: 0, in saveDataRootPath, isExtensionStart: false);
|
journalSize: 0, in saveDataRootPath, isExtensionStart: false);
|
||||||
@ -283,7 +283,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void RevertExtendSaveDataFileSystem(ulong saveDataId, SaveDataSpaceId spaceId, long originalSize,
|
public void RevertExtendSaveDataFileSystem(ulong saveDataId, SaveDataSpaceId spaceId, long originalSize,
|
||||||
in Path saveDataRootPath)
|
ref readonly Path saveDataRootPath)
|
||||||
{
|
{
|
||||||
using var saveDataFile = new UniqueRef<IFile>();
|
using var saveDataFile = new UniqueRef<IFile>();
|
||||||
Result res = OpenSaveDataImageFile(ref saveDataFile.Ref, spaceId, saveDataId, in saveDataRootPath);
|
Result res = OpenSaveDataImageFile(ref saveDataFile.Ref, spaceId, saveDataId, in saveDataRootPath);
|
||||||
@ -401,7 +401,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Result CreateSaveDataFileSystem(ulong saveDataId, in SaveDataCreationInfo2 creationInfo,
|
public Result CreateSaveDataFileSystem(ulong saveDataId, in SaveDataCreationInfo2 creationInfo,
|
||||||
in Path saveDataRootPath, bool skipFormat)
|
ref readonly Path saveDataRootPath, bool skipFormat)
|
||||||
{
|
{
|
||||||
Unsafe.SkipInit(out Array18<byte> saveImageNameBuffer);
|
Unsafe.SkipInit(out Array18<byte> saveImageNameBuffer);
|
||||||
|
|
||||||
@ -477,7 +477,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Result DeleteSaveDataFileSystem(SaveDataSpaceId spaceId, ulong saveDataId, bool wipeSaveFile,
|
public Result DeleteSaveDataFileSystem(SaveDataSpaceId spaceId, ulong saveDataId, bool wipeSaveFile,
|
||||||
in Path saveDataRootPath)
|
ref readonly Path saveDataRootPath)
|
||||||
{
|
{
|
||||||
Unsafe.SkipInit(out Array18<byte> saveImageNameBuffer);
|
Unsafe.SkipInit(out Array18<byte> saveImageNameBuffer);
|
||||||
|
|
||||||
@ -538,7 +538,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Result ReadSaveDataFileSystemExtraData(out SaveDataExtraData extraData, SaveDataSpaceId spaceId,
|
public Result ReadSaveDataFileSystemExtraData(out SaveDataExtraData extraData, SaveDataSpaceId spaceId,
|
||||||
ulong saveDataId, SaveDataType type, in Path saveDataRootPath)
|
ulong saveDataId, SaveDataType type, ref readonly Path saveDataRootPath)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out extraData);
|
UnsafeHelpers.SkipParamInit(out extraData);
|
||||||
|
|
||||||
@ -564,7 +564,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||||||
|
|
||||||
// We won't actually use the returned save data FS.
|
// We won't actually use the returned save data FS.
|
||||||
// Opening the FS should cache an extra data accessor for it.
|
// Opening the FS should cache an extra data accessor for it.
|
||||||
res = OpenSaveDataFileSystem(ref unusedSaveDataFs.Ref, spaceId, saveDataId, saveDataRootPath,
|
res = OpenSaveDataFileSystem(ref unusedSaveDataFs.Ref, spaceId, saveDataId, in saveDataRootPath,
|
||||||
openReadOnly: true, type, cacheExtraData: true);
|
openReadOnly: true, type, cacheExtraData: true);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
@ -581,7 +581,8 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Result WriteSaveDataFileSystemExtraData(SaveDataSpaceId spaceId, ulong saveDataId,
|
public Result WriteSaveDataFileSystemExtraData(SaveDataSpaceId spaceId, ulong saveDataId,
|
||||||
in SaveDataExtraData extraData, in Path saveDataRootPath, SaveDataType type, bool updateTimeStamp)
|
in SaveDataExtraData extraData, ref readonly Path saveDataRootPath, SaveDataType type,
|
||||||
|
bool updateTimeStamp)
|
||||||
{
|
{
|
||||||
// Emulated save data on a host device doesn't have extra data.
|
// Emulated save data on a host device doesn't have extra data.
|
||||||
if (IsAllowedDirectorySaveData(spaceId, in saveDataRootPath))
|
if (IsAllowedDirectorySaveData(spaceId, in saveDataRootPath))
|
||||||
@ -604,7 +605,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||||||
|
|
||||||
// We won't actually use the returned save data FS.
|
// We won't actually use the returned save data FS.
|
||||||
// Opening the FS should cache an extra data accessor for it.
|
// Opening the FS should cache an extra data accessor for it.
|
||||||
res = OpenSaveDataFileSystem(ref unusedSaveDataFs.Ref, spaceId, saveDataId, saveDataRootPath,
|
res = OpenSaveDataFileSystem(ref unusedSaveDataFs.Ref, spaceId, saveDataId, in saveDataRootPath,
|
||||||
openReadOnly: false, type, cacheExtraData: true);
|
openReadOnly: false, type, cacheExtraData: true);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
@ -625,7 +626,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Result CorruptSaveDataFileSystem(SaveDataSpaceId spaceId, ulong saveDataId, long offset,
|
public Result CorruptSaveDataFileSystem(SaveDataSpaceId spaceId, ulong saveDataId, long offset,
|
||||||
in Path saveDataRootPath)
|
ref readonly Path saveDataRootPath)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
@ -635,7 +636,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||||||
return _config.TimeService.GetCurrentPosixTime(out timeStamp);
|
return _config.TimeService.GetCurrentPosixTime(out timeStamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsSaveEmulated(in Path saveDataRootPath)
|
private bool IsSaveEmulated(ref readonly Path saveDataRootPath)
|
||||||
{
|
{
|
||||||
return !saveDataRootPath.IsEmpty();
|
return !saveDataRootPath.IsEmpty();
|
||||||
}
|
}
|
||||||
@ -649,7 +650,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenSaveDataDirectoryFileSystem(ref SharedRef<IFileSystem> outFileSystem,
|
public Result OpenSaveDataDirectoryFileSystem(ref SharedRef<IFileSystem> outFileSystem,
|
||||||
SaveDataSpaceId spaceId, in Path saveDataRootPath, bool allowEmulatedSave)
|
SaveDataSpaceId spaceId, ref readonly Path saveDataRootPath, bool allowEmulatedSave)
|
||||||
{
|
{
|
||||||
Result res;
|
Result res;
|
||||||
|
|
||||||
@ -662,7 +663,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||||||
// Ensure the target save data directory exists
|
// Ensure the target save data directory exists
|
||||||
res = _config.TargetManagerFsCreator.Create(ref tmFileSystem.Ref, in saveDataRootPath,
|
res = _config.TargetManagerFsCreator.Create(ref tmFileSystem.Ref, in saveDataRootPath,
|
||||||
openCaseSensitive: false, ensureRootPathExists: true,
|
openCaseSensitive: false, ensureRootPathExists: true,
|
||||||
ResultFs.SaveDataRootPathUnavailable.Value);
|
pathNotFoundResult: ResultFs.SaveDataRootPathUnavailable.Value);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -674,13 +675,13 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
res = _config.TargetManagerFsCreator.Create(ref outFileSystem, in path, isTargetFsCaseSensitive,
|
res = _config.TargetManagerFsCreator.Create(ref outFileSystem, in path, isTargetFsCaseSensitive,
|
||||||
ensureRootPathExists: false, ResultFs.SaveDataRootPathUnavailable.Value);
|
ensureRootPathExists: false, pathNotFoundResult: ResultFs.SaveDataRootPathUnavailable.Value);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res = _config.LocalFsCreator.Create(ref outFileSystem, in saveDataRootPath, openCaseSensitive: true,
|
res = _config.LocalFsCreator.Create(ref outFileSystem, in saveDataRootPath, openCaseSensitive: true,
|
||||||
ensureRootPathExists: true, ResultFs.SaveDataRootPathUnavailable.Value);
|
ensureRootPathExists: true, pathNotFoundResult: ResultFs.SaveDataRootPathUnavailable.Value);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -709,13 +710,13 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenSaveDataDirectoryFileSystemImpl(ref SharedRef<IFileSystem> outFileSystem,
|
public Result OpenSaveDataDirectoryFileSystemImpl(ref SharedRef<IFileSystem> outFileSystem,
|
||||||
SaveDataSpaceId spaceId, in Path directoryPath)
|
SaveDataSpaceId spaceId, ref readonly Path directoryPath)
|
||||||
{
|
{
|
||||||
return OpenSaveDataDirectoryFileSystemImpl(ref outFileSystem, spaceId, in directoryPath, createIfMissing: true);
|
return OpenSaveDataDirectoryFileSystemImpl(ref outFileSystem, spaceId, in directoryPath, createIfMissing: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result OpenSaveDataDirectoryFileSystemImpl(ref SharedRef<IFileSystem> outFileSystem,
|
public Result OpenSaveDataDirectoryFileSystemImpl(ref SharedRef<IFileSystem> outFileSystem,
|
||||||
SaveDataSpaceId spaceId, in Path directoryPath, bool createIfMissing)
|
SaveDataSpaceId spaceId, ref readonly Path directoryPath, bool createIfMissing)
|
||||||
{
|
{
|
||||||
using var baseFileSystem = new SharedRef<IFileSystem>();
|
using var baseFileSystem = new SharedRef<IFileSystem>();
|
||||||
|
|
||||||
@ -819,7 +820,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if a save is to be stored on a host device.
|
/// Checks if a save is to be stored on a host device.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsAllowedDirectorySaveData(SaveDataSpaceId spaceId, in Path saveDataRootPath)
|
public bool IsAllowedDirectorySaveData(SaveDataSpaceId spaceId, ref readonly Path saveDataRootPath)
|
||||||
{
|
{
|
||||||
return spaceId == SaveDataSpaceId.User && IsSaveEmulated(in saveDataRootPath);
|
return spaceId == SaveDataSpaceId.User && IsSaveEmulated(in saveDataRootPath);
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ public class SaveDataIndexer : ISaveDataIndexer
|
|||||||
{
|
{
|
||||||
private WeakRef<Reader> _reader;
|
private WeakRef<Reader> _reader;
|
||||||
|
|
||||||
public ReaderAccessor(in SharedRef<Reader> reader)
|
public ReaderAccessor(ref readonly SharedRef<Reader> reader)
|
||||||
{
|
{
|
||||||
_reader = new WeakRef<Reader>(in reader);
|
_reader = new WeakRef<Reader>(in reader);
|
||||||
}
|
}
|
||||||
@ -748,7 +748,7 @@ public class SaveDataIndexer : ISaveDataIndexer
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="reader">The reader to add.</param>
|
/// <param name="reader">The reader to add.</param>
|
||||||
/// <returns>The <see cref="Result"/> of the operation.</returns>
|
/// <returns>The <see cref="Result"/> of the operation.</returns>
|
||||||
private Result RegisterReader(in SharedRef<Reader> reader)
|
private Result RegisterReader(ref readonly SharedRef<Reader> reader)
|
||||||
{
|
{
|
||||||
Assert.SdkRequires(_mutex.IsLockedByCurrentThread());
|
Assert.SdkRequires(_mutex.IsLockedByCurrentThread());
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ public class SaveDataOpenTypeSetFileStorage : FileStorageBasedFileSystem
|
|||||||
_mutex = new SdkMutexType();
|
_mutex = new SdkMutexType();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result Initialize(ref SharedRef<IFileSystem> baseFileSystem, in Path path, OpenMode mode, OpenType type)
|
public Result Initialize(ref SharedRef<IFileSystem> baseFileSystem, ref readonly Path path, OpenMode mode, OpenType type)
|
||||||
{
|
{
|
||||||
Result res = Initialize(ref baseFileSystem, in path, mode);
|
Result res = Initialize(ref baseFileSystem, in path, mode);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
@ -11,21 +11,21 @@ namespace LibHac.FsSrv.Sf;
|
|||||||
public interface IFileSystem : IDisposable
|
public interface IFileSystem : IDisposable
|
||||||
{
|
{
|
||||||
Result GetImpl(ref SharedRef<Fs.Fsa.IFileSystem> fileSystem);
|
Result GetImpl(ref SharedRef<Fs.Fsa.IFileSystem> fileSystem);
|
||||||
Result CreateFile(in Path path, long size, int option);
|
Result CreateFile(ref readonly Path path, long size, int option);
|
||||||
Result DeleteFile(in Path path);
|
Result DeleteFile(ref readonly Path path);
|
||||||
Result CreateDirectory(in Path path);
|
Result CreateDirectory(ref readonly Path path);
|
||||||
Result DeleteDirectory(in Path path);
|
Result DeleteDirectory(ref readonly Path path);
|
||||||
Result DeleteDirectoryRecursively(in Path path);
|
Result DeleteDirectoryRecursively(ref readonly Path path);
|
||||||
Result RenameFile(in Path currentPath, in Path newPath);
|
Result RenameFile(ref readonly Path currentPath, ref readonly Path newPath);
|
||||||
Result RenameDirectory(in Path currentPath, in Path newPath);
|
Result RenameDirectory(ref readonly Path currentPath, ref readonly Path newPath);
|
||||||
Result GetEntryType(out uint entryType, in Path path);
|
Result GetEntryType(out uint entryType, ref readonly Path path);
|
||||||
Result OpenFile(ref SharedRef<IFileSf> outFile, in Path path, uint mode);
|
Result OpenFile(ref SharedRef<IFileSf> outFile, ref readonly Path path, uint mode);
|
||||||
Result OpenDirectory(ref SharedRef<IDirectorySf> outDirectory, in Path path, uint mode);
|
Result OpenDirectory(ref SharedRef<IDirectorySf> outDirectory, ref readonly Path path, uint mode);
|
||||||
Result Commit();
|
Result Commit();
|
||||||
Result GetFreeSpaceSize(out long freeSpace, in Path path);
|
Result GetFreeSpaceSize(out long freeSpace, ref readonly Path path);
|
||||||
Result GetTotalSpaceSize(out long totalSpace, in Path path);
|
Result GetTotalSpaceSize(out long totalSpace, ref readonly Path path);
|
||||||
Result CleanDirectoryRecursively(in Path path);
|
Result CleanDirectoryRecursively(ref readonly Path path);
|
||||||
Result GetFileTimeStampRaw(out FileTimeStampRaw timeStamp, in Path path);
|
Result GetFileTimeStampRaw(out FileTimeStampRaw timeStamp, ref readonly Path path);
|
||||||
Result QueryEntry(OutBuffer outBuffer, InBuffer inBuffer, int queryId, in Path path);
|
Result QueryEntry(OutBuffer outBuffer, InBuffer inBuffer, int queryId, ref readonly Path path);
|
||||||
Result GetFileSystemAttribute(out FileSystemAttribute outAttribute);
|
Result GetFileSystemAttribute(out FileSystemAttribute outAttribute);
|
||||||
}
|
}
|
@ -19,12 +19,12 @@ public interface IFileSystemProxy : IDisposable
|
|||||||
Result SetCurrentProcess(ulong processId);
|
Result SetCurrentProcess(ulong processId);
|
||||||
Result OpenDataFileSystemByCurrentProcess(ref SharedRef<IFileSystemSf> outFileSystem);
|
Result OpenDataFileSystemByCurrentProcess(ref SharedRef<IFileSystemSf> outFileSystem);
|
||||||
Result OpenFileSystemWithPatch(ref SharedRef<IFileSystemSf> outFileSystem, ProgramId programId, FileSystemProxyType fsType);
|
Result OpenFileSystemWithPatch(ref SharedRef<IFileSystemSf> outFileSystem, ProgramId programId, FileSystemProxyType fsType);
|
||||||
Result OpenFileSystemWithId(ref SharedRef<IFileSystemSf> outFileSystem, in FspPath path, ulong id, FileSystemProxyType fsType);
|
Result OpenFileSystemWithId(ref SharedRef<IFileSystemSf> outFileSystem, ref readonly FspPath path, ulong id, FileSystemProxyType fsType);
|
||||||
Result OpenDataFileSystemByProgramId(ref SharedRef<IFileSystemSf> outFileSystem, ProgramId programId);
|
Result OpenDataFileSystemByProgramId(ref SharedRef<IFileSystemSf> outFileSystem, ProgramId programId);
|
||||||
Result OpenBisFileSystem(ref SharedRef<IFileSystemSf> outFileSystem, in FspPath rootPath, BisPartitionId partitionId);
|
Result OpenBisFileSystem(ref SharedRef<IFileSystemSf> outFileSystem, ref readonly FspPath rootPath, BisPartitionId partitionId);
|
||||||
Result OpenBisStorage(ref SharedRef<IStorageSf> outStorage, BisPartitionId partitionId);
|
Result OpenBisStorage(ref SharedRef<IStorageSf> outStorage, BisPartitionId partitionId);
|
||||||
Result InvalidateBisCache();
|
Result InvalidateBisCache();
|
||||||
Result OpenHostFileSystem(ref SharedRef<IFileSystemSf> outFileSystem, in FspPath path);
|
Result OpenHostFileSystem(ref SharedRef<IFileSystemSf> outFileSystem, ref readonly FspPath path);
|
||||||
Result OpenSdCardFileSystem(ref SharedRef<IFileSystemSf> outFileSystem);
|
Result OpenSdCardFileSystem(ref SharedRef<IFileSystemSf> outFileSystem);
|
||||||
Result FormatSdCardFileSystem();
|
Result FormatSdCardFileSystem();
|
||||||
Result DeleteSaveDataFileSystem(ulong saveDataId);
|
Result DeleteSaveDataFileSystem(ulong saveDataId);
|
||||||
@ -41,7 +41,7 @@ public interface IFileSystemProxy : IDisposable
|
|||||||
Result DeleteCacheStorage(ushort index);
|
Result DeleteCacheStorage(ushort index);
|
||||||
Result GetCacheStorageSize(out long dataSize, out long journalSize, ushort index);
|
Result GetCacheStorageSize(out long dataSize, out long journalSize, ushort index);
|
||||||
Result CreateSaveDataFileSystemWithHashSalt(in SaveDataAttribute attribute, in SaveDataCreationInfo creationInfo, in SaveDataMetaInfo metaInfo, in HashSalt hashSalt);
|
Result CreateSaveDataFileSystemWithHashSalt(in SaveDataAttribute attribute, in SaveDataCreationInfo creationInfo, in SaveDataMetaInfo metaInfo, in HashSalt hashSalt);
|
||||||
Result OpenHostFileSystemWithOption(ref SharedRef<IFileSystemSf> outFileSystem, in FspPath path, MountHostOption option);
|
Result OpenHostFileSystemWithOption(ref SharedRef<IFileSystemSf> outFileSystem, ref readonly FspPath path, MountHostOption option);
|
||||||
Result CreateSaveDataFileSystemWithCreationInfo2(in SaveDataCreationInfo2 creationInfo);
|
Result CreateSaveDataFileSystemWithCreationInfo2(in SaveDataCreationInfo2 creationInfo);
|
||||||
Result OpenSaveDataFileSystem(ref SharedRef<IFileSystemSf> outFileSystem, SaveDataSpaceId spaceId, in SaveDataAttribute attribute);
|
Result OpenSaveDataFileSystem(ref SharedRef<IFileSystemSf> outFileSystem, SaveDataSpaceId spaceId, in SaveDataAttribute attribute);
|
||||||
Result OpenSaveDataFileSystemBySystemSaveDataId(ref SharedRef<IFileSystemSf> outFileSystem, SaveDataSpaceId spaceId, in SaveDataAttribute attribute);
|
Result OpenSaveDataFileSystemBySystemSaveDataId(ref SharedRef<IFileSystemSf> outFileSystem, SaveDataSpaceId spaceId, in SaveDataAttribute attribute);
|
||||||
@ -79,7 +79,7 @@ public interface IFileSystemProxy : IDisposable
|
|||||||
Result OpenDataStorageByDataId(ref SharedRef<IStorageSf> outStorage, DataId dataId, StorageId storageId);
|
Result OpenDataStorageByDataId(ref SharedRef<IStorageSf> outStorage, DataId dataId, StorageId storageId);
|
||||||
Result OpenPatchDataStorageByCurrentProcess(ref SharedRef<IStorageSf> outStorage);
|
Result OpenPatchDataStorageByCurrentProcess(ref SharedRef<IStorageSf> outStorage);
|
||||||
Result OpenDataFileSystemWithProgramIndex(ref SharedRef<IFileSystemSf> outFileSystem, byte programIndex);
|
Result OpenDataFileSystemWithProgramIndex(ref SharedRef<IFileSystemSf> outFileSystem, byte programIndex);
|
||||||
Result OpenDataStorageByPath(ref SharedRef<IFileSystemSf> outFileSystem, in FspPath path, FileSystemProxyType fsType);
|
Result OpenDataStorageByPath(ref SharedRef<IFileSystemSf> outFileSystem, ref readonly FspPath path, FileSystemProxyType fsType);
|
||||||
Result OpenDataStorageWithProgramIndex(ref SharedRef<IStorageSf> outStorage, byte programIndex);
|
Result OpenDataStorageWithProgramIndex(ref SharedRef<IStorageSf> outStorage, byte programIndex);
|
||||||
Result OpenDeviceOperator(ref SharedRef<IDeviceOperator> outDeviceOperator);
|
Result OpenDeviceOperator(ref SharedRef<IDeviceOperator> outDeviceOperator);
|
||||||
Result OpenSdCardDetectionEventNotifier(ref SharedRef<IEventNotifier> outEventNotifier);
|
Result OpenSdCardDetectionEventNotifier(ref SharedRef<IEventNotifier> outEventNotifier);
|
||||||
@ -95,8 +95,8 @@ public interface IFileSystemProxy : IDisposable
|
|||||||
Result GetRightsId(out RightsId rightsId, ProgramId programId, StorageId storageId);
|
Result GetRightsId(out RightsId rightsId, ProgramId programId, StorageId storageId);
|
||||||
Result RegisterExternalKey(in RightsId rightsId, in AccessKey externalKey);
|
Result RegisterExternalKey(in RightsId rightsId, in AccessKey externalKey);
|
||||||
Result UnregisterAllExternalKey();
|
Result UnregisterAllExternalKey();
|
||||||
Result GetRightsIdByPath(out RightsId rightsId, in FspPath path);
|
Result GetRightsIdByPath(out RightsId rightsId, ref readonly FspPath path);
|
||||||
Result GetRightsIdAndKeyGenerationByPath(out RightsId rightsId, out byte keyGeneration, in FspPath path);
|
Result GetRightsIdAndKeyGenerationByPath(out RightsId rightsId, out byte keyGeneration, ref readonly FspPath path);
|
||||||
Result SetCurrentPosixTimeWithTimeDifference(long currentTime, int timeDifference);
|
Result SetCurrentPosixTimeWithTimeDifference(long currentTime, int timeDifference);
|
||||||
Result GetFreeSpaceSizeForSaveData(out long freeSpaceSize, SaveDataSpaceId spaceId);
|
Result GetFreeSpaceSizeForSaveData(out long freeSpaceSize, SaveDataSpaceId spaceId);
|
||||||
Result VerifySaveDataFileSystemBySaveDataSpaceId(SaveDataSpaceId spaceId, ulong saveDataId, OutBuffer readBuffer);
|
Result VerifySaveDataFileSystemBySaveDataSpaceId(SaveDataSpaceId spaceId, ulong saveDataId, OutBuffer readBuffer);
|
||||||
@ -114,9 +114,9 @@ public interface IFileSystemProxy : IDisposable
|
|||||||
Result AbandonAccessFailure(ulong processId);
|
Result AbandonAccessFailure(ulong processId);
|
||||||
Result GetAndClearErrorInfo(out FileSystemProxyErrorInfo errorInfo);
|
Result GetAndClearErrorInfo(out FileSystemProxyErrorInfo errorInfo);
|
||||||
Result RegisterProgramIndexMapInfo(InBuffer programIndexMapInfoBuffer, int programCount);
|
Result RegisterProgramIndexMapInfo(InBuffer programIndexMapInfoBuffer, int programCount);
|
||||||
Result SetBisRootForHost(BisPartitionId partitionId, in FspPath path);
|
Result SetBisRootForHost(BisPartitionId partitionId, ref readonly FspPath path);
|
||||||
Result SetSaveDataSize(long saveDataSize, long saveDataJournalSize);
|
Result SetSaveDataSize(long saveDataSize, long saveDataJournalSize);
|
||||||
Result SetSaveDataRootPath(in FspPath path);
|
Result SetSaveDataRootPath(ref readonly FspPath path);
|
||||||
Result DisableAutoSaveDataCreation();
|
Result DisableAutoSaveDataCreation();
|
||||||
Result SetGlobalAccessLogMode(GlobalAccessLogMode mode);
|
Result SetGlobalAccessLogMode(GlobalAccessLogMode mode);
|
||||||
Result GetGlobalAccessLogMode(out GlobalAccessLogMode mode);
|
Result GetGlobalAccessLogMode(out GlobalAccessLogMode mode);
|
||||||
|
@ -9,7 +9,7 @@ namespace LibHac.FsSrv.Sf;
|
|||||||
public interface IFileSystemProxyForLoader : IDisposable
|
public interface IFileSystemProxyForLoader : IDisposable
|
||||||
{
|
{
|
||||||
Result OpenCodeFileSystem(ref SharedRef<IFileSystemSf> fileSystem,
|
Result OpenCodeFileSystem(ref SharedRef<IFileSystemSf> fileSystem,
|
||||||
out CodeVerificationData verificationData, in FspPath path, ProgramId programId);
|
out CodeVerificationData verificationData, ref readonly FspPath path, ProgramId programId);
|
||||||
|
|
||||||
Result IsArchivedProgram(out bool isArchived, ulong processId);
|
Result IsArchivedProgram(out bool isArchived, ulong processId);
|
||||||
Result SetCurrentProcess(ulong processId);
|
Result SetCurrentProcess(ulong processId);
|
||||||
|
@ -11,8 +11,8 @@ public interface ISaveDataTransferManagerForSaveDataRepair : IDisposable
|
|||||||
public Result SetKeyPackage(InBuffer keyPackage);
|
public Result SetKeyPackage(InBuffer keyPackage);
|
||||||
public Result OpenSaveDataExporterAndGetEncryptedKey(ref SharedRef<ISaveDataDivisionExporter> outExporter, out RsaEncryptedKey key, SaveDataSpaceId spaceId, ulong saveDataId);
|
public Result OpenSaveDataExporterAndGetEncryptedKey(ref SharedRef<ISaveDataDivisionExporter> outExporter, out RsaEncryptedKey key, SaveDataSpaceId spaceId, ulong saveDataId);
|
||||||
public Result PrepareOpenSaveDataImporter(out RsaEncryptedKey key);
|
public Result PrepareOpenSaveDataImporter(out RsaEncryptedKey key);
|
||||||
public Result OpenSaveDataImporterForSaveDataAfterRepair(ref SharedRef<ISaveDataDivisionImporter> outImporter, InBuffer initialDataBeforeRepair, InBuffer initialDataAfterRepair, UserId userId, SaveDataSpaceId spaceId);
|
public Result OpenSaveDataImporterForSaveDataAfterRepair(ref SharedRef<ISaveDataDivisionImporter> outImporter, InBuffer initialDataBeforeRepair, InBuffer initialDataAfterRepair, in UserId userId, SaveDataSpaceId spaceId);
|
||||||
public Result OpenSaveDataImporterForSaveDataBeforeRepair(ref SharedRef<ISaveDataDivisionImporter> outImporter, InBuffer initialData, UserId userId, SaveDataSpaceId spaceId);
|
public Result OpenSaveDataImporterForSaveDataBeforeRepair(ref SharedRef<ISaveDataDivisionImporter> outImporter, InBuffer initialData, in UserId userId, SaveDataSpaceId spaceId);
|
||||||
public Result OpenSaveDataExporterWithKey(ref SharedRef<ISaveDataDivisionExporter> outExporter, in AesKey key, SaveDataSpaceId spaceId, ulong saveDataId);
|
public Result OpenSaveDataExporterWithKey(ref SharedRef<ISaveDataDivisionExporter> outExporter, in AesKey key, SaveDataSpaceId spaceId, ulong saveDataId);
|
||||||
public Result OpenSaveDataImporterWithKey(ref SharedRef<ISaveDataDivisionImporter> outImporter, in AesKey key, InBuffer initialData, UserId userId, ulong saveDataSpaceId);
|
public Result OpenSaveDataImporterWithKey(ref SharedRef<ISaveDataDivisionImporter> outImporter, in AesKey key, InBuffer initialData, in UserId userId, ulong saveDataSpaceId);
|
||||||
}
|
}
|
@ -126,7 +126,7 @@ public class AesCtrCounterExtendedStorage : IStorage
|
|||||||
|
|
||||||
// ReSharper disable once UnusedMember.Local
|
// ReSharper disable once UnusedMember.Local
|
||||||
private Result Initialize(MemoryResource allocator, ReadOnlySpan<byte> key, uint secureValue,
|
private Result Initialize(MemoryResource allocator, ReadOnlySpan<byte> key, uint secureValue,
|
||||||
in ValueSubStorage dataStorage, in ValueSubStorage tableStorage)
|
ref readonly ValueSubStorage dataStorage, ref readonly ValueSubStorage tableStorage)
|
||||||
{
|
{
|
||||||
Unsafe.SkipInit(out BucketTree.Header header);
|
Unsafe.SkipInit(out BucketTree.Header header);
|
||||||
|
|
||||||
@ -159,8 +159,8 @@ public class AesCtrCounterExtendedStorage : IStorage
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Result Initialize(MemoryResource allocator, ReadOnlySpan<byte> key, uint secureValue, long counterOffset,
|
public Result Initialize(MemoryResource allocator, ReadOnlySpan<byte> key, uint secureValue, long counterOffset,
|
||||||
in ValueSubStorage dataStorage, in ValueSubStorage nodeStorage, in ValueSubStorage entryStorage, int entryCount,
|
ref readonly ValueSubStorage dataStorage, ref readonly ValueSubStorage nodeStorage,
|
||||||
ref UniqueRef<IDecryptor> decryptor)
|
ref readonly ValueSubStorage entryStorage, int entryCount, ref UniqueRef<IDecryptor> decryptor)
|
||||||
{
|
{
|
||||||
Assert.SdkRequiresEqual(key.Length, KeySize);
|
Assert.SdkRequiresEqual(key.Length, KeySize);
|
||||||
Assert.SdkRequiresGreaterEqual(counterOffset, 0);
|
Assert.SdkRequiresGreaterEqual(counterOffset, 0);
|
||||||
|
@ -50,7 +50,7 @@ public class AesCtrStorage : IStorage
|
|||||||
iv.CopyTo(_iv);
|
iv.CopyTo(_iv);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AesCtrStorage(in SharedRef<IStorage> baseStorage, ReadOnlySpan<byte> key, ReadOnlySpan<byte> iv)
|
public AesCtrStorage(ref readonly SharedRef<IStorage> baseStorage, ReadOnlySpan<byte> key, ReadOnlySpan<byte> iv)
|
||||||
{
|
{
|
||||||
Assert.SdkRequiresNotNull(in baseStorage);
|
Assert.SdkRequiresNotNull(in baseStorage);
|
||||||
Assert.SdkRequiresEqual(key.Length, KeySize);
|
Assert.SdkRequiresEqual(key.Length, KeySize);
|
||||||
|
@ -53,7 +53,7 @@ public class AesXtsStorageExternal : IStorage
|
|||||||
iv.CopyTo(_iv);
|
iv.CopyTo(_iv);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AesXtsStorageExternal(in SharedRef<IStorage> baseStorage, ReadOnlySpan<byte> key1, ReadOnlySpan<byte> key2,
|
public AesXtsStorageExternal(ref readonly SharedRef<IStorage> baseStorage, ReadOnlySpan<byte> key1, ReadOnlySpan<byte> key2,
|
||||||
ReadOnlySpan<byte> iv, uint blockSize, CryptAesXtsFunction encryptFunction, CryptAesXtsFunction decryptFunction)
|
ReadOnlySpan<byte> iv, uint blockSize, CryptAesXtsFunction encryptFunction, CryptAesXtsFunction decryptFunction)
|
||||||
: this(baseStorage.Get, key1, key2, iv, blockSize, encryptFunction, decryptFunction)
|
: this(baseStorage.Get, key1, key2, iv, blockSize, encryptFunction, decryptFunction)
|
||||||
{
|
{
|
||||||
|
@ -205,7 +205,7 @@ public class AlignmentMatchingStoragePooledBuffer<TBufferAlignment> : IStorage
|
|||||||
Assert.SdkRequires(BitUtil.IsPowerOfTwo(dataAlign), "DataAlign must be a power of 2.");
|
Assert.SdkRequires(BitUtil.IsPowerOfTwo(dataAlign), "DataAlign must be a power of 2.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public AlignmentMatchingStoragePooledBuffer(in SharedRef<IStorage> baseStorage, int dataAlign)
|
public AlignmentMatchingStoragePooledBuffer(ref readonly SharedRef<IStorage> baseStorage, int dataAlign)
|
||||||
{
|
{
|
||||||
Abort.DoAbortUnless(BitUtil.IsPowerOfTwo(BufferAlign));
|
Abort.DoAbortUnless(BitUtil.IsPowerOfTwo(BufferAlign));
|
||||||
|
|
||||||
@ -345,7 +345,7 @@ public class AlignmentMatchingStorageInBulkRead<TBufferAlignment> : IStorage
|
|||||||
Assert.SdkRequires(BitUtil.IsPowerOfTwo(dataAlignment));
|
Assert.SdkRequires(BitUtil.IsPowerOfTwo(dataAlignment));
|
||||||
}
|
}
|
||||||
|
|
||||||
public AlignmentMatchingStorageInBulkRead(in SharedRef<IStorage> baseStorage, int dataAlignment)
|
public AlignmentMatchingStorageInBulkRead(ref readonly SharedRef<IStorage> baseStorage, int dataAlignment)
|
||||||
{
|
{
|
||||||
Abort.DoAbortUnless(BitUtil.IsPowerOfTwo(BufferAlign));
|
Abort.DoAbortUnless(BitUtil.IsPowerOfTwo(BufferAlign));
|
||||||
|
|
||||||
|
@ -33,13 +33,13 @@ public static class AlignmentMatchingStorageImpl
|
|||||||
return (uint)(Alignment.AlignUp(value, alignment) - value);
|
return (uint)(Alignment.AlignUp(value, alignment) - value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result Read(in SharedRef<IStorage> storage, Span<byte> workBuffer, uint dataAlignment,
|
public static Result Read(ref readonly SharedRef<IStorage> storage, Span<byte> workBuffer, uint dataAlignment,
|
||||||
uint bufferAlignment, long offset, Span<byte> destination)
|
uint bufferAlignment, long offset, Span<byte> destination)
|
||||||
{
|
{
|
||||||
return Read(storage.Get, workBuffer, dataAlignment, bufferAlignment, offset, destination);
|
return Read(storage.Get, workBuffer, dataAlignment, bufferAlignment, offset, destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result Write(in SharedRef<IStorage> storage, Span<byte> subBuffer, uint dataAlignment,
|
public static Result Write(ref readonly SharedRef<IStorage> storage, Span<byte> subBuffer, uint dataAlignment,
|
||||||
uint bufferAlignment, long offset, ReadOnlySpan<byte> source)
|
uint bufferAlignment, long offset, ReadOnlySpan<byte> source)
|
||||||
{
|
{
|
||||||
return Write(storage.Get, subBuffer, dataAlignment, bufferAlignment, offset, source);
|
return Write(storage.Get, subBuffer, dataAlignment, bufferAlignment, offset, source);
|
||||||
|
@ -7,57 +7,57 @@ namespace LibHac.FsSystem;
|
|||||||
|
|
||||||
public class ApplicationTemporaryFileSystem : IFileSystem, ISaveDataExtraDataAccessor
|
public class ApplicationTemporaryFileSystem : IFileSystem, ISaveDataExtraDataAccessor
|
||||||
{
|
{
|
||||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option)
|
protected override Result DoCreateFile(ref readonly Path path, long size, CreateFileOptions option)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteFile(in Path path)
|
protected override Result DoDeleteFile(ref readonly Path path)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCreateDirectory(in Path path)
|
protected override Result DoCreateDirectory(ref readonly Path path)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteDirectory(in Path path)
|
protected override Result DoDeleteDirectory(ref readonly Path path)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
protected override Result DoDeleteDirectoryRecursively(ref readonly Path path)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
protected override Result DoCleanDirectoryRecursively(ref readonly Path path)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath)
|
protected override Result DoRenameFile(ref readonly Path currentPath, ref readonly Path newPath)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath)
|
protected override Result DoRenameDirectory(ref readonly Path currentPath, ref readonly Path newPath)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
protected override Result DoGetEntryType(out DirectoryEntryType entryType, ref readonly Path path)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, in Path path, OpenMode mode)
|
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, ref readonly Path path, OpenMode mode)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, in Path path,
|
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, ref readonly Path path,
|
||||||
OpenDirectoryMode mode)
|
OpenDirectoryMode mode)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
@ -62,7 +62,7 @@ file struct StorageNode
|
|||||||
_index = (int)(pos - _start) - 1;
|
_index = (int)(pos - _start) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result Find(in ValueSubStorage storage, long virtualAddress)
|
public Result Find(ref readonly ValueSubStorage storage, long virtualAddress)
|
||||||
{
|
{
|
||||||
int end = _count;
|
int end = _count;
|
||||||
Offset pos = _start;
|
Offset pos = _start;
|
||||||
@ -489,8 +489,8 @@ public partial class BucketTree : IDisposable
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result Initialize(MemoryResource allocator, in ValueSubStorage nodeStorage, in ValueSubStorage entryStorage,
|
public Result Initialize(MemoryResource allocator, ref readonly ValueSubStorage nodeStorage,
|
||||||
int nodeSize, int entrySize, int entryCount)
|
ref readonly ValueSubStorage entryStorage, int nodeSize, int entrySize, int entryCount)
|
||||||
{
|
{
|
||||||
Assert.SdkRequiresNotNull(allocator);
|
Assert.SdkRequiresNotNull(allocator);
|
||||||
Assert.SdkRequiresLessEqual(sizeof(long), entrySize);
|
Assert.SdkRequiresLessEqual(sizeof(long), entrySize);
|
||||||
@ -683,7 +683,7 @@ public partial class BucketTree : IDisposable
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Result ScanContinuousReading<TEntry>(out ContinuousReadingInfo info,
|
private Result ScanContinuousReading<TEntry>(out ContinuousReadingInfo info,
|
||||||
in ContinuousReadingParam<TEntry> param) where TEntry : unmanaged, IContinuousReadingEntry
|
ref readonly ContinuousReadingParam<TEntry> param) where TEntry : unmanaged, IContinuousReadingEntry
|
||||||
{
|
{
|
||||||
Assert.SdkRequires(IsInitialized());
|
Assert.SdkRequires(IsInitialized());
|
||||||
Assert.Equal(Unsafe.SizeOf<TEntry>(), _entrySize);
|
Assert.Equal(Unsafe.SizeOf<TEntry>(), _entrySize);
|
||||||
|
@ -45,9 +45,9 @@ public partial class BucketTree
|
|||||||
/// <param name="entrySize">The size of each entry that will be stored in the bucket tree.</param>
|
/// <param name="entrySize">The size of each entry that will be stored in the bucket tree.</param>
|
||||||
/// <param name="entryCount">The exact number of entries that will be added to the bucket tree.</param>
|
/// <param name="entryCount">The exact number of entries that will be added to the bucket tree.</param>
|
||||||
/// <returns>The <see cref="Result"/> of the operation.</returns>
|
/// <returns>The <see cref="Result"/> of the operation.</returns>
|
||||||
public Result Initialize(MemoryResource allocator, in ValueSubStorage headerStorage,
|
public Result Initialize(MemoryResource allocator, ref readonly ValueSubStorage headerStorage,
|
||||||
in ValueSubStorage nodeStorage, in ValueSubStorage entryStorage, int nodeSize, int entrySize,
|
ref readonly ValueSubStorage nodeStorage, ref readonly ValueSubStorage entryStorage, int nodeSize,
|
||||||
int entryCount)
|
int entrySize, int entryCount)
|
||||||
{
|
{
|
||||||
Assert.NotNull(allocator);
|
Assert.NotNull(allocator);
|
||||||
Assert.SdkRequiresLessEqual(sizeof(long), entrySize);
|
Assert.SdkRequiresLessEqual(sizeof(long), entrySize);
|
||||||
|
@ -891,7 +891,7 @@ public class BufferedStorage : IStorage
|
|||||||
/// <param name="sharedCache">The <see cref="SharedCache"/> to gain exclusive access to.</param>
|
/// <param name="sharedCache">The <see cref="SharedCache"/> to gain exclusive access to.</param>
|
||||||
/// <returns>The <see cref="Result"/> of the operation, and <see langword="true"/> if exclusive
|
/// <returns>The <see cref="Result"/> of the operation, and <see langword="true"/> if exclusive
|
||||||
/// access to the <see cref="_cache"/> was gained; <see langword="false"/> if not.</returns>
|
/// access to the <see cref="_cache"/> was gained; <see langword="false"/> if not.</returns>
|
||||||
public (Result Result, bool wasUpgradeSuccessful) Upgrade(in SharedCache sharedCache)
|
public (Result Result, bool wasUpgradeSuccessful) Upgrade(ref readonly SharedCache sharedCache)
|
||||||
{
|
{
|
||||||
Assert.SdkRequires(_bufferedStorage == sharedCache.BufferedStorage);
|
Assert.SdkRequires(_bufferedStorage == sharedCache.BufferedStorage);
|
||||||
Assert.SdkRequires(!sharedCache.Cache.IsNull);
|
Assert.SdkRequires(!sharedCache.Cache.IsNull);
|
||||||
@ -989,7 +989,8 @@ public class BufferedStorage : IStorage
|
|||||||
/// <param name="blockSize">The size of each cached block. Must be a power of 2.</param>
|
/// <param name="blockSize">The size of each cached block. Must be a power of 2.</param>
|
||||||
/// <param name="bufferCount">The maximum number of blocks that can be cached at one time.</param>
|
/// <param name="bufferCount">The maximum number of blocks that can be cached at one time.</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public Result Initialize(in ValueSubStorage baseStorage, IBufferManager bufferManager, int blockSize, int bufferCount)
|
public Result Initialize(ref readonly ValueSubStorage baseStorage, IBufferManager bufferManager, int blockSize,
|
||||||
|
int bufferCount)
|
||||||
{
|
{
|
||||||
Assert.SdkRequiresNotNull(bufferManager);
|
Assert.SdkRequiresNotNull(bufferManager);
|
||||||
Assert.SdkRequiresLess(0, blockSize);
|
Assert.SdkRequiresLess(0, blockSize);
|
||||||
|
@ -64,9 +64,10 @@ public class CompressedStorage : IStorage, IAsynchronousAccessSplitter
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result Initialize(MemoryResource allocatorForBucketTree, in ValueSubStorage dataStorage,
|
public Result Initialize(MemoryResource allocatorForBucketTree, ref readonly ValueSubStorage dataStorage,
|
||||||
in ValueSubStorage nodeStorage, in ValueSubStorage entryStorage, int bucketTreeEntryCount,
|
ref readonly ValueSubStorage nodeStorage, ref readonly ValueSubStorage entryStorage,
|
||||||
long blockSizeMax, long continuousReadingSizeMax, GetDecompressorFunction getDecompressorFunc)
|
int bucketTreeEntryCount, long blockSizeMax, long continuousReadingSizeMax,
|
||||||
|
GetDecompressorFunction getDecompressorFunc)
|
||||||
{
|
{
|
||||||
Assert.SdkRequiresNotNull(allocatorForBucketTree);
|
Assert.SdkRequiresNotNull(allocatorForBucketTree);
|
||||||
Assert.SdkRequiresLess(0, blockSizeMax);
|
Assert.SdkRequiresLess(0, blockSizeMax);
|
||||||
@ -296,9 +297,10 @@ public class CompressedStorage : IStorage, IAsynchronousAccessSplitter
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Result Initialize(MemoryResource allocatorForBucketTree, IBufferManager allocatorForCacheManager,
|
public Result Initialize(MemoryResource allocatorForBucketTree, IBufferManager allocatorForCacheManager,
|
||||||
in ValueSubStorage dataStorage, in ValueSubStorage nodeStorage, in ValueSubStorage entryStorage,
|
ref readonly ValueSubStorage dataStorage, ref readonly ValueSubStorage nodeStorage,
|
||||||
int bucketTreeEntryCount, long blockSizeMax, long continuousReadingSizeMax,
|
ref readonly ValueSubStorage entryStorage, int bucketTreeEntryCount, long blockSizeMax,
|
||||||
GetDecompressorFunction getDecompressorFunc, long cacheSize0, long cacheSize1, int maxCacheEntries)
|
long continuousReadingSizeMax, GetDecompressorFunction getDecompressorFunc, long cacheSize0, long cacheSize1,
|
||||||
|
int maxCacheEntries)
|
||||||
{
|
{
|
||||||
Result res = _core.Initialize(allocatorForBucketTree, in dataStorage, in nodeStorage, in entryStorage,
|
Result res = _core.Initialize(allocatorForBucketTree, in dataStorage, in nodeStorage, in entryStorage,
|
||||||
bucketTreeEntryCount, blockSizeMax, continuousReadingSizeMax, getDecompressorFunc);
|
bucketTreeEntryCount, blockSizeMax, continuousReadingSizeMax, getDecompressorFunc);
|
||||||
|
@ -63,7 +63,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||||||
base.Dispose();
|
base.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result Initialize(in Path path)
|
public Result Initialize(ref readonly Path path)
|
||||||
{
|
{
|
||||||
return _path.Initialize(in path).Ret();
|
return _path.Initialize(in path).Ret();
|
||||||
}
|
}
|
||||||
@ -401,7 +401,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||||||
base.Dispose();
|
base.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result Initialize(in Path path)
|
public Result Initialize(ref readonly Path path)
|
||||||
{
|
{
|
||||||
return _path.Initialize(in path).Ret();
|
return _path.Initialize(in path).Ret();
|
||||||
}
|
}
|
||||||
@ -481,7 +481,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsReadTarget(in DirectoryEntry entry)
|
private bool IsReadTarget(ref readonly DirectoryEntry entry)
|
||||||
{
|
{
|
||||||
bool hasConcatAttribute = IsConcatenationFileAttribute(entry.Attributes);
|
bool hasConcatAttribute = IsConcatenationFileAttribute(entry.Attributes);
|
||||||
|
|
||||||
@ -540,7 +540,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||||||
return path.AppendChild(buffer).Ret();
|
return path.AppendChild(buffer).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Result GenerateInternalFilePath(ref Path outPath, int index, in Path basePath)
|
private static Result GenerateInternalFilePath(ref Path outPath, int index, ref readonly Path basePath)
|
||||||
{
|
{
|
||||||
Result res = outPath.Initialize(in basePath);
|
Result res = outPath.Initialize(in basePath);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -548,7 +548,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||||||
return AppendInternalFilePath(ref outPath, index).Ret();
|
return AppendInternalFilePath(ref outPath, index).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Result GenerateParentPath(ref Path outParentPath, in Path path)
|
private static Result GenerateParentPath(ref Path outParentPath, ref readonly Path path)
|
||||||
{
|
{
|
||||||
if (path == RootPath)
|
if (path == RootPath)
|
||||||
return ResultFs.PathNotFound.Log();
|
return ResultFs.PathNotFound.Log();
|
||||||
@ -564,7 +564,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||||||
return attribute.HasFlag(NxFileAttributes.Directory | NxFileAttributes.Archive);
|
return attribute.HasFlag(NxFileAttributes.Directory | NxFileAttributes.Archive);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsConcatenationFile(in Path path)
|
private bool IsConcatenationFile(ref readonly Path path)
|
||||||
{
|
{
|
||||||
Result res = _baseFileSystem.Get.GetFileAttributes(out NxFileAttributes attribute, in path);
|
Result res = _baseFileSystem.Get.GetFileAttributes(out NxFileAttributes attribute, in path);
|
||||||
if (res.IsFailure())
|
if (res.IsFailure())
|
||||||
@ -573,7 +573,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||||||
return IsConcatenationFileAttribute(attribute);
|
return IsConcatenationFileAttribute(attribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Result GetInternalFileCount(out int count, in Path path)
|
private Result GetInternalFileCount(out int count, ref readonly Path path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out count);
|
UnsafeHelpers.SkipParamInit(out count);
|
||||||
|
|
||||||
@ -608,7 +608,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
protected override Result DoGetEntryType(out DirectoryEntryType entryType, ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
||||||
|
|
||||||
@ -618,28 +618,28 @@ public class ConcatenationFileSystem : IFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _baseFileSystem.Get.GetEntryType(out entryType, path).Ret();
|
return _baseFileSystem.Get.GetEntryType(out entryType, in path).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, in Path path)
|
protected override Result DoGetFreeSpaceSize(out long freeSpace, ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
||||||
|
|
||||||
return _baseFileSystem.Get.GetFreeSpaceSize(out freeSpace, path).Ret();
|
return _baseFileSystem.Get.GetFreeSpaceSize(out freeSpace, in path).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, in Path path)
|
protected override Result DoGetTotalSpaceSize(out long totalSpace, ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
||||||
|
|
||||||
return _baseFileSystem.Get.GetTotalSpaceSize(out totalSpace, path).Ret();
|
return _baseFileSystem.Get.GetTotalSpaceSize(out totalSpace, in path).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, in Path path)
|
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
||||||
|
|
||||||
return _baseFileSystem.Get.GetFileTimeStampRaw(out timeStamp, path).Ret();
|
return _baseFileSystem.Get.GetFileTimeStampRaw(out timeStamp, in path).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoFlush()
|
protected override Result DoFlush()
|
||||||
@ -649,7 +649,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||||||
return _baseFileSystem.Get.Flush().Ret();
|
return _baseFileSystem.Get.Flush().Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, in Path path, OpenMode mode)
|
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, ref readonly Path path, OpenMode mode)
|
||||||
{
|
{
|
||||||
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
||||||
|
|
||||||
@ -708,18 +708,18 @@ public class ConcatenationFileSystem : IFileSystem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, in Path path,
|
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, ref readonly Path path,
|
||||||
OpenDirectoryMode mode)
|
OpenDirectoryMode mode)
|
||||||
{
|
{
|
||||||
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
||||||
|
|
||||||
if (IsConcatenationFile(path))
|
if (IsConcatenationFile(in path))
|
||||||
{
|
{
|
||||||
return ResultFs.PathNotFound.Log();
|
return ResultFs.PathNotFound.Log();
|
||||||
}
|
}
|
||||||
|
|
||||||
using var baseDirectory = new UniqueRef<IDirectory>();
|
using var baseDirectory = new UniqueRef<IDirectory>();
|
||||||
Result res = _baseFileSystem.Get.OpenDirectory(ref baseDirectory.Ref, path, OpenDirectoryMode.All);
|
Result res = _baseFileSystem.Get.OpenDirectory(ref baseDirectory.Ref, in path, OpenDirectoryMode.All);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
using var concatDirectory = new UniqueRef<ConcatenationDirectory>(
|
using var concatDirectory = new UniqueRef<ConcatenationDirectory>(
|
||||||
@ -731,7 +731,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option)
|
protected override Result DoCreateFile(ref readonly Path path, long size, CreateFileOptions option)
|
||||||
{
|
{
|
||||||
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
||||||
|
|
||||||
@ -740,7 +740,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||||||
// Create a normal file if the concatenation file flag isn't set
|
// Create a normal file if the concatenation file flag isn't set
|
||||||
if (!option.HasFlag(CreateFileOptions.CreateConcatenationFile))
|
if (!option.HasFlag(CreateFileOptions.CreateConcatenationFile))
|
||||||
{
|
{
|
||||||
return _baseFileSystem.Get.CreateFile(path, size, newOption).Ret();
|
return _baseFileSystem.Get.CreateFile(in path, size, newOption).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
using var parentPath = new Path();
|
using var parentPath = new Path();
|
||||||
@ -815,7 +815,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteFile(in Path path)
|
protected override Result DoDeleteFile(ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
||||||
|
|
||||||
@ -824,7 +824,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||||||
return _baseFileSystem.Get.DeleteFile(in path).Ret();
|
return _baseFileSystem.Get.DeleteFile(in path).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result res = GetInternalFileCount(out int count, path);
|
Result res = GetInternalFileCount(out int count, in path);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
using var filePath = new Path();
|
using var filePath = new Path();
|
||||||
@ -849,7 +849,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCreateDirectory(in Path path)
|
protected override Result DoCreateDirectory(ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
||||||
|
|
||||||
@ -864,26 +864,26 @@ public class ConcatenationFileSystem : IFileSystem
|
|||||||
return _baseFileSystem.Get.CreateDirectory(in path).Ret();
|
return _baseFileSystem.Get.CreateDirectory(in path).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteDirectory(in Path path)
|
protected override Result DoDeleteDirectory(ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
||||||
|
|
||||||
// Make sure the directory isn't a concatenation file.
|
// Make sure the directory isn't a concatenation file.
|
||||||
if (IsConcatenationFile(path))
|
if (IsConcatenationFile(in path))
|
||||||
return ResultFs.PathNotFound.Log();
|
return ResultFs.PathNotFound.Log();
|
||||||
|
|
||||||
return _baseFileSystem.Get.DeleteDirectory(path).Ret();
|
return _baseFileSystem.Get.DeleteDirectory(in path).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Result CleanDirectoryRecursivelyImpl(in Path path)
|
private Result CleanDirectoryRecursivelyImpl(ref readonly Path path)
|
||||||
{
|
{
|
||||||
static Result OnEnterDir(in Path path, in DirectoryEntry entry, ref FsIterationTaskClosure closure) =>
|
static Result OnEnterDir(ref readonly Path path, in DirectoryEntry entry, ref FsIterationTaskClosure closure) =>
|
||||||
Result.Success;
|
Result.Success;
|
||||||
|
|
||||||
static Result OnExitDir(in Path path, in DirectoryEntry entry, ref FsIterationTaskClosure closure) =>
|
static Result OnExitDir(ref readonly Path path, in DirectoryEntry entry, ref FsIterationTaskClosure closure) =>
|
||||||
closure.SourceFileSystem.DeleteDirectory(in path).Ret();
|
closure.SourceFileSystem.DeleteDirectory(in path).Ret();
|
||||||
|
|
||||||
static Result OnFile(in Path path, in DirectoryEntry entry, ref FsIterationTaskClosure closure) =>
|
static Result OnFile(ref readonly Path path, in DirectoryEntry entry, ref FsIterationTaskClosure closure) =>
|
||||||
closure.SourceFileSystem.DeleteFile(in path).Ret();
|
closure.SourceFileSystem.DeleteFile(in path).Ret();
|
||||||
|
|
||||||
var closure = new FsIterationTaskClosure();
|
var closure = new FsIterationTaskClosure();
|
||||||
@ -894,7 +894,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||||||
ref closure).Ret();
|
ref closure).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
protected override Result DoDeleteDirectoryRecursively(ref readonly Path path)
|
||||||
{
|
{
|
||||||
bool isConcatenationFile;
|
bool isConcatenationFile;
|
||||||
using (new ScopedLock<SdkMutexType>(ref _mutex))
|
using (new ScopedLock<SdkMutexType>(ref _mutex))
|
||||||
@ -911,7 +911,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||||||
return _baseFileSystem.Get.DeleteDirectory(in path).Ret();
|
return _baseFileSystem.Get.DeleteDirectory(in path).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
protected override Result DoCleanDirectoryRecursively(ref readonly Path path)
|
||||||
{
|
{
|
||||||
bool isConcatenationFile;
|
bool isConcatenationFile;
|
||||||
using (new ScopedLock<SdkMutexType>(ref _mutex))
|
using (new ScopedLock<SdkMutexType>(ref _mutex))
|
||||||
@ -925,7 +925,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||||||
return CleanDirectoryRecursivelyImpl(in path).Ret();
|
return CleanDirectoryRecursivelyImpl(in path).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath)
|
protected override Result DoRenameFile(ref readonly Path currentPath, ref readonly Path newPath)
|
||||||
{
|
{
|
||||||
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
||||||
|
|
||||||
@ -935,7 +935,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||||||
return _baseFileSystem.Get.RenameFile(in currentPath, in newPath).Ret();
|
return _baseFileSystem.Get.RenameFile(in currentPath, in newPath).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath)
|
protected override Result DoRenameDirectory(ref readonly Path currentPath, ref readonly Path newPath)
|
||||||
{
|
{
|
||||||
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
||||||
|
|
||||||
@ -945,7 +945,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||||||
return _baseFileSystem.Get.RenameDirectory(in currentPath, in newPath).Ret();
|
return _baseFileSystem.Get.RenameDirectory(in currentPath, in newPath).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result GetFileSize(out long size, in Path path)
|
public Result GetFileSize(out long size, ref readonly Path path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out size);
|
UnsafeHelpers.SkipParamInit(out size);
|
||||||
|
|
||||||
@ -987,7 +987,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
||||||
in Path path)
|
ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
||||||
|
|
||||||
|
@ -331,7 +331,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Result ResolvePath(ref Path outFullPath, in Path path)
|
private Result ResolvePath(ref Path outFullPath, ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var pathDirectoryName = new Path();
|
using var pathDirectoryName = new Path();
|
||||||
|
|
||||||
@ -349,7 +349,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option)
|
protected override Result DoCreateFile(ref readonly Path path, long size, CreateFileOptions option)
|
||||||
{
|
{
|
||||||
using var fullPath = new Path();
|
using var fullPath = new Path();
|
||||||
Result res = ResolvePath(ref fullPath.Ref(), in path);
|
Result res = ResolvePath(ref fullPath.Ref(), in path);
|
||||||
@ -363,7 +363,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteFile(in Path path)
|
protected override Result DoDeleteFile(ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var fullPath = new Path();
|
using var fullPath = new Path();
|
||||||
Result res = ResolvePath(ref fullPath.Ref(), in path);
|
Result res = ResolvePath(ref fullPath.Ref(), in path);
|
||||||
@ -377,7 +377,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCreateDirectory(in Path path)
|
protected override Result DoCreateDirectory(ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var fullPath = new Path();
|
using var fullPath = new Path();
|
||||||
Result res = ResolvePath(ref fullPath.Ref(), in path);
|
Result res = ResolvePath(ref fullPath.Ref(), in path);
|
||||||
@ -391,7 +391,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteDirectory(in Path path)
|
protected override Result DoDeleteDirectory(ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var fullPath = new Path();
|
using var fullPath = new Path();
|
||||||
Result res = ResolvePath(ref fullPath.Ref(), in path);
|
Result res = ResolvePath(ref fullPath.Ref(), in path);
|
||||||
@ -405,7 +405,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
protected override Result DoDeleteDirectoryRecursively(ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var fullPath = new Path();
|
using var fullPath = new Path();
|
||||||
Result res = ResolvePath(ref fullPath.Ref(), in path);
|
Result res = ResolvePath(ref fullPath.Ref(), in path);
|
||||||
@ -419,7 +419,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
protected override Result DoCleanDirectoryRecursively(ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var fullPath = new Path();
|
using var fullPath = new Path();
|
||||||
Result res = ResolvePath(ref fullPath.Ref(), in path);
|
Result res = ResolvePath(ref fullPath.Ref(), in path);
|
||||||
@ -433,7 +433,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath)
|
protected override Result DoRenameFile(ref readonly Path currentPath, ref readonly Path newPath)
|
||||||
{
|
{
|
||||||
using var currentFullPath = new Path();
|
using var currentFullPath = new Path();
|
||||||
using var newFullPath = new Path();
|
using var newFullPath = new Path();
|
||||||
@ -452,7 +452,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath)
|
protected override Result DoRenameDirectory(ref readonly Path currentPath, ref readonly Path newPath)
|
||||||
{
|
{
|
||||||
using var currentFullPath = new Path();
|
using var currentFullPath = new Path();
|
||||||
using var newFullPath = new Path();
|
using var newFullPath = new Path();
|
||||||
@ -471,7 +471,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
protected override Result DoGetEntryType(out DirectoryEntryType entryType, ref readonly Path path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out entryType);
|
UnsafeHelpers.SkipParamInit(out entryType);
|
||||||
|
|
||||||
@ -487,7 +487,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, in Path path, OpenMode mode)
|
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, ref readonly Path path, OpenMode mode)
|
||||||
{
|
{
|
||||||
using var fullPath = new Path();
|
using var fullPath = new Path();
|
||||||
Result res = ResolvePath(ref fullPath.Ref(), in path);
|
Result res = ResolvePath(ref fullPath.Ref(), in path);
|
||||||
@ -510,7 +510,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, in Path path,
|
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, ref readonly Path path,
|
||||||
OpenDirectoryMode mode)
|
OpenDirectoryMode mode)
|
||||||
{
|
{
|
||||||
using var fullPath = new Path();
|
using var fullPath = new Path();
|
||||||
@ -531,10 +531,10 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||||||
/// <param name="destPath">The path of the destination directory.</param>
|
/// <param name="destPath">The path of the destination directory.</param>
|
||||||
/// <param name="sourcePath">The path of the source directory.</param>
|
/// <param name="sourcePath">The path of the source directory.</param>
|
||||||
/// <returns>The <see cref="Result"/> of the operation.</returns>
|
/// <returns>The <see cref="Result"/> of the operation.</returns>
|
||||||
private Result SynchronizeDirectory(in Path destPath, in Path sourcePath)
|
private Result SynchronizeDirectory(ref readonly Path destPath, ref readonly Path sourcePath)
|
||||||
{
|
{
|
||||||
// Delete destination dir and recreate it.
|
// Delete destination dir and recreate it.
|
||||||
Result res = _baseFs.DeleteDirectoryRecursively(destPath);
|
Result res = _baseFs.DeleteDirectoryRecursively(in destPath);
|
||||||
|
|
||||||
// Changed: Nintendo returns all errors unconditionally because SynchronizeDirectory is always called
|
// Changed: Nintendo returns all errors unconditionally because SynchronizeDirectory is always called
|
||||||
// in situations where a PathNotFound error would mean the save directory was in an invalid state.
|
// in situations where a PathNotFound error would mean the save directory was in an invalid state.
|
||||||
@ -542,7 +542,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||||||
// put the save directory in an invalid state.
|
// put the save directory in an invalid state.
|
||||||
if (res.IsFailure() && !ResultFs.PathNotFound.Includes(res)) return res;
|
if (res.IsFailure() && !ResultFs.PathNotFound.Includes(res)) return res;
|
||||||
|
|
||||||
res = _baseFs.CreateDirectory(destPath);
|
res = _baseFs.CreateDirectory(in destPath);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
var directoryEntry = new DirectoryEntry();
|
var directoryEntry = new DirectoryEntry();
|
||||||
@ -650,7 +650,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, in Path path)
|
protected override Result DoGetFreeSpaceSize(out long freeSpace, ref readonly Path path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out freeSpace);
|
UnsafeHelpers.SkipParamInit(out freeSpace);
|
||||||
|
|
||||||
@ -666,7 +666,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, in Path path)
|
protected override Result DoGetTotalSpaceSize(out long totalSpace, ref readonly Path path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out totalSpace);
|
UnsafeHelpers.SkipParamInit(out totalSpace);
|
||||||
|
|
||||||
@ -895,7 +895,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||||||
return PathFunctions.SetUpFixedPath(ref path, extraDataName);
|
return PathFunctions.SetUpFixedPath(ref path, extraDataName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Result EnsureExtraDataSize(in Path path)
|
private Result EnsureExtraDataSize(ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var file = new UniqueRef<IFile>();
|
using var file = new UniqueRef<IFile>();
|
||||||
Result res = _baseFs.OpenFile(ref file.Ref, in path, OpenMode.ReadWrite);
|
Result res = _baseFs.OpenFile(ref file.Ref, in path, OpenMode.ReadWrite);
|
||||||
@ -910,7 +910,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||||||
return file.Get.SetSize(Unsafe.SizeOf<SaveDataExtraData>());
|
return file.Get.SetSize(Unsafe.SizeOf<SaveDataExtraData>());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Result SynchronizeExtraData(in Path destPath, in Path sourcePath)
|
private Result SynchronizeExtraData(ref readonly Path destPath, ref readonly Path sourcePath)
|
||||||
{
|
{
|
||||||
Span<byte> workBuffer = stackalloc byte[Unsafe.SizeOf<SaveDataExtraData>()];
|
Span<byte> workBuffer = stackalloc byte[Unsafe.SizeOf<SaveDataExtraData>()];
|
||||||
|
|
||||||
@ -961,7 +961,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||||||
return WriteExtraDataImpl(in extraData);
|
return WriteExtraDataImpl(in extraData);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Result WriteExtraDataImpl(in SaveDataExtraData extraData)
|
private Result WriteExtraDataImpl(ref readonly SaveDataExtraData extraData)
|
||||||
{
|
{
|
||||||
Assert.SdkRequires(_mutex.IsLockedByCurrentThread());
|
Assert.SdkRequires(_mutex.IsLockedByCurrentThread());
|
||||||
|
|
||||||
|
@ -90,40 +90,40 @@ public class ForwardingFileSystem : IFileSystem
|
|||||||
base.Dispose();
|
base.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option) =>
|
protected override Result DoCreateFile(ref readonly Path path, long size, CreateFileOptions option) =>
|
||||||
BaseFileSystem.Get.CreateFile(in path, size, option);
|
BaseFileSystem.Get.CreateFile(in path, size, option);
|
||||||
|
|
||||||
protected override Result DoDeleteFile(in Path path) => BaseFileSystem.Get.DeleteFile(in path);
|
protected override Result DoDeleteFile(ref readonly Path path) => BaseFileSystem.Get.DeleteFile(in path);
|
||||||
|
|
||||||
protected override Result DoCreateDirectory(in Path path) => BaseFileSystem.Get.CreateDirectory(in path);
|
protected override Result DoCreateDirectory(ref readonly Path path) => BaseFileSystem.Get.CreateDirectory(in path);
|
||||||
|
|
||||||
protected override Result DoDeleteDirectory(in Path path) => BaseFileSystem.Get.DeleteDirectory(in path);
|
protected override Result DoDeleteDirectory(ref readonly Path path) => BaseFileSystem.Get.DeleteDirectory(in path);
|
||||||
|
|
||||||
protected override Result DoDeleteDirectoryRecursively(in Path path) =>
|
protected override Result DoDeleteDirectoryRecursively(ref readonly Path path) =>
|
||||||
BaseFileSystem.Get.DeleteDirectoryRecursively(in path);
|
BaseFileSystem.Get.DeleteDirectoryRecursively(in path);
|
||||||
|
|
||||||
protected override Result DoCleanDirectoryRecursively(in Path path) =>
|
protected override Result DoCleanDirectoryRecursively(ref readonly Path path) =>
|
||||||
BaseFileSystem.Get.CleanDirectoryRecursively(in path);
|
BaseFileSystem.Get.CleanDirectoryRecursively(in path);
|
||||||
|
|
||||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath) =>
|
protected override Result DoRenameFile(ref readonly Path currentPath, ref readonly Path newPath) =>
|
||||||
BaseFileSystem.Get.RenameFile(in currentPath, in newPath);
|
BaseFileSystem.Get.RenameFile(in currentPath, in newPath);
|
||||||
|
|
||||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath) =>
|
protected override Result DoRenameDirectory(ref readonly Path currentPath, ref readonly Path newPath) =>
|
||||||
BaseFileSystem.Get.RenameDirectory(in currentPath, in newPath);
|
BaseFileSystem.Get.RenameDirectory(in currentPath, in newPath);
|
||||||
|
|
||||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path) =>
|
protected override Result DoGetEntryType(out DirectoryEntryType entryType, ref readonly Path path) =>
|
||||||
BaseFileSystem.Get.GetEntryType(out entryType, in path);
|
BaseFileSystem.Get.GetEntryType(out entryType, in path);
|
||||||
|
|
||||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, in Path path) =>
|
protected override Result DoGetFreeSpaceSize(out long freeSpace, ref readonly Path path) =>
|
||||||
BaseFileSystem.Get.GetFreeSpaceSize(out freeSpace, in path);
|
BaseFileSystem.Get.GetFreeSpaceSize(out freeSpace, in path);
|
||||||
|
|
||||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, in Path path) =>
|
protected override Result DoGetTotalSpaceSize(out long totalSpace, ref readonly Path path) =>
|
||||||
BaseFileSystem.Get.GetTotalSpaceSize(out totalSpace, in path);
|
BaseFileSystem.Get.GetTotalSpaceSize(out totalSpace, in path);
|
||||||
|
|
||||||
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, in Path path, OpenMode mode) =>
|
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, ref readonly Path path, OpenMode mode) =>
|
||||||
BaseFileSystem.Get.OpenFile(ref outFile, in path, mode);
|
BaseFileSystem.Get.OpenFile(ref outFile, in path, mode);
|
||||||
|
|
||||||
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, in Path path,
|
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, ref readonly Path path,
|
||||||
OpenDirectoryMode mode) =>
|
OpenDirectoryMode mode) =>
|
||||||
BaseFileSystem.Get.OpenDirectory(ref outDirectory, in path, mode);
|
BaseFileSystem.Get.OpenDirectory(ref outDirectory, in path, mode);
|
||||||
|
|
||||||
@ -136,12 +136,12 @@ public class ForwardingFileSystem : IFileSystem
|
|||||||
|
|
||||||
protected override Result DoFlush() => BaseFileSystem.Get.Flush();
|
protected override Result DoFlush() => BaseFileSystem.Get.Flush();
|
||||||
|
|
||||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, in Path path) =>
|
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, ref readonly Path path) =>
|
||||||
BaseFileSystem.Get.GetFileTimeStampRaw(out timeStamp, in path);
|
BaseFileSystem.Get.GetFileTimeStampRaw(out timeStamp, in path);
|
||||||
|
|
||||||
protected override Result DoGetFileSystemAttribute(out FileSystemAttribute outAttribute) =>
|
protected override Result DoGetFileSystemAttribute(out FileSystemAttribute outAttribute) =>
|
||||||
BaseFileSystem.Get.GetFileSystemAttribute(out outAttribute);
|
BaseFileSystem.Get.GetFileSystemAttribute(out outAttribute);
|
||||||
|
|
||||||
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
||||||
in Path path) => BaseFileSystem.Get.QueryEntry(outBuffer, inBuffer, queryId, in path);
|
ref readonly Path path) => BaseFileSystem.Get.QueryEntry(outBuffer, inBuffer, queryId, in path);
|
||||||
}
|
}
|
@ -162,7 +162,7 @@ public class HierarchicalIntegrityVerificationStorageControlArea : IDisposable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result Format(in ValueSubStorage metaStorage,
|
public static Result Format(ref readonly ValueSubStorage metaStorage,
|
||||||
in HierarchicalIntegrityVerificationMetaInformation metaInfo)
|
in HierarchicalIntegrityVerificationMetaInformation metaInfo)
|
||||||
{
|
{
|
||||||
// Ensure the storage is large enough to hold the meta info.
|
// Ensure the storage is large enough to hold the meta info.
|
||||||
@ -189,7 +189,7 @@ public class HierarchicalIntegrityVerificationStorageControlArea : IDisposable
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result Expand(in ValueSubStorage metaStorage,
|
public static Result Expand(ref readonly ValueSubStorage metaStorage,
|
||||||
in HierarchicalIntegrityVerificationMetaInformation newMeta)
|
in HierarchicalIntegrityVerificationMetaInformation newMeta)
|
||||||
{
|
{
|
||||||
// Ensure the storage is large enough to hold the meta info.
|
// Ensure the storage is large enough to hold the meta info.
|
||||||
@ -230,7 +230,7 @@ public class HierarchicalIntegrityVerificationStorageControlArea : IDisposable
|
|||||||
outInfo = _meta.LevelHashInfo;
|
outInfo = _meta.LevelHashInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result Initialize(in ValueSubStorage metaStorage)
|
public Result Initialize(ref readonly ValueSubStorage metaStorage)
|
||||||
{
|
{
|
||||||
// Ensure the storage is large enough to hold the meta info.
|
// Ensure the storage is large enough to hold the meta info.
|
||||||
Result res = metaStorage.GetSize(out long metaSize);
|
Result res = metaStorage.GetSize(out long metaSize);
|
||||||
@ -279,7 +279,7 @@ public class HierarchicalIntegrityVerificationStorage : IStorage
|
|||||||
|
|
||||||
private ValueSubStorage[] _storages;
|
private ValueSubStorage[] _storages;
|
||||||
|
|
||||||
public HierarchicalStorageInformation(in HierarchicalStorageInformation other)
|
public HierarchicalStorageInformation(ref readonly HierarchicalStorageInformation other)
|
||||||
{
|
{
|
||||||
_storages = new ValueSubStorage[(int)Storage.DataStorage + 1];
|
_storages = new ValueSubStorage[(int)Storage.DataStorage + 1];
|
||||||
|
|
||||||
@ -311,13 +311,13 @@ public class HierarchicalIntegrityVerificationStorage : IStorage
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetMasterHashStorage(in ValueSubStorage storage) => _storages[(int)Storage.MasterStorage].Set(in storage);
|
public void SetMasterHashStorage(ref readonly ValueSubStorage storage) => _storages[(int)Storage.MasterStorage].Set(in storage);
|
||||||
public void SetLayer1HashStorage(in ValueSubStorage storage) => _storages[(int)Storage.Layer1Storage].Set(in storage);
|
public void SetLayer1HashStorage(ref readonly ValueSubStorage storage) => _storages[(int)Storage.Layer1Storage].Set(in storage);
|
||||||
public void SetLayer2HashStorage(in ValueSubStorage storage) => _storages[(int)Storage.Layer2Storage].Set(in storage);
|
public void SetLayer2HashStorage(ref readonly ValueSubStorage storage) => _storages[(int)Storage.Layer2Storage].Set(in storage);
|
||||||
public void SetLayer3HashStorage(in ValueSubStorage storage) => _storages[(int)Storage.Layer3Storage].Set(in storage);
|
public void SetLayer3HashStorage(ref readonly ValueSubStorage storage) => _storages[(int)Storage.Layer3Storage].Set(in storage);
|
||||||
public void SetLayer4HashStorage(in ValueSubStorage storage) => _storages[(int)Storage.Layer4Storage].Set(in storage);
|
public void SetLayer4HashStorage(ref readonly ValueSubStorage storage) => _storages[(int)Storage.Layer4Storage].Set(in storage);
|
||||||
public void SetLayer5HashStorage(in ValueSubStorage storage) => _storages[(int)Storage.Layer5Storage].Set(in storage);
|
public void SetLayer5HashStorage(ref readonly ValueSubStorage storage) => _storages[(int)Storage.Layer5Storage].Set(in storage);
|
||||||
public void SetDataStorage(in ValueSubStorage storage) => _storages[(int)Storage.DataStorage].Set(in storage);
|
public void SetDataStorage(ref readonly ValueSubStorage storage) => _storages[(int)Storage.DataStorage].Set(in storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal const uint IntegrityVerificationStorageMagic = 0x43465649; // IVFC
|
internal const uint IntegrityVerificationStorageMagic = 0x43465649; // IVFC
|
||||||
|
@ -122,47 +122,47 @@ public abstract class IResultConvertFileSystem<T> : ISaveDataFileSystem where T
|
|||||||
|
|
||||||
protected abstract Result ConvertResult(Result result);
|
protected abstract Result ConvertResult(Result result);
|
||||||
|
|
||||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option)
|
protected override Result DoCreateFile(ref readonly Path path, long size, CreateFileOptions option)
|
||||||
{
|
{
|
||||||
return ConvertResult(_baseFileSystem.Get.CreateFile(in path, size)).Ret();
|
return ConvertResult(_baseFileSystem.Get.CreateFile(in path, size)).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteFile(in Path path)
|
protected override Result DoDeleteFile(ref readonly Path path)
|
||||||
{
|
{
|
||||||
return ConvertResult(_baseFileSystem.Get.DeleteFile(in path)).Ret();
|
return ConvertResult(_baseFileSystem.Get.DeleteFile(in path)).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCreateDirectory(in Path path)
|
protected override Result DoCreateDirectory(ref readonly Path path)
|
||||||
{
|
{
|
||||||
return ConvertResult(_baseFileSystem.Get.CreateDirectory(in path)).Ret();
|
return ConvertResult(_baseFileSystem.Get.CreateDirectory(in path)).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteDirectory(in Path path)
|
protected override Result DoDeleteDirectory(ref readonly Path path)
|
||||||
{
|
{
|
||||||
return ConvertResult(_baseFileSystem.Get.DeleteDirectory(in path)).Ret();
|
return ConvertResult(_baseFileSystem.Get.DeleteDirectory(in path)).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
protected override Result DoDeleteDirectoryRecursively(ref readonly Path path)
|
||||||
{
|
{
|
||||||
return ConvertResult(_baseFileSystem.Get.DeleteDirectoryRecursively(in path)).Ret();
|
return ConvertResult(_baseFileSystem.Get.DeleteDirectoryRecursively(in path)).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
protected override Result DoCleanDirectoryRecursively(ref readonly Path path)
|
||||||
{
|
{
|
||||||
return ConvertResult(_baseFileSystem.Get.CleanDirectoryRecursively(in path)).Ret();
|
return ConvertResult(_baseFileSystem.Get.CleanDirectoryRecursively(in path)).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath)
|
protected override Result DoRenameFile(ref readonly Path currentPath, ref readonly Path newPath)
|
||||||
{
|
{
|
||||||
return ConvertResult(_baseFileSystem.Get.RenameFile(in currentPath, in newPath)).Ret();
|
return ConvertResult(_baseFileSystem.Get.RenameFile(in currentPath, in newPath)).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath)
|
protected override Result DoRenameDirectory(ref readonly Path currentPath, ref readonly Path newPath)
|
||||||
{
|
{
|
||||||
return ConvertResult(_baseFileSystem.Get.RenameDirectory(in currentPath, in newPath)).Ret();
|
return ConvertResult(_baseFileSystem.Get.RenameDirectory(in currentPath, in newPath)).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
protected override Result DoGetEntryType(out DirectoryEntryType entryType, ref readonly Path path)
|
||||||
{
|
{
|
||||||
return ConvertResult(_baseFileSystem.Get.GetEntryType(out entryType, in path)).Ret();
|
return ConvertResult(_baseFileSystem.Get.GetEntryType(out entryType, in path)).Ret();
|
||||||
}
|
}
|
||||||
@ -187,23 +187,23 @@ public abstract class IResultConvertFileSystem<T> : ISaveDataFileSystem where T
|
|||||||
return ConvertResult(_baseFileSystem.Get.Flush()).Ret();
|
return ConvertResult(_baseFileSystem.Get.Flush()).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, in Path path)
|
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, ref readonly Path path)
|
||||||
{
|
{
|
||||||
return ConvertResult(_baseFileSystem.Get.GetFileTimeStampRaw(out timeStamp, in path)).Ret();
|
return ConvertResult(_baseFileSystem.Get.GetFileTimeStampRaw(out timeStamp, in path)).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
||||||
in Path path)
|
ref readonly Path path)
|
||||||
{
|
{
|
||||||
return ConvertResult(_baseFileSystem.Get.QueryEntry(outBuffer, inBuffer, queryId, in path)).Ret();
|
return ConvertResult(_baseFileSystem.Get.QueryEntry(outBuffer, inBuffer, queryId, in path)).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, in Path path)
|
protected override Result DoGetFreeSpaceSize(out long freeSpace, ref readonly Path path)
|
||||||
{
|
{
|
||||||
return ConvertResult(_baseFileSystem.Get.GetFreeSpaceSize(out freeSpace, in path)).Ret();
|
return ConvertResult(_baseFileSystem.Get.GetFreeSpaceSize(out freeSpace, in path)).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, in Path path)
|
protected override Result DoGetTotalSpaceSize(out long totalSpace, ref readonly Path path)
|
||||||
{
|
{
|
||||||
return ConvertResult(_baseFileSystem.Get.GetTotalSpaceSize(out totalSpace, in path)).Ret();
|
return ConvertResult(_baseFileSystem.Get.GetTotalSpaceSize(out totalSpace, in path)).Ret();
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ public class IndirectStorage : IStorage
|
|||||||
public static long QueryEntryStorageSize(int entryCount) =>
|
public static long QueryEntryStorageSize(int entryCount) =>
|
||||||
BucketTree.QueryEntryStorageSize(NodeSize, Unsafe.SizeOf<Entry>(), entryCount);
|
BucketTree.QueryEntryStorageSize(NodeSize, Unsafe.SizeOf<Entry>(), entryCount);
|
||||||
|
|
||||||
public void SetStorage(int index, in ValueSubStorage storage)
|
public void SetStorage(int index, ref readonly ValueSubStorage storage)
|
||||||
{
|
{
|
||||||
Assert.SdkRequiresInRange(index, 0, StorageCount);
|
Assert.SdkRequiresInRange(index, 0, StorageCount);
|
||||||
_dataStorage[index].Set(in storage);
|
_dataStorage[index].Set(in storage);
|
||||||
@ -120,7 +120,7 @@ public class IndirectStorage : IStorage
|
|||||||
return _table.IsInitialized();
|
return _table.IsInitialized();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result Initialize(MemoryResource allocator, in ValueSubStorage tableStorage)
|
public Result Initialize(MemoryResource allocator, ref readonly ValueSubStorage tableStorage)
|
||||||
{
|
{
|
||||||
Unsafe.SkipInit(out BucketTree.Header header);
|
Unsafe.SkipInit(out BucketTree.Header header);
|
||||||
|
|
||||||
@ -141,14 +141,14 @@ public class IndirectStorage : IStorage
|
|||||||
if (storageSize < entryStorageOffset + entryStorageSize)
|
if (storageSize < entryStorageOffset + entryStorageSize)
|
||||||
return ResultFs.InvalidIndirectStorageBucketTreeSize.Log();
|
return ResultFs.InvalidIndirectStorageBucketTreeSize.Log();
|
||||||
|
|
||||||
using var nodeStorage = new ValueSubStorage(tableStorage, nodeStorageOffset, nodeStorageSize);
|
using var nodeStorage = new ValueSubStorage(in tableStorage, nodeStorageOffset, nodeStorageSize);
|
||||||
using var entryStorage = new ValueSubStorage(tableStorage, entryStorageOffset, entryStorageSize);
|
using var entryStorage = new ValueSubStorage(in tableStorage, entryStorageOffset, entryStorageSize);
|
||||||
|
|
||||||
return Initialize(allocator, in nodeStorage, in entryStorage, header.EntryCount);
|
return Initialize(allocator, in nodeStorage, in entryStorage, header.EntryCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result Initialize(MemoryResource allocator, in ValueSubStorage nodeStorage, in ValueSubStorage entryStorage,
|
public Result Initialize(MemoryResource allocator, ref readonly ValueSubStorage nodeStorage,
|
||||||
int entryCount)
|
ref readonly ValueSubStorage entryStorage, int entryCount)
|
||||||
{
|
{
|
||||||
return _table.Initialize(allocator, in nodeStorage, in entryStorage, NodeSize, Unsafe.SizeOf<Entry>(),
|
return _table.Initialize(allocator, in nodeStorage, in entryStorage, NodeSize, Unsafe.SizeOf<Entry>(),
|
||||||
entryCount);
|
entryCount);
|
||||||
|
@ -90,8 +90,8 @@ public class IntegrityVerificationStorage : IStorage
|
|||||||
return _verificationBlockSize;
|
return _verificationBlockSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialize(in ValueSubStorage hashStorage, in ValueSubStorage dataStorage, int sizeVerificationBlock,
|
public void Initialize(ref readonly ValueSubStorage hashStorage, ref readonly ValueSubStorage dataStorage,
|
||||||
int sizeUpperLayerVerificationBlock, IBufferManager bufferManager,
|
int sizeVerificationBlock, int sizeUpperLayerVerificationBlock, IBufferManager bufferManager,
|
||||||
IHash256GeneratorFactory hashGeneratorFactory, in Optional<HashSalt> hashSalt, bool isRealData, bool isWritable,
|
IHash256GeneratorFactory hashGeneratorFactory, in Optional<HashSalt> hashSalt, bool isRealData, bool isWritable,
|
||||||
bool allowClearedBlocks)
|
bool allowClearedBlocks)
|
||||||
{
|
{
|
||||||
@ -226,7 +226,7 @@ public class IntegrityVerificationStorage : IStorage
|
|||||||
{
|
{
|
||||||
int verifiedSize = (verifiedCount + i) << _verificationBlockOrder;
|
int verifiedSize = (verifiedCount + i) << _verificationBlockOrder;
|
||||||
ref BlockHash blockHash = ref signatureBuffer.GetBuffer<BlockHash>()[i];
|
ref BlockHash blockHash = ref signatureBuffer.GetBuffer<BlockHash>()[i];
|
||||||
currentResult = VerifyHash(destination.Slice(verifiedCount), ref blockHash, in hashGenerator);
|
currentResult = VerifyHash(destination.Slice(verifiedCount), ref blockHash, ref hashGenerator.Ref);
|
||||||
|
|
||||||
if (ResultFs.IntegrityVerificationStorageCorrupted.Includes(currentResult))
|
if (ResultFs.IntegrityVerificationStorageCorrupted.Includes(currentResult))
|
||||||
{
|
{
|
||||||
@ -319,7 +319,7 @@ public class IntegrityVerificationStorage : IStorage
|
|||||||
{
|
{
|
||||||
int updatedSize = (updatedSignatureCount + i) << _verificationBlockOrder;
|
int updatedSize = (updatedSignatureCount + i) << _verificationBlockOrder;
|
||||||
CalcBlockHash(out signatureBuffer.GetBuffer<BlockHash>()[i], source.Slice(updatedSize),
|
CalcBlockHash(out signatureBuffer.GetBuffer<BlockHash>()[i], source.Slice(updatedSize),
|
||||||
in hashGenerator);
|
ref hashGenerator.Ref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -523,18 +523,18 @@ public class IntegrityVerificationStorage : IStorage
|
|||||||
Result res = _hashGeneratorFactory.Create(ref hashGenerator.Ref);
|
Result res = _hashGeneratorFactory.Create(ref hashGenerator.Ref);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
CalcBlockHash(out outHash, buffer, verificationBlockSize, in hashGenerator);
|
CalcBlockHash(out outHash, buffer, verificationBlockSize, ref hashGenerator.Ref);
|
||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CalcBlockHash(out BlockHash outHash, ReadOnlySpan<byte> buffer,
|
private void CalcBlockHash(out BlockHash outHash, ReadOnlySpan<byte> buffer,
|
||||||
in UniqueRef<IHash256Generator> hashGenerator)
|
ref UniqueRef<IHash256Generator> hashGenerator)
|
||||||
{
|
{
|
||||||
CalcBlockHash(out outHash, buffer, _verificationBlockSize, in hashGenerator);
|
CalcBlockHash(out outHash, buffer, _verificationBlockSize, ref hashGenerator);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CalcBlockHash(out BlockHash outHash, ReadOnlySpan<byte> buffer, int verificationBlockSize,
|
private void CalcBlockHash(out BlockHash outHash, ReadOnlySpan<byte> buffer, int verificationBlockSize,
|
||||||
in UniqueRef<IHash256Generator> hashGenerator)
|
ref UniqueRef<IHash256Generator> hashGenerator)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out outHash);
|
UnsafeHelpers.SkipParamInit(out outHash);
|
||||||
|
|
||||||
@ -568,7 +568,7 @@ public class IntegrityVerificationStorage : IStorage
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Result VerifyHash(ReadOnlySpan<byte> buffer, ref BlockHash hash,
|
private Result VerifyHash(ReadOnlySpan<byte> buffer, ref BlockHash hash,
|
||||||
in UniqueRef<IHash256Generator> hashGenerator)
|
ref UniqueRef<IHash256Generator> hashGenerator)
|
||||||
{
|
{
|
||||||
Assert.SdkRequiresGreaterEqual(buffer.Length, HashSize);
|
Assert.SdkRequiresGreaterEqual(buffer.Length, HashSize);
|
||||||
|
|
||||||
@ -582,7 +582,7 @@ public class IntegrityVerificationStorage : IStorage
|
|||||||
return ResultFs.ClearedRealDataVerificationFailed.Log();
|
return ResultFs.ClearedRealDataVerificationFailed.Log();
|
||||||
}
|
}
|
||||||
|
|
||||||
CalcBlockHash(out BlockHash actualHash, buffer, hashGenerator);
|
CalcBlockHash(out BlockHash actualHash, buffer, ref hashGenerator);
|
||||||
|
|
||||||
if (!CryptoUtil.IsSameBytes(SpanHelpers.AsReadOnlyByteSpan(in hash),
|
if (!CryptoUtil.IsSameBytes(SpanHelpers.AsReadOnlyByteSpan(in hash),
|
||||||
SpanHelpers.AsReadOnlyByteSpan(in actualHash), Unsafe.SizeOf<BlockHash>()))
|
SpanHelpers.AsReadOnlyByteSpan(in actualHash), Unsafe.SizeOf<BlockHash>()))
|
||||||
|
@ -158,7 +158,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Result ResolveFullPath(out string outFullPath, in Path path, bool checkCaseSensitivity)
|
private Result ResolveFullPath(out string outFullPath, ref readonly Path path, bool checkCaseSensitivity)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out outFullPath);
|
UnsafeHelpers.SkipParamInit(out outFullPath);
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetFileAttributes(out NxFileAttributes attributes, in Path path)
|
protected override Result DoGetFileAttributes(out NxFileAttributes attributes, ref readonly Path path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out attributes);
|
UnsafeHelpers.SkipParamInit(out attributes);
|
||||||
|
|
||||||
@ -213,7 +213,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoSetFileAttributes(in Path path, NxFileAttributes attributes)
|
protected override Result DoSetFileAttributes(ref readonly Path path, NxFileAttributes attributes)
|
||||||
{
|
{
|
||||||
Result res = ResolveFullPath(out string fullPath, in path, true);
|
Result res = ResolveFullPath(out string fullPath, in path, true);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -241,7 +241,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetFileSize(out long fileSize, in Path path)
|
protected override Result DoGetFileSize(out long fileSize, ref readonly Path path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out fileSize);
|
UnsafeHelpers.SkipParamInit(out fileSize);
|
||||||
|
|
||||||
@ -254,12 +254,12 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||||||
return GetSizeInternal(out fileSize, info);
|
return GetSizeInternal(out fileSize, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCreateDirectory(in Path path)
|
protected override Result DoCreateDirectory(ref readonly Path path)
|
||||||
{
|
{
|
||||||
return DoCreateDirectory(path, NxFileAttributes.None);
|
return DoCreateDirectory(in path, NxFileAttributes.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCreateDirectory(in Path path, NxFileAttributes archiveAttribute)
|
protected override Result DoCreateDirectory(ref readonly Path path, NxFileAttributes archiveAttribute)
|
||||||
{
|
{
|
||||||
Result res = ResolveFullPath(out string fullPath, in path, false);
|
Result res = ResolveFullPath(out string fullPath, in path, false);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -280,7 +280,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||||||
return CreateDirInternal(dir, archiveAttribute);
|
return CreateDirInternal(dir, archiveAttribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option)
|
protected override Result DoCreateFile(ref readonly Path path, long size, CreateFileOptions option)
|
||||||
{
|
{
|
||||||
Result res = ResolveFullPath(out string fullPath, in path, false);
|
Result res = ResolveFullPath(out string fullPath, in path, false);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -308,7 +308,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteDirectory(in Path path)
|
protected override Result DoDeleteDirectory(ref readonly Path path)
|
||||||
{
|
{
|
||||||
Result res = ResolveFullPath(out string fullPath, in path, true);
|
Result res = ResolveFullPath(out string fullPath, in path, true);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -320,7 +320,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||||||
() => DeleteDirectoryInternal(dir, false), _fsClient);
|
() => DeleteDirectoryInternal(dir, false), _fsClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
protected override Result DoDeleteDirectoryRecursively(ref readonly Path path)
|
||||||
{
|
{
|
||||||
Result res = ResolveFullPath(out string fullPath, in path, true);
|
Result res = ResolveFullPath(out string fullPath, in path, true);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -332,7 +332,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||||||
() => DeleteDirectoryInternal(dir, true), _fsClient);
|
() => DeleteDirectoryInternal(dir, true), _fsClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
protected override Result DoCleanDirectoryRecursively(ref readonly Path path)
|
||||||
{
|
{
|
||||||
Result res = ResolveFullPath(out string fullPath, in path, true);
|
Result res = ResolveFullPath(out string fullPath, in path, true);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -343,7 +343,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||||||
return CleanDirectoryInternal(dir, _fsClient);
|
return CleanDirectoryInternal(dir, _fsClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteFile(in Path path)
|
protected override Result DoDeleteFile(ref readonly Path path)
|
||||||
{
|
{
|
||||||
Result res = ResolveFullPath(out string fullPath, in path, true);
|
Result res = ResolveFullPath(out string fullPath, in path, true);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -355,7 +355,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||||||
() => DeleteFileInternal(file), _fsClient);
|
() => DeleteFileInternal(file), _fsClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, in Path path,
|
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, ref readonly Path path,
|
||||||
OpenDirectoryMode mode)
|
OpenDirectoryMode mode)
|
||||||
{
|
{
|
||||||
Result res = ResolveFullPath(out string fullPath, in path, true);
|
Result res = ResolveFullPath(out string fullPath, in path, true);
|
||||||
@ -378,12 +378,12 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, in Path path, OpenMode mode)
|
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, ref readonly Path path, OpenMode mode)
|
||||||
{
|
{
|
||||||
Result res = ResolveFullPath(out string fullPath, in path, true);
|
Result res = ResolveFullPath(out string fullPath, in path, true);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
res = GetEntryType(out DirectoryEntryType entryType, path);
|
res = GetEntryType(out DirectoryEntryType entryType, in path);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
if (entryType == DirectoryEntryType.Directory)
|
if (entryType == DirectoryEntryType.Directory)
|
||||||
@ -401,7 +401,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath)
|
protected override Result DoRenameDirectory(ref readonly Path currentPath, ref readonly Path newPath)
|
||||||
{
|
{
|
||||||
Result res = ResolveFullPath(out string fullCurrentPath, in currentPath, true);
|
Result res = ResolveFullPath(out string fullCurrentPath, in currentPath, true);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -422,7 +422,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||||||
() => RenameDirInternal(currentDirInfo, newDirInfo), _fsClient);
|
() => RenameDirInternal(currentDirInfo, newDirInfo), _fsClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath)
|
protected override Result DoRenameFile(ref readonly Path currentPath, ref readonly Path newPath)
|
||||||
{
|
{
|
||||||
Result res = ResolveFullPath(out string fullCurrentPath, in currentPath, true);
|
Result res = ResolveFullPath(out string fullCurrentPath, in currentPath, true);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -443,7 +443,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||||||
() => RenameFileInternal(currentFileInfo, newFileInfo), _fsClient);
|
() => RenameFileInternal(currentFileInfo, newFileInfo), _fsClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
protected override Result DoGetEntryType(out DirectoryEntryType entryType, ref readonly Path path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out entryType);
|
UnsafeHelpers.SkipParamInit(out entryType);
|
||||||
|
|
||||||
@ -471,7 +471,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||||||
return ResultFs.PathNotFound.Log();
|
return ResultFs.PathNotFound.Log();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, in Path path)
|
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, ref readonly Path path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out timeStamp);
|
UnsafeHelpers.SkipParamInit(out timeStamp);
|
||||||
|
|
||||||
@ -501,7 +501,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, in Path path)
|
protected override Result DoGetFreeSpaceSize(out long freeSpace, ref readonly Path path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out freeSpace);
|
UnsafeHelpers.SkipParamInit(out freeSpace);
|
||||||
|
|
||||||
@ -512,7 +512,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, in Path path)
|
protected override Result DoGetTotalSpaceSize(out long totalSpace, ref readonly Path path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out totalSpace);
|
UnsafeHelpers.SkipParamInit(out totalSpace);
|
||||||
|
|
||||||
@ -567,7 +567,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
||||||
in Path path)
|
ref readonly Path path)
|
||||||
{
|
{
|
||||||
return ResultFs.UnsupportedOperation.Log();
|
return ResultFs.UnsupportedOperation.Log();
|
||||||
}
|
}
|
||||||
|
@ -449,7 +449,7 @@ public class NcaReader : IDisposable
|
|||||||
Assert.SdkRequires(_bodyStorage.HasValue);
|
Assert.SdkRequires(_bodyStorage.HasValue);
|
||||||
Assert.SdkRequiresLessEqual(Unsafe.SizeOf<NcaHeader>(), outBuffer.Length);
|
Assert.SdkRequiresLessEqual(Unsafe.SizeOf<NcaHeader>(), outBuffer.Length);
|
||||||
|
|
||||||
SpanHelpers.AsReadOnlyByteSpan(_header).CopyTo(outBuffer);
|
SpanHelpers.AsReadOnlyByteSpan(in _header).CopyTo(outBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DecryptAesCtrFunction GetExternalDecryptAesCtrFunction()
|
public DecryptAesCtrFunction GetExternalDecryptAesCtrFunction()
|
||||||
|
@ -406,14 +406,14 @@ public class PartitionFileSystemCore<TMetaData, TFormat, THeader, TEntry> : IFil
|
|||||||
base.Dispose();
|
base.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result Initialize(in SharedRef<IStorage> baseStorage)
|
public Result Initialize(ref readonly SharedRef<IStorage> baseStorage)
|
||||||
{
|
{
|
||||||
_sharedStorage.SetByCopy(in baseStorage);
|
_sharedStorage.SetByCopy(in baseStorage);
|
||||||
|
|
||||||
return Initialize(_sharedStorage.Get).Ret();
|
return Initialize(_sharedStorage.Get).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result Initialize(in SharedRef<IStorage> baseStorage, MemoryResource allocator)
|
public Result Initialize(ref readonly SharedRef<IStorage> baseStorage, MemoryResource allocator)
|
||||||
{
|
{
|
||||||
_sharedStorage.SetByCopy(in baseStorage);
|
_sharedStorage.SetByCopy(in baseStorage);
|
||||||
|
|
||||||
@ -445,14 +445,14 @@ public class PartitionFileSystemCore<TMetaData, TFormat, THeader, TEntry> : IFil
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result Initialize(ref UniqueRef<TMetaData> metaData, in SharedRef<IStorage> baseStorage)
|
public Result Initialize(ref UniqueRef<TMetaData> metaData, ref readonly SharedRef<IStorage> baseStorage)
|
||||||
{
|
{
|
||||||
_uniqueMetaData.Set(ref metaData);
|
_uniqueMetaData.Set(ref metaData);
|
||||||
|
|
||||||
return Initialize(_uniqueMetaData.Get, in baseStorage).Ret();
|
return Initialize(_uniqueMetaData.Get, in baseStorage).Ret();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result Initialize(TMetaData metaData, in SharedRef<IStorage> baseStorage)
|
public Result Initialize(TMetaData metaData, ref readonly SharedRef<IStorage> baseStorage)
|
||||||
{
|
{
|
||||||
if (_isInitialized)
|
if (_isInitialized)
|
||||||
return ResultFs.PreconditionViolation.Log();
|
return ResultFs.PreconditionViolation.Log();
|
||||||
@ -484,7 +484,7 @@ public class PartitionFileSystemCore<TMetaData, TFormat, THeader, TEntry> : IFil
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
protected override Result DoGetEntryType(out DirectoryEntryType entryType, ref readonly Path path)
|
||||||
{
|
{
|
||||||
Unsafe.SkipInit(out entryType);
|
Unsafe.SkipInit(out entryType);
|
||||||
|
|
||||||
@ -510,7 +510,7 @@ public class PartitionFileSystemCore<TMetaData, TFormat, THeader, TEntry> : IFil
|
|||||||
return ResultFs.PathNotFound.Log();
|
return ResultFs.PathNotFound.Log();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, in Path path, OpenMode mode)
|
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, ref readonly Path path, OpenMode mode)
|
||||||
{
|
{
|
||||||
if (!_isInitialized)
|
if (!_isInitialized)
|
||||||
return ResultFs.PreconditionViolation.Log();
|
return ResultFs.PreconditionViolation.Log();
|
||||||
@ -531,7 +531,7 @@ public class PartitionFileSystemCore<TMetaData, TFormat, THeader, TEntry> : IFil
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, in Path path, OpenDirectoryMode mode)
|
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, ref readonly Path path, OpenDirectoryMode mode)
|
||||||
{
|
{
|
||||||
if (!_isInitialized)
|
if (!_isInitialized)
|
||||||
return ResultFs.PreconditionViolation.Log();
|
return ResultFs.PreconditionViolation.Log();
|
||||||
@ -547,14 +547,14 @@ public class PartitionFileSystemCore<TMetaData, TFormat, THeader, TEntry> : IFil
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
protected override Result DoCreateFile(ref readonly Path path, long size, CreateFileOptions option) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||||
protected override Result DoDeleteFile(in Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
protected override Result DoDeleteFile(ref readonly Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||||
protected override Result DoCreateDirectory(in Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
protected override Result DoCreateDirectory(ref readonly Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||||
protected override Result DoDeleteDirectory(in Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
protected override Result DoDeleteDirectory(ref readonly Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||||
protected override Result DoDeleteDirectoryRecursively(in Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
protected override Result DoDeleteDirectoryRecursively(ref readonly Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||||
protected override Result DoCleanDirectoryRecursively(in Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
protected override Result DoCleanDirectoryRecursively(ref readonly Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
protected override Result DoRenameFile(ref readonly Path currentPath, ref readonly Path newPath) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
protected override Result DoRenameDirectory(ref readonly Path currentPath, ref readonly Path newPath) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||||
|
|
||||||
protected override Result DoCommit()
|
protected override Result DoCommit()
|
||||||
{
|
{
|
||||||
|
@ -208,7 +208,7 @@ namespace LibHac.FsSystem
|
|||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out outSize);
|
UnsafeHelpers.SkipParamInit(out outSize);
|
||||||
|
|
||||||
if (!CryptoUtil.IsSameBytes(SpanHelpers.AsReadOnlyByteSpan(header), TFormat.VersionSignature,
|
if (!CryptoUtil.IsSameBytes(SpanHelpers.AsReadOnlyByteSpan(in header), TFormat.VersionSignature,
|
||||||
TFormat.VersionSignature.Length))
|
TFormat.VersionSignature.Length))
|
||||||
{
|
{
|
||||||
return TFormat.ResultSignatureVerificationFailed.Log();
|
return TFormat.ResultSignatureVerificationFailed.Log();
|
||||||
|
@ -73,7 +73,7 @@ public class SparseStorage : IndirectStorage
|
|||||||
SetZeroStorage();
|
SetZeroStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetDataStorage(in ValueSubStorage storage)
|
public void SetDataStorage(ref readonly ValueSubStorage storage)
|
||||||
{
|
{
|
||||||
Assert.SdkRequires(IsInitialized());
|
Assert.SdkRequires(IsInitialized());
|
||||||
|
|
||||||
|
@ -253,73 +253,73 @@ internal class StorageLayoutTypeSetFileSystem : IFileSystem
|
|||||||
base.Dispose();
|
base.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option)
|
protected override Result DoCreateFile(ref readonly Path path, long size, CreateFileOptions option)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
||||||
return _baseFileSystem.Get.CreateFile(path, size, option);
|
return _baseFileSystem.Get.CreateFile(in path, size, option);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteFile(in Path path)
|
protected override Result DoDeleteFile(ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
||||||
return _baseFileSystem.Get.DeleteFile(path);
|
return _baseFileSystem.Get.DeleteFile(in path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCreateDirectory(in Path path)
|
protected override Result DoCreateDirectory(ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
||||||
return _baseFileSystem.Get.CreateDirectory(path);
|
return _baseFileSystem.Get.CreateDirectory(in path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteDirectory(in Path path)
|
protected override Result DoDeleteDirectory(ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
||||||
return _baseFileSystem.Get.DeleteDirectory(path);
|
return _baseFileSystem.Get.DeleteDirectory(in path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
protected override Result DoDeleteDirectoryRecursively(ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
||||||
return _baseFileSystem.Get.DeleteDirectoryRecursively(path);
|
return _baseFileSystem.Get.DeleteDirectoryRecursively(in path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
protected override Result DoCleanDirectoryRecursively(ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
||||||
return _baseFileSystem.Get.CleanDirectoryRecursively(path);
|
return _baseFileSystem.Get.CleanDirectoryRecursively(in path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath)
|
protected override Result DoRenameFile(ref readonly Path currentPath, ref readonly Path newPath)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
||||||
return _baseFileSystem.Get.RenameFile(currentPath, newPath);
|
return _baseFileSystem.Get.RenameFile(in currentPath, in newPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath)
|
protected override Result DoRenameDirectory(ref readonly Path currentPath, ref readonly Path newPath)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
||||||
return _baseFileSystem.Get.RenameDirectory(currentPath, newPath);
|
return _baseFileSystem.Get.RenameDirectory(in currentPath, in newPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
protected override Result DoGetEntryType(out DirectoryEntryType entryType, ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
||||||
return _baseFileSystem.Get.GetEntryType(out entryType, path);
|
return _baseFileSystem.Get.GetEntryType(out entryType, in path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, in Path path)
|
protected override Result DoGetFreeSpaceSize(out long freeSpace, ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
||||||
return _baseFileSystem.Get.GetFreeSpaceSize(out freeSpace, path);
|
return _baseFileSystem.Get.GetFreeSpaceSize(out freeSpace, in path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, in Path path)
|
protected override Result DoGetTotalSpaceSize(out long totalSpace, ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
||||||
return _baseFileSystem.Get.GetTotalSpaceSize(out totalSpace, path);
|
return _baseFileSystem.Get.GetTotalSpaceSize(out totalSpace, in path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, in Path path, OpenMode mode)
|
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, ref readonly Path path, OpenMode mode)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
||||||
using var baseFile = new UniqueRef<IFile>();
|
using var baseFile = new UniqueRef<IFile>();
|
||||||
@ -331,7 +331,7 @@ internal class StorageLayoutTypeSetFileSystem : IFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, in Path path,
|
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, ref readonly Path path,
|
||||||
OpenDirectoryMode mode)
|
OpenDirectoryMode mode)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
||||||
@ -368,10 +368,10 @@ internal class StorageLayoutTypeSetFileSystem : IFileSystem
|
|||||||
return _baseFileSystem.Get.Flush();
|
return _baseFileSystem.Get.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, in Path path)
|
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
||||||
return _baseFileSystem.Get.GetFileTimeStampRaw(out timeStamp, path);
|
return _baseFileSystem.Get.GetFileTimeStampRaw(out timeStamp, in path);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetFileSystemAttribute(out FileSystemAttribute outAttribute)
|
protected override Result DoGetFileSystemAttribute(out FileSystemAttribute outAttribute)
|
||||||
@ -381,9 +381,9 @@ internal class StorageLayoutTypeSetFileSystem : IFileSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
||||||
in Path path)
|
ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
||||||
return _baseFileSystem.Get.QueryEntry(outBuffer, inBuffer, queryId, path);
|
return _baseFileSystem.Get.QueryEntry(outBuffer, inBuffer, queryId, in path);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -32,18 +32,18 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||||||
base.Dispose();
|
base.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result Initialize(in Path rootPath)
|
public Result Initialize(ref readonly Path rootPath)
|
||||||
{
|
{
|
||||||
return _rootPath.Initialize(in rootPath);
|
return _rootPath.Initialize(in rootPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Result ResolveFullPath(ref Path outPath, in Path relativePath)
|
private Result ResolveFullPath(ref Path outPath, ref readonly Path relativePath)
|
||||||
{
|
{
|
||||||
using Path rootPath = _rootPath.DangerousGetPath();
|
using Path rootPath = _rootPath.DangerousGetPath();
|
||||||
return outPath.Combine(in rootPath, in relativePath);
|
return outPath.Combine(in rootPath, in relativePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
protected override Result DoGetEntryType(out DirectoryEntryType entryType, ref readonly Path path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out entryType);
|
UnsafeHelpers.SkipParamInit(out entryType);
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetFreeSpaceSize(out long freeSpace, in Path path)
|
protected override Result DoGetFreeSpaceSize(out long freeSpace, ref readonly Path path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out freeSpace);
|
UnsafeHelpers.SkipParamInit(out freeSpace);
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetTotalSpaceSize(out long totalSpace, in Path path)
|
protected override Result DoGetTotalSpaceSize(out long totalSpace, ref readonly Path path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out totalSpace);
|
UnsafeHelpers.SkipParamInit(out totalSpace);
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, in Path path)
|
protected override Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, ref readonly Path path)
|
||||||
{
|
{
|
||||||
UnsafeHelpers.SkipParamInit(out timeStamp);
|
UnsafeHelpers.SkipParamInit(out timeStamp);
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, in Path path, OpenMode mode)
|
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, ref readonly Path path, OpenMode mode)
|
||||||
{
|
{
|
||||||
using var fullPath = new Path();
|
using var fullPath = new Path();
|
||||||
Result res = ResolveFullPath(ref fullPath.Ref(), in path);
|
Result res = ResolveFullPath(ref fullPath.Ref(), in path);
|
||||||
@ -111,7 +111,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, in Path path,
|
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, ref readonly Path path,
|
||||||
OpenDirectoryMode mode)
|
OpenDirectoryMode mode)
|
||||||
{
|
{
|
||||||
using var fullPath = new Path();
|
using var fullPath = new Path();
|
||||||
@ -124,7 +124,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option)
|
protected override Result DoCreateFile(ref readonly Path path, long size, CreateFileOptions option)
|
||||||
{
|
{
|
||||||
using var fullPath = new Path();
|
using var fullPath = new Path();
|
||||||
Result res = ResolveFullPath(ref fullPath.Ref(), in path);
|
Result res = ResolveFullPath(ref fullPath.Ref(), in path);
|
||||||
@ -136,7 +136,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteFile(in Path path)
|
protected override Result DoDeleteFile(ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var fullPath = new Path();
|
using var fullPath = new Path();
|
||||||
Result res = ResolveFullPath(ref fullPath.Ref(), in path);
|
Result res = ResolveFullPath(ref fullPath.Ref(), in path);
|
||||||
@ -148,7 +148,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCreateDirectory(in Path path)
|
protected override Result DoCreateDirectory(ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var fullPath = new Path();
|
using var fullPath = new Path();
|
||||||
Result res = ResolveFullPath(ref fullPath.Ref(), in path);
|
Result res = ResolveFullPath(ref fullPath.Ref(), in path);
|
||||||
@ -160,7 +160,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteDirectory(in Path path)
|
protected override Result DoDeleteDirectory(ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var fullPath = new Path();
|
using var fullPath = new Path();
|
||||||
Result res = ResolveFullPath(ref fullPath.Ref(), in path);
|
Result res = ResolveFullPath(ref fullPath.Ref(), in path);
|
||||||
@ -172,7 +172,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
protected override Result DoDeleteDirectoryRecursively(ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var fullPath = new Path();
|
using var fullPath = new Path();
|
||||||
Result res = ResolveFullPath(ref fullPath.Ref(), in path);
|
Result res = ResolveFullPath(ref fullPath.Ref(), in path);
|
||||||
@ -184,7 +184,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
protected override Result DoCleanDirectoryRecursively(ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var fullPath = new Path();
|
using var fullPath = new Path();
|
||||||
Result res = ResolveFullPath(ref fullPath.Ref(), in path);
|
Result res = ResolveFullPath(ref fullPath.Ref(), in path);
|
||||||
@ -196,7 +196,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath)
|
protected override Result DoRenameFile(ref readonly Path currentPath, ref readonly Path newPath)
|
||||||
{
|
{
|
||||||
using var currentFullPath = new Path();
|
using var currentFullPath = new Path();
|
||||||
Result res = ResolveFullPath(ref currentFullPath.Ref(), in currentPath);
|
Result res = ResolveFullPath(ref currentFullPath.Ref(), in currentPath);
|
||||||
@ -212,7 +212,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath)
|
protected override Result DoRenameDirectory(ref readonly Path currentPath, ref readonly Path newPath)
|
||||||
{
|
{
|
||||||
using var currentFullPath = new Path();
|
using var currentFullPath = new Path();
|
||||||
Result res = ResolveFullPath(ref currentFullPath.Ref(), in currentPath);
|
Result res = ResolveFullPath(ref currentFullPath.Ref(), in currentPath);
|
||||||
@ -229,7 +229,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
||||||
in Path path)
|
ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var fullPath = new Path();
|
using var fullPath = new Path();
|
||||||
Result res = ResolveFullPath(ref fullPath.Ref(), in path);
|
Result res = ResolveFullPath(ref fullPath.Ref(), in path);
|
||||||
|
@ -17,7 +17,7 @@ public class SwitchStorage : IStorage
|
|||||||
private SharedRef<IStorage> _falseStorage;
|
private SharedRef<IStorage> _falseStorage;
|
||||||
private Func<bool> _storageSelectionFunction;
|
private Func<bool> _storageSelectionFunction;
|
||||||
|
|
||||||
public SwitchStorage(in SharedRef<IStorage> trueStorage, in SharedRef<IStorage> falseStorage,
|
public SwitchStorage(ref readonly SharedRef<IStorage> trueStorage, ref readonly SharedRef<IStorage> falseStorage,
|
||||||
Func<bool> storageSelectionFunction)
|
Func<bool> storageSelectionFunction)
|
||||||
{
|
{
|
||||||
_trueStorage = SharedRef<IStorage>.CreateCopy(in trueStorage);
|
_trueStorage = SharedRef<IStorage>.CreateCopy(in trueStorage);
|
||||||
@ -125,8 +125,8 @@ public class RegionSwitchStorage : IStorage
|
|||||||
private SharedRef<IStorage> _outsideRegionStorage;
|
private SharedRef<IStorage> _outsideRegionStorage;
|
||||||
private Region _region;
|
private Region _region;
|
||||||
|
|
||||||
public RegionSwitchStorage(in SharedRef<IStorage> insideRegionStorage,
|
public RegionSwitchStorage(ref readonly SharedRef<IStorage> insideRegionStorage,
|
||||||
in SharedRef<IStorage> outsideRegionStorage, Region region)
|
ref readonly SharedRef<IStorage> outsideRegionStorage, Region region)
|
||||||
{
|
{
|
||||||
_insideRegionStorage = SharedRef<IStorage>.CreateCopy(in insideRegionStorage);
|
_insideRegionStorage = SharedRef<IStorage>.CreateCopy(in insideRegionStorage);
|
||||||
_outsideRegionStorage = SharedRef<IStorage>.CreateCopy(in outsideRegionStorage);
|
_outsideRegionStorage = SharedRef<IStorage>.CreateCopy(in outsideRegionStorage);
|
||||||
|
@ -68,7 +68,7 @@ public class UnionStorage : IStorage
|
|||||||
return GetLogSize(blockSize) * blockCount + LogHeaderSize;
|
return GetLogSize(blockSize) * blockCount + LogHeaderSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result Format(in ValueSubStorage storage, long blockSize)
|
public static Result Format(ref readonly ValueSubStorage storage, long blockSize)
|
||||||
{
|
{
|
||||||
Assert.SdkRequiresGreater(blockSize, 1);
|
Assert.SdkRequiresGreater(blockSize, 1);
|
||||||
Assert.SdkRequires(BitUtil.IsPowerOfTwo(blockSize));
|
Assert.SdkRequires(BitUtil.IsPowerOfTwo(blockSize));
|
||||||
@ -80,7 +80,8 @@ public class UnionStorage : IStorage
|
|||||||
return storage.Write(0, SpanHelpers.AsReadOnlyByteSpan(in header));
|
return storage.Write(0, SpanHelpers.AsReadOnlyByteSpan(in header));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result Initialize(in ValueSubStorage baseStorage, in ValueSubStorage logStorage, long blockSize)
|
public Result Initialize(ref readonly ValueSubStorage baseStorage, ref readonly ValueSubStorage logStorage,
|
||||||
|
long blockSize)
|
||||||
{
|
{
|
||||||
Assert.SdkRequiresNull(_buffer);
|
Assert.SdkRequiresNull(_buffer);
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ public class DummyEventNotifier : IEventNotifier
|
|||||||
/// <remarks>Based on nnSdk 13.4.0 (FS 13.1.0)</remarks>
|
/// <remarks>Based on nnSdk 13.4.0 (FS 13.1.0)</remarks>
|
||||||
internal static class Utility
|
internal static class Utility
|
||||||
{
|
{
|
||||||
public delegate Result FsIterationTask(in Path path, in DirectoryEntry entry, ref FsIterationTaskClosure closure);
|
public delegate Result FsIterationTask(ref readonly Path path, in DirectoryEntry entry, ref FsIterationTaskClosure closure);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to pass various ref structs to an <see cref="FsIterationTask"/>.
|
/// Used to pass various ref structs to an <see cref="FsIterationTask"/>.
|
||||||
@ -145,8 +145,8 @@ internal static class Utility
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result IterateDirectoryRecursively(IFileSystem fs, in Path rootPath, ref DirectoryEntry dirEntry,
|
public static Result IterateDirectoryRecursively(IFileSystem fs, ref readonly Path rootPath,
|
||||||
FsIterationTask onEnterDir, FsIterationTask onExitDir, FsIterationTask onFile,
|
ref DirectoryEntry dirEntry, FsIterationTask onEnterDir, FsIterationTask onExitDir, FsIterationTask onFile,
|
||||||
ref FsIterationTaskClosure closure)
|
ref FsIterationTaskClosure closure)
|
||||||
{
|
{
|
||||||
using var pathBuffer = new Path();
|
using var pathBuffer = new Path();
|
||||||
@ -160,8 +160,8 @@ internal static class Utility
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result CleanupDirectoryRecursively(IFileSystem fs, in Path rootPath, ref DirectoryEntry dirEntry,
|
public static Result CleanupDirectoryRecursively(IFileSystem fs, ref readonly Path rootPath,
|
||||||
FsIterationTask onEnterDir, FsIterationTask onExitDir, FsIterationTask onFile,
|
ref DirectoryEntry dirEntry, FsIterationTask onEnterDir, FsIterationTask onExitDir, FsIterationTask onFile,
|
||||||
ref FsIterationTaskClosure closure)
|
ref FsIterationTaskClosure closure)
|
||||||
{
|
{
|
||||||
using var pathBuffer = new Path();
|
using var pathBuffer = new Path();
|
||||||
@ -172,12 +172,12 @@ internal static class Utility
|
|||||||
ref closure);
|
ref closure);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result CopyFile(IFileSystem destFileSystem, IFileSystem sourceFileSystem, in Path destPath,
|
public static Result CopyFile(IFileSystem destFileSystem, IFileSystem sourceFileSystem, ref readonly Path destPath,
|
||||||
in Path sourcePath, Span<byte> workBuffer)
|
ref readonly Path sourcePath, Span<byte> workBuffer)
|
||||||
{
|
{
|
||||||
// Open source file.
|
// Open source file.
|
||||||
using var sourceFile = new UniqueRef<IFile>();
|
using var sourceFile = new UniqueRef<IFile>();
|
||||||
Result res = sourceFileSystem.OpenFile(ref sourceFile.Ref, sourcePath, OpenMode.Read);
|
Result res = sourceFileSystem.OpenFile(ref sourceFile.Ref, in sourcePath, OpenMode.Read);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
res = sourceFile.Get.GetSize(out long fileSize);
|
res = sourceFile.Get.GetSize(out long fileSize);
|
||||||
@ -210,9 +210,10 @@ internal static class Utility
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Result CopyDirectoryRecursively(IFileSystem destinationFileSystem, IFileSystem sourceFileSystem,
|
public static Result CopyDirectoryRecursively(IFileSystem destinationFileSystem, IFileSystem sourceFileSystem,
|
||||||
in Path destinationPath, in Path sourcePath, ref DirectoryEntry dirEntry, Span<byte> workBuffer)
|
ref readonly Path destinationPath, ref readonly Path sourcePath, ref DirectoryEntry dirEntry,
|
||||||
|
Span<byte> workBuffer)
|
||||||
{
|
{
|
||||||
static Result OnEnterDir(in Path path, in DirectoryEntry entry, ref FsIterationTaskClosure closure)
|
static Result OnEnterDir(ref readonly Path path, in DirectoryEntry entry, ref FsIterationTaskClosure closure)
|
||||||
{
|
{
|
||||||
Result res = closure.DestinationPathBuffer.AppendChild(entry.Name);
|
Result res = closure.DestinationPathBuffer.AppendChild(entry.Name);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -220,12 +221,12 @@ internal static class Utility
|
|||||||
return closure.SourceFileSystem.CreateDirectory(in closure.DestinationPathBuffer);
|
return closure.SourceFileSystem.CreateDirectory(in closure.DestinationPathBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result OnExitDir(in Path path, in DirectoryEntry entry, ref FsIterationTaskClosure closure)
|
static Result OnExitDir(ref readonly Path path, in DirectoryEntry entry, ref FsIterationTaskClosure closure)
|
||||||
{
|
{
|
||||||
return closure.DestinationPathBuffer.RemoveChild();
|
return closure.DestinationPathBuffer.RemoveChild();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result OnFile(in Path path, in DirectoryEntry entry, ref FsIterationTaskClosure closure)
|
static Result OnFile(ref readonly Path path, in DirectoryEntry entry, ref FsIterationTaskClosure closure)
|
||||||
{
|
{
|
||||||
Result res = closure.DestinationPathBuffer.AppendChild(entry.Name);
|
Result res = closure.DestinationPathBuffer.AppendChild(entry.Name);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -242,7 +243,7 @@ internal static class Utility
|
|||||||
closure.SourceFileSystem = sourceFileSystem;
|
closure.SourceFileSystem = sourceFileSystem;
|
||||||
closure.DestFileSystem = destinationFileSystem;
|
closure.DestFileSystem = destinationFileSystem;
|
||||||
|
|
||||||
Result res = closure.DestinationPathBuffer.Initialize(destinationPath);
|
Result res = closure.DestinationPathBuffer.Initialize(in destinationPath);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
res = IterateDirectoryRecursively(sourceFileSystem, in sourcePath, ref dirEntry, OnEnterDir, OnExitDir,
|
res = IterateDirectoryRecursively(sourceFileSystem, in sourcePath, ref dirEntry, OnEnterDir, OnExitDir,
|
||||||
@ -252,17 +253,17 @@ internal static class Utility
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result CopyDirectoryRecursively(IFileSystem fileSystem, in Path destinationPath,
|
public static Result CopyDirectoryRecursively(IFileSystem fileSystem, ref readonly Path destinationPath,
|
||||||
in Path sourcePath, ref DirectoryEntry dirEntry, Span<byte> workBuffer)
|
ref readonly Path sourcePath, ref DirectoryEntry dirEntry, Span<byte> workBuffer)
|
||||||
{
|
{
|
||||||
var closure = new FsIterationTaskClosure();
|
var closure = new FsIterationTaskClosure();
|
||||||
closure.Buffer = workBuffer;
|
closure.Buffer = workBuffer;
|
||||||
closure.SourceFileSystem = fileSystem;
|
closure.SourceFileSystem = fileSystem;
|
||||||
|
|
||||||
Result res = closure.DestinationPathBuffer.Initialize(destinationPath);
|
Result res = closure.DestinationPathBuffer.Initialize(in destinationPath);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
static Result OnEnterDir(in Path path, in DirectoryEntry entry, ref FsIterationTaskClosure closure)
|
static Result OnEnterDir(ref readonly Path path, in DirectoryEntry entry, ref FsIterationTaskClosure closure)
|
||||||
{
|
{
|
||||||
Result res = closure.DestinationPathBuffer.AppendChild(entry.Name);
|
Result res = closure.DestinationPathBuffer.AppendChild(entry.Name);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -270,12 +271,12 @@ internal static class Utility
|
|||||||
return closure.SourceFileSystem.CreateDirectory(in closure.DestinationPathBuffer);
|
return closure.SourceFileSystem.CreateDirectory(in closure.DestinationPathBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result OnExitDir(in Path path, in DirectoryEntry entry, ref FsIterationTaskClosure closure)
|
static Result OnExitDir(ref readonly Path path, in DirectoryEntry entry, ref FsIterationTaskClosure closure)
|
||||||
{
|
{
|
||||||
return closure.DestinationPathBuffer.RemoveChild();
|
return closure.DestinationPathBuffer.RemoveChild();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result OnFile(in Path path, in DirectoryEntry entry, ref FsIterationTaskClosure closure)
|
static Result OnFile(ref readonly Path path, in DirectoryEntry entry, ref FsIterationTaskClosure closure)
|
||||||
{
|
{
|
||||||
Result res = closure.DestinationPathBuffer.AppendChild(entry.Name);
|
Result res = closure.DestinationPathBuffer.AppendChild(entry.Name);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
@ -296,10 +297,10 @@ internal static class Utility
|
|||||||
|
|
||||||
public static Result VerifyDirectoryRecursively(IFileSystem fileSystem, Span<byte> workBuffer)
|
public static Result VerifyDirectoryRecursively(IFileSystem fileSystem, Span<byte> workBuffer)
|
||||||
{
|
{
|
||||||
static Result OnEnterAndExitDir(in Path path, in DirectoryEntry entry, ref FsIterationTaskClosure closure) =>
|
static Result OnEnterAndExitDir(ref readonly Path path, in DirectoryEntry entry, ref FsIterationTaskClosure closure) =>
|
||||||
Result.Success;
|
Result.Success;
|
||||||
|
|
||||||
static Result OnFile(in Path path, in DirectoryEntry entry, ref FsIterationTaskClosure closure)
|
static Result OnFile(ref readonly Path path, in DirectoryEntry entry, ref FsIterationTaskClosure closure)
|
||||||
{
|
{
|
||||||
using var file = new UniqueRef<IFile>();
|
using var file = new UniqueRef<IFile>();
|
||||||
|
|
||||||
@ -336,7 +337,7 @@ internal static class Utility
|
|||||||
OnEnterAndExitDir, OnFile, ref closure);
|
OnEnterAndExitDir, OnFile, ref closure);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Result EnsureDirectoryImpl(IFileSystem fileSystem, in Path path)
|
private static Result EnsureDirectoryImpl(IFileSystem fileSystem, ref readonly Path path)
|
||||||
{
|
{
|
||||||
using var pathCopy = new Path();
|
using var pathCopy = new Path();
|
||||||
bool isFinished;
|
bool isFinished;
|
||||||
@ -378,7 +379,7 @@ internal static class Utility
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Result EnsureDirectory(IFileSystem fileSystem, in Path path)
|
public static Result EnsureDirectory(IFileSystem fileSystem, ref readonly Path path)
|
||||||
{
|
{
|
||||||
Result res = fileSystem.GetEntryType(out _, in path);
|
Result res = fileSystem.GetEntryType(out _, in path);
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ public sealed class GameCardEmulated : IGcApi
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InsertGameCard(in SharedRef<IStorage> storage)
|
public void InsertGameCard(ref readonly SharedRef<IStorage> storage)
|
||||||
{
|
{
|
||||||
_attached = false;
|
_attached = false;
|
||||||
_activated = false;
|
_activated = false;
|
||||||
|
@ -8,7 +8,7 @@ namespace LibHac.Gc;
|
|||||||
public interface IGcApi
|
public interface IGcApi
|
||||||
{
|
{
|
||||||
IGcWriterApi Writer { get; }
|
IGcWriterApi Writer { get; }
|
||||||
void InsertGameCard(in SharedRef<IStorage> storage);
|
void InsertGameCard(ref readonly SharedRef<IStorage> storage);
|
||||||
void RemoveGameCard();
|
void RemoveGameCard();
|
||||||
void PresetInternalKeys(ReadOnlySpan<byte> gameCardKey, ReadOnlySpan<byte> gameCardCertificate);
|
void PresetInternalKeys(ReadOnlySpan<byte> gameCardKey, ReadOnlySpan<byte> gameCardCertificate);
|
||||||
void Initialize(Memory<byte> workBuffer, ulong deviceBufferAddress);
|
void Initialize(Memory<byte> workBuffer, ulong deviceBufferAddress);
|
||||||
|
@ -569,7 +569,7 @@ public class GameCardManager : IStorageDeviceManager, IStorageDeviceOperator, IG
|
|||||||
return new WriteOnlyGameCardStorage(ref manager.Ref, _gc);
|
return new WriteOnlyGameCardStorage(ref manager.Ref, _gc);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SharedRef<IStorageDevice> CreateStorageDeviceNonSecure(in SharedRef<IStorage> baseStorage,
|
private SharedRef<IStorageDevice> CreateStorageDeviceNonSecure(ref readonly SharedRef<IStorage> baseStorage,
|
||||||
GameCardHandle handle)
|
GameCardHandle handle)
|
||||||
{
|
{
|
||||||
using SharedRef<IGameCardManager> manager = SharedRef<IGameCardManager>.Create(in _selfReference);
|
using SharedRef<IGameCardManager> manager = SharedRef<IGameCardManager>.Create(in _selfReference);
|
||||||
@ -580,7 +580,7 @@ public class GameCardManager : IStorageDeviceManager, IStorageDeviceOperator, IG
|
|||||||
return SharedRef<IStorageDevice>.CreateMove(ref storageDevice.Ref);
|
return SharedRef<IStorageDevice>.CreateMove(ref storageDevice.Ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SharedRef<IStorageDevice> CreateStorageDeviceSecure(in SharedRef<IStorage> baseStorage,
|
private SharedRef<IStorageDevice> CreateStorageDeviceSecure(ref readonly SharedRef<IStorage> baseStorage,
|
||||||
GameCardHandle handle, ReadOnlySpan<byte> cardDeviceId, ReadOnlySpan<byte> cardImageHash)
|
GameCardHandle handle, ReadOnlySpan<byte> cardDeviceId, ReadOnlySpan<byte> cardImageHash)
|
||||||
{
|
{
|
||||||
using SharedRef<IGameCardManager> manager = SharedRef<IGameCardManager>.Create(in _selfReference);
|
using SharedRef<IGameCardManager> manager = SharedRef<IGameCardManager>.Create(in _selfReference);
|
||||||
|
@ -173,7 +173,7 @@ internal abstract class GameCardStorageInterfaceAdapter : IStorageSf
|
|||||||
{
|
{
|
||||||
private SharedRef<IStorage> _baseStorage;
|
private SharedRef<IStorage> _baseStorage;
|
||||||
|
|
||||||
protected GameCardStorageInterfaceAdapter(in SharedRef<IStorage> baseStorage)
|
protected GameCardStorageInterfaceAdapter(ref readonly SharedRef<IStorage> baseStorage)
|
||||||
{
|
{
|
||||||
_baseStorage = SharedRef<IStorage>.CreateCopy(in baseStorage);
|
_baseStorage = SharedRef<IStorage>.CreateCopy(in baseStorage);
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ internal class GameCardStorageDevice : GameCardStorageInterfaceAdapter, IStorage
|
|||||||
private readonly IGcApi _gc;
|
private readonly IGcApi _gc;
|
||||||
|
|
||||||
private GameCardStorageDevice(IGcApi gc, ref SharedRef<IGameCardManager> manager,
|
private GameCardStorageDevice(IGcApi gc, ref SharedRef<IGameCardManager> manager,
|
||||||
in SharedRef<IStorage> baseStorage, GameCardHandle handle) : base(in baseStorage)
|
ref readonly SharedRef<IStorage> baseStorage, GameCardHandle handle) : base(in baseStorage)
|
||||||
{
|
{
|
||||||
_manager = SharedRef<IGameCardManager>.CreateMove(ref manager);
|
_manager = SharedRef<IGameCardManager>.CreateMove(ref manager);
|
||||||
_handle = handle;
|
_handle = handle;
|
||||||
@ -37,8 +37,8 @@ internal class GameCardStorageDevice : GameCardStorageInterfaceAdapter, IStorage
|
|||||||
}
|
}
|
||||||
|
|
||||||
private GameCardStorageDevice(IGcApi gc, ref SharedRef<IGameCardManager> manager,
|
private GameCardStorageDevice(IGcApi gc, ref SharedRef<IGameCardManager> manager,
|
||||||
in SharedRef<IStorage> baseStorage, GameCardHandle handle, bool isSecure, ReadOnlySpan<byte> cardDeviceId,
|
ref readonly SharedRef<IStorage> baseStorage, GameCardHandle handle, bool isSecure,
|
||||||
ReadOnlySpan<byte> cardImageHash)
|
ReadOnlySpan<byte> cardDeviceId, ReadOnlySpan<byte> cardImageHash)
|
||||||
: base(in baseStorage)
|
: base(in baseStorage)
|
||||||
{
|
{
|
||||||
Assert.SdkRequiresEqual(cardDeviceId.Length, Values.GcCardDeviceIdSize);
|
Assert.SdkRequiresEqual(cardDeviceId.Length, Values.GcCardDeviceIdSize);
|
||||||
@ -55,7 +55,7 @@ internal class GameCardStorageDevice : GameCardStorageInterfaceAdapter, IStorage
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static SharedRef<GameCardStorageDevice> CreateShared(IGcApi gc, ref SharedRef<IGameCardManager> manager,
|
public static SharedRef<GameCardStorageDevice> CreateShared(IGcApi gc, ref SharedRef<IGameCardManager> manager,
|
||||||
in SharedRef<IStorage> baseStorage, GameCardHandle handle)
|
ref readonly SharedRef<IStorage> baseStorage, GameCardHandle handle)
|
||||||
{
|
{
|
||||||
var storageDevice = new GameCardStorageDevice(gc, ref manager, in baseStorage, handle);
|
var storageDevice = new GameCardStorageDevice(gc, ref manager, in baseStorage, handle);
|
||||||
|
|
||||||
@ -66,8 +66,8 @@ internal class GameCardStorageDevice : GameCardStorageInterfaceAdapter, IStorage
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static SharedRef<GameCardStorageDevice> CreateShared(IGcApi gc, ref SharedRef<IGameCardManager> manager,
|
public static SharedRef<GameCardStorageDevice> CreateShared(IGcApi gc, ref SharedRef<IGameCardManager> manager,
|
||||||
in SharedRef<IStorage> baseStorage, GameCardHandle handle, bool isSecure, ReadOnlySpan<byte> cardDeviceId,
|
ref readonly SharedRef<IStorage> baseStorage, GameCardHandle handle, bool isSecure,
|
||||||
ReadOnlySpan<byte> cardImageHash)
|
ReadOnlySpan<byte> cardDeviceId, ReadOnlySpan<byte> cardImageHash)
|
||||||
{
|
{
|
||||||
var storageDevice = new GameCardStorageDevice(gc, ref manager, in baseStorage, handle, isSecure, cardDeviceId,
|
var storageDevice = new GameCardStorageDevice(gc, ref manager, in baseStorage, handle, isSecure, cardDeviceId,
|
||||||
cardImageHash);
|
cardImageHash);
|
||||||
|
@ -23,7 +23,7 @@ public class InitialProcessBinaryReader : IDisposable
|
|||||||
_storage.Destroy();
|
_storage.Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result Initialize(in SharedRef<IStorage> binaryStorage)
|
public Result Initialize(ref readonly SharedRef<IStorage> binaryStorage)
|
||||||
{
|
{
|
||||||
if (!binaryStorage.HasValue)
|
if (!binaryStorage.HasValue)
|
||||||
return ResultLibHac.NullArgument.Log();
|
return ResultLibHac.NullArgument.Log();
|
||||||
@ -47,7 +47,7 @@ public class InitialProcessBinaryReader : IDisposable
|
|||||||
|
|
||||||
// There's no metadata with the offsets of each KIP; they're all stored sequentially in the file.
|
// There's no metadata with the offsets of each KIP; they're all stored sequentially in the file.
|
||||||
// Read the size of each KIP to get their offsets.
|
// Read the size of each KIP to get their offsets.
|
||||||
res = GetKipOffsets(out _offsets, binaryStorage, _header.ProcessCount);
|
res = GetKipOffsets(out _offsets, in binaryStorage, _header.ProcessCount);
|
||||||
if (res.IsFailure()) return res.Miss();
|
if (res.IsFailure()) return res.Miss();
|
||||||
|
|
||||||
_storage.SetByCopy(in binaryStorage);
|
_storage.SetByCopy(in binaryStorage);
|
||||||
@ -64,8 +64,8 @@ public class InitialProcessBinaryReader : IDisposable
|
|||||||
return Result.Success;
|
return Result.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Result GetKipOffsets(out (int offset, int size)[] kipOffsets, in SharedRef<IStorage> iniStorage,
|
private static Result GetKipOffsets(out (int offset, int size)[] kipOffsets,
|
||||||
int processCount)
|
ref readonly SharedRef<IStorage> iniStorage, int processCount)
|
||||||
{
|
{
|
||||||
Assert.SdkRequiresLessEqual(processCount, MaxProcessCount);
|
Assert.SdkRequiresLessEqual(processCount, MaxProcessCount);
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ public class KipReader : IDisposable
|
|||||||
_kipStorage.Destroy();
|
_kipStorage.Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Result Initialize(in SharedRef<IStorage> kipData)
|
public Result Initialize(ref readonly SharedRef<IStorage> kipData)
|
||||||
{
|
{
|
||||||
if (!kipData.HasValue)
|
if (!kipData.HasValue)
|
||||||
return ResultLibHac.NullArgument.Log();
|
return ResultLibHac.NullArgument.Log();
|
||||||
|
@ -7,23 +7,23 @@ namespace LibHac.Lr;
|
|||||||
public interface ILocationResolver : IDisposable
|
public interface ILocationResolver : IDisposable
|
||||||
{
|
{
|
||||||
Result ResolveProgramPath(out Path path, ProgramId id);
|
Result ResolveProgramPath(out Path path, ProgramId id);
|
||||||
Result RedirectProgramPath(in Path path, ProgramId id);
|
Result RedirectProgramPath(ref readonly Path path, ProgramId id);
|
||||||
Result ResolveApplicationControlPath(out Path path, ProgramId id);
|
Result ResolveApplicationControlPath(out Path path, ProgramId id);
|
||||||
Result ResolveApplicationHtmlDocumentPath(out Path path, ProgramId id);
|
Result ResolveApplicationHtmlDocumentPath(out Path path, ProgramId id);
|
||||||
Result ResolveDataPath(out Path path, DataId id);
|
Result ResolveDataPath(out Path path, DataId id);
|
||||||
Result RedirectApplicationControlPath(in Path path, ProgramId id, ProgramId ownerId);
|
Result RedirectApplicationControlPath(ref readonly Path path, ProgramId id, ProgramId ownerId);
|
||||||
Result RedirectApplicationHtmlDocumentPath(in Path path, ProgramId id, ProgramId ownerId);
|
Result RedirectApplicationHtmlDocumentPath(ref readonly Path path, ProgramId id, ProgramId ownerId);
|
||||||
Result ResolveApplicationLegalInformationPath(out Path path, ProgramId id);
|
Result ResolveApplicationLegalInformationPath(out Path path, ProgramId id);
|
||||||
Result RedirectApplicationLegalInformationPath(in Path path, ProgramId id, ProgramId ownerId);
|
Result RedirectApplicationLegalInformationPath(ref readonly Path path, ProgramId id, ProgramId ownerId);
|
||||||
Result Refresh();
|
Result Refresh();
|
||||||
Result RedirectApplicationProgramPath(in Path path, ProgramId id, ProgramId ownerId);
|
Result RedirectApplicationProgramPath(ref readonly Path path, ProgramId id, ProgramId ownerId);
|
||||||
Result ClearApplicationRedirection(InArray<ProgramId> excludingIds);
|
Result ClearApplicationRedirection(InArray<ProgramId> excludingIds);
|
||||||
Result EraseProgramRedirection(ProgramId id);
|
Result EraseProgramRedirection(ProgramId id);
|
||||||
Result EraseApplicationControlRedirection(ProgramId id);
|
Result EraseApplicationControlRedirection(ProgramId id);
|
||||||
Result EraseApplicationHtmlDocumentRedirection(ProgramId id);
|
Result EraseApplicationHtmlDocumentRedirection(ProgramId id);
|
||||||
Result EraseApplicationLegalInformationRedirection(ProgramId id);
|
Result EraseApplicationLegalInformationRedirection(ProgramId id);
|
||||||
Result ResolveProgramPathForDebug(out Path path, ProgramId id);
|
Result ResolveProgramPathForDebug(out Path path, ProgramId id);
|
||||||
Result RedirectProgramPathForDebug(in Path path, ProgramId id);
|
Result RedirectProgramPathForDebug(ref readonly Path path, ProgramId id);
|
||||||
Result RedirectApplicationProgramPathForDebug(in Path path, ProgramId id, ProgramId ownerId);
|
Result RedirectApplicationProgramPathForDebug(ref readonly Path path, ProgramId id, ProgramId ownerId);
|
||||||
Result EraseProgramRedirectionForDebug(ProgramId id);
|
Result EraseProgramRedirectionForDebug(ProgramId id);
|
||||||
}
|
}
|
@ -6,13 +6,13 @@ namespace LibHac.Lr;
|
|||||||
public interface IRegisteredLocationResolver : IDisposable
|
public interface IRegisteredLocationResolver : IDisposable
|
||||||
{
|
{
|
||||||
Result ResolveProgramPath(out Path path, ProgramId id);
|
Result ResolveProgramPath(out Path path, ProgramId id);
|
||||||
Result RegisterProgramPath(in Path path, ProgramId id, ProgramId ownerId);
|
Result RegisterProgramPath(ref readonly Path path, ProgramId id, ProgramId ownerId);
|
||||||
Result UnregisterProgramPath(ProgramId id);
|
Result UnregisterProgramPath(ProgramId id);
|
||||||
Result RedirectProgramPath(in Path path, ProgramId id, ProgramId ownerId);
|
Result RedirectProgramPath(ref readonly Path path, ProgramId id, ProgramId ownerId);
|
||||||
Result ResolveHtmlDocumentPath(out Path path, ProgramId id);
|
Result ResolveHtmlDocumentPath(out Path path, ProgramId id);
|
||||||
Result RegisterHtmlDocumentPath(in Path path, ProgramId id, ProgramId ownerId);
|
Result RegisterHtmlDocumentPath(ref readonly Path path, ProgramId id, ProgramId ownerId);
|
||||||
Result UnregisterHtmlDocumentPath(ProgramId id);
|
Result UnregisterHtmlDocumentPath(ProgramId id);
|
||||||
Result RedirectHtmlDocumentPath(in Path path, ProgramId id);
|
Result RedirectHtmlDocumentPath(ref readonly Path path, ProgramId id);
|
||||||
Result Refresh();
|
Result Refresh();
|
||||||
Result RefreshExcluding(ReadOnlySpan<ProgramId> ids);
|
Result RefreshExcluding(ReadOnlySpan<ProgramId> ids);
|
||||||
}
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user