mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Use ref readonly
This commit is contained in:
parent
03bf56f26c
commit
32dff54cce
120 changed files with 779 additions and 768 deletions
|
@ -6,7 +6,7 @@ public struct DeliveryCacheDirectoryEntry
|
|||
public long Size;
|
||||
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;
|
||||
Size = size;
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace LibHac.Bcat.Impl.Ipc;
|
|||
|
||||
public interface IDeliveryCacheDirectoryService : IDisposable
|
||||
{
|
||||
Result Open(ref DirectoryName name);
|
||||
Result Open(ref readonly DirectoryName name);
|
||||
Result Read(out int entriesRead, Span<DeliveryCacheDirectoryEntry> entryBuffer);
|
||||
Result GetCount(out int count);
|
||||
}
|
|
@ -4,7 +4,7 @@ namespace LibHac.Bcat.Impl.Ipc;
|
|||
|
||||
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 GetSize(out long size);
|
||||
Result GetDigest(out Digest digest);
|
||||
|
|
|
@ -23,11 +23,11 @@ internal class DeliveryCacheFileMetaAccessor
|
|||
Server = server;
|
||||
}
|
||||
|
||||
public Result ReadApplicationFileMeta(ulong applicationId, ref DirectoryName directoryName,
|
||||
public Result ReadApplicationFileMeta(ulong applicationId, ref readonly DirectoryName directoryName,
|
||||
bool allowMissingMetaFile)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
|
|
@ -212,8 +212,8 @@ internal class DeliveryCacheStorageManager
|
|||
}
|
||||
}
|
||||
|
||||
public void GetFilePath(Span<byte> pathBuffer, ulong applicationId, ref DirectoryName directoryName,
|
||||
ref FileName fileName)
|
||||
public void GetFilePath(Span<byte> pathBuffer, ulong applicationId, ref readonly DirectoryName directoryName,
|
||||
ref readonly FileName fileName)
|
||||
{
|
||||
// returns "mount:/directories/%s/files/%s", directoryName, fileName
|
||||
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
|
||||
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
|
||||
lock (_locker)
|
||||
|
|
|
@ -27,7 +27,7 @@ internal class DeliveryCacheDirectoryService : IDeliveryCacheDirectoryService
|
|||
Access = accessControl;
|
||||
}
|
||||
|
||||
public Result Open(ref DirectoryName name)
|
||||
public Result Open(ref readonly DirectoryName name)
|
||||
{
|
||||
if (!name.IsValid())
|
||||
return ResultBcat.InvalidArgument.Log();
|
||||
|
@ -38,7 +38,7 @@ internal class DeliveryCacheDirectoryService : IDeliveryCacheDirectoryService
|
|||
return ResultBcat.AlreadyOpen.Log();
|
||||
|
||||
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();
|
||||
|
||||
Count = metaReader.Count;
|
||||
|
@ -59,7 +59,7 @@ internal class DeliveryCacheDirectoryService : IDeliveryCacheDirectoryService
|
|||
return ResultBcat.NotOpen.Log();
|
||||
|
||||
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();
|
||||
|
||||
int i;
|
||||
|
|
|
@ -29,7 +29,7 @@ internal class DeliveryCacheFileService : IDeliveryCacheFileService
|
|||
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())
|
||||
return ResultBcat.InvalidArgument.Log();
|
||||
|
@ -43,14 +43,14 @@ internal class DeliveryCacheFileService : IDeliveryCacheFileService
|
|||
return ResultBcat.AlreadyOpen.Log();
|
||||
|
||||
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();
|
||||
|
||||
res = metaReader.FindEntry(out DeliveryCacheFileMetaEntry entry, ref fileName);
|
||||
res = metaReader.FindEntry(out DeliveryCacheFileMetaEntry entry, in fileName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
|
|
@ -105,7 +105,7 @@ public class Package1
|
|||
public ref readonly Package1Pk11Header Pk11Header => ref _pk11Header;
|
||||
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;
|
||||
_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="storage">An <see cref="IStorage"/> of the encrypted package2.</param>
|
||||
/// <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));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -65,7 +65,7 @@ public class Package2StorageReader : IDisposable
|
|||
int offset = _header.Meta.GetPayloadFileOffset(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)
|
||||
{
|
||||
|
@ -178,7 +178,7 @@ public class Package2StorageReader : IDisposable
|
|||
int offset = _header.Meta.GetPayloadFileOffset(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;
|
||||
sha.Initialize();
|
||||
|
@ -224,10 +224,10 @@ public class Package2StorageReader : IDisposable
|
|||
int encryptedHeaderSize = Unsafe.SizeOf<Package2Header>() - unencryptedHeaderSize;
|
||||
|
||||
// Get signature and IV
|
||||
storages.Add(new SubStorage(_storage, 0, unencryptedHeaderSize));
|
||||
storages.Add(new SubStorage(in _storage, 0, unencryptedHeaderSize));
|
||||
|
||||
// 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 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);
|
||||
|
||||
private static RSAParameters CreateRsaParameters(in RsaKey key)
|
||||
private static RSAParameters CreateRsaParameters(ref readonly RsaKey key)
|
||||
{
|
||||
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
|
||||
{
|
||||
|
|
|
@ -72,7 +72,7 @@ public readonly ref struct ReadOnlyRef<T>
|
|||
/// </summary>
|
||||
/// <param name="value">The reference to the target <typeparamref name="T"/> value.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public ReadOnlyRef(in T value)
|
||||
public ReadOnlyRef(ref readonly T value)
|
||||
{
|
||||
_ref = ref value;
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ public struct SharedRef<T> : IDisposable where T : class, IDisposable
|
|||
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>();
|
||||
|
||||
|
@ -153,7 +153,7 @@ public struct SharedRef<T> : IDisposable where T : class, IDisposable
|
|||
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));
|
||||
|
||||
|
@ -228,7 +228,7 @@ public struct SharedRef<T> : IDisposable where T : class, IDisposable
|
|||
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 otherRef = other._refCount;
|
||||
|
@ -293,7 +293,7 @@ public struct WeakRef<T> : IDisposable where T : class, IDisposable
|
|||
private T _value;
|
||||
private RefCount _refCount;
|
||||
|
||||
public WeakRef(in SharedRef<T> other)
|
||||
public WeakRef(ref readonly SharedRef<T> other)
|
||||
{
|
||||
this = Create(in other);
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ public struct WeakRef<T> : IDisposable where T : class, IDisposable
|
|||
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>();
|
||||
|
||||
|
@ -356,7 +356,7 @@ public struct WeakRef<T> : IDisposable where T : class, IDisposable
|
|||
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));
|
||||
|
||||
|
@ -398,14 +398,14 @@ public struct WeakRef<T> : IDisposable where T : class, IDisposable
|
|||
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);
|
||||
Swap(ref temp);
|
||||
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);
|
||||
Swap(ref temp);
|
||||
|
|
|
@ -60,19 +60,19 @@ public static class SpanHelpers
|
|||
}
|
||||
|
||||
[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);
|
||||
}
|
||||
|
||||
[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);
|
||||
}
|
||||
|
||||
[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
|
||||
{
|
||||
return CreateReadOnlySpan(in Unsafe.As<TStruct, TSpan>(ref Unsafe.AsRef(in reference)),
|
||||
|
@ -80,7 +80,7 @@ public static class SpanHelpers
|
|||
}
|
||||
|
||||
[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>());
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public enum AbortReason
|
|||
|
||||
public static class Abort
|
||||
{
|
||||
internal static void InvokeAbortObserver(in AbortInfo abortInfo)
|
||||
internal static void InvokeAbortObserver(ref readonly AbortInfo abortInfo)
|
||||
{
|
||||
// Todo
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public enum AssertionFailureOperation
|
|||
Continue
|
||||
}
|
||||
|
||||
public delegate AssertionFailureOperation AssertionFailureHandler(in AssertionInfo assertionInfo);
|
||||
public delegate AssertionFailureOperation AssertionFailureHandler(ref readonly AssertionInfo assertionInfo);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
private static void ExecuteAssertionFailureOperation(AssertionFailureOperation operation,
|
||||
in AssertionInfo assertionInfo)
|
||||
ref readonly AssertionInfo assertionInfo)
|
||||
{
|
||||
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);
|
||||
ExecuteAssertionFailureOperation(operation, in assertionInfo);
|
||||
|
@ -440,7 +440,7 @@ public static class Assert
|
|||
// 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
|
||||
{
|
||||
if (AssertImpl.NotNull(in value))
|
||||
|
@ -575,7 +575,7 @@ public static class Assert
|
|||
// 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
|
||||
{
|
||||
if (AssertImpl.Null(in value))
|
||||
|
@ -621,7 +621,7 @@ public static class Assert
|
|||
// 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
|
||||
{
|
||||
if (AssertImpl.Null(in value))
|
||||
|
|
|
@ -13,7 +13,7 @@ internal class ObserverManager<TObserver, TItem> where TObserver : IObserverHold
|
|||
private LinkedList<TObserver> _observers;
|
||||
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)
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ internal class ObserverManager<TObserver, TItem> where TObserver : IObserverHold
|
|||
_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);
|
||||
|
||||
|
@ -81,7 +81,7 @@ internal class LogObserverManager
|
|||
private readonly LinkedList<LogObserverHolder> _observers;
|
||||
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)
|
||||
{
|
||||
|
@ -129,7 +129,7 @@ internal class LogObserverManager
|
|||
_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);
|
||||
|
||||
|
|
|
@ -7,12 +7,12 @@ namespace LibHac.Diag;
|
|||
public static class Log
|
||||
{
|
||||
// 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);
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@ using LibHac.Diag.Impl;
|
|||
|
||||
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
|
||||
{
|
||||
|
@ -40,7 +40,8 @@ namespace LibHac.Diag
|
|||
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;
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
|
@ -73,7 +75,7 @@ namespace LibHac.Diag
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -401,7 +401,7 @@ namespace LibHac.Fs.Impl
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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.TargetLocked"/>: When opening as <see cref="OpenMode.Write"/>,
|
||||
/// 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>();
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ public static class PathExtensions
|
|||
/// <returns>A reference to the given <see cref="Path"/>.</returns>
|
||||
#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
|
||||
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)
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ public static class PathExtensions
|
|||
return ref *p;
|
||||
}
|
||||
|
||||
public static unsafe bool IsNullRef(in Path path)
|
||||
public static unsafe bool IsNullRef(ref readonly Path 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)
|
||||
{
|
||||
|
@ -131,7 +131,7 @@ public ref struct Path
|
|||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||
/// <see cref="ResultFs.NotNormalized"/>: The <c>IsNormalized</c> flag of
|
||||
/// <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)
|
||||
return ResultFs.NotNormalized.Log();
|
||||
|
@ -406,7 +406,7 @@ public ref struct Path
|
|||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||
/// <see cref="ResultFs.NotNormalized"/>: The <c>IsNormalized</c> flag of
|
||||
/// <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)
|
||||
return ResultFs.NotNormalized.Log();
|
||||
|
@ -433,7 +433,7 @@ public ref struct Path
|
|||
/// 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>
|
||||
/// <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();
|
||||
|
||||
|
@ -840,7 +840,7 @@ public ref struct Path
|
|||
/// <param name="parent">The <see cref="Path"/> to insert.</param>
|
||||
/// <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>
|
||||
public Result InsertParent(scoped in Path parent)
|
||||
public Result InsertParent(scoped ref readonly Path parent)
|
||||
{
|
||||
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>
|
||||
/// <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>
|
||||
public Result AppendChild(scoped in Path child)
|
||||
public Result AppendChild(scoped ref readonly Path child)
|
||||
{
|
||||
return AppendChild(child.GetString());
|
||||
}
|
||||
|
@ -949,7 +949,7 @@ public ref struct Path
|
|||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||
/// <see cref="ResultFs.NotNormalized"/>: The <c>IsNormalized</c> flag of either
|
||||
/// <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 path2Length = path2.GetLength();
|
||||
|
@ -985,7 +985,7 @@ public ref struct Path
|
|||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||
/// <see cref="ResultFs.NotNormalized"/>: The <c>IsNormalized</c> flag of
|
||||
/// <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 path2Length = StringUtils.GetLength(path2);
|
||||
|
@ -1010,7 +1010,7 @@ public ref struct Path
|
|||
/// <param name="path1">The first path to combine.</param>
|
||||
/// <param name="path2">The second path to combine.</param>
|
||||
/// <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 path2Length = path2.GetLength();
|
||||
|
|
|
@ -88,7 +88,7 @@ public static class PathUtility
|
|||
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));
|
||||
}
|
||||
|
|
|
@ -265,8 +265,8 @@ public struct SaveDataCreationInfo2
|
|||
public int MetaSize;
|
||||
public Array356<byte> Reserved4;
|
||||
|
||||
public static Result Make(out SaveDataCreationInfo2 creationInfo, in SaveDataAttribute attribute, long size,
|
||||
long journalSize, long blockSize, ulong ownerId, SaveDataFlags flags, SaveDataSpaceId spaceId,
|
||||
public static Result Make(out SaveDataCreationInfo2 creationInfo, in SaveDataAttribute attribute,
|
||||
long size, long journalSize, long blockSize, ulong ownerId, SaveDataFlags flags, SaveDataSpaceId spaceId,
|
||||
SaveDataFormatType formatType)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out creationInfo);
|
||||
|
|
|
@ -3,28 +3,28 @@
|
|||
// ReSharper disable once InconsistentNaming
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public Result SetFileAttributes(in Path path, NxFileAttributes attributes)
|
||||
public Result SetFileAttributes(ref readonly Path path, NxFileAttributes 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);
|
||||
}
|
||||
|
||||
protected abstract Result DoCreateDirectory(in Path path, NxFileAttributes archiveAttribute);
|
||||
protected abstract Result DoGetFileAttributes(out NxFileAttributes attributes, in Path path);
|
||||
protected abstract Result DoSetFileAttributes(in Path path, NxFileAttributes attributes);
|
||||
protected abstract Result DoGetFileSize(out long fileSize, in Path path);
|
||||
protected abstract Result DoCreateDirectory(ref readonly Path path, NxFileAttributes archiveAttribute);
|
||||
protected abstract Result DoGetFileAttributes(out NxFileAttributes attributes, ref readonly Path path);
|
||||
protected abstract Result DoSetFileAttributes(ref readonly Path path, NxFileAttributes attributes);
|
||||
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.PathAlreadyExists"/>: Specified path already exists as either a file or directory.<br/>
|
||||
/// <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)
|
||||
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.PathAlreadyExists"/>: Specified path already exists as either a file or directory.<br/>
|
||||
/// <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);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public abstract class IFileSystem : IDisposable
|
|||
/// <param name="path">The full path of the file to delete.</param>
|
||||
/// <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>
|
||||
public Result DeleteFile(in Path path)
|
||||
public Result DeleteFile(ref readonly Path 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.PathAlreadyExists"/>: Specified path already exists as either a file or directory.<br/>
|
||||
/// <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);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public abstract class IFileSystem : IDisposable
|
|||
/// <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.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);
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ public abstract class IFileSystem : IDisposable
|
|||
/// <param name="path">The full path of the directory to delete.</param>
|
||||
/// <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>
|
||||
public Result DeleteDirectoryRecursively(in Path path)
|
||||
public Result DeleteDirectoryRecursively(ref readonly Path 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>
|
||||
/// <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>
|
||||
public Result CleanDirectoryRecursively(in Path path)
|
||||
public Result CleanDirectoryRecursively(ref readonly Path path)
|
||||
{
|
||||
return DoCleanDirectoryRecursively(in path);
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public abstract class IFileSystem : IDisposable
|
|||
/// <remarks>
|
||||
/// If <paramref name="currentPath"/> and <paramref name="newPath"/> are the same, this function does nothing and returns successfully.
|
||||
/// </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);
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ public abstract class IFileSystem : IDisposable
|
|||
/// <remarks>
|
||||
/// If <paramref name="currentPath"/> and <paramref name="newPath"/> are the same, this function does nothing and returns <see cref="Result.Success"/>.
|
||||
/// </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);
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ public abstract class IFileSystem : IDisposable
|
|||
/// <param name="path">The full path to check.</param>
|
||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||
/// <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);
|
||||
}
|
||||
|
@ -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.TargetLocked"/>: When opening as <see cref="OpenMode.Write"/>,
|
||||
/// 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)
|
||||
return ResultFs.InvalidModeForFileOpen.Log();
|
||||
|
@ -225,7 +225,7 @@ public abstract class IFileSystem : IDisposable
|
|||
/// <param name="mode">Specifies which sub-entries should be enumerated.</param>
|
||||
/// <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>
|
||||
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 ||
|
||||
(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="path">The path of the drive to query. Unused in almost all cases.</param>
|
||||
/// <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);
|
||||
}
|
||||
|
@ -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="path">The path of the drive to query. Unused in almost all cases.</param>
|
||||
/// <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);
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ public abstract class IFileSystem : IDisposable
|
|||
/// <param name="path">The path of the file or directory.</param>
|
||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||
/// <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);
|
||||
}
|
||||
|
@ -294,9 +294,9 @@ public abstract class IFileSystem : IDisposable
|
|||
/// <param name="queryId">The type of query to perform.</param>
|
||||
/// <param name="path">The full path of the file to query.</param>
|
||||
/// <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>
|
||||
|
@ -309,44 +309,44 @@ public abstract class IFileSystem : IDisposable
|
|||
return DoGetFileSystemAttribute(out outAttribute);
|
||||
}
|
||||
|
||||
protected abstract Result DoCreateFile(in Path path, long size, CreateFileOptions option);
|
||||
protected abstract Result DoDeleteFile(in Path path);
|
||||
protected abstract Result DoCreateDirectory(in Path path);
|
||||
protected abstract Result DoDeleteDirectory(in Path path);
|
||||
protected abstract Result DoDeleteDirectoryRecursively(in Path path);
|
||||
protected abstract Result DoCleanDirectoryRecursively(in Path path);
|
||||
protected abstract Result DoRenameFile(in Path currentPath, in Path newPath);
|
||||
protected abstract Result DoRenameDirectory(in Path currentPath, in Path newPath);
|
||||
protected abstract Result DoGetEntryType(out DirectoryEntryType entryType, in Path path);
|
||||
protected abstract Result DoCreateFile(ref readonly Path path, long size, CreateFileOptions option);
|
||||
protected abstract Result DoDeleteFile(ref readonly Path path);
|
||||
protected abstract Result DoCreateDirectory(ref readonly Path path);
|
||||
protected abstract Result DoDeleteDirectory(ref readonly Path path);
|
||||
protected abstract Result DoDeleteDirectoryRecursively(ref readonly Path path);
|
||||
protected abstract Result DoCleanDirectoryRecursively(ref readonly Path path);
|
||||
protected abstract Result DoRenameFile(ref readonly Path currentPath, ref readonly Path newPath);
|
||||
protected abstract Result DoRenameDirectory(ref readonly Path currentPath, ref readonly Path newPath);
|
||||
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);
|
||||
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);
|
||||
return ResultFs.NotImplemented.Log();
|
||||
}
|
||||
|
||||
protected abstract Result DoOpenFile(ref UniqueRef<IFile> outFile, in Path path, OpenMode mode);
|
||||
protected abstract Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, in Path path, OpenDirectoryMode mode);
|
||||
protected abstract Result DoOpenFile(ref UniqueRef<IFile> outFile, ref readonly Path path, OpenMode mode);
|
||||
protected abstract Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, ref readonly Path path, OpenDirectoryMode mode);
|
||||
protected abstract Result DoCommit();
|
||||
|
||||
protected virtual Result DoCommitProvisionally(long counter) => ResultFs.NotImplemented.Log();
|
||||
protected virtual Result DoRollback() => 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);
|
||||
return ResultFs.NotImplemented.Log();
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -49,43 +49,43 @@ public static class Registrar
|
|||
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);
|
||||
|
||||
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);
|
||||
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path) =>
|
||||
protected override Result DoCleanDirectoryRecursively(ref readonly Path 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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
protected override Result DoGetFileSystemAttribute(out FileSystemAttribute 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);
|
||||
|
||||
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);
|
||||
|
||||
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) =>
|
||||
_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 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);
|
||||
|
||||
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)
|
||||
|
|
|
@ -738,7 +738,7 @@ public static class UserFileSystem
|
|||
? SaveDataFlags.Restore
|
||||
: SaveDataFlags.None;
|
||||
|
||||
return fs.Impl.WriteSaveDataFileSystemExtraData(SaveDataSpaceId.User, in attribute, in extraData,
|
||||
return fs.Impl.WriteSaveDataFileSystemExtraData(SaveDataSpaceId.User, attribute, in extraData,
|
||||
in extraDataMask);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ public class ReadOnlyFileSystem : IFileSystem
|
|||
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
|
||||
if ((mode & OpenMode.All) != OpenMode.Read)
|
||||
|
@ -104,40 +104,40 @@ public class ReadOnlyFileSystem : IFileSystem
|
|||
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)
|
||||
{
|
||||
// An IDirectory is already read-only so we don't need a wrapper ReadOnlyDictionary class
|
||||
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);
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
protected override Result DoDeleteFile(in Path path) =>
|
||||
protected override Result DoDeleteFile(ref readonly Path path) =>
|
||||
ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
|
||||
protected override Result DoCreateDirectory(in Path path) =>
|
||||
protected override Result DoCreateDirectory(ref readonly Path path) =>
|
||||
ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
|
||||
protected override Result DoDeleteDirectory(in Path path) =>
|
||||
protected override Result DoDeleteDirectory(ref readonly Path path) =>
|
||||
ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path) =>
|
||||
protected override Result DoDeleteDirectoryRecursively(ref readonly Path path) =>
|
||||
ResultFs.UnsupportedWriteForReadOnlyFileSystem.Log();
|
||||
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path) =>
|
||||
protected override Result DoCleanDirectoryRecursively(ref readonly Path path) =>
|
||||
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();
|
||||
|
||||
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();
|
||||
|
||||
protected override Result DoCommit() =>
|
||||
|
@ -146,12 +146,12 @@ public class ReadOnlyFileSystem : IFileSystem
|
|||
protected override Result DoCommitProvisionally(long counter) =>
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
return ResultFs.UnsupportedGetTotalSpaceSizeForReadOnlyFileSystem.Log();
|
||||
|
|
|
@ -123,7 +123,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||
{
|
||||
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);
|
||||
|
||||
|
@ -147,7 +147,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||
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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -155,7 +155,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||
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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -163,7 +163,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||
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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -171,7 +171,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||
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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -179,7 +179,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||
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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -187,7 +187,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||
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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -195,7 +195,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||
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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -206,7 +206,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||
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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -217,7 +217,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||
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);
|
||||
|
||||
|
@ -229,7 +229,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||
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);
|
||||
|
||||
|
@ -239,7 +239,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||
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);
|
||||
|
||||
|
@ -249,7 +249,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||
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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -263,7 +263,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||
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)
|
||||
{
|
||||
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
|
@ -283,7 +283,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||
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);
|
||||
|
||||
|
@ -299,7 +299,7 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
|||
}
|
||||
|
||||
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);
|
||||
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>
|
||||
/// <returns>The <see cref="Result"/> of the operation.</returns>
|
||||
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 var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
|
|
@ -19,7 +19,7 @@ public static class PathBasedFileDataCacheShim
|
|||
}
|
||||
|
||||
internal static void InvalidatePathBasedFileDataCacheEntry(this FileSystemClientImpl fs,
|
||||
FileSystemAccessor fsAccessor, in Path path)
|
||||
FileSystemAccessor fsAccessor, ref readonly Path path)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public static class PathBasedFileDataCacheShim
|
|||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -157,7 +157,7 @@ namespace LibHac.Fs.Shim
|
|||
}
|
||||
|
||||
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);
|
||||
|
||||
|
@ -171,7 +171,7 @@ namespace LibHac.Fs.Shim
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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.
|
||||
/// </remarks>
|
||||
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();
|
||||
|
||||
|
@ -1359,7 +1359,7 @@ namespace LibHac.Fs.Shim
|
|||
SaveDataType.System, userId, saveDataId);
|
||||
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();
|
||||
|
||||
flags = extraData.Flags;
|
||||
|
@ -1456,7 +1456,7 @@ namespace LibHac.Fs.Shim
|
|||
SaveDataType.System, userId, saveDataId);
|
||||
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;
|
||||
|
||||
res = fs.Impl.ReadSaveDataFileSystemExtraData(out SaveDataExtraData extraData, SaveDataSpaceId.User,
|
||||
in attribute, in extraDataMask);
|
||||
attribute, in extraDataMask);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
isRestoreFlagSet = extraData.Flags.HasFlag(SaveDataFlags.Restore);
|
||||
|
@ -2303,7 +2303,7 @@ namespace LibHac.Fs.Shim
|
|||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = fs.Impl.ReadSaveDataFileSystemExtraData(out SaveDataExtraData extraData, SaveDataSpaceId.User,
|
||||
in attribute, in extraDataMask);
|
||||
attribute, in extraDataMask);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
saveSize = extraData.DataSize;
|
||||
|
|
|
@ -26,7 +26,7 @@ public static class SdCard
|
|||
|
||||
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)
|
||||
{
|
||||
// Retry a few times if the storage device isn't ready yet
|
||||
|
@ -261,7 +261,7 @@ public static class SdCard
|
|||
outMode = (SdCardSpeedMode)speedMode;
|
||||
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)
|
||||
{
|
||||
outSpeedMode = 0;
|
||||
|
@ -305,7 +305,7 @@ public static class SdCard
|
|||
|
||||
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
|
||||
const int maxRetries = 10;
|
||||
|
@ -348,7 +348,7 @@ public static class SdCard
|
|||
|
||||
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)
|
||||
{
|
||||
outSize = 0;
|
||||
|
@ -394,7 +394,7 @@ public static class SdCard
|
|||
|
||||
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)
|
||||
{
|
||||
outSize = 0;
|
||||
|
@ -442,7 +442,7 @@ public static class SdCard
|
|||
outLogSize = logSize;
|
||||
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)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outErrorInfo, out outLogSize);
|
||||
|
@ -482,7 +482,7 @@ public static class SdCard
|
|||
|
||||
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
|
||||
const int maxRetries = 10;
|
||||
|
|
|
@ -106,7 +106,7 @@ public class SubStorage : IStorage
|
|||
/// <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="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;
|
||||
_offset = offset;
|
||||
|
|
|
@ -23,7 +23,7 @@ public struct ValueSubStorage : IDisposable
|
|||
_sharedBaseStorage = new SharedRef<IStorage>();
|
||||
}
|
||||
|
||||
public ValueSubStorage(in ValueSubStorage other)
|
||||
public ValueSubStorage(ref readonly ValueSubStorage other)
|
||||
{
|
||||
_baseStorage = other._baseStorage;
|
||||
_offset = other._offset;
|
||||
|
@ -45,7 +45,7 @@ public struct ValueSubStorage : IDisposable
|
|||
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;
|
||||
_offset = subStorage._offset + offset;
|
||||
|
@ -59,7 +59,7 @@ public struct ValueSubStorage : IDisposable
|
|||
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;
|
||||
_offset = offset;
|
||||
|
@ -88,7 +88,7 @@ public struct ValueSubStorage : IDisposable
|
|||
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)))
|
||||
{
|
||||
|
|
|
@ -85,7 +85,7 @@ public readonly struct BaseFileSystemService
|
|||
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)
|
||||
{
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
|
@ -150,7 +150,7 @@ public readonly struct BaseFileSystemService
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
public Result SetBisRootForHost(BisPartitionId partitionId, in FspPath path)
|
||||
public Result SetBisRootForHost(BisPartitionId partitionId, ref readonly FspPath path)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ public class FileSystemProxyCoreImpl
|
|||
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();
|
||||
Result res = pathHost.Initialize(in path);
|
||||
|
@ -88,13 +88,13 @@ public class FileSystemProxyCoreImpl
|
|||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = _fsCreators.TargetManagerFileSystemCreator.Create(ref outFileSystem, in pathHost, isSupported,
|
||||
ensureRootPathExists: false, Result.Success);
|
||||
ensureRootPathExists: false, pathNotFoundResult: Result.Success);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
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)
|
||||
{
|
||||
if (!path.IsEmpty() && openCaseSensitive)
|
||||
|
@ -105,7 +105,7 @@ public class FileSystemProxyCoreImpl
|
|||
else
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
|||
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)
|
||||
{
|
||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
|
@ -172,7 +172,7 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
|||
}
|
||||
|
||||
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);
|
||||
|
||||
|
@ -251,7 +251,7 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
|||
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)
|
||||
{
|
||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
|
@ -478,7 +478,7 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
|||
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)
|
||||
{
|
||||
return GetBaseFileSystemService().OpenBisFileSystem(ref outFileSystem, in rootPath, partitionId);
|
||||
|
@ -494,13 +494,13 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
|||
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);
|
||||
}
|
||||
|
||||
public Result OpenHostFileSystemWithOption(ref SharedRef<IFileSystemSf> outFileSystem,
|
||||
in FspPath path, MountHostOption option)
|
||||
ref readonly FspPath path, MountHostOption option)
|
||||
{
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -783,7 +783,7 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
public Result SetSaveDataRootPath(in FspPath path)
|
||||
public Result SetSaveDataRootPath(ref readonly FspPath path)
|
||||
{
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -919,12 +919,13 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
|||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
|
@ -992,7 +993,7 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
|||
.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);
|
||||
}
|
||||
|
|
|
@ -6,5 +6,5 @@ namespace LibHac.FsSrv.FsCreator;
|
|||
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
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);
|
||||
}
|
|
@ -82,7 +82,7 @@ public class SaveDataResultConvertFileSystem : IResultConvertFileSystem<ISaveDat
|
|||
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>();
|
||||
Result res = ConvertResult(GetFileSystem().OpenFile(ref file.Ref, in path, mode));
|
||||
|
@ -95,7 +95,7 @@ public class SaveDataResultConvertFileSystem : IResultConvertFileSystem<ISaveDat
|
|||
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)
|
||||
{
|
||||
using var directory = new UniqueRef<IDirectory>();
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace LibHac.FsSrv.FsCreator;
|
|||
public class SubDirectoryFileSystemCreator : ISubDirectoryFileSystemCreator
|
||||
{
|
||||
public Result Create(ref SharedRef<IFileSystem> outSubDirFileSystem, ref SharedRef<IFileSystem> baseFileSystem,
|
||||
in Path path)
|
||||
ref readonly Path path)
|
||||
{
|
||||
using var directory = new UniqueRef<IDirectory>();
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace LibHac.FsSrv.FsCreator;
|
|||
|
||||
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)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
|
|
@ -12,9 +12,9 @@ public class AsynchronousAccessFileSystem : ForwardingFileSystem
|
|||
{ }
|
||||
|
||||
// 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
|
||||
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
|
||||
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
|
||||
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 Result SetUpPath(ref Path fsPath, in PathSf sfPath)
|
||||
private Result SetUpPath(ref Path fsPath, ref readonly PathSf sfPath)
|
||||
{
|
||||
Result res;
|
||||
|
||||
|
@ -316,7 +316,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||
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)
|
||||
return ResultFs.InvalidSize.Log();
|
||||
|
@ -331,7 +331,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
public Result DeleteFile(in PathSf path)
|
||||
public Result DeleteFile(ref readonly PathSf path)
|
||||
{
|
||||
using var pathNormalized = new Path();
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
|
@ -343,7 +343,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
public Result CreateDirectory(in PathSf path)
|
||||
public Result CreateDirectory(ref readonly PathSf path)
|
||||
{
|
||||
using var pathNormalized = new Path();
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
|
@ -358,7 +358,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
public Result DeleteDirectory(in PathSf path)
|
||||
public Result DeleteDirectory(ref readonly PathSf path)
|
||||
{
|
||||
using var pathNormalized = new Path();
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
|
@ -373,7 +373,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
public Result DeleteDirectoryRecursively(in PathSf path)
|
||||
public Result DeleteDirectoryRecursively(ref readonly PathSf path)
|
||||
{
|
||||
using var pathNormalized = new Path();
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
|
@ -388,7 +388,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
public Result CleanDirectoryRecursively(in PathSf path)
|
||||
public Result CleanDirectoryRecursively(ref readonly PathSf path)
|
||||
{
|
||||
using var pathNormalized = new Path();
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
|
@ -400,7 +400,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||
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();
|
||||
Result res = SetUpPath(ref currentPathNormalized.Ref(), in currentPath);
|
||||
|
@ -416,7 +416,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||
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();
|
||||
Result res = SetUpPath(ref currentPathNormalized.Ref(), in currentPath);
|
||||
|
@ -435,7 +435,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||
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);
|
||||
|
||||
|
@ -450,7 +450,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||
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);
|
||||
|
||||
|
@ -465,7 +465,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||
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);
|
||||
|
||||
|
@ -480,7 +480,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||
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;
|
||||
|
||||
|
@ -510,7 +510,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||
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;
|
||||
|
||||
|
@ -546,7 +546,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||
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);
|
||||
|
||||
|
@ -561,7 +561,7 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
|||
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)
|
||||
{
|
||||
|
|
|
@ -48,7 +48,7 @@ public static class FileSystemProxyServiceObject
|
|||
}
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ public interface ISaveDataTransferCoreInterface : IDisposable
|
|||
Result QuerySaveDataTotalSize(out long outTotalSize, long dataSize, long journalSize);
|
||||
Result CheckSaveDataFile(long saveDataId, SaveDataSpaceId spaceId);
|
||||
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 WriteSaveDataFileSystemExtraDataCore(SaveDataSpaceId spaceId, ulong saveDataId, in SaveDataExtraData extraData, SaveDataType type, bool updateTimeStamp);
|
||||
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();
|
||||
pathFlags.AllowMountName();
|
||||
|
|
|
@ -46,18 +46,18 @@ internal class OpenCountFileSystem : ForwardingFileSystem
|
|||
}
|
||||
|
||||
// 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
|
||||
return base.DoOpenFile(ref outFile, path, mode);
|
||||
return base.DoOpenFile(ref outFile, in path, mode);
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
// Todo: Implement
|
||||
return base.DoOpenDirectory(ref outDirectory, path, mode);
|
||||
return base.DoOpenDirectory(ref outDirectory, in path, mode);
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
|
|
|
@ -24,7 +24,7 @@ public class SaveDataExtraDataAccessorCacheManager : ISaveDataExtraDataAccessorO
|
|||
private readonly SaveDataSpaceId _spaceId;
|
||||
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);
|
||||
_spaceId = spaceId;
|
||||
|
@ -74,7 +74,7 @@ public class SaveDataExtraDataAccessorCacheManager : ISaveDataExtraDataAccessorO
|
|||
_accessorList.Clear();
|
||||
}
|
||||
|
||||
public Result Register(in SharedRef<ISaveDataExtraDataAccessor> accessor, SaveDataSpaceId spaceId,
|
||||
public Result Register(ref readonly SharedRef<ISaveDataExtraDataAccessor> accessor, SaveDataSpaceId spaceId,
|
||||
ulong saveDataId)
|
||||
{
|
||||
accessor.Get.RegisterExtraDataAccessorObserver(this, spaceId, saveDataId);
|
||||
|
|
|
@ -34,58 +34,58 @@ public class SaveDataFileSystemCacheRegister : IFileSystem
|
|||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteFile(in Path path)
|
||||
protected override Result DoDeleteFile(ref readonly Path 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);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectory(in Path path)
|
||||
protected override Result DoDeleteDirectory(ref readonly Path 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);
|
||||
}
|
||||
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
||||
protected override Result DoCleanDirectoryRecursively(ref readonly Path 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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -105,12 +105,12 @@ public class SaveDataFileSystemCacheRegister : IFileSystem
|
|||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ internal static class Utility
|
|||
}
|
||||
|
||||
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())
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ internal static class Utility
|
|||
|
||||
// Check if the directory exists
|
||||
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();
|
||||
|
||||
dir.Reset();
|
||||
|
@ -44,7 +44,7 @@ internal static class Utility
|
|||
}
|
||||
|
||||
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
|
||||
if (!createIfMissing)
|
||||
|
@ -57,7 +57,7 @@ internal static class Utility
|
|||
Result res = FsSystem.Utility.EnsureDirectory(baseFileSystem.Get, in rootPath);
|
||||
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)
|
||||
|
|
|
@ -168,7 +168,7 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
|||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
|||
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)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
@ -225,7 +225,7 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
|||
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)
|
||||
{
|
||||
const StorageLayoutType storageFlag = StorageLayoutType.All;
|
||||
|
@ -384,7 +384,7 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
|||
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;
|
||||
UnsafeHelpers.SkipParamInit(out outRightsId, out outKeyGeneration);
|
||||
|
|
|
@ -67,23 +67,22 @@ public class NcaFileSystemServiceImpl
|
|||
public bool CanMountNca;
|
||||
}
|
||||
|
||||
public Result OpenFileSystem(ref SharedRef<IFileSystem> outFileSystem, in Path path, FileSystemProxyType type,
|
||||
ulong id, bool isDirectory)
|
||||
public Result OpenFileSystem(ref SharedRef<IFileSystem> outFileSystem, ref readonly Path path,
|
||||
FileSystemProxyType type, ulong id, bool isDirectory)
|
||||
{
|
||||
return OpenFileSystem(ref outFileSystem, out Unsafe.NullRef<CodeVerificationData>(), in path, type, false,
|
||||
id, isDirectory);
|
||||
return OpenFileSystem(ref outFileSystem, out Unsafe.NullRef<CodeVerificationData>(), in path, type, false, id,
|
||||
isDirectory);
|
||||
}
|
||||
|
||||
public Result OpenFileSystem(ref SharedRef<IFileSystem> outFileSystem, in Path path, FileSystemProxyType type,
|
||||
bool canMountSystemDataPrivate, ulong id, bool isDirectory)
|
||||
public Result OpenFileSystem(ref SharedRef<IFileSystem> outFileSystem, ref readonly Path path,
|
||||
FileSystemProxyType type, bool canMountSystemDataPrivate, ulong id, bool isDirectory)
|
||||
{
|
||||
return OpenFileSystem(ref outFileSystem, out Unsafe.NullRef<CodeVerificationData>(), in path, type,
|
||||
canMountSystemDataPrivate, id, isDirectory);
|
||||
}
|
||||
|
||||
public Result OpenFileSystem(ref SharedRef<IFileSystem> outFileSystem,
|
||||
out CodeVerificationData verificationData, in Path path, FileSystemProxyType type,
|
||||
bool canMountSystemDataPrivate, ulong id, bool isDirectory)
|
||||
public Result OpenFileSystem(ref SharedRef<IFileSystem> outFileSystem, out CodeVerificationData verificationData,
|
||||
ref readonly Path path, FileSystemProxyType type, bool canMountSystemDataPrivate, ulong id, bool isDirectory)
|
||||
{
|
||||
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)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
public Result OpenFileSystemWithPatch(ref SharedRef<IFileSystem> outFileSystem,
|
||||
in Path originalNcaPath, in Path currentNcaPath, FileSystemProxyType fsType, ulong id)
|
||||
public Result OpenFileSystemWithPatch(ref SharedRef<IFileSystem> outFileSystem, ref readonly Path originalNcaPath,
|
||||
ref readonly Path currentNcaPath, FileSystemProxyType fsType, ulong id)
|
||||
{
|
||||
using var romFsStorage = new SharedRef<IStorage>();
|
||||
Result res = OpenStorageWithPatch(ref romFsStorage.Ref, out Unsafe.NullRef<Hash>(), in originalNcaPath,
|
||||
|
@ -281,7 +280,7 @@ public class NcaFileSystemServiceImpl
|
|||
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();
|
||||
}
|
||||
|
@ -305,7 +304,7 @@ public class NcaFileSystemServiceImpl
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
public Result RegisterUpdatePartition(ulong programId, in Path path)
|
||||
public Result RegisterUpdatePartition(ulong programId, ref readonly Path path)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
@ -511,7 +510,7 @@ public class NcaFileSystemServiceImpl
|
|||
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)
|
||||
{
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
|
@ -522,7 +521,7 @@ public class NcaFileSystemServiceImpl
|
|||
}
|
||||
|
||||
private Result ParseDirWithPathCaseNormalizationOnCaseSensitiveHostFs(ref SharedRef<IFileSystem> outFileSystem,
|
||||
in Path path)
|
||||
ref readonly Path path)
|
||||
{
|
||||
using var pathRoot = new Path();
|
||||
using var pathData = new Path();
|
||||
|
@ -858,7 +857,7 @@ public class NcaFileSystemServiceImpl
|
|||
_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,
|
||||
Result.Success);
|
||||
|
|
|
@ -739,7 +739,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
|||
{
|
||||
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;
|
||||
|
||||
return DeleteSaveDataFileSystemBySaveDataSpaceIdCore(spaceId, info.SaveDataId).Ret();
|
||||
|
@ -776,9 +776,12 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
|||
res = accessor.Get.GetInterface().GetKey(out SaveDataAttribute key, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Result GetExtraData(out SaveDataExtraData data) =>
|
||||
_serviceImpl.ReadSaveDataFileSystemExtraData(out data, targetSpaceId, saveDataId, key.Type,
|
||||
_saveDataRootPath.DangerousGetPath());
|
||||
|
||||
Result GetExtraData(out SaveDataExtraData data)
|
||||
{
|
||||
var path = _saveDataRootPath.DangerousGetPath();
|
||||
return _serviceImpl.ReadSaveDataFileSystemExtraData(out data, targetSpaceId, saveDataId, key.Type, in path);
|
||||
}
|
||||
|
||||
res = SaveDataAccessibilityChecker.CheckDelete(in key, programInfo, GetExtraData);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -842,7 +845,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Result SetSaveDataRootPath(in FspPath path)
|
||||
public Result SetSaveDataRootPath(ref readonly FspPath path)
|
||||
{
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -1165,7 +1168,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
|||
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);
|
||||
|
||||
|
@ -1849,7 +1852,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
|||
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();
|
||||
|
||||
// Make a mask for reading the entire extra data
|
||||
|
@ -1898,7 +1901,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
|||
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();
|
||||
|
||||
return ReadSaveDataFileSystemExtraDataCore(out extraDataRef, spaceId, info.SaveDataId, in maskRef).Ret();
|
||||
|
@ -1978,7 +1981,7 @@ internal class SaveDataFileSystemService : ISaveDataTransferCoreInterface, ISave
|
|||
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();
|
||||
|
||||
return WriteSaveDataFileSystemExtraDataWithMask(info.SaveDataId, spaceId, extraData, extraDataMask).Ret();
|
||||
|
|
|
@ -82,12 +82,12 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
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();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
}
|
||||
|
||||
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>();
|
||||
|
||||
|
@ -241,33 +241,33 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private Result OpenSaveDataImageFile(ref UniqueRef<IFile> outFile, SaveDataSpaceId spaceId, ulong saveDataId,
|
||||
in Path saveDataRootPath)
|
||||
ref readonly Path saveDataRootPath)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
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,
|
||||
in saveDataRootPath, isExtensionStart: true);
|
||||
}
|
||||
|
||||
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,
|
||||
journalSize: 0, in saveDataRootPath, isExtensionStart: false);
|
||||
|
@ -283,7 +283,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
}
|
||||
|
||||
public void RevertExtendSaveDataFileSystem(ulong saveDataId, SaveDataSpaceId spaceId, long originalSize,
|
||||
in Path saveDataRootPath)
|
||||
ref readonly Path saveDataRootPath)
|
||||
{
|
||||
using var saveDataFile = new UniqueRef<IFile>();
|
||||
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,
|
||||
in Path saveDataRootPath, bool skipFormat)
|
||||
ref readonly Path saveDataRootPath, bool skipFormat)
|
||||
{
|
||||
Unsafe.SkipInit(out Array18<byte> saveImageNameBuffer);
|
||||
|
||||
|
@ -477,7 +477,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
}
|
||||
|
||||
public Result DeleteSaveDataFileSystem(SaveDataSpaceId spaceId, ulong saveDataId, bool wipeSaveFile,
|
||||
in Path saveDataRootPath)
|
||||
ref readonly Path saveDataRootPath)
|
||||
{
|
||||
Unsafe.SkipInit(out Array18<byte> saveImageNameBuffer);
|
||||
|
||||
|
@ -538,7 +538,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
}
|
||||
|
||||
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);
|
||||
|
||||
|
@ -564,7 +564,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
|
||||
// We won't actually use the returned save data FS.
|
||||
// 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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
|
@ -581,7 +581,8 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
}
|
||||
|
||||
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.
|
||||
if (IsAllowedDirectorySaveData(spaceId, in saveDataRootPath))
|
||||
|
@ -604,7 +605,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
|
||||
// We won't actually use the returned save data FS.
|
||||
// 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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
|
@ -625,7 +626,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
}
|
||||
|
||||
public Result CorruptSaveDataFileSystem(SaveDataSpaceId spaceId, ulong saveDataId, long offset,
|
||||
in Path saveDataRootPath)
|
||||
ref readonly Path saveDataRootPath)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
@ -635,7 +636,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
return _config.TimeService.GetCurrentPosixTime(out timeStamp);
|
||||
}
|
||||
|
||||
private bool IsSaveEmulated(in Path saveDataRootPath)
|
||||
private bool IsSaveEmulated(ref readonly Path saveDataRootPath)
|
||||
{
|
||||
return !saveDataRootPath.IsEmpty();
|
||||
}
|
||||
|
@ -649,7 +650,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
}
|
||||
|
||||
public Result OpenSaveDataDirectoryFileSystem(ref SharedRef<IFileSystem> outFileSystem,
|
||||
SaveDataSpaceId spaceId, in Path saveDataRootPath, bool allowEmulatedSave)
|
||||
SaveDataSpaceId spaceId, ref readonly Path saveDataRootPath, bool allowEmulatedSave)
|
||||
{
|
||||
Result res;
|
||||
|
||||
|
@ -662,7 +663,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
// Ensure the target save data directory exists
|
||||
res = _config.TargetManagerFsCreator.Create(ref tmFileSystem.Ref, in saveDataRootPath,
|
||||
openCaseSensitive: false, ensureRootPathExists: true,
|
||||
ResultFs.SaveDataRootPathUnavailable.Value);
|
||||
pathNotFoundResult: ResultFs.SaveDataRootPathUnavailable.Value);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
|
@ -674,13 +675,13 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
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();
|
||||
}
|
||||
else
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -709,13 +710,13 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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>();
|
||||
|
||||
|
@ -819,7 +820,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
|||
/// <summary>
|
||||
/// Checks if a save is to be stored on a host device.
|
||||
/// </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);
|
||||
}
|
||||
|
|
|
@ -184,7 +184,7 @@ public class SaveDataIndexer : ISaveDataIndexer
|
|||
{
|
||||
private WeakRef<Reader> _reader;
|
||||
|
||||
public ReaderAccessor(in SharedRef<Reader> reader)
|
||||
public ReaderAccessor(ref readonly SharedRef<Reader> reader)
|
||||
{
|
||||
_reader = new WeakRef<Reader>(in reader);
|
||||
}
|
||||
|
@ -748,7 +748,7 @@ public class SaveDataIndexer : ISaveDataIndexer
|
|||
/// </summary>
|
||||
/// <param name="reader">The reader to add.</param>
|
||||
/// <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());
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public class SaveDataOpenTypeSetFileStorage : FileStorageBasedFileSystem
|
|||
_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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
|
|
@ -11,21 +11,21 @@ namespace LibHac.FsSrv.Sf;
|
|||
public interface IFileSystem : IDisposable
|
||||
{
|
||||
Result GetImpl(ref SharedRef<Fs.Fsa.IFileSystem> fileSystem);
|
||||
Result CreateFile(in Path path, long size, int option);
|
||||
Result DeleteFile(in Path path);
|
||||
Result CreateDirectory(in Path path);
|
||||
Result DeleteDirectory(in Path path);
|
||||
Result DeleteDirectoryRecursively(in Path path);
|
||||
Result RenameFile(in Path currentPath, in Path newPath);
|
||||
Result RenameDirectory(in Path currentPath, in Path newPath);
|
||||
Result GetEntryType(out uint entryType, in Path path);
|
||||
Result OpenFile(ref SharedRef<IFileSf> outFile, in Path path, uint mode);
|
||||
Result OpenDirectory(ref SharedRef<IDirectorySf> outDirectory, in Path path, uint mode);
|
||||
Result CreateFile(ref readonly Path path, long size, int option);
|
||||
Result DeleteFile(ref readonly Path path);
|
||||
Result CreateDirectory(ref readonly Path path);
|
||||
Result DeleteDirectory(ref readonly Path path);
|
||||
Result DeleteDirectoryRecursively(ref readonly Path path);
|
||||
Result RenameFile(ref readonly Path currentPath, ref readonly Path newPath);
|
||||
Result RenameDirectory(ref readonly Path currentPath, ref readonly Path newPath);
|
||||
Result GetEntryType(out uint entryType, ref readonly Path path);
|
||||
Result OpenFile(ref SharedRef<IFileSf> outFile, ref readonly Path path, uint mode);
|
||||
Result OpenDirectory(ref SharedRef<IDirectorySf> outDirectory, ref readonly Path path, uint mode);
|
||||
Result Commit();
|
||||
Result GetFreeSpaceSize(out long freeSpace, in Path path);
|
||||
Result GetTotalSpaceSize(out long totalSpace, in Path path);
|
||||
Result CleanDirectoryRecursively(in Path path);
|
||||
Result GetFileTimeStampRaw(out FileTimeStampRaw timeStamp, in Path path);
|
||||
Result QueryEntry(OutBuffer outBuffer, InBuffer inBuffer, int queryId, in Path path);
|
||||
Result GetFreeSpaceSize(out long freeSpace, ref readonly Path path);
|
||||
Result GetTotalSpaceSize(out long totalSpace, ref readonly Path path);
|
||||
Result CleanDirectoryRecursively(ref readonly Path path);
|
||||
Result GetFileTimeStampRaw(out FileTimeStampRaw timeStamp, ref readonly Path path);
|
||||
Result QueryEntry(OutBuffer outBuffer, InBuffer inBuffer, int queryId, ref readonly Path path);
|
||||
Result GetFileSystemAttribute(out FileSystemAttribute outAttribute);
|
||||
}
|
|
@ -19,12 +19,12 @@ public interface IFileSystemProxy : IDisposable
|
|||
Result SetCurrentProcess(ulong processId);
|
||||
Result OpenDataFileSystemByCurrentProcess(ref SharedRef<IFileSystemSf> outFileSystem);
|
||||
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 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 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 FormatSdCardFileSystem();
|
||||
Result DeleteSaveDataFileSystem(ulong saveDataId);
|
||||
|
@ -41,7 +41,7 @@ public interface IFileSystemProxy : IDisposable
|
|||
Result DeleteCacheStorage(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 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 OpenSaveDataFileSystem(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 OpenPatchDataStorageByCurrentProcess(ref SharedRef<IStorageSf> outStorage);
|
||||
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 OpenDeviceOperator(ref SharedRef<IDeviceOperator> outDeviceOperator);
|
||||
Result OpenSdCardDetectionEventNotifier(ref SharedRef<IEventNotifier> outEventNotifier);
|
||||
|
@ -95,8 +95,8 @@ public interface IFileSystemProxy : IDisposable
|
|||
Result GetRightsId(out RightsId rightsId, ProgramId programId, StorageId storageId);
|
||||
Result RegisterExternalKey(in RightsId rightsId, in AccessKey externalKey);
|
||||
Result UnregisterAllExternalKey();
|
||||
Result GetRightsIdByPath(out RightsId rightsId, in FspPath path);
|
||||
Result GetRightsIdAndKeyGenerationByPath(out RightsId rightsId, out byte keyGeneration, in FspPath path);
|
||||
Result GetRightsIdByPath(out RightsId rightsId, ref readonly FspPath path);
|
||||
Result GetRightsIdAndKeyGenerationByPath(out RightsId rightsId, out byte keyGeneration, ref readonly FspPath path);
|
||||
Result SetCurrentPosixTimeWithTimeDifference(long currentTime, int timeDifference);
|
||||
Result GetFreeSpaceSizeForSaveData(out long freeSpaceSize, SaveDataSpaceId spaceId);
|
||||
Result VerifySaveDataFileSystemBySaveDataSpaceId(SaveDataSpaceId spaceId, ulong saveDataId, OutBuffer readBuffer);
|
||||
|
@ -114,9 +114,9 @@ public interface IFileSystemProxy : IDisposable
|
|||
Result AbandonAccessFailure(ulong processId);
|
||||
Result GetAndClearErrorInfo(out FileSystemProxyErrorInfo errorInfo);
|
||||
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 SetSaveDataRootPath(in FspPath path);
|
||||
Result SetSaveDataRootPath(ref readonly FspPath path);
|
||||
Result DisableAutoSaveDataCreation();
|
||||
Result SetGlobalAccessLogMode(GlobalAccessLogMode mode);
|
||||
Result GetGlobalAccessLogMode(out GlobalAccessLogMode mode);
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace LibHac.FsSrv.Sf;
|
|||
public interface IFileSystemProxyForLoader : IDisposable
|
||||
{
|
||||
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 SetCurrentProcess(ulong processId);
|
||||
|
|
|
@ -11,8 +11,8 @@ public interface ISaveDataTransferManagerForSaveDataRepair : IDisposable
|
|||
public Result SetKeyPackage(InBuffer keyPackage);
|
||||
public Result OpenSaveDataExporterAndGetEncryptedKey(ref SharedRef<ISaveDataDivisionExporter> outExporter, out RsaEncryptedKey key, SaveDataSpaceId spaceId, ulong saveDataId);
|
||||
public Result PrepareOpenSaveDataImporter(out RsaEncryptedKey key);
|
||||
public Result OpenSaveDataImporterForSaveDataAfterRepair(ref SharedRef<ISaveDataDivisionImporter> outImporter, InBuffer initialDataBeforeRepair, InBuffer initialDataAfterRepair, UserId userId, SaveDataSpaceId spaceId);
|
||||
public Result OpenSaveDataImporterForSaveDataBeforeRepair(ref SharedRef<ISaveDataDivisionImporter> outImporter, InBuffer initialData, 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, in UserId userId, SaveDataSpaceId spaceId);
|
||||
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
|
||||
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);
|
||||
|
||||
|
@ -159,8 +159,8 @@ public class AesCtrCounterExtendedStorage : IStorage
|
|||
}
|
||||
|
||||
public Result Initialize(MemoryResource allocator, ReadOnlySpan<byte> key, uint secureValue, long counterOffset,
|
||||
in ValueSubStorage dataStorage, in ValueSubStorage nodeStorage, in ValueSubStorage entryStorage, int entryCount,
|
||||
ref UniqueRef<IDecryptor> decryptor)
|
||||
ref readonly ValueSubStorage dataStorage, ref readonly ValueSubStorage nodeStorage,
|
||||
ref readonly ValueSubStorage entryStorage, int entryCount, ref UniqueRef<IDecryptor> decryptor)
|
||||
{
|
||||
Assert.SdkRequiresEqual(key.Length, KeySize);
|
||||
Assert.SdkRequiresGreaterEqual(counterOffset, 0);
|
||||
|
|
|
@ -50,7 +50,7 @@ public class AesCtrStorage : IStorage
|
|||
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.SdkRequiresEqual(key.Length, KeySize);
|
||||
|
|
|
@ -53,7 +53,7 @@ public class AesXtsStorageExternal : IStorage
|
|||
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)
|
||||
: 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.");
|
||||
}
|
||||
|
||||
public AlignmentMatchingStoragePooledBuffer(in SharedRef<IStorage> baseStorage, int dataAlign)
|
||||
public AlignmentMatchingStoragePooledBuffer(ref readonly SharedRef<IStorage> baseStorage, int dataAlign)
|
||||
{
|
||||
Abort.DoAbortUnless(BitUtil.IsPowerOfTwo(BufferAlign));
|
||||
|
||||
|
@ -345,7 +345,7 @@ public class AlignmentMatchingStorageInBulkRead<TBufferAlignment> : IStorage
|
|||
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));
|
||||
|
||||
|
|
|
@ -33,13 +33,13 @@ public static class AlignmentMatchingStorageImpl
|
|||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
return Write(storage.Get, subBuffer, dataAlignment, bufferAlignment, offset, source);
|
||||
|
|
|
@ -7,57 +7,57 @@ namespace LibHac.FsSystem;
|
|||
|
||||
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();
|
||||
}
|
||||
|
||||
protected override Result DoDeleteFile(in Path path)
|
||||
protected override Result DoDeleteFile(ref readonly Path path)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override Result DoCreateDirectory(in Path path)
|
||||
protected override Result DoCreateDirectory(ref readonly Path path)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectory(in Path path)
|
||||
protected override Result DoDeleteDirectory(ref readonly Path path)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
||||
protected override Result DoDeleteDirectoryRecursively(ref readonly Path path)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
||||
protected override Result DoCleanDirectoryRecursively(ref readonly Path path)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, in Path path)
|
||||
protected override Result DoGetEntryType(out DirectoryEntryType entryType, ref readonly Path path)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
|
|
@ -62,7 +62,7 @@ file struct StorageNode
|
|||
_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;
|
||||
Offset pos = _start;
|
||||
|
@ -489,8 +489,8 @@ public partial class BucketTree : IDisposable
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
public Result Initialize(MemoryResource allocator, in ValueSubStorage nodeStorage, in ValueSubStorage entryStorage,
|
||||
int nodeSize, int entrySize, int entryCount)
|
||||
public Result Initialize(MemoryResource allocator, ref readonly ValueSubStorage nodeStorage,
|
||||
ref readonly ValueSubStorage entryStorage, int nodeSize, int entrySize, int entryCount)
|
||||
{
|
||||
Assert.SdkRequiresNotNull(allocator);
|
||||
Assert.SdkRequiresLessEqual(sizeof(long), entrySize);
|
||||
|
@ -683,7 +683,7 @@ public partial class BucketTree : IDisposable
|
|||
}
|
||||
|
||||
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.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="entryCount">The exact number of entries that will be added to the bucket tree.</param>
|
||||
/// <returns>The <see cref="Result"/> of the operation.</returns>
|
||||
public Result Initialize(MemoryResource allocator, in ValueSubStorage headerStorage,
|
||||
in ValueSubStorage nodeStorage, in ValueSubStorage entryStorage, int nodeSize, int entrySize,
|
||||
int entryCount)
|
||||
public Result Initialize(MemoryResource allocator, ref readonly ValueSubStorage headerStorage,
|
||||
ref readonly ValueSubStorage nodeStorage, ref readonly ValueSubStorage entryStorage, int nodeSize,
|
||||
int entrySize, int entryCount)
|
||||
{
|
||||
Assert.NotNull(allocator);
|
||||
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>
|
||||
/// <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>
|
||||
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(!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="bufferCount">The maximum number of blocks that can be cached at one time.</param>
|
||||
/// <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.SdkRequiresLess(0, blockSize);
|
||||
|
|
|
@ -64,9 +64,10 @@ public class CompressedStorage : IStorage, IAsynchronousAccessSplitter
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Result Initialize(MemoryResource allocatorForBucketTree, in ValueSubStorage dataStorage,
|
||||
in ValueSubStorage nodeStorage, in ValueSubStorage entryStorage, int bucketTreeEntryCount,
|
||||
long blockSizeMax, long continuousReadingSizeMax, GetDecompressorFunction getDecompressorFunc)
|
||||
public Result Initialize(MemoryResource allocatorForBucketTree, ref readonly ValueSubStorage dataStorage,
|
||||
ref readonly ValueSubStorage nodeStorage, ref readonly ValueSubStorage entryStorage,
|
||||
int bucketTreeEntryCount, long blockSizeMax, long continuousReadingSizeMax,
|
||||
GetDecompressorFunction getDecompressorFunc)
|
||||
{
|
||||
Assert.SdkRequiresNotNull(allocatorForBucketTree);
|
||||
Assert.SdkRequiresLess(0, blockSizeMax);
|
||||
|
@ -296,9 +297,10 @@ public class CompressedStorage : IStorage, IAsynchronousAccessSplitter
|
|||
}
|
||||
|
||||
public Result Initialize(MemoryResource allocatorForBucketTree, IBufferManager allocatorForCacheManager,
|
||||
in ValueSubStorage dataStorage, in ValueSubStorage nodeStorage, in ValueSubStorage entryStorage,
|
||||
int bucketTreeEntryCount, long blockSizeMax, long continuousReadingSizeMax,
|
||||
GetDecompressorFunction getDecompressorFunc, long cacheSize0, long cacheSize1, int maxCacheEntries)
|
||||
ref readonly ValueSubStorage dataStorage, ref readonly ValueSubStorage nodeStorage,
|
||||
ref readonly ValueSubStorage entryStorage, int bucketTreeEntryCount, long blockSizeMax,
|
||||
long continuousReadingSizeMax, GetDecompressorFunction getDecompressorFunc, long cacheSize0, long cacheSize1,
|
||||
int maxCacheEntries)
|
||||
{
|
||||
Result res = _core.Initialize(allocatorForBucketTree, in dataStorage, in nodeStorage, in entryStorage,
|
||||
bucketTreeEntryCount, blockSizeMax, continuousReadingSizeMax, getDecompressorFunc);
|
||||
|
|
|
@ -63,7 +63,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||
base.Dispose();
|
||||
}
|
||||
|
||||
public Result Initialize(in Path path)
|
||||
public Result Initialize(ref readonly Path path)
|
||||
{
|
||||
return _path.Initialize(in path).Ret();
|
||||
}
|
||||
|
@ -401,7 +401,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||
base.Dispose();
|
||||
}
|
||||
|
||||
public Result Initialize(in Path path)
|
||||
public Result Initialize(ref readonly Path path)
|
||||
{
|
||||
return _path.Initialize(in path).Ret();
|
||||
}
|
||||
|
@ -481,7 +481,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
private bool IsReadTarget(in DirectoryEntry entry)
|
||||
private bool IsReadTarget(ref readonly DirectoryEntry entry)
|
||||
{
|
||||
bool hasConcatAttribute = IsConcatenationFileAttribute(entry.Attributes);
|
||||
|
||||
|
@ -540,7 +540,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||
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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -548,7 +548,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||
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)
|
||||
return ResultFs.PathNotFound.Log();
|
||||
|
@ -564,7 +564,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||
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);
|
||||
if (res.IsFailure())
|
||||
|
@ -573,7 +573,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||
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);
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -618,28 +618,28 @@ public class ConcatenationFileSystem : IFileSystem
|
|||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
return _baseFileSystem.Get.GetFileTimeStampRaw(out timeStamp, path).Ret();
|
||||
return _baseFileSystem.Get.GetFileTimeStampRaw(out timeStamp, in path).Ret();
|
||||
}
|
||||
|
||||
protected override Result DoFlush()
|
||||
|
@ -649,7 +649,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||
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);
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
using var scopedLock = new ScopedLock<SdkMutexType>(ref _mutex);
|
||||
|
||||
if (IsConcatenationFile(path))
|
||||
if (IsConcatenationFile(in path))
|
||||
{
|
||||
return ResultFs.PathNotFound.Log();
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
using var concatDirectory = new UniqueRef<ConcatenationDirectory>(
|
||||
|
@ -731,7 +731,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||
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);
|
||||
|
||||
|
@ -740,7 +740,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||
// Create a normal file if the concatenation file flag isn't set
|
||||
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();
|
||||
|
@ -815,7 +815,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||
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);
|
||||
|
||||
|
@ -824,7 +824,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||
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();
|
||||
|
||||
using var filePath = new Path();
|
||||
|
@ -849,7 +849,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||
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);
|
||||
|
||||
|
@ -864,26 +864,26 @@ public class ConcatenationFileSystem : IFileSystem
|
|||
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);
|
||||
|
||||
// Make sure the directory isn't a concatenation file.
|
||||
if (IsConcatenationFile(path))
|
||||
if (IsConcatenationFile(in path))
|
||||
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;
|
||||
|
||||
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();
|
||||
|
||||
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();
|
||||
|
||||
var closure = new FsIterationTaskClosure();
|
||||
|
@ -894,7 +894,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||
ref closure).Ret();
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
||||
protected override Result DoDeleteDirectoryRecursively(ref readonly Path path)
|
||||
{
|
||||
bool isConcatenationFile;
|
||||
using (new ScopedLock<SdkMutexType>(ref _mutex))
|
||||
|
@ -911,7 +911,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||
return _baseFileSystem.Get.DeleteDirectory(in path).Ret();
|
||||
}
|
||||
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
||||
protected override Result DoCleanDirectoryRecursively(ref readonly Path path)
|
||||
{
|
||||
bool isConcatenationFile;
|
||||
using (new ScopedLock<SdkMutexType>(ref _mutex))
|
||||
|
@ -925,7 +925,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||
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);
|
||||
|
||||
|
@ -935,7 +935,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||
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);
|
||||
|
||||
|
@ -945,7 +945,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||
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);
|
||||
|
||||
|
@ -987,7 +987,7 @@ public class ConcatenationFileSystem : IFileSystem
|
|||
}
|
||||
|
||||
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);
|
||||
|
||||
|
|
|
@ -331,7 +331,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||
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();
|
||||
|
||||
|
@ -349,7 +349,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||
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();
|
||||
Result res = ResolvePath(ref fullPath.Ref(), in path);
|
||||
|
@ -363,7 +363,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoDeleteFile(in Path path)
|
||||
protected override Result DoDeleteFile(ref readonly Path path)
|
||||
{
|
||||
using var fullPath = new Path();
|
||||
Result res = ResolvePath(ref fullPath.Ref(), in path);
|
||||
|
@ -377,7 +377,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoCreateDirectory(in Path path)
|
||||
protected override Result DoCreateDirectory(ref readonly Path path)
|
||||
{
|
||||
using var fullPath = new Path();
|
||||
Result res = ResolvePath(ref fullPath.Ref(), in path);
|
||||
|
@ -391,7 +391,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectory(in Path path)
|
||||
protected override Result DoDeleteDirectory(ref readonly Path path)
|
||||
{
|
||||
using var fullPath = new Path();
|
||||
Result res = ResolvePath(ref fullPath.Ref(), in path);
|
||||
|
@ -405,7 +405,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
||||
protected override Result DoDeleteDirectoryRecursively(ref readonly Path path)
|
||||
{
|
||||
using var fullPath = new Path();
|
||||
Result res = ResolvePath(ref fullPath.Ref(), in path);
|
||||
|
@ -419,7 +419,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
||||
protected override Result DoCleanDirectoryRecursively(ref readonly Path path)
|
||||
{
|
||||
using var fullPath = new Path();
|
||||
Result res = ResolvePath(ref fullPath.Ref(), in path);
|
||||
|
@ -433,7 +433,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||
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 newFullPath = new Path();
|
||||
|
@ -452,7 +452,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||
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 newFullPath = new Path();
|
||||
|
@ -471,7 +471,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||
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);
|
||||
|
||||
|
@ -487,7 +487,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||
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();
|
||||
Result res = ResolvePath(ref fullPath.Ref(), in path);
|
||||
|
@ -510,7 +510,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||
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)
|
||||
{
|
||||
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="sourcePath">The path of the source directory.</param>
|
||||
/// <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.
|
||||
Result res = _baseFs.DeleteDirectoryRecursively(destPath);
|
||||
Result res = _baseFs.DeleteDirectoryRecursively(in destPath);
|
||||
|
||||
// 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.
|
||||
|
@ -542,7 +542,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||
// put the save directory in an invalid state.
|
||||
if (res.IsFailure() && !ResultFs.PathNotFound.Includes(res)) return res;
|
||||
|
||||
res = _baseFs.CreateDirectory(destPath);
|
||||
res = _baseFs.CreateDirectory(in destPath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
var directoryEntry = new DirectoryEntry();
|
||||
|
@ -650,7 +650,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||
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);
|
||||
|
||||
|
@ -666,7 +666,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||
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);
|
||||
|
||||
|
@ -895,7 +895,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||
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>();
|
||||
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>());
|
||||
}
|
||||
|
||||
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>()];
|
||||
|
||||
|
@ -961,7 +961,7 @@ public class DirectorySaveDataFileSystem : ISaveDataFileSystem
|
|||
return WriteExtraDataImpl(in extraData);
|
||||
}
|
||||
|
||||
private Result WriteExtraDataImpl(in SaveDataExtraData extraData)
|
||||
private Result WriteExtraDataImpl(ref readonly SaveDataExtraData extraData)
|
||||
{
|
||||
Assert.SdkRequires(_mutex.IsLockedByCurrentThread());
|
||||
|
||||
|
|
|
@ -90,40 +90,40 @@ public class ForwardingFileSystem : IFileSystem
|
|||
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);
|
||||
|
||||
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);
|
||||
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path) =>
|
||||
protected override Result DoCleanDirectoryRecursively(ref readonly Path 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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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) =>
|
||||
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 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);
|
||||
|
||||
protected override Result DoGetFileSystemAttribute(out FileSystemAttribute outAttribute) =>
|
||||
BaseFileSystem.Get.GetFileSystemAttribute(out outAttribute);
|
||||
|
||||
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)
|
||||
{
|
||||
// Ensure the storage is large enough to hold the meta info.
|
||||
|
@ -189,7 +189,7 @@ public class HierarchicalIntegrityVerificationStorageControlArea : IDisposable
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
public static Result Expand(in ValueSubStorage metaStorage,
|
||||
public static Result Expand(ref readonly ValueSubStorage metaStorage,
|
||||
in HierarchicalIntegrityVerificationMetaInformation newMeta)
|
||||
{
|
||||
// Ensure the storage is large enough to hold the meta info.
|
||||
|
@ -230,7 +230,7 @@ public class HierarchicalIntegrityVerificationStorageControlArea : IDisposable
|
|||
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.
|
||||
Result res = metaStorage.GetSize(out long metaSize);
|
||||
|
@ -279,7 +279,7 @@ public class HierarchicalIntegrityVerificationStorage : IStorage
|
|||
|
||||
private ValueSubStorage[] _storages;
|
||||
|
||||
public HierarchicalStorageInformation(in HierarchicalStorageInformation other)
|
||||
public HierarchicalStorageInformation(ref readonly HierarchicalStorageInformation other)
|
||||
{
|
||||
_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 SetLayer1HashStorage(in ValueSubStorage storage) => _storages[(int)Storage.Layer1Storage].Set(in storage);
|
||||
public void SetLayer2HashStorage(in ValueSubStorage storage) => _storages[(int)Storage.Layer2Storage].Set(in storage);
|
||||
public void SetLayer3HashStorage(in ValueSubStorage storage) => _storages[(int)Storage.Layer3Storage].Set(in storage);
|
||||
public void SetLayer4HashStorage(in ValueSubStorage storage) => _storages[(int)Storage.Layer4Storage].Set(in storage);
|
||||
public void SetLayer5HashStorage(in ValueSubStorage storage) => _storages[(int)Storage.Layer5Storage].Set(in storage);
|
||||
public void SetDataStorage(in ValueSubStorage storage) => _storages[(int)Storage.DataStorage].Set(in storage);
|
||||
public void SetMasterHashStorage(ref readonly ValueSubStorage storage) => _storages[(int)Storage.MasterStorage].Set(in storage);
|
||||
public void SetLayer1HashStorage(ref readonly ValueSubStorage storage) => _storages[(int)Storage.Layer1Storage].Set(in storage);
|
||||
public void SetLayer2HashStorage(ref readonly ValueSubStorage storage) => _storages[(int)Storage.Layer2Storage].Set(in storage);
|
||||
public void SetLayer3HashStorage(ref readonly ValueSubStorage storage) => _storages[(int)Storage.Layer3Storage].Set(in storage);
|
||||
public void SetLayer4HashStorage(ref readonly ValueSubStorage storage) => _storages[(int)Storage.Layer4Storage].Set(in storage);
|
||||
public void SetLayer5HashStorage(ref readonly ValueSubStorage storage) => _storages[(int)Storage.Layer5Storage].Set(in storage);
|
||||
public void SetDataStorage(ref readonly ValueSubStorage storage) => _storages[(int)Storage.DataStorage].Set(in storage);
|
||||
}
|
||||
|
||||
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 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();
|
||||
}
|
||||
|
||||
protected override Result DoDeleteFile(in Path path)
|
||||
protected override Result DoDeleteFile(ref readonly Path path)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectory(in Path path)
|
||||
protected override Result DoDeleteDirectory(ref readonly Path path)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
||||
protected override Result DoCleanDirectoryRecursively(ref readonly Path path)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
@ -187,23 +187,23 @@ public abstract class IResultConvertFileSystem<T> : ISaveDataFileSystem where T
|
|||
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();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ public class IndirectStorage : IStorage
|
|||
public static long QueryEntryStorageSize(int 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);
|
||||
_dataStorage[index].Set(in storage);
|
||||
|
@ -120,7 +120,7 @@ public class IndirectStorage : IStorage
|
|||
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);
|
||||
|
||||
|
@ -141,14 +141,14 @@ public class IndirectStorage : IStorage
|
|||
if (storageSize < entryStorageOffset + entryStorageSize)
|
||||
return ResultFs.InvalidIndirectStorageBucketTreeSize.Log();
|
||||
|
||||
using var nodeStorage = new ValueSubStorage(tableStorage, nodeStorageOffset, nodeStorageSize);
|
||||
using var entryStorage = new ValueSubStorage(tableStorage, entryStorageOffset, entryStorageSize);
|
||||
using var nodeStorage = new ValueSubStorage(in tableStorage, nodeStorageOffset, nodeStorageSize);
|
||||
using var entryStorage = new ValueSubStorage(in tableStorage, entryStorageOffset, entryStorageSize);
|
||||
|
||||
return Initialize(allocator, in nodeStorage, in entryStorage, header.EntryCount);
|
||||
}
|
||||
|
||||
public Result Initialize(MemoryResource allocator, in ValueSubStorage nodeStorage, in ValueSubStorage entryStorage,
|
||||
int entryCount)
|
||||
public Result Initialize(MemoryResource allocator, ref readonly ValueSubStorage nodeStorage,
|
||||
ref readonly ValueSubStorage entryStorage, int entryCount)
|
||||
{
|
||||
return _table.Initialize(allocator, in nodeStorage, in entryStorage, NodeSize, Unsafe.SizeOf<Entry>(),
|
||||
entryCount);
|
||||
|
|
|
@ -90,8 +90,8 @@ public class IntegrityVerificationStorage : IStorage
|
|||
return _verificationBlockSize;
|
||||
}
|
||||
|
||||
public void Initialize(in ValueSubStorage hashStorage, in ValueSubStorage dataStorage, int sizeVerificationBlock,
|
||||
int sizeUpperLayerVerificationBlock, IBufferManager bufferManager,
|
||||
public void Initialize(ref readonly ValueSubStorage hashStorage, ref readonly ValueSubStorage dataStorage,
|
||||
int sizeVerificationBlock, int sizeUpperLayerVerificationBlock, IBufferManager bufferManager,
|
||||
IHash256GeneratorFactory hashGeneratorFactory, in Optional<HashSalt> hashSalt, bool isRealData, bool isWritable,
|
||||
bool allowClearedBlocks)
|
||||
{
|
||||
|
@ -226,7 +226,7 @@ public class IntegrityVerificationStorage : IStorage
|
|||
{
|
||||
int verifiedSize = (verifiedCount + i) << _verificationBlockOrder;
|
||||
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))
|
||||
{
|
||||
|
@ -319,7 +319,7 @@ public class IntegrityVerificationStorage : IStorage
|
|||
{
|
||||
int updatedSize = (updatedSignatureCount + i) << _verificationBlockOrder;
|
||||
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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
CalcBlockHash(out outHash, buffer, verificationBlockSize, in hashGenerator);
|
||||
CalcBlockHash(out outHash, buffer, verificationBlockSize, ref hashGenerator.Ref);
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
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,
|
||||
in UniqueRef<IHash256Generator> hashGenerator)
|
||||
ref UniqueRef<IHash256Generator> hashGenerator)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outHash);
|
||||
|
||||
|
@ -568,7 +568,7 @@ public class IntegrityVerificationStorage : IStorage
|
|||
}
|
||||
|
||||
private Result VerifyHash(ReadOnlySpan<byte> buffer, ref BlockHash hash,
|
||||
in UniqueRef<IHash256Generator> hashGenerator)
|
||||
ref UniqueRef<IHash256Generator> hashGenerator)
|
||||
{
|
||||
Assert.SdkRequiresGreaterEqual(buffer.Length, HashSize);
|
||||
|
||||
|
@ -582,7 +582,7 @@ public class IntegrityVerificationStorage : IStorage
|
|||
return ResultFs.ClearedRealDataVerificationFailed.Log();
|
||||
}
|
||||
|
||||
CalcBlockHash(out BlockHash actualHash, buffer, hashGenerator);
|
||||
CalcBlockHash(out BlockHash actualHash, buffer, ref hashGenerator);
|
||||
|
||||
if (!CryptoUtil.IsSameBytes(SpanHelpers.AsReadOnlyByteSpan(in hash),
|
||||
SpanHelpers.AsReadOnlyByteSpan(in actualHash), Unsafe.SizeOf<BlockHash>()))
|
||||
|
|
|
@ -158,7 +158,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||
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);
|
||||
|
||||
|
@ -194,7 +194,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||
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);
|
||||
|
||||
|
@ -213,7 +213,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||
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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -241,7 +241,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||
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);
|
||||
|
||||
|
@ -254,12 +254,12 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||
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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -280,7 +280,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||
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);
|
||||
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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -320,7 +320,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||
() => 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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -332,7 +332,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||
() => 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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -343,7 +343,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||
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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -355,7 +355,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||
() => 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)
|
||||
{
|
||||
Result res = ResolveFullPath(out string fullPath, in path, true);
|
||||
|
@ -378,12 +378,12 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||
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);
|
||||
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 (entryType == DirectoryEntryType.Directory)
|
||||
|
@ -401,7 +401,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||
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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -422,7 +422,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||
() => 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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -443,7 +443,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||
() => 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);
|
||||
|
||||
|
@ -471,7 +471,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||
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);
|
||||
|
||||
|
@ -501,7 +501,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||
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);
|
||||
|
||||
|
@ -512,7 +512,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||
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);
|
||||
|
||||
|
@ -567,7 +567,7 @@ public class LocalFileSystem : IAttributeFileSystem
|
|||
}
|
||||
|
||||
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
||||
in Path path)
|
||||
ref readonly Path path)
|
||||
{
|
||||
return ResultFs.UnsupportedOperation.Log();
|
||||
}
|
||||
|
|
|
@ -449,7 +449,7 @@ public class NcaReader : IDisposable
|
|||
Assert.SdkRequires(_bodyStorage.HasValue);
|
||||
Assert.SdkRequiresLessEqual(Unsafe.SizeOf<NcaHeader>(), outBuffer.Length);
|
||||
|
||||
SpanHelpers.AsReadOnlyByteSpan(_header).CopyTo(outBuffer);
|
||||
SpanHelpers.AsReadOnlyByteSpan(in _header).CopyTo(outBuffer);
|
||||
}
|
||||
|
||||
public DecryptAesCtrFunction GetExternalDecryptAesCtrFunction()
|
||||
|
|
|
@ -406,14 +406,14 @@ public class PartitionFileSystemCore<TMetaData, TFormat, THeader, TEntry> : IFil
|
|||
base.Dispose();
|
||||
}
|
||||
|
||||
public Result Initialize(in SharedRef<IStorage> baseStorage)
|
||||
public Result Initialize(ref readonly SharedRef<IStorage> baseStorage)
|
||||
{
|
||||
_sharedStorage.SetByCopy(in baseStorage);
|
||||
|
||||
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);
|
||||
|
||||
|
@ -445,14 +445,14 @@ public class PartitionFileSystemCore<TMetaData, TFormat, THeader, TEntry> : IFil
|
|||
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);
|
||||
|
||||
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)
|
||||
return ResultFs.PreconditionViolation.Log();
|
||||
|
@ -484,7 +484,7 @@ public class PartitionFileSystemCore<TMetaData, TFormat, THeader, TEntry> : IFil
|
|||
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);
|
||||
|
||||
|
@ -510,7 +510,7 @@ public class PartitionFileSystemCore<TMetaData, TFormat, THeader, TEntry> : IFil
|
|||
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)
|
||||
return ResultFs.PreconditionViolation.Log();
|
||||
|
@ -531,7 +531,7 @@ public class PartitionFileSystemCore<TMetaData, TFormat, THeader, TEntry> : IFil
|
|||
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)
|
||||
return ResultFs.PreconditionViolation.Log();
|
||||
|
@ -547,14 +547,14 @@ public class PartitionFileSystemCore<TMetaData, TFormat, THeader, TEntry> : IFil
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoDeleteFile(in Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoCreateDirectory(in Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoDeleteDirectory(in Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoCreateFile(ref readonly Path path, long size, CreateFileOptions option) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoDeleteFile(ref readonly Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoCreateDirectory(ref readonly Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoDeleteDirectory(ref readonly Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoDeleteDirectoryRecursively(ref readonly Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoCleanDirectoryRecursively(ref readonly Path path) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoRenameFile(ref readonly Path currentPath, ref readonly Path newPath) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
protected override Result DoRenameDirectory(ref readonly Path currentPath, ref readonly Path newPath) => ResultFs.UnsupportedWriteForPartitionFileSystem.Log();
|
||||
|
||||
protected override Result DoCommit()
|
||||
{
|
||||
|
|
|
@ -208,7 +208,7 @@ namespace LibHac.FsSystem
|
|||
{
|
||||
UnsafeHelpers.SkipParamInit(out outSize);
|
||||
|
||||
if (!CryptoUtil.IsSameBytes(SpanHelpers.AsReadOnlyByteSpan(header), TFormat.VersionSignature,
|
||||
if (!CryptoUtil.IsSameBytes(SpanHelpers.AsReadOnlyByteSpan(in header), TFormat.VersionSignature,
|
||||
TFormat.VersionSignature.Length))
|
||||
{
|
||||
return TFormat.ResultSignatureVerificationFailed.Log();
|
||||
|
|
|
@ -73,7 +73,7 @@ public class SparseStorage : IndirectStorage
|
|||
SetZeroStorage();
|
||||
}
|
||||
|
||||
public void SetDataStorage(in ValueSubStorage storage)
|
||||
public void SetDataStorage(ref readonly ValueSubStorage storage)
|
||||
{
|
||||
Assert.SdkRequires(IsInitialized());
|
||||
|
||||
|
|
|
@ -253,73 +253,73 @@ internal class StorageLayoutTypeSetFileSystem : IFileSystem
|
|||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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 baseFile = new UniqueRef<IFile>();
|
||||
|
@ -331,7 +331,7 @@ internal class StorageLayoutTypeSetFileSystem : IFileSystem
|
|||
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)
|
||||
{
|
||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(_storageFlag);
|
||||
|
@ -368,10 +368,10 @@ internal class StorageLayoutTypeSetFileSystem : IFileSystem
|
|||
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);
|
||||
return _baseFileSystem.Get.GetFileTimeStampRaw(out timeStamp, path);
|
||||
return _baseFileSystem.Get.GetFileTimeStampRaw(out timeStamp, in path);
|
||||
}
|
||||
|
||||
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,
|
||||
in Path path)
|
||||
ref readonly Path path)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
public Result Initialize(in Path rootPath)
|
||||
public Result Initialize(ref readonly Path 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();
|
||||
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);
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||
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);
|
||||
|
||||
|
@ -71,7 +71,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||
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);
|
||||
|
||||
|
@ -85,7 +85,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||
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);
|
||||
|
||||
|
@ -99,7 +99,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||
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();
|
||||
Result res = ResolveFullPath(ref fullPath.Ref(), in path);
|
||||
|
@ -111,7 +111,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||
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)
|
||||
{
|
||||
using var fullPath = new Path();
|
||||
|
@ -124,7 +124,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||
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();
|
||||
Result res = ResolveFullPath(ref fullPath.Ref(), in path);
|
||||
|
@ -136,7 +136,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoDeleteFile(in Path path)
|
||||
protected override Result DoDeleteFile(ref readonly Path path)
|
||||
{
|
||||
using var fullPath = new Path();
|
||||
Result res = ResolveFullPath(ref fullPath.Ref(), in path);
|
||||
|
@ -148,7 +148,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoCreateDirectory(in Path path)
|
||||
protected override Result DoCreateDirectory(ref readonly Path path)
|
||||
{
|
||||
using var fullPath = new Path();
|
||||
Result res = ResolveFullPath(ref fullPath.Ref(), in path);
|
||||
|
@ -160,7 +160,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectory(in Path path)
|
||||
protected override Result DoDeleteDirectory(ref readonly Path path)
|
||||
{
|
||||
using var fullPath = new Path();
|
||||
Result res = ResolveFullPath(ref fullPath.Ref(), in path);
|
||||
|
@ -172,7 +172,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
||||
protected override Result DoDeleteDirectoryRecursively(ref readonly Path path)
|
||||
{
|
||||
using var fullPath = new Path();
|
||||
Result res = ResolveFullPath(ref fullPath.Ref(), in path);
|
||||
|
@ -184,7 +184,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
||||
protected override Result DoCleanDirectoryRecursively(ref readonly Path path)
|
||||
{
|
||||
using var fullPath = new Path();
|
||||
Result res = ResolveFullPath(ref fullPath.Ref(), in path);
|
||||
|
@ -196,7 +196,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||
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();
|
||||
Result res = ResolveFullPath(ref currentFullPath.Ref(), in currentPath);
|
||||
|
@ -212,7 +212,7 @@ public class SubdirectoryFileSystem : IFileSystem
|
|||
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();
|
||||
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,
|
||||
in Path path)
|
||||
ref readonly Path path)
|
||||
{
|
||||
using var fullPath = new Path();
|
||||
Result res = ResolveFullPath(ref fullPath.Ref(), in path);
|
||||
|
|
|
@ -17,7 +17,7 @@ public class SwitchStorage : IStorage
|
|||
private SharedRef<IStorage> _falseStorage;
|
||||
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)
|
||||
{
|
||||
_trueStorage = SharedRef<IStorage>.CreateCopy(in trueStorage);
|
||||
|
@ -125,8 +125,8 @@ public class RegionSwitchStorage : IStorage
|
|||
private SharedRef<IStorage> _outsideRegionStorage;
|
||||
private Region _region;
|
||||
|
||||
public RegionSwitchStorage(in SharedRef<IStorage> insideRegionStorage,
|
||||
in SharedRef<IStorage> outsideRegionStorage, Region region)
|
||||
public RegionSwitchStorage(ref readonly SharedRef<IStorage> insideRegionStorage,
|
||||
ref readonly SharedRef<IStorage> outsideRegionStorage, Region region)
|
||||
{
|
||||
_insideRegionStorage = SharedRef<IStorage>.CreateCopy(in insideRegionStorage);
|
||||
_outsideRegionStorage = SharedRef<IStorage>.CreateCopy(in outsideRegionStorage);
|
||||
|
|
|
@ -68,7 +68,7 @@ public class UnionStorage : IStorage
|
|||
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.SdkRequires(BitUtil.IsPowerOfTwo(blockSize));
|
||||
|
@ -80,7 +80,8 @@ public class UnionStorage : IStorage
|
|||
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);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ public class DummyEventNotifier : IEventNotifier
|
|||
/// <remarks>Based on nnSdk 13.4.0 (FS 13.1.0)</remarks>
|
||||
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>
|
||||
/// Used to pass various ref structs to an <see cref="FsIterationTask"/>.
|
||||
|
@ -145,8 +145,8 @@ internal static class Utility
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
public static Result IterateDirectoryRecursively(IFileSystem fs, in Path rootPath, ref DirectoryEntry dirEntry,
|
||||
FsIterationTask onEnterDir, FsIterationTask onExitDir, FsIterationTask onFile,
|
||||
public static Result IterateDirectoryRecursively(IFileSystem fs, ref readonly Path rootPath,
|
||||
ref DirectoryEntry dirEntry, FsIterationTask onEnterDir, FsIterationTask onExitDir, FsIterationTask onFile,
|
||||
ref FsIterationTaskClosure closure)
|
||||
{
|
||||
using var pathBuffer = new Path();
|
||||
|
@ -160,8 +160,8 @@ internal static class Utility
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
public static Result CleanupDirectoryRecursively(IFileSystem fs, in Path rootPath, ref DirectoryEntry dirEntry,
|
||||
FsIterationTask onEnterDir, FsIterationTask onExitDir, FsIterationTask onFile,
|
||||
public static Result CleanupDirectoryRecursively(IFileSystem fs, ref readonly Path rootPath,
|
||||
ref DirectoryEntry dirEntry, FsIterationTask onEnterDir, FsIterationTask onExitDir, FsIterationTask onFile,
|
||||
ref FsIterationTaskClosure closure)
|
||||
{
|
||||
using var pathBuffer = new Path();
|
||||
|
@ -172,12 +172,12 @@ internal static class Utility
|
|||
ref closure);
|
||||
}
|
||||
|
||||
public static Result CopyFile(IFileSystem destFileSystem, IFileSystem sourceFileSystem, in Path destPath,
|
||||
in Path sourcePath, Span<byte> workBuffer)
|
||||
public static Result CopyFile(IFileSystem destFileSystem, IFileSystem sourceFileSystem, ref readonly Path destPath,
|
||||
ref readonly Path sourcePath, Span<byte> workBuffer)
|
||||
{
|
||||
// Open source file.
|
||||
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();
|
||||
|
||||
res = sourceFile.Get.GetSize(out long fileSize);
|
||||
|
@ -210,9 +210,10 @@ internal static class Utility
|
|||
}
|
||||
|
||||
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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -220,12 +221,12 @@ internal static class Utility
|
|||
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();
|
||||
}
|
||||
|
||||
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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -242,7 +243,7 @@ internal static class Utility
|
|||
closure.SourceFileSystem = sourceFileSystem;
|
||||
closure.DestFileSystem = destinationFileSystem;
|
||||
|
||||
Result res = closure.DestinationPathBuffer.Initialize(destinationPath);
|
||||
Result res = closure.DestinationPathBuffer.Initialize(in destinationPath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
res = IterateDirectoryRecursively(sourceFileSystem, in sourcePath, ref dirEntry, OnEnterDir, OnExitDir,
|
||||
|
@ -252,17 +253,17 @@ internal static class Utility
|
|||
return res;
|
||||
}
|
||||
|
||||
public static Result CopyDirectoryRecursively(IFileSystem fileSystem, in Path destinationPath,
|
||||
in Path sourcePath, ref DirectoryEntry dirEntry, Span<byte> workBuffer)
|
||||
public static Result CopyDirectoryRecursively(IFileSystem fileSystem, ref readonly Path destinationPath,
|
||||
ref readonly Path sourcePath, ref DirectoryEntry dirEntry, Span<byte> workBuffer)
|
||||
{
|
||||
var closure = new FsIterationTaskClosure();
|
||||
closure.Buffer = workBuffer;
|
||||
closure.SourceFileSystem = fileSystem;
|
||||
|
||||
Result res = closure.DestinationPathBuffer.Initialize(destinationPath);
|
||||
Result res = closure.DestinationPathBuffer.Initialize(in destinationPath);
|
||||
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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -270,12 +271,12 @@ internal static class Utility
|
|||
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();
|
||||
}
|
||||
|
||||
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);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
@ -296,10 +297,10 @@ internal static class Utility
|
|||
|
||||
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;
|
||||
|
||||
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>();
|
||||
|
||||
|
@ -336,7 +337,7 @@ internal static class Utility
|
|||
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();
|
||||
bool isFinished;
|
||||
|
@ -378,7 +379,7 @@ internal static class Utility
|
|||
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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
_activated = false;
|
||||
|
|
|
@ -8,7 +8,7 @@ namespace LibHac.Gc;
|
|||
public interface IGcApi
|
||||
{
|
||||
IGcWriterApi Writer { get; }
|
||||
void InsertGameCard(in SharedRef<IStorage> storage);
|
||||
void InsertGameCard(ref readonly SharedRef<IStorage> storage);
|
||||
void RemoveGameCard();
|
||||
void PresetInternalKeys(ReadOnlySpan<byte> gameCardKey, ReadOnlySpan<byte> gameCardCertificate);
|
||||
void Initialize(Memory<byte> workBuffer, ulong deviceBufferAddress);
|
||||
|
|
|
@ -569,7 +569,7 @@ public class GameCardManager : IStorageDeviceManager, IStorageDeviceOperator, IG
|
|||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
using SharedRef<IGameCardManager> manager = SharedRef<IGameCardManager>.Create(in _selfReference);
|
||||
|
|
|
@ -173,7 +173,7 @@ internal abstract class GameCardStorageInterfaceAdapter : IStorageSf
|
|||
{
|
||||
private SharedRef<IStorage> _baseStorage;
|
||||
|
||||
protected GameCardStorageInterfaceAdapter(in SharedRef<IStorage> baseStorage)
|
||||
protected GameCardStorageInterfaceAdapter(ref readonly SharedRef<IStorage> baseStorage)
|
||||
{
|
||||
_baseStorage = SharedRef<IStorage>.CreateCopy(in baseStorage);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ internal class GameCardStorageDevice : GameCardStorageInterfaceAdapter, IStorage
|
|||
private readonly IGcApi _gc;
|
||||
|
||||
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);
|
||||
_handle = handle;
|
||||
|
@ -37,8 +37,8 @@ internal class GameCardStorageDevice : GameCardStorageInterfaceAdapter, IStorage
|
|||
}
|
||||
|
||||
private GameCardStorageDevice(IGcApi gc, ref SharedRef<IGameCardManager> manager,
|
||||
in SharedRef<IStorage> baseStorage, GameCardHandle handle, bool isSecure, ReadOnlySpan<byte> cardDeviceId,
|
||||
ReadOnlySpan<byte> cardImageHash)
|
||||
ref readonly SharedRef<IStorage> baseStorage, GameCardHandle handle, bool isSecure,
|
||||
ReadOnlySpan<byte> cardDeviceId, ReadOnlySpan<byte> cardImageHash)
|
||||
: base(in baseStorage)
|
||||
{
|
||||
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,
|
||||
in SharedRef<IStorage> baseStorage, GameCardHandle handle)
|
||||
ref readonly SharedRef<IStorage> baseStorage, GameCardHandle 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,
|
||||
in SharedRef<IStorage> baseStorage, GameCardHandle handle, bool isSecure, ReadOnlySpan<byte> cardDeviceId,
|
||||
ReadOnlySpan<byte> cardImageHash)
|
||||
ref readonly SharedRef<IStorage> baseStorage, GameCardHandle handle, bool isSecure,
|
||||
ReadOnlySpan<byte> cardDeviceId, ReadOnlySpan<byte> cardImageHash)
|
||||
{
|
||||
var storageDevice = new GameCardStorageDevice(gc, ref manager, in baseStorage, handle, isSecure, cardDeviceId,
|
||||
cardImageHash);
|
||||
|
|
|
@ -23,7 +23,7 @@ public class InitialProcessBinaryReader : IDisposable
|
|||
_storage.Destroy();
|
||||
}
|
||||
|
||||
public Result Initialize(in SharedRef<IStorage> binaryStorage)
|
||||
public Result Initialize(ref readonly SharedRef<IStorage> binaryStorage)
|
||||
{
|
||||
if (!binaryStorage.HasValue)
|
||||
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.
|
||||
// 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();
|
||||
|
||||
_storage.SetByCopy(in binaryStorage);
|
||||
|
@ -64,8 +64,8 @@ public class InitialProcessBinaryReader : IDisposable
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
private static Result GetKipOffsets(out (int offset, int size)[] kipOffsets, in SharedRef<IStorage> iniStorage,
|
||||
int processCount)
|
||||
private static Result GetKipOffsets(out (int offset, int size)[] kipOffsets,
|
||||
ref readonly SharedRef<IStorage> iniStorage, int processCount)
|
||||
{
|
||||
Assert.SdkRequiresLessEqual(processCount, MaxProcessCount);
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public class KipReader : IDisposable
|
|||
_kipStorage.Destroy();
|
||||
}
|
||||
|
||||
public Result Initialize(in SharedRef<IStorage> kipData)
|
||||
public Result Initialize(ref readonly SharedRef<IStorage> kipData)
|
||||
{
|
||||
if (!kipData.HasValue)
|
||||
return ResultLibHac.NullArgument.Log();
|
||||
|
|
|
@ -7,23 +7,23 @@ namespace LibHac.Lr;
|
|||
public interface ILocationResolver : IDisposable
|
||||
{
|
||||
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 ResolveApplicationHtmlDocumentPath(out Path path, ProgramId id);
|
||||
Result ResolveDataPath(out Path path, DataId id);
|
||||
Result RedirectApplicationControlPath(in Path path, ProgramId id, ProgramId ownerId);
|
||||
Result RedirectApplicationHtmlDocumentPath(in Path path, ProgramId id, ProgramId ownerId);
|
||||
Result RedirectApplicationControlPath(ref readonly Path path, ProgramId id, ProgramId ownerId);
|
||||
Result RedirectApplicationHtmlDocumentPath(ref readonly Path path, ProgramId id, ProgramId ownerId);
|
||||
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 RedirectApplicationProgramPath(in Path path, ProgramId id, ProgramId ownerId);
|
||||
Result RedirectApplicationProgramPath(ref readonly Path path, ProgramId id, ProgramId ownerId);
|
||||
Result ClearApplicationRedirection(InArray<ProgramId> excludingIds);
|
||||
Result EraseProgramRedirection(ProgramId id);
|
||||
Result EraseApplicationControlRedirection(ProgramId id);
|
||||
Result EraseApplicationHtmlDocumentRedirection(ProgramId id);
|
||||
Result EraseApplicationLegalInformationRedirection(ProgramId id);
|
||||
Result ResolveProgramPathForDebug(out Path path, ProgramId id);
|
||||
Result RedirectProgramPathForDebug(in Path path, ProgramId id);
|
||||
Result RedirectApplicationProgramPathForDebug(in Path path, ProgramId id, ProgramId ownerId);
|
||||
Result RedirectProgramPathForDebug(ref readonly Path path, ProgramId id);
|
||||
Result RedirectApplicationProgramPathForDebug(ref readonly Path path, ProgramId id, ProgramId ownerId);
|
||||
Result EraseProgramRedirectionForDebug(ProgramId id);
|
||||
}
|
|
@ -6,13 +6,13 @@ namespace LibHac.Lr;
|
|||
public interface IRegisteredLocationResolver : IDisposable
|
||||
{
|
||||
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 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 RegisterHtmlDocumentPath(in Path path, ProgramId id, ProgramId ownerId);
|
||||
Result RegisterHtmlDocumentPath(ref readonly Path path, ProgramId id, ProgramId ownerId);
|
||||
Result UnregisterHtmlDocumentPath(ProgramId id);
|
||||
Result RedirectHtmlDocumentPath(in Path path, ProgramId id);
|
||||
Result RedirectHtmlDocumentPath(ref readonly Path path, ProgramId id);
|
||||
Result Refresh();
|
||||
Result RefreshExcluding(ReadOnlySpan<ProgramId> ids);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue