mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2025-02-09 13:14:46 +01:00
Rename Result rc
variables to Result res
This commit is contained in:
parent
70aac7ca7b
commit
ef71eedc05
@ -61,11 +61,11 @@ public class ArpClient : IDisposable
|
||||
return;
|
||||
|
||||
using var reader = new SharedRef<IReader>();
|
||||
Result rc = _hosClient.Sm.GetService(ref reader.Ref(), "arp:r");
|
||||
Result res = _hosClient.Sm.GetService(ref reader.Ref(), "arp:r");
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
throw new HorizonResultException(rc, "Failed to initialize arp reader.");
|
||||
throw new HorizonResultException(res, "Failed to initialize arp reader.");
|
||||
}
|
||||
|
||||
_reader.SetByMove(ref reader.Ref());
|
||||
|
@ -36,10 +36,10 @@ public class BcatServer
|
||||
|
||||
using SharedRef<IServiceCreator> service = GetServiceCreator(type);
|
||||
|
||||
Result rc = Hos.Sm.RegisterService(new BcatServiceObject(ref service.Ref()), name);
|
||||
if (rc.IsFailure())
|
||||
Result res = Hos.Sm.RegisterService(new BcatServiceObject(ref service.Ref()), name);
|
||||
if (res.IsFailure())
|
||||
{
|
||||
throw new HorizonResultException(rc, "Abort");
|
||||
throw new HorizonResultException(res, "Abort");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,11 +52,11 @@ internal class DeliveryCacheDirectoryMetaAccessor
|
||||
{
|
||||
FileSystemClient fs = Server.GetFsClient();
|
||||
|
||||
Result rc = fs.OpenFile(out FileHandle handle, path, OpenMode.Read);
|
||||
Result res = fs.OpenFile(out FileHandle handle, path, OpenMode.Read);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
if (ResultFs.PathNotFound.Includes(rc))
|
||||
if (ResultFs.PathNotFound.Includes(res))
|
||||
{
|
||||
if (allowMissingMetaFile)
|
||||
{
|
||||
@ -64,10 +64,10 @@ internal class DeliveryCacheDirectoryMetaAccessor
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
return ResultBcat.NotFound.LogConverted(rc);
|
||||
return ResultBcat.NotFound.LogConverted(res);
|
||||
}
|
||||
|
||||
return rc;
|
||||
return res;
|
||||
}
|
||||
|
||||
try
|
||||
@ -76,16 +76,16 @@ internal class DeliveryCacheDirectoryMetaAccessor
|
||||
int header = 0;
|
||||
|
||||
// Verify the header value
|
||||
rc = fs.ReadFile(out long bytesRead, handle, 0, SpanHelpers.AsByteSpan(ref header));
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = fs.ReadFile(out long bytesRead, handle, 0, SpanHelpers.AsByteSpan(ref header));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (bytesRead != sizeof(int) || header != MetaFileHeaderValue)
|
||||
return ResultBcat.InvalidDeliveryCacheStorageFile.Log();
|
||||
|
||||
// Read all the directory entries
|
||||
Span<byte> buffer = MemoryMarshal.Cast<DeliveryCacheDirectoryMetaEntry, byte>(Entries);
|
||||
rc = fs.ReadFile(out bytesRead, handle, 4, buffer);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = fs.ReadFile(out bytesRead, handle, 4, buffer);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Count = (int)((uint)bytesRead / Unsafe.SizeOf<DeliveryCacheDirectoryMetaEntry>());
|
||||
|
||||
|
@ -73,11 +73,11 @@ internal class DeliveryCacheFileMetaAccessor
|
||||
{
|
||||
FileSystemClient fs = Server.GetFsClient();
|
||||
|
||||
Result rc = fs.OpenFile(out FileHandle handle, path, OpenMode.Read);
|
||||
Result res = fs.OpenFile(out FileHandle handle, path, OpenMode.Read);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
if (ResultFs.PathNotFound.Includes(rc))
|
||||
if (ResultFs.PathNotFound.Includes(res))
|
||||
{
|
||||
if (allowMissingMetaFile)
|
||||
{
|
||||
@ -85,10 +85,10 @@ internal class DeliveryCacheFileMetaAccessor
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
return ResultBcat.NotFound.LogConverted(rc);
|
||||
return ResultBcat.NotFound.LogConverted(res);
|
||||
}
|
||||
|
||||
return rc;
|
||||
return res;
|
||||
}
|
||||
|
||||
try
|
||||
@ -97,16 +97,16 @@ internal class DeliveryCacheFileMetaAccessor
|
||||
int header = 0;
|
||||
|
||||
// Verify the header value
|
||||
rc = fs.ReadFile(out long bytesRead, handle, 0, SpanHelpers.AsByteSpan(ref header));
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = fs.ReadFile(out long bytesRead, handle, 0, SpanHelpers.AsByteSpan(ref header));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (bytesRead != sizeof(int) || header != MetaFileHeaderValue)
|
||||
return ResultBcat.InvalidDeliveryCacheStorageFile.Log();
|
||||
|
||||
// Read all the file entries
|
||||
Span<byte> buffer = MemoryMarshal.Cast<DeliveryCacheFileMetaEntry, byte>(Entries);
|
||||
rc = fs.ReadFile(out bytesRead, handle, 4, buffer);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = fs.ReadFile(out bytesRead, handle, 4, buffer);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Count = (int)((uint)bytesRead / Unsafe.SizeOf<DeliveryCacheFileMetaEntry>());
|
||||
|
||||
|
@ -35,8 +35,8 @@ internal class DeliveryCacheStorageManager
|
||||
lock (_locker)
|
||||
{
|
||||
// Find an existing storage entry for this application ID or get an empty one
|
||||
Result rc = FindOrGetUnusedEntry(out int index, applicationId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = FindOrGetUnusedEntry(out int index, applicationId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
ref Entry entry = ref Entries[index];
|
||||
|
||||
@ -55,15 +55,15 @@ internal class DeliveryCacheStorageManager
|
||||
// Mount the save if enabled
|
||||
if (!DisableStorage)
|
||||
{
|
||||
rc = Server.GetFsClient()
|
||||
res = Server.GetFsClient()
|
||||
.MountBcatSaveData(new U8Span(mountName.Name), new Ncm.ApplicationId(applicationId));
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
if (ResultFs.TargetNotFound.Includes(rc))
|
||||
return ResultBcat.SaveDataNotFound.LogConverted(rc);
|
||||
if (ResultFs.TargetNotFound.Includes(res))
|
||||
return ResultBcat.SaveDataNotFound.LogConverted(res);
|
||||
|
||||
return rc;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,11 +121,11 @@ internal class DeliveryCacheStorageManager
|
||||
|
||||
if (!DisableStorage)
|
||||
{
|
||||
Result rc = Server.GetFsClient().Commit(new U8Span(mountName.Name));
|
||||
Result res = Server.GetFsClient().Commit(new U8Span(mountName.Name));
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
throw new HorizonResultException(rc, "Abort");
|
||||
throw new HorizonResultException(res, "Abort");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -141,19 +141,19 @@ internal class DeliveryCacheStorageManager
|
||||
AppendMountName(ref sb, applicationId);
|
||||
sb.Append(RootPath);
|
||||
|
||||
Result rc;
|
||||
Result res;
|
||||
|
||||
if (DisableStorage)
|
||||
{
|
||||
size = 0x4400000;
|
||||
rc = Result.Success;
|
||||
res = Result.Success;
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = Server.GetFsClient().GetFreeSpaceSize(out size, new U8Span(path));
|
||||
res = Server.GetFsClient().GetFreeSpaceSize(out size, new U8Span(path));
|
||||
}
|
||||
|
||||
return rc;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,8 +38,8 @@ internal class DeliveryCacheDirectoryService : IDeliveryCacheDirectoryService
|
||||
return ResultBcat.AlreadyOpen.Log();
|
||||
|
||||
var metaReader = new DeliveryCacheFileMetaAccessor(Server);
|
||||
Result rc = metaReader.ReadApplicationFileMeta(ApplicationId, ref name, false);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = metaReader.ReadApplicationFileMeta(ApplicationId, ref name, false);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Count = metaReader.Count;
|
||||
_name = name;
|
||||
@ -59,18 +59,18 @@ internal class DeliveryCacheDirectoryService : IDeliveryCacheDirectoryService
|
||||
return ResultBcat.NotOpen.Log();
|
||||
|
||||
var metaReader = new DeliveryCacheFileMetaAccessor(Server);
|
||||
Result rc = metaReader.ReadApplicationFileMeta(ApplicationId, ref _name, true);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = metaReader.ReadApplicationFileMeta(ApplicationId, ref _name, true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
int i;
|
||||
for (i = 0; i < entryBuffer.Length; i++)
|
||||
{
|
||||
rc = metaReader.GetEntry(out DeliveryCacheFileMetaEntry entry, i);
|
||||
res = metaReader.GetEntry(out DeliveryCacheFileMetaEntry entry, i);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
if (!ResultBcat.NotFound.Includes(rc))
|
||||
return rc;
|
||||
if (!ResultBcat.NotFound.Includes(res))
|
||||
return res;
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -43,17 +43,17 @@ internal class DeliveryCacheFileService : IDeliveryCacheFileService
|
||||
return ResultBcat.AlreadyOpen.Log();
|
||||
|
||||
var metaReader = new DeliveryCacheFileMetaAccessor(Server);
|
||||
Result rc = metaReader.ReadApplicationFileMeta(ApplicationId, ref directoryName, true);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = metaReader.ReadApplicationFileMeta(ApplicationId, ref directoryName, true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = metaReader.FindEntry(out DeliveryCacheFileMetaEntry entry, ref fileName);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = metaReader.FindEntry(out DeliveryCacheFileMetaEntry entry, ref fileName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Span<byte> filePath = stackalloc byte[0x80];
|
||||
Server.GetStorageManager().GetFilePath(filePath, ApplicationId, ref directoryName, ref fileName);
|
||||
|
||||
rc = Server.GetFsClient().OpenFile(out _handle, new U8Span(filePath), OpenMode.Read);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = Server.GetFsClient().OpenFile(out _handle, new U8Span(filePath), OpenMode.Read);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
_metaEntry = entry;
|
||||
IsFileOpen = true;
|
||||
@ -71,8 +71,8 @@ internal class DeliveryCacheFileService : IDeliveryCacheFileService
|
||||
if (!IsFileOpen)
|
||||
return ResultBcat.NotOpen.Log();
|
||||
|
||||
Result rc = Server.GetFsClient().ReadFile(out long read, _handle, offset, destination);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = Server.GetFsClient().ReadFile(out long read, _handle, offset, destination);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
bytesRead = read;
|
||||
return Result.Success;
|
||||
|
@ -60,18 +60,18 @@ internal class DeliveryCacheStorageService : IDeliveryCacheStorageService
|
||||
lock (Locker)
|
||||
{
|
||||
var metaReader = new DeliveryCacheDirectoryMetaAccessor(Server);
|
||||
Result rc = metaReader.ReadApplicationDirectoryMeta(ApplicationId, true);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = metaReader.ReadApplicationDirectoryMeta(ApplicationId, true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
int i;
|
||||
for (i = 0; i < nameBuffer.Length; i++)
|
||||
{
|
||||
rc = metaReader.GetEntry(out DeliveryCacheDirectoryMetaEntry entry, i);
|
||||
res = metaReader.GetEntry(out DeliveryCacheDirectoryMetaEntry entry, i);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
if (!ResultBcat.NotFound.Includes(rc))
|
||||
return rc;
|
||||
if (!ResultBcat.NotFound.Includes(res))
|
||||
return res;
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -25,11 +25,11 @@ internal class ServiceCreator : IServiceCreator
|
||||
public Result CreateDeliveryCacheStorageService(ref SharedRef<IDeliveryCacheStorageService> outService,
|
||||
ulong processId)
|
||||
{
|
||||
Result rc = Server.Hos.Arp.GetApplicationLaunchProperty(out ApplicationLaunchProperty launchProperty,
|
||||
Result res = Server.Hos.Arp.GetApplicationLaunchProperty(out ApplicationLaunchProperty launchProperty,
|
||||
processId);
|
||||
|
||||
if (rc.IsFailure())
|
||||
return ResultBcat.NotFound.LogConverted(rc);
|
||||
if (res.IsFailure())
|
||||
return ResultBcat.NotFound.LogConverted(res);
|
||||
|
||||
return CreateDeliveryCacheStorageServiceImpl(ref outService, launchProperty.ApplicationId);
|
||||
}
|
||||
@ -46,8 +46,8 @@ internal class ServiceCreator : IServiceCreator
|
||||
private Result CreateDeliveryCacheStorageServiceImpl(ref SharedRef<IDeliveryCacheStorageService> outService,
|
||||
ApplicationId applicationId)
|
||||
{
|
||||
Result rc = Server.GetStorageManager().Open(applicationId.Value);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = Server.GetStorageManager().Open(applicationId.Value);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// todo: Check if network account required
|
||||
|
||||
|
@ -108,40 +108,40 @@ public class Package1
|
||||
_baseStorage.SetByCopy(in storage);
|
||||
|
||||
// Read what might be a mariko header and check if it actually is a mariko header
|
||||
Result rc = _baseStorage.Get.Read(0, SpanHelpers.AsByteSpan(ref _marikoOemHeader));
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = _baseStorage.Get.Read(0, SpanHelpers.AsByteSpan(ref _marikoOemHeader));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
IsMariko = IsMarikoImpl();
|
||||
|
||||
if (IsMariko)
|
||||
{
|
||||
rc = InitMarikoBodyStorage();
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = InitMarikoBodyStorage();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = _baseStorage.Get.GetSize(out long baseStorageSize);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = _baseStorage.Get.GetSize(out long baseStorageSize);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
_bodyStorage = new SubStorage(in _baseStorage, 0, baseStorageSize);
|
||||
rc = _bodyStorage.Read(0, SpanHelpers.AsByteSpan(ref _metaData));
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _bodyStorage.Read(0, SpanHelpers.AsByteSpan(ref _metaData));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
rc = ParseStage1();
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = ParseStage1();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = ReadPk11Header();
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = ReadPk11Header();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!IsMariko && IsModern)
|
||||
{
|
||||
rc = ReadModernEristaMac();
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = ReadModernEristaMac();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
rc = SetPk11Storage();
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = SetPk11Storage();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Make sure the PK11 section sizes add up to the expected size
|
||||
if (IsDecrypted && !VerifyPk11Sizes())
|
||||
@ -165,8 +165,8 @@ public class Package1
|
||||
return ResultLibHac.InvalidPackage1MarikoBodySize.Log();
|
||||
|
||||
// Verify the body storage size is not smaller than the size in the header
|
||||
Result rc = _baseStorage.Get.GetSize(out long totalSize);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = _baseStorage.Get.GetSize(out long totalSize);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
long bodySize = totalSize - Unsafe.SizeOf<Package1MarikoOemHeader>();
|
||||
if (bodySize < MarikoOemHeader.Size)
|
||||
@ -180,8 +180,8 @@ public class Package1
|
||||
Span<byte> metaData2 = SpanHelpers.AsByteSpan(ref metaData[1]);
|
||||
|
||||
// Read both the plaintext metadata and encrypted metadata
|
||||
rc = bodySubStorage.Read(0, MemoryMarshal.Cast<Package1MetaData, byte>(metaData));
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = bodySubStorage.Read(0, MemoryMarshal.Cast<Package1MetaData, byte>(metaData));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Set the body storage and decrypted metadata
|
||||
_metaData = metaData[0];
|
||||
@ -233,8 +233,8 @@ public class Package1
|
||||
// Read the package1ldr footer
|
||||
int footerOffset = stage1Size - Unsafe.SizeOf<Package1Stage1Footer>();
|
||||
|
||||
Result rc = _bodyStorage.Read(footerOffset, SpanHelpers.AsByteSpan(ref _stage1Footer));
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = _bodyStorage.Read(footerOffset, SpanHelpers.AsByteSpan(ref _stage1Footer));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Get the PK11 size from the field in the unencrypted stage 1 footer
|
||||
Pk11Size = _stage1Footer.Pk11Size;
|
||||
@ -259,8 +259,8 @@ public class Package1
|
||||
// Read the PK11 header from the body storage
|
||||
int pk11Offset = IsModern ? ModernStage1Size : LegacyStage1Size;
|
||||
|
||||
Result rc = _bodyStorage.Read(pk11Offset, SpanHelpers.AsByteSpan(ref _pk11Header));
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = _bodyStorage.Read(pk11Offset, SpanHelpers.AsByteSpan(ref _pk11Header));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Check if PK11 is already decrypted, creating the PK11 storage if it is
|
||||
IsDecrypted = _pk11Header.Magic == Package1Pk11Header.ExpectedMagic;
|
||||
|
@ -39,8 +39,8 @@ public class Package2StorageReader : IDisposable
|
||||
/// <returns>The <see cref="Result"/> of the operation.</returns>
|
||||
public Result Initialize(KeySet keySet, in SharedRef<IStorage> storage)
|
||||
{
|
||||
Result rc = storage.Get.Read(0, SpanHelpers.AsByteSpan(ref _header));
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = storage.Get.Read(0, SpanHelpers.AsByteSpan(ref _header));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
_key = keySet.Package2Keys[_header.Meta.GetKeyGeneration()];
|
||||
DecryptHeader(_key, ref _header.Meta, ref _header.Meta);
|
||||
@ -105,8 +105,8 @@ public class Package2StorageReader : IDisposable
|
||||
|
||||
// Ini is embedded in the kernel
|
||||
using var kernelStorage = new UniqueRef<IStorage>();
|
||||
Result rc = OpenKernel(ref kernelStorage.Ref());
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = OpenKernel(ref kernelStorage.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!IniExtract.TryGetIni1Offset(out int offset, out int size, kernelStorage.Get))
|
||||
{
|
||||
@ -124,11 +124,11 @@ public class Package2StorageReader : IDisposable
|
||||
/// <returns>The <see cref="Result"/> of the operation.</returns>
|
||||
public Result Verify()
|
||||
{
|
||||
Result rc = VerifySignature();
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = VerifySignature();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = VerifyMeta();
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = VerifyMeta();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return VerifyPayloads();
|
||||
}
|
||||
@ -143,8 +143,8 @@ public class Package2StorageReader : IDisposable
|
||||
Unsafe.SkipInit(out Package2Meta meta);
|
||||
Span<byte> metaBytes = SpanHelpers.AsByteSpan(ref meta);
|
||||
|
||||
Result rc = _storage.Get.Read(Package2Header.SignatureSize, metaBytes);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = _storage.Get.Read(Package2Header.SignatureSize, metaBytes);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return _header.VerifySignature(_keySet.Package2SigningKeyParams.Modulus, metaBytes);
|
||||
}
|
||||
@ -188,8 +188,8 @@ public class Package2StorageReader : IDisposable
|
||||
int toRead = Math.Min(array.Length, size);
|
||||
Span<byte> span = array.AsSpan(0, toRead);
|
||||
|
||||
Result rc = payloadSubStorage.Read(offset, span);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = payloadSubStorage.Read(offset, span);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
sha.Update(span);
|
||||
|
||||
@ -243,8 +243,8 @@ public class Package2StorageReader : IDisposable
|
||||
continue;
|
||||
|
||||
using var payloadStorage = new UniqueRef<IStorage>();
|
||||
Result rc = OpenPayload(ref payloadStorage.Ref(), i);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = OpenPayload(ref payloadStorage.Ref(), i);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
storages.Add(payloadStorage.Release());
|
||||
}
|
||||
|
@ -66,9 +66,9 @@ namespace LibHac.Fs
|
||||
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.GetGlobalAccessLogMode(out mode);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
Result res = fileSystemProxy.Get.GetGlobalAccessLogMode(out mode);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Result SetGlobalAccessLogMode(this FileSystemClient fs, GlobalAccessLogMode mode)
|
||||
@ -82,9 +82,9 @@ namespace LibHac.Fs
|
||||
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.SetGlobalAccessLogMode(mode);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
Result res = fileSystemProxy.Get.SetGlobalAccessLogMode(mode);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static void SetLocalAccessLog(this FileSystemClient fs, bool enabled)
|
||||
@ -503,8 +503,8 @@ namespace LibHac.Fs.Impl
|
||||
private static void GetProgramIndexForAccessLog(FileSystemClientImpl fs, out int index, out int count)
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.GetFileSystemProxyServiceObject();
|
||||
Result rc = fileSystemProxy.Get.GetProgramIndexForAccessLog(out index, out count);
|
||||
Abort.DoAbortUnless(rc.IsSuccess());
|
||||
Result res = fileSystemProxy.Get.GetProgramIndexForAccessLog(out index, out count);
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
}
|
||||
|
||||
private static void OutputAccessLogStart(FileSystemClientImpl fs)
|
||||
@ -713,9 +713,9 @@ namespace LibHac.Fs.Impl
|
||||
}
|
||||
else
|
||||
{
|
||||
Result rc = fs.Fs.GetGlobalAccessLogMode(out g.GlobalAccessLogMode);
|
||||
fs.LogResultErrorMessage(rc);
|
||||
if (rc.IsFailure()) Abort.DoAbort(rc);
|
||||
Result res = fs.Fs.GetGlobalAccessLogMode(out g.GlobalAccessLogMode);
|
||||
fs.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) Abort.DoAbort(res);
|
||||
|
||||
if (g.GlobalAccessLogMode != GlobalAccessLogMode.None)
|
||||
{
|
||||
@ -771,9 +771,9 @@ namespace LibHac.Fs.Impl
|
||||
|
||||
internal static bool IsEnabledFileSystemAccessorAccessLog(this FileSystemClientImpl fs, U8Span mountName)
|
||||
{
|
||||
Result rc = fs.Find(out FileSystemAccessor accessor, mountName);
|
||||
Result res = fs.Find(out FileSystemAccessor accessor, mountName);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
return true;
|
||||
|
||||
return accessor.IsEnabledAccessLog();
|
||||
@ -781,9 +781,9 @@ namespace LibHac.Fs.Impl
|
||||
|
||||
public static void EnableFileSystemAccessorAccessLog(this FileSystemClientImpl fs, U8Span mountName)
|
||||
{
|
||||
Result rc = fs.Find(out FileSystemAccessor fileSystem, mountName);
|
||||
fs.LogResultErrorMessage(rc);
|
||||
Abort.DoAbortUnless(rc.IsSuccess());
|
||||
Result res = fs.Find(out FileSystemAccessor fileSystem, mountName);
|
||||
fs.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
|
||||
fileSystem.SetAccessLog(true);
|
||||
}
|
||||
|
@ -38,11 +38,11 @@ public static class ApplicationSaveDataManagement
|
||||
// ReSharper disable HeuristicUnreachableCode
|
||||
|
||||
// Get the current save data size
|
||||
Result rc = fs.Impl.GetSaveDataAvailableSize(out long availableSize, spaceId, saveDataId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fs.Impl.GetSaveDataAvailableSize(out long availableSize, spaceId, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = fs.Impl.GetSaveDataJournalSize(out long journalSize, spaceId, saveDataId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fs.Impl.GetSaveDataJournalSize(out long journalSize, spaceId, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Check if the save data needs to be extended
|
||||
if (availableSize < saveDataSize || journalSize < saveDataJournalSize)
|
||||
@ -57,18 +57,18 @@ public static class ApplicationSaveDataManagement
|
||||
long newSaveDataSize = Math.Max(saveDataSize, availableSize);
|
||||
long newSaveDataJournalSize = Math.Max(saveDataJournalSize, journalSize);
|
||||
|
||||
rc = fs.Impl.ExtendSaveData(spaceId, saveDataId, newSaveDataSize, newSaveDataJournalSize);
|
||||
res = fs.Impl.ExtendSaveData(spaceId, saveDataId, newSaveDataSize, newSaveDataJournalSize);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
if (ResultFs.UsableSpaceNotEnough.Includes(rc))
|
||||
if (ResultFs.UsableSpaceNotEnough.Includes(res))
|
||||
{
|
||||
// Calculate how much space we need to extend the save data
|
||||
rc = fs.QuerySaveDataTotalSize(out long currentSaveDataTotalSize, availableSize, journalSize);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fs.QuerySaveDataTotalSize(out long currentSaveDataTotalSize, availableSize, journalSize);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = fs.QuerySaveDataTotalSize(out long newSaveDataTotalSize, newSaveDataSize, newSaveDataJournalSize);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fs.QuerySaveDataTotalSize(out long newSaveDataTotalSize, newSaveDataSize, newSaveDataJournalSize);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
long newSaveDataSizeDifference = RoundUpOccupationSize(newSaveDataTotalSize) -
|
||||
RoundUpOccupationSize(currentSaveDataTotalSize);
|
||||
@ -80,7 +80,7 @@ public static class ApplicationSaveDataManagement
|
||||
return ResultFs.UsableSpaceNotEnough.Log();
|
||||
}
|
||||
|
||||
return rc.Miss();
|
||||
return res.Miss();
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,21 +92,21 @@ public static class ApplicationSaveDataManagement
|
||||
private static Result CreateSaveData(FileSystemClient fs, ref long inOutRequiredSize, Func<Result> createFunc,
|
||||
long saveDataSize, long saveDataJournalSize, long saveDataBaseSize)
|
||||
{
|
||||
Result rc = createFunc();
|
||||
Result res = createFunc();
|
||||
|
||||
if (rc.IsSuccess())
|
||||
if (res.IsSuccess())
|
||||
return Result.Success;
|
||||
|
||||
if (ResultFs.UsableSpaceNotEnough.Includes(rc))
|
||||
if (ResultFs.UsableSpaceNotEnough.Includes(res))
|
||||
{
|
||||
rc = fs.QuerySaveDataTotalSize(out long saveDataTotalSize, saveDataSize, saveDataJournalSize);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = fs.QuerySaveDataTotalSize(out long saveDataTotalSize, saveDataSize, saveDataJournalSize);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
inOutRequiredSize += RoundUpOccupationSize(saveDataTotalSize) + saveDataBaseSize;
|
||||
}
|
||||
else if (!ResultFs.PathAlreadyExists.Includes(rc))
|
||||
else if (!ResultFs.PathAlreadyExists.Includes(res))
|
||||
{
|
||||
return rc.Miss();
|
||||
return res.Miss();
|
||||
}
|
||||
|
||||
return Result.Success;
|
||||
@ -116,30 +116,30 @@ public static class ApplicationSaveDataManagement
|
||||
in SaveDataFilter filter, Func<Result> createFunc, long saveDataSize, long saveDataJournalSize,
|
||||
long saveDataBaseSize)
|
||||
{
|
||||
Result rc = fs.FindSaveDataWithFilter(out SaveDataInfo info, SaveDataSpaceId.User, in filter);
|
||||
Result res = fs.FindSaveDataWithFilter(out SaveDataInfo info, SaveDataSpaceId.User, in filter);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
if (ResultFs.TargetNotFound.Includes(rc))
|
||||
if (ResultFs.TargetNotFound.Includes(res))
|
||||
{
|
||||
rc = CreateSaveData(fs, ref inOutRequiredSize, createFunc, saveDataSize, saveDataJournalSize,
|
||||
res = CreateSaveData(fs, ref inOutRequiredSize, createFunc, saveDataSize, saveDataJournalSize,
|
||||
saveDataBaseSize);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
return rc.Miss();
|
||||
return res.Miss();
|
||||
}
|
||||
|
||||
long requiredSize = 0;
|
||||
rc = ExtendSaveDataIfNeeded(fs, ref requiredSize, SaveDataSpaceId.User, info.SaveDataId, saveDataSize,
|
||||
res = ExtendSaveDataIfNeeded(fs, ref requiredSize, SaveDataSpaceId.User, info.SaveDataId, saveDataSize,
|
||||
saveDataJournalSize);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
if (!ResultFs.UsableSpaceNotEnough.Includes(rc))
|
||||
return rc.Miss();
|
||||
if (!ResultFs.UsableSpaceNotEnough.Includes(res))
|
||||
return res.Miss();
|
||||
|
||||
inOutRequiredSize += requiredSize;
|
||||
}
|
||||
@ -210,15 +210,15 @@ public static class ApplicationSaveDataManagement
|
||||
|
||||
if (bcatDeliveryCacheStorageSize > 0)
|
||||
{
|
||||
Result rc = SaveDataFilter.Make(out SaveDataFilter filter, programId: default, SaveDataType.Bcat,
|
||||
Result res = SaveDataFilter.Make(out SaveDataFilter filter, programId: default, SaveDataType.Bcat,
|
||||
userId: default, saveDataId: default, index: default);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Result CreateBcatStorageFunc() => fs.CreateBcatSaveData(applicationId, bcatDeliveryCacheStorageSize);
|
||||
|
||||
rc = EnsureAndExtendSaveData(fs, ref requiredSize, in filter, CreateBcatStorageFunc,
|
||||
res = EnsureAndExtendSaveData(fs, ref requiredSize, in filter, CreateBcatStorageFunc,
|
||||
bcatDeliveryCacheStorageSize, bcatDeliveryCacheJournalSize, 0x4000);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
if (requiredSize == 0)
|
||||
@ -235,12 +235,12 @@ public static class ApplicationSaveDataManagement
|
||||
Ncm.ApplicationId applicationId)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out targetMedia);
|
||||
Result rc;
|
||||
Result res;
|
||||
|
||||
if (fs.IsSdCardAccessible())
|
||||
{
|
||||
rc = DoesCacheStorageExist(out bool existsOnSd, SaveDataSpaceId.SdUser, fs, applicationId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = DoesCacheStorageExist(out bool existsOnSd, SaveDataSpaceId.SdUser, fs, applicationId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (existsOnSd)
|
||||
{
|
||||
@ -249,8 +249,8 @@ public static class ApplicationSaveDataManagement
|
||||
}
|
||||
}
|
||||
|
||||
rc = DoesCacheStorageExist(out bool existsOnNand, SaveDataSpaceId.User, fs, applicationId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = DoesCacheStorageExist(out bool existsOnNand, SaveDataSpaceId.User, fs, applicationId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
targetMedia = existsOnNand ? CacheStorageTargetMedia.Nand : CacheStorageTargetMedia.None;
|
||||
return Result.Success;
|
||||
@ -262,16 +262,16 @@ public static class ApplicationSaveDataManagement
|
||||
|
||||
bool doesStorageExist = true;
|
||||
|
||||
Result rc = SaveDataFilter.Make(out SaveDataFilter filter, applicationId.Value, SaveDataType.Cache,
|
||||
Result res = SaveDataFilter.Make(out SaveDataFilter filter, applicationId.Value, SaveDataType.Cache,
|
||||
userId: default, saveDataId: default, index: default);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = fs.Impl.FindSaveDataWithFilter(out SaveDataInfo _, spaceId, in filter);
|
||||
res = fs.Impl.FindSaveDataWithFilter(out SaveDataInfo _, spaceId, in filter);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
if (!ResultFs.TargetNotFound.Includes(rc))
|
||||
return rc.Miss();
|
||||
if (!ResultFs.TargetNotFound.Includes(res))
|
||||
return res.Miss();
|
||||
|
||||
doesStorageExist = false;
|
||||
}
|
||||
@ -287,26 +287,26 @@ public static class ApplicationSaveDataManagement
|
||||
{
|
||||
long requiredSize = 0;
|
||||
|
||||
Result rc = SaveDataFilter.Make(out SaveDataFilter filter, applicationId.Value, SaveDataType.Cache,
|
||||
Result res = SaveDataFilter.Make(out SaveDataFilter filter, applicationId.Value, SaveDataType.Cache,
|
||||
userId: default, saveDataId: default, index);
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Check if the cache storage already exists or not.
|
||||
bool doesStorageExist = true;
|
||||
rc = fs.Impl.FindSaveDataWithFilter(out SaveDataInfo info, spaceId, in filter);
|
||||
res = fs.Impl.FindSaveDataWithFilter(out SaveDataInfo info, spaceId, in filter);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
if (ResultFs.TargetNotFound.Includes(rc))
|
||||
if (ResultFs.TargetNotFound.Includes(res))
|
||||
{
|
||||
doesStorageExist = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res.Miss();
|
||||
}
|
||||
}
|
||||
|
||||
@ -315,32 +315,32 @@ public static class ApplicationSaveDataManagement
|
||||
// The cache storage already exists. Ensure it's large enough.
|
||||
if (!allowExisting)
|
||||
{
|
||||
rc = ResultFs.AlreadyExists.Value;
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc.Miss();
|
||||
res = ResultFs.AlreadyExists.Value;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res.Miss();
|
||||
}
|
||||
|
||||
rc = ExtendSaveDataIfNeeded(fs, ref requiredSize, spaceId, info.SaveDataId, cacheStorageSize,
|
||||
res = ExtendSaveDataIfNeeded(fs, ref requiredSize, spaceId, info.SaveDataId, cacheStorageSize,
|
||||
cacheStorageJournalSize);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
if (ResultFs.UsableSpaceNotEnough.Includes(rc))
|
||||
if (ResultFs.UsableSpaceNotEnough.Includes(res))
|
||||
{
|
||||
// Don't return this error. If there's not enough space we return Success along with
|
||||
// The amount of space required to create the cache storage.
|
||||
}
|
||||
else if (ResultFs.SaveDataExtending.Includes(rc))
|
||||
else if (ResultFs.SaveDataExtending.Includes(res))
|
||||
{
|
||||
rc = ResultFs.SaveDataCorrupted.LogConverted(rc);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc.Miss();
|
||||
res = ResultFs.SaveDataCorrupted.LogConverted(res);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res.Miss();
|
||||
}
|
||||
else
|
||||
{
|
||||
rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
res.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -350,11 +350,11 @@ public static class ApplicationSaveDataManagement
|
||||
Result CreateCacheFunc() => fs.CreateCacheStorage(applicationId, spaceId, saveDataOwnerId, index,
|
||||
cacheStorageSize, cacheStorageJournalSize, SaveDataFlags.None);
|
||||
|
||||
rc = CreateSaveData(fs, ref requiredSize, CreateCacheFunc, cacheStorageSize, cacheStorageJournalSize,
|
||||
res = CreateSaveData(fs, ref requiredSize, CreateCacheFunc, cacheStorageSize, cacheStorageJournalSize,
|
||||
0x4000);
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
outRequiredSize = requiredSize;
|
||||
@ -369,26 +369,26 @@ public static class ApplicationSaveDataManagement
|
||||
long requiredSize = 0;
|
||||
|
||||
// Check if the cache storage already exists
|
||||
Result rc = GetCacheStorageTargetMediaImpl(fs, out CacheStorageTargetMedia media, applicationId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = GetCacheStorageTargetMediaImpl(fs, out CacheStorageTargetMedia media, applicationId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (media == CacheStorageTargetMedia.SdCard)
|
||||
{
|
||||
// If it exists on the SD card, ensure it's large enough.
|
||||
targetMedia = CacheStorageTargetMedia.SdCard;
|
||||
|
||||
rc = TryCreateCacheStorage(fs, ref requiredSize, SaveDataSpaceId.SdUser, applicationId, saveDataOwnerId,
|
||||
res = TryCreateCacheStorage(fs, ref requiredSize, SaveDataSpaceId.SdUser, applicationId, saveDataOwnerId,
|
||||
index, cacheStorageSize, cacheStorageJournalSize, allowExisting);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else if (media == CacheStorageTargetMedia.Nand)
|
||||
{
|
||||
// If it exists on the BIS, ensure it's large enough.
|
||||
targetMedia = CacheStorageTargetMedia.Nand;
|
||||
|
||||
rc = TryCreateCacheStorage(fs, ref requiredSize, SaveDataSpaceId.User, applicationId, saveDataOwnerId,
|
||||
res = TryCreateCacheStorage(fs, ref requiredSize, SaveDataSpaceId.User, applicationId, saveDataOwnerId,
|
||||
index, cacheStorageSize, cacheStorageJournalSize, allowExisting);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -401,9 +401,9 @@ public static class ApplicationSaveDataManagement
|
||||
Result CreateStorageOnSdCard() => fs.CreateCacheStorage(applicationId, SaveDataSpaceId.SdUser,
|
||||
saveDataOwnerId, index, cacheStorageSize, cacheStorageJournalSize, SaveDataFlags.None);
|
||||
|
||||
rc = CreateSaveData(fs, ref requiredSize, CreateStorageOnSdCard, cacheStorageSize, cacheStorageJournalSize,
|
||||
res = CreateSaveData(fs, ref requiredSize, CreateStorageOnSdCard, cacheStorageSize, cacheStorageJournalSize,
|
||||
0x4000);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Don't use the SD card if it doesn't have enough space.
|
||||
if (requiredSize != 0)
|
||||
@ -419,9 +419,9 @@ public static class ApplicationSaveDataManagement
|
||||
Result CreateStorageOnNand() => fs.CreateCacheStorage(applicationId, SaveDataSpaceId.User, saveDataOwnerId,
|
||||
index, cacheStorageSize, cacheStorageSize, SaveDataFlags.None);
|
||||
|
||||
rc = CreateSaveData(fs, ref requiredSize, CreateStorageOnNand, cacheStorageSize, cacheStorageJournalSize,
|
||||
res = CreateSaveData(fs, ref requiredSize, CreateStorageOnNand, cacheStorageSize, cacheStorageJournalSize,
|
||||
0x4000);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (requiredSize != 0)
|
||||
targetMedia = CacheStorageTargetMedia.None;
|
||||
@ -443,18 +443,18 @@ public static class ApplicationSaveDataManagement
|
||||
|
||||
long requiredSize = 0;
|
||||
|
||||
Result rc = SaveDataFilter.Make(out SaveDataFilter filter, applicationId.Value, SaveDataType.Device,
|
||||
Result res = SaveDataFilter.Make(out SaveDataFilter filter, applicationId.Value, SaveDataType.Device,
|
||||
userId: default, saveDataId: default, index: default);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
const SaveDataFlags flags = SaveDataFlags.None;
|
||||
|
||||
Result CreateSave() =>
|
||||
fs.CreateDeviceSaveData(applicationId, applicationId.Value, saveDataSize, saveDataJournalSize, flags);
|
||||
|
||||
rc = EnsureAndExtendSaveData(fs.Fs, ref requiredSize, in filter, CreateSave, saveDataSize, saveDataJournalSize,
|
||||
res = EnsureAndExtendSaveData(fs.Fs, ref requiredSize, in filter, CreateSave, saveDataSize, saveDataJournalSize,
|
||||
0x4000);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outRequiredSize = requiredSize;
|
||||
return Result.Success;
|
||||
@ -463,9 +463,9 @@ public static class ApplicationSaveDataManagement
|
||||
public static Result GetCacheStorageTargetMedia(this FileSystemClient fs, out CacheStorageTargetMedia targetMedia,
|
||||
Ncm.ApplicationId applicationId)
|
||||
{
|
||||
Result rc = GetCacheStorageTargetMediaImpl(fs, out targetMedia, applicationId);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = GetCacheStorageTargetMediaImpl(fs, out targetMedia, applicationId);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -476,11 +476,11 @@ public static class ApplicationSaveDataManagement
|
||||
{
|
||||
outRequiredSize = 0;
|
||||
|
||||
Result rc = EnsureApplicationCacheStorageImpl(fs, ref outRequiredSize, out targetMedia, applicationId,
|
||||
Result res = EnsureApplicationCacheStorageImpl(fs, ref outRequiredSize, out targetMedia, applicationId,
|
||||
saveDataOwnerId, index, cacheStorageSize, cacheStorageJournalSize, allowExisting);
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -490,12 +490,12 @@ public static class ApplicationSaveDataManagement
|
||||
{
|
||||
outRequiredSize = 0;
|
||||
|
||||
Result rc = EnsureApplicationCacheStorageImpl(fs, ref outRequiredSize, out _, applicationId,
|
||||
Result res = EnsureApplicationCacheStorageImpl(fs, ref outRequiredSize, out _, applicationId,
|
||||
controlProperty.SaveDataOwnerId, index: 0, controlProperty.CacheStorageSize,
|
||||
controlProperty.CacheStorageJournalSize, true);
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -509,12 +509,12 @@ public static class ApplicationSaveDataManagement
|
||||
|
||||
if (controlProperty.CacheStorageSize > 0)
|
||||
{
|
||||
Result rc = EnsureApplicationCacheStorageImpl(fs, ref outRequiredSize, out targetMedia, applicationId,
|
||||
Result res = EnsureApplicationCacheStorageImpl(fs, ref outRequiredSize, out targetMedia, applicationId,
|
||||
controlProperty.SaveDataOwnerId, index: 0, controlProperty.CacheStorageSize,
|
||||
controlProperty.CacheStorageJournalSize, true);
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
return Result.Success;
|
||||
@ -527,27 +527,27 @@ public static class ApplicationSaveDataManagement
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outRequiredSize, out targetMedia);
|
||||
|
||||
Result rc;
|
||||
Result res;
|
||||
|
||||
if (index > controlProperty.CacheStorageIndexMax)
|
||||
{
|
||||
rc = ResultFs.CacheStorageIndexTooLarge.Value;
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc.Miss();
|
||||
res = ResultFs.CacheStorageIndexTooLarge.Value;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res.Miss();
|
||||
}
|
||||
|
||||
if (cacheStorageSize + cacheStorageJournalSize > controlProperty.CacheStorageDataAndJournalSizeMax)
|
||||
{
|
||||
rc = ResultFs.CacheStorageSizeTooLarge.Value;
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc.Miss();
|
||||
res = ResultFs.CacheStorageSizeTooLarge.Value;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res.Miss();
|
||||
}
|
||||
|
||||
rc = EnsureApplicationCacheStorageImpl(fs, ref outRequiredSize, out targetMedia, applicationId,
|
||||
res = EnsureApplicationCacheStorageImpl(fs, ref outRequiredSize, out targetMedia, applicationId,
|
||||
controlProperty.SaveDataOwnerId, index, cacheStorageSize, cacheStorageJournalSize, false);
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -556,31 +556,31 @@ public static class ApplicationSaveDataManagement
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Result rc = SaveDataFilter.Make(out SaveDataFilter filter, programId: default, SaveDataType.Temporary,
|
||||
Result res = SaveDataFilter.Make(out SaveDataFilter filter, programId: default, SaveDataType.Temporary,
|
||||
userId: default, saveDataId: default, index: default);
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Try to find any temporary save data.
|
||||
rc = fs.Impl.FindSaveDataWithFilter(out SaveDataInfo info, SaveDataSpaceId.Temporary, in filter);
|
||||
res = fs.Impl.FindSaveDataWithFilter(out SaveDataInfo info, SaveDataSpaceId.Temporary, in filter);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
if (ResultFs.TargetNotFound.Includes(rc))
|
||||
if (ResultFs.TargetNotFound.Includes(res))
|
||||
{
|
||||
// No more save data found. We're done cleaning.
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res.Miss();
|
||||
}
|
||||
|
||||
// Delete the found save data.
|
||||
rc = fs.Impl.DeleteSaveData(SaveDataSpaceId.Temporary, info.SaveDataId);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fs.Impl.DeleteSaveData(SaveDataSpaceId.Temporary, info.SaveDataId);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
}
|
||||
|
||||
@ -589,11 +589,11 @@ public static class ApplicationSaveDataManagement
|
||||
{
|
||||
outRequiredSize = 0;
|
||||
|
||||
Result rc = EnsureApplicationBcatDeliveryCacheStorageImpl(fs, ref outRequiredSize, applicationId,
|
||||
Result res = EnsureApplicationBcatDeliveryCacheStorageImpl(fs, ref outRequiredSize, applicationId,
|
||||
in controlProperty);
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -604,9 +604,9 @@ public static class ApplicationSaveDataManagement
|
||||
UnsafeHelpers.SkipParamInit(out outRequiredSize);
|
||||
|
||||
using var prohibiter = new UniqueRef<SaveDataTransferProhibiterForCloudBackUp>();
|
||||
Result rc = fs.Impl.OpenSaveDataTransferProhibiterForCloudBackUp(ref prohibiter.Ref(), applicationId);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fs.Impl.OpenSaveDataTransferProhibiterForCloudBackUp(ref prohibiter.Ref(), applicationId);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
long requiredSize = 0;
|
||||
|
||||
@ -629,20 +629,20 @@ public static class ApplicationSaveDataManagement
|
||||
}
|
||||
|
||||
UserId userId = Unsafe.As<Uid, UserId>(ref Unsafe.AsRef(in user));
|
||||
rc = SaveDataFilter.Make(out SaveDataFilter filter, applicationId.Value, SaveDataType.Account, userId,
|
||||
res = SaveDataFilter.Make(out SaveDataFilter filter, applicationId.Value, SaveDataType.Account, userId,
|
||||
saveDataId: default, index: default);
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
long baseSize = RoundUpOccupationSize(new SaveDataMetaPolicy(SaveDataType.Account).GetSaveDataMetaSize()) +
|
||||
0x8000;
|
||||
|
||||
rc = EnsureAndExtendSaveData(fs, ref requiredSize, in filter, CreateAccountSaveFunc, accountSaveDataSize,
|
||||
res = EnsureAndExtendSaveData(fs, ref requiredSize, in filter, CreateAccountSaveFunc, accountSaveDataSize,
|
||||
accountSaveJournalSize, baseSize);
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
// Ensure the device save exists
|
||||
@ -651,35 +651,35 @@ public static class ApplicationSaveDataManagement
|
||||
Result CreateDeviceSaveFunc() => fs.Impl.CreateDeviceSaveData(applicationId, saveDataOwnerId,
|
||||
deviceSaveDataSize, deviceSaveJournalSize, SaveDataFlags.None);
|
||||
|
||||
rc = SaveDataFilter.Make(out SaveDataFilter filter, applicationId.Value, SaveDataType.Device,
|
||||
res = SaveDataFilter.Make(out SaveDataFilter filter, applicationId.Value, SaveDataType.Device,
|
||||
userId: default, saveDataId: default, index: default);
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
long baseSize = RoundUpOccupationSize(new SaveDataMetaPolicy(SaveDataType.Device).GetSaveDataMetaSize()) +
|
||||
0x8000;
|
||||
|
||||
long requiredSizeForDeviceSaveData = 0;
|
||||
rc = EnsureAndExtendSaveData(fs, ref requiredSizeForDeviceSaveData, in filter, CreateDeviceSaveFunc,
|
||||
res = EnsureAndExtendSaveData(fs, ref requiredSizeForDeviceSaveData, in filter, CreateDeviceSaveFunc,
|
||||
deviceSaveDataSize, deviceSaveJournalSize, baseSize);
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (requiredSizeForDeviceSaveData == 0)
|
||||
{
|
||||
rc = fs.Impl.CreateDeviceSaveData(applicationId, saveDataOwnerId, deviceSaveDataSize,
|
||||
res = fs.Impl.CreateDeviceSaveData(applicationId, saveDataOwnerId, deviceSaveDataSize,
|
||||
deviceSaveJournalSize, SaveDataFlags.None);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
if (ResultFs.PathAlreadyExists.Includes(rc))
|
||||
if (ResultFs.PathAlreadyExists.Includes(res))
|
||||
{
|
||||
// Nothing to do if the save already exists.
|
||||
rc.Catch().Handle();
|
||||
res.Catch().Handle();
|
||||
}
|
||||
else if (ResultFs.UsableSpaceNotEnough.Includes(rc))
|
||||
else if (ResultFs.UsableSpaceNotEnough.Includes(res))
|
||||
{
|
||||
requiredSizeForDeviceSaveData +=
|
||||
RoundUpOccupationSize(new SaveDataMetaPolicy(SaveDataType.Device).GetSaveDataMetaSize()) +
|
||||
@ -687,8 +687,8 @@ public static class ApplicationSaveDataManagement
|
||||
}
|
||||
else
|
||||
{
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res.Miss();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -697,19 +697,19 @@ public static class ApplicationSaveDataManagement
|
||||
}
|
||||
|
||||
long requiredSizeForBcat = 0;
|
||||
rc = EnsureApplicationBcatDeliveryCacheStorageImpl(fs, ref requiredSizeForBcat, applicationId,
|
||||
res = EnsureApplicationBcatDeliveryCacheStorageImpl(fs, ref requiredSizeForBcat, applicationId,
|
||||
in controlProperty);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
if (ResultFs.UsableSpaceNotEnough.Includes(rc))
|
||||
if (ResultFs.UsableSpaceNotEnough.Includes(res))
|
||||
{
|
||||
requiredSize += requiredSizeForBcat;
|
||||
}
|
||||
else
|
||||
{
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res.Miss();
|
||||
}
|
||||
}
|
||||
|
||||
@ -720,9 +720,9 @@ public static class ApplicationSaveDataManagement
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out requiredSize);
|
||||
|
||||
Result rc = fs.Impl.QuerySaveDataTotalSize(out long saveDataTotalSize,
|
||||
Result res = fs.Impl.QuerySaveDataTotalSize(out long saveDataTotalSize,
|
||||
controlProperty.TemporaryStorageSize, saveDataJournalSize: 0);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
requiredSize = RoundUpOccupationSize(saveDataTotalSize) + 0x4000;
|
||||
return Result.Success;
|
||||
@ -730,30 +730,30 @@ public static class ApplicationSaveDataManagement
|
||||
|
||||
if (requiredSize == 0)
|
||||
{
|
||||
rc = fs.Impl.CreateTemporaryStorage(applicationId, saveDataOwnerId,
|
||||
res = fs.Impl.CreateTemporaryStorage(applicationId, saveDataOwnerId,
|
||||
controlProperty.TemporaryStorageSize, SaveDataFlags.None);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
if (ResultFs.UsableSpaceNotEnough.Includes(rc))
|
||||
if (ResultFs.UsableSpaceNotEnough.Includes(res))
|
||||
{
|
||||
rc = CalculateRequiredSizeForTemporaryStorage(fs, out long temporaryStorageSize,
|
||||
res = CalculateRequiredSizeForTemporaryStorage(fs, out long temporaryStorageSize,
|
||||
in controlProperty);
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
requiredSize += temporaryStorageSize;
|
||||
}
|
||||
else if (ResultFs.PathAlreadyExists.Includes(rc))
|
||||
else if (ResultFs.PathAlreadyExists.Includes(res))
|
||||
{
|
||||
// Nothing to do if the save already exists.
|
||||
rc.Catch().Handle();
|
||||
res.Catch().Handle();
|
||||
}
|
||||
else
|
||||
{
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res.Miss();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -761,32 +761,32 @@ public static class ApplicationSaveDataManagement
|
||||
{
|
||||
// If there was already insufficient space to create the previous saves, check if the temp
|
||||
// save already exists instead of trying to create a new one.
|
||||
rc = SaveDataFilter.Make(out SaveDataFilter filter, applicationId.Value, SaveDataType.Temporary,
|
||||
res = SaveDataFilter.Make(out SaveDataFilter filter, applicationId.Value, SaveDataType.Temporary,
|
||||
userId: default, saveDataId: default, index: default);
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Check if the temporary save exists
|
||||
rc = fs.Impl.FindSaveDataWithFilter(out SaveDataInfo _, SaveDataSpaceId.Temporary, in filter);
|
||||
res = fs.Impl.FindSaveDataWithFilter(out SaveDataInfo _, SaveDataSpaceId.Temporary, in filter);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
if (ResultFs.TargetNotFound.Includes(rc))
|
||||
if (ResultFs.TargetNotFound.Includes(res))
|
||||
{
|
||||
// If it doesn't exist, calculate the size required to create it
|
||||
rc = CalculateRequiredSizeForTemporaryStorage(fs, out long temporaryStorageSize,
|
||||
res = CalculateRequiredSizeForTemporaryStorage(fs, out long temporaryStorageSize,
|
||||
in controlProperty);
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
requiredSize += temporaryStorageSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res.Miss();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -800,9 +800,9 @@ public static class ApplicationSaveDataManagement
|
||||
|
||||
outRequiredSize = requiredSize;
|
||||
|
||||
rc = ResultFs.UsableSpaceNotEnough.Log();
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
res = ResultFs.UsableSpaceNotEnough.Log();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Result ExtendApplicationSaveData(this FileSystemClient fs, out long outRequiredSize,
|
||||
@ -811,40 +811,40 @@ public static class ApplicationSaveDataManagement
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outRequiredSize);
|
||||
|
||||
Result rc = CheckSaveDataType(type, in user);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = CheckSaveDataType(type, in user);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
UserId userId = Unsafe.As<Uid, UserId>(ref Unsafe.AsRef(in user));
|
||||
rc = SaveDataFilter.Make(out SaveDataFilter filter, applicationId.Value, type, userId, saveDataId: default,
|
||||
res = SaveDataFilter.Make(out SaveDataFilter filter, applicationId.Value, type, userId, saveDataId: default,
|
||||
index: default);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = fs.Impl.FindSaveDataWithFilter(out SaveDataInfo info, SaveDataSpaceId.User, in filter);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fs.Impl.FindSaveDataWithFilter(out SaveDataInfo info, SaveDataSpaceId.User, in filter);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = CheckExtensionSizeUnderMax(type, in controlProperty, saveDataSize, saveDataJournalSize);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = CheckExtensionSizeUnderMax(type, in controlProperty, saveDataSize, saveDataJournalSize);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
long requiredSize = 0;
|
||||
rc = ExtendSaveDataIfNeeded(fs, ref requiredSize, SaveDataSpaceId.User, info.SaveDataId, saveDataSize,
|
||||
res = ExtendSaveDataIfNeeded(fs, ref requiredSize, SaveDataSpaceId.User, info.SaveDataId, saveDataSize,
|
||||
saveDataJournalSize);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
if (ResultFs.UsableSpaceNotEnough.Includes(rc))
|
||||
if (ResultFs.UsableSpaceNotEnough.Includes(res))
|
||||
{
|
||||
outRequiredSize = requiredSize;
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc.Rethrow();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res.Rethrow();
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res.Miss();
|
||||
}
|
||||
|
||||
return Result.Success;
|
||||
@ -855,27 +855,27 @@ public static class ApplicationSaveDataManagement
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outSaveDataSize, out outSaveDataJournalSize);
|
||||
|
||||
Result rc = CheckSaveDataType(type, in user);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = CheckSaveDataType(type, in user);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
UserId userId = Unsafe.As<Uid, UserId>(ref Unsafe.AsRef(in user));
|
||||
rc = SaveDataFilter.Make(out SaveDataFilter filter, applicationId.Value, type, userId, saveDataId: default,
|
||||
res = SaveDataFilter.Make(out SaveDataFilter filter, applicationId.Value, type, userId, saveDataId: default,
|
||||
index: default);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = fs.Impl.FindSaveDataWithFilter(out SaveDataInfo info, SaveDataSpaceId.User, in filter);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fs.Impl.FindSaveDataWithFilter(out SaveDataInfo info, SaveDataSpaceId.User, in filter);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = fs.Impl.GetSaveDataAvailableSize(out long saveDataSize, info.SaveDataId);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fs.Impl.GetSaveDataAvailableSize(out long saveDataSize, info.SaveDataId);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = fs.Impl.GetSaveDataJournalSize(out long saveDataJournalSize, info.SaveDataId);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fs.Impl.GetSaveDataJournalSize(out long saveDataJournalSize, info.SaveDataId);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outSaveDataSize = saveDataSize;
|
||||
outSaveDataJournalSize = saveDataJournalSize;
|
||||
|
@ -49,8 +49,8 @@ public ref struct DirectoryPathParser
|
||||
|
||||
if (windowsSkipLength != 0)
|
||||
{
|
||||
Result rc = CurrentPath.InitializeWithNormalization(pathBuffer, windowsSkipLength + 1);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = CurrentPath.InitializeWithNormalization(pathBuffer, windowsSkipLength + 1);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
_buffer = _buffer.Slice(1);
|
||||
}
|
||||
@ -60,8 +60,8 @@ public ref struct DirectoryPathParser
|
||||
|
||||
if (!initialPath.IsEmpty)
|
||||
{
|
||||
Result rc = CurrentPath.InitializeWithNormalization(initialPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = CurrentPath.InitializeWithNormalization(initialPath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,11 +57,11 @@ public class FileStorage : IStorage
|
||||
if (destination.Length == 0)
|
||||
return Result.Success;
|
||||
|
||||
Result rc = UpdateSize();
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = UpdateSize();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = CheckAccessRange(offset, destination.Length, _fileSize);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = CheckAccessRange(offset, destination.Length, _fileSize);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return _baseFile.Read(out _, offset, destination, ReadOption.None);
|
||||
}
|
||||
@ -71,11 +71,11 @@ public class FileStorage : IStorage
|
||||
if (source.Length == 0)
|
||||
return Result.Success;
|
||||
|
||||
Result rc = UpdateSize();
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = UpdateSize();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = CheckAccessRange(offset, source.Length, _fileSize);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = CheckAccessRange(offset, source.Length, _fileSize);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return _baseFile.Write(offset, source, WriteOption.None);
|
||||
}
|
||||
@ -89,8 +89,8 @@ public class FileStorage : IStorage
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out size);
|
||||
|
||||
Result rc = UpdateSize();
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = UpdateSize();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
size = _fileSize;
|
||||
return Result.Success;
|
||||
@ -108,8 +108,8 @@ public class FileStorage : IStorage
|
||||
{
|
||||
case OperationId.InvalidateCache:
|
||||
{
|
||||
Result rc = _baseFile.OperateRange(OperationId.InvalidateCache, offset, size);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseFile.OperateRange(OperationId.InvalidateCache, offset, size);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -124,11 +124,11 @@ public class FileStorage : IStorage
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
Result rc = UpdateSize();
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = UpdateSize();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = CheckOffsetAndSize(offset, size);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = CheckOffsetAndSize(offset, size);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return _baseFile.OperateRange(outBuffer, operationId, offset, size, inBuffer);
|
||||
}
|
||||
@ -142,8 +142,8 @@ public class FileStorage : IStorage
|
||||
if (_fileSize != InvalidSize)
|
||||
return Result.Success;
|
||||
|
||||
Result rc = _baseFile.GetSize(out long size);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseFile.GetSize(out long size);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
_fileSize = size;
|
||||
return Result.Success;
|
||||
@ -183,8 +183,8 @@ public class FileStorageBasedFileSystem : FileStorage
|
||||
{
|
||||
using var baseFile = new UniqueRef<IFile>();
|
||||
|
||||
Result rc = baseFileSystem.Get.OpenFile(ref baseFile.Ref(), in path, mode);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = baseFileSystem.Get.OpenFile(ref baseFile.Ref(), in path, mode);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
SetFile(baseFile.Get);
|
||||
_baseFileSystem.SetByMove(ref baseFileSystem);
|
||||
@ -254,11 +254,11 @@ public class FileHandleStorage : IStorage
|
||||
if (destination.Length == 0)
|
||||
return Result.Success;
|
||||
|
||||
Result rc = UpdateSize();
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = UpdateSize();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = CheckAccessRange(offset, destination.Length, _size);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = CheckAccessRange(offset, destination.Length, _size);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return _fsClient.ReadFile(_handle, offset, destination, ReadOption.None);
|
||||
}
|
||||
@ -270,11 +270,11 @@ public class FileHandleStorage : IStorage
|
||||
if (source.Length == 0)
|
||||
return Result.Success;
|
||||
|
||||
Result rc = UpdateSize();
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = UpdateSize();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = CheckAccessRange(offset, source.Length, _size);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = CheckAccessRange(offset, source.Length, _size);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return _fsClient.WriteFile(_handle, offset, source, WriteOption.None);
|
||||
}
|
||||
@ -288,8 +288,8 @@ public class FileHandleStorage : IStorage
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out size);
|
||||
|
||||
Result rc = UpdateSize();
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = UpdateSize();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
size = _size;
|
||||
return Result.Success;
|
||||
@ -309,8 +309,8 @@ public class FileHandleStorage : IStorage
|
||||
if (outBuffer.Length != Unsafe.SizeOf<QueryRangeInfo>())
|
||||
return ResultFs.InvalidSize.Log();
|
||||
|
||||
Result rc = _fsClient.QueryRange(out SpanHelpers.AsStruct<QueryRangeInfo>(outBuffer), _handle, offset, size);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _fsClient.QueryRange(out SpanHelpers.AsStruct<QueryRangeInfo>(outBuffer), _handle, offset, size);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -320,8 +320,8 @@ public class FileHandleStorage : IStorage
|
||||
if (_size != InvalidSize)
|
||||
return Result.Success;
|
||||
|
||||
Result rc = _fsClient.GetFileSize(out long size, _handle);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _fsClient.GetFileSize(out long size, _handle);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
_size = size;
|
||||
return Result.Success;
|
||||
|
@ -129,8 +129,8 @@ public ref struct Path
|
||||
|
||||
_length = path.GetLength();
|
||||
|
||||
Result rc = Preallocate(_length + NullTerminatorLength);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = Preallocate(_length + NullTerminatorLength);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
int bytesCopied = StringUtils.Copy(_buffer, path._string, _length + NullTerminatorLength);
|
||||
|
||||
@ -404,8 +404,8 @@ public ref struct Path
|
||||
|
||||
int otherLength = other.GetLength();
|
||||
|
||||
Result rc = Preallocate(otherLength + NullTerminatorLength);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = Preallocate(otherLength + NullTerminatorLength);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
int bytesCopied = StringUtils.Copy(_writeBuffer, other.GetString(), otherLength + NullTerminatorLength);
|
||||
|
||||
@ -428,8 +428,8 @@ public ref struct Path
|
||||
{
|
||||
int otherLength = other.GetLength();
|
||||
|
||||
Result rc = Preallocate(otherLength + NullTerminatorLength);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = Preallocate(otherLength + NullTerminatorLength);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
int bytesCopied = StringUtils.Copy(_writeBuffer, other.GetString(), otherLength + NullTerminatorLength);
|
||||
|
||||
@ -457,8 +457,8 @@ public ref struct Path
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
Result rc = Preallocate(length + NullTerminatorLength);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = Preallocate(length + NullTerminatorLength);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
int bytesCopied = StringUtils.Copy(GetWriteBuffer(), path, length + NullTerminatorLength);
|
||||
|
||||
@ -478,8 +478,8 @@ public ref struct Path
|
||||
/// <returns><see cref="Result.Success"/>: The operation was successful.</returns>
|
||||
public Result Initialize(ReadOnlySpan<byte> path)
|
||||
{
|
||||
Result rc = InitializeImpl(path, StringUtils.GetLength(path));
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = InitializeImpl(path, StringUtils.GetLength(path));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
_isNormalized = false;
|
||||
return Result.Success;
|
||||
@ -500,8 +500,8 @@ public ref struct Path
|
||||
/// <see cref="ResultFs.InvalidPathFormat"/>: The path is not in a valid format.</returns>
|
||||
public Result InitializeWithNormalization(ReadOnlySpan<byte> path)
|
||||
{
|
||||
Result rc = Initialize(path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = Initialize(path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (_string.At(0) != NullTerminator && !WindowsPath.IsWindowsPath(_string, false) &&
|
||||
_string.At(0) != DirectorySeparator)
|
||||
@ -509,21 +509,21 @@ public ref struct Path
|
||||
var flags = new PathFlags();
|
||||
flags.AllowRelativePath();
|
||||
|
||||
rc = Normalize(flags);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = Normalize(flags);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else if (WindowsPath.IsWindowsPath(_string, true))
|
||||
{
|
||||
var flags = new PathFlags();
|
||||
flags.AllowWindowsPath();
|
||||
|
||||
rc = Normalize(flags);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = Normalize(flags);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = PathNormalizer.IsNormalized(out _isNormalized, out _, _string);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = PathNormalizer.IsNormalized(out _isNormalized, out _, _string);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
// Note: I have no idea why Nintendo checks if the path is normalized
|
||||
@ -544,8 +544,8 @@ public ref struct Path
|
||||
/// <returns><see cref="Result.Success"/>: The operation was successful.</returns>
|
||||
public Result Initialize(ReadOnlySpan<byte> path, int length)
|
||||
{
|
||||
Result rc = InitializeImpl(path, length);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = InitializeImpl(path, length);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
_isNormalized = false;
|
||||
return Result.Success;
|
||||
@ -567,8 +567,8 @@ public ref struct Path
|
||||
/// <see cref="ResultFs.InvalidPathFormat"/>: The path is not in a valid format.</returns>
|
||||
public Result InitializeWithNormalization(ReadOnlySpan<byte> path, int length)
|
||||
{
|
||||
Result rc = Initialize(path, length);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = Initialize(path, length);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (_string.At(0) != NullTerminator && !WindowsPath.IsWindowsPath(_string, false) &&
|
||||
_string.At(0) != DirectorySeparator)
|
||||
@ -576,21 +576,21 @@ public ref struct Path
|
||||
var flags = new PathFlags();
|
||||
flags.AllowRelativePath();
|
||||
|
||||
rc = Normalize(flags);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = Normalize(flags);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else if (WindowsPath.IsWindowsPath(_string, true))
|
||||
{
|
||||
var flags = new PathFlags();
|
||||
flags.AllowWindowsPath();
|
||||
|
||||
rc = Normalize(flags);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = Normalize(flags);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = PathNormalizer.IsNormalized(out _isNormalized, out _, _string);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = PathNormalizer.IsNormalized(out _isNormalized, out _, _string);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
// Note: I have no idea why Nintendo checks if the path is normalized
|
||||
@ -610,8 +610,8 @@ public ref struct Path
|
||||
/// <returns><see cref="Result.Success"/>: The operation was successful.</returns>
|
||||
public Result InitializeWithReplaceBackslash(ReadOnlySpan<byte> path)
|
||||
{
|
||||
Result rc = InitializeImpl(path, StringUtils.GetLength(path));
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = InitializeImpl(path, StringUtils.GetLength(path));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (_writeBufferLength > 1)
|
||||
{
|
||||
@ -632,8 +632,8 @@ public ref struct Path
|
||||
/// <returns><see cref="Result.Success"/>: The operation was successful.</returns>
|
||||
public Result InitializeWithReplaceForwardSlashes(ReadOnlySpan<byte> path)
|
||||
{
|
||||
Result rc = InitializeImpl(path, StringUtils.GetLength(path));
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = InitializeImpl(path, StringUtils.GetLength(path));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (_writeBufferLength > 1)
|
||||
{
|
||||
@ -663,8 +663,8 @@ public ref struct Path
|
||||
/// <returns><see cref="Result.Success"/>: The operation was successful.</returns>
|
||||
public Result InitializeWithReplaceUnc(ReadOnlySpan<byte> path)
|
||||
{
|
||||
Result rc = InitializeImpl(path, StringUtils.GetLength(path));
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = InitializeImpl(path, StringUtils.GetLength(path));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
_isNormalized = false;
|
||||
|
||||
@ -763,8 +763,8 @@ public ref struct Path
|
||||
}
|
||||
|
||||
// Give our Path a buffer that can hold the combined string.
|
||||
Result rc = Preallocate(parentLength + DirectorySeparator + childLength + NullTerminatorLength);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = Preallocate(parentLength + DirectorySeparator + childLength + NullTerminatorLength);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Span<byte> destBuffer = GetWriteBuffer();
|
||||
|
||||
@ -887,8 +887,8 @@ public ref struct Path
|
||||
ClearBuffer();
|
||||
}
|
||||
|
||||
Result rc = Preallocate(parentLength + SeparatorLength + childLength + NullTerminatorLength);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = Preallocate(parentLength + SeparatorLength + childLength + NullTerminatorLength);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Span<byte> destBuffer = GetWriteBuffer();
|
||||
|
||||
@ -946,21 +946,21 @@ public ref struct Path
|
||||
int path1Length = path1.GetLength();
|
||||
int path2Length = path2.GetLength();
|
||||
|
||||
Result rc = Preallocate(path1Length + SeparatorLength + path2Length + NullTerminatorLength);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = Preallocate(path1Length + SeparatorLength + path2Length + NullTerminatorLength);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = Initialize(in path1);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = Initialize(in path1);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (IsEmpty())
|
||||
{
|
||||
rc = Initialize(in path2);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = Initialize(in path2);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = AppendChild(in path2);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = AppendChild(in path2);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
return Result.Success;
|
||||
@ -982,14 +982,14 @@ public ref struct Path
|
||||
int path1Length = path1.GetLength();
|
||||
int path2Length = StringUtils.GetLength(path2);
|
||||
|
||||
Result rc = Preallocate(path1Length + SeparatorLength + path2Length + NullTerminatorLength);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = Preallocate(path1Length + SeparatorLength + path2Length + NullTerminatorLength);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = Initialize(in path1);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = Initialize(in path1);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = AppendChild(path2);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = AppendChild(path2);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -1007,14 +1007,14 @@ public ref struct Path
|
||||
int path1Length = StringUtils.GetLength(path1);
|
||||
int path2Length = path2.GetLength();
|
||||
|
||||
Result rc = Preallocate(path1Length + SeparatorLength + path2Length + NullTerminatorLength);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = Preallocate(path1Length + SeparatorLength + path2Length + NullTerminatorLength);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = Initialize(path1);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = Initialize(path1);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = AppendChild(in path2);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = AppendChild(in path2);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -1036,8 +1036,8 @@ public ref struct Path
|
||||
if (oldLength > 0)
|
||||
{
|
||||
ReadOnlySpan<byte> oldString = _string;
|
||||
Result rc = Preallocate(oldLength);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = Preallocate(oldLength);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
StringUtils.Copy(_writeBuffer, oldString, oldLength + NullTerminatorLength);
|
||||
}
|
||||
@ -1109,8 +1109,8 @@ public ref struct Path
|
||||
if (_isNormalized)
|
||||
return Result.Success;
|
||||
|
||||
Result rc = PathFormatter.IsNormalized(out bool isNormalized, out _, _string, flags);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = PathFormatter.IsNormalized(out bool isNormalized, out _, _string, flags);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (isNormalized)
|
||||
{
|
||||
@ -1133,8 +1133,8 @@ public ref struct Path
|
||||
{
|
||||
rentedArray = ArrayPool<byte>.Shared.Rent(alignedBufferLength);
|
||||
|
||||
rc = PathFormatter.Normalize(rentedArray, GetWriteBuffer(), flags);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = PathFormatter.Normalize(rentedArray, GetWriteBuffer(), flags);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
SetModifiableBuffer(Shared.Move(ref rentedArray), alignedBufferLength);
|
||||
_isNormalized = true;
|
||||
@ -1169,14 +1169,14 @@ public static class PathFunctions
|
||||
/// <see cref="ResultFs.InvalidPathFormat"/>: The path is in an invalid format or is not normalized.</returns>
|
||||
public static Result SetUpFixedPath(ref Path path, ReadOnlySpan<byte> pathBuffer)
|
||||
{
|
||||
Result rc = PathNormalizer.IsNormalized(out bool isNormalized, out _, pathBuffer);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = PathNormalizer.IsNormalized(out bool isNormalized, out _, pathBuffer);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!isNormalized)
|
||||
return ResultFs.InvalidPathFormat.Log();
|
||||
|
||||
rc = path.SetShallowBuffer(pathBuffer);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = path.SetShallowBuffer(pathBuffer);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ public static class PathFormatter
|
||||
|
||||
if (WindowsPath.IsUncPath(currentPath, false, true))
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
|
||||
ReadOnlySpan<byte> finalPath = currentPath;
|
||||
|
||||
@ -253,9 +253,9 @@ public static class PathFormatter
|
||||
{
|
||||
if (currentComponentOffset != 0)
|
||||
{
|
||||
rc = CheckSharedName(
|
||||
res = CheckSharedName(
|
||||
currentPath.Slice(currentComponentOffset, pos - currentComponentOffset));
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
finalPath = currentPath.Slice(pos);
|
||||
break;
|
||||
@ -264,8 +264,8 @@ public static class PathFormatter
|
||||
if (currentPath.At(pos + 1) == DirectorySeparator || currentPath.At(pos + 1) == AltDirectorySeparator)
|
||||
return ResultFs.InvalidPathFormat.Log();
|
||||
|
||||
rc = CheckHostName(currentPath.Slice(2, pos - 2));
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = CheckHostName(currentPath.Slice(2, pos - 2));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
currentComponentOffset = pos + 1;
|
||||
}
|
||||
@ -276,8 +276,8 @@ public static class PathFormatter
|
||||
|
||||
if (currentComponentOffset != 0 && finalPath == currentPath)
|
||||
{
|
||||
rc = CheckSharedName(currentPath.Slice(currentComponentOffset, pos - currentComponentOffset));
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = CheckSharedName(currentPath.Slice(currentComponentOffset, pos - currentComponentOffset));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
finalPath = currentPath.Slice(pos);
|
||||
}
|
||||
@ -326,16 +326,16 @@ public static class PathFormatter
|
||||
{
|
||||
isNormalized = true;
|
||||
|
||||
Result rc = ParseWindowsPathImpl(out newPath, out windowsPathLength, Span<byte>.Empty, path, hasMountName);
|
||||
if (!rc.IsSuccess())
|
||||
Result res = ParseWindowsPathImpl(out newPath, out windowsPathLength, Span<byte>.Empty, path, hasMountName);
|
||||
if (!res.IsSuccess())
|
||||
{
|
||||
if (ResultFs.NotNormalized.Includes(rc))
|
||||
if (ResultFs.NotNormalized.Includes(res))
|
||||
{
|
||||
isNormalized = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return rc;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@ -396,8 +396,8 @@ public static class PathFormatter
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out isNormalized, out normalizedLength);
|
||||
|
||||
Result rc = PathUtility.CheckUtf8(path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = PathUtility.CheckUtf8(path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
ReadOnlySpan<byte> buffer = path;
|
||||
int totalLength = 0;
|
||||
@ -425,8 +425,8 @@ public static class PathFormatter
|
||||
|
||||
bool hasMountName = false;
|
||||
|
||||
rc = SkipMountName(out buffer, out int mountNameLength, buffer);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = SkipMountName(out buffer, out int mountNameLength, buffer);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (mountNameLength != 0)
|
||||
{
|
||||
@ -449,8 +449,8 @@ public static class PathFormatter
|
||||
|
||||
bool isRelativePath = false;
|
||||
|
||||
rc = SkipRelativeDotPath(out buffer, out int relativePathLength, buffer);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = SkipRelativeDotPath(out buffer, out int relativePathLength, buffer);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (relativePathLength != 0)
|
||||
{
|
||||
@ -469,8 +469,8 @@ public static class PathFormatter
|
||||
isRelativePath = true;
|
||||
}
|
||||
|
||||
rc = SkipWindowsPath(out buffer, out int windowsPathLength, out bool isNormalizedWin, buffer, hasMountName);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = SkipWindowsPath(out buffer, out int windowsPathLength, out bool isNormalizedWin, buffer, hasMountName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!isNormalizedWin)
|
||||
{
|
||||
@ -513,9 +513,9 @@ public static class PathFormatter
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
rc = PathUtility.CheckInvalidBackslash(out bool isBackslashContained, buffer,
|
||||
res = PathUtility.CheckInvalidBackslash(out bool isBackslashContained, buffer,
|
||||
flags.IsWindowsPathAllowed() || flags.IsBackslashAllowed());
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (isBackslashContained && !flags.IsBackslashAllowed())
|
||||
{
|
||||
@ -523,8 +523,8 @@ public static class PathFormatter
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
rc = PathNormalizer.IsNormalized(out isNormalized, out int length, buffer, flags.AreAllCharactersAllowed());
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = PathNormalizer.IsNormalized(out isNormalized, out int length, buffer, flags.AreAllCharactersAllowed());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
totalLength += length;
|
||||
normalizedLength = totalLength;
|
||||
@ -533,7 +533,7 @@ public static class PathFormatter
|
||||
|
||||
public static Result Normalize(Span<byte> outputBuffer, ReadOnlySpan<byte> path, PathFlags flags)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
|
||||
ReadOnlySpan<byte> src = path;
|
||||
int currentPos = 0;
|
||||
@ -554,8 +554,8 @@ public static class PathFormatter
|
||||
|
||||
if (flags.IsMountNameAllowed())
|
||||
{
|
||||
rc = ParseMountName(out src, out int mountNameLength, outputBuffer.Slice(currentPos), src);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = ParseMountName(out src, out int mountNameLength, outputBuffer.Slice(currentPos), src);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
currentPos += mountNameLength;
|
||||
hasMountName = mountNameLength != 0;
|
||||
@ -578,8 +578,8 @@ public static class PathFormatter
|
||||
if (currentPos >= outputBuffer.Length)
|
||||
return ResultFs.TooLongPath.Log();
|
||||
|
||||
rc = ParseRelativeDotPath(out src, out int relativePathLength, outputBuffer.Slice(currentPos), src);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = ParseRelativeDotPath(out src, out int relativePathLength, outputBuffer.Slice(currentPos), src);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
currentPos += relativePathLength;
|
||||
|
||||
@ -600,9 +600,9 @@ public static class PathFormatter
|
||||
if (currentPos >= outputBuffer.Length)
|
||||
return ResultFs.TooLongPath.Log();
|
||||
|
||||
rc = ParseWindowsPath(out src, out int windowsPathLength, outputBuffer.Slice(currentPos), src,
|
||||
res = ParseWindowsPath(out src, out int windowsPathLength, outputBuffer.Slice(currentPos), src,
|
||||
hasMountName);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
currentPos += windowsPathLength;
|
||||
|
||||
@ -624,9 +624,9 @@ public static class PathFormatter
|
||||
isWindowsPath = true;
|
||||
}
|
||||
|
||||
rc = PathUtility.CheckInvalidBackslash(out bool isBackslashContained, src,
|
||||
res = PathUtility.CheckInvalidBackslash(out bool isBackslashContained, src,
|
||||
flags.IsWindowsPathAllowed() || flags.IsBackslashAllowed());
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
byte[] srcBufferSlashReplaced = null;
|
||||
try
|
||||
@ -644,9 +644,9 @@ public static class PathFormatter
|
||||
src = srcBufferSlashReplaced.AsSpan(srcOffset);
|
||||
}
|
||||
|
||||
rc = PathNormalizer.Normalize(outputBuffer.Slice(currentPos), out _, src, isWindowsPath, isDriveRelative,
|
||||
res = PathNormalizer.Normalize(outputBuffer.Slice(currentPos), out _, src, isWindowsPath, isDriveRelative,
|
||||
flags.AreAllCharactersAllowed());
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public static class PathNormalizer
|
||||
var convertedPath = new RentedArray<byte>();
|
||||
try
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
// Check if parent directory path replacement is needed.
|
||||
if (IsParentDirectoryPathReplacementNeeded(currentPath))
|
||||
{
|
||||
@ -100,8 +100,8 @@ public static class PathNormalizer
|
||||
{
|
||||
if (!allowAllCharacters)
|
||||
{
|
||||
rc = CheckInvalidCharacter(currentPath[i + dirLen]);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = CheckInvalidCharacter(currentPath[i + dirLen]);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
dirLen++;
|
||||
@ -185,8 +185,8 @@ public static class PathNormalizer
|
||||
|
||||
outputBuffer[totalLength] = NullTerminator;
|
||||
|
||||
rc = IsNormalized(out bool isNormalized, out _, outputBuffer, allowAllCharacters);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = IsNormalized(out bool isNormalized, out _, outputBuffer, allowAllCharacters);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Assert.SdkAssert(isNormalized);
|
||||
|
||||
@ -238,8 +238,8 @@ public static class PathNormalizer
|
||||
|
||||
if (!allowAllCharacters && state != PathState.Initial)
|
||||
{
|
||||
Result rc = CheckInvalidCharacter(c);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = CheckInvalidCharacter(c);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
switch (state)
|
||||
|
@ -56,9 +56,9 @@ public static class PathUtility
|
||||
if (length >= PathTool.EntryNameLengthMax + 1)
|
||||
return ResultFs.TooLongPath.Log();
|
||||
|
||||
Result rc = PathFormatter.SkipMountName(out ReadOnlySpan<byte> pathWithoutMountName, out int skipLength,
|
||||
Result res = PathFormatter.SkipMountName(out ReadOnlySpan<byte> pathWithoutMountName, out int skipLength,
|
||||
new U8Span(path));
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!WindowsPath.IsWindowsPath(pathWithoutMountName, true))
|
||||
{
|
||||
|
@ -93,7 +93,7 @@ internal class FileAccessor : IDisposable
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out bytesRead);
|
||||
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x50];
|
||||
var handle = new FileHandle(this);
|
||||
|
||||
@ -102,15 +102,15 @@ internal class FileAccessor : IDisposable
|
||||
if (Hos.Fs.Impl.IsEnabledAccessLog() && Hos.Fs.Impl.IsEnabledHandleAccessLog(handle))
|
||||
{
|
||||
Tick start = Hos.Os.GetSystemTick();
|
||||
rc = _lastResult;
|
||||
res = _lastResult;
|
||||
Tick end = Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogOffset).AppendFormat(offset)
|
||||
.Append(LogSize).AppendFormat(destination.Length)
|
||||
.Append(LogReadSize).AppendFormat(AccessLogImpl.DereferenceOutValue(in bytesRead, rc));
|
||||
.Append(LogReadSize).AppendFormat(AccessLogImpl.DereferenceOutValue(in bytesRead, res));
|
||||
|
||||
Hos.Fs.Impl.OutputAccessLog(rc, start, end, handle, new U8Span(logBuffer),
|
||||
Hos.Fs.Impl.OutputAccessLog(res, start, end, handle, new U8Span(logBuffer),
|
||||
nameof(UserFile.ReadFile));
|
||||
}
|
||||
|
||||
@ -130,23 +130,23 @@ internal class FileAccessor : IDisposable
|
||||
if (Hos.Fs.Impl.IsEnabledAccessLog() && Hos.Fs.Impl.IsEnabledHandleAccessLog(handle))
|
||||
{
|
||||
Tick start = Hos.Os.GetSystemTick();
|
||||
rc = ReadWithoutCacheAccessLog(out bytesRead, offset, destination, in option);
|
||||
res = ReadWithoutCacheAccessLog(out bytesRead, offset, destination, in option);
|
||||
Tick end = Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogOffset).AppendFormat(offset)
|
||||
.Append(LogSize).AppendFormat(destination.Length)
|
||||
.Append(LogReadSize).AppendFormat(AccessLogImpl.DereferenceOutValue(in bytesRead, rc));
|
||||
.Append(LogReadSize).AppendFormat(AccessLogImpl.DereferenceOutValue(in bytesRead, res));
|
||||
|
||||
Hos.Fs.Impl.OutputAccessLog(rc, start, end, handle, new U8Span(logBuffer),
|
||||
Hos.Fs.Impl.OutputAccessLog(res, start, end, handle, new U8Span(logBuffer),
|
||||
nameof(UserFile.ReadFile));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = ReadWithoutCacheAccessLog(out bytesRead, offset, destination, in option);
|
||||
res = ReadWithoutCacheAccessLog(out bytesRead, offset, destination, in option);
|
||||
}
|
||||
|
||||
return rc;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Result Write(long offset, ReadOnlySpan<byte> source, in WriteOption option)
|
||||
@ -159,14 +159,14 @@ internal class FileAccessor : IDisposable
|
||||
|
||||
if (_filePathHash is not null)
|
||||
{
|
||||
Result rc = UpdateLastResult(Hos.Fs.Impl.WriteViaPathBasedFileDataCache(_file.Get, (int)GetOpenMode(),
|
||||
Result res = UpdateLastResult(Hos.Fs.Impl.WriteViaPathBasedFileDataCache(_file.Get, (int)GetOpenMode(),
|
||||
_parentFileSystem, in _filePathHash.Value, _pathHashIndex, offset, source, in option));
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else
|
||||
{
|
||||
Result rc = UpdateLastResult(_file.Get.Write(offset, source, in option));
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = UpdateLastResult(_file.Get.Write(offset, source, in option));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
setter.Set(option.HasFlushFlag() ? WriteState.None : WriteState.NeedsFlush);
|
||||
@ -181,8 +181,8 @@ internal class FileAccessor : IDisposable
|
||||
using ScopedSetter<WriteState> setter =
|
||||
ScopedSetter<WriteState>.MakeScopedSetter(ref _writeState, WriteState.Failed);
|
||||
|
||||
Result rc = UpdateLastResult(_file.Get.Flush());
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = UpdateLastResult(_file.Get.Flush());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
setter.Set(WriteState.None);
|
||||
return Result.Success;
|
||||
@ -201,16 +201,16 @@ internal class FileAccessor : IDisposable
|
||||
{
|
||||
using UniqueLock lk = Hos.Fs.Impl.LockPathBasedFileDataCacheEntries();
|
||||
|
||||
Result rc = UpdateLastResult(_file.Get.SetSize(size));
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = UpdateLastResult(_file.Get.SetSize(size));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Hos.Fs.Impl.InvalidatePathBasedFileDataCacheEntry(_parentFileSystem, in _filePathHash.Value, _pathHashIndex);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else
|
||||
{
|
||||
Result rc = UpdateLastResult(_file.Get.SetSize(size));
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = UpdateLastResult(_file.Get.SetSize(size));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
setter.Set(originalWriteState);
|
||||
|
@ -146,9 +146,9 @@ internal class FileSystemAccessor : IDisposable
|
||||
|
||||
private Result SetUpPath(ref Path path, U8Span pathBuffer)
|
||||
{
|
||||
Result rc = PathFormatter.IsNormalized(out bool isNormalized, out _, pathBuffer, _pathFlags);
|
||||
Result res = PathFormatter.IsNormalized(out bool isNormalized, out _, pathBuffer, _pathFlags);
|
||||
|
||||
if (rc.IsSuccess() && isNormalized)
|
||||
if (res.IsSuccess() && isNormalized)
|
||||
{
|
||||
path.SetShallowBuffer(pathBuffer);
|
||||
}
|
||||
@ -156,17 +156,17 @@ internal class FileSystemAccessor : IDisposable
|
||||
{
|
||||
if (_pathFlags.IsWindowsPathAllowed())
|
||||
{
|
||||
rc = path.InitializeWithReplaceForwardSlashes(pathBuffer);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = path.InitializeWithReplaceForwardSlashes(pathBuffer);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = path.InitializeWithReplaceBackslash(pathBuffer);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = path.InitializeWithReplaceBackslash(pathBuffer);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
rc = path.Normalize(_pathFlags);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = path.Normalize(_pathFlags);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
if (path.GetLength() > PathTool.EntryNameLengthMax)
|
||||
@ -178,22 +178,22 @@ internal class FileSystemAccessor : IDisposable
|
||||
public Result CreateFile(U8Span path, long size, CreateFileOptions option)
|
||||
{
|
||||
using var pathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (_isPathCacheAttached)
|
||||
{
|
||||
using UniqueLock lk = Hos.Fs.Impl.LockPathBasedFileDataCacheEntries();
|
||||
|
||||
rc = _fileSystem.Get.CreateFile(in pathNormalized, size, option);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = _fileSystem.Get.CreateFile(in pathNormalized, size, option);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Hos.Fs.Impl.InvalidatePathBasedFileDataCacheEntry(this, in pathNormalized);
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = _fileSystem.Get.CreateFile(in pathNormalized, size, option);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fileSystem.Get.CreateFile(in pathNormalized, size, option);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
return Result.Success;
|
||||
@ -202,11 +202,11 @@ internal class FileSystemAccessor : IDisposable
|
||||
public Result DeleteFile(U8Span path)
|
||||
{
|
||||
using var pathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _fileSystem.Get.DeleteFile(in pathNormalized);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fileSystem.Get.DeleteFile(in pathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -214,11 +214,11 @@ internal class FileSystemAccessor : IDisposable
|
||||
public Result CreateDirectory(U8Span path)
|
||||
{
|
||||
using var pathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _fileSystem.Get.CreateDirectory(in pathNormalized);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fileSystem.Get.CreateDirectory(in pathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -226,11 +226,11 @@ internal class FileSystemAccessor : IDisposable
|
||||
public Result DeleteDirectory(U8Span path)
|
||||
{
|
||||
using var pathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _fileSystem.Get.CreateDirectory(in pathNormalized);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fileSystem.Get.CreateDirectory(in pathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -238,11 +238,11 @@ internal class FileSystemAccessor : IDisposable
|
||||
public Result DeleteDirectoryRecursively(U8Span path)
|
||||
{
|
||||
using var pathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _fileSystem.Get.DeleteDirectoryRecursively(in pathNormalized);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fileSystem.Get.DeleteDirectoryRecursively(in pathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -250,11 +250,11 @@ internal class FileSystemAccessor : IDisposable
|
||||
public Result CleanDirectoryRecursively(U8Span path)
|
||||
{
|
||||
using var pathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _fileSystem.Get.CleanDirectoryRecursively(in pathNormalized);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fileSystem.Get.CleanDirectoryRecursively(in pathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -262,26 +262,26 @@ internal class FileSystemAccessor : IDisposable
|
||||
public Result RenameFile(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
using var currentPathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref currentPathNormalized.Ref(), currentPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref currentPathNormalized.Ref(), currentPath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var newPathNormalized = new Path();
|
||||
rc = SetUpPath(ref newPathNormalized.Ref(), newPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = SetUpPath(ref newPathNormalized.Ref(), newPath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (_isPathCacheAttached)
|
||||
{
|
||||
using UniqueLock lk = Hos.Fs.Impl.LockPathBasedFileDataCacheEntries();
|
||||
|
||||
rc = _fileSystem.Get.RenameFile(in currentPathNormalized, in newPathNormalized);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = _fileSystem.Get.RenameFile(in currentPathNormalized, in newPathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Hos.Fs.Impl.InvalidatePathBasedFileDataCacheEntry(this, in newPathNormalized);
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = _fileSystem.Get.RenameFile(in currentPathNormalized, in newPathNormalized);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fileSystem.Get.RenameFile(in currentPathNormalized, in newPathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
return Result.Success;
|
||||
@ -290,26 +290,26 @@ internal class FileSystemAccessor : IDisposable
|
||||
public Result RenameDirectory(U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
using var currentPathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref currentPathNormalized.Ref(), currentPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref currentPathNormalized.Ref(), currentPath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var newPathNormalized = new Path();
|
||||
rc = SetUpPath(ref newPathNormalized.Ref(), newPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = SetUpPath(ref newPathNormalized.Ref(), newPath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (_isPathCacheAttached)
|
||||
{
|
||||
using UniqueLock lk = Hos.Fs.Impl.LockPathBasedFileDataCacheEntries();
|
||||
|
||||
rc = _fileSystem.Get.RenameDirectory(in currentPathNormalized, in newPathNormalized);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = _fileSystem.Get.RenameDirectory(in currentPathNormalized, in newPathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Hos.Fs.Impl.InvalidatePathBasedFileDataCacheEntries(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = _fileSystem.Get.RenameDirectory(in currentPathNormalized, in newPathNormalized);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fileSystem.Get.RenameDirectory(in currentPathNormalized, in newPathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
return Result.Success;
|
||||
}
|
||||
@ -319,11 +319,11 @@ internal class FileSystemAccessor : IDisposable
|
||||
UnsafeHelpers.SkipParamInit(out entryType);
|
||||
|
||||
using var pathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _fileSystem.Get.GetEntryType(out entryType, in pathNormalized);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fileSystem.Get.GetEntryType(out entryType, in pathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -333,11 +333,11 @@ internal class FileSystemAccessor : IDisposable
|
||||
UnsafeHelpers.SkipParamInit(out freeSpace);
|
||||
|
||||
using var pathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _fileSystem.Get.GetFreeSpaceSize(out freeSpace, in pathNormalized);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fileSystem.Get.GetFreeSpaceSize(out freeSpace, in pathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -347,11 +347,11 @@ internal class FileSystemAccessor : IDisposable
|
||||
UnsafeHelpers.SkipParamInit(out totalSpace);
|
||||
|
||||
using var pathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _fileSystem.Get.GetTotalSpaceSize(out totalSpace, in pathNormalized);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fileSystem.Get.GetTotalSpaceSize(out totalSpace, in pathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -359,12 +359,12 @@ internal class FileSystemAccessor : IDisposable
|
||||
public Result OpenFile(ref UniqueRef<FileAccessor> outFile, U8Span path, OpenMode mode)
|
||||
{
|
||||
using var pathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var file = new UniqueRef<IFile>();
|
||||
rc = _fileSystem.Get.OpenFile(ref file.Ref(), in pathNormalized, mode);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fileSystem.Get.OpenFile(ref file.Ref(), in pathNormalized, mode);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
var accessor = new FileAccessor(Hos, ref file.Ref(), this, mode);
|
||||
|
||||
@ -398,12 +398,12 @@ internal class FileSystemAccessor : IDisposable
|
||||
public Result OpenDirectory(ref UniqueRef<DirectoryAccessor> outDirectory, U8Span path, OpenDirectoryMode mode)
|
||||
{
|
||||
using var pathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var directory = new UniqueRef<IDirectory>();
|
||||
rc = _fileSystem.Get.OpenDirectory(ref directory.Ref(), in pathNormalized, mode);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fileSystem.Get.OpenDirectory(ref directory.Ref(), in pathNormalized, mode);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
var accessor = new DirectoryAccessor(ref directory.Ref(), this);
|
||||
|
||||
@ -447,11 +447,11 @@ internal class FileSystemAccessor : IDisposable
|
||||
UnsafeHelpers.SkipParamInit(out timeStamp);
|
||||
|
||||
using var pathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _fileSystem.Get.GetFileTimeStampRaw(out timeStamp, in pathNormalized);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fileSystem.Get.GetFileTimeStampRaw(out timeStamp, in pathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -459,11 +459,11 @@ internal class FileSystemAccessor : IDisposable
|
||||
public Result QueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId, U8Span path)
|
||||
{
|
||||
using var pathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _fileSystem.Get.QueryEntry(outBuffer, inBuffer, queryId, in pathNormalized);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fileSystem.Get.QueryEntry(outBuffer, inBuffer, queryId, in pathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -495,8 +495,8 @@ internal class FileSystemAccessor : IDisposable
|
||||
if (!_saveDataAttributeGetter.HasValue)
|
||||
return ResultFs.PreconditionViolation.Log();
|
||||
|
||||
Result rc = _saveDataAttributeGetter.Get.GetSaveDataAttribute(out attribute);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = _saveDataAttributeGetter.Get.GetSaveDataAttribute(out attribute);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -669,8 +669,8 @@ internal class FileSystemAccessor : IDisposable
|
||||
if ((openMode & fileOpenModeMask) == 0)
|
||||
continue;
|
||||
|
||||
Result rc = file.Value.GetSize(out long fileSize);
|
||||
if (rc.IsFailure())
|
||||
Result res = file.Value.GetSize(out long fileSize);
|
||||
if (res.IsFailure())
|
||||
fileSize = -1;
|
||||
|
||||
var openModeString = new U8StringBuilder(openModeStringBuffer);
|
||||
|
@ -83,8 +83,8 @@ public abstract class IFile : IDisposable
|
||||
{
|
||||
if (option.HasFlushFlag())
|
||||
{
|
||||
Result rc = Flush();
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = Flush();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
return Result.Success;
|
||||
@ -167,8 +167,8 @@ public abstract class IFile : IDisposable
|
||||
return ResultFs.ReadUnpermitted.Log();
|
||||
|
||||
// Get the file size, and validate our offset.
|
||||
Result rc = GetSize(out long fileSize);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSize(out long fileSize);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (offset > fileSize)
|
||||
return ResultFs.OutOfRange.Log();
|
||||
@ -187,8 +187,8 @@ public abstract class IFile : IDisposable
|
||||
return ResultFs.WriteUnpermitted.Log();
|
||||
|
||||
// Get the file size.
|
||||
Result rc = GetSize(out long fileSize);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSize(out long fileSize);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
needsAppend = false;
|
||||
|
||||
|
@ -167,8 +167,8 @@ public abstract class IFileSystem : IDisposable
|
||||
return ResultFs.NullptrArgument.Log();
|
||||
|
||||
using var pathNormalized = new Path();
|
||||
Result rs = pathNormalized.InitializeWithNormalization(path);
|
||||
if (rs.IsFailure()) return rs;
|
||||
Result res = pathNormalized.InitializeWithNormalization(path);
|
||||
if (res.IsFailure()) return res;
|
||||
|
||||
return DoGetEntryType(out entryType, in pathNormalized);
|
||||
}
|
||||
@ -209,8 +209,8 @@ public abstract class IFileSystem : IDisposable
|
||||
return ResultFs.NullptrArgument.Log();
|
||||
|
||||
using var pathNormalized = new Path();
|
||||
Result rs = pathNormalized.InitializeWithNormalization(path);
|
||||
if (rs.IsFailure()) return rs;
|
||||
Result res = pathNormalized.InitializeWithNormalization(path);
|
||||
if (res.IsFailure()) return res;
|
||||
|
||||
return DoOpenFile(ref file, in pathNormalized, mode);
|
||||
}
|
||||
|
@ -124,8 +124,8 @@ public static class MountUtility
|
||||
return ResultFs.NotMounted.Log();
|
||||
}
|
||||
|
||||
Result rc = GetMountNameAndSubPath(out MountName mountName, out subPath, path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetMountNameAndSubPath(out MountName mountName, out subPath, path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return fs.Find(out fileSystem, new U8Span(mountName.Name));
|
||||
}
|
||||
@ -157,8 +157,8 @@ public static class MountUtility
|
||||
|
||||
public static Result Unmount(this FileSystemClientImpl fs, U8Span mountName)
|
||||
{
|
||||
Result rc = fs.Find(out FileSystemAccessor fileSystem, mountName);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = fs.Find(out FileSystemAccessor fileSystem, mountName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fileSystem.IsFileDataCacheAttachable())
|
||||
{
|
||||
@ -178,11 +178,11 @@ public static class MountUtility
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out isMounted);
|
||||
|
||||
Result rc = fs.Find(out _, mountName);
|
||||
if (rc.IsFailure())
|
||||
Result res = fs.Find(out _, mountName);
|
||||
if (res.IsFailure())
|
||||
{
|
||||
if (!ResultFs.NotMounted.Includes(rc))
|
||||
return rc;
|
||||
if (!ResultFs.NotMounted.Includes(res))
|
||||
return res;
|
||||
|
||||
isMounted = false;
|
||||
}
|
||||
@ -196,52 +196,52 @@ public static class MountUtility
|
||||
|
||||
public static void Unmount(this FileSystemClient fs, U8Span mountName)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x30];
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog() && fs.Impl.IsEnabledFileSystemAccessorAccessLog(mountName))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fs.Impl.Unmount(mountName);
|
||||
res = fs.Impl.Unmount(mountName);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogName).Append(mountName).Append((byte)'"');
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fs.Impl.Unmount(mountName);
|
||||
res = fs.Impl.Unmount(mountName);
|
||||
}
|
||||
fs.Impl.LogResultErrorMessage(rc);
|
||||
Abort.DoAbortUnless(rc.IsSuccess());
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
}
|
||||
|
||||
public static bool IsMounted(this FileSystemClient fs, U8Span mountName)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
bool isMounted;
|
||||
Span<byte> logBuffer = stackalloc byte[0x30];
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog() && fs.Impl.IsEnabledFileSystemAccessorAccessLog(mountName))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fs.Impl.IsMounted(out isMounted, mountName);
|
||||
res = fs.Impl.IsMounted(out isMounted, mountName);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
ReadOnlySpan<byte> boolString = AccessLogImpl.ConvertFromBoolToAccessLogBooleanValue(isMounted);
|
||||
sb.Append(LogName).Append(mountName).Append(LogIsMounted).Append(boolString).Append((byte)'"');
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fs.Impl.IsMounted(out isMounted, mountName);
|
||||
res = fs.Impl.IsMounted(out isMounted, mountName);
|
||||
}
|
||||
fs.Impl.LogResultErrorMessage(rc);
|
||||
Abort.DoAbortUnless(rc.IsSuccess());
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
|
||||
return isMounted;
|
||||
}
|
||||
@ -249,33 +249,33 @@ public static class MountUtility
|
||||
public static Result ConvertToFsCommonPath(this FileSystemClient fs, U8SpanMutable commonPathBuffer,
|
||||
U8Span path)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
|
||||
if (commonPathBuffer.IsNull())
|
||||
{
|
||||
rc = ResultFs.NullptrArgument.Value;
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
res = ResultFs.NullptrArgument.Value;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
if (path.IsNull())
|
||||
{
|
||||
rc = ResultFs.NullptrArgument.Value;
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
res = ResultFs.NullptrArgument.Value;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
rc = GetMountNameAndSubPath(out MountName mountName, out U8Span subPath, path);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = GetMountNameAndSubPath(out MountName mountName, out U8Span subPath, path);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = fs.Impl.Find(out FileSystemAccessor fileSystem, new U8Span(mountName.Name));
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = fs.Impl.Find(out FileSystemAccessor fileSystem, new U8Span(mountName.Name));
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = fileSystem.GetCommonMountName(commonPathBuffer.Value);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = fileSystem.GetCommonMountName(commonPathBuffer.Value);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
int mountNameLength = StringUtils.GetLength(commonPathBuffer);
|
||||
int commonPathLength = StringUtils.GetLength(subPath);
|
||||
|
@ -110,8 +110,8 @@ public static class Registrar
|
||||
using var accessor = new UniqueRef<FileSystemAccessor>(new FileSystemAccessor(fs.Hos, name, null,
|
||||
ref fileSystem, ref mountNameGenerator.Ref(), ref attributeGetter.Ref()));
|
||||
|
||||
Result rc = fs.Impl.Register(ref accessor.Ref());
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fs.Impl.Register(ref accessor.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -124,8 +124,8 @@ public static class Registrar
|
||||
using var accessor = new UniqueRef<FileSystemAccessor>(new FileSystemAccessor(fs.Hos, name, null,
|
||||
ref fileSystem, ref mountNameGenerator, ref attributeGetter.Ref()));
|
||||
|
||||
Result rc = fs.Impl.Register(ref accessor.Ref());
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fs.Impl.Register(ref accessor.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -137,10 +137,10 @@ public static class Registrar
|
||||
using var unmountHookInvoker = new UniqueRef<IUnmountHookInvoker>();
|
||||
using var attributeGetter = new UniqueRef<ISaveDataAttributeGetter>();
|
||||
|
||||
Result rc = Register(fs, name, multiCommitTarget, ref fileSystem, ref mountNameGenerator,
|
||||
Result res = Register(fs, name, multiCommitTarget, ref fileSystem, ref mountNameGenerator,
|
||||
ref attributeGetter.Ref(), useDataCache, storageForPurgeFileDataCache, usePathCache,
|
||||
ref unmountHookInvoker.Ref());
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -152,9 +152,9 @@ public static class Registrar
|
||||
{
|
||||
using var attributeGetter = new UniqueRef<ISaveDataAttributeGetter>();
|
||||
|
||||
Result rc = Register(fs, name, multiCommitTarget, ref fileSystem, ref mountNameGenerator,
|
||||
Result res = Register(fs, name, multiCommitTarget, ref fileSystem, ref mountNameGenerator,
|
||||
ref attributeGetter.Ref(), useDataCache, storageForPurgeFileDataCache, usePathCache, ref unmountHook);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -166,10 +166,10 @@ public static class Registrar
|
||||
{
|
||||
using var unmountHookInvoker = new UniqueRef<IUnmountHookInvoker>();
|
||||
|
||||
Result rc = Register(fs, name, multiCommitTarget, ref fileSystem, ref mountNameGenerator,
|
||||
Result res = Register(fs, name, multiCommitTarget, ref fileSystem, ref mountNameGenerator,
|
||||
ref saveAttributeGetter, useDataCache, storageForPurgeFileDataCache, usePathCache,
|
||||
ref unmountHookInvoker.Ref());
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -200,8 +200,8 @@ public static class Registrar
|
||||
accessor.Get.SetFileDataCacheAttachable(useDataCache, storageForPurgeFileDataCache);
|
||||
accessor.Get.SetPathBasedFileDataCacheAttachable(usePathCache);
|
||||
|
||||
Result rc = fs.Impl.Register(ref accessor.Ref());
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fs.Impl.Register(ref accessor.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -22,12 +22,12 @@ public static class UserDirectory
|
||||
public static Result ReadDirectory(this FileSystemClient fs, out long entriesRead,
|
||||
Span<DirectoryEntry> entryBuffer, DirectoryHandle handle)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog() && fs.Impl.IsEnabledHandleAccessLog(handle))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = Get(handle).Read(out entriesRead, entryBuffer);
|
||||
res = Get(handle).Read(out entriesRead, entryBuffer);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
Span<byte> buffer = stackalloc byte[0x50];
|
||||
@ -35,40 +35,40 @@ public static class UserDirectory
|
||||
|
||||
sb.Append(LogEntryBufferCount).AppendFormat(entryBuffer.Length)
|
||||
.Append(LogEntryCount).AppendFormat(entriesRead);
|
||||
fs.Impl.OutputAccessLog(rc, start, end, handle, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, handle, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = Get(handle).Read(out entriesRead, entryBuffer);
|
||||
res = Get(handle).Read(out entriesRead, entryBuffer);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Result GetDirectoryEntryCount(this FileSystemClient fs, out long count, DirectoryHandle handle)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog() && fs.Impl.IsEnabledHandleAccessLog(handle))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = Get(handle).GetEntryCount(out count);
|
||||
res = Get(handle).GetEntryCount(out count);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
Span<byte> buffer = stackalloc byte[0x50];
|
||||
var sb = new U8StringBuilder(buffer, true);
|
||||
|
||||
sb.Append(LogEntryCount).AppendFormat(count);
|
||||
fs.Impl.OutputAccessLog(rc, start, end, handle, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, handle, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = Get(handle).GetEntryCount(out count);
|
||||
res = Get(handle).GetEntryCount(out count);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static void CloseDirectory(this FileSystemClient fs, DirectoryHandle handle)
|
||||
|
@ -28,57 +28,57 @@ public static class UserFile
|
||||
public static Result ReadFile(this FileSystemClient fs, FileHandle handle, long offset, Span<byte> destination,
|
||||
in ReadOption option)
|
||||
{
|
||||
Result rc = ReadFileImpl(fs, out long bytesRead, handle, offset, destination, in option);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = ReadFileImpl(fs, out long bytesRead, handle, offset, destination, in option);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (bytesRead == destination.Length)
|
||||
return Result.Success;
|
||||
|
||||
rc = ResultFs.OutOfRange.Log();
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
res = ResultFs.OutOfRange.Log();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Result ReadFile(this FileSystemClient fs, FileHandle handle, long offset, Span<byte> destination)
|
||||
{
|
||||
Result rc = ReadFileImpl(fs, out long bytesRead, handle, offset, destination, ReadOption.None);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = ReadFileImpl(fs, out long bytesRead, handle, offset, destination, ReadOption.None);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (bytesRead == destination.Length)
|
||||
return Result.Success;
|
||||
|
||||
rc = ResultFs.OutOfRange.Log();
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
res = ResultFs.OutOfRange.Log();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Result ReadFile(this FileSystemClient fs, out long bytesRead, FileHandle handle, long offset,
|
||||
Span<byte> destination, in ReadOption option)
|
||||
{
|
||||
Result rc = ReadFileImpl(fs, out bytesRead, handle, offset, destination, in option);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
Result res = ReadFileImpl(fs, out bytesRead, handle, offset, destination, in option);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Result ReadFile(this FileSystemClient fs, out long bytesRead, FileHandle handle, long offset,
|
||||
Span<byte> destination)
|
||||
{
|
||||
Result rc = ReadFileImpl(fs, out bytesRead, handle, offset, destination, ReadOption.None);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
Result res = ReadFileImpl(fs, out bytesRead, handle, offset, destination, ReadOption.None);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Result WriteFile(this FileSystemClient fs, FileHandle handle, long offset,
|
||||
ReadOnlySpan<byte> source, in WriteOption option)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog() && fs.Impl.IsEnabledHandleAccessLog(handle))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = Get(handle).Write(offset, source, in option);
|
||||
res = Get(handle).Write(offset, source, in option);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
Span<byte> buffer = stackalloc byte[0x60];
|
||||
@ -89,87 +89,87 @@ public static class UserFile
|
||||
if (option.HasFlushFlag())
|
||||
sb.Append(LogWriteOptionFlush);
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, handle, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, handle, new U8Span(sb.Buffer));
|
||||
sb.Dispose();
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = Get(handle).Write(offset, source, in option);
|
||||
res = Get(handle).Write(offset, source, in option);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Result FlushFile(this FileSystemClient fs, FileHandle handle)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog() && fs.Impl.IsEnabledHandleAccessLog(handle))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = Get(handle).Flush();
|
||||
res = Get(handle).Flush();
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, handle, U8Span.Empty);
|
||||
fs.Impl.OutputAccessLog(res, start, end, handle, U8Span.Empty);
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = Get(handle).Flush();
|
||||
res = Get(handle).Flush();
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Result SetFileSize(this FileSystemClient fs, FileHandle handle, long size)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog() && fs.Impl.IsEnabledHandleAccessLog(handle))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = Get(handle).SetSize(size);
|
||||
res = Get(handle).SetSize(size);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
Span<byte> buffer = stackalloc byte[0x20];
|
||||
var sb = new U8StringBuilder(buffer, true);
|
||||
|
||||
sb.Append(LogSize).AppendFormat(size);
|
||||
fs.Impl.OutputAccessLog(rc, start, end, handle, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, handle, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = Get(handle).SetSize(size);
|
||||
res = Get(handle).SetSize(size);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Result GetFileSize(this FileSystemClient fs, out long size, FileHandle handle)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog() && fs.Impl.IsEnabledHandleAccessLog(handle))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = Get(handle).GetSize(out size);
|
||||
res = Get(handle).GetSize(out size);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
Span<byte> buffer = stackalloc byte[0x20];
|
||||
var sb = new U8StringBuilder(buffer, true);
|
||||
|
||||
sb.Append(LogSize).AppendFormat(AccessLogImpl.DereferenceOutValue(in size, rc));
|
||||
fs.Impl.OutputAccessLog(rc, start, end, handle, new U8Span(sb.Buffer));
|
||||
sb.Append(LogSize).AppendFormat(AccessLogImpl.DereferenceOutValue(in size, res));
|
||||
fs.Impl.OutputAccessLog(res, start, end, handle, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = Get(handle).GetSize(out size);
|
||||
res = Get(handle).GetSize(out size);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static OpenMode GetFileOpenMode(this FileSystemClient fs, FileHandle handle)
|
||||
@ -212,20 +212,20 @@ public static class UserFile
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out rangeInfo);
|
||||
|
||||
Result rc = Get(handle).OperateRange(SpanHelpers.AsByteSpan(ref rangeInfo), OperationId.QueryRange, offset,
|
||||
Result res = Get(handle).OperateRange(SpanHelpers.AsByteSpan(ref rangeInfo), OperationId.QueryRange, offset,
|
||||
size, ReadOnlySpan<byte>.Empty);
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Result InvalidateCache(this FileSystemClient fs, FileHandle handle)
|
||||
{
|
||||
Result rc = Get(handle).OperateRange(Span<byte>.Empty, OperationId.InvalidateCache, 0, long.MaxValue,
|
||||
Result res = Get(handle).OperateRange(Span<byte>.Empty, OperationId.InvalidateCache, 0, long.MaxValue,
|
||||
ReadOnlySpan<byte>.Empty);
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Result QueryUnpreparedRange(this FileSystemClient fs, out Range unpreparedRange, FileHandle handle)
|
||||
@ -233,11 +233,11 @@ public static class UserFile
|
||||
UnsafeHelpers.SkipParamInit(out unpreparedRange);
|
||||
Unsafe.SkipInit(out UnpreparedRangeInfo info);
|
||||
|
||||
Result rc = Get(handle).OperateRange(SpanHelpers.AsByteSpan(ref info), OperationId.QueryUnpreparedRange, 0, 0,
|
||||
Result res = Get(handle).OperateRange(SpanHelpers.AsByteSpan(ref info), OperationId.QueryUnpreparedRange, 0, 0,
|
||||
ReadOnlySpan<byte>.Empty);
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
unpreparedRange = info.Range;
|
||||
return Result.Success;
|
||||
@ -249,11 +249,11 @@ public static class UserFile
|
||||
UnsafeHelpers.SkipParamInit(out unpreparedRangeInfo);
|
||||
Unsafe.SkipInit(out UnpreparedRangeInfo info);
|
||||
|
||||
Result rc = Get(handle).OperateRange(SpanHelpers.AsByteSpan(ref info), OperationId.QueryUnpreparedRange, 0, 0,
|
||||
Result res = Get(handle).OperateRange(SpanHelpers.AsByteSpan(ref info), OperationId.QueryUnpreparedRange, 0, 0,
|
||||
ReadOnlySpan<byte>.Empty);
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
unpreparedRangeInfo = info;
|
||||
return Result.Success;
|
||||
@ -267,11 +267,11 @@ public static class UserFile
|
||||
Unsafe.SkipInit(out UnpreparedRangeInfo info);
|
||||
var args = new LazyLoadArguments { GuideIndex = guideIndex };
|
||||
|
||||
Result rc = Get(handle).OperateRange(SpanHelpers.AsByteSpan(ref info), OperationId.QueryLazyLoadCompletionRate,
|
||||
Result res = Get(handle).OperateRange(SpanHelpers.AsByteSpan(ref info), OperationId.QueryLazyLoadCompletionRate,
|
||||
0, 0, SpanHelpers.AsReadOnlyByteSpan(in args));
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
completionRate = info.CompletionRate;
|
||||
return Result.Success;
|
||||
@ -282,11 +282,11 @@ public static class UserFile
|
||||
{
|
||||
Unsafe.SkipInit(out UnpreparedRangeInfo info);
|
||||
|
||||
Result rc = Get(handle).OperateRange(SpanHelpers.AsByteSpan(ref info), OperationId.ReadyLazyLoadFile,
|
||||
Result res = Get(handle).OperateRange(SpanHelpers.AsByteSpan(ref info), OperationId.ReadyLazyLoadFile,
|
||||
offset, size, ReadOnlySpan<byte>.Empty);
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public static class UserFileSystem
|
||||
|
||||
public static Result DeleteFile(this FileSystemClient fs, U8Span path)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
U8Span subPath;
|
||||
FileSystemAccessor fileSystem;
|
||||
Span<byte> logBuffer = stackalloc byte[0x300];
|
||||
@ -33,41 +33,41 @@ public static class UserFileSystem
|
||||
if (fs.Impl.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
res = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogPath).Append(path).Append((byte)'"');
|
||||
logBuffer = sb.Buffer;
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
res = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog() && fileSystem.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fileSystem.DeleteFile(subPath);
|
||||
res = fileSystem.DeleteFile(subPath);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fileSystem.DeleteFile(subPath);
|
||||
res = fileSystem.DeleteFile(subPath);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Result CreateDirectory(this FileSystemClient fs, U8Span path)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
U8Span subPath;
|
||||
FileSystemAccessor fileSystem;
|
||||
Span<byte> logBuffer = stackalloc byte[0x300];
|
||||
@ -75,41 +75,41 @@ public static class UserFileSystem
|
||||
if (fs.Impl.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
res = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogPath).Append(path).Append((byte)'"');
|
||||
logBuffer = sb.Buffer;
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
res = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog() && fileSystem.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fileSystem.CreateDirectory(subPath);
|
||||
res = fileSystem.CreateDirectory(subPath);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fileSystem.CreateDirectory(subPath);
|
||||
res = fileSystem.CreateDirectory(subPath);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Result DeleteDirectory(this FileSystemClient fs, U8Span path)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
U8Span subPath;
|
||||
FileSystemAccessor fileSystem;
|
||||
Span<byte> logBuffer = stackalloc byte[0x300];
|
||||
@ -117,41 +117,41 @@ public static class UserFileSystem
|
||||
if (fs.Impl.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
res = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogPath).Append(path).Append((byte)'"');
|
||||
logBuffer = sb.Buffer;
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
res = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog() && fileSystem.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fileSystem.DeleteDirectory(subPath);
|
||||
res = fileSystem.DeleteDirectory(subPath);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fileSystem.DeleteDirectory(subPath);
|
||||
res = fileSystem.DeleteDirectory(subPath);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Result DeleteDirectoryRecursively(this FileSystemClient fs, U8Span path)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
U8Span subPath;
|
||||
FileSystemAccessor fileSystem;
|
||||
Span<byte> logBuffer = stackalloc byte[0x300];
|
||||
@ -159,41 +159,41 @@ public static class UserFileSystem
|
||||
if (fs.Impl.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
res = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogPath).Append(path).Append((byte)'"');
|
||||
logBuffer = sb.Buffer;
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
res = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog() && fileSystem.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fileSystem.DeleteDirectoryRecursively(subPath);
|
||||
res = fileSystem.DeleteDirectoryRecursively(subPath);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fileSystem.DeleteDirectoryRecursively(subPath);
|
||||
res = fileSystem.DeleteDirectoryRecursively(subPath);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Result CleanDirectoryRecursively(this FileSystemClient fs, U8Span path)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
U8Span subPath;
|
||||
FileSystemAccessor fileSystem;
|
||||
Span<byte> logBuffer = stackalloc byte[0x300];
|
||||
@ -201,41 +201,41 @@ public static class UserFileSystem
|
||||
if (fs.Impl.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
res = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogPath).Append(path).Append((byte)'"');
|
||||
logBuffer = sb.Buffer;
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
res = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog() && fileSystem.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fileSystem.CleanDirectoryRecursively(subPath);
|
||||
res = fileSystem.CleanDirectoryRecursively(subPath);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fileSystem.CleanDirectoryRecursively(subPath);
|
||||
res = fileSystem.CleanDirectoryRecursively(subPath);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Result RenameFile(this FileSystemClient fs, U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
U8Span currentSubPath, newSubPath;
|
||||
FileSystemAccessor currentFileSystem, newFileSystem;
|
||||
Span<byte> logBuffer = stackalloc byte[0x300];
|
||||
@ -244,64 +244,64 @@ public static class UserFileSystem
|
||||
if (fs.Impl.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fs.Impl.FindFileSystem(out currentFileSystem, out currentSubPath, currentPath);
|
||||
res = fs.Impl.FindFileSystem(out currentFileSystem, out currentSubPath, currentPath);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogPath).Append(currentPath).Append(LogNewPath).Append(newPath).Append((byte)'"');
|
||||
logBuffer = sb.Buffer;
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fs.Impl.FindFileSystem(out currentFileSystem, out currentSubPath, currentPath);
|
||||
res = fs.Impl.FindFileSystem(out currentFileSystem, out currentSubPath, currentPath);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Get the file system accessor for the new path
|
||||
if (fs.Impl.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fs.Impl.FindFileSystem(out newFileSystem, out newSubPath, newPath);
|
||||
res = fs.Impl.FindFileSystem(out newFileSystem, out newSubPath, newPath);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fs.Impl.FindFileSystem(out newFileSystem, out newSubPath, newPath);
|
||||
res = fs.Impl.FindFileSystem(out newFileSystem, out newSubPath, newPath);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Rename the file
|
||||
if (fs.Impl.IsEnabledAccessLog() && currentFileSystem.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
rc = currentFileSystem != newFileSystem
|
||||
res = currentFileSystem != newFileSystem
|
||||
? ResultFs.RenameToOtherFileSystem.Log()
|
||||
: currentFileSystem.RenameFile(currentSubPath, newSubPath);
|
||||
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = currentFileSystem != newFileSystem
|
||||
res = currentFileSystem != newFileSystem
|
||||
? ResultFs.RenameToOtherFileSystem.Log()
|
||||
: currentFileSystem.RenameFile(currentSubPath, newSubPath);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Result RenameDirectory(this FileSystemClient fs, U8Span currentPath, U8Span newPath)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
U8Span currentSubPath, newSubPath;
|
||||
FileSystemAccessor currentFileSystem, newFileSystem;
|
||||
Span<byte> logBuffer = stackalloc byte[0x300];
|
||||
@ -310,66 +310,66 @@ public static class UserFileSystem
|
||||
if (fs.Impl.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fs.Impl.FindFileSystem(out currentFileSystem, out currentSubPath, currentPath);
|
||||
res = fs.Impl.FindFileSystem(out currentFileSystem, out currentSubPath, currentPath);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogPath).Append(currentPath).Append(LogNewPath).Append(newPath).Append((byte)'"');
|
||||
logBuffer = sb.Buffer;
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fs.Impl.FindFileSystem(out currentFileSystem, out currentSubPath, currentPath);
|
||||
res = fs.Impl.FindFileSystem(out currentFileSystem, out currentSubPath, currentPath);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Get the file system accessor for the new path
|
||||
if (fs.Impl.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fs.Impl.FindFileSystem(out newFileSystem, out newSubPath, newPath);
|
||||
res = fs.Impl.FindFileSystem(out newFileSystem, out newSubPath, newPath);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fs.Impl.FindFileSystem(out newFileSystem, out newSubPath, newPath);
|
||||
res = fs.Impl.FindFileSystem(out newFileSystem, out newSubPath, newPath);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Rename the directory
|
||||
if (fs.Impl.IsEnabledAccessLog() && currentFileSystem.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
rc = currentFileSystem != newFileSystem
|
||||
res = currentFileSystem != newFileSystem
|
||||
? ResultFs.RenameToOtherFileSystem.Log()
|
||||
: currentFileSystem.RenameDirectory(currentSubPath, newSubPath);
|
||||
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = currentFileSystem != newFileSystem
|
||||
res = currentFileSystem != newFileSystem
|
||||
? ResultFs.RenameToOtherFileSystem.Log()
|
||||
: currentFileSystem.RenameDirectory(currentSubPath, newSubPath);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Result GetEntryType(this FileSystemClient fs, out DirectoryEntryType type, U8Span path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out type);
|
||||
|
||||
Result rc;
|
||||
Result res;
|
||||
U8Span subPath;
|
||||
FileSystemAccessor fileSystem;
|
||||
Span<byte> logBuffer = stackalloc byte[0x300];
|
||||
@ -377,51 +377,51 @@ public static class UserFileSystem
|
||||
if (fs.Impl.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
res = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var idString = new IdString();
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogPath).Append(path).Append(LogEntryType)
|
||||
.Append(idString.ToString(AccessLogImpl.DereferenceOutValue(in type, rc)));
|
||||
.Append(idString.ToString(AccessLogImpl.DereferenceOutValue(in type, res)));
|
||||
logBuffer = sb.Buffer;
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
res = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog() && fileSystem.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fileSystem.GetEntryType(out type, subPath);
|
||||
res = fileSystem.GetEntryType(out type, subPath);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var idString = new IdString();
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogPath).Append(path).Append(LogEntryType)
|
||||
.Append(idString.ToString(AccessLogImpl.DereferenceOutValue(in type, rc)));
|
||||
.Append(idString.ToString(AccessLogImpl.DereferenceOutValue(in type, res)));
|
||||
logBuffer = sb.Buffer;
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fileSystem.GetEntryType(out type, subPath);
|
||||
res = fileSystem.GetEntryType(out type, subPath);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Result GetFreeSpaceSize(this FileSystemClient fs, out long freeSpace, U8Span path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out freeSpace);
|
||||
|
||||
Result rc;
|
||||
Result res;
|
||||
var subPath = U8Span.Empty;
|
||||
FileSystemAccessor fileSystem;
|
||||
Span<byte> logBuffer = stackalloc byte[0x300];
|
||||
@ -437,22 +437,22 @@ public static class UserFileSystem
|
||||
if (fs.Impl.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = FindImpl(fs, path, out fileSystem, ref subPath);
|
||||
res = FindImpl(fs, path, out fileSystem, ref subPath);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogPath).Append(path).Append((byte)'"').Append(LogSize)
|
||||
.AppendFormat(AccessLogImpl.DereferenceOutValue(in freeSpace, rc));
|
||||
.AppendFormat(AccessLogImpl.DereferenceOutValue(in freeSpace, res));
|
||||
logBuffer = sb.Buffer;
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = FindImpl(fs, path, out fileSystem, ref subPath);
|
||||
res = FindImpl(fs, path, out fileSystem, ref subPath);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
static Result GetImpl(out long freeSpace, FileSystemAccessor fileSystem, U8Span subPath)
|
||||
{
|
||||
@ -467,29 +467,29 @@ public static class UserFileSystem
|
||||
if (fs.Impl.IsEnabledAccessLog() && fileSystem.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = GetImpl(out freeSpace, fileSystem, subPath);
|
||||
res = GetImpl(out freeSpace, fileSystem, subPath);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogPath).Append(path).Append((byte)'"').Append(LogSize)
|
||||
.AppendFormat(AccessLogImpl.DereferenceOutValue(in freeSpace, rc));
|
||||
.AppendFormat(AccessLogImpl.DereferenceOutValue(in freeSpace, res));
|
||||
logBuffer = sb.Buffer;
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = GetImpl(out freeSpace, fileSystem, subPath);
|
||||
res = GetImpl(out freeSpace, fileSystem, subPath);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Result OpenFile(this FileSystemClient fs, out FileHandle handle, U8Span path, OpenMode mode)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out handle);
|
||||
|
||||
Result rc;
|
||||
Result res;
|
||||
U8Span subPath;
|
||||
FileSystemAccessor fileSystem;
|
||||
Span<byte> logBuffer = stackalloc byte[0x300];
|
||||
@ -497,37 +497,37 @@ public static class UserFileSystem
|
||||
if (fs.Impl.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
res = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogPath).Append(path).Append((byte)'"').Append(LogOpenMode).AppendFormat((int)mode, 'X');
|
||||
logBuffer = sb.Buffer;
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
res = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var file = new UniqueRef<FileAccessor>();
|
||||
if (fs.Impl.IsEnabledAccessLog() && fileSystem.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fileSystem.OpenFile(ref file.Ref(), subPath, mode);
|
||||
res = fileSystem.OpenFile(ref file.Ref(), subPath, mode);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, file.Get, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, file.Get, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fileSystem.OpenFile(ref file.Ref(), subPath, mode);
|
||||
res = fileSystem.OpenFile(ref file.Ref(), subPath, mode);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
handle = new FileHandle(file.Release());
|
||||
return Result.Success;
|
||||
@ -546,7 +546,7 @@ public static class UserFileSystem
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out handle);
|
||||
|
||||
Result rc;
|
||||
Result res;
|
||||
U8Span subPath;
|
||||
FileSystemAccessor fileSystem;
|
||||
Span<byte> logBuffer = stackalloc byte[0x300];
|
||||
@ -554,38 +554,38 @@ public static class UserFileSystem
|
||||
if (fs.Impl.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
res = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogPath).Append(path).Append((byte)'"').Append(LogOpenMode).AppendFormat((int)mode, 'X');
|
||||
logBuffer = sb.Buffer;
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
res = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var accessor = new UniqueRef<DirectoryAccessor>();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog() && fileSystem.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fileSystem.OpenDirectory(ref accessor.Ref(), subPath, mode);
|
||||
res = fileSystem.OpenDirectory(ref accessor.Ref(), subPath, mode);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, accessor.Get, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, accessor.Get, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fileSystem.OpenDirectory(ref accessor.Ref(), subPath, mode);
|
||||
res = fileSystem.OpenDirectory(ref accessor.Ref(), subPath, mode);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
handle = new DirectoryHandle(accessor.Release());
|
||||
return Result.Success;
|
||||
@ -594,43 +594,43 @@ public static class UserFileSystem
|
||||
private static Result CommitImpl(FileSystemClient fs, U8Span mountName,
|
||||
[CallerMemberName] string functionName = "")
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
FileSystemAccessor fileSystem;
|
||||
Span<byte> logBuffer = stackalloc byte[0x30];
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fs.Impl.Find(out fileSystem, mountName);
|
||||
res = fs.Impl.Find(out fileSystem, mountName);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogName).Append(mountName).Append((byte)'"');
|
||||
logBuffer = sb.Buffer;
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer), functionName);
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer), functionName);
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fs.Impl.Find(out fileSystem, mountName);
|
||||
res = fs.Impl.Find(out fileSystem, mountName);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog() && fileSystem.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fileSystem.Commit();
|
||||
res = fileSystem.Commit();
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(logBuffer), functionName);
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(logBuffer), functionName);
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fileSystem.Commit();
|
||||
res = fileSystem.Commit();
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Result Commit(this FileSystemClient fs, ReadOnlySpan<U8String> mountNames)
|
||||
@ -649,67 +649,67 @@ public static class UserFileSystem
|
||||
using var commitManager = new SharedRef<IMultiCommitManager>();
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenMultiCommitManager(ref commitManager.Ref());
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = fileSystemProxy.Get.OpenMultiCommitManager(ref commitManager.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
for (int i = 0; i < mountNames.Length; i++)
|
||||
{
|
||||
rc = fs.Impl.Find(out FileSystemAccessor accessor, mountNames[i]);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = fs.Impl.Find(out FileSystemAccessor accessor, mountNames[i]);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IFileSystemSf> fileSystem = accessor.GetMultiCommitTarget();
|
||||
if (!fileSystem.HasValue)
|
||||
return ResultFs.UnsupportedCommitTarget.Log();
|
||||
|
||||
rc = commitManager.Get.Add(ref fileSystem.Ref());
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = commitManager.Get.Add(ref fileSystem.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
rc = commitManager.Get.Commit();
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = commitManager.Get.Commit();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
public static Result Commit(this FileSystemClient fs, U8Span mountName, CommitOption option)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
FileSystemAccessor fileSystem;
|
||||
Span<byte> logBuffer = stackalloc byte[0x40];
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fs.Impl.Find(out fileSystem, mountName);
|
||||
res = fs.Impl.Find(out fileSystem, mountName);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogName).Append(mountName).Append(LogCommitOption).AppendFormat((int)option.Flags, 'X');
|
||||
logBuffer = sb.Buffer;
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fs.Impl.Find(out fileSystem, mountName);
|
||||
res = fs.Impl.Find(out fileSystem, mountName);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog() && fileSystem.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = RunCommit(fs, option, fileSystem);
|
||||
res = RunCommit(fs, option, fileSystem);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = RunCommit(fs, option, fileSystem);
|
||||
res = RunCommit(fs, option, fileSystem);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
|
||||
static Result RunCommit(FileSystemClient fs, CommitOption option, FileSystemAccessor fileSystem)
|
||||
{
|
||||
@ -724,8 +724,8 @@ public static class UserFileSystem
|
||||
return ResultFs.InvalidCommitOption.Log();
|
||||
}
|
||||
|
||||
Result rc = fileSystem.GetSaveDataAttribute(out SaveDataAttribute attribute);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = fileSystem.GetSaveDataAttribute(out SaveDataAttribute attribute);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (attribute.ProgramId == SaveData.InvalidProgramId)
|
||||
attribute.ProgramId = SaveData.AutoResolveCallerProgramId;
|
||||
|
@ -14,8 +14,8 @@ public static class UserFileSystemForDebug
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out timeStamp);
|
||||
|
||||
Result rc = fs.FindFileSystem(out FileSystemAccessor fileSystem, out U8Span subPath, path);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fs.FindFileSystem(out FileSystemAccessor fileSystem, out U8Span subPath, path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return fileSystem.GetFileTimeStampRaw(out timeStamp, subPath);
|
||||
}
|
||||
@ -23,8 +23,8 @@ public static class UserFileSystemForDebug
|
||||
public static Result GetFileTimeStampRawForDebug(this FileSystemClient fs, out FileTimeStampRaw timeStamp,
|
||||
U8Span path)
|
||||
{
|
||||
Result rc = fs.Impl.GetFileTimeStampRawForDebug(out timeStamp, path);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
Result res = fs.Impl.GetFileTimeStampRawForDebug(out timeStamp, path);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@ public static class UserFileSystemPrivate
|
||||
{
|
||||
public static Result CreateFile(this FileSystemClient fs, U8Span path, long size, CreateFileOptions option)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
U8Span subPath;
|
||||
FileSystemAccessor fileSystem;
|
||||
Span<byte> logBuffer = stackalloc byte[0x300];
|
||||
@ -22,65 +22,65 @@ public static class UserFileSystemPrivate
|
||||
if (fs.Impl.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
res = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogPath).Append(path).Append((byte)'"');
|
||||
logBuffer = sb.Buffer;
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
res = fs.Impl.FindFileSystem(out fileSystem, out subPath, path);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog() && fileSystem.IsEnabledAccessLog())
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fileSystem.CreateFile(subPath, size, option);
|
||||
res = fileSystem.CreateFile(subPath, size, option);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogPath).Append(path).Append((byte)'"').Append(LogSize).AppendFormat(size);
|
||||
logBuffer = sb.Buffer;
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fileSystem.CreateFile(subPath, size, option);
|
||||
res = fileSystem.CreateFile(subPath, size, option);
|
||||
}
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Result GetTotalSpaceSize(this FileSystemClient fs, out long totalSpace, U8Span path)
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out totalSpace);
|
||||
|
||||
Result rc = fs.Impl.FindFileSystem(out FileSystemAccessor fileSystem, out U8Span subPath, path);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = fs.Impl.FindFileSystem(out FileSystemAccessor fileSystem, out U8Span subPath, path);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = fileSystem.GetTotalSpaceSize(out totalSpace, subPath);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
res = fileSystem.GetTotalSpaceSize(out totalSpace, subPath);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Result SetConcatenationFileAttribute(this FileSystemClient fs, U8Span path)
|
||||
{
|
||||
Result rc = fs.Impl.FindFileSystem(out FileSystemAccessor fileSystem, out U8Span subPath, path);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = fs.Impl.FindFileSystem(out FileSystemAccessor fileSystem, out U8Span subPath, path);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = fileSystem.QueryEntry(Span<byte>.Empty, ReadOnlySpan<byte>.Empty, QueryId.SetConcatenationFileAttribute,
|
||||
res = fileSystem.QueryEntry(Span<byte>.Empty, ReadOnlySpan<byte>.Empty, QueryId.SetConcatenationFileAttribute,
|
||||
subPath);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static Result QueryUnpreparedFileInformation(this FileSystemClient fs, out UnpreparedFileInformation info,
|
||||
@ -88,13 +88,13 @@ public static class UserFileSystemPrivate
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out info);
|
||||
|
||||
Result rc = fs.Impl.FindFileSystem(out FileSystemAccessor fileSystem, out _, path);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = fs.Impl.FindFileSystem(out FileSystemAccessor fileSystem, out _, path);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = fileSystem.QueryEntry(SpanHelpers.AsByteSpan(ref info), ReadOnlySpan<byte>.Empty,
|
||||
res = fileSystem.QueryEntry(SpanHelpers.AsByteSpan(ref info), ReadOnlySpan<byte>.Empty,
|
||||
QueryId.QueryUnpreparedFileInformation, new U8Span(new[] { (byte)'/' }));
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
}
|
@ -93,8 +93,8 @@ public abstract class IStorage : IDisposable
|
||||
|
||||
public static Result CheckAccessRange(long offset, ulong size, long totalSize)
|
||||
{
|
||||
Result rc = CheckAccessRange(offset, unchecked((long)size), totalSize);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = CheckAccessRange(offset, unchecked((long)size), totalSize);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -115,17 +115,17 @@ public abstract class IStorage : IDisposable
|
||||
|
||||
public static Result CheckOffsetAndSize(long offset, ulong size)
|
||||
{
|
||||
Result rc = CheckOffsetAndSize(offset, unchecked((long)size));
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = CheckOffsetAndSize(offset, unchecked((long)size));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
public static Result CheckOffsetAndSizeWithResult(long offset, long size, Result resultOnFailure)
|
||||
{
|
||||
Result rc = CheckOffsetAndSize(offset, size);
|
||||
Result res = CheckOffsetAndSize(offset, size);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
return resultOnFailure.Log();
|
||||
|
||||
return Result.Success;
|
||||
@ -133,9 +133,9 @@ public abstract class IStorage : IDisposable
|
||||
|
||||
public static Result CheckOffsetAndSizeWithResult(long offset, ulong size, Result resultOnFailure)
|
||||
{
|
||||
Result rc = CheckOffsetAndSize(offset, size);
|
||||
Result res = CheckOffsetAndSize(offset, size);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
return resultOnFailure.Log();
|
||||
|
||||
return Result.Success;
|
||||
|
@ -22,8 +22,8 @@ public class MemoryStorage : IStorage
|
||||
if (destination.Length == 0)
|
||||
return Result.Success;
|
||||
|
||||
Result rc = CheckAccessRange(offset, destination.Length, _storageBuffer.Length);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = CheckAccessRange(offset, destination.Length, _storageBuffer.Length);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
_storageBuffer.AsSpan((int)offset, destination.Length).CopyTo(destination);
|
||||
|
||||
@ -35,8 +35,8 @@ public class MemoryStorage : IStorage
|
||||
if (source.Length == 0)
|
||||
return Result.Success;
|
||||
|
||||
Result rc = CheckAccessRange(offset, source.Length, _storageBuffer.Length);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = CheckAccessRange(offset, source.Length, _storageBuffer.Length);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
source.CopyTo(_storageBuffer.AsSpan((int)offset));
|
||||
|
||||
|
@ -97,8 +97,8 @@ public class ReadOnlyFileSystem : IFileSystem
|
||||
return ResultFs.InvalidModeForFileOpen.Log();
|
||||
|
||||
using var baseFile = new UniqueRef<IFile>();
|
||||
Result rc = _baseFileSystem.Get.OpenFile(ref baseFile.Ref(), in path, mode);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = _baseFileSystem.Get.OpenFile(ref baseFile.Ref(), in path, mode);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outFile.Reset(new ReadOnlyFile(ref baseFile.Ref()));
|
||||
return Result.Success;
|
||||
|
@ -20,12 +20,12 @@ public static class Application
|
||||
{
|
||||
public static Result MountApplicationPackage(this FileSystemClient fs, U8Span mountName, U8Span path)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = Mount(fs, mountName, path);
|
||||
res = Mount(fs, mountName, path);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
Span<byte> logBuffer = stackalloc byte[0x300];
|
||||
@ -34,15 +34,15 @@ public static class Application
|
||||
sb.Append(LogName).Append(mountName).Append(LogQuote)
|
||||
.Append(LogPath).Append(path).Append(LogQuote);
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = Mount(fs, mountName, path);
|
||||
res = Mount(fs, mountName, path);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -51,18 +51,18 @@ public static class Application
|
||||
|
||||
static Result Mount(FileSystemClient fs, U8Span mountName, U8Span path)
|
||||
{
|
||||
Result rc = fs.Impl.CheckMountName(mountName);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = fs.Impl.CheckMountName(mountName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = PathUtility.ConvertToFspPath(out FspPath sfPath, path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = PathUtility.ConvertToFspPath(out FspPath sfPath, path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
rc = fileSystemProxy.Get.OpenFileSystemWithId(ref fileSystem.Ref(), in sfPath,
|
||||
res = fileSystemProxy.Get.OpenFileSystemWithId(ref fileSystem.Ref(), in sfPath,
|
||||
Ncm.ProgramId.InvalidId.Value, FileSystemProxyType.Package);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystemAdapter =
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref()));
|
||||
@ -70,8 +70,8 @@ public static class Application
|
||||
if (!fileSystemAdapter.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInApplicationA.Log();
|
||||
|
||||
rc = fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -19,8 +19,8 @@ public static class BaseFileSystem
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenBaseFileSystem(ref outFileSystem, fileSystemId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenBaseFileSystem(ref outFileSystem, fileSystemId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -31,26 +31,26 @@ public static class BaseFileSystem
|
||||
using var fileSystemAdapter =
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref()));
|
||||
|
||||
Result rc = fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
public static Result MountBaseFileSystem(this FileSystemClient fs, U8Span mountName, BaseFileSystemId fileSystemId)
|
||||
{
|
||||
Result rc = fs.Impl.CheckMountName(mountName);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fs.Impl.CheckMountName(mountName);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
rc = OpenBaseFileSystem(fs, ref fileSystem.Ref(), fileSystemId);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = OpenBaseFileSystem(fs, ref fileSystem.Ref(), fileSystemId);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = RegisterFileSystem(fs, mountName, ref fileSystem.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = RegisterFileSystem(fs, mountName, ref fileSystem.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -59,9 +59,9 @@ public static class BaseFileSystem
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.FormatBaseFileSystem(fileSystemId);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.FormatBaseFileSystem(fileSystemId);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -23,12 +23,12 @@ public static class BcatSaveData
|
||||
public static Result MountBcatSaveData(this FileSystemClient fs, U8Span mountName,
|
||||
Ncm.ApplicationId applicationId)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = Mount(fs, mountName, applicationId);
|
||||
res = Mount(fs, mountName, applicationId);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
Span<byte> logBuffer = stackalloc byte[0x50];
|
||||
@ -37,15 +37,15 @@ public static class BcatSaveData
|
||||
sb.Append(LogName).Append(mountName).Append(LogQuote)
|
||||
.Append(LogApplicationId).AppendFormat(applicationId.Value, 'X');
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = Mount(fs, mountName, applicationId);
|
||||
res = Mount(fs, mountName, applicationId);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -54,19 +54,19 @@ public static class BcatSaveData
|
||||
|
||||
static Result Mount(FileSystemClient fs, U8Span mountName, Ncm.ApplicationId applicationId)
|
||||
{
|
||||
Result rc = fs.Impl.CheckMountName(mountName);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = fs.Impl.CheckMountName(mountName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
rc = SaveDataAttribute.Make(out SaveDataAttribute attribute, applicationId, SaveDataType.Bcat,
|
||||
res = SaveDataAttribute.Make(out SaveDataAttribute attribute, applicationId, SaveDataType.Bcat,
|
||||
InvalidUserId, InvalidSystemSaveDataId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
rc = fileSystemProxy.Get.OpenSaveDataFileSystem(ref fileSystem.Ref(), SaveDataSpaceId.User, in attribute);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = fileSystemProxy.Get.OpenSaveDataFileSystem(ref fileSystem.Ref(), SaveDataSpaceId.User, in attribute);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystemAdapter =
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref()));
|
||||
@ -74,8 +74,8 @@ public static class BcatSaveData
|
||||
if (!fileSystemAdapter.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInBcatSaveDataA.Log();
|
||||
|
||||
rc = fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -55,12 +55,12 @@ public static class Bis
|
||||
private static Result MountBis(this FileSystemClientImpl fs, U8Span mountName, BisPartitionId partitionId,
|
||||
U8Span rootPath)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
|
||||
if (fs.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = Mount(fs, mountName, partitionId);
|
||||
res = Mount(fs, mountName, partitionId);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
Span<byte> logBuffer = stackalloc byte[0x300];
|
||||
@ -71,15 +71,15 @@ public static class Bis
|
||||
.Append(LogBisPartitionId).Append(idString.ToString(partitionId))
|
||||
.Append(LogPath).Append(rootPath).Append(LogQuote);
|
||||
|
||||
fs.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = Mount(fs, mountName, partitionId);
|
||||
res = Mount(fs, mountName, partitionId);
|
||||
}
|
||||
|
||||
fs.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
fs.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -88,8 +88,8 @@ public static class Bis
|
||||
|
||||
static Result Mount(FileSystemClientImpl fs, U8Span mountName, BisPartitionId partitionId)
|
||||
{
|
||||
Result rc = fs.CheckMountNameAcceptingReservedMountName(mountName);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fs.CheckMountNameAcceptingReservedMountName(mountName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.GetFileSystemProxyServiceObject();
|
||||
|
||||
@ -98,8 +98,8 @@ public static class Bis
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
rc = fileSystemProxy.Get.OpenBisFileSystem(ref fileSystem.Ref(), in sfPath, partitionId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fileSystemProxy.Get.OpenBisFileSystem(ref fileSystem.Ref(), in sfPath, partitionId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var mountNameGenerator =
|
||||
new UniqueRef<ICommonMountNameGenerator>(new BisCommonMountNameGenerator(partitionId));
|
||||
@ -113,8 +113,8 @@ public static class Bis
|
||||
if (!fileSystemAdapter.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInBisB.Log();
|
||||
|
||||
rc = fs.Fs.Register(mountName, ref fileSystemAdapter.Ref(), ref mountNameGenerator.Ref());
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fs.Fs.Register(mountName, ref fileSystemAdapter.Ref(), ref mountNameGenerator.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -170,17 +170,17 @@ public static class Bis
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var storage = new SharedRef<IStorageSf>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenBisStorage(ref storage.Ref(), partitionId);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenBisStorage(ref storage.Ref(), partitionId);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var storageAdapter = new UniqueRef<IStorage>(new StorageServiceObjectAdapter(ref storage.Ref()));
|
||||
|
||||
if (!storageAdapter.HasValue)
|
||||
{
|
||||
rc = ResultFs.AllocationMemoryFailedInBisC.Value;
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Log();
|
||||
res = ResultFs.AllocationMemoryFailedInBisC.Value;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Log();
|
||||
}
|
||||
|
||||
outPartitionStorage.Set(ref storageAdapter.Ref());
|
||||
@ -191,9 +191,9 @@ public static class Bis
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.InvalidateBisCache();
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.InvalidateBisCache();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -22,11 +22,11 @@ public static class Code
|
||||
public static Result MountCode(this FileSystemClient fs, out CodeVerificationData verificationData,
|
||||
U8Span mountName, U8Span path, ProgramId programId)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = Mount(fs, out verificationData, mountName, path, programId);
|
||||
res = Mount(fs, out verificationData, mountName, path, programId);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
Span<byte> logBuffer = stackalloc byte[0x300];
|
||||
@ -36,15 +36,15 @@ public static class Code
|
||||
.Append(LogPath).Append(path).Append(LogQuote)
|
||||
.Append(LogProgramId).AppendFormat(programId.Value, 'X');
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = Mount(fs, out verificationData, mountName, path, programId);
|
||||
res = Mount(fs, out verificationData, mountName, path, programId);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -56,24 +56,24 @@ public static class Code
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out verificationData);
|
||||
|
||||
Result rc = fs.Impl.CheckMountName(mountName);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = fs.Impl.CheckMountName(mountName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = PathUtility.ConvertToFspPath(out FspPath sfPath, path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = PathUtility.ConvertToFspPath(out FspPath sfPath, path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IFileSystemProxyForLoader> fileSystemProxy =
|
||||
fs.Impl.GetFileSystemProxyForLoaderServiceObject();
|
||||
|
||||
// Todo: IPC code should automatically set process ID
|
||||
rc = fileSystemProxy.Get.SetCurrentProcess(fs.Hos.Os.GetCurrentProcessId().Value);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fileSystemProxy.Get.SetCurrentProcess(fs.Hos.Os.GetCurrentProcessId().Value);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
rc = fileSystemProxy.Get.OpenCodeFileSystem(ref fileSystem.Ref(), out verificationData, in sfPath,
|
||||
res = fileSystemProxy.Get.OpenCodeFileSystem(ref fileSystem.Ref(), out verificationData, in sfPath,
|
||||
programId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystemAdapter =
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref()));
|
||||
@ -81,8 +81,8 @@ public static class Code
|
||||
if (!fileSystemAdapter.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInCodeA.Log();
|
||||
|
||||
rc = fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -37,19 +37,19 @@ public static class Content
|
||||
private static Result MountContentImpl(FileSystemClient fs, U8Span mountName, U8Span path, ulong id,
|
||||
ContentType contentType)
|
||||
{
|
||||
Result rc = fs.Impl.CheckMountNameAcceptingReservedMountName(mountName);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = fs.Impl.CheckMountNameAcceptingReservedMountName(mountName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
FileSystemProxyType fsType = ConvertToFileSystemProxyType(contentType);
|
||||
|
||||
rc = PathUtility.ConvertToFspPath(out FspPath sfPath, path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = PathUtility.ConvertToFspPath(out FspPath sfPath, path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
rc = fileSystemProxy.Get.OpenFileSystemWithId(ref fileSystem.Ref(), in sfPath, id, fsType);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = fileSystemProxy.Get.OpenFileSystemWithId(ref fileSystem.Ref(), in sfPath, id, fsType);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystemAdapter =
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref()));
|
||||
@ -57,21 +57,21 @@ public static class Content
|
||||
if (!fileSystemAdapter.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInContentA.Log();
|
||||
|
||||
rc = fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
public static Result MountContent(this FileSystemClient fs, U8Span mountName, U8Span path, ContentType contentType)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x300];
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = PreMount(contentType);
|
||||
res = PreMount(contentType);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var idString = new IdString();
|
||||
@ -81,22 +81,22 @@ public static class Content
|
||||
.Append(LogPath).Append(path).Append(LogQuote)
|
||||
.Append(LogContentType).Append(idString.ToString(contentType));
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = PreMount(contentType);
|
||||
res = PreMount(contentType);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
ProgramId programId = default;
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = MountContentImpl(fs, mountName, path, programId.Value, contentType);
|
||||
res = MountContentImpl(fs, mountName, path, programId.Value, contentType);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var idString = new IdString();
|
||||
@ -107,15 +107,15 @@ public static class Content
|
||||
.Append(LogProgramId).AppendFormat(programId.Value, 'X')
|
||||
.Append(LogContentType).Append(idString.ToString(contentType));
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = MountContentImpl(fs, mountName, path, programId.Value, contentType);
|
||||
res = MountContentImpl(fs, mountName, path, programId.Value, contentType);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -134,13 +134,13 @@ public static class Content
|
||||
public static Result MountContent(this FileSystemClient fs, U8Span mountName, U8Span path, ProgramId programId,
|
||||
ContentType contentType)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x300];
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = MountContentImpl(fs, mountName, path, programId.Value, contentType);
|
||||
res = MountContentImpl(fs, mountName, path, programId.Value, contentType);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var idString = new IdString();
|
||||
@ -153,15 +153,15 @@ public static class Content
|
||||
|
||||
logBuffer = sb.Buffer;
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = MountContentImpl(fs, mountName, path, programId.Value, contentType);
|
||||
res = MountContentImpl(fs, mountName, path, programId.Value, contentType);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -172,13 +172,13 @@ public static class Content
|
||||
public static Result MountContent(this FileSystemClient fs, U8Span mountName, U8Span path, DataId dataId,
|
||||
ContentType contentType)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x300];
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = MountContentImpl(fs, mountName, path, dataId.Value, contentType);
|
||||
res = MountContentImpl(fs, mountName, path, dataId.Value, contentType);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var idString = new IdString();
|
||||
@ -189,15 +189,15 @@ public static class Content
|
||||
.Append(LogDataId).AppendFormat(dataId.Value, 'X')
|
||||
.Append(LogContentType).Append(idString.ToString(contentType));
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = MountContentImpl(fs, mountName, path, dataId.Value, contentType);
|
||||
res = MountContentImpl(fs, mountName, path, dataId.Value, contentType);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -208,13 +208,13 @@ public static class Content
|
||||
public static Result MountContent(this FileSystemClient fs, U8Span mountName, ProgramId programId,
|
||||
ContentType contentType)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x300];
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = Mount(fs, mountName, programId, contentType);
|
||||
res = Mount(fs, mountName, programId, contentType);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var idString = new IdString();
|
||||
@ -224,15 +224,15 @@ public static class Content
|
||||
.Append(LogProgramId).AppendFormat(programId.Value, 'X')
|
||||
.Append(LogContentType).Append(idString.ToString(contentType));
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = Mount(fs, mountName, programId, contentType);
|
||||
res = Mount(fs, mountName, programId, contentType);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -241,16 +241,16 @@ public static class Content
|
||||
|
||||
static Result Mount(FileSystemClient fs, U8Span mountName, ProgramId programId, ContentType contentType)
|
||||
{
|
||||
Result rc = fs.Impl.CheckMountNameAcceptingReservedMountName(mountName);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = fs.Impl.CheckMountNameAcceptingReservedMountName(mountName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
FileSystemProxyType fsType = ConvertToFileSystemProxyType(contentType);
|
||||
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
rc = fileSystemProxy.Get.OpenFileSystemWithPatch(ref fileSystem.Ref(), programId, fsType);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = fileSystemProxy.Get.OpenFileSystemWithPatch(ref fileSystem.Ref(), programId, fsType);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystemAdapter =
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref()));
|
||||
@ -258,8 +258,8 @@ public static class Content
|
||||
if (!fileSystemAdapter.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInContentA.Log();
|
||||
|
||||
rc = fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -56,13 +56,13 @@ public static class ContentStorage
|
||||
|
||||
public static Result MountContentStorage(this FileSystemClient fs, U8Span mountName, ContentStorageId storageId)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x40];
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = Mount(fs, mountName, storageId);
|
||||
res = Mount(fs, mountName, storageId);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var idString = new IdString();
|
||||
@ -71,15 +71,15 @@ public static class ContentStorage
|
||||
sb.Append(LogName).Append(mountName).Append(LogQuote)
|
||||
.Append(LogContentStorageId).Append(idString.ToString(storageId));
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = Mount(fs, mountName, storageId);
|
||||
res = Mount(fs, mountName, storageId);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -93,26 +93,26 @@ public static class ContentStorage
|
||||
const int maxRetries = 10;
|
||||
const int retryInterval = 1000;
|
||||
|
||||
Result rc = fs.Impl.CheckMountNameAcceptingReservedMountName(mountName);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = fs.Impl.CheckMountNameAcceptingReservedMountName(mountName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
for (int i = 0; i < maxRetries; i++)
|
||||
{
|
||||
rc = fileSystemProxy.Get.OpenContentStorageFileSystem(ref fileSystem.Ref(), storageId);
|
||||
res = fileSystemProxy.Get.OpenContentStorageFileSystem(ref fileSystem.Ref(), storageId);
|
||||
|
||||
if (rc.IsSuccess())
|
||||
if (res.IsSuccess())
|
||||
break;
|
||||
|
||||
if (!ResultFs.SystemPartitionNotReady.Includes(rc))
|
||||
return rc;
|
||||
if (!ResultFs.SystemPartitionNotReady.Includes(res))
|
||||
return res;
|
||||
|
||||
// Note: Nintendo has an off-by-one error where they check if
|
||||
// "i == maxRetries" instead of "i == maxRetries - 1"
|
||||
if (i == maxRetries - 1)
|
||||
return rc;
|
||||
return res;
|
||||
|
||||
fs.Hos.Os.SleepThread(TimeSpan.FromMilliSeconds(retryInterval));
|
||||
}
|
||||
@ -129,8 +129,8 @@ public static class ContentStorage
|
||||
if (!mountNameGenerator.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInContentStorageB.Log();
|
||||
|
||||
rc = fs.Register(mountName, ref fileSystemAdapter.Ref(), ref mountNameGenerator.Ref());
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fs.Register(mountName, ref fileSystemAdapter.Ref(), ref mountNameGenerator.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -32,29 +32,29 @@ public static class CustomStorage
|
||||
|
||||
public static Result MountCustomStorage(this FileSystemClient fs, U8Span mountName, CustomStorageId storageId)
|
||||
{
|
||||
Result rc = Mount(fs, mountName, storageId);
|
||||
Result res = Mount(fs, mountName, storageId);
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
|
||||
static Result Mount(FileSystemClient fs, U8Span mountName, CustomStorageId storageId)
|
||||
{
|
||||
Result rc = fs.Impl.CheckMountName(mountName);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fs.Impl.CheckMountName(mountName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
rc = fileSystemProxy.Get.OpenCustomStorageFileSystem(ref fileSystem.Ref(), storageId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fileSystemProxy.Get.OpenCustomStorageFileSystem(ref fileSystem.Ref(), storageId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystemAdapter =
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref()));
|
||||
|
||||
rc = fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -24,9 +24,9 @@ public static class DebugShim
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.CreatePaddingFile(size);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.CreatePaddingFile(size);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -35,9 +35,9 @@ public static class DebugShim
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.DeleteAllPaddingFiles();
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.DeleteAllPaddingFiles();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -47,9 +47,9 @@ public static class DebugShim
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OverrideSaveDataTransferTokenSignVerificationKey(new InBuffer(keyBuffer));
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OverrideSaveDataTransferTokenSignVerificationKey(new InBuffer(keyBuffer));
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -58,9 +58,9 @@ public static class DebugShim
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.RegisterDebugConfiguration((uint)key, value);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.RegisterDebugConfiguration((uint)key, value);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -69,9 +69,9 @@ public static class DebugShim
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.UnregisterDebugConfiguration((uint)key);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.UnregisterDebugConfiguration((uint)key);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -29,9 +29,9 @@ public static class DeviceSaveData
|
||||
|
||||
public Result GetSaveDataAttribute(out SaveDataAttribute attribute)
|
||||
{
|
||||
Result rc = SaveDataAttribute.Make(out attribute, _programId, SaveDataType.Device, InvalidUserId,
|
||||
Result res = SaveDataAttribute.Make(out attribute, _programId, SaveDataType.Device, InvalidUserId,
|
||||
InvalidSystemSaveDataId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -42,14 +42,14 @@ public static class DeviceSaveData
|
||||
private static Result MountDeviceSaveDataImpl(this FileSystemClientImpl fs, U8Span mountName,
|
||||
in SaveDataAttribute attribute)
|
||||
{
|
||||
Result rc = fs.CheckMountName(mountName);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = fs.CheckMountName(mountName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.GetFileSystemProxyServiceObject();
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
rc = fileSystemProxy.Get.OpenSaveDataFileSystem(ref fileSystem.Ref(), DeviceSaveDataSpaceId, in attribute);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fileSystemProxy.Get.OpenSaveDataFileSystem(ref fileSystem.Ref(), DeviceSaveDataSpaceId, in attribute);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
var fileSystemAdapterRaw = new FileSystemServiceObjectAdapter(ref fileSystem.Ref());
|
||||
using var fileSystemAdapter = new UniqueRef<IFileSystem>(fileSystemAdapterRaw);
|
||||
@ -62,10 +62,10 @@ public static class DeviceSaveData
|
||||
|
||||
using var mountNameGenerator = new UniqueRef<ICommonMountNameGenerator>();
|
||||
|
||||
rc = fs.Fs.Register(mountName, fileSystemAdapterRaw, ref fileSystemAdapter.Ref(), ref mountNameGenerator.Ref(),
|
||||
res = fs.Fs.Register(mountName, fileSystemAdapterRaw, ref fileSystemAdapter.Ref(), ref mountNameGenerator.Ref(),
|
||||
ref saveDataAttributeGetter.Ref(), useDataCache: false, storageForPurgeFileDataCache: null,
|
||||
usePathCache: true);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -74,30 +74,30 @@ public static class DeviceSaveData
|
||||
{
|
||||
Span<byte> logBuffer = stackalloc byte[0x30];
|
||||
|
||||
Result rc = SaveDataAttribute.Make(out SaveDataAttribute attribute, InvalidProgramId, SaveDataType.Device,
|
||||
Result res = SaveDataAttribute.Make(out SaveDataAttribute attribute, InvalidProgramId, SaveDataType.Device,
|
||||
InvalidUserId, InvalidSystemSaveDataId);
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = MountDeviceSaveDataImpl(fs.Impl, mountName, in attribute);
|
||||
res = MountDeviceSaveDataImpl(fs.Impl, mountName, in attribute);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogName).Append(mountName).Append(LogQuote);
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = MountDeviceSaveDataImpl(fs.Impl, mountName, in attribute);
|
||||
res = MountDeviceSaveDataImpl(fs.Impl, mountName, in attribute);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -110,31 +110,31 @@ public static class DeviceSaveData
|
||||
{
|
||||
Span<byte> logBuffer = stackalloc byte[0x50];
|
||||
|
||||
Result rc = SaveDataAttribute.Make(out SaveDataAttribute attribute, applicationId, SaveDataType.Device,
|
||||
Result res = SaveDataAttribute.Make(out SaveDataAttribute attribute, applicationId, SaveDataType.Device,
|
||||
InvalidUserId, InvalidSystemSaveDataId);
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = MountDeviceSaveDataImpl(fs.Impl, mountName, in attribute);
|
||||
res = MountDeviceSaveDataImpl(fs.Impl, mountName, in attribute);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogName).Append(mountName).Append(LogQuote)
|
||||
.Append(LogApplicationId).AppendFormat(applicationId.Value, 'X');
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = MountDeviceSaveDataImpl(fs.Impl, mountName, in attribute);
|
||||
res = MountDeviceSaveDataImpl(fs.Impl, mountName, in attribute);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -149,7 +149,7 @@ public static class DeviceSaveData
|
||||
|
||||
public static bool IsDeviceSaveDataExisting(this FileSystemClient fs, ApplicationId applicationId)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x30];
|
||||
|
||||
bool exists;
|
||||
@ -158,21 +158,21 @@ public static class DeviceSaveData
|
||||
if (fs.Impl.IsEnabledAccessLog() && fs.Impl.IsEnabledHandleAccessLog(null))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fs.Impl.IsSaveDataExisting(out exists, appId, SaveDataType.Device, InvalidUserId);
|
||||
res = fs.Impl.IsSaveDataExisting(out exists, appId, SaveDataType.Device, InvalidUserId);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogApplicationId).AppendFormat(applicationId.Value, 'X');
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fs.Impl.IsSaveDataExisting(out exists, appId, SaveDataType.Device, InvalidUserId);
|
||||
res = fs.Impl.IsSaveDataExisting(out exists, appId, SaveDataType.Device, InvalidUserId);
|
||||
}
|
||||
|
||||
fs.Impl.LogResultErrorMessage(rc);
|
||||
Abort.DoAbortUnless(rc.IsSuccess());
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
|
||||
return exists;
|
||||
}
|
||||
|
@ -14,9 +14,9 @@ public static class ErrorInfo
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.GetAndClearErrorInfo(out outErrorInfo);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.GetAndClearErrorInfo(out outErrorInfo);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -61,11 +61,11 @@ public static class FileSystemProxyServiceObject
|
||||
}
|
||||
|
||||
using var fileSystemProxy = new SharedRef<IFileSystemProxy>();
|
||||
Result rc = fs.Hos.Sm.GetService(ref fileSystemProxy.Ref(), "fsp-srv");
|
||||
Result res = fs.Hos.Sm.GetService(ref fileSystemProxy.Ref(), "fsp-srv");
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
throw new HorizonResultException(rc, "Failed to get file system proxy service object.");
|
||||
throw new HorizonResultException(res, "Failed to get file system proxy service object.");
|
||||
}
|
||||
|
||||
fileSystemProxy.Get.SetCurrentProcess(fs.Hos.Os.GetCurrentProcessId().Value).IgnoreResult();
|
||||
@ -92,11 +92,11 @@ public static class FileSystemProxyServiceObject
|
||||
FileSystemClientImpl fs)
|
||||
{
|
||||
using var fileSystemProxy = new SharedRef<IFileSystemProxyForLoader>();
|
||||
Result rc = fs.Hos.Sm.GetService(ref fileSystemProxy.Ref(), "fsp-ldr");
|
||||
Result res = fs.Hos.Sm.GetService(ref fileSystemProxy.Ref(), "fsp-ldr");
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
throw new HorizonResultException(rc, "Failed to get file system proxy service object.");
|
||||
throw new HorizonResultException(res, "Failed to get file system proxy service object.");
|
||||
}
|
||||
|
||||
fileSystemProxy.Get.SetCurrentProcess(fs.Hos.Os.GetCurrentProcessId().Value).IgnoreResult();
|
||||
@ -121,11 +121,11 @@ public static class FileSystemProxyServiceObject
|
||||
private static SharedRef<IProgramRegistry> GetProgramRegistryServiceObjectImpl(FileSystemClientImpl fs)
|
||||
{
|
||||
using var registry = new SharedRef<IProgramRegistry>();
|
||||
Result rc = fs.Hos.Sm.GetService(ref registry.Ref(), "fsp-pr");
|
||||
Result res = fs.Hos.Sm.GetService(ref registry.Ref(), "fsp-pr");
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
throw new HorizonResultException(rc, "Failed to get registry service object.");
|
||||
throw new HorizonResultException(res, "Failed to get registry service object.");
|
||||
}
|
||||
|
||||
registry.Get.SetCurrentProcess(fs.Hos.Os.GetCurrentProcessId().Value).IgnoreResult();
|
||||
|
@ -150,70 +150,70 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
||||
|
||||
protected override Result DoCreateFile(in Path path, long size, CreateFileOptions option)
|
||||
{
|
||||
Result rc = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return _baseFs.Get.CreateFile(in sfPath, size, (int)option);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteFile(in Path path)
|
||||
{
|
||||
Result rc = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return _baseFs.Get.DeleteFile(in sfPath);
|
||||
}
|
||||
|
||||
protected override Result DoCreateDirectory(in Path path)
|
||||
{
|
||||
Result rc = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return _baseFs.Get.CreateDirectory(in sfPath);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectory(in Path path)
|
||||
{
|
||||
Result rc = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return _baseFs.Get.DeleteDirectory(in sfPath);
|
||||
}
|
||||
|
||||
protected override Result DoDeleteDirectoryRecursively(in Path path)
|
||||
{
|
||||
Result rc = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return _baseFs.Get.DeleteDirectoryRecursively(in sfPath);
|
||||
}
|
||||
|
||||
protected override Result DoCleanDirectoryRecursively(in Path path)
|
||||
{
|
||||
Result rc = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return _baseFs.Get.CleanDirectoryRecursively(in sfPath);
|
||||
}
|
||||
|
||||
protected override Result DoRenameFile(in Path currentPath, in Path newPath)
|
||||
{
|
||||
Result rc = GetPathForServiceObject(out PathSf currentSfPath, in currentPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetPathForServiceObject(out PathSf currentSfPath, in currentPath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = GetPathForServiceObject(out PathSf newSfPath, in newPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = GetPathForServiceObject(out PathSf newSfPath, in newPath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return _baseFs.Get.RenameFile(in currentSfPath, in newSfPath);
|
||||
}
|
||||
|
||||
protected override Result DoRenameDirectory(in Path currentPath, in Path newPath)
|
||||
{
|
||||
Result rc = GetPathForServiceObject(out PathSf currentSfPath, in currentPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetPathForServiceObject(out PathSf currentSfPath, in currentPath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = GetPathForServiceObject(out PathSf newSfPath, in newPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = GetPathForServiceObject(out PathSf newSfPath, in newPath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return _baseFs.Get.RenameDirectory(in currentSfPath, in newSfPath);
|
||||
}
|
||||
@ -222,8 +222,8 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out entryType);
|
||||
|
||||
Result rc = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
ref uint sfEntryType = ref Unsafe.As<DirectoryEntryType, uint>(ref entryType);
|
||||
|
||||
@ -234,8 +234,8 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out freeSpace);
|
||||
|
||||
Result rc = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return _baseFs.Get.GetFreeSpaceSize(out freeSpace, in sfPath);
|
||||
}
|
||||
@ -244,21 +244,21 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out totalSpace);
|
||||
|
||||
Result rc = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return _baseFs.Get.GetTotalSpaceSize(out totalSpace, in sfPath);
|
||||
}
|
||||
|
||||
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, in Path path, OpenMode mode)
|
||||
{
|
||||
Result rc = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileServiceObject = new SharedRef<IFileSf>();
|
||||
|
||||
rc = _baseFs.Get.OpenFile(ref fileServiceObject.Ref(), in sfPath, (uint)mode);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _baseFs.Get.OpenFile(ref fileServiceObject.Ref(), in sfPath, (uint)mode);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outFile.Reset(new FileServiceObjectAdapter(ref fileServiceObject.Ref()));
|
||||
return Result.Success;
|
||||
@ -267,13 +267,13 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
||||
protected override Result DoOpenDirectory(ref UniqueRef<IDirectory> outDirectory, in Path path,
|
||||
OpenDirectoryMode mode)
|
||||
{
|
||||
Result rc = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var directoryServiceObject = new SharedRef<IDirectorySf>();
|
||||
|
||||
rc = _baseFs.Get.OpenDirectory(ref directoryServiceObject.Ref(), in sfPath, (uint)mode);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _baseFs.Get.OpenDirectory(ref directoryServiceObject.Ref(), in sfPath, (uint)mode);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outDirectory.Reset(new DirectoryServiceObjectAdapter(ref directoryServiceObject.Ref()));
|
||||
return Result.Success;
|
||||
@ -288,8 +288,8 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out timeStamp);
|
||||
|
||||
Result rc = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return _baseFs.Get.GetFileTimeStampRaw(out timeStamp, in sfPath);
|
||||
}
|
||||
@ -297,8 +297,8 @@ internal class FileSystemServiceObjectAdapter : IFileSystem, IMultiCommitTarget
|
||||
protected override Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
|
||||
in Path path)
|
||||
{
|
||||
Result rc = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetPathForServiceObject(out PathSf sfPath, in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return _baseFs.Get.QueryEntry(new OutBuffer(outBuffer), new InBuffer(inBuffer), (int)queryId, in sfPath);
|
||||
}
|
||||
|
@ -84,13 +84,13 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.GetGameCardHandle(out GameCardHandle handle);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.GetGameCardHandle(out GameCardHandle handle);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outHandle = handle;
|
||||
return Result.Success;
|
||||
@ -99,13 +99,13 @@ public static class GameCard
|
||||
public static Result MountGameCardPartition(this FileSystemClient fs, U8Span mountName, GameCardHandle handle,
|
||||
GameCardPartition partitionId)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x60];
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = Mount(fs, mountName, handle, partitionId);
|
||||
res = Mount(fs, mountName, handle, partitionId);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var idString = new IdString();
|
||||
@ -115,15 +115,15 @@ public static class GameCard
|
||||
.Append(LogGameCardHandle).AppendFormat(handle, 'X')
|
||||
.Append(LogGameCardPartition).Append(idString.ToString(partitionId));
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = Mount(fs, mountName, handle, partitionId);
|
||||
res = Mount(fs, mountName, handle, partitionId);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -132,14 +132,14 @@ public static class GameCard
|
||||
|
||||
static Result Mount(FileSystemClient fs, U8Span mountName, GameCardHandle handle, GameCardPartition partitionId)
|
||||
{
|
||||
Result rc = fs.Impl.CheckMountNameAcceptingReservedMountName(mountName);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fs.Impl.CheckMountNameAcceptingReservedMountName(mountName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
rc = fileSystemProxy.Get.OpenGameCardFileSystem(ref fileSystem.Ref(), handle, partitionId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fileSystemProxy.Get.OpenGameCardFileSystem(ref fileSystem.Ref(), handle, partitionId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystemAdapter =
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref()));
|
||||
@ -162,13 +162,13 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.LogResultErrorMessage(rc);
|
||||
Abort.DoAbortUnless(rc.IsSuccess());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
|
||||
rc = deviceOperator.Get.IsGameCardInserted(out bool isInserted);
|
||||
fs.Impl.LogResultErrorMessage(rc);
|
||||
Abort.DoAbortUnless(rc.IsSuccess());
|
||||
res = deviceOperator.Get.IsGameCardInserted(out bool isInserted);
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
|
||||
return isInserted;
|
||||
}
|
||||
@ -179,9 +179,9 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var storage = new SharedRef<IStorageSf>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenGameCardStorage(ref storage.Ref(), handle, partitionType);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenGameCardStorage(ref storage.Ref(), handle, partitionType);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var storageAdapter = new UniqueRef<IStorage>(new StorageServiceObjectAdapter(ref storage.Ref()));
|
||||
|
||||
@ -197,13 +197,13 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.EraseGameCard((uint)cardSize, romAreaStartPageAddress);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.EraseGameCard((uint)cardSize, romAreaStartPageAddress);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -216,13 +216,13 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.GetGameCardUpdatePartitionInfo(out uint cupVersion, out ulong cupId, handle);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.GetGameCardUpdatePartitionInfo(out uint cupVersion, out ulong cupId, handle);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outPartitionInfo.CupVersion = cupVersion;
|
||||
outPartitionInfo.CupId = cupId;
|
||||
@ -235,13 +235,13 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.LogResultErrorMessage(rc);
|
||||
Abort.DoAbortUnless(rc.IsSuccess());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
|
||||
rc = deviceOperator.Get.FinalizeGameCardDriver();
|
||||
fs.Impl.LogResultErrorMessage(rc);
|
||||
Abort.DoAbortUnless(rc.IsSuccess());
|
||||
res = deviceOperator.Get.FinalizeGameCardDriver();
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
}
|
||||
|
||||
public static Result GetGameCardAttribute(this FileSystemClient fs, out GameCardAttribute outAttribute,
|
||||
@ -252,13 +252,13 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.GetGameCardAttribute(out byte gameCardAttribute, handle);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.GetGameCardAttribute(out byte gameCardAttribute, handle);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outAttribute = (GameCardAttribute)gameCardAttribute;
|
||||
|
||||
@ -273,13 +273,13 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.GetGameCardCompatibilityType(out byte gameCardCompatibilityType, handle);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.GetGameCardCompatibilityType(out byte gameCardCompatibilityType, handle);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outCompatibilityType = (GameCardCompatibilityType)gameCardCompatibilityType;
|
||||
|
||||
@ -292,13 +292,13 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.GetGameCardDeviceCertificate(new OutBuffer(outBuffer), outBuffer.Length, handle);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.GetGameCardDeviceCertificate(new OutBuffer(outBuffer), outBuffer.Length, handle);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -309,14 +309,14 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.ChallengeCardExistence(new OutBuffer(responseBuffer), new InBuffer(challengeSeedBuffer),
|
||||
res = deviceOperator.Get.ChallengeCardExistence(new OutBuffer(responseBuffer), new InBuffer(challengeSeedBuffer),
|
||||
new InBuffer(challengeValueBuffer), handle);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -329,16 +329,16 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Unsafe.SkipInit(out RmaInformation rmaInformation);
|
||||
|
||||
rc = deviceOperator.Get.GetGameCardAsicInfo(OutBuffer.FromStruct(ref rmaInformation),
|
||||
res = deviceOperator.Get.GetGameCardAsicInfo(OutBuffer.FromStruct(ref rmaInformation),
|
||||
Unsafe.SizeOf<RmaInformation>(), new InBuffer(asicFirmwareBuffer), asicFirmwareBuffer.Length);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outRmaInfo = rmaInformation;
|
||||
|
||||
@ -352,15 +352,15 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Unsafe.SkipInit(out GameCardIdSet gcIdSet);
|
||||
|
||||
rc = deviceOperator.Get.GetGameCardIdSet(OutBuffer.FromStruct(ref gcIdSet), Unsafe.SizeOf<GameCardIdSet>());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.GetGameCardIdSet(OutBuffer.FromStruct(ref gcIdSet), Unsafe.SizeOf<GameCardIdSet>());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outGcIdSet = gcIdSet;
|
||||
|
||||
@ -369,27 +369,27 @@ public static class GameCard
|
||||
|
||||
public static Result GetGameCardCid(this FileSystemClient fs, Span<byte> outCidBuffer)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
|
||||
if (outCidBuffer.Length < Unsafe.SizeOf<GameCardIdSet>())
|
||||
{
|
||||
rc = ResultFs.InvalidSize.Value;
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc.Log();
|
||||
res = ResultFs.InvalidSize.Value;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res.Log();
|
||||
}
|
||||
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Unsafe.SkipInit(out GameCardIdSet gcIdSet);
|
||||
|
||||
rc = deviceOperator.Get.GetGameCardIdSet(OutBuffer.FromStruct(ref gcIdSet), Unsafe.SizeOf<GameCardIdSet>());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.GetGameCardIdSet(OutBuffer.FromStruct(ref gcIdSet), Unsafe.SizeOf<GameCardIdSet>());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
SpanHelpers.AsByteSpan(ref gcIdSet).CopyTo(outCidBuffer);
|
||||
|
||||
@ -401,13 +401,13 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.WriteToGameCardDirectly(offset, new OutBuffer(buffer), buffer.Length);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.WriteToGameCardDirectly(offset, new OutBuffer(buffer), buffer.Length);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -417,13 +417,13 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.SetVerifyWriteEnableFlag(isEnabled);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.SetVerifyWriteEnableFlag(isEnabled);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -433,13 +433,13 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.GetGameCardImageHash(new OutBuffer(outBuffer), outBuffer.Length, handle);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.GetGameCardImageHash(new OutBuffer(outBuffer), outBuffer.Length, handle);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -450,14 +450,14 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.GetGameCardDeviceIdForProdCard(new OutBuffer(outIdBuffer), outIdBuffer.Length,
|
||||
res = deviceOperator.Get.GetGameCardDeviceIdForProdCard(new OutBuffer(outIdBuffer), outIdBuffer.Length,
|
||||
new InBuffer(devHeaderBuffer), devHeaderBuffer.Length);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -467,13 +467,13 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.EraseAndWriteParamDirectly(new InBuffer(devParamBuffer), devParamBuffer.Length);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.EraseAndWriteParamDirectly(new InBuffer(devParamBuffer), devParamBuffer.Length);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -483,13 +483,13 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.ReadParamDirectly(new OutBuffer(outBuffer), outBuffer.Length);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.ReadParamDirectly(new OutBuffer(outBuffer), outBuffer.Length);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -499,13 +499,13 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.ForceEraseGameCard();
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.ForceEraseGameCard();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -517,13 +517,13 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.GetGameCardErrorInfo(out GameCardErrorInfo gameCardErrorInfo);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.GetGameCardErrorInfo(out GameCardErrorInfo gameCardErrorInfo);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outErrorInfo = gameCardErrorInfo;
|
||||
|
||||
@ -537,13 +537,13 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.GetGameCardErrorReportInfo(out GameCardErrorReportInfo gameCardErrorReportInfo);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.GetGameCardErrorReportInfo(out GameCardErrorReportInfo gameCardErrorReportInfo);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outErrorInfo = gameCardErrorReportInfo;
|
||||
|
||||
@ -556,37 +556,37 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenGameCardFileSystem(ref fileSystem.Ref(), handle, partitionId);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenGameCardFileSystem(ref fileSystem.Ref(), handle, partitionId);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
public static Result GetGameCardDeviceId(this FileSystemClient fs, Span<byte> outBuffer)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
|
||||
// Note: Nintendo checks for length 8 here rather than GcCardDeviceIdSize (0x10)
|
||||
if (outBuffer.Length < GcCardDeviceIdSize)
|
||||
{
|
||||
rc = ResultFs.InvalidSize.Value;
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc.Log();
|
||||
res = ResultFs.InvalidSize.Value;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res.Log();
|
||||
}
|
||||
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Span<byte> buffer = stackalloc byte[GcCardDeviceIdSize];
|
||||
|
||||
rc = deviceOperator.Get.GetGameCardDeviceId(new OutBuffer(buffer), GcCardDeviceIdSize);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.GetGameCardDeviceId(new OutBuffer(buffer), GcCardDeviceIdSize);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
buffer.CopyTo(outBuffer);
|
||||
|
||||
@ -600,12 +600,12 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.SetDeviceSimulationEvent((uint)SdmmcPort.GcAsic, (uint)simulatedOperationType,
|
||||
res = deviceOperator.Get.SetDeviceSimulationEvent((uint)SdmmcPort.GcAsic, (uint)simulatedOperationType,
|
||||
(uint)simulatedFailureType, failureResult.Value, autoClearEvent);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -615,9 +615,9 @@ public static class GameCard
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.SimulateDeviceDetectionEvent(SdmmcPort.GcAsic, mode, signalEvent);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.SimulateDeviceDetectionEvent(SdmmcPort.GcAsic, mode, signalEvent);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -626,10 +626,10 @@ public static class GameCard
|
||||
SimulatingDeviceTargetOperation simulatedOperationType,
|
||||
SimulatingDeviceAccessFailureEventType simulatedFailureType)
|
||||
{
|
||||
Result rc = SetGameCardSimulationEventImpl(fs, simulatedOperationType, simulatedFailureType, Result.Success,
|
||||
Result res = SetGameCardSimulationEventImpl(fs, simulatedOperationType, simulatedFailureType, Result.Success,
|
||||
autoClearEvent: false);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -638,10 +638,10 @@ public static class GameCard
|
||||
SimulatingDeviceTargetOperation simulatedOperationType,
|
||||
SimulatingDeviceAccessFailureEventType simulatedFailureType, bool autoClearEvent)
|
||||
{
|
||||
Result rc = SetGameCardSimulationEventImpl(fs, simulatedOperationType, simulatedFailureType, Result.Success,
|
||||
Result res = SetGameCardSimulationEventImpl(fs, simulatedOperationType, simulatedFailureType, Result.Success,
|
||||
autoClearEvent);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -649,10 +649,10 @@ public static class GameCard
|
||||
public static Result SetGameCardSimulationEvent(this FileSystemClient fs,
|
||||
SimulatingDeviceTargetOperation simulatedOperationType, Result failureResult, bool autoClearEvent)
|
||||
{
|
||||
Result rc = SetGameCardSimulationEventImpl(fs, simulatedOperationType,
|
||||
Result res = SetGameCardSimulationEventImpl(fs, simulatedOperationType,
|
||||
SimulatingDeviceAccessFailureEventType.AccessFailure, failureResult, autoClearEvent);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -662,13 +662,13 @@ public static class GameCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.ClearDeviceSimulationEvent((uint)SdmmcPort.GcAsic);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.ClearDeviceSimulationEvent((uint)SdmmcPort.GcAsic);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -45,13 +45,13 @@ public static class Host
|
||||
|
||||
if (option.Flags != MountHostOptionFlag.None)
|
||||
{
|
||||
Result rc = fileSystemProxy.Get.OpenHostFileSystemWithOption(ref fileSystem.Ref(), in path, option);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = fileSystemProxy.Get.OpenHostFileSystemWithOption(ref fileSystem.Ref(), in path, option);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else
|
||||
{
|
||||
Result rc = fileSystemProxy.Get.OpenHostFileSystem(ref fileSystem.Ref(), in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = fileSystemProxy.Get.OpenHostFileSystem(ref fileSystem.Ref(), in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
using var fileSystemAdapter =
|
||||
@ -129,8 +129,8 @@ public static class Host
|
||||
if (fs.Impl.IsUsedReservedMountName(mountName))
|
||||
return ResultFs.InvalidMountName.Log();
|
||||
|
||||
Result rc = PathUtility.ConvertToFspPath(out FspPath sfPath, path);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = PathUtility.ConvertToFspPath(out FspPath sfPath, path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (sfPath.Str[0] == NullTerminator)
|
||||
{
|
||||
@ -140,8 +140,8 @@ public static class Host
|
||||
|
||||
using var fileSystem = new UniqueRef<IFileSystem>();
|
||||
|
||||
rc = OpenHostFileSystemImpl(fs, ref fileSystem.Ref(), in sfPath, option);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = OpenHostFileSystemImpl(fs, ref fileSystem.Ref(), in sfPath, option);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outFileSystem.Set(ref fileSystem.Ref());
|
||||
return Result.Success;
|
||||
@ -159,8 +159,8 @@ public static class Host
|
||||
private static Result PreMountHost(FileSystemClient fs,
|
||||
ref UniqueRef<HostCommonMountNameGenerator> outMountNameGenerator, U8Span mountName, U8Span path)
|
||||
{
|
||||
Result rc = fs.Impl.CheckMountName(mountName);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = fs.Impl.CheckMountName(mountName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outMountNameGenerator.Reset(new HostCommonMountNameGenerator(path));
|
||||
|
||||
@ -179,7 +179,7 @@ public static class Host
|
||||
/// <returns>The <see cref="Result"/> of the operation.</returns>
|
||||
public static Result MountHost(this FileSystemClient fs, U8Span mountName, U8Span path)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x300];
|
||||
|
||||
using var mountNameGenerator = new UniqueRef<HostCommonMountNameGenerator>();
|
||||
@ -187,7 +187,7 @@ public static class Host
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = PreMountHost(fs, ref mountNameGenerator.Ref(), mountName, path);
|
||||
res = PreMountHost(fs, ref mountNameGenerator.Ref(), mountName, path);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
@ -196,49 +196,49 @@ public static class Host
|
||||
|
||||
logBuffer = sb.Buffer;
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = PreMountHost(fs, ref mountNameGenerator.Ref(), mountName, path);
|
||||
res = PreMountHost(fs, ref mountNameGenerator.Ref(), mountName, path);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystem = new UniqueRef<IFileSystem>();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = OpenHostFileSystem(fs, ref fileSystem.Ref(), mountName, path, MountHostOption.None);
|
||||
res = OpenHostFileSystem(fs, ref fileSystem.Ref(), mountName, path, MountHostOption.None);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = OpenHostFileSystem(fs, ref fileSystem.Ref(), mountName, path, MountHostOption.None);
|
||||
res = OpenHostFileSystem(fs, ref fileSystem.Ref(), mountName, path, MountHostOption.None);
|
||||
}
|
||||
|
||||
// No AbortIfNeeded here
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = PostMount(fs, mountName, ref fileSystem.Ref(), ref mountNameGenerator.Ref());
|
||||
res = PostMount(fs, mountName, ref fileSystem.Ref(), ref mountNameGenerator.Ref());
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = PostMount(fs, mountName, ref fileSystem.Ref(), ref mountNameGenerator.Ref());
|
||||
res = PostMount(fs, mountName, ref fileSystem.Ref(), ref mountNameGenerator.Ref());
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -251,8 +251,8 @@ public static class Host
|
||||
using UniqueRef<ICommonMountNameGenerator> baseMountNameGenerator =
|
||||
UniqueRef<ICommonMountNameGenerator>.Create(ref mountNameGenerator);
|
||||
|
||||
Result rc = fs.Register(mountName, ref fileSystem, ref baseMountNameGenerator.Ref());
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fs.Register(mountName, ref fileSystem, ref baseMountNameGenerator.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -268,7 +268,7 @@ public static class Host
|
||||
/// <returns>The <see cref="Result"/> of the operation.</returns>
|
||||
public static Result MountHost(this FileSystemClient fs, U8Span mountName, U8Span path, MountHostOption option)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x300];
|
||||
|
||||
using var mountNameGenerator = new UniqueRef<HostCommonMountNameGenerator>();
|
||||
@ -276,7 +276,7 @@ public static class Host
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = PreMountHost(fs, ref mountNameGenerator.Ref(), mountName, path);
|
||||
res = PreMountHost(fs, ref mountNameGenerator.Ref(), mountName, path);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var idString = new IdString();
|
||||
@ -288,49 +288,49 @@ public static class Host
|
||||
|
||||
logBuffer = sb.Buffer;
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = PreMountHost(fs, ref mountNameGenerator.Ref(), mountName, path);
|
||||
res = PreMountHost(fs, ref mountNameGenerator.Ref(), mountName, path);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystem = new UniqueRef<IFileSystem>();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = OpenHostFileSystem(fs, ref fileSystem.Ref(), mountName, path, option);
|
||||
res = OpenHostFileSystem(fs, ref fileSystem.Ref(), mountName, path, option);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = OpenHostFileSystem(fs, ref fileSystem.Ref(), mountName, path, option);
|
||||
res = OpenHostFileSystem(fs, ref fileSystem.Ref(), mountName, path, option);
|
||||
}
|
||||
|
||||
// No AbortIfNeeded here
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = PostMount(fs, mountName, ref fileSystem.Ref(), ref mountNameGenerator.Ref());
|
||||
res = PostMount(fs, mountName, ref fileSystem.Ref(), ref mountNameGenerator.Ref());
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = PostMount(fs, mountName, ref fileSystem.Ref(), ref mountNameGenerator.Ref());
|
||||
res = PostMount(fs, mountName, ref fileSystem.Ref(), ref mountNameGenerator.Ref());
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -343,8 +343,8 @@ public static class Host
|
||||
using UniqueRef<ICommonMountNameGenerator> baseMountNameGenerator =
|
||||
UniqueRef<ICommonMountNameGenerator>.Create(ref mountNameGenerator);
|
||||
|
||||
Result rc = fs.Register(mountName, ref fileSystem, ref baseMountNameGenerator.Ref());
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fs.Register(mountName, ref fileSystem, ref baseMountNameGenerator.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -357,7 +357,7 @@ public static class Host
|
||||
/// <returns>The <see cref="Result"/> of the operation.</returns>
|
||||
public static Result MountHostRoot(this FileSystemClient fs)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x30];
|
||||
|
||||
using var fileSystem = new UniqueRef<IFileSystem>();
|
||||
@ -366,38 +366,38 @@ public static class Host
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = OpenHostFileSystemImpl(fs, ref fileSystem.Ref(), in sfPath, MountHostOption.None);
|
||||
res = OpenHostFileSystemImpl(fs, ref fileSystem.Ref(), in sfPath, MountHostOption.None);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogName).Append(HostRootFileSystemMountName).Append(LogQuote);
|
||||
logBuffer = sb.Buffer;
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = OpenHostFileSystemImpl(fs, ref fileSystem.Ref(), in sfPath, MountHostOption.None);
|
||||
res = OpenHostFileSystemImpl(fs, ref fileSystem.Ref(), in sfPath, MountHostOption.None);
|
||||
}
|
||||
|
||||
// No AbortIfNeeded here
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = PostMount(fs, ref fileSystem.Ref());
|
||||
res = PostMount(fs, ref fileSystem.Ref());
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = PostMount(fs, ref fileSystem.Ref());
|
||||
res = PostMount(fs, ref fileSystem.Ref());
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(new U8Span(HostRootFileSystemMountName));
|
||||
@ -412,9 +412,9 @@ public static class Host
|
||||
if (!mountNameGenerator.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInHostC.Log();
|
||||
|
||||
Result rc = fs.Register(new U8Span(HostRootFileSystemMountName), ref fileSystem,
|
||||
Result res = fs.Register(new U8Span(HostRootFileSystemMountName), ref fileSystem,
|
||||
ref mountNameGenerator.Ref());
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -428,7 +428,7 @@ public static class Host
|
||||
/// <returns>The <see cref="Result"/> of the operation.</returns>
|
||||
public static Result MountHostRoot(this FileSystemClient fs, MountHostOption option)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x60];
|
||||
|
||||
using var fileSystem = new UniqueRef<IFileSystem>();
|
||||
@ -437,7 +437,7 @@ public static class Host
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = OpenHostFileSystemImpl(fs, ref fileSystem.Ref(), in sfPath, option);
|
||||
res = OpenHostFileSystemImpl(fs, ref fileSystem.Ref(), in sfPath, option);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var idString = new IdString();
|
||||
@ -448,31 +448,31 @@ public static class Host
|
||||
|
||||
logBuffer = sb.Buffer;
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = OpenHostFileSystemImpl(fs, ref fileSystem.Ref(), in sfPath, option);
|
||||
res = OpenHostFileSystemImpl(fs, ref fileSystem.Ref(), in sfPath, option);
|
||||
}
|
||||
|
||||
// No AbortIfNeeded here
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = PostMount(fs, ref fileSystem.Ref());
|
||||
res = PostMount(fs, ref fileSystem.Ref());
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = PostMount(fs, ref fileSystem.Ref());
|
||||
res = PostMount(fs, ref fileSystem.Ref());
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(new U8Span(HostRootFileSystemMountName));
|
||||
@ -487,9 +487,9 @@ public static class Host
|
||||
if (!mountNameGenerator.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInHostC.Log();
|
||||
|
||||
Result rc = fs.Register(new U8Span(HostRootFileSystemMountName), ref fileSystem,
|
||||
Result res = fs.Register(new U8Span(HostRootFileSystemMountName), ref fileSystem,
|
||||
ref mountNameGenerator.Ref());
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -501,7 +501,7 @@ public static class Host
|
||||
/// <param name="fs">The <see cref="FileSystemClient"/> to use.</param>
|
||||
public static void UnmountHostRoot(this FileSystemClient fs)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x30];
|
||||
|
||||
var mountName = new U8Span(HostRootFileSystemMountName);
|
||||
@ -509,20 +509,20 @@ public static class Host
|
||||
if (fs.Impl.IsEnabledAccessLog() && fs.Impl.IsEnabledFileSystemAccessorAccessLog(mountName))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fs.Impl.Unmount(mountName);
|
||||
res = fs.Impl.Unmount(mountName);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogName).Append(mountName).Append((byte)'"');
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fs.Impl.Unmount(mountName);
|
||||
res = fs.Impl.Unmount(mountName);
|
||||
}
|
||||
|
||||
fs.Impl.LogResultErrorMessage(rc);
|
||||
Abort.DoAbortUnless(rc.IsSuccess());
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
}
|
||||
}
|
@ -19,13 +19,13 @@ public static class ImageDirectory
|
||||
{
|
||||
public static Result MountImageDirectory(this FileSystemClient fs, U8Span mountName, ImageDirectoryId directoryId)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x50];
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = Mount(fs, mountName, directoryId);
|
||||
res = Mount(fs, mountName, directoryId);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var idString = new IdString();
|
||||
@ -34,15 +34,15 @@ public static class ImageDirectory
|
||||
sb.Append(LogName).Append(mountName).Append(LogQuote)
|
||||
.Append(LogImageDirectoryId).Append(idString.ToString(directoryId));
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = Mount(fs, mountName, directoryId);
|
||||
res = Mount(fs, mountName, directoryId);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -51,14 +51,14 @@ public static class ImageDirectory
|
||||
|
||||
static Result Mount(FileSystemClient fs, U8Span mountName, ImageDirectoryId directoryId)
|
||||
{
|
||||
Result rc = fs.Impl.CheckMountName(mountName);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fs.Impl.CheckMountName(mountName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
rc = fileSystemProxy.Get.OpenImageDirectoryFileSystem(ref fileSystem.Ref(), directoryId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fileSystemProxy.Get.OpenImageDirectoryFileSystem(ref fileSystem.Ref(), directoryId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystemAdapter =
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref()));
|
||||
@ -66,8 +66,8 @@ public static class ImageDirectory
|
||||
if (!fileSystemAdapter.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInImageDirectoryA.Log();
|
||||
|
||||
rc = fs.Impl.Fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fs.Impl.Fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -15,9 +15,9 @@ public static class LoaderApi
|
||||
using SharedRef<IFileSystemProxyForLoader> fileSystemProxy =
|
||||
fs.Impl.GetFileSystemProxyForLoaderServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.IsArchivedProgram(out isArchived, processId.Value);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.IsArchivedProgram(out isArchived, processId.Value);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -20,13 +20,13 @@ public static class Logo
|
||||
{
|
||||
public static Result MountLogo(this FileSystemClient fs, U8Span mountName, U8Span path, ProgramId programId)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x300];
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = Mount(fs, mountName, path, programId);
|
||||
res = Mount(fs, mountName, path, programId);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
@ -35,15 +35,15 @@ public static class Logo
|
||||
.Append(LogPath).Append(path).Append(LogQuote)
|
||||
.Append(LogProgramId).AppendFormat(programId.Value, 'X');
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = Mount(fs, mountName, path, programId);
|
||||
res = Mount(fs, mountName, path, programId);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -52,18 +52,18 @@ public static class Logo
|
||||
|
||||
static Result Mount(FileSystemClient fs, U8Span mountName, U8Span path, ProgramId programId)
|
||||
{
|
||||
Result rc = fs.Impl.CheckMountName(mountName);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fs.Impl.CheckMountName(mountName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = PathUtility.ConvertToFspPath(out FspPath sfPath, path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = PathUtility.ConvertToFspPath(out FspPath sfPath, path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
rc = fileSystemProxy.Get.OpenFileSystemWithId(ref fileSystem.Ref(), in sfPath, programId.Value,
|
||||
res = fileSystemProxy.Get.OpenFileSystemWithId(ref fileSystem.Ref(), in sfPath, programId.Value,
|
||||
FileSystemProxyType.Logo);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystemAdapter =
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref()));
|
||||
@ -71,8 +71,8 @@ public static class Logo
|
||||
if (!fileSystemAdapter.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInLogoA.Log();
|
||||
|
||||
rc = fs.Impl.Fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fs.Impl.Fs.Register(mountName, ref fileSystemAdapter.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -13,9 +13,9 @@ public static class MemoryReportInfoShim
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.GetAndClearMemoryReportInfo(out reportInfo);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.GetAndClearMemoryReportInfo(out reportInfo);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -18,13 +18,13 @@ public static class Mmc
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.GetMmcSpeedMode(out long speedMode);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.GetMmcSpeedMode(out long speedMode);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outSpeedMode = (MmcSpeedMode)speedMode;
|
||||
return Result.Success;
|
||||
@ -35,13 +35,13 @@ public static class Mmc
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.GetMmcCid(new OutBuffer(outCidBuffer), outCidBuffer.Length);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.GetMmcCid(new OutBuffer(outCidBuffer), outCidBuffer.Length);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -51,13 +51,13 @@ public static class Mmc
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.EraseMmc((uint)partition);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.EraseMmc((uint)partition);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -70,13 +70,13 @@ public static class Mmc
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.GetMmcPartitionSize(out outPartitionSize, (uint)partition);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.GetMmcPartitionSize(out outPartitionSize, (uint)partition);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -88,13 +88,13 @@ public static class Mmc
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.GetMmcPatrolCount(out outPatrolCount);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.GetMmcPatrolCount(out outPatrolCount);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -107,14 +107,14 @@ public static class Mmc
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.GetAndClearMmcErrorInfo(out outErrorInfo, out long logSize, new OutBuffer(logBuffer),
|
||||
res = deviceOperator.Get.GetAndClearMmcErrorInfo(out outErrorInfo, out long logSize, new OutBuffer(logBuffer),
|
||||
logBuffer.Length);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outLogSize = logSize;
|
||||
|
||||
@ -126,13 +126,13 @@ public static class Mmc
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.GetMmcExtendedCsd(new OutBuffer(outBuffer), outBuffer.Length);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.GetMmcExtendedCsd(new OutBuffer(outBuffer), outBuffer.Length);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -142,13 +142,13 @@ public static class Mmc
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.SuspendMmcPatrol();
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.SuspendMmcPatrol();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -158,13 +158,13 @@ public static class Mmc
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.ResumeMmcPatrol();
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.ResumeMmcPatrol();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -14,9 +14,9 @@ public static class PosixTimeShim
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.SetCurrentPosixTimeWithTimeDifference(currentPosixTime.Value,
|
||||
Result res = fileSystemProxy.Get.SetCurrentPosixTimeWithTimeDifference(currentPosixTime.Value,
|
||||
timeDifferenceSeconds);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
}
|
@ -27,9 +27,9 @@ public static class ProgramIndexMapInfoShim
|
||||
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.RegisterProgramIndexMapInfo(InBuffer.FromSpan(mapInfo), mapInfo.Length);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.RegisterProgramIndexMapInfo(InBuffer.FromSpan(mapInfo), mapInfo.Length);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -21,15 +21,15 @@ public static class ProgramRegistry
|
||||
{
|
||||
using SharedRef<IProgramRegistry> programRegistry = fs.Impl.GetProgramRegistryServiceObject();
|
||||
|
||||
Result rc = programRegistry.Get.SetCurrentProcess(fs.Hos.Os.GetCurrentProcessId().Value);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = programRegistry.Get.SetCurrentProcess(fs.Hos.Os.GetCurrentProcessId().Value);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = programRegistry.Get.RegisterProgram(processId, programId, storageId, new InBuffer(accessControlData),
|
||||
res = programRegistry.Get.RegisterProgram(processId, programId, storageId, new InBuffer(accessControlData),
|
||||
accessControlData.Length, new InBuffer(accessControlDescriptor), accessControlDescriptor.Length);
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -16,9 +16,9 @@ public static class RightsIdShim
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.GetRightsId(out rightsId, programId, storageId);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.GetRightsId(out rightsId, programId, storageId);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -27,15 +27,15 @@ public static class RightsIdShim
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out rightsId);
|
||||
|
||||
Result rc = PathUtility.ConvertToFspPath(out FspPath sfPath, path);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = PathUtility.ConvertToFspPath(out FspPath sfPath, path);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
rc = fileSystemProxy.Get.GetRightsIdByPath(out rightsId, in sfPath);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fileSystemProxy.Get.GetRightsIdByPath(out rightsId, in sfPath);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -44,15 +44,15 @@ public static class RightsIdShim
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out rightsId, out keyGeneration);
|
||||
|
||||
Result rc = PathUtility.ConvertToFspPath(out FspPath sfPath, path);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = PathUtility.ConvertToFspPath(out FspPath sfPath, path);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
rc = fileSystemProxy.Get.GetRightsIdAndKeyGenerationByPath(out rightsId, out keyGeneration, in sfPath);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fileSystemProxy.Get.GetRightsIdAndKeyGenerationByPath(out rightsId, out keyGeneration, in sfPath);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -61,9 +61,9 @@ public static class RightsIdShim
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.RegisterExternalKey(in rightsId, in key);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.RegisterExternalKey(in rightsId, in key);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -72,9 +72,9 @@ public static class RightsIdShim
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.UnregisterExternalKey(in rightsId);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.UnregisterExternalKey(in rightsId);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -83,9 +83,9 @@ public static class RightsIdShim
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.UnregisterAllExternalKey();
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.UnregisterAllExternalKey();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -30,9 +30,9 @@ public static class SaveData
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenSaveDataInternalStorageFileSystem(ref fileSystem.Ref(), spaceId,
|
||||
Result res = fileSystemProxy.Get.OpenSaveDataInternalStorageFileSystem(ref fileSystem.Ref(), spaceId,
|
||||
saveDataId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystemAdapter =
|
||||
new UniqueRef<IFileSystem>(new FileSystemServiceObjectAdapter(ref fileSystem.Ref()));
|
||||
@ -46,30 +46,30 @@ public static class SaveData
|
||||
long saveDataJournalSize)
|
||||
{
|
||||
// Find the save data for the current program.
|
||||
Result rc = SaveDataFilter.Make(out SaveDataFilter filter, InvalidProgramId.Value, SaveDataType.Account, userId,
|
||||
Result res = SaveDataFilter.Make(out SaveDataFilter filter, InvalidProgramId.Value, SaveDataType.Account, userId,
|
||||
InvalidSystemSaveDataId, index: 0, SaveDataRank.Primary);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = fs.Impl.FindSaveDataWithFilter(out SaveDataInfo info, SaveDataSpaceId.User, in filter);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fs.Impl.FindSaveDataWithFilter(out SaveDataInfo info, SaveDataSpaceId.User, in filter);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
SaveDataSpaceId spaceId = info.SpaceId;
|
||||
ulong saveDataId = info.SaveDataId;
|
||||
|
||||
// Get the current save data's sizes.
|
||||
rc = fs.Impl.GetSaveDataAvailableSize(out long availableSize, spaceId, saveDataId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fs.Impl.GetSaveDataAvailableSize(out long availableSize, spaceId, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = fs.Impl.GetSaveDataJournalSize(out long journalSize, spaceId, saveDataId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fs.Impl.GetSaveDataJournalSize(out long journalSize, spaceId, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Extend the save data if it's not large enough.
|
||||
if (availableSize < saveDataSize || journalSize < saveDataJournalSize)
|
||||
{
|
||||
long newSaveDataSize = Math.Max(saveDataSize, availableSize);
|
||||
long newJournalSize = Math.Max(saveDataJournalSize, journalSize);
|
||||
rc = fs.Impl.ExtendSaveData(spaceId, saveDataId, newSaveDataSize, newJournalSize);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fs.Impl.ExtendSaveData(spaceId, saveDataId, newSaveDataSize, newJournalSize);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
return Result.Success;
|
||||
@ -78,26 +78,26 @@ public static class SaveData
|
||||
private static Result MountSaveDataImpl(this FileSystemClientImpl fs, U8Span mountName, SaveDataSpaceId spaceId,
|
||||
ProgramId programId, UserId userId, SaveDataType type, bool openReadOnly, ushort index)
|
||||
{
|
||||
Result rc = fs.CheckMountName(mountName);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = fs.CheckMountName(mountName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.GetFileSystemProxyServiceObject();
|
||||
|
||||
rc = SaveDataAttribute.Make(out SaveDataAttribute attribute, programId, type, userId, InvalidSystemSaveDataId,
|
||||
res = SaveDataAttribute.Make(out SaveDataAttribute attribute, programId, type, userId, InvalidSystemSaveDataId,
|
||||
index);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
if (openReadOnly)
|
||||
{
|
||||
rc = fileSystemProxy.Get.OpenReadOnlySaveDataFileSystem(ref fileSystem.Ref(), spaceId, in attribute);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = fileSystemProxy.Get.OpenReadOnlySaveDataFileSystem(ref fileSystem.Ref(), spaceId, in attribute);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fileSystemProxy.Get.OpenSaveDataFileSystem(ref fileSystem.Ref(), spaceId, in attribute);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = fileSystemProxy.Get.OpenSaveDataFileSystem(ref fileSystem.Ref(), spaceId, in attribute);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
// Note: Nintendo does pass in the same object both as a unique_ptr and as a raw pointer.
|
||||
@ -110,9 +110,9 @@ public static class SaveData
|
||||
|
||||
using var mountNameGenerator = new UniqueRef<ICommonMountNameGenerator>();
|
||||
|
||||
rc = fs.Fs.Register(mountName, fileSystemAdapterRaw, ref fileSystemAdapter.Ref(), ref mountNameGenerator.Ref(),
|
||||
res = fs.Fs.Register(mountName, fileSystemAdapterRaw, ref fileSystemAdapter.Ref(), ref mountNameGenerator.Ref(),
|
||||
false, null, true);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -131,13 +131,13 @@ public static class SaveData
|
||||
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = SaveDataAttribute.Make(out SaveDataAttribute attribute, InvalidProgramId, SaveDataType.Account,
|
||||
Result res = SaveDataAttribute.Make(out SaveDataAttribute attribute, InvalidProgramId, SaveDataType.Account,
|
||||
userId, InvalidSystemSaveDataId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = SaveDataCreationInfo.Make(out SaveDataCreationInfo creationInfo, saveDataSize, saveDataJournalSize,
|
||||
res = SaveDataCreationInfo.Make(out SaveDataCreationInfo creationInfo, saveDataSize, saveDataJournalSize,
|
||||
ownerId: 0, SaveDataFlags.None, SaveDataSpaceId.User);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
var metaInfo = new SaveDataMetaInfo
|
||||
{
|
||||
@ -145,22 +145,22 @@ public static class SaveData
|
||||
Size = 0
|
||||
};
|
||||
|
||||
rc = fileSystemProxy.Get.CreateSaveDataFileSystem(in attribute, in creationInfo, in metaInfo);
|
||||
res = fileSystemProxy.Get.CreateSaveDataFileSystem(in attribute, in creationInfo, in metaInfo);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
// Ensure the save is large enough if it already exists
|
||||
if (ResultFs.PathAlreadyExists.Includes(rc))
|
||||
if (ResultFs.PathAlreadyExists.Includes(res))
|
||||
{
|
||||
if (extendIfNeeded)
|
||||
{
|
||||
rc = ExtendSaveDataIfNeeded(fs.Fs, userId, saveDataSize, saveDataJournalSize);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = ExtendSaveDataIfNeeded(fs.Fs, userId, saveDataSize, saveDataJournalSize);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return rc.Miss();
|
||||
return res.Miss();
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,28 +175,28 @@ public static class SaveData
|
||||
|
||||
public static Result MountSaveData(this FileSystemClient fs, U8Span mountName, UserId userId)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x60];
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = MountSaveDataImpl(fs.Impl, mountName, InvalidUserId);
|
||||
res = MountSaveDataImpl(fs.Impl, mountName, InvalidUserId);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogName).Append(mountName).Append(LogQuote)
|
||||
.Append(LogUserId).AppendFormat(userId.Id.High, 'X', 16).AppendFormat(userId.Id.Low, 'X', 16);
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = MountSaveDataImpl(fs.Impl, mountName, InvalidUserId);
|
||||
res = MountSaveDataImpl(fs.Impl, mountName, InvalidUserId);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -207,13 +207,13 @@ public static class SaveData
|
||||
public static Result MountSaveData(this FileSystemClient fs, U8Span mountName, Ncm.ApplicationId applicationId,
|
||||
UserId userId)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x90];
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.User, applicationId, userId,
|
||||
res = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.User, applicationId, userId,
|
||||
SaveDataType.Account, openReadOnly: false, index: 0);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
@ -222,16 +222,16 @@ public static class SaveData
|
||||
.Append(LogApplicationId).AppendFormat(applicationId.Value, 'X')
|
||||
.Append(LogUserId).AppendFormat(userId.Id.High, 'X', 16).AppendFormat(userId.Id.Low, 'X', 16);
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.User, applicationId, userId,
|
||||
res = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.User, applicationId, userId,
|
||||
SaveDataType.Account, openReadOnly: false, index: 0);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -242,13 +242,13 @@ public static class SaveData
|
||||
public static Result MountSaveDataReadOnly(this FileSystemClient fs, U8Span mountName,
|
||||
Ncm.ApplicationId applicationId, UserId userId)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x90];
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.User, applicationId, userId,
|
||||
res = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.User, applicationId, userId,
|
||||
SaveDataType.Account, openReadOnly: true, index: 0);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
@ -257,16 +257,16 @@ public static class SaveData
|
||||
.Append(LogApplicationId).AppendFormat(applicationId.Value, 'X')
|
||||
.Append(LogUserId).AppendFormat(userId.Id.High, 'X', 16).AppendFormat(userId.Id.Low, 'X', 16);
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.User, applicationId, userId,
|
||||
res = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.User, applicationId, userId,
|
||||
SaveDataType.Account, openReadOnly: true, index: 0);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -292,53 +292,53 @@ public static class SaveData
|
||||
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = SaveDataAttribute.Make(out SaveDataAttribute attribute, applicationId, type, userId,
|
||||
Result res = SaveDataAttribute.Make(out SaveDataAttribute attribute, applicationId, type, userId,
|
||||
InvalidSystemSaveDataId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
rc = fileSystemProxy.Get.OpenSaveDataFileSystem(ref fileSystem.Ref(), SaveDataSpaceId.User, in attribute);
|
||||
res = fileSystemProxy.Get.OpenSaveDataFileSystem(ref fileSystem.Ref(), SaveDataSpaceId.User, in attribute);
|
||||
|
||||
if (rc.IsSuccess() || ResultFs.TargetLocked.Includes(rc) || ResultFs.SaveDataExtending.Includes(rc))
|
||||
if (res.IsSuccess() || ResultFs.TargetLocked.Includes(res) || ResultFs.SaveDataExtending.Includes(res))
|
||||
{
|
||||
exists = true;
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
if (ResultFs.TargetNotFound.Includes(rc))
|
||||
if (ResultFs.TargetNotFound.Includes(res))
|
||||
{
|
||||
exists = false;
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
return rc.Miss();
|
||||
return res.Miss();
|
||||
}
|
||||
|
||||
public static Result MountTemporaryStorage(this FileSystemClient fs, U8Span mountName)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x30];
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.Temporary, InvalidProgramId, InvalidUserId,
|
||||
res = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.Temporary, InvalidProgramId, InvalidUserId,
|
||||
SaveDataType.Temporary, openReadOnly: false, index: 0);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogName).Append(mountName).Append(LogQuote);
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.Temporary, InvalidProgramId, InvalidUserId,
|
||||
res = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.Temporary, InvalidProgramId, InvalidUserId,
|
||||
SaveDataType.Temporary, openReadOnly: false, index: 0);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -348,29 +348,29 @@ public static class SaveData
|
||||
|
||||
public static Result MountCacheStorage(this FileSystemClient fs, U8Span mountName)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x30];
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.User, InvalidProgramId,
|
||||
res = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.User, InvalidProgramId,
|
||||
InvalidUserId, SaveDataType.Cache, openReadOnly: false, index: 0);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogName).Append(mountName).Append(LogQuote);
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.User, InvalidProgramId,
|
||||
res = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.User, InvalidProgramId,
|
||||
InvalidUserId, SaveDataType.Cache, openReadOnly: false, index: 0);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -380,14 +380,14 @@ public static class SaveData
|
||||
|
||||
public static Result MountCacheStorage(this FileSystemClient fs, U8Span mountName, int index)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x40];
|
||||
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.User, InvalidProgramId,
|
||||
res = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.User, InvalidProgramId,
|
||||
InvalidUserId, SaveDataType.Cache, openReadOnly: false, (ushort)index);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
@ -395,16 +395,16 @@ public static class SaveData
|
||||
sb.Append(LogName).Append(mountName).Append(LogQuote)
|
||||
.Append(LogIndex).AppendFormat(index);
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.User, InvalidProgramId,
|
||||
res = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.User, InvalidProgramId,
|
||||
InvalidUserId, SaveDataType.Cache, openReadOnly: false, (ushort)index);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -414,13 +414,13 @@ public static class SaveData
|
||||
|
||||
public static Result MountCacheStorage(this FileSystemClient fs, U8Span mountName, Ncm.ApplicationId applicationId)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x50];
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.User, applicationId,
|
||||
res = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.User, applicationId,
|
||||
InvalidUserId, SaveDataType.Cache, openReadOnly: false, index: 0);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
@ -428,16 +428,16 @@ public static class SaveData
|
||||
sb.Append(LogName).Append(mountName).Append(LogQuote)
|
||||
.Append(LogApplicationId).AppendFormat(applicationId.Value, 'X');
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.User, applicationId,
|
||||
res = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.User, applicationId,
|
||||
InvalidUserId, SaveDataType.Cache, openReadOnly: false, index: 0);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -448,13 +448,13 @@ public static class SaveData
|
||||
public static Result MountCacheStorage(this FileSystemClient fs, U8Span mountName, Ncm.ApplicationId applicationId,
|
||||
int index)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x60];
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.User, applicationId,
|
||||
res = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.User, applicationId,
|
||||
InvalidUserId, SaveDataType.Cache, openReadOnly: false, (ushort)index);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
@ -463,16 +463,16 @@ public static class SaveData
|
||||
.Append(LogApplicationId).AppendFormat(applicationId.Value, 'X')
|
||||
.Append(LogIndex).AppendFormat(index);
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.User, applicationId,
|
||||
res = MountSaveDataImpl(fs.Impl, mountName, SaveDataSpaceId.User, applicationId,
|
||||
InvalidUserId, SaveDataType.Cache, openReadOnly: false, (ushort)index);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc;
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -483,9 +483,9 @@ public static class SaveData
|
||||
public static Result OpenSaveDataInternalStorageFileSystem(this FileSystemClient fs,
|
||||
ref UniqueRef<IFileSystem> outFileSystem, SaveDataSpaceId spaceId, ulong saveDataId)
|
||||
{
|
||||
Result rc = OpenSaveDataInternalStorageFileSystemImpl(fs, ref outFileSystem, spaceId, saveDataId);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = OpenSaveDataInternalStorageFileSystemImpl(fs, ref outFileSystem, spaceId, saveDataId);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -493,21 +493,21 @@ public static class SaveData
|
||||
public static Result MountSaveDataInternalStorage(this FileSystemClient fs, U8Span mountName,
|
||||
SaveDataSpaceId spaceId, ulong saveDataId)
|
||||
{
|
||||
Result rc = Operate(fs, mountName, spaceId, saveDataId);
|
||||
Result res = Operate(fs, mountName, spaceId, saveDataId);
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
|
||||
static Result Operate(FileSystemClient fs, U8Span mountName, SaveDataSpaceId spaceId, ulong saveDataId)
|
||||
{
|
||||
Result rc = fs.Impl.CheckMountName(mountName);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fs.Impl.CheckMountName(mountName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystem = new UniqueRef<IFileSystem>();
|
||||
rc = OpenSaveDataInternalStorageFileSystemImpl(fs, ref fileSystem.Ref(), spaceId, saveDataId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = OpenSaveDataInternalStorageFileSystemImpl(fs, ref fileSystem.Ref(), spaceId, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return fs.Register(mountName, ref fileSystem.Ref());
|
||||
}
|
||||
|
@ -23,36 +23,36 @@ public static class SaveDataForDebug
|
||||
|
||||
public static void SetSaveDataRootPath(this FileSystemClient fs, U8Span path)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x300];
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog() && fs.Impl.IsEnabledHandleAccessLog(null))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = SetRootPath(fs, path);
|
||||
res = SetRootPath(fs, path);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogPath).Append(path).Append(LogQuote);
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = SetRootPath(fs, path);
|
||||
res = SetRootPath(fs, path);
|
||||
}
|
||||
|
||||
fs.Impl.LogResultErrorMessage(rc);
|
||||
Abort.DoAbortUnlessSuccess(rc);
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnlessSuccess(res);
|
||||
|
||||
static Result SetRootPath(FileSystemClient fs, U8Span path)
|
||||
{
|
||||
Result rc = PathUtility.ConvertToFspPath(out FspPath sfPath, path);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = PathUtility.ConvertToFspPath(out FspPath sfPath, path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
rc = fileSystemProxy.Get.SetSaveDataRootPath(in sfPath);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fileSystemProxy.Get.SetSaveDataRootPath(in sfPath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -60,25 +60,25 @@ public static class SaveDataForDebug
|
||||
|
||||
public static void UnsetSaveDataRootPath(this FileSystemClient fs)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog() && fs.Impl.IsEnabledHandleAccessLog(null))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
rc = fileSystemProxy.Get.UnsetSaveDataRootPath();
|
||||
res = fileSystemProxy.Get.UnsetSaveDataRootPath();
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, U8Span.Empty);
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, U8Span.Empty);
|
||||
}
|
||||
else
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
rc = fileSystemProxy.Get.UnsetSaveDataRootPath();
|
||||
res = fileSystemProxy.Get.UnsetSaveDataRootPath();
|
||||
}
|
||||
|
||||
fs.Impl.LogResultErrorMessage(rc);
|
||||
Abort.DoAbortUnlessSuccess(rc);
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnlessSuccess(res);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -96,27 +96,27 @@ public static class SaveDataForDebug
|
||||
/// <see cref="ResultFs.PermissionDenied"/>: Insufficient permissions.</returns>
|
||||
public static Result EnsureSaveDataForDebug(this FileSystemClient fs, long saveDataSize, long saveDataJournalSize)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x60];
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog() && fs.Impl.IsEnabledHandleAccessLog(null))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = Ensure(fs, saveDataSize, saveDataJournalSize);
|
||||
res = Ensure(fs, saveDataSize, saveDataJournalSize);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogSaveDataSize).AppendFormat(saveDataSize, 'd')
|
||||
.Append(LogSaveDataJournalSize).AppendFormat(saveDataJournalSize, 'd');
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = Ensure(fs, saveDataSize, saveDataJournalSize);
|
||||
res = Ensure(fs, saveDataSize, saveDataJournalSize);
|
||||
}
|
||||
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
|
||||
@ -124,9 +124,9 @@ public static class SaveDataForDebug
|
||||
{
|
||||
UserId userIdForDebug = InvalidUserId;
|
||||
|
||||
Result rc = fs.Impl.EnsureSaveDataImpl(userIdForDebug, saveDataSize, saveDataJournalSize,
|
||||
Result res = fs.Impl.EnsureSaveDataImpl(userIdForDebug, saveDataSize, saveDataJournalSize,
|
||||
extendIfNeeded: true);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -146,26 +146,26 @@ public static class SaveDataForDebug
|
||||
/// <see cref="ResultFs.PermissionDenied"/>: Insufficient permissions.</returns>
|
||||
public static Result MountSaveDataForDebug(this FileSystemClient fs, U8Span mountName)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x30];
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = Mount(fs, mountName);
|
||||
res = Mount(fs, mountName);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogName).Append(mountName).Append(LogQuote);
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = Mount(fs, mountName);
|
||||
res = Mount(fs, mountName);
|
||||
}
|
||||
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -176,12 +176,12 @@ public static class SaveDataForDebug
|
||||
{
|
||||
UserId userIdForDebug = InvalidUserId;
|
||||
|
||||
Result rc = fs.Impl.EnsureSaveDataImpl(userIdForDebug, SaveDataSizeForDebug, SaveDataJournalSizeForDebug,
|
||||
Result res = fs.Impl.EnsureSaveDataImpl(userIdForDebug, SaveDataSizeForDebug, SaveDataJournalSizeForDebug,
|
||||
extendIfNeeded: false);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = fs.Impl.MountSaveDataImpl(mountName, userIdForDebug);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fs.Impl.MountSaveDataImpl(mountName, userIdForDebug);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -33,25 +33,25 @@ public class SaveDataChunkIterator : ISaveDataChunkIterator
|
||||
|
||||
public ushort GetId()
|
||||
{
|
||||
Result rc = _baseInterface.Get.GetId(out uint id);
|
||||
_fsClient.Impl.LogResultErrorMessage(rc);
|
||||
Abort.DoAbortUnless(rc.IsSuccess());
|
||||
Result res = _baseInterface.Get.GetId(out uint id);
|
||||
_fsClient.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
|
||||
return (ushort)id;
|
||||
}
|
||||
|
||||
public void Next()
|
||||
{
|
||||
Result rc = _baseInterface.Get.Next();
|
||||
_fsClient.Impl.LogResultErrorMessage(rc);
|
||||
Abort.DoAbortUnless(rc.IsSuccess());
|
||||
Result res = _baseInterface.Get.Next();
|
||||
_fsClient.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
}
|
||||
|
||||
public bool IsEnd()
|
||||
{
|
||||
Result rc = _baseInterface.Get.IsEnd(out bool isEnd);
|
||||
_fsClient.Impl.LogResultErrorMessage(rc);
|
||||
Abort.DoAbortUnless(rc.IsSuccess());
|
||||
Result res = _baseInterface.Get.IsEnd(out bool isEnd);
|
||||
_fsClient.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
|
||||
return isEnd;
|
||||
}
|
||||
@ -84,11 +84,11 @@ public class SaveDataChunkExporter : ISaveDataChunkExporter
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outPulledSize);
|
||||
|
||||
Result rc = _baseInterface.Get.Pull(out ulong pulledSize, new OutBuffer(destination),
|
||||
Result res = _baseInterface.Get.Pull(out ulong pulledSize, new OutBuffer(destination),
|
||||
(ulong)destination.Length);
|
||||
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outPulledSize = pulledSize;
|
||||
return Result.Success;
|
||||
@ -96,9 +96,9 @@ public class SaveDataChunkExporter : ISaveDataChunkExporter
|
||||
|
||||
public long GetRestRawDataSize()
|
||||
{
|
||||
Result rc = _baseInterface.Get.GetRestRawDataSize(out long restSize);
|
||||
_fsClient.Impl.LogResultErrorMessage(rc);
|
||||
Abort.DoAbortUnless(rc.IsSuccess());
|
||||
Result res = _baseInterface.Get.GetRestRawDataSize(out long restSize);
|
||||
_fsClient.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
|
||||
return restSize;
|
||||
}
|
||||
@ -129,9 +129,9 @@ public class SaveDataChunkImporter : ISaveDataChunkImporter
|
||||
|
||||
public Result Push(ReadOnlySpan<byte> source)
|
||||
{
|
||||
Result rc = _baseInterface.Get.Push(new InBuffer(source), (ulong)source.Length);
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.Push(new InBuffer(source), (ulong)source.Length);
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -163,9 +163,9 @@ public class SaveDataExporterVersion2 : ISaveDataDivisionExporter
|
||||
|
||||
public Result SetDivisionCount(int divisionCount)
|
||||
{
|
||||
Result rc = _baseInterface.Get.SetDivisionCount(divisionCount);
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.SetDivisionCount(divisionCount);
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -174,9 +174,9 @@ public class SaveDataExporterVersion2 : ISaveDataDivisionExporter
|
||||
{
|
||||
using var iteratorObject = new SharedRef<FsSrv.Sf.ISaveDataChunkIterator>();
|
||||
|
||||
Result rc = _baseInterface.Get.OpenSaveDataDiffChunkIterator(ref iteratorObject.Ref());
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.OpenSaveDataDiffChunkIterator(ref iteratorObject.Ref());
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outIterator.Reset(new SaveDataChunkIterator(_fsClient, ref iteratorObject.Ref()));
|
||||
return Result.Success;
|
||||
@ -186,9 +186,9 @@ public class SaveDataExporterVersion2 : ISaveDataDivisionExporter
|
||||
{
|
||||
using var exporterObject = new SharedRef<FsSrv.Sf.ISaveDataChunkExporter>();
|
||||
|
||||
Result rc = _baseInterface.Get.OpenSaveDataChunkExporter(ref exporterObject.Ref(), chunkId);
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.OpenSaveDataChunkExporter(ref exporterObject.Ref(), chunkId);
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outExporter.Reset(new SaveDataChunkExporter(_fsClient, ref exporterObject.Ref()));
|
||||
return Result.Success;
|
||||
@ -198,9 +198,9 @@ public class SaveDataExporterVersion2 : ISaveDataDivisionExporter
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outKeySeed);
|
||||
|
||||
Result rc = _baseInterface.Get.GetKeySeed(out KeySeed keySeed);
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.GetKeySeed(out KeySeed keySeed);
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outKeySeed = keySeed;
|
||||
return Result.Success;
|
||||
@ -210,9 +210,9 @@ public class SaveDataExporterVersion2 : ISaveDataDivisionExporter
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outInitialDataMac);
|
||||
|
||||
Result rc = _baseInterface.Get.GetInitialDataMac(out InitialDataMac initialDataMac);
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.GetInitialDataMac(out InitialDataMac initialDataMac);
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outInitialDataMac = initialDataMac;
|
||||
return Result.Success;
|
||||
@ -222,9 +222,9 @@ public class SaveDataExporterVersion2 : ISaveDataDivisionExporter
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outKeyGeneration);
|
||||
|
||||
Result rc = _baseInterface.Get.GetInitialDataMacKeyGeneration(out int initialDataMacKeyGeneration);
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.GetInitialDataMacKeyGeneration(out int initialDataMacKeyGeneration);
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outKeyGeneration = initialDataMacKeyGeneration;
|
||||
return Result.Success;
|
||||
@ -232,18 +232,18 @@ public class SaveDataExporterVersion2 : ISaveDataDivisionExporter
|
||||
|
||||
public Result FinalizeExport()
|
||||
{
|
||||
Result rc = _baseInterface.Get.FinalizeExport();
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.FinalizeExport();
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
public Result CancelExport()
|
||||
{
|
||||
Result rc = _baseInterface.Get.CancelExport();
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.CancelExport();
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -252,9 +252,9 @@ public class SaveDataExporterVersion2 : ISaveDataDivisionExporter
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outContext);
|
||||
|
||||
Result rc = _baseInterface.Get.SuspendExport(OutBuffer.FromStruct(ref outContext));
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.SuspendExport(OutBuffer.FromStruct(ref outContext));
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -263,9 +263,9 @@ public class SaveDataExporterVersion2 : ISaveDataDivisionExporter
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outInitialDataAad);
|
||||
|
||||
Result rc = _baseInterface.Get.GetImportInitialDataAad(out InitialDataAad initialDataAad);
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.GetImportInitialDataAad(out InitialDataAad initialDataAad);
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outInitialDataAad = initialDataAad;
|
||||
return Result.Success;
|
||||
@ -273,9 +273,9 @@ public class SaveDataExporterVersion2 : ISaveDataDivisionExporter
|
||||
|
||||
public Result SetExportInitialDataAad(in InitialDataAad initialDataAad)
|
||||
{
|
||||
Result rc = _baseInterface.Get.SetExportInitialDataAad(in initialDataAad);
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.SetExportInitialDataAad(in initialDataAad);
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -285,9 +285,9 @@ public class SaveDataExporterVersion2 : ISaveDataDivisionExporter
|
||||
UnsafeHelpers.SkipParamInit(out outCommitId);
|
||||
Unsafe.SkipInit(out SaveDataExtraData extraData);
|
||||
|
||||
Result rc = _baseInterface.Get.ReadSaveDataExtraData(OutBuffer.FromStruct(ref extraData));
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.ReadSaveDataExtraData(OutBuffer.FromStruct(ref extraData));
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outCommitId = extraData.CommitId;
|
||||
return Result.Success;
|
||||
@ -298,9 +298,9 @@ public class SaveDataExporterVersion2 : ISaveDataDivisionExporter
|
||||
UnsafeHelpers.SkipParamInit(out outTimeStamp);
|
||||
Unsafe.SkipInit(out SaveDataExtraData extraData);
|
||||
|
||||
Result rc = _baseInterface.Get.ReadSaveDataExtraData(OutBuffer.FromStruct(ref extraData));
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.ReadSaveDataExtraData(OutBuffer.FromStruct(ref extraData));
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outTimeStamp = new PosixTime(extraData.TimeStamp);
|
||||
return Result.Success;
|
||||
@ -308,9 +308,9 @@ public class SaveDataExporterVersion2 : ISaveDataDivisionExporter
|
||||
|
||||
public Result GetReportInfo(out ExportReportInfo outReportInfo)
|
||||
{
|
||||
Result rc = _baseInterface.Get.GetReportInfo(out outReportInfo);
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.GetReportInfo(out outReportInfo);
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -342,36 +342,36 @@ public class SaveDataImporterVersion2 : ISaveDataDivisionImporter
|
||||
|
||||
public Result InitializeImport(out long remaining, long sizeToProcess)
|
||||
{
|
||||
Result rc = _baseInterface.Get.InitializeImport(out remaining, sizeToProcess);
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.InitializeImport(out remaining, sizeToProcess);
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
public Result FinalizeImport()
|
||||
{
|
||||
Result rc = _baseInterface.Get.FinalizeImport();
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.FinalizeImport();
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
public Result FinalizeImportWithoutSwap()
|
||||
{
|
||||
Result rc = _baseInterface.Get.FinalizeImportWithoutSwap();
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.FinalizeImportWithoutSwap();
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
public Result CancelImport()
|
||||
{
|
||||
Result rc = _baseInterface.Get.CancelImport();
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.CancelImport();
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -380,18 +380,18 @@ public class SaveDataImporterVersion2 : ISaveDataDivisionImporter
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outContext);
|
||||
|
||||
Result rc = _baseInterface.Get.GetImportContext(OutBuffer.FromStruct(ref outContext));
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.GetImportContext(OutBuffer.FromStruct(ref outContext));
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
public Result SuspendImport()
|
||||
{
|
||||
Result rc = _baseInterface.Get.SuspendImport();
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.SuspendImport();
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -400,9 +400,9 @@ public class SaveDataImporterVersion2 : ISaveDataDivisionImporter
|
||||
{
|
||||
using var iteratorObject = new SharedRef<FsSrv.Sf.ISaveDataChunkIterator>();
|
||||
|
||||
Result rc = _baseInterface.Get.OpenSaveDataDiffChunkIterator(ref iteratorObject.Ref());
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.OpenSaveDataDiffChunkIterator(ref iteratorObject.Ref());
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outIterator.Reset(new SaveDataChunkIterator(_fsClient, ref iteratorObject.Ref()));
|
||||
return Result.Success;
|
||||
@ -412,9 +412,9 @@ public class SaveDataImporterVersion2 : ISaveDataDivisionImporter
|
||||
{
|
||||
using var importerObject = new SharedRef<FsSrv.Sf.ISaveDataChunkImporter>();
|
||||
|
||||
Result rc = _baseInterface.Get.OpenSaveDataChunkImporter(ref importerObject.Ref(), chunkId);
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.OpenSaveDataChunkImporter(ref importerObject.Ref(), chunkId);
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outImporter.Reset(new SaveDataChunkImporter(_fsClient, ref importerObject.Ref()));
|
||||
return Result.Success;
|
||||
@ -424,9 +424,9 @@ public class SaveDataImporterVersion2 : ISaveDataDivisionImporter
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outInitialDataAad);
|
||||
|
||||
Result rc = _baseInterface.Get.GetImportInitialDataAad(out InitialDataAad initialDataAad);
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.GetImportInitialDataAad(out InitialDataAad initialDataAad);
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outInitialDataAad = initialDataAad;
|
||||
return Result.Success;
|
||||
@ -437,9 +437,9 @@ public class SaveDataImporterVersion2 : ISaveDataDivisionImporter
|
||||
UnsafeHelpers.SkipParamInit(out outCommitId);
|
||||
Unsafe.SkipInit(out SaveDataExtraData extraData);
|
||||
|
||||
Result rc = _baseInterface.Get.ReadSaveDataExtraData(OutBuffer.FromStruct(ref extraData));
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.ReadSaveDataExtraData(OutBuffer.FromStruct(ref extraData));
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outCommitId = extraData.CommitId;
|
||||
return Result.Success;
|
||||
@ -450,9 +450,9 @@ public class SaveDataImporterVersion2 : ISaveDataDivisionImporter
|
||||
UnsafeHelpers.SkipParamInit(out outTimeStamp);
|
||||
Unsafe.SkipInit(out SaveDataExtraData extraData);
|
||||
|
||||
Result rc = _baseInterface.Get.ReadSaveDataExtraData(OutBuffer.FromStruct(ref extraData));
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.ReadSaveDataExtraData(OutBuffer.FromStruct(ref extraData));
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outTimeStamp = new PosixTime(extraData.TimeStamp);
|
||||
return Result.Success;
|
||||
@ -460,9 +460,9 @@ public class SaveDataImporterVersion2 : ISaveDataDivisionImporter
|
||||
|
||||
public Result GetReportInfo(out ImportReportInfo outReportInfo)
|
||||
{
|
||||
Result rc = _baseInterface.Get.GetReportInfo(out outReportInfo);
|
||||
_fsClient.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.GetReportInfo(out outReportInfo);
|
||||
_fsClient.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -45,9 +45,9 @@ namespace LibHac.Fs
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenSaveDataTransferManagerVersion2(ref _baseInterface);
|
||||
fs.Impl.LogResultErrorMessage(rc);
|
||||
Abort.DoAbortUnless(rc.IsSuccess());
|
||||
Result res = fileSystemProxy.Get.OpenSaveDataTransferManagerVersion2(ref _baseInterface);
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
|
||||
_fsClient = fs;
|
||||
}
|
||||
@ -61,18 +61,18 @@ namespace LibHac.Fs
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outChallenge);
|
||||
|
||||
Result rc = _baseInterface.Get.GetChallenge(OutBuffer.FromStruct(ref outChallenge));
|
||||
_fsClient.Impl.LogResultErrorMessage(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.GetChallenge(OutBuffer.FromStruct(ref outChallenge));
|
||||
_fsClient.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
public Result SetKeySeedPackage(in KeySeedPackage keySeedPackage)
|
||||
{
|
||||
Result rc = _baseInterface.Get.SetKeySeedPackage(InBuffer.FromStruct(in keySeedPackage));
|
||||
_fsClient.Impl.LogResultErrorMessage(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.SetKeySeedPackage(InBuffer.FromStruct(in keySeedPackage));
|
||||
_fsClient.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -82,9 +82,9 @@ namespace LibHac.Fs
|
||||
{
|
||||
using var exporterInterface = new SharedRef<FsSrv.Sf.ISaveDataDivisionExporter>();
|
||||
|
||||
Result rc = _baseInterface.Get.OpenSaveDataExporter(ref exporterInterface.Ref(), spaceId, saveDataId);
|
||||
_fsClient.Impl.LogResultErrorMessage(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseInterface.Get.OpenSaveDataExporter(ref exporterInterface.Ref(), spaceId, saveDataId);
|
||||
_fsClient.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outExporter.Reset(new SaveDataExporterVersion2(_fsClient, ref exporterInterface.Ref()));
|
||||
return Result.Success;
|
||||
@ -95,11 +95,11 @@ namespace LibHac.Fs
|
||||
{
|
||||
using var exporterInterface = new SharedRef<FsSrv.Sf.ISaveDataDivisionExporter>();
|
||||
|
||||
Result rc = _baseInterface.Get.OpenSaveDataExporterForDiffExport(ref exporterInterface.Ref(),
|
||||
Result res = _baseInterface.Get.OpenSaveDataExporterForDiffExport(ref exporterInterface.Ref(),
|
||||
InBuffer.FromStruct(in initialData), spaceId, saveDataId);
|
||||
|
||||
_fsClient.Impl.LogResultErrorMessage(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
_fsClient.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outExporter.Reset(new SaveDataExporterVersion2(_fsClient, ref exporterInterface.Ref()));
|
||||
return Result.Success;
|
||||
@ -110,11 +110,11 @@ namespace LibHac.Fs
|
||||
{
|
||||
using var exporterInterface = new SharedRef<FsSrv.Sf.ISaveDataDivisionExporter>();
|
||||
|
||||
Result rc = _baseInterface.Get.OpenSaveDataExporterByContext(ref exporterInterface.Ref(),
|
||||
Result res = _baseInterface.Get.OpenSaveDataExporterByContext(ref exporterInterface.Ref(),
|
||||
InBuffer.FromStruct(in exportContext));
|
||||
|
||||
_fsClient.Impl.LogResultErrorMessage(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
_fsClient.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outExporter.Reset(new SaveDataExporterVersion2(_fsClient, ref exporterInterface.Ref()));
|
||||
return Result.Success;
|
||||
@ -125,11 +125,11 @@ namespace LibHac.Fs
|
||||
{
|
||||
using var importerInterface = new SharedRef<FsSrv.Sf.ISaveDataDivisionImporter>();
|
||||
|
||||
Result rc = _baseInterface.Get.OpenSaveDataImporterDeprecated(ref importerInterface.Ref(),
|
||||
Result res = _baseInterface.Get.OpenSaveDataImporterDeprecated(ref importerInterface.Ref(),
|
||||
InBuffer.FromStruct(in initialData), in userId, spaceId);
|
||||
|
||||
_fsClient.Impl.LogResultErrorMessage(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
_fsClient.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outImporter.Reset(new SaveDataImporterVersion2(_fsClient, ref importerInterface.Ref()));
|
||||
return Result.Success;
|
||||
@ -140,11 +140,11 @@ namespace LibHac.Fs
|
||||
{
|
||||
using var importerInterface = new SharedRef<FsSrv.Sf.ISaveDataDivisionImporter>();
|
||||
|
||||
Result rc = _baseInterface.Get.OpenSaveDataImporterForDiffImport(ref importerInterface.Ref(),
|
||||
Result res = _baseInterface.Get.OpenSaveDataImporterForDiffImport(ref importerInterface.Ref(),
|
||||
InBuffer.FromStruct(in initialData), spaceId, saveDataId);
|
||||
|
||||
_fsClient.Impl.LogResultErrorMessage(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
_fsClient.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outImporter.Reset(new SaveDataImporterVersion2(_fsClient, ref importerInterface.Ref()));
|
||||
return Result.Success;
|
||||
@ -155,11 +155,11 @@ namespace LibHac.Fs
|
||||
{
|
||||
using var importerInterface = new SharedRef<FsSrv.Sf.ISaveDataDivisionImporter>();
|
||||
|
||||
Result rc = _baseInterface.Get.OpenSaveDataImporterForDuplicateDiffImport(ref importerInterface.Ref(),
|
||||
Result res = _baseInterface.Get.OpenSaveDataImporterForDuplicateDiffImport(ref importerInterface.Ref(),
|
||||
InBuffer.FromStruct(in initialData), spaceId, saveDataId);
|
||||
|
||||
_fsClient.Impl.LogResultErrorMessage(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
_fsClient.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outImporter.Reset(new SaveDataImporterVersion2(_fsClient, ref importerInterface.Ref()));
|
||||
return Result.Success;
|
||||
@ -170,11 +170,11 @@ namespace LibHac.Fs
|
||||
{
|
||||
using var importerInterface = new SharedRef<FsSrv.Sf.ISaveDataDivisionImporter>();
|
||||
|
||||
Result rc = _baseInterface.Get.OpenSaveDataImporter(ref importerInterface.Ref(),
|
||||
Result res = _baseInterface.Get.OpenSaveDataImporter(ref importerInterface.Ref(),
|
||||
InBuffer.FromStruct(in initialData), in userId, spaceId, useSwap);
|
||||
|
||||
_fsClient.Impl.LogResultErrorMessage(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
_fsClient.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outImporter.Reset(new SaveDataImporterVersion2(_fsClient, ref importerInterface.Ref()));
|
||||
return Result.Success;
|
||||
@ -191,11 +191,11 @@ namespace LibHac.Fs
|
||||
{
|
||||
using var importerInterface = new SharedRef<FsSrv.Sf.ISaveDataDivisionImporter>();
|
||||
|
||||
Result rc = _baseInterface.Get.OpenSaveDataImporterByContext(ref importerInterface.Ref(),
|
||||
Result res = _baseInterface.Get.OpenSaveDataImporterByContext(ref importerInterface.Ref(),
|
||||
InBuffer.FromStruct(in importContext));
|
||||
|
||||
_fsClient.Impl.LogResultErrorMessage(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
_fsClient.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outImporter.Reset(new SaveDataImporterVersion2(_fsClient, ref importerInterface.Ref()));
|
||||
return Result.Success;
|
||||
@ -203,18 +203,18 @@ namespace LibHac.Fs
|
||||
|
||||
public static SaveDataTag MakeUserAccountSaveDataTag(Ncm.ApplicationId applicationId, in UserId userId)
|
||||
{
|
||||
Result rc = SaveDataAttribute.Make(out SaveDataAttribute attribute, applicationId, SaveDataType.Account,
|
||||
Result res = SaveDataAttribute.Make(out SaveDataAttribute attribute, applicationId, SaveDataType.Account,
|
||||
userId, InvalidSystemSaveDataId, index: 0, SaveDataRank.Primary);
|
||||
Abort.DoAbortUnless(rc.IsSuccess());
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
|
||||
return Unsafe.As<SaveDataAttribute, SaveDataTag>(ref attribute);
|
||||
}
|
||||
|
||||
public static SaveDataTag MakeDeviceSaveDataTag(Ncm.ApplicationId applicationId)
|
||||
{
|
||||
Result rc = SaveDataAttribute.Make(out SaveDataAttribute attribute, applicationId, SaveDataType.Device,
|
||||
Result res = SaveDataAttribute.Make(out SaveDataAttribute attribute, applicationId, SaveDataType.Device,
|
||||
InvalidUserId, InvalidSystemSaveDataId, index: 0, SaveDataRank.Primary);
|
||||
Abort.DoAbortUnless(rc.IsSuccess());
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
|
||||
return Unsafe.As<SaveDataAttribute, SaveDataTag>(ref attribute);
|
||||
}
|
||||
@ -224,20 +224,20 @@ namespace LibHac.Fs
|
||||
ref readonly SaveDataAttribute attribute =
|
||||
ref Unsafe.As<SaveDataTag, SaveDataAttribute>(ref Unsafe.AsRef(in tag));
|
||||
|
||||
Result rc = _baseInterface.Get.CancelSuspendingImportByAttribute(in attribute);
|
||||
Result res = _baseInterface.Get.CancelSuspendingImportByAttribute(in attribute);
|
||||
|
||||
_fsClient.Impl.LogResultErrorMessage(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
_fsClient.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
public Result CancelSuspendingImport(Ncm.ApplicationId applicationId, in UserId userId)
|
||||
{
|
||||
Result rc = _baseInterface.Get.CancelSuspendingImport(applicationId, in userId);
|
||||
Result res = _baseInterface.Get.CancelSuspendingImport(applicationId, in userId);
|
||||
|
||||
_fsClient.Impl.LogResultErrorMessage(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
_fsClient.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -249,10 +249,10 @@ namespace LibHac.Fs
|
||||
ref readonly SaveDataAttribute attribute =
|
||||
ref Unsafe.As<SaveDataTag, SaveDataAttribute>(ref Unsafe.AsRef(in tag));
|
||||
|
||||
Result rc = _baseInterface.Get.SwapSecondary(in attribute, doSwap, commitId);
|
||||
Result res = _baseInterface.Get.SwapSecondary(in attribute, doSwap, commitId);
|
||||
|
||||
_fsClient.Impl.LogResultErrorMessage(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
_fsClient.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -294,8 +294,8 @@ namespace LibHac.Fs.Shim
|
||||
using var prohibiter = new SharedRef<ISaveDataTransferProhibiter>();
|
||||
|
||||
// Todo: Uncomment once opening transfer prohibiters is implemented
|
||||
// Result rc = fileSystemProxy.Get.OpenSaveDataTransferProhibiter(ref prohibiter.Ref(), applicationId);
|
||||
// if (rc.IsFailure()) return rc.Miss();
|
||||
// Result res = fileSystemProxy.Get.OpenSaveDataTransferProhibiter(ref prohibiter.Ref(), applicationId);
|
||||
// if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outProhibiter.Reset(new SaveDataTransferProhibiterForCloudBackUp(ref prohibiter.Ref()));
|
||||
|
||||
@ -305,9 +305,9 @@ namespace LibHac.Fs.Shim
|
||||
public static Result OpenSaveDataTransferProhibiterForCloudBackUp(this FileSystemClient fs,
|
||||
ref UniqueRef<SaveDataTransferProhibiterForCloudBackUp> outProhibiter, Ncm.ApplicationId applicationId)
|
||||
{
|
||||
Result rc = fs.Impl.OpenSaveDataTransferProhibiterForCloudBackUp(ref outProhibiter, applicationId);
|
||||
fs.Impl.LogResultErrorMessage(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fs.Impl.OpenSaveDataTransferProhibiterForCloudBackUp(ref outProhibiter, applicationId);
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -318,11 +318,11 @@ namespace LibHac.Fs.Shim
|
||||
{
|
||||
for (int i = 0; i < applicationIds.Length; i++)
|
||||
{
|
||||
Result rc = fs.Impl.OpenSaveDataTransferProhibiterForCloudBackUp(ref outProhibiters[i],
|
||||
Result res = fs.Impl.OpenSaveDataTransferProhibiterForCloudBackUp(ref outProhibiters[i],
|
||||
applicationIds[i]);
|
||||
|
||||
fs.Impl.LogResultErrorMessage(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
return Result.Success;
|
||||
@ -335,11 +335,11 @@ namespace LibHac.Fs.Shim
|
||||
ulong tempAppId = 0;
|
||||
var programId = new Ncm.ProgramId(applicationId.Value + (uint)programIndex);
|
||||
|
||||
Result rc = fileSystemProxy.Get.ListAccessibleSaveDataOwnerId(out outCount,
|
||||
Result res = fileSystemProxy.Get.ListAccessibleSaveDataOwnerId(out outCount,
|
||||
OutBuffer.FromStruct(ref tempAppId), programId, startIndex: 0, bufferIdCount: 0);
|
||||
|
||||
fs.Impl.LogResultErrorMessage(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -351,15 +351,15 @@ namespace LibHac.Fs.Shim
|
||||
using var iterator = new UniqueRef<SaveDataIterator>();
|
||||
|
||||
// We want to iterate every save with a Secondary rank
|
||||
Result rc = SaveDataFilter.Make(out SaveDataFilter filter, programId: default, saveType: default,
|
||||
Result res = SaveDataFilter.Make(out SaveDataFilter filter, programId: default, saveType: default,
|
||||
userId: default, saveDataId: default, index: default, SaveDataRank.Secondary);
|
||||
|
||||
fs.Impl.LogResultErrorMessage(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = fs.Impl.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.User, in filter);
|
||||
fs.Impl.LogResultErrorMessage(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fs.Impl.OpenSaveDataIterator(ref iterator.Ref(), SaveDataSpaceId.User, in filter);
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
long workSize = 0;
|
||||
|
||||
@ -367,11 +367,11 @@ namespace LibHac.Fs.Shim
|
||||
{
|
||||
Unsafe.SkipInit(out SaveDataInfo info);
|
||||
|
||||
rc = fs.Impl.ReadSaveDataIteratorSaveDataInfo(out long count, SpanHelpers.AsSpan(ref info),
|
||||
res = fs.Impl.ReadSaveDataIteratorSaveDataInfo(out long count, SpanHelpers.AsSpan(ref info),
|
||||
ref iterator.Get);
|
||||
|
||||
fs.Impl.LogResultErrorMessage(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Break once we've iterated all saves
|
||||
if (count == 0)
|
||||
|
@ -35,16 +35,16 @@ public static class SdCard
|
||||
|
||||
for (int i = 0; i < maxRetries; i++)
|
||||
{
|
||||
Result rc = fileSystemProxy.Get.OpenSdCardFileSystem(ref outFileSystem);
|
||||
Result res = fileSystemProxy.Get.OpenSdCardFileSystem(ref outFileSystem);
|
||||
|
||||
if (rc.IsSuccess())
|
||||
if (res.IsSuccess())
|
||||
break;
|
||||
|
||||
if (!ResultFs.StorageDeviceNotReady.Includes(rc))
|
||||
return rc;
|
||||
if (!ResultFs.StorageDeviceNotReady.Includes(res))
|
||||
return res;
|
||||
|
||||
if (i == maxRetries - 1)
|
||||
return rc;
|
||||
return res;
|
||||
|
||||
fs.Hos.Os.SleepThread(TimeSpan.FromMilliSeconds(retryInterval));
|
||||
}
|
||||
@ -67,29 +67,29 @@ public static class SdCard
|
||||
|
||||
public static Result MountSdCard(this FileSystemClient fs, U8Span mountName)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x30];
|
||||
|
||||
// Check if the mount name is valid
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fs.Impl.CheckMountName(mountName);
|
||||
res = fs.Impl.CheckMountName(mountName);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogName).Append(mountName);
|
||||
logBuffer = sb.Buffer;
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fs.Impl.CheckMountName(mountName);
|
||||
res = fs.Impl.CheckMountName(mountName);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Open the SD card file system
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
@ -97,34 +97,34 @@ public static class SdCard
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = OpenSdCardFileSystem(fs, ref fileSystem.Ref());
|
||||
res = OpenSdCardFileSystem(fs, ref fileSystem.Ref());
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = OpenSdCardFileSystem(fs, ref fileSystem.Ref());
|
||||
res = OpenSdCardFileSystem(fs, ref fileSystem.Ref());
|
||||
}
|
||||
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Mount the file system
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = RegisterFileSystem(fs, mountName, ref fileSystem.Ref());
|
||||
res = RegisterFileSystem(fs, mountName, ref fileSystem.Ref());
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = RegisterFileSystem(fs, mountName, ref fileSystem.Ref());
|
||||
res = RegisterFileSystem(fs, mountName, ref fileSystem.Ref());
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -134,29 +134,29 @@ public static class SdCard
|
||||
|
||||
public static Result MountSdCardForDebug(this FileSystemClient fs, U8Span mountName)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x30];
|
||||
|
||||
// Check if the mount name is valid
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = fs.Impl.CheckMountName(mountName);
|
||||
res = fs.Impl.CheckMountName(mountName);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var sb = new U8StringBuilder(logBuffer, true);
|
||||
sb.Append(LogName).Append(mountName);
|
||||
logBuffer = sb.Buffer;
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fs.Impl.CheckMountName(mountName);
|
||||
res = fs.Impl.CheckMountName(mountName);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Open the SD card file system
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
@ -164,34 +164,34 @@ public static class SdCard
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = OpenSdCardFileSystem(fs, ref fileSystem.Ref());
|
||||
res = OpenSdCardFileSystem(fs, ref fileSystem.Ref());
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLogUnlessResultSuccess(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = OpenSdCardFileSystem(fs, ref fileSystem.Ref());
|
||||
res = OpenSdCardFileSystem(fs, ref fileSystem.Ref());
|
||||
}
|
||||
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Mount the file system
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = RegisterFileSystem(fs, mountName, ref fileSystem.Ref());
|
||||
res = RegisterFileSystem(fs, mountName, ref fileSystem.Ref());
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(logBuffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(logBuffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = RegisterFileSystem(fs, mountName, ref fileSystem.Ref());
|
||||
res = RegisterFileSystem(fs, mountName, ref fileSystem.Ref());
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.Application))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
@ -204,13 +204,13 @@ public static class SdCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.LogResultErrorMessage(rc);
|
||||
Abort.DoAbortUnless(rc.IsSuccess());
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
|
||||
rc = CheckIfInserted(fs, ref deviceOperator.Ref(), out bool isInserted);
|
||||
fs.Impl.LogResultErrorMessage(rc);
|
||||
Abort.DoAbortUnless(rc.IsSuccess());
|
||||
res = CheckIfInserted(fs, ref deviceOperator.Ref(), out bool isInserted);
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
|
||||
return isInserted;
|
||||
|
||||
@ -225,16 +225,16 @@ public static class SdCard
|
||||
|
||||
for (int i = 0; i < maxRetries; i++)
|
||||
{
|
||||
Result rc = deviceOperator.Get.IsSdCardInserted(out isInserted);
|
||||
Result res = deviceOperator.Get.IsSdCardInserted(out isInserted);
|
||||
|
||||
if (rc.IsSuccess())
|
||||
if (res.IsSuccess())
|
||||
break;
|
||||
|
||||
if (!ResultFs.StorageDeviceNotReady.Includes(rc))
|
||||
return rc;
|
||||
if (!ResultFs.StorageDeviceNotReady.Includes(res))
|
||||
return res;
|
||||
|
||||
if (i == maxRetries - 1)
|
||||
return rc;
|
||||
return res;
|
||||
|
||||
fs.Hos.Os.SleepThread(TimeSpan.FromMilliSeconds(retryInterval));
|
||||
}
|
||||
@ -250,13 +250,13 @@ public static class SdCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = GetSpeedMode(fs, in deviceOperator, out long speedMode);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = GetSpeedMode(fs, in deviceOperator, out long speedMode);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outMode = (SdCardSpeedMode)speedMode;
|
||||
return Result.Success;
|
||||
@ -272,16 +272,16 @@ public static class SdCard
|
||||
|
||||
for (int i = 0; i < maxRetries; i++)
|
||||
{
|
||||
Result rc = deviceOperator.Get.GetSdCardSpeedMode(out outSpeedMode);
|
||||
Result res = deviceOperator.Get.GetSdCardSpeedMode(out outSpeedMode);
|
||||
|
||||
if (rc.IsSuccess())
|
||||
if (res.IsSuccess())
|
||||
break;
|
||||
|
||||
if (!ResultFs.StorageDeviceNotReady.Includes(rc))
|
||||
return rc;
|
||||
if (!ResultFs.StorageDeviceNotReady.Includes(res))
|
||||
return res;
|
||||
|
||||
if (i == maxRetries - 1)
|
||||
return rc;
|
||||
return res;
|
||||
|
||||
fs.Hos.Os.SleepThread(TimeSpan.FromMilliSeconds(retryInterval));
|
||||
}
|
||||
@ -295,13 +295,13 @@ public static class SdCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = GetCid(fs, in deviceOperator, outCidBuffer);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = GetCid(fs, in deviceOperator, outCidBuffer);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
|
||||
@ -313,16 +313,16 @@ public static class SdCard
|
||||
|
||||
for (int i = 0; i < maxRetries; i++)
|
||||
{
|
||||
Result rc = deviceOperator.Get.GetSdCardCid(new OutBuffer(outCidBuffer), outCidBuffer.Length);
|
||||
Result res = deviceOperator.Get.GetSdCardCid(new OutBuffer(outCidBuffer), outCidBuffer.Length);
|
||||
|
||||
if (rc.IsSuccess())
|
||||
if (res.IsSuccess())
|
||||
break;
|
||||
|
||||
if (!ResultFs.StorageDeviceNotReady.Includes(rc))
|
||||
return rc;
|
||||
if (!ResultFs.StorageDeviceNotReady.Includes(res))
|
||||
return res;
|
||||
|
||||
if (i == maxRetries - 1)
|
||||
return rc;
|
||||
return res;
|
||||
|
||||
fs.Hos.Os.SleepThread(TimeSpan.FromMilliSeconds(retryInterval));
|
||||
}
|
||||
@ -338,13 +338,13 @@ public static class SdCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = GetUserAreaSize(fs, in deviceOperator, out outSize);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = GetUserAreaSize(fs, in deviceOperator, out outSize);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
|
||||
@ -359,16 +359,16 @@ public static class SdCard
|
||||
|
||||
for (int i = 0; i < maxRetries; i++)
|
||||
{
|
||||
Result rc = deviceOperator.Get.GetSdCardUserAreaSize(out outSize);
|
||||
Result res = deviceOperator.Get.GetSdCardUserAreaSize(out outSize);
|
||||
|
||||
if (rc.IsSuccess())
|
||||
if (res.IsSuccess())
|
||||
break;
|
||||
|
||||
if (!ResultFs.StorageDeviceNotReady.Includes(rc))
|
||||
return rc;
|
||||
if (!ResultFs.StorageDeviceNotReady.Includes(res))
|
||||
return res;
|
||||
|
||||
if (i == maxRetries - 1)
|
||||
return rc;
|
||||
return res;
|
||||
|
||||
fs.Hos.Os.SleepThread(TimeSpan.FromMilliSeconds(retryInterval));
|
||||
}
|
||||
@ -384,13 +384,13 @@ public static class SdCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = GetProtectedAreaSize(fs, in deviceOperator, out outSize);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = GetProtectedAreaSize(fs, in deviceOperator, out outSize);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
|
||||
@ -405,16 +405,16 @@ public static class SdCard
|
||||
|
||||
for (int i = 0; i < maxRetries; i++)
|
||||
{
|
||||
Result rc = deviceOperator.Get.GetSdCardProtectedAreaSize(out outSize);
|
||||
Result res = deviceOperator.Get.GetSdCardProtectedAreaSize(out outSize);
|
||||
|
||||
if (rc.IsSuccess())
|
||||
if (res.IsSuccess())
|
||||
break;
|
||||
|
||||
if (!ResultFs.StorageDeviceNotReady.Includes(rc))
|
||||
return rc;
|
||||
if (!ResultFs.StorageDeviceNotReady.Includes(res))
|
||||
return res;
|
||||
|
||||
if (i == maxRetries - 1)
|
||||
return rc;
|
||||
return res;
|
||||
|
||||
fs.Hos.Os.SleepThread(TimeSpan.FromMilliSeconds(retryInterval));
|
||||
}
|
||||
@ -431,13 +431,13 @@ public static class SdCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = GetErrorInfo(fs, in deviceOperator, out outErrorInfo, out long logSize, logBuffer);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = GetErrorInfo(fs, in deviceOperator, out outErrorInfo, out long logSize, logBuffer);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outLogSize = logSize;
|
||||
return Result.Success;
|
||||
@ -453,17 +453,17 @@ public static class SdCard
|
||||
|
||||
for (int i = 0; i < maxRetries; i++)
|
||||
{
|
||||
Result rc = deviceOperator.Get.GetAndClearSdCardErrorInfo(out outErrorInfo, out outLogSize,
|
||||
Result res = deviceOperator.Get.GetAndClearSdCardErrorInfo(out outErrorInfo, out outLogSize,
|
||||
new OutBuffer(logBuffer), logBuffer.Length);
|
||||
|
||||
if (rc.IsSuccess())
|
||||
if (res.IsSuccess())
|
||||
break;
|
||||
|
||||
if (!ResultFs.StorageDeviceNotReady.Includes(rc))
|
||||
return rc;
|
||||
if (!ResultFs.StorageDeviceNotReady.Includes(res))
|
||||
return res;
|
||||
|
||||
if (i == maxRetries - 1)
|
||||
return rc;
|
||||
return res;
|
||||
|
||||
fs.Hos.Os.SleepThread(TimeSpan.FromMilliSeconds(retryInterval));
|
||||
}
|
||||
@ -476,9 +476,9 @@ public static class SdCard
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = Format(fs, in fileSystemProxy);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = Format(fs, in fileSystemProxy);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
|
||||
@ -490,16 +490,16 @@ public static class SdCard
|
||||
|
||||
for (int i = 0; i < maxRetries; i++)
|
||||
{
|
||||
Result rc = fileSystemProxy.Get.FormatSdCardFileSystem();
|
||||
Result res = fileSystemProxy.Get.FormatSdCardFileSystem();
|
||||
|
||||
if (rc.IsSuccess())
|
||||
if (res.IsSuccess())
|
||||
break;
|
||||
|
||||
if (!ResultFs.StorageDeviceNotReady.Includes(rc))
|
||||
return rc;
|
||||
if (!ResultFs.StorageDeviceNotReady.Includes(res))
|
||||
return res;
|
||||
|
||||
if (i == maxRetries - 1)
|
||||
return rc;
|
||||
return res;
|
||||
|
||||
fs.Hos.Os.SleepThread(TimeSpan.FromMilliSeconds(retryInterval));
|
||||
}
|
||||
@ -512,9 +512,9 @@ public static class SdCard
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.FormatSdCardDryRun();
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.FormatSdCardDryRun();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -523,9 +523,9 @@ public static class SdCard
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.IsExFatSupported(out bool isSupported);
|
||||
fs.Impl.LogResultErrorMessage(rc);
|
||||
Abort.DoAbortUnless(rc.IsSuccess());
|
||||
Result res = fileSystemProxy.Get.IsExFatSupported(out bool isSupported);
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
|
||||
return isSupported;
|
||||
}
|
||||
@ -534,25 +534,25 @@ public static class SdCard
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.SetSdCardEncryptionSeed(in seed);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
Result res = fileSystemProxy.Get.SetSdCardEncryptionSeed(in seed);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
public static void SetSdCardAccessibility(this FileSystemClient fs, bool isAccessible)
|
||||
{
|
||||
Result rc = fs.Impl.SetSdCardAccessibility(isAccessible);
|
||||
fs.Impl.LogResultErrorMessage(rc);
|
||||
Abort.DoAbortUnless(rc.IsSuccess());
|
||||
Result res = fs.Impl.SetSdCardAccessibility(isAccessible);
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
}
|
||||
|
||||
public static bool IsSdCardAccessible(this FileSystemClient fs)
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.IsSdCardAccessible(out bool isAccessible);
|
||||
fs.Impl.LogResultErrorMessage(rc);
|
||||
Abort.DoAbortUnless(rc.IsSuccess());
|
||||
Result res = fileSystemProxy.Get.IsSdCardAccessible(out bool isAccessible);
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
|
||||
return isAccessible;
|
||||
}
|
||||
@ -569,9 +569,9 @@ public static class SdCard
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.SimulateDeviceDetectionEvent(SdmmcPort.SdCard, mode, signalEvent);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.SimulateDeviceDetectionEvent(SdmmcPort.SdCard, mode, signalEvent);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -580,10 +580,10 @@ public static class SdCard
|
||||
SimulatingDeviceTargetOperation simulatedOperationType,
|
||||
SimulatingDeviceAccessFailureEventType simulatedFailureType)
|
||||
{
|
||||
Result rc = SetSdCardSimulationEvent(fs, simulatedOperationType, simulatedFailureType, Result.Success,
|
||||
Result res = SetSdCardSimulationEvent(fs, simulatedOperationType, simulatedFailureType, Result.Success,
|
||||
autoClearEvent: false);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -592,10 +592,10 @@ public static class SdCard
|
||||
SimulatingDeviceTargetOperation simulatedOperationType,
|
||||
SimulatingDeviceAccessFailureEventType simulatedFailureType, bool autoClearEvent)
|
||||
{
|
||||
Result rc = SetSdCardSimulationEvent(fs, simulatedOperationType, simulatedFailureType, Result.Success,
|
||||
Result res = SetSdCardSimulationEvent(fs, simulatedOperationType, simulatedFailureType, Result.Success,
|
||||
autoClearEvent);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -603,10 +603,10 @@ public static class SdCard
|
||||
public static Result SetSdCardSimulationEvent(this FileSystemClient fs,
|
||||
SimulatingDeviceTargetOperation simulatedOperationType, Result failureResult, bool autoClearEvent)
|
||||
{
|
||||
Result rc = SetSdCardSimulationEvent(fs, simulatedOperationType,
|
||||
Result res = SetSdCardSimulationEvent(fs, simulatedOperationType,
|
||||
SimulatingDeviceAccessFailureEventType.AccessFailure, failureResult, autoClearEvent);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -616,13 +616,13 @@ public static class SdCard
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.ClearDeviceSimulationEvent((uint)SdmmcPort.SdCard);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.ClearDeviceSimulationEvent((uint)SdmmcPort.SdCard);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -631,8 +631,8 @@ public static class SdCard
|
||||
{
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.GetFileSystemProxyServiceObject();
|
||||
|
||||
Result rc = fileSystemProxy.Get.SetSdCardAccessibility(isAccessible);
|
||||
fs.AbortIfNeeded(rc);
|
||||
return rc;
|
||||
Result res = fileSystemProxy.Get.SetSdCardAccessibility(isAccessible);
|
||||
fs.AbortIfNeeded(res);
|
||||
return res;
|
||||
}
|
||||
}
|
@ -17,12 +17,12 @@ public static class SdmmcControl
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.GetSdmmcConnectionStatus(out int speedMode, out int busWidth, (int)port);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.GetSdmmcConnectionStatus(out int speedMode, out int busWidth, (int)port);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outSpeedMode = (SdmmcSpeedMode)speedMode;
|
||||
outBusWidth = (SdmmcBusWidth)busWidth;
|
||||
@ -35,13 +35,13 @@ public static class SdmmcControl
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.SuspendSdmmcControl();
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.SuspendSdmmcControl();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -51,13 +51,13 @@ public static class SdmmcControl
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.ResumeSdmmcControl();
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.ResumeSdmmcControl();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -14,35 +14,35 @@ public static class SignedSystemPartition
|
||||
{
|
||||
public static bool IsValidSignedSystemPartitionOnSdCard(this FileSystemClient fs, U8Span path)
|
||||
{
|
||||
Result rc = fs.Impl.FindFileSystem(out FileSystemAccessor fileSystem, out U8Span _, path);
|
||||
fs.Impl.LogResultErrorMessage(rc);
|
||||
Abort.DoAbortUnlessSuccess(rc);
|
||||
Result res = fs.Impl.FindFileSystem(out FileSystemAccessor fileSystem, out U8Span _, path);
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnlessSuccess(res);
|
||||
|
||||
bool isValid = false;
|
||||
|
||||
rc = Operate(ref isValid, fileSystem);
|
||||
fs.Impl.LogResultErrorMessage(rc);
|
||||
Abort.DoAbortUnlessSuccess(rc);
|
||||
res = Operate(ref isValid, fileSystem);
|
||||
fs.Impl.LogResultErrorMessage(res);
|
||||
Abort.DoAbortUnlessSuccess(res);
|
||||
|
||||
return isValid;
|
||||
|
||||
static Result Operate(ref bool isValid, FileSystemAccessor fileSystem)
|
||||
{
|
||||
Result rc = fileSystem.QueryEntry(SpanHelpers.AsByteSpan(ref isValid), ReadOnlySpan<byte>.Empty,
|
||||
Result res = fileSystem.QueryEntry(SpanHelpers.AsByteSpan(ref isValid), ReadOnlySpan<byte>.Empty,
|
||||
QueryId.IsSignedSystemPartition, new U8Span(new[] { (byte)'/' }));
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
// Any IFileSystems other than a signed system partition IFileSystem should
|
||||
// return an "UnsupportedOperation" result
|
||||
if (ResultFs.UnsupportedOperation.Includes(rc))
|
||||
if (ResultFs.UnsupportedOperation.Includes(res))
|
||||
{
|
||||
rc.Catch();
|
||||
res.Catch();
|
||||
isValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return rc.Miss();
|
||||
return res.Miss();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,13 +21,13 @@ namespace LibHac.Fs.Shim
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.SetSpeedEmulationMode((int)mode);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.SetSpeedEmulationMode((int)mode);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -39,13 +39,13 @@ namespace LibHac.Fs.Shim
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
using var deviceOperator = new SharedRef<IDeviceOperator>();
|
||||
|
||||
Result rc = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = fileSystemProxy.Get.OpenDeviceOperator(ref deviceOperator.Ref());
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = deviceOperator.Get.GetSpeedEmulationMode(out int mode);
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = deviceOperator.Get.GetSpeedEmulationMode(out int mode);
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outMode = (SpeedEmulationMode)mode;
|
||||
|
||||
|
@ -40,13 +40,13 @@ public static class SystemSaveData
|
||||
public static Result MountSystemSaveData(this FileSystemClient fs, U8Span mountName,
|
||||
SaveDataSpaceId spaceId, ulong saveDataId, UserId userId)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
Span<byte> logBuffer = stackalloc byte[0x90];
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
{
|
||||
Tick start = fs.Hos.Os.GetSystemTick();
|
||||
rc = Mount(fs, mountName, spaceId, saveDataId, userId);
|
||||
res = Mount(fs, mountName, spaceId, saveDataId, userId);
|
||||
Tick end = fs.Hos.Os.GetSystemTick();
|
||||
|
||||
var idString = new IdString();
|
||||
@ -56,37 +56,37 @@ public static class SystemSaveData
|
||||
.Append(LogSaveDataId).AppendFormat(saveDataId, 'X')
|
||||
.Append(LogUserId).AppendFormat(userId.Id.High, 'X', 16).AppendFormat(userId.Id.Low, 'X', 16);
|
||||
|
||||
fs.Impl.OutputAccessLog(rc, start, end, null, new U8Span(sb.Buffer));
|
||||
fs.Impl.OutputAccessLog(res, start, end, null, new U8Span(sb.Buffer));
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = Mount(fs, mountName, spaceId, saveDataId, userId);
|
||||
res = Mount(fs, mountName, spaceId, saveDataId, userId);
|
||||
}
|
||||
|
||||
fs.Impl.AbortIfNeeded(rc);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
fs.Impl.AbortIfNeeded(res);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fs.Impl.IsEnabledAccessLog(AccessLogTarget.System))
|
||||
fs.Impl.EnableFileSystemAccessorAccessLog(mountName);
|
||||
|
||||
return rc;
|
||||
return res;
|
||||
|
||||
static Result Mount(FileSystemClient fs, U8Span mountName, SaveDataSpaceId spaceId, ulong saveDataId,
|
||||
UserId userId)
|
||||
{
|
||||
Result rc = fs.Impl.CheckMountName(mountName);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = fs.Impl.CheckMountName(mountName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IFileSystemProxy> fileSystemProxy = fs.Impl.GetFileSystemProxyServiceObject();
|
||||
|
||||
rc = SaveDataAttribute.Make(out SaveDataAttribute attribute, InvalidProgramId,
|
||||
res = SaveDataAttribute.Make(out SaveDataAttribute attribute, InvalidProgramId,
|
||||
SaveDataType.System, userId, saveDataId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystemSf>();
|
||||
|
||||
rc = fileSystemProxy.Get.OpenSaveDataFileSystemBySystemSaveDataId(ref fileSystem.Ref(), spaceId, in attribute);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = fileSystemProxy.Get.OpenSaveDataFileSystemBySystemSaveDataId(ref fileSystem.Ref(), spaceId, in attribute);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
var fileSystemAdapterRaw = new FileSystemServiceObjectAdapter(ref fileSystem.Ref());
|
||||
using var fileSystemAdapter = new UniqueRef<IFileSystem>(fileSystemAdapterRaw);
|
||||
|
@ -159,11 +159,11 @@ public class SubStorage : IStorage
|
||||
if (!IsValid()) return ResultFs.NotInitialized.Log();
|
||||
if (destination.Length == 0) return Result.Success;
|
||||
|
||||
Result rc = CheckAccessRange(offset, destination.Length, _size);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = CheckAccessRange(offset, destination.Length, _size);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = BaseStorage.Read(_offset + offset, destination);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = BaseStorage.Read(_offset + offset, destination);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -173,11 +173,11 @@ public class SubStorage : IStorage
|
||||
if (!IsValid()) return ResultFs.NotInitialized.Log();
|
||||
if (source.Length == 0) return Result.Success;
|
||||
|
||||
Result rc = CheckAccessRange(offset, source.Length, _size);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = CheckAccessRange(offset, source.Length, _size);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = BaseStorage.Write(_offset + offset, source);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = BaseStorage.Write(_offset + offset, source);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -186,8 +186,8 @@ public class SubStorage : IStorage
|
||||
{
|
||||
if (!IsValid()) return ResultFs.NotInitialized.Log();
|
||||
|
||||
Result rc = BaseStorage.Flush();
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = BaseStorage.Flush();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -197,11 +197,11 @@ public class SubStorage : IStorage
|
||||
if (!IsValid()) return ResultFs.NotInitialized.Log();
|
||||
if (!_isResizable) return ResultFs.UnsupportedSetSizeForNotResizableSubStorage.Log();
|
||||
|
||||
Result rc = CheckOffsetAndSize(_offset, size);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = CheckOffsetAndSize(_offset, size);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = BaseStorage.GetSize(out long currentSize);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = BaseStorage.GetSize(out long currentSize);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (currentSize != _offset + _size)
|
||||
{
|
||||
@ -209,8 +209,8 @@ public class SubStorage : IStorage
|
||||
return ResultFs.UnsupportedSetSizeForResizableSubStorage.Log();
|
||||
}
|
||||
|
||||
rc = BaseStorage.SetSize(_offset + size);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = BaseStorage.SetSize(_offset + size);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
_size = size;
|
||||
|
||||
@ -235,8 +235,8 @@ public class SubStorage : IStorage
|
||||
{
|
||||
if (size == 0) return Result.Success;
|
||||
|
||||
Result rc = CheckOffsetAndSize(_offset, size);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = CheckOffsetAndSize(_offset, size);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
return BaseStorage.OperateRange(outBuffer, operationId, _offset + offset, size, inBuffer);
|
||||
|
@ -31,16 +31,16 @@ public static class Utility
|
||||
|
||||
for (int i = 0; i < maxTryCount; i++)
|
||||
{
|
||||
Result rc = listGetter();
|
||||
Result res = listGetter();
|
||||
|
||||
if (rc.IsSuccess())
|
||||
return rc;
|
||||
if (res.IsSuccess())
|
||||
return res;
|
||||
|
||||
// Try again if any save data were added or removed while getting the list
|
||||
if (!ResultFs.InvalidHandle.Includes(rc))
|
||||
return rc.Miss();
|
||||
if (!ResultFs.InvalidHandle.Includes(res))
|
||||
return res.Miss();
|
||||
|
||||
lastResult = rc;
|
||||
lastResult = res;
|
||||
hos.Os.SleepThread(TimeSpan.FromMilliSeconds(sleepTime));
|
||||
sleepTime *= sleepTimeMultiplier;
|
||||
}
|
||||
|
@ -112,11 +112,11 @@ public struct ValueSubStorage : IDisposable
|
||||
if (!IsValid()) return ResultFs.NotInitialized.Log();
|
||||
if (destination.Length == 0) return Result.Success;
|
||||
|
||||
Result rc = IStorage.CheckAccessRange(offset, destination.Length, _size);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = IStorage.CheckAccessRange(offset, destination.Length, _size);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _baseStorage.Read(_offset + offset, destination);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = _baseStorage.Read(_offset + offset, destination);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -126,11 +126,11 @@ public struct ValueSubStorage : IDisposable
|
||||
if (!IsValid()) return ResultFs.NotInitialized.Log();
|
||||
if (source.Length == 0) return Result.Success;
|
||||
|
||||
Result rc = IStorage.CheckAccessRange(offset, source.Length, _size);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = IStorage.CheckAccessRange(offset, source.Length, _size);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _baseStorage.Write(_offset + offset, source);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = _baseStorage.Write(_offset + offset, source);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -139,8 +139,8 @@ public struct ValueSubStorage : IDisposable
|
||||
{
|
||||
if (!IsValid()) return ResultFs.NotInitialized.Log();
|
||||
|
||||
Result rc = _baseStorage.Flush();
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _baseStorage.Flush();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -150,11 +150,11 @@ public struct ValueSubStorage : IDisposable
|
||||
if (!IsValid()) return ResultFs.NotInitialized.Log();
|
||||
if (!_isResizable) return ResultFs.UnsupportedSetSizeForNotResizableSubStorage.Log();
|
||||
|
||||
Result rc = IStorage.CheckOffsetAndSize(_offset, size);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = IStorage.CheckOffsetAndSize(_offset, size);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _baseStorage.GetSize(out long currentSize);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _baseStorage.GetSize(out long currentSize);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (currentSize != _offset + _size)
|
||||
{
|
||||
@ -162,8 +162,8 @@ public struct ValueSubStorage : IDisposable
|
||||
return ResultFs.UnsupportedSetSizeForResizableSubStorage.Log();
|
||||
}
|
||||
|
||||
rc = _baseStorage.SetSize(_offset + size);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _baseStorage.SetSize(_offset + size);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
_size = size;
|
||||
|
||||
@ -193,8 +193,8 @@ public struct ValueSubStorage : IDisposable
|
||||
{
|
||||
if (size == 0) return Result.Success;
|
||||
|
||||
Result rc = IStorage.CheckOffsetAndSize(_offset, size);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = IStorage.CheckOffsetAndSize(_offset, size);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
return _baseStorage.OperateRange(outBuffer, operationId, _offset + offset, size, inBuffer);
|
||||
|
@ -25,16 +25,16 @@ public readonly struct AccessFailureManagementService
|
||||
public Result OpenAccessFailureDetectionEventNotifier(ref SharedRef<IEventNotifier> outNotifier,
|
||||
ulong processId, bool notifyOnDeepRetry)
|
||||
{
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.CanCall(OperationType.OpenAccessFailureDetectionEventNotifier))
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
||||
using var notifier = new UniqueRef<IEventNotifier>();
|
||||
|
||||
rc = _serviceImpl.CreateNotifier(ref notifier.Ref(), processId, notifyOnDeepRetry);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _serviceImpl.CreateNotifier(ref notifier.Ref(), processId, notifyOnDeepRetry);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outNotifier.Set(ref notifier.Ref());
|
||||
return Result.Success;
|
||||
@ -44,8 +44,8 @@ public readonly struct AccessFailureManagementService
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out eventHandle);
|
||||
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.CanCall(OperationType.GetAccessFailureDetectionEvent))
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
@ -60,8 +60,8 @@ public readonly struct AccessFailureManagementService
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out isDetected);
|
||||
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.CanCall(OperationType.IsAccessFailureDetected))
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
@ -72,8 +72,8 @@ public readonly struct AccessFailureManagementService
|
||||
|
||||
public Result ResolveAccessFailure(ulong processId)
|
||||
{
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.CanCall(OperationType.ResolveAccessFailure))
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
@ -87,8 +87,8 @@ public readonly struct AccessFailureManagementService
|
||||
|
||||
public Result AbandonAccessFailure(ulong processId)
|
||||
{
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.CanCall(OperationType.AbandonAccessFailure))
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
@ -18,8 +18,8 @@ internal readonly struct AccessLogService
|
||||
|
||||
public Result SetAccessLogMode(GlobalAccessLogMode mode)
|
||||
{
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.CanCall(OperationType.SetGlobalAccessLogMode))
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
@ -36,8 +36,8 @@ internal readonly struct AccessLogService
|
||||
|
||||
public Result OutputAccessLogToSdCard(InBuffer textBuffer)
|
||||
{
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return _serviceImpl.OutputAccessLogToSdCard(textBuffer.Buffer, programInfo.ProgramIdValue, _processId);
|
||||
}
|
||||
|
@ -35,8 +35,8 @@ public readonly struct BaseFileSystemService
|
||||
|
||||
private Result CheckCapabilityById(BaseFileSystemId id, ulong processId)
|
||||
{
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo, processId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo, processId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (id == BaseFileSystemId.TemporaryDirectory)
|
||||
{
|
||||
@ -60,13 +60,13 @@ public readonly struct BaseFileSystemService
|
||||
|
||||
public Result OpenBaseFileSystem(ref SharedRef<IFileSystemSf> outFileSystem, BaseFileSystemId fileSystemId)
|
||||
{
|
||||
Result rc = CheckCapabilityById(fileSystemId, _processId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = CheckCapabilityById(fileSystemId, _processId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Open the file system
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
rc = _serviceImpl.OpenBaseFileSystem(ref fileSystem.Ref(), fileSystemId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _serviceImpl.OpenBaseFileSystem(ref fileSystem.Ref(), fileSystemId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Create an SF adapter for the file system
|
||||
using SharedRef<IFileSystemSf> fileSystemAdapter =
|
||||
@ -79,8 +79,8 @@ public readonly struct BaseFileSystemService
|
||||
|
||||
public Result FormatBaseFileSystem(BaseFileSystemId fileSystemId)
|
||||
{
|
||||
Result rc = CheckCapabilityById(fileSystemId, _processId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = CheckCapabilityById(fileSystemId, _processId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return _serviceImpl.FormatBaseFileSystem(fileSystemId);
|
||||
}
|
||||
@ -88,8 +88,8 @@ public readonly struct BaseFileSystemService
|
||||
public Result OpenBisFileSystem(ref SharedRef<IFileSystemSf> outFileSystem, in FspPath rootPath,
|
||||
BisPartitionId partitionId)
|
||||
{
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Get the permissions the caller needs
|
||||
AccessibilityType requiredAccess = partitionId switch
|
||||
@ -117,23 +117,23 @@ public readonly struct BaseFileSystemService
|
||||
|
||||
// Normalize the path
|
||||
using var pathNormalized = new Path();
|
||||
rc = pathNormalized.Initialize(rootPath.Str);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = pathNormalized.Initialize(rootPath.Str);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
var pathFlags = new PathFlags();
|
||||
pathFlags.AllowEmptyPath();
|
||||
rc = pathNormalized.Normalize(pathFlags);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = pathNormalized.Normalize(pathFlags);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Open the file system
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
rc = _serviceImpl.OpenBisFileSystem(ref fileSystem.Ref(), partitionId, false);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _serviceImpl.OpenBisFileSystem(ref fileSystem.Ref(), partitionId, false);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var subDirFileSystem = new SharedRef<IFileSystem>();
|
||||
rc = Utility.CreateSubDirectoryFileSystem(ref subDirFileSystem.Ref(), ref fileSystem.Ref(),
|
||||
res = Utility.CreateSubDirectoryFileSystem(ref subDirFileSystem.Ref(), ref fileSystem.Ref(),
|
||||
in pathNormalized);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Add all the file system wrappers
|
||||
using var typeSetFileSystem =
|
||||
@ -162,8 +162,8 @@ public readonly struct BaseFileSystemService
|
||||
return ResultFs.InvalidSize.Log();
|
||||
|
||||
// Caller must have the FillBis permission
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.CanCall(OperationType.FillBis))
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
@ -174,8 +174,8 @@ public readonly struct BaseFileSystemService
|
||||
public Result DeleteAllPaddingFiles()
|
||||
{
|
||||
// Caller must have the FillBis permission
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.CanCall(OperationType.FillBis))
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
@ -186,16 +186,16 @@ public readonly struct BaseFileSystemService
|
||||
public Result OpenGameCardFileSystem(ref SharedRef<IFileSystemSf> outFileSystem, GameCardHandle handle,
|
||||
GameCardPartition partitionId)
|
||||
{
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.GetAccessibilityFor(AccessibilityType.MountGameCard).CanRead)
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
rc = _serviceImpl.OpenGameCardFileSystem(ref fileSystem.Ref(), handle, partitionId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _serviceImpl.OpenGameCardFileSystem(ref fileSystem.Ref(), handle, partitionId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var asyncFileSystem =
|
||||
new SharedRef<IFileSystem>(new AsynchronousAccessFileSystem(ref fileSystem.Ref()));
|
||||
@ -210,8 +210,8 @@ public readonly struct BaseFileSystemService
|
||||
|
||||
public Result OpenSdCardFileSystem(ref SharedRef<IFileSystemSf> outFileSystem)
|
||||
{
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Accessibility accessibility = programInfo.AccessControl.GetAccessibilityFor(AccessibilityType.MountSdCard);
|
||||
|
||||
@ -222,8 +222,8 @@ public readonly struct BaseFileSystemService
|
||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
rc = _serviceImpl.OpenSdCardProxyFileSystem(ref fileSystem.Ref());
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _serviceImpl.OpenSdCardProxyFileSystem(ref fileSystem.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Add all the file system wrappers
|
||||
using var typeSetFileSystem =
|
||||
@ -243,8 +243,8 @@ public readonly struct BaseFileSystemService
|
||||
public Result FormatSdCardFileSystem()
|
||||
{
|
||||
// Caller must have the FormatSdCard permission
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.CanCall(OperationType.FormatSdCard))
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
@ -271,8 +271,8 @@ public readonly struct BaseFileSystemService
|
||||
ImageDirectoryId directoryId)
|
||||
{
|
||||
// Caller must have the MountImageAndVideoStorage permission
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Accessibility accessibility =
|
||||
programInfo.AccessControl.GetAccessibilityFor(AccessibilityType.MountImageAndVideoStorage);
|
||||
@ -295,8 +295,8 @@ public readonly struct BaseFileSystemService
|
||||
}
|
||||
|
||||
using var baseFileSystem = new SharedRef<IFileSystem>();
|
||||
rc = _serviceImpl.OpenBaseFileSystem(ref baseFileSystem.Ref(), fileSystemId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _serviceImpl.OpenBaseFileSystem(ref baseFileSystem.Ref(), fileSystemId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IFileSystemSf> fileSystemAdapter =
|
||||
FileSystemInterfaceAdapter.CreateShared(ref baseFileSystem.Ref(), false);
|
||||
@ -310,15 +310,15 @@ public readonly struct BaseFileSystemService
|
||||
ulong transferMemorySize)
|
||||
{
|
||||
// Caller must have the OpenBisWiper permission
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.CanCall(OperationType.OpenBisWiper))
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
||||
using var bisWiper = new UniqueRef<IWiper>();
|
||||
rc = _serviceImpl.OpenBisWiper(ref bisWiper.Ref(), transferMemoryHandle, transferMemorySize);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _serviceImpl.OpenBisWiper(ref bisWiper.Ref(), transferMemoryHandle, transferMemorySize);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outBisWiper.Set(ref bisWiper.Ref());
|
||||
|
||||
|
@ -53,8 +53,8 @@ public class BaseFileSystemServiceImpl
|
||||
public Result OpenBisFileSystem(ref SharedRef<IFileSystem> outFileSystem, BisPartitionId partitionId,
|
||||
bool caseSensitive)
|
||||
{
|
||||
Result rc = _config.BisFileSystemCreator.Create(ref outFileSystem, partitionId, caseSensitive);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _config.BisFileSystemCreator.Create(ref outFileSystem, partitionId, caseSensitive);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -73,17 +73,17 @@ public class BaseFileSystemServiceImpl
|
||||
GameCardPartition partitionId)
|
||||
{
|
||||
const int maxTries = 2;
|
||||
Result rc = Result.Success;
|
||||
Result res = Result.Success;
|
||||
|
||||
for (int i = 0; i < maxTries; i++)
|
||||
{
|
||||
rc = _config.GameCardFileSystemCreator.Create(ref outFileSystem, handle, partitionId);
|
||||
res = _config.GameCardFileSystemCreator.Create(ref outFileSystem, handle, partitionId);
|
||||
|
||||
if (!ResultFs.DataCorrupted.Includes(rc))
|
||||
if (!ResultFs.DataCorrupted.Includes(res))
|
||||
break;
|
||||
}
|
||||
|
||||
return rc;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Result OpenSdCardProxyFileSystem(ref SharedRef<IFileSystem> outFileSystem)
|
||||
|
@ -64,11 +64,11 @@ public readonly struct BaseStorageService
|
||||
var storageFlag = StorageLayoutType.Bis;
|
||||
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = GetAccessibilityForOpenBisPartition(out Accessibility accessibility, programInfo, id);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = GetAccessibilityForOpenBisPartition(out Accessibility accessibility, programInfo, id);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
bool canAccess = accessibility.CanRead && accessibility.CanWrite;
|
||||
|
||||
@ -76,8 +76,8 @@ public readonly struct BaseStorageService
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
||||
using var storage = new SharedRef<IStorage>();
|
||||
rc = _serviceImpl.OpenBisStorage(ref storage.Ref(), id);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _serviceImpl.OpenBisStorage(ref storage.Ref(), id);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var typeSetStorage =
|
||||
new SharedRef<IStorage>(new StorageLayoutTypeSetStorage(ref storage.Ref(), storageFlag));
|
||||
@ -94,8 +94,8 @@ public readonly struct BaseStorageService
|
||||
|
||||
public Result InvalidateBisCache()
|
||||
{
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.CanCall(OperationType.InvalidateBisCache))
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
@ -106,8 +106,8 @@ public readonly struct BaseStorageService
|
||||
public Result OpenGameCardStorage(ref SharedRef<IStorageSf> outStorage, GameCardHandle handle,
|
||||
GameCardPartitionRaw partitionId)
|
||||
{
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Accessibility accessibility =
|
||||
programInfo.AccessControl.GetAccessibilityFor(AccessibilityType.OpenGameCardStorage);
|
||||
@ -118,8 +118,8 @@ public readonly struct BaseStorageService
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
||||
using var storage = new SharedRef<IStorage>();
|
||||
rc = _serviceImpl.OpenGameCardPartition(ref storage.Ref(), handle, partitionId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _serviceImpl.OpenGameCardPartition(ref storage.Ref(), handle, partitionId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Todo: Async storage
|
||||
|
||||
@ -133,19 +133,19 @@ public readonly struct BaseStorageService
|
||||
|
||||
public Result OpenDeviceOperator(ref SharedRef<IDeviceOperator> outDeviceOperator)
|
||||
{
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _serviceImpl.OpenDeviceOperator(ref outDeviceOperator, programInfo.AccessControl);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = _serviceImpl.OpenDeviceOperator(ref outDeviceOperator, programInfo.AccessControl);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
public Result OpenSdCardDetectionEventNotifier(ref SharedRef<IEventNotifier> outEventNotifier)
|
||||
{
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.CanCall(OperationType.OpenSdCardDetectionEventNotifier))
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
@ -155,8 +155,8 @@ public readonly struct BaseStorageService
|
||||
|
||||
public Result OpenGameCardDetectionEventNotifier(ref SharedRef<IEventNotifier> outEventNotifier)
|
||||
{
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.CanCall(OperationType.OpenGameCardDetectionEventNotifier))
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
@ -166,8 +166,8 @@ public readonly struct BaseStorageService
|
||||
|
||||
public Result SimulateDeviceDetectionEvent(SdmmcPort port, SimulatingDeviceDetectionMode mode, bool signalEvent)
|
||||
{
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.CanCall(OperationType.SimulateDevice))
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
@ -37,8 +37,8 @@ public struct DebugConfigurationService
|
||||
|
||||
public Result Register(uint key, long value)
|
||||
{
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo, _processId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo, _processId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.CanCall(OperationType.SetDebugConfiguration))
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
@ -49,8 +49,8 @@ public struct DebugConfigurationService
|
||||
|
||||
public Result Unregister(uint key)
|
||||
{
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo, _processId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo, _processId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.CanCall(OperationType.SetDebugConfiguration))
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
@ -37,37 +37,37 @@ public class FileSystemProxyCoreImpl
|
||||
|
||||
if (storageId == CustomStorageId.System)
|
||||
{
|
||||
Result rc = _baseFileSystemService.OpenBisFileSystem(ref fileSystem.Ref(), BisPartitionId.User);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = _baseFileSystemService.OpenBisFileSystem(ref fileSystem.Ref(), BisPartitionId.User);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var path = new Path();
|
||||
rc = PathFunctions.SetUpFixedPathSingleEntry(ref path.Ref(), pathBuffer.Items,
|
||||
res = PathFunctions.SetUpFixedPathSingleEntry(ref path.Ref(), pathBuffer.Items,
|
||||
CustomStorage.GetCustomStorageDirectoryName(CustomStorageId.System));
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IFileSystem> tempFs = SharedRef<IFileSystem>.CreateMove(ref fileSystem.Ref());
|
||||
rc = Utility.WrapSubDirectory(ref fileSystem.Ref(), ref tempFs.Ref(), in path, createIfMissing: true);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = Utility.WrapSubDirectory(ref fileSystem.Ref(), ref tempFs.Ref(), in path, createIfMissing: true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else if (storageId == CustomStorageId.SdCard)
|
||||
{
|
||||
Result rc = _baseFileSystemService.OpenSdCardProxyFileSystem(ref fileSystem.Ref());
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = _baseFileSystemService.OpenSdCardProxyFileSystem(ref fileSystem.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var path = new Path();
|
||||
rc = PathFunctions.SetUpFixedPathDoubleEntry(ref path.Ref(), pathBuffer.Items,
|
||||
res = PathFunctions.SetUpFixedPathDoubleEntry(ref path.Ref(), pathBuffer.Items,
|
||||
CommonPaths.SdCardNintendoRootDirectoryName,
|
||||
CustomStorage.GetCustomStorageDirectoryName(CustomStorageId.System));
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IFileSystem> tempFs = SharedRef<IFileSystem>.CreateMove(ref fileSystem.Ref());
|
||||
rc = Utility.WrapSubDirectory(ref fileSystem.Ref(), ref tempFs.Ref(), in path, createIfMissing: true);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = Utility.WrapSubDirectory(ref fileSystem.Ref(), ref tempFs.Ref(), in path, createIfMissing: true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
tempFs.SetByMove(ref fileSystem.Ref());
|
||||
rc = _fsCreators.EncryptedFileSystemCreator.Create(ref fileSystem.Ref(), ref tempFs.Ref(),
|
||||
res = _fsCreators.EncryptedFileSystemCreator.Create(ref fileSystem.Ref(), ref tempFs.Ref(),
|
||||
IEncryptedFileSystemCreator.KeyId.CustomStorage, in _sdEncryptionSeed);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -81,15 +81,15 @@ public class FileSystemProxyCoreImpl
|
||||
private Result OpenHostFileSystem(ref SharedRef<IFileSystem> outFileSystem, in Path path)
|
||||
{
|
||||
using var pathHost = new Path();
|
||||
Result rc = pathHost.Initialize(in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = pathHost.Initialize(in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _fsCreators.TargetManagerFileSystemCreator.NormalizeCaseOfPath(out bool isSupported, ref pathHost.Ref());
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fsCreators.TargetManagerFileSystemCreator.NormalizeCaseOfPath(out bool isSupported, ref pathHost.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _fsCreators.TargetManagerFileSystemCreator.Create(ref outFileSystem, in pathHost, isSupported,
|
||||
res = _fsCreators.TargetManagerFileSystemCreator.Create(ref outFileSystem, in pathHost, isSupported,
|
||||
ensureRootPathExists: false, Result.Success);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -99,14 +99,14 @@ public class FileSystemProxyCoreImpl
|
||||
{
|
||||
if (!path.IsEmpty() && openCaseSensitive)
|
||||
{
|
||||
Result rc = OpenHostFileSystem(ref outFileSystem, in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = OpenHostFileSystem(ref outFileSystem, in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else
|
||||
{
|
||||
Result rc = _fsCreators.TargetManagerFileSystemCreator.Create(ref outFileSystem, in path,
|
||||
Result res = _fsCreators.TargetManagerFileSystemCreator.Create(ref outFileSystem, in path,
|
||||
openCaseSensitive, ensureRootPathExists: false, Result.Success);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
return Result.Success;
|
||||
|
@ -156,8 +156,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result OpenFileSystemWithId(ref SharedRef<IFileSystemSf> outFileSystem, in FspPath path,
|
||||
ulong id, FileSystemProxyType fsType)
|
||||
{
|
||||
Result rc = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return ncaFsService.OpenFileSystemWithId(ref outFileSystem, in path, id, fsType);
|
||||
}
|
||||
@ -165,8 +165,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result OpenFileSystemWithPatch(ref SharedRef<IFileSystemSf> outFileSystem,
|
||||
ProgramId programId, FileSystemProxyType fsType)
|
||||
{
|
||||
Result rc = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return ncaFsService.OpenFileSystemWithPatch(ref outFileSystem, programId, fsType);
|
||||
}
|
||||
@ -176,8 +176,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out verificationData);
|
||||
|
||||
Result rc = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return ncaFsService.OpenCodeFileSystem(ref fileSystem, out verificationData, in path, programId);
|
||||
}
|
||||
@ -202,16 +202,16 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out freeSpaceSize);
|
||||
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.GetFreeSpaceSizeForSaveData(out freeSpaceSize, spaceId);
|
||||
}
|
||||
|
||||
public Result OpenDataFileSystemByCurrentProcess(ref SharedRef<IFileSystemSf> outFileSystem)
|
||||
{
|
||||
Result rc = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return ncaFsService.OpenDataFileSystemByCurrentProcess(ref outFileSystem);
|
||||
}
|
||||
@ -219,16 +219,16 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result OpenDataFileSystemByProgramId(ref SharedRef<IFileSystemSf> outFileSystem,
|
||||
ProgramId programId)
|
||||
{
|
||||
Result rc = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return ncaFsService.OpenDataFileSystemByProgramId(ref outFileSystem, programId);
|
||||
}
|
||||
|
||||
public Result OpenDataStorageByCurrentProcess(ref SharedRef<IStorageSf> outStorage)
|
||||
{
|
||||
Result rc = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return ncaFsService.OpenDataStorageByCurrentProcess(ref outStorage);
|
||||
}
|
||||
@ -236,8 +236,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result OpenDataStorageByProgramId(ref SharedRef<IStorageSf> outStorage,
|
||||
ProgramId programId)
|
||||
{
|
||||
Result rc = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return ncaFsService.OpenDataStorageByProgramId(ref outStorage, programId);
|
||||
}
|
||||
@ -245,8 +245,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result OpenDataStorageByDataId(ref SharedRef<IStorageSf> outStorage, DataId dataId,
|
||||
StorageId storageId)
|
||||
{
|
||||
Result rc = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return ncaFsService.OpenDataStorageByDataId(ref outStorage, dataId, storageId);
|
||||
}
|
||||
@ -254,8 +254,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result OpenDataStorageByPath(ref SharedRef<IFileSystemSf> outFileSystem, in FspPath path,
|
||||
FileSystemProxyType fsType)
|
||||
{
|
||||
Result rc = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return ncaFsService.OpenDataStorageByPath(ref outFileSystem, in path, fsType);
|
||||
}
|
||||
@ -268,8 +268,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result OpenDataFileSystemWithProgramIndex(ref SharedRef<IFileSystemSf> outFileSystem,
|
||||
byte programIndex)
|
||||
{
|
||||
Result rc = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return ncaFsService.OpenDataFileSystemWithProgramIndex(ref outFileSystem, programIndex);
|
||||
}
|
||||
@ -277,32 +277,32 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result OpenDataStorageWithProgramIndex(ref SharedRef<IStorageSf> outStorage,
|
||||
byte programIndex)
|
||||
{
|
||||
Result rc = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return ncaFsService.OpenDataStorageWithProgramIndex(ref outStorage, programIndex);
|
||||
}
|
||||
|
||||
public Result RegisterSaveDataFileSystemAtomicDeletion(InBuffer saveDataIds)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.RegisterSaveDataFileSystemAtomicDeletion(saveDataIds);
|
||||
}
|
||||
|
||||
public Result DeleteSaveDataFileSystem(ulong saveDataId)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.DeleteSaveDataFileSystem(saveDataId);
|
||||
}
|
||||
|
||||
public Result DeleteSaveDataFileSystemBySaveDataSpaceId(SaveDataSpaceId spaceId, ulong saveDataId)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.DeleteSaveDataFileSystemBySaveDataSpaceId(spaceId, saveDataId);
|
||||
}
|
||||
@ -310,16 +310,16 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result DeleteSaveDataFileSystemBySaveDataAttribute(SaveDataSpaceId spaceId,
|
||||
in SaveDataAttribute attribute)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.DeleteSaveDataFileSystemBySaveDataAttribute(spaceId, in attribute);
|
||||
}
|
||||
|
||||
public Result UpdateSaveDataMacForDebug(SaveDataSpaceId spaceId, ulong saveDataId)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.UpdateSaveDataMacForDebug(spaceId, saveDataId);
|
||||
}
|
||||
@ -327,8 +327,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result CreateSaveDataFileSystem(in SaveDataAttribute attribute, in SaveDataCreationInfo creationInfo,
|
||||
in SaveDataMetaInfo metaInfo)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.CreateSaveDataFileSystem(in attribute, in creationInfo, in metaInfo);
|
||||
}
|
||||
@ -336,8 +336,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result CreateSaveDataFileSystemWithHashSalt(in SaveDataAttribute attribute,
|
||||
in SaveDataCreationInfo creationInfo, in SaveDataMetaInfo metaInfo, in HashSalt hashSalt)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.CreateSaveDataFileSystemWithHashSalt(in attribute, in creationInfo, in metaInfo,
|
||||
in hashSalt);
|
||||
@ -346,16 +346,16 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result CreateSaveDataFileSystemBySystemSaveDataId(in SaveDataAttribute attribute,
|
||||
in SaveDataCreationInfo creationInfo)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.CreateSaveDataFileSystemBySystemSaveDataId(in attribute, in creationInfo);
|
||||
}
|
||||
|
||||
public Result CreateSaveDataFileSystemWithCreationInfo2(in SaveDataCreationInfo2 creationInfo)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.CreateSaveDataFileSystemWithCreationInfo2(in creationInfo);
|
||||
}
|
||||
@ -363,8 +363,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result ExtendSaveDataFileSystem(SaveDataSpaceId spaceId, ulong saveDataId, long dataSize,
|
||||
long journalSize)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.ExtendSaveDataFileSystem(spaceId, saveDataId, dataSize, journalSize);
|
||||
}
|
||||
@ -372,8 +372,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result OpenSaveDataFileSystem(ref SharedRef<IFileSystemSf> outFileSystem, SaveDataSpaceId spaceId,
|
||||
in SaveDataAttribute attribute)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.OpenSaveDataFileSystem(ref outFileSystem, spaceId, in attribute);
|
||||
}
|
||||
@ -381,8 +381,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result OpenReadOnlySaveDataFileSystem(ref SharedRef<IFileSystemSf> outFileSystem,
|
||||
SaveDataSpaceId spaceId, in SaveDataAttribute attribute)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.OpenReadOnlySaveDataFileSystem(ref outFileSystem, spaceId, in attribute);
|
||||
}
|
||||
@ -390,16 +390,16 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result OpenSaveDataFileSystemBySystemSaveDataId(ref SharedRef<IFileSystemSf> outFileSystem,
|
||||
SaveDataSpaceId spaceId, in SaveDataAttribute attribute)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.OpenSaveDataFileSystemBySystemSaveDataId(ref outFileSystem, spaceId, in attribute);
|
||||
}
|
||||
|
||||
public Result ReadSaveDataFileSystemExtraData(OutBuffer extraDataBuffer, ulong saveDataId)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.ReadSaveDataFileSystemExtraData(extraDataBuffer, saveDataId);
|
||||
}
|
||||
@ -407,8 +407,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result ReadSaveDataFileSystemExtraDataBySaveDataAttribute(OutBuffer extraDataBuffer,
|
||||
SaveDataSpaceId spaceId, in SaveDataAttribute attribute)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.ReadSaveDataFileSystemExtraDataBySaveDataAttribute(extraDataBuffer, spaceId,
|
||||
in attribute);
|
||||
@ -417,8 +417,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(OutBuffer extraDataBuffer,
|
||||
SaveDataSpaceId spaceId, in SaveDataAttribute attribute, InBuffer maskBuffer)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.ReadSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(extraDataBuffer, spaceId,
|
||||
in attribute, maskBuffer);
|
||||
@ -427,8 +427,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result ReadSaveDataFileSystemExtraDataBySaveDataSpaceId(OutBuffer extraDataBuffer,
|
||||
SaveDataSpaceId spaceId, ulong saveDataId)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.ReadSaveDataFileSystemExtraDataBySaveDataSpaceId(extraDataBuffer, spaceId, saveDataId);
|
||||
}
|
||||
@ -436,8 +436,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result WriteSaveDataFileSystemExtraData(ulong saveDataId, SaveDataSpaceId spaceId,
|
||||
InBuffer extraDataBuffer)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.WriteSaveDataFileSystemExtraData(saveDataId, spaceId, extraDataBuffer);
|
||||
}
|
||||
@ -445,8 +445,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result WriteSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(in SaveDataAttribute attribute,
|
||||
SaveDataSpaceId spaceId, InBuffer extraDataBuffer, InBuffer maskBuffer)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.WriteSaveDataFileSystemExtraDataWithMaskBySaveDataAttribute(in attribute, spaceId,
|
||||
extraDataBuffer, maskBuffer);
|
||||
@ -455,8 +455,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result WriteSaveDataFileSystemExtraDataWithMask(ulong saveDataId, SaveDataSpaceId spaceId,
|
||||
InBuffer extraDataBuffer, InBuffer maskBuffer)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.WriteSaveDataFileSystemExtraDataWithMask(saveDataId, spaceId, extraDataBuffer,
|
||||
maskBuffer);
|
||||
@ -502,8 +502,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result OpenHostFileSystemWithOption(ref SharedRef<IFileSystemSf> outFileSystem,
|
||||
in FspPath path, MountHostOption option)
|
||||
{
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Accessibility accessibility = programInfo.AccessControl.GetAccessibilityFor(AccessibilityType.MountHost);
|
||||
|
||||
@ -515,13 +515,13 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
|
||||
if (path.Str.At(0) == DirectorySeparator && path.Str.At(1) != DirectorySeparator)
|
||||
{
|
||||
rc = pathNormalized.Initialize(path.Str.Slice(1));
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = pathNormalized.Initialize(path.Str.Slice(1));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = pathNormalized.InitializeWithReplaceUnc(path.Str);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = pathNormalized.InitializeWithReplaceUnc(path.Str);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
var flags = new PathFlags();
|
||||
@ -529,13 +529,13 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
flags.AllowRelativePath();
|
||||
flags.AllowEmptyPath();
|
||||
|
||||
rc = pathNormalized.Normalize(flags);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = pathNormalized.Normalize(flags);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
bool isCaseSensitive = option.Flags.HasFlag(MountHostOptionFlag.PseudoCaseSensitive);
|
||||
|
||||
rc = _fsProxyCore.OpenHostFileSystem(ref hostFileSystem.Ref(), in pathNormalized, isCaseSensitive);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fsProxyCore.OpenHostFileSystem(ref hostFileSystem.Ref(), in pathNormalized, isCaseSensitive);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
var adapterFlags = new PathFlags();
|
||||
if (path.Str.At(0) == NullTerminator)
|
||||
@ -597,24 +597,24 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
|
||||
public Result OpenSystemDataUpdateEventNotifier(ref SharedRef<IEventNotifier> outEventNotifier)
|
||||
{
|
||||
Result rc = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return ncaFsService.OpenSystemDataUpdateEventNotifier(ref outEventNotifier);
|
||||
}
|
||||
|
||||
public Result NotifySystemDataUpdateEvent()
|
||||
{
|
||||
Result rc = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return ncaFsService.NotifySystemDataUpdateEvent();
|
||||
}
|
||||
|
||||
public Result OpenSaveDataInfoReader(ref SharedRef<ISaveDataInfoReader> outInfoReader)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.OpenSaveDataInfoReader(ref outInfoReader);
|
||||
}
|
||||
@ -622,8 +622,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result OpenSaveDataInfoReaderBySaveDataSpaceId(
|
||||
ref SharedRef<ISaveDataInfoReader> outInfoReader, SaveDataSpaceId spaceId)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.OpenSaveDataInfoReaderBySaveDataSpaceId(ref outInfoReader, spaceId);
|
||||
}
|
||||
@ -631,8 +631,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result OpenSaveDataInfoReaderWithFilter(ref SharedRef<ISaveDataInfoReader> outInfoReader,
|
||||
SaveDataSpaceId spaceId, in SaveDataFilter filter)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.OpenSaveDataInfoReaderWithFilter(ref outInfoReader, spaceId, in filter);
|
||||
}
|
||||
@ -642,8 +642,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out count);
|
||||
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.FindSaveDataWithFilter(out count, saveDataInfoBuffer, spaceId, in filter);
|
||||
}
|
||||
@ -651,8 +651,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result OpenSaveDataInternalStorageFileSystem(ref SharedRef<IFileSystemSf> outFileSystem,
|
||||
SaveDataSpaceId spaceId, ulong saveDataId)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.OpenSaveDataInternalStorageFileSystem(ref outFileSystem, spaceId, saveDataId);
|
||||
}
|
||||
@ -661,8 +661,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out size);
|
||||
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.QuerySaveDataInternalStorageTotalSize(out size, spaceId, saveDataId);
|
||||
}
|
||||
@ -671,16 +671,16 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out commitId);
|
||||
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.GetSaveDataCommitId(out commitId, spaceId, saveDataId);
|
||||
}
|
||||
|
||||
public Result OpenSaveDataInfoReaderOnlyCacheStorage(ref SharedRef<ISaveDataInfoReader> outInfoReader)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.OpenSaveDataInfoReaderOnlyCacheStorage(ref outInfoReader);
|
||||
}
|
||||
@ -688,16 +688,16 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result OpenSaveDataMetaFile(ref SharedRef<IFileSf> outFile, SaveDataSpaceId spaceId,
|
||||
in SaveDataAttribute attribute, SaveDataMetaType type)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.OpenSaveDataMetaFile(ref outFile, spaceId, in attribute, type);
|
||||
}
|
||||
|
||||
public Result DeleteCacheStorage(ushort index)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.DeleteCacheStorage(index);
|
||||
}
|
||||
@ -706,16 +706,16 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out dataSize, out journalSize);
|
||||
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.GetCacheStorageSize(out dataSize, out journalSize, index);
|
||||
}
|
||||
|
||||
public Result OpenSaveDataTransferManager(ref SharedRef<ISaveDataTransferManager> outTransferManager)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.OpenSaveDataTransferManager(ref outTransferManager);
|
||||
}
|
||||
@ -723,8 +723,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result OpenSaveDataTransferManagerVersion2(
|
||||
ref SharedRef<ISaveDataTransferManagerWithDivision> outTransferManager)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.OpenSaveDataTransferManagerVersion2(ref outTransferManager);
|
||||
}
|
||||
@ -732,8 +732,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result OpenSaveDataTransferManagerForSaveDataRepair(
|
||||
ref SharedRef<ISaveDataTransferManagerForSaveDataRepair> outTransferManager)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.OpenSaveDataTransferManagerForSaveDataRepair(ref outTransferManager);
|
||||
}
|
||||
@ -741,8 +741,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result OpenSaveDataTransferManagerForRepair(
|
||||
ref SharedRef<ISaveDataTransferManagerForRepair> outTransferManager)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.OpenSaveDataTransferManagerForRepair(ref outTransferManager);
|
||||
}
|
||||
@ -750,8 +750,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result OpenSaveDataTransferProhibiter(ref SharedRef<ISaveDataTransferProhibiter> outProhibiter,
|
||||
Ncm.ApplicationId applicationId)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.OpenSaveDataTransferProhibiter(ref outProhibiter, applicationId);
|
||||
}
|
||||
@ -761,8 +761,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out readCount);
|
||||
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.ListAccessibleSaveDataOwnerId(out readCount, idBuffer, programId, startIndex,
|
||||
bufferIdCount);
|
||||
@ -771,8 +771,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result OpenSaveDataMover(ref SharedRef<ISaveDataMover> outSaveDataMover, SaveDataSpaceId sourceSpaceId,
|
||||
SaveDataSpaceId destinationSpaceId, NativeHandle workBufferHandle, ulong workBufferSize)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.OpenSaveDataMover(ref outSaveDataMover, sourceSpaceId, destinationSpaceId,
|
||||
workBufferHandle, workBufferSize);
|
||||
@ -785,16 +785,16 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
|
||||
public Result SetSaveDataRootPath(in FspPath path)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.SetSaveDataRootPath(in path);
|
||||
}
|
||||
|
||||
public Result UnsetSaveDataRootPath()
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.UnsetSaveDataRootPath();
|
||||
}
|
||||
@ -802,8 +802,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result OpenContentStorageFileSystem(ref SharedRef<IFileSystemSf> outFileSystem,
|
||||
ContentStorageId storageId)
|
||||
{
|
||||
Result rc = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return ncaFsService.OpenContentStorageFileSystem(ref outFileSystem, storageId);
|
||||
}
|
||||
@ -814,8 +814,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
var storageFlag = StorageLayoutType.NonGameCard;
|
||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Accessibility accessibility =
|
||||
programInfo.AccessControl.GetAccessibilityFor(AccessibilityType.MountCloudBackupWorkStorage);
|
||||
@ -824,8 +824,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
rc = _fsProxyCore.OpenCloudBackupWorkStorageFileSystem(ref fileSystem.Ref(), storageId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fsProxyCore.OpenCloudBackupWorkStorageFileSystem(ref fileSystem.Ref(), storageId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Add all the wrappers for the file system
|
||||
using var typeSetFileSystem =
|
||||
@ -847,8 +847,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
var storageFlag = StorageLayoutType.NonGameCard;
|
||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
AccessibilityType accessType = storageId > CustomStorageId.SdCard
|
||||
? AccessibilityType.NotMount
|
||||
@ -860,8 +860,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
rc = _fsProxyCore.OpenCustomStorageFileSystem(ref fileSystem.Ref(), storageId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fsProxyCore.OpenCustomStorageFileSystem(ref fileSystem.Ref(), storageId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Add all the file system wrappers
|
||||
using var typeSetFileSystem =
|
||||
@ -888,8 +888,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out isArchived);
|
||||
|
||||
Result rc = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return ncaFsService.IsArchivedProgram(out isArchived, processId);
|
||||
}
|
||||
@ -898,8 +898,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out totalSize);
|
||||
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.QuerySaveDataTotalSize(out totalSize, dataSize, journalSize);
|
||||
}
|
||||
@ -913,8 +913,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out rightsId);
|
||||
|
||||
Result rc = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return ncaFsService.GetRightsId(out rightsId, programId, storageId);
|
||||
}
|
||||
@ -928,55 +928,55 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out rightsId, out keyGeneration);
|
||||
|
||||
Result rc = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return ncaFsService.GetRightsIdAndKeyGenerationByPath(out rightsId, out keyGeneration, in path);
|
||||
}
|
||||
|
||||
public Result RegisterExternalKey(in RightsId rightsId, in AccessKey externalKey)
|
||||
{
|
||||
Result rc = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return ncaFsService.RegisterExternalKey(in rightsId, in externalKey);
|
||||
}
|
||||
|
||||
public Result UnregisterExternalKey(in RightsId rightsId)
|
||||
{
|
||||
Result rc = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return ncaFsService.UnregisterExternalKey(in rightsId);
|
||||
}
|
||||
|
||||
public Result UnregisterAllExternalKey()
|
||||
{
|
||||
Result rc = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return ncaFsService.UnregisterAllExternalKey();
|
||||
}
|
||||
|
||||
public Result SetSdCardEncryptionSeed(in EncryptionSeed seed)
|
||||
{
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.CanCall(OperationType.SetEncryptionSeed))
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
||||
rc = _fsProxyCore.SetSdCardEncryptionSeed(in seed);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fsProxyCore.SetSdCardEncryptionSeed(in seed);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = saveFsService.SetSdCardEncryptionSeed(in seed);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = saveFsService.SetSdCardEncryptionSeed(in seed);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return ncaFsService.SetSdCardEncryptionSeed(in seed);
|
||||
}
|
||||
@ -1000,8 +1000,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result VerifySaveDataFileSystemBySaveDataSpaceId(SaveDataSpaceId spaceId, ulong saveDataId,
|
||||
OutBuffer readBuffer)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.VerifySaveDataFileSystemBySaveDataSpaceId(spaceId, saveDataId, readBuffer);
|
||||
}
|
||||
@ -1013,8 +1013,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
|
||||
public Result CorruptSaveDataFileSystemByOffset(SaveDataSpaceId spaceId, ulong saveDataId, long offset)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.CorruptSaveDataFileSystemByOffset(spaceId, saveDataId, offset);
|
||||
}
|
||||
@ -1022,8 +1022,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
public Result CorruptSaveDataFileSystemBySaveDataSpaceId(SaveDataSpaceId spaceId, ulong saveDataId)
|
||||
{
|
||||
// Corrupt both of the save data headers
|
||||
Result rc = CorruptSaveDataFileSystemByOffset(spaceId, saveDataId, 0);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = CorruptSaveDataFileSystemByOffset(spaceId, saveDataId, 0);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return CorruptSaveDataFileSystemByOffset(spaceId, saveDataId, 0x4000);
|
||||
}
|
||||
@ -1085,16 +1085,16 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
|
||||
public Result RegisterUpdatePartition()
|
||||
{
|
||||
Result rc = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return ncaFsService.RegisterUpdatePartition();
|
||||
}
|
||||
|
||||
public Result OpenRegisteredUpdatePartition(ref SharedRef<IFileSystemSf> outFileSystem)
|
||||
{
|
||||
Result rc = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetNcaFileSystemService(out NcaFileSystemService ncaFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return ncaFsService.OpenRegisteredUpdatePartition(ref outFileSystem);
|
||||
}
|
||||
@ -1111,16 +1111,16 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
|
||||
public Result OverrideSaveDataTransferTokenSignVerificationKey(InBuffer key)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.OverrideSaveDataTransferTokenSignVerificationKey(key);
|
||||
}
|
||||
|
||||
public Result SetSdCardAccessibility(bool isAccessible)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.SetSdCardAccessibility(isAccessible);
|
||||
}
|
||||
@ -1129,8 +1129,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out isAccessible);
|
||||
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.IsSdCardAccessible(out isAccessible);
|
||||
}
|
||||
@ -1164,8 +1164,8 @@ public class FileSystemProxyImpl : IFileSystemProxy, IFileSystemProxyForLoader
|
||||
|
||||
public Result OpenMultiCommitManager(ref SharedRef<IMultiCommitManager> outCommitManager)
|
||||
{
|
||||
Result rc = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetSaveDataFileSystemService(out SaveDataFileSystemService saveFsService);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return saveFsService.OpenMultiCommitManager(ref outCommitManager);
|
||||
}
|
||||
|
@ -75,17 +75,17 @@ public class EmulatedBisFileSystemCreator : IBuiltInStorageFileSystemCreator
|
||||
}
|
||||
|
||||
using var bisRootPath = new Path();
|
||||
Result rc = bisRootPath.Initialize(GetPartitionPath(partitionId).ToU8String());
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = bisRootPath.Initialize(GetPartitionPath(partitionId).ToU8String());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
var pathFlags = new PathFlags();
|
||||
pathFlags.AllowEmptyPath();
|
||||
rc = bisRootPath.Normalize(pathFlags);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = bisRootPath.Normalize(pathFlags);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var partitionFileSystem = new SharedRef<IFileSystem>();
|
||||
rc = Utility.WrapSubDirectory(ref partitionFileSystem.Ref(), ref rootFileSystem.Ref(), in bisRootPath, true);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = Utility.WrapSubDirectory(ref partitionFileSystem.Ref(), ref rootFileSystem.Ref(), in bisRootPath, true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outFileSystem.SetByMove(ref partitionFileSystem.Ref());
|
||||
return Result.Success;
|
||||
|
@ -22,8 +22,8 @@ public class EmulatedGameCardFsCreator : IGameCardFileSystemCreator
|
||||
{
|
||||
// Use the old xci code temporarily
|
||||
|
||||
Result rc = _gameCard.GetXci(out Xci xci, handle);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = _gameCard.GetXci(out Xci xci, handle);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!xci.HasPartition((XciPartitionType)partitionType))
|
||||
{
|
||||
|
@ -22,8 +22,8 @@ public class EmulatedGameCardStorageCreator : IGameCardStorageCreator
|
||||
|
||||
using var baseStorage = new SharedRef<IStorage>(new ReadOnlyGameCardStorage(GameCard, handle));
|
||||
|
||||
Result rc = GameCard.GetCardInfo(out GameCardInfo cardInfo, handle);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GameCard.GetCardInfo(out GameCardInfo cardInfo, handle);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outStorage.Reset(new SubStorage(in baseStorage, 0, cardInfo.SecureAreaOffset));
|
||||
return Result.Success;
|
||||
@ -39,17 +39,17 @@ public class EmulatedGameCardStorageCreator : IGameCardStorageCreator
|
||||
Span<byte> deviceId = stackalloc byte[0x10];
|
||||
Span<byte> imageHash = stackalloc byte[0x20];
|
||||
|
||||
Result rc = GameCard.GetGameCardDeviceId(deviceId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GameCard.GetGameCardDeviceId(deviceId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = GameCard.GetGameCardImageHash(imageHash);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = GameCard.GetGameCardImageHash(imageHash);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var baseStorage =
|
||||
new SharedRef<IStorage>(new ReadOnlyGameCardStorage(GameCard, handle, deviceId, imageHash));
|
||||
|
||||
rc = GameCard.GetCardInfo(out GameCardInfo cardInfo, handle);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = GameCard.GetCardInfo(out GameCardInfo cardInfo, handle);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outStorage.Reset(new SubStorage(in baseStorage, cardInfo.SecureAreaOffset, cardInfo.SecureAreaSize));
|
||||
return Result.Success;
|
||||
@ -113,8 +113,8 @@ public class EmulatedGameCardStorageCreator : IGameCardStorageCreator
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out size);
|
||||
|
||||
Result rc = GameCard.GetCardInfo(out GameCardInfo info, Handle);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GameCard.GetCardInfo(out GameCardInfo info, Handle);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
size = info.Size;
|
||||
return Result.Success;
|
||||
|
@ -58,19 +58,19 @@ public class EmulatedSdCardFileSystemCreator : ISdCardProxyFileSystemCreator, ID
|
||||
string path = _path ?? DefaultPath;
|
||||
|
||||
using var sdCardPath = new Path();
|
||||
Result rc = sdCardPath.Initialize(StringUtils.StringToUtf8(path));
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = sdCardPath.Initialize(StringUtils.StringToUtf8(path));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
var pathFlags = new PathFlags();
|
||||
pathFlags.AllowEmptyPath();
|
||||
rc = sdCardPath.Normalize(pathFlags);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = sdCardPath.Normalize(pathFlags);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Todo: Add ProxyFileSystem?
|
||||
|
||||
using SharedRef<IFileSystem> fileSystem = SharedRef<IFileSystem>.CreateCopy(in _rootFileSystem);
|
||||
rc = Utility.WrapSubDirectory(ref _sdCardFileSystem, ref fileSystem.Ref(), in sdCardPath, true);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = Utility.WrapSubDirectory(ref _sdCardFileSystem, ref fileSystem.Ref(), in sdCardPath, true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outFileSystem.SetByCopy(in _sdCardFileSystem);
|
||||
|
||||
|
@ -13,8 +13,8 @@ public class PartitionFileSystemCreator : IPartitionFileSystemCreator
|
||||
using var partitionFs =
|
||||
new SharedRef<PartitionFileSystemCore<StandardEntry>>(new PartitionFileSystemCore<StandardEntry>());
|
||||
|
||||
Result rc = partitionFs.Get.Initialize(ref baseStorage);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = partitionFs.Get.Initialize(ref baseStorage);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outFileSystem.SetByMove(ref partitionFs.Ref());
|
||||
return Result.Success;
|
||||
|
@ -48,14 +48,14 @@ public class SaveDataFileSystemCreator : ISaveDataFileSystemCreator
|
||||
Unsafe.SkipInit(out Array18<byte> saveImageNameBuffer);
|
||||
|
||||
using var saveImageName = new Path();
|
||||
Result rc = PathFunctions.SetUpFixedPathSaveId(ref saveImageName.Ref(), saveImageNameBuffer.Items, saveDataId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = PathFunctions.SetUpFixedPathSaveId(ref saveImageName.Ref(), saveImageNameBuffer.Items, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = baseFileSystem.Get.GetEntryType(out DirectoryEntryType type, in saveImageName);
|
||||
res = baseFileSystem.Get.GetEntryType(out DirectoryEntryType type, in saveImageName);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
return ResultFs.PathNotFound.Includes(rc) ? ResultFs.TargetNotFound.LogConverted(rc) : rc.Miss();
|
||||
return ResultFs.PathNotFound.Includes(res) ? ResultFs.TargetNotFound.LogConverted(res) : res.Miss();
|
||||
}
|
||||
|
||||
using var saveDataFs = new SharedRef<ISaveDataFileSystem>();
|
||||
@ -74,8 +74,8 @@ public class SaveDataFileSystemCreator : ISaveDataFileSystemCreator
|
||||
if (!baseFs.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInSaveDataFileSystemCreatorA.Log();
|
||||
|
||||
rc = baseFs.Get.Initialize(in saveImageName);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = baseFs.Get.Initialize(in saveImageName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Create and initialize the directory save data FS
|
||||
using UniqueRef<IFileSystem> tempFs = UniqueRef<IFileSystem>.Create(ref baseFs.Ref());
|
||||
@ -85,9 +85,9 @@ public class SaveDataFileSystemCreator : ISaveDataFileSystemCreator
|
||||
if (!saveDirFs.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInSaveDataFileSystemCreatorB.Log();
|
||||
|
||||
rc = saveDirFs.Get.Initialize(isJournalingSupported, isMultiCommitSupported, !openReadOnly,
|
||||
res = saveDirFs.Get.Initialize(isJournalingSupported, isMultiCommitSupported, !openReadOnly,
|
||||
timeStampGetter, _randomGenerator);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
saveDataFs.SetByMove(ref saveDirFs.Ref());
|
||||
}
|
||||
@ -98,9 +98,9 @@ public class SaveDataFileSystemCreator : ISaveDataFileSystemCreator
|
||||
Optional<OpenType> openType =
|
||||
openShared ? new Optional<OpenType>(OpenType.Normal) : new Optional<OpenType>();
|
||||
|
||||
rc = _fsServer.OpenSaveDataStorage(ref fileStorage.Ref(), ref baseFileSystem, spaceId, saveDataId,
|
||||
res = _fsServer.OpenSaveDataStorage(ref fileStorage.Ref(), ref baseFileSystem, spaceId, saveDataId,
|
||||
OpenMode.ReadWrite, openType);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
@ -85,8 +85,8 @@ public class SaveDataResultConvertFileSystem : IResultConvertFileSystem<ISaveDat
|
||||
protected override Result DoOpenFile(ref UniqueRef<IFile> outFile, in Path path, OpenMode mode)
|
||||
{
|
||||
using var file = new UniqueRef<IFile>();
|
||||
Result rc = ConvertResult(GetFileSystem().OpenFile(ref file.Ref(), in path, mode));
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = ConvertResult(GetFileSystem().OpenFile(ref file.Ref(), in path, mode));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using UniqueRef<SaveDataResultConvertFile> resultConvertFile =
|
||||
new(new SaveDataResultConvertFile(ref file.Ref(), _isReconstructible));
|
||||
@ -99,8 +99,8 @@ public class SaveDataResultConvertFileSystem : IResultConvertFileSystem<ISaveDat
|
||||
OpenDirectoryMode mode)
|
||||
{
|
||||
using var directory = new UniqueRef<IDirectory>();
|
||||
Result rc = ConvertResult(GetFileSystem().OpenDirectory(ref directory.Ref(), in path, mode));
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = ConvertResult(GetFileSystem().OpenDirectory(ref directory.Ref(), in path, mode));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using UniqueRef<SaveDataResultConvertDirectory> resultConvertDirectory =
|
||||
new(new SaveDataResultConvertDirectory(ref directory.Ref(), _isReconstructible));
|
||||
|
@ -28,18 +28,18 @@ public class StorageOnNcaCreator : IStorageOnNcaCreator
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out fsHeader);
|
||||
|
||||
Result rc = OpenStorage(out IStorage storageTemp, nca, fsIndex);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = OpenStorage(out IStorage storageTemp, nca, fsIndex);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (isCodeFs)
|
||||
{
|
||||
using (var codeFs = new PartitionFileSystemCore<StandardEntry>())
|
||||
{
|
||||
rc = codeFs.Initialize(storageTemp);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = codeFs.Initialize(storageTemp);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = VerifyAcidSignature(codeFs, nca);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = VerifyAcidSignature(codeFs, nca);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,8 @@ public class SubDirectoryFileSystemCreator : ISubDirectoryFileSystemCreator
|
||||
{
|
||||
using var directory = new UniqueRef<IDirectory>();
|
||||
|
||||
Result rc = baseFileSystem.Get.OpenDirectory(ref directory.Ref(), in path, OpenDirectoryMode.Directory);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = baseFileSystem.Get.OpenDirectory(ref directory.Ref(), in path, OpenDirectoryMode.Directory);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
directory.Reset();
|
||||
|
||||
@ -22,8 +22,8 @@ public class SubDirectoryFileSystemCreator : ISubDirectoryFileSystemCreator
|
||||
if (!subFs.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInSubDirectoryFileSystemCreatorA.Log();
|
||||
|
||||
rc = subFs.Get.Initialize(in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = subFs.Get.Initialize(in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outSubDirFileSystem.SetByMove(ref subFs.Ref());
|
||||
return Result.Success;
|
||||
|
@ -30,8 +30,8 @@ internal class DeviceEventSimulationStorage : IStorage
|
||||
{
|
||||
Assert.SdkNotNull(_deviceEventSimulator);
|
||||
|
||||
Result rc = _deviceEventSimulator.CheckSimulatedAccessFailureEvent(SimulatingDeviceTargetOperation.Read);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = _deviceEventSimulator.CheckSimulatedAccessFailureEvent(SimulatingDeviceTargetOperation.Read);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return _baseStorage.Get.Read(offset, destination);
|
||||
}
|
||||
@ -40,8 +40,8 @@ internal class DeviceEventSimulationStorage : IStorage
|
||||
{
|
||||
Assert.SdkNotNull(_deviceEventSimulator);
|
||||
|
||||
Result rc = _deviceEventSimulator.CheckSimulatedAccessFailureEvent(SimulatingDeviceTargetOperation.Write);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = _deviceEventSimulator.CheckSimulatedAccessFailureEvent(SimulatingDeviceTargetOperation.Write);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return _baseStorage.Get.Write(offset, source);
|
||||
}
|
||||
|
@ -68,8 +68,8 @@ public class DeviceOperator : IDeviceOperator
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outSpeedMode);
|
||||
|
||||
Result rc = _fsServer.Storage.GetSdCardSpeedMode(out SdCardSpeedMode speedMode);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _fsServer.Storage.GetSdCardSpeedMode(out SdCardSpeedMode speedMode);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outSpeedMode = (long)speedMode;
|
||||
return Result.Success;
|
||||
@ -79,8 +79,8 @@ public class DeviceOperator : IDeviceOperator
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outSize);
|
||||
|
||||
Result rc = _fsServer.Storage.GetSdCardUserAreaSize(out long size);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _fsServer.Storage.GetSdCardUserAreaSize(out long size);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outSize = size;
|
||||
return Result.Success;
|
||||
@ -90,8 +90,8 @@ public class DeviceOperator : IDeviceOperator
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outSize);
|
||||
|
||||
Result rc = _fsServer.Storage.GetSdCardProtectedAreaSize(out long size);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _fsServer.Storage.GetSdCardProtectedAreaSize(out long size);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outSize = size;
|
||||
return Result.Success;
|
||||
@ -105,9 +105,9 @@ public class DeviceOperator : IDeviceOperator
|
||||
if (logBuffer.Size < logBufferSize)
|
||||
return ResultFs.InvalidSize.Log();
|
||||
|
||||
Result rc = _fsServer.Storage.GetAndClearSdCardErrorInfo(out StorageErrorInfo storageErrorInfo,
|
||||
Result res = _fsServer.Storage.GetAndClearSdCardErrorInfo(out StorageErrorInfo storageErrorInfo,
|
||||
out long logSize, GetSpan(logBuffer, logBufferSize));
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outStorageErrorInfo = storageErrorInfo;
|
||||
outLogSize = logSize;
|
||||
@ -126,8 +126,8 @@ public class DeviceOperator : IDeviceOperator
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outSpeedMode);
|
||||
|
||||
Result rc = _fsServer.Storage.GetMmcSpeedMode(out MmcSpeedMode speedMode);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _fsServer.Storage.GetMmcSpeedMode(out MmcSpeedMode speedMode);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outSpeedMode = (long)speedMode;
|
||||
return Result.Success;
|
||||
@ -145,8 +145,8 @@ public class DeviceOperator : IDeviceOperator
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outSize);
|
||||
|
||||
Result rc = _fsServer.Storage.GetMmcPartitionSize(out long mmcPartitionSize, (MmcPartition)partitionId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _fsServer.Storage.GetMmcPartitionSize(out long mmcPartitionSize, (MmcPartition)partitionId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outSize = mmcPartitionSize;
|
||||
return Result.Success;
|
||||
@ -156,8 +156,8 @@ public class DeviceOperator : IDeviceOperator
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outCount);
|
||||
|
||||
Result rc = _fsServer.Storage.GetMmcPatrolCount(out uint mmcPatrolCount);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _fsServer.Storage.GetMmcPatrolCount(out uint mmcPatrolCount);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outCount = mmcPatrolCount;
|
||||
return Result.Success;
|
||||
@ -171,9 +171,9 @@ public class DeviceOperator : IDeviceOperator
|
||||
if (logBuffer.Size < logBufferSize)
|
||||
return ResultFs.InvalidSize.Log();
|
||||
|
||||
Result rc = _fsServer.Storage.GetAndClearMmcErrorInfo(out StorageErrorInfo storageErrorInfo, out long logSize,
|
||||
Result res = _fsServer.Storage.GetAndClearMmcErrorInfo(out StorageErrorInfo storageErrorInfo, out long logSize,
|
||||
GetSpan(logBuffer, logBufferSize));
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outStorageErrorInfo = storageErrorInfo;
|
||||
outLogSize = logSize;
|
||||
@ -208,8 +208,8 @@ public class DeviceOperator : IDeviceOperator
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outIsInserted);
|
||||
|
||||
Result rc = _fsServer.Storage.IsGameCardInserted(out bool isInserted);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _fsServer.Storage.IsGameCardInserted(out bool isInserted);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outIsInserted = isInserted;
|
||||
return Result.Success;
|
||||
@ -229,15 +229,15 @@ public class DeviceOperator : IDeviceOperator
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outHandle);
|
||||
|
||||
Result rc = _fsServer.Storage.GetInitializationResult();
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _fsServer.Storage.GetInitializationResult();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
_fsServer.Storage.IsGameCardInserted(out bool isInserted).IgnoreResult();
|
||||
if (!isInserted)
|
||||
return ResultFs.GameCardFsGetHandleFailure.Log();
|
||||
|
||||
rc = _fsServer.Storage.GetGameCardHandle(out GameCardHandle handle);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = _fsServer.Storage.GetGameCardHandle(out GameCardHandle handle);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outHandle = handle;
|
||||
return Result.Success;
|
||||
@ -247,8 +247,8 @@ public class DeviceOperator : IDeviceOperator
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outCupVersion, out outCupId);
|
||||
|
||||
Result rc = _fsServer.Storage.GetGameCardStatus(out GameCardStatus gameCardStatus, handle);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _fsServer.Storage.GetGameCardStatus(out GameCardStatus gameCardStatus, handle);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outCupVersion = gameCardStatus.UpdatePartitionVersion;
|
||||
outCupId = gameCardStatus.UpdatePartitionId;
|
||||
@ -269,8 +269,8 @@ public class DeviceOperator : IDeviceOperator
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outAttribute);
|
||||
|
||||
Result rc = _fsServer.Storage.GetGameCardStatus(out GameCardStatus gameCardStatus, handle);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _fsServer.Storage.GetGameCardStatus(out GameCardStatus gameCardStatus, handle);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outAttribute = gameCardStatus.GameCardAttribute;
|
||||
return Result.Success;
|
||||
@ -280,8 +280,8 @@ public class DeviceOperator : IDeviceOperator
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outCompatibilityType);
|
||||
|
||||
Result rc = _fsServer.Storage.GetGameCardStatus(out GameCardStatus gameCardStatus, handle);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _fsServer.Storage.GetGameCardStatus(out GameCardStatus gameCardStatus, handle);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outCompatibilityType = gameCardStatus.CompatibilityType;
|
||||
return Result.Success;
|
||||
@ -323,9 +323,9 @@ public class DeviceOperator : IDeviceOperator
|
||||
if (rmaInfoBufferSize != Unsafe.SizeOf<RmaInformation>())
|
||||
return ResultFs.InvalidArgument.Log();
|
||||
|
||||
Result rc = _fsServer.Storage.GetGameCardAsicInfo(out RmaInformation rmaInfo,
|
||||
Result res = _fsServer.Storage.GetGameCardAsicInfo(out RmaInformation rmaInfo,
|
||||
GetSpan(asicFirmwareBuffer, asicFirmwareBufferSize));
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
SpanHelpers.AsReadOnlyByteSpan(in rmaInfo).CopyTo(outRmaInfoBuffer.Buffer);
|
||||
return Result.Success;
|
||||
@ -339,8 +339,8 @@ public class DeviceOperator : IDeviceOperator
|
||||
if (outBufferSize != Unsafe.SizeOf<GameCardIdSet>())
|
||||
return ResultFs.InvalidArgument.Log();
|
||||
|
||||
Result rc = _fsServer.Storage.GetGameCardIdSet(out GameCardIdSet gcIdSet);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _fsServer.Storage.GetGameCardIdSet(out GameCardIdSet gcIdSet);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
SpanHelpers.AsReadOnlyByteSpan(in gcIdSet).CopyTo(outBuffer.Buffer);
|
||||
return Result.Success;
|
||||
@ -436,8 +436,8 @@ public class DeviceOperator : IDeviceOperator
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outErrorInfo);
|
||||
|
||||
Result rc = _fsServer.Storage.GetGameCardErrorInfo(out GameCardErrorInfo gameCardErrorInfo);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _fsServer.Storage.GetGameCardErrorInfo(out GameCardErrorInfo gameCardErrorInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outErrorInfo = gameCardErrorInfo;
|
||||
return Result.Success;
|
||||
@ -447,8 +447,8 @@ public class DeviceOperator : IDeviceOperator
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out outErrorInfo);
|
||||
|
||||
Result rc = _fsServer.Storage.GetGameCardErrorReportInfo(out GameCardErrorReportInfo gameCardErrorReportInfo);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _fsServer.Storage.GetGameCardErrorReportInfo(out GameCardErrorReportInfo gameCardErrorReportInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outErrorInfo = gameCardErrorReportInfo;
|
||||
return Result.Success;
|
||||
@ -479,13 +479,13 @@ public class DeviceOperator : IDeviceOperator
|
||||
|
||||
public Result SuspendSdmmcControl()
|
||||
{
|
||||
Result rc = _fsServer.Storage.SuspendSdCardControl();
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _fsServer.Storage.SuspendSdCardControl();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Missing: Detach SD card device buffer
|
||||
|
||||
rc = _fsServer.Storage.SuspendMmcControl();
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = _fsServer.Storage.SuspendMmcControl();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Missing: Detach MMC device buffer
|
||||
|
||||
@ -496,13 +496,13 @@ public class DeviceOperator : IDeviceOperator
|
||||
{
|
||||
// Missing: Attach MMC device buffer
|
||||
|
||||
Result rc = _fsServer.Storage.ResumeMmcControl();
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = _fsServer.Storage.ResumeMmcControl();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Missing: Attach SD card device buffer
|
||||
|
||||
rc = _fsServer.Storage.ResumeSdCardControl();
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = _fsServer.Storage.ResumeSdCardControl();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -514,8 +514,8 @@ public class DeviceOperator : IDeviceOperator
|
||||
if ((uint)port > (uint)Port.GcAsic0)
|
||||
return ResultFs.InvalidArgument.Log();
|
||||
|
||||
Result rc = SdmmcSrv.Common.CheckConnection(out SpeedMode speedMode, out BusWidth busWidth, (Port)port);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = SdmmcSrv.Common.CheckConnection(out SpeedMode speedMode, out BusWidth busWidth, (Port)port);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
SdmmcSpeedMode sdmmcSpeedMode = speedMode switch
|
||||
{
|
||||
|
@ -55,19 +55,19 @@ public class FileInterfaceAdapter : IFileSf
|
||||
if (destination.Size < (int)size)
|
||||
return ResultFs.InvalidSize.Log();
|
||||
|
||||
Result rc = Result.Success;
|
||||
Result res = Result.Success;
|
||||
long readSize = 0;
|
||||
|
||||
for (int tryNum = 0; tryNum < maxTryCount; tryNum++)
|
||||
{
|
||||
rc = _baseFile.Get.Read(out readSize, offset, destination.Buffer.Slice(0, (int)size), option);
|
||||
res = _baseFile.Get.Read(out readSize, offset, destination.Buffer.Slice(0, (int)size), option);
|
||||
|
||||
// Retry on ResultDataCorrupted
|
||||
if (!ResultFs.DataCorrupted.Includes(rc))
|
||||
if (!ResultFs.DataCorrupted.Includes(res))
|
||||
break;
|
||||
}
|
||||
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
bytesRead = readSize;
|
||||
return Result.Success;
|
||||
@ -108,19 +108,19 @@ public class FileInterfaceAdapter : IFileSf
|
||||
const int maxTryCount = 2;
|
||||
UnsafeHelpers.SkipParamInit(out size);
|
||||
|
||||
Result rc = Result.Success;
|
||||
Result res = Result.Success;
|
||||
long tmpSize = 0;
|
||||
|
||||
for (int tryNum = 0; tryNum < maxTryCount; tryNum++)
|
||||
{
|
||||
rc = _baseFile.Get.GetSize(out tmpSize);
|
||||
res = _baseFile.Get.GetSize(out tmpSize);
|
||||
|
||||
// Retry on ResultDataCorrupted
|
||||
if (!ResultFs.DataCorrupted.Includes(rc))
|
||||
if (!ResultFs.DataCorrupted.Includes(res))
|
||||
break;
|
||||
}
|
||||
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
size = tmpSize;
|
||||
return Result.Success;
|
||||
@ -135,17 +135,17 @@ public class FileInterfaceAdapter : IFileSf
|
||||
{
|
||||
Unsafe.SkipInit(out QueryRangeInfo info);
|
||||
|
||||
Result rc = _baseFile.Get.OperateRange(SpanHelpers.AsByteSpan(ref info), OperationId.QueryRange, offset,
|
||||
Result res = _baseFile.Get.OperateRange(SpanHelpers.AsByteSpan(ref info), OperationId.QueryRange, offset,
|
||||
size, ReadOnlySpan<byte>.Empty);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rangeInfo.Merge(in info);
|
||||
}
|
||||
else if (operationId == (int)OperationId.InvalidateCache)
|
||||
{
|
||||
Result rc = _baseFile.Get.OperateRange(Span<byte>.Empty, OperationId.InvalidateCache, offset, size,
|
||||
Result res = _baseFile.Get.OperateRange(Span<byte>.Empty, OperationId.InvalidateCache, offset, size,
|
||||
ReadOnlySpan<byte>.Empty);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
return Result.Success;
|
||||
@ -168,11 +168,11 @@ public class FileInterfaceAdapter : IFileSf
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
Result rc = PermissionCheck((OperationId)operationId, this);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = PermissionCheck((OperationId)operationId, this);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _baseFile.Get.OperateRange(outBuffer.Buffer, (OperationId)operationId, offset, size, inBuffer.Buffer);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _baseFile.Get.OperateRange(outBuffer.Buffer, (OperationId)operationId, offset, size, inBuffer.Buffer);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -207,19 +207,19 @@ public class DirectoryInterfaceAdapter : IDirectorySf
|
||||
|
||||
Span<DirectoryEntry> entries = MemoryMarshal.Cast<byte, DirectoryEntry>(entryBuffer.Buffer);
|
||||
|
||||
Result rc = Result.Success;
|
||||
Result res = Result.Success;
|
||||
long numRead = 0;
|
||||
|
||||
for (int tryNum = 0; tryNum < maxTryCount; tryNum++)
|
||||
{
|
||||
rc = _baseDirectory.Get.Read(out numRead, entries);
|
||||
res = _baseDirectory.Get.Read(out numRead, entries);
|
||||
|
||||
// Retry on ResultDataCorrupted
|
||||
if (!ResultFs.DataCorrupted.Includes(rc))
|
||||
if (!ResultFs.DataCorrupted.Includes(res))
|
||||
break;
|
||||
}
|
||||
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
entriesRead = numRead;
|
||||
return Result.Success;
|
||||
@ -229,8 +229,8 @@ public class DirectoryInterfaceAdapter : IDirectorySf
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out entryCount);
|
||||
|
||||
Result rc = _baseDirectory.Get.GetEntryCount(out long count);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = _baseDirectory.Get.GetEntryCount(out long count);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
entryCount = count;
|
||||
return Result.Success;
|
||||
@ -297,21 +297,21 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
||||
|
||||
private Result SetUpPath(ref Path fsPath, in PathSf sfPath)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
|
||||
if (_pathFlags.IsWindowsPathAllowed())
|
||||
{
|
||||
rc = fsPath.InitializeWithReplaceUnc(sfPath.Str);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = fsPath.InitializeWithReplaceUnc(sfPath.Str);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = fsPath.Initialize(sfPath.Str);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = fsPath.Initialize(sfPath.Str);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
rc = fsPath.Normalize(_pathFlags);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = fsPath.Normalize(_pathFlags);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -322,11 +322,11 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
||||
return ResultFs.InvalidSize.Log();
|
||||
|
||||
using var pathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _baseFileSystem.Get.CreateFile(in pathNormalized, size, (CreateFileOptions)option);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _baseFileSystem.Get.CreateFile(in pathNormalized, size, (CreateFileOptions)option);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -334,11 +334,11 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
||||
public Result DeleteFile(in PathSf path)
|
||||
{
|
||||
using var pathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _baseFileSystem.Get.DeleteFile(in pathNormalized);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _baseFileSystem.Get.DeleteFile(in pathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -346,14 +346,14 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
||||
public Result CreateDirectory(in PathSf path)
|
||||
{
|
||||
using var pathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (pathNormalized == RootDir)
|
||||
return ResultFs.PathAlreadyExists.Log();
|
||||
|
||||
rc = _baseFileSystem.Get.CreateDirectory(in pathNormalized);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _baseFileSystem.Get.CreateDirectory(in pathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -361,14 +361,14 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
||||
public Result DeleteDirectory(in PathSf path)
|
||||
{
|
||||
using var pathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (pathNormalized == RootDir)
|
||||
return ResultFs.DirectoryUndeletable.Log();
|
||||
|
||||
rc = _baseFileSystem.Get.DeleteDirectory(in pathNormalized);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _baseFileSystem.Get.DeleteDirectory(in pathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -376,14 +376,14 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
||||
public Result DeleteDirectoryRecursively(in PathSf path)
|
||||
{
|
||||
using var pathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (pathNormalized == RootDir)
|
||||
return ResultFs.DirectoryUndeletable.Log();
|
||||
|
||||
rc = _baseFileSystem.Get.DeleteDirectoryRecursively(in pathNormalized);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _baseFileSystem.Get.DeleteDirectoryRecursively(in pathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -391,11 +391,11 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
||||
public Result CleanDirectoryRecursively(in PathSf path)
|
||||
{
|
||||
using var pathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _baseFileSystem.Get.CleanDirectoryRecursively(in pathNormalized);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _baseFileSystem.Get.CleanDirectoryRecursively(in pathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -403,15 +403,15 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
||||
public Result RenameFile(in PathSf currentPath, in PathSf newPath)
|
||||
{
|
||||
using var currentPathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref currentPathNormalized.Ref(), in currentPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref currentPathNormalized.Ref(), in currentPath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var newPathNormalized = new Path();
|
||||
rc = SetUpPath(ref newPathNormalized.Ref(), in newPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = SetUpPath(ref newPathNormalized.Ref(), in newPath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _baseFileSystem.Get.RenameFile(in currentPathNormalized, in newPathNormalized);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _baseFileSystem.Get.RenameFile(in currentPathNormalized, in newPathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -419,18 +419,18 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
||||
public Result RenameDirectory(in PathSf currentPath, in PathSf newPath)
|
||||
{
|
||||
using var currentPathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref currentPathNormalized.Ref(), in currentPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref currentPathNormalized.Ref(), in currentPath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var newPathNormalized = new Path();
|
||||
rc = SetUpPath(ref newPathNormalized.Ref(), in newPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = SetUpPath(ref newPathNormalized.Ref(), in newPath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (PathUtility.IsSubPath(currentPathNormalized.GetString(), newPathNormalized.GetString()))
|
||||
return ResultFs.DirectoryUnrenamable.Log();
|
||||
|
||||
rc = _baseFileSystem.Get.RenameDirectory(in currentPathNormalized, in newPathNormalized);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _baseFileSystem.Get.RenameDirectory(in currentPathNormalized, in newPathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -440,11 +440,11 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
||||
UnsafeHelpers.SkipParamInit(out entryType);
|
||||
|
||||
using var pathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _baseFileSystem.Get.GetEntryType(out DirectoryEntryType type, in pathNormalized);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _baseFileSystem.Get.GetEntryType(out DirectoryEntryType type, in pathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
entryType = (uint)type;
|
||||
return Result.Success;
|
||||
@ -455,11 +455,11 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
||||
UnsafeHelpers.SkipParamInit(out freeSpace);
|
||||
|
||||
using var pathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _baseFileSystem.Get.GetFreeSpaceSize(out long space, in pathNormalized);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _baseFileSystem.Get.GetFreeSpaceSize(out long space, in pathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
freeSpace = space;
|
||||
return Result.Success;
|
||||
@ -470,11 +470,11 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
||||
UnsafeHelpers.SkipParamInit(out totalSpace);
|
||||
|
||||
using var pathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _baseFileSystem.Get.GetTotalSpaceSize(out long space, in pathNormalized);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _baseFileSystem.Get.GetTotalSpaceSize(out long space, in pathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
totalSpace = space;
|
||||
return Result.Success;
|
||||
@ -485,21 +485,21 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
||||
const int maxTryCount = 2;
|
||||
|
||||
using var pathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var file = new UniqueRef<IFile>();
|
||||
|
||||
for (int tryNum = 0; tryNum < maxTryCount; tryNum++)
|
||||
{
|
||||
rc = _baseFileSystem.Get.OpenFile(ref file.Ref(), in pathNormalized, (OpenMode)mode);
|
||||
res = _baseFileSystem.Get.OpenFile(ref file.Ref(), in pathNormalized, (OpenMode)mode);
|
||||
|
||||
// Retry on ResultDataCorrupted
|
||||
if (!ResultFs.DataCorrupted.Includes(rc))
|
||||
if (!ResultFs.DataCorrupted.Includes(res))
|
||||
break;
|
||||
}
|
||||
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<FileSystemInterfaceAdapter> selfReference =
|
||||
SharedRef<FileSystemInterfaceAdapter>.Create(in _selfReference);
|
||||
@ -515,22 +515,22 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
||||
const int maxTryCount = 2;
|
||||
|
||||
using var pathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var directory = new UniqueRef<IDirectory>();
|
||||
|
||||
for (int tryNum = 0; tryNum < maxTryCount; tryNum++)
|
||||
{
|
||||
rc = _baseFileSystem.Get.OpenDirectory(ref directory.Ref(), in pathNormalized,
|
||||
res = _baseFileSystem.Get.OpenDirectory(ref directory.Ref(), in pathNormalized,
|
||||
(OpenDirectoryMode)mode);
|
||||
|
||||
// Retry on ResultDataCorrupted
|
||||
if (!ResultFs.DataCorrupted.Includes(rc))
|
||||
if (!ResultFs.DataCorrupted.Includes(res))
|
||||
break;
|
||||
}
|
||||
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<FileSystemInterfaceAdapter> selfReference =
|
||||
SharedRef<FileSystemInterfaceAdapter>.Create(in _selfReference);
|
||||
@ -551,11 +551,11 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
||||
UnsafeHelpers.SkipParamInit(out timeStamp);
|
||||
|
||||
using var pathNormalized = new Path();
|
||||
Result rc = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _baseFileSystem.Get.GetFileTimeStampRaw(out FileTimeStampRaw tempTimeStamp, in pathNormalized);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _baseFileSystem.Get.GetFileTimeStampRaw(out FileTimeStampRaw tempTimeStamp, in pathNormalized);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
timeStamp = tempTimeStamp;
|
||||
return Result.Success;
|
||||
@ -578,16 +578,16 @@ public class FileSystemInterfaceAdapter : IFileSystemSf
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
Result rc = PermissionCheck((QueryId)queryId, this);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = PermissionCheck((QueryId)queryId, this);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var pathNormalized = new Path();
|
||||
rc = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = SetUpPath(ref pathNormalized.Ref(), in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _baseFileSystem.Get.QueryEntry(outBuffer.Buffer, inBuffer.Buffer, (QueryId)queryId,
|
||||
res = _baseFileSystem.Get.QueryEntry(outBuffer.Buffer, inBuffer.Buffer, (QueryId)queryId,
|
||||
in pathNormalized);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
@ -82,11 +82,11 @@ internal class LocationResolverSet : IDisposable
|
||||
if (Utility.IsHostFsMountName(lrPath.Value))
|
||||
pathFlags.AllowWindowsPath();
|
||||
|
||||
Result rc = outPath.InitializeWithReplaceUnc(lrPath.Value);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = outPath.InitializeWithReplaceUnc(lrPath.Value);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = outPath.Normalize(pathFlags);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = outPath.Normalize(pathFlags);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -107,9 +107,9 @@ internal class LocationResolverSet : IDisposable
|
||||
if (!_resolvers[index].HasValue)
|
||||
{
|
||||
_resolvers[index].Set(null);
|
||||
Result rc = Hos.Lr.OpenLocationResolver(out _resolvers[index].Value, storageId);
|
||||
Result res = Hos.Lr.OpenLocationResolver(out _resolvers[index].Value, storageId);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
_resolvers[index].Clear();
|
||||
return ResultLr.ApplicationNotFound.Log();
|
||||
@ -137,8 +137,8 @@ internal class LocationResolverSet : IDisposable
|
||||
|
||||
if (!_aocResolver.HasValue)
|
||||
{
|
||||
Result rc = Hos.Lr.OpenAddOnContentLocationResolver(out AddOnContentLocationResolver lr);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = Hos.Lr.OpenAddOnContentLocationResolver(out AddOnContentLocationResolver lr);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
_aocResolver.Set(in lr);
|
||||
}
|
||||
@ -149,11 +149,11 @@ internal class LocationResolverSet : IDisposable
|
||||
|
||||
public Result ResolveApplicationControlPath(ref Fs.Path outPath, Ncm.ApplicationId applicationId, StorageId storageId)
|
||||
{
|
||||
Result rc = GetLocationResolver(out LocationResolver resolver, storageId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetLocationResolver(out LocationResolver resolver, storageId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = resolver.ResolveApplicationControlPath(out Lr.Path path, applicationId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = resolver.ResolveApplicationControlPath(out Lr.Path path, applicationId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return SetUpFsPath(ref outPath, in path);
|
||||
}
|
||||
@ -162,11 +162,11 @@ internal class LocationResolverSet : IDisposable
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out isDirectory);
|
||||
|
||||
Result rc = GetLocationResolver(out LocationResolver resolver, storageId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetLocationResolver(out LocationResolver resolver, storageId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = resolver.ResolveApplicationHtmlDocumentPath(out Lr.Path path, applicationId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = resolver.ResolveApplicationHtmlDocumentPath(out Lr.Path path, applicationId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
isDirectory = PathUtility.IsDirectoryPath(path.Value);
|
||||
|
||||
@ -177,11 +177,11 @@ internal class LocationResolverSet : IDisposable
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out isDirectory);
|
||||
|
||||
Result rc = GetLocationResolver(out LocationResolver resolver, storageId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetLocationResolver(out LocationResolver resolver, storageId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = resolver.ResolveProgramPath(out Lr.Path path, programId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = resolver.ResolveProgramPath(out Lr.Path path, programId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
isDirectory = PathUtility.IsDirectoryPath(path.Value);
|
||||
|
||||
@ -192,11 +192,11 @@ internal class LocationResolverSet : IDisposable
|
||||
{
|
||||
UnsafeHelpers.SkipParamInit(out isDirectory);
|
||||
|
||||
Result rc = GetLocationResolver(out LocationResolver resolver, storageId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetLocationResolver(out LocationResolver resolver, storageId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = resolver.ResolveProgramPathForDebug(out Lr.Path path, programId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = resolver.ResolveProgramPathForDebug(out Lr.Path path, programId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
isDirectory = PathUtility.IsDirectoryPath(path.Value);
|
||||
|
||||
@ -205,11 +205,11 @@ internal class LocationResolverSet : IDisposable
|
||||
|
||||
public Result ResolveAddOnContentPath(ref Fs.Path outPath, DataId dataId)
|
||||
{
|
||||
Result rc = GetAddOnContentLocationResolver(out AddOnContentLocationResolver resolver);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetAddOnContentLocationResolver(out AddOnContentLocationResolver resolver);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = resolver.ResolveAddOnContentPath(out Lr.Path path, dataId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = resolver.ResolveAddOnContentPath(out Lr.Path path, dataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return SetUpFsPath(ref outPath, in path);
|
||||
}
|
||||
@ -219,11 +219,11 @@ internal class LocationResolverSet : IDisposable
|
||||
if (storageId == StorageId.None)
|
||||
return ResultFs.InvalidAlignment.Log();
|
||||
|
||||
Result rc = GetLocationResolver(out LocationResolver resolver, storageId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetLocationResolver(out LocationResolver resolver, storageId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = resolver.ResolveDataPath(out Lr.Path path, dataId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = resolver.ResolveDataPath(out Lr.Path path, dataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return SetUpFsPath(ref outPath, in path);
|
||||
}
|
||||
@ -233,11 +233,11 @@ internal class LocationResolverSet : IDisposable
|
||||
RegisteredLocationResolver resolver = null;
|
||||
try
|
||||
{
|
||||
Result rc = GetRegisteredLocationResolver(out resolver);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetRegisteredLocationResolver(out resolver);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = resolver.ResolveProgramPath(out Lr.Path path, new ProgramId(id));
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = resolver.ResolveProgramPath(out Lr.Path path, new ProgramId(id));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return SetUpFsPath(ref outPath, in path);
|
||||
}
|
||||
@ -252,11 +252,11 @@ internal class LocationResolverSet : IDisposable
|
||||
RegisteredLocationResolver resolver = null;
|
||||
try
|
||||
{
|
||||
Result rc = GetRegisteredLocationResolver(out resolver);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetRegisteredLocationResolver(out resolver);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = resolver.ResolveHtmlDocumentPath(out Lr.Path path, new ProgramId(id));
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = resolver.ResolveHtmlDocumentPath(out Lr.Path path, new ProgramId(id));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return SetUpFsPath(ref outPath, in path);
|
||||
}
|
||||
|
@ -100,15 +100,15 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
private Result EnsureSaveDataForContext()
|
||||
{
|
||||
using var contextFileSystem = new SharedRef<IFileSystem>();
|
||||
Result rc = _multiCommitInterface.Get.OpenMultiCommitContext(ref contextFileSystem.Ref());
|
||||
Result res = _multiCommitInterface.Get.OpenMultiCommitContext(ref contextFileSystem.Ref());
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
if (!ResultFs.TargetNotFound.Includes(rc))
|
||||
return rc;
|
||||
if (!ResultFs.TargetNotFound.Includes(res))
|
||||
return res;
|
||||
|
||||
rc = _fsServer.Hos.Fs.CreateSystemSaveData(SaveDataId, SaveDataSize, SaveJournalSize, SaveDataFlags.None);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fsServer.Hos.Fs.CreateSystemSaveData(SaveDataId, SaveDataSize, SaveJournalSize, SaveDataFlags.None);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
return Result.Success;
|
||||
@ -128,8 +128,8 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
return ResultFs.MultiCommitFileSystemLimit.Log();
|
||||
|
||||
using var fsaFileSystem = new SharedRef<IFileSystem>();
|
||||
Result rc = fileSystem.Get.GetImpl(ref fsaFileSystem.Ref());
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = fileSystem.Get.GetImpl(ref fsaFileSystem.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Check that the file system hasn't already been added
|
||||
for (int i = 0; i < _fileSystemCount; i++)
|
||||
@ -155,20 +155,20 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
_counter = 1;
|
||||
|
||||
using var contextUpdater = new ContextUpdater(contextFileSystem);
|
||||
Result rc = contextUpdater.Create(_counter, _fileSystemCount);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = contextUpdater.Create(_counter, _fileSystemCount);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = CommitProvisionallyFileSystem(_counter);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = CommitProvisionallyFileSystem(_counter);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = contextUpdater.CommitProvisionallyDone();
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = contextUpdater.CommitProvisionallyDone();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = CommitFileSystem();
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = CommitFileSystem();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = contextUpdater.CommitDone();
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = contextUpdater.CommitDone();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -182,11 +182,11 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
using ScopedLock<SdkMutexType> scopedLock = ScopedLock.Lock(ref Globals.MultiCommitMutex);
|
||||
|
||||
using var contextFileSystem = new SharedRef<IFileSystem>();
|
||||
Result rc = EnsureSaveDataForContext();
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = EnsureSaveDataForContext();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _multiCommitInterface.Get.OpenMultiCommitContext(ref contextFileSystem.Ref());
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _multiCommitInterface.Get.OpenMultiCommitContext(ref contextFileSystem.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Commit(contextFileSystem.Get);
|
||||
}
|
||||
@ -198,20 +198,20 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
/// <returns>The <see cref="Result"/> of the operation.</returns>
|
||||
private Result CommitProvisionallyFileSystem(long counter)
|
||||
{
|
||||
Result rc = Result.Success;
|
||||
Result res = Result.Success;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < _fileSystemCount; i++)
|
||||
{
|
||||
Assert.SdkNotNull(_fileSystems[i].Get);
|
||||
|
||||
rc = _fileSystems[i].Get.CommitProvisionally(counter);
|
||||
res = _fileSystems[i].Get.CommitProvisionally(counter);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
break;
|
||||
}
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
// Rollback all provisional commits including the failed commit
|
||||
for (int j = 0; j <= i; j++)
|
||||
@ -222,7 +222,7 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
return res;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -269,17 +269,17 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
IFileSystem contextFs, SaveDataFileSystemServiceImpl saveService)
|
||||
{
|
||||
using var contextFilePath = new Fs.Path();
|
||||
Result rc = PathFunctions.SetUpFixedPath(ref contextFilePath.Ref(), CommitContextFileName);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = PathFunctions.SetUpFixedPath(ref contextFilePath.Ref(), CommitContextFileName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Read the multi-commit context
|
||||
using var contextFile = new UniqueRef<IFile>();
|
||||
rc = contextFs.OpenFile(ref contextFile.Ref(), in contextFilePath, OpenMode.ReadWrite);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = contextFs.OpenFile(ref contextFile.Ref(), in contextFilePath, OpenMode.ReadWrite);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Unsafe.SkipInit(out Context context);
|
||||
rc = contextFile.Get.Read(out _, 0, SpanHelpers.AsByteSpan(ref context), ReadOption.None);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = contextFile.Get.Read(out _, 0, SpanHelpers.AsByteSpan(ref context), ReadOption.None);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Note: Nintendo doesn't check if the proper amount of bytes were read, but it
|
||||
// doesn't really matter since the context is validated.
|
||||
@ -301,32 +301,32 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
using var reader = new SharedRef<SaveDataInfoReaderImpl>();
|
||||
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
||||
|
||||
rc = saveService.OpenSaveDataIndexerAccessor(ref accessor.Ref(), out _, SaveDataSpaceId.User);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = saveService.OpenSaveDataIndexerAccessor(ref accessor.Ref(), out _, SaveDataSpaceId.User);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = accessor.Get.GetInterface().OpenSaveDataInfoReader(ref reader.Ref());
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = accessor.Get.GetInterface().OpenSaveDataInfoReader(ref reader.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Iterate through all the saves to find any provisionally committed save data
|
||||
while (true)
|
||||
{
|
||||
Unsafe.SkipInit(out SaveDataInfo info);
|
||||
|
||||
rc = reader.Get.Read(out long readCount, OutBuffer.FromStruct(ref info));
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = reader.Get.Read(out long readCount, OutBuffer.FromStruct(ref info));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Break once we're done iterating all save data
|
||||
if (readCount == 0)
|
||||
break;
|
||||
|
||||
rc = multiCommitInterface.IsProvisionallyCommittedSaveData(out bool isProvisionallyCommitted,
|
||||
res = multiCommitInterface.IsProvisionallyCommittedSaveData(out bool isProvisionallyCommitted,
|
||||
in info);
|
||||
|
||||
// Note: Multi-commits are only recovered at boot time, so some saves could be missed if there
|
||||
// are more than MaxFileSystemCount provisionally committed saves.
|
||||
// In theory this shouldn't happen because a multi-commit should only be interrupted if the
|
||||
// entire OS is brought down.
|
||||
if (rc.IsSuccess() && isProvisionallyCommitted && saveCount < MaxFileSystemCount)
|
||||
if (res.IsSuccess() && isProvisionallyCommitted && saveCount < MaxFileSystemCount)
|
||||
{
|
||||
savesToRecover[saveCount] = info;
|
||||
saveCount++;
|
||||
@ -339,11 +339,11 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
// If any commits fail, the result from the first failed recovery will be returned.
|
||||
for (int i = 0; i < saveCount; i++)
|
||||
{
|
||||
rc = multiCommitInterface.RecoverProvisionallyCommittedSaveData(in savesToRecover[i], false);
|
||||
res = multiCommitInterface.RecoverProvisionallyCommittedSaveData(in savesToRecover[i], false);
|
||||
|
||||
if (rc.IsFailure() && !recoveryResult.IsFailure())
|
||||
if (res.IsFailure() && !recoveryResult.IsFailure())
|
||||
{
|
||||
recoveryResult = rc;
|
||||
recoveryResult = res;
|
||||
}
|
||||
}
|
||||
|
||||
@ -369,9 +369,9 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
// Keep track of the first error that occurs during the recovery
|
||||
Result recoveryResult = Result.Success;
|
||||
|
||||
Result rc = RecoverCommit(multiCommitInterface, contextFs, saveService);
|
||||
Result res = RecoverCommit(multiCommitInterface, contextFs, saveService);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
// Note: Yes, the next ~50 lines are exactly the same as the code in RecoverCommit except
|
||||
// for a single bool value. No, Nintendo doesn't split it out into its own function.
|
||||
@ -382,32 +382,32 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
using var reader = new SharedRef<SaveDataInfoReaderImpl>();
|
||||
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
||||
|
||||
rc = saveService.OpenSaveDataIndexerAccessor(ref accessor.Ref(), out _, SaveDataSpaceId.User);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = saveService.OpenSaveDataIndexerAccessor(ref accessor.Ref(), out _, SaveDataSpaceId.User);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = accessor.Get.GetInterface().OpenSaveDataInfoReader(ref reader.Ref());
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = accessor.Get.GetInterface().OpenSaveDataInfoReader(ref reader.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Iterate through all the saves to find any provisionally committed save data
|
||||
while (true)
|
||||
{
|
||||
Unsafe.SkipInit(out SaveDataInfo info);
|
||||
|
||||
rc = reader.Get.Read(out long readCount, OutBuffer.FromStruct(ref info));
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = reader.Get.Read(out long readCount, OutBuffer.FromStruct(ref info));
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Break once we're done iterating all save data
|
||||
if (readCount == 0)
|
||||
break;
|
||||
|
||||
rc = multiCommitInterface.IsProvisionallyCommittedSaveData(out bool isProvisionallyCommitted,
|
||||
res = multiCommitInterface.IsProvisionallyCommittedSaveData(out bool isProvisionallyCommitted,
|
||||
in info);
|
||||
|
||||
// Note: Multi-commits are only recovered at boot time, so some saves could be missed if there
|
||||
// are more than MaxFileSystemCount provisionally committed saves.
|
||||
// In theory this shouldn't happen because a multi-commit should only be interrupted if the
|
||||
// entire OS is brought down.
|
||||
if (rc.IsSuccess() && isProvisionallyCommitted && saveCount < MaxFileSystemCount)
|
||||
if (res.IsSuccess() && isProvisionallyCommitted && saveCount < MaxFileSystemCount)
|
||||
{
|
||||
savesToRecover[saveCount] = info;
|
||||
saveCount++;
|
||||
@ -420,25 +420,25 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
// If any commits fail, the result from the first failed recovery will be returned.
|
||||
for (int i = 0; i < saveCount; i++)
|
||||
{
|
||||
rc = multiCommitInterface.RecoverProvisionallyCommittedSaveData(in savesToRecover[i], true);
|
||||
res = multiCommitInterface.RecoverProvisionallyCommittedSaveData(in savesToRecover[i], true);
|
||||
|
||||
if (rc.IsFailure() && !recoveryResult.IsFailure())
|
||||
if (res.IsFailure() && !recoveryResult.IsFailure())
|
||||
{
|
||||
recoveryResult = rc;
|
||||
recoveryResult = res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
using var contextFilePath = new Fs.Path();
|
||||
rc = PathFunctions.SetUpFixedPath(ref contextFilePath.Ref(), CommitContextFileName);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = PathFunctions.SetUpFixedPath(ref contextFilePath.Ref(), CommitContextFileName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Delete the commit context file
|
||||
rc = contextFs.DeleteFile(in contextFilePath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = contextFs.DeleteFile(in contextFilePath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = contextFs.Commit();
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = contextFs.Commit();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return recoveryResult;
|
||||
}
|
||||
@ -462,12 +462,12 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
// Check if a multi-commit was interrupted by checking if there's a commit context file.
|
||||
Result rc = multiCommitInterface.OpenMultiCommitContext(ref fileSystem.Ref());
|
||||
Result res = multiCommitInterface.OpenMultiCommitContext(ref fileSystem.Ref());
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
if (!ResultFs.PathNotFound.Includes(rc) && !ResultFs.TargetNotFound.Includes(rc))
|
||||
return rc;
|
||||
if (!ResultFs.PathNotFound.Includes(res) && !ResultFs.TargetNotFound.Includes(res))
|
||||
return res;
|
||||
|
||||
// Unable to open the multi-commit context file system, so there's nothing to recover
|
||||
needsRecovery = false;
|
||||
@ -476,16 +476,16 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
if (needsRecovery)
|
||||
{
|
||||
using var contextFilePath = new Fs.Path();
|
||||
rc = PathFunctions.SetUpFixedPath(ref contextFilePath.Ref(), CommitContextFileName);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = PathFunctions.SetUpFixedPath(ref contextFilePath.Ref(), CommitContextFileName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var file = new UniqueRef<IFile>();
|
||||
rc = fileSystem.Get.OpenFile(ref file.Ref(), in contextFilePath, OpenMode.Read);
|
||||
res = fileSystem.Get.OpenFile(ref file.Ref(), in contextFilePath, OpenMode.Read);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
// Unable to open the context file. No multi-commit to recover.
|
||||
if (ResultFs.PathNotFound.Includes(rc))
|
||||
if (ResultFs.PathNotFound.Includes(res))
|
||||
needsRecovery = false;
|
||||
}
|
||||
}
|
||||
@ -547,31 +547,31 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
public Result Create(long counter, int fileSystemCount)
|
||||
{
|
||||
using var contextFilePath = new Fs.Path();
|
||||
Result rc = PathFunctions.SetUpFixedPath(ref contextFilePath.Ref(), CommitContextFileName);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = PathFunctions.SetUpFixedPath(ref contextFilePath.Ref(), CommitContextFileName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Open context file and create if it doesn't exist
|
||||
using (var contextFile = new UniqueRef<IFile>())
|
||||
{
|
||||
rc = _fileSystem.OpenFile(ref contextFile.Ref(), in contextFilePath, OpenMode.Read);
|
||||
res = _fileSystem.OpenFile(ref contextFile.Ref(), in contextFilePath, OpenMode.Read);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
if (!ResultFs.PathNotFound.Includes(rc))
|
||||
return rc;
|
||||
if (!ResultFs.PathNotFound.Includes(res))
|
||||
return res;
|
||||
|
||||
rc = _fileSystem.CreateFile(in contextFilePath, CommitContextFileSize);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fileSystem.CreateFile(in contextFilePath, CommitContextFileSize);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _fileSystem.OpenFile(ref contextFile.Ref(), in contextFilePath, OpenMode.Read);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fileSystem.OpenFile(ref contextFile.Ref(), in contextFilePath, OpenMode.Read);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
}
|
||||
|
||||
using (var contextFile = new UniqueRef<IFile>())
|
||||
{
|
||||
rc = _fileSystem.OpenFile(ref contextFile.Ref(), in contextFilePath, OpenMode.ReadWrite);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fileSystem.OpenFile(ref contextFile.Ref(), in contextFilePath, OpenMode.ReadWrite);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
_context.Version = CurrentCommitContextVersion;
|
||||
_context.State = CommitState.NotCommitted;
|
||||
@ -579,15 +579,15 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
_context.Counter = counter;
|
||||
|
||||
// Write the initial context to the file
|
||||
rc = contextFile.Get.Write(0, SpanHelpers.AsByteSpan(ref _context), WriteOption.None);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = contextFile.Get.Write(0, SpanHelpers.AsByteSpan(ref _context), WriteOption.None);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = contextFile.Get.Flush();
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = contextFile.Get.Flush();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
rc = _fileSystem.Commit();
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fileSystem.Commit();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -601,20 +601,20 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
{
|
||||
using (var contextFilePath = new Fs.Path())
|
||||
{
|
||||
Result rc = PathFunctions.SetUpFixedPath(ref contextFilePath.Ref(), CommitContextFileName);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = PathFunctions.SetUpFixedPath(ref contextFilePath.Ref(), CommitContextFileName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var contextFile = new UniqueRef<IFile>();
|
||||
rc = _fileSystem.OpenFile(ref contextFile.Ref(), in contextFilePath, OpenMode.ReadWrite);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fileSystem.OpenFile(ref contextFile.Ref(), in contextFilePath, OpenMode.ReadWrite);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
_context.State = CommitState.ProvisionallyCommitted;
|
||||
|
||||
rc = contextFile.Get.Write(0, SpanHelpers.AsByteSpan(ref _context), WriteOption.None);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = contextFile.Get.Write(0, SpanHelpers.AsByteSpan(ref _context), WriteOption.None);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = contextFile.Get.Flush();
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = contextFile.Get.Flush();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
return _fileSystem.Commit();
|
||||
@ -627,14 +627,14 @@ internal class MultiCommitManager : IMultiCommitManager
|
||||
public Result CommitDone()
|
||||
{
|
||||
using var contextFilePath = new Fs.Path();
|
||||
Result rc = PathFunctions.SetUpFixedPath(ref contextFilePath.Ref(), CommitContextFileName);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = PathFunctions.SetUpFixedPath(ref contextFilePath.Ref(), CommitContextFileName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _fileSystem.DeleteFile(in contextFilePath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fileSystem.DeleteFile(in contextFilePath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _fileSystem.Commit();
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _fileSystem.Commit();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
_fileSystem = null;
|
||||
return Result.Success;
|
||||
|
@ -137,8 +137,8 @@ public class SaveDataFileSystemCacheManager : IDisposable
|
||||
}
|
||||
else
|
||||
{
|
||||
Result rc = fileSystem.Get.RollbackOnlyModified();
|
||||
if (rc.IsSuccess())
|
||||
Result res = fileSystem.Get.RollbackOnlyModified();
|
||||
if (res.IsSuccess())
|
||||
{
|
||||
using ScopedLock<SdkRecursiveMutexType> scopedLock = ScopedLock.Lock(ref _mutex);
|
||||
|
||||
|
@ -39,18 +39,18 @@ public class StorageInterfaceAdapter : IStorageSf
|
||||
if (destination.Size < size)
|
||||
return ResultFs.InvalidSize.Log();
|
||||
|
||||
Result rc = Result.Success;
|
||||
Result res = Result.Success;
|
||||
|
||||
for (int tryNum = 0; tryNum < maxTryCount; tryNum++)
|
||||
{
|
||||
rc = _baseStorage.Get.Read(offset, destination.Buffer.Slice(0, (int)size));
|
||||
res = _baseStorage.Get.Read(offset, destination.Buffer.Slice(0, (int)size));
|
||||
|
||||
// Retry on ResultDataCorrupted
|
||||
if (!ResultFs.DataCorrupted.Includes(rc))
|
||||
if (!ResultFs.DataCorrupted.Includes(res))
|
||||
break;
|
||||
}
|
||||
|
||||
return rc;
|
||||
return res;
|
||||
}
|
||||
|
||||
public Result Write(long offset, InBuffer source, long size)
|
||||
@ -94,17 +94,17 @@ public class StorageInterfaceAdapter : IStorageSf
|
||||
{
|
||||
Unsafe.SkipInit(out QueryRangeInfo info);
|
||||
|
||||
Result rc = _baseStorage.Get.OperateRange(SpanHelpers.AsByteSpan(ref info), OperationId.QueryRange,
|
||||
Result res = _baseStorage.Get.OperateRange(SpanHelpers.AsByteSpan(ref info), OperationId.QueryRange,
|
||||
offset, size, ReadOnlySpan<byte>.Empty);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rangeInfo.Merge(in info);
|
||||
}
|
||||
else if (operationId == (int)OperationId.InvalidateCache)
|
||||
{
|
||||
Result rc = _baseStorage.Get.OperateRange(Span<byte>.Empty, OperationId.InvalidateCache, offset, size,
|
||||
Result res = _baseStorage.Get.OperateRange(Span<byte>.Empty, OperationId.InvalidateCache, offset, size,
|
||||
ReadOnlySpan<byte>.Empty);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
return Result.Success;
|
||||
|
@ -26,8 +26,8 @@ internal static class Utility
|
||||
|
||||
// Check if the directory exists
|
||||
using var dir = new UniqueRef<IDirectory>();
|
||||
Result rc = baseFileSystem.Get.OpenDirectory(ref dir.Ref(), rootPath, OpenDirectoryMode.Directory);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = baseFileSystem.Get.OpenDirectory(ref dir.Ref(), rootPath, OpenDirectoryMode.Directory);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
dir.Reset();
|
||||
|
||||
@ -35,8 +35,8 @@ internal static class Utility
|
||||
if (!fs.HasValue)
|
||||
return ResultFs.AllocationMemoryFailedInSubDirectoryFileSystemCreatorA.Log();
|
||||
|
||||
rc = fs.Get.Initialize(in rootPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = fs.Get.Initialize(in rootPath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outSubDirFileSystem.SetByMove(ref fs.Ref());
|
||||
|
||||
@ -54,8 +54,8 @@ internal static class Utility
|
||||
}
|
||||
|
||||
// Ensure the path exists or check if it's a directory
|
||||
Result rc = FsSystem.Utility.EnsureDirectory(baseFileSystem.Get, in rootPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = FsSystem.Utility.EnsureDirectory(baseFileSystem.Get, in rootPath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return CreateSubDirectoryFileSystem(ref outFileSystem, ref baseFileSystem, rootPath);
|
||||
}
|
||||
|
@ -77,8 +77,8 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||
|
||||
// Get the program info for the caller and verify permissions
|
||||
Result rc = GetProgramInfo(out ProgramInfo callerProgramInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo callerProgramInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (fsType != FileSystemProxyType.Manual)
|
||||
{
|
||||
@ -102,8 +102,8 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
||||
// Get the program info for the owner of the file system being opened
|
||||
rc = GetProgramInfoByProgramId(out ProgramInfo ownerProgramInfo, programId.Value);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = GetProgramInfoByProgramId(out ProgramInfo ownerProgramInfo, programId.Value);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Try to find the path to the original version of the file system
|
||||
using var originalPath = new Path();
|
||||
@ -127,9 +127,9 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
return originalResult;
|
||||
|
||||
// There is an original version and no patch version. Open the original directly
|
||||
rc = _serviceImpl.OpenFileSystem(ref fileSystem.Ref(), in originalPath, fsType, programId.Value,
|
||||
res = _serviceImpl.OpenFileSystem(ref fileSystem.Ref(), in originalPath, fsType, programId.Value,
|
||||
isDirectory);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -141,9 +141,9 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
: ref PathExtensions.GetNullRef();
|
||||
|
||||
// Open the file system using both the original and patch versions
|
||||
rc = _serviceImpl.OpenFileSystemWithPatch(ref fileSystem.Ref(), in originalNcaPath, in patchPath,
|
||||
res = _serviceImpl.OpenFileSystemWithPatch(ref fileSystem.Ref(), in originalNcaPath, in patchPath,
|
||||
fsType, programId.Value);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
// Add all the file system wrappers
|
||||
@ -231,8 +231,8 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
const StorageLayoutType storageFlag = StorageLayoutType.All;
|
||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
AccessControl ac = programInfo.AccessControl;
|
||||
|
||||
@ -278,21 +278,21 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
bool canMountSystemDataPrivate = ac.GetAccessibilityFor(AccessibilityType.MountSystemDataPrivate).CanRead;
|
||||
|
||||
using var pathNormalized = new Path();
|
||||
rc = pathNormalized.InitializeWithReplaceUnc(path.Str);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = pathNormalized.InitializeWithReplaceUnc(path.Str);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
var pathFlags = new PathFlags();
|
||||
pathFlags.AllowWindowsPath();
|
||||
pathFlags.AllowMountName();
|
||||
rc = pathNormalized.Normalize(pathFlags);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = pathNormalized.Normalize(pathFlags);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
bool isDirectory = PathUtility.IsDirectoryPath(in path);
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
rc = _serviceImpl.OpenFileSystem(ref fileSystem.Ref(), in pathNormalized, fsType, canMountSystemDataPrivate,
|
||||
res = _serviceImpl.OpenFileSystem(ref fileSystem.Ref(), in pathNormalized, fsType, canMountSystemDataPrivate,
|
||||
id, isDirectory);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Add all the wrappers for the file system
|
||||
using var typeSetFileSystem =
|
||||
@ -321,17 +321,17 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
|
||||
public Result OpenDataFileSystemWithProgramIndex(ref SharedRef<IFileSystemSf> outFileSystem, byte programIndex)
|
||||
{
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Get the program ID of the program with the specified index if in a multi-program application
|
||||
rc = _serviceImpl.ResolveRomReferenceProgramId(out ProgramId targetProgramId, programInfo.ProgramId,
|
||||
res = _serviceImpl.ResolveRomReferenceProgramId(out ProgramId targetProgramId, programInfo.ProgramId,
|
||||
programIndex);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
rc = OpenDataFileSystemCore(ref fileSystem.Ref(), out _, targetProgramId.Value, programInfo.StorageId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = OpenDataFileSystemCore(ref fileSystem.Ref(), out _, targetProgramId.Value, programInfo.StorageId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Verify the caller has access to the file system
|
||||
if (targetProgramId != programInfo.ProgramId &&
|
||||
@ -363,21 +363,21 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
|
||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.All);
|
||||
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.CanCall(OperationType.GetRightsId))
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
||||
using var programPath = new Path();
|
||||
rc = _serviceImpl.ResolveProgramPath(out bool isDirectory, ref programPath.Ref(), programId, storageId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _serviceImpl.ResolveProgramPath(out bool isDirectory, ref programPath.Ref(), programId, storageId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (isDirectory)
|
||||
return ResultFs.TargetNotFound.Log();
|
||||
|
||||
rc = _serviceImpl.GetRightsId(out RightsId rightsId, out _, in programPath, programId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _serviceImpl.GetRightsId(out RightsId rightsId, out _, in programPath, programId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outRightsId = rightsId;
|
||||
|
||||
@ -391,28 +391,28 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
|
||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(StorageLayoutType.All);
|
||||
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.CanCall(OperationType.GetRightsId))
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
||||
using var pathNormalized = new Path();
|
||||
rc = pathNormalized.Initialize(path.Str);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = pathNormalized.Initialize(path.Str);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
var pathFlags = new PathFlags();
|
||||
pathFlags.AllowWindowsPath();
|
||||
pathFlags.AllowMountName();
|
||||
rc = pathNormalized.Normalize(pathFlags);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = pathNormalized.Normalize(pathFlags);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (PathUtility.IsDirectoryPath(in path))
|
||||
return ResultFs.TargetNotFound.Log();
|
||||
|
||||
rc = _serviceImpl.GetRightsId(out RightsId rightsId, out byte keyGeneration, in pathNormalized,
|
||||
res = _serviceImpl.GetRightsId(out RightsId rightsId, out byte keyGeneration, in pathNormalized,
|
||||
new ProgramId(checkThroughProgramId));
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outRightsId = rightsId;
|
||||
outKeyGeneration = keyGeneration;
|
||||
@ -430,15 +430,15 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
using var scopedContext = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||
|
||||
using var programPath = new Path();
|
||||
Result rc = _serviceImpl.ResolveRomPath(out bool isDirectory, ref programPath.Ref(), programId, storageId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = _serviceImpl.ResolveRomPath(out bool isDirectory, ref programPath.Ref(), programId, storageId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
isHostFs = Utility.IsHostFsMountName(programPath.GetString());
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
rc = _serviceImpl.OpenDataFileSystem(ref fileSystem.Ref(), in programPath, FileSystemProxyType.Rom,
|
||||
res = _serviceImpl.OpenDataFileSystem(ref fileSystem.Ref(), in programPath, FileSystemProxyType.Rom,
|
||||
programId, isDirectory);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Add all the file system wrappers
|
||||
using var typeSetFileSystem =
|
||||
@ -455,8 +455,8 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
StorageLayoutType storageFlag = contentStorageId == ContentStorageId.System ? StorageLayoutType.Bis : StorageLayoutType.All;
|
||||
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Accessibility accessibility =
|
||||
programInfo.AccessControl.GetAccessibilityFor(AccessibilityType.MountContentStorage);
|
||||
@ -465,8 +465,8 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
rc = _serviceImpl.OpenContentStorageFileSystem(ref fileSystem.Ref(), contentStorageId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _serviceImpl.OpenContentStorageFileSystem(ref fileSystem.Ref(), contentStorageId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Add all the file system wrappers
|
||||
using var typeSetFileSystem =
|
||||
@ -485,8 +485,8 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
|
||||
public Result RegisterExternalKey(in RightsId rightsId, in AccessKey accessKey)
|
||||
{
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.CanCall(OperationType.RegisterExternalKey))
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
@ -496,8 +496,8 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
|
||||
public Result UnregisterExternalKey(in RightsId rightsId)
|
||||
{
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.CanCall(OperationType.RegisterExternalKey))
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
@ -507,8 +507,8 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
|
||||
public Result UnregisterAllExternalKey()
|
||||
{
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.CanCall(OperationType.RegisterExternalKey))
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
@ -518,8 +518,8 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
|
||||
public Result RegisterUpdatePartition()
|
||||
{
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.CanCall(OperationType.RegisterUpdatePartition))
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
@ -527,8 +527,8 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
ulong targetProgramId = programInfo.ProgramIdValue;
|
||||
|
||||
using var programPath = new Path();
|
||||
rc = _serviceImpl.ResolveRomPath(out _, ref programPath.Ref(), targetProgramId, programInfo.StorageId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _serviceImpl.ResolveRomPath(out _, ref programPath.Ref(), targetProgramId, programInfo.StorageId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return _serviceImpl.RegisterUpdatePartition(targetProgramId, in programPath);
|
||||
}
|
||||
@ -538,8 +538,8 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
var storageFlag = StorageLayoutType.All;
|
||||
using var scopedLayoutType = new ScopedStorageLayoutTypeSetter(storageFlag);
|
||||
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Accessibility accessibility =
|
||||
programInfo.AccessControl.GetAccessibilityFor(AccessibilityType.MountRegisteredUpdatePartition);
|
||||
@ -547,8 +547,8 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
rc = _serviceImpl.OpenRegisteredUpdatePartition(ref fileSystem.Ref());
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _serviceImpl.OpenRegisteredUpdatePartition(ref fileSystem.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Add all the file system wrappers
|
||||
using var typeSetFileSystem =
|
||||
@ -572,8 +572,8 @@ internal class NcaFileSystemService : IRomFileSystemAccessFailureManager
|
||||
|
||||
public Result SetSdCardEncryptionSeed(in EncryptionSeed encryptionSeed)
|
||||
{
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.CanCall(OperationType.SetEncryptionSeed))
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
@ -94,9 +94,9 @@ public class NcaFileSystemServiceImpl
|
||||
|
||||
// Open the root filesystem based on the path's mount name
|
||||
using var baseFileSystem = new SharedRef<IFileSystem>();
|
||||
Result rc = ParseMountName(ref currentPath, ref baseFileSystem.Ref(), out bool shouldContinue,
|
||||
Result res = ParseMountName(ref currentPath, ref baseFileSystem.Ref(), out bool shouldContinue,
|
||||
out MountInfo mountNameInfo);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Don't continue if the rest of the path is empty
|
||||
if (!shouldContinue)
|
||||
@ -104,18 +104,18 @@ public class NcaFileSystemServiceImpl
|
||||
|
||||
if (type == FileSystemProxyType.Logo && mountNameInfo.IsGameCard)
|
||||
{
|
||||
rc = _config.BaseFsService.OpenGameCardFileSystem(ref outFileSystem, (uint)mountNameInfo.GcHandle,
|
||||
res = _config.BaseFsService.OpenGameCardFileSystem(ref outFileSystem, (uint)mountNameInfo.GcHandle,
|
||||
GameCardPartition.Logo);
|
||||
|
||||
if (rc.IsSuccess())
|
||||
if (res.IsSuccess())
|
||||
return Result.Success;
|
||||
|
||||
if (!ResultFs.PartitionNotFound.Includes(rc))
|
||||
return rc;
|
||||
if (!ResultFs.PartitionNotFound.Includes(res))
|
||||
return res;
|
||||
}
|
||||
|
||||
rc = CheckDirOrNcaOrNsp(ref currentPath, out isDirectory);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = CheckDirOrNcaOrNsp(ref currentPath, out isDirectory);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (isDirectory)
|
||||
{
|
||||
@ -123,17 +123,17 @@ public class NcaFileSystemServiceImpl
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
||||
using var directoryPath = new Path();
|
||||
rc = directoryPath.InitializeWithNormalization(currentPath.Value);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = directoryPath.InitializeWithNormalization(currentPath.Value);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (type == FileSystemProxyType.Manual)
|
||||
{
|
||||
using var hostFileSystem = new SharedRef<IFileSystem>();
|
||||
using var readOnlyFileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
rc = ParseDirWithPathCaseNormalizationOnCaseSensitiveHostFs(ref hostFileSystem.Ref(),
|
||||
res = ParseDirWithPathCaseNormalizationOnCaseSensitiveHostFs(ref hostFileSystem.Ref(),
|
||||
in directoryPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
readOnlyFileSystem.Reset(new ReadOnlyFileSystem(ref hostFileSystem.Ref()));
|
||||
outFileSystem.SetByMove(ref readOnlyFileSystem.Ref());
|
||||
@ -146,9 +146,9 @@ public class NcaFileSystemServiceImpl
|
||||
|
||||
using var nspFileSystem = new SharedRef<IFileSystem>();
|
||||
using SharedRef<IFileSystem> tempFileSystem = SharedRef<IFileSystem>.CreateCopy(in baseFileSystem);
|
||||
rc = ParseNsp(ref currentPath, ref nspFileSystem.Ref(), ref baseFileSystem.Ref());
|
||||
res = ParseNsp(ref currentPath, ref nspFileSystem.Ref(), ref baseFileSystem.Ref());
|
||||
|
||||
if (rc.IsSuccess())
|
||||
if (res.IsSuccess())
|
||||
{
|
||||
// Must be the end of the path to open Application Package FS type
|
||||
if (currentPath.Value.At(0) == 0)
|
||||
@ -172,13 +172,13 @@ public class NcaFileSystemServiceImpl
|
||||
|
||||
ulong openProgramId = mountNameInfo.IsHostFs ? ulong.MaxValue : id;
|
||||
|
||||
rc = ParseNca(ref currentPath, out Nca nca, ref baseFileSystem.Ref(), openProgramId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = ParseNca(ref currentPath, out Nca nca, ref baseFileSystem.Ref(), openProgramId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var ncaSectionStorage = new SharedRef<IStorage>();
|
||||
rc = OpenStorageByContentType(ref ncaSectionStorage.Ref(), nca, out NcaFormatType fsType, type,
|
||||
res = OpenStorageByContentType(ref ncaSectionStorage.Ref(), nca, out NcaFormatType fsType, type,
|
||||
mountNameInfo.IsGameCard, canMountSystemDataPrivate);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
switch (fsType)
|
||||
{
|
||||
@ -207,9 +207,9 @@ public class NcaFileSystemServiceImpl
|
||||
in Path originalNcaPath, in Path currentNcaPath, FileSystemProxyType fsType, ulong id)
|
||||
{
|
||||
using var romFsStorage = new SharedRef<IStorage>();
|
||||
Result rc = OpenStorageWithPatch(ref romFsStorage.Ref(), out Unsafe.NullRef<Hash>(), in originalNcaPath,
|
||||
Result res = OpenStorageWithPatch(ref romFsStorage.Ref(), out Unsafe.NullRef<Hash>(), in originalNcaPath,
|
||||
in currentNcaPath, fsType, id);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return _config.RomFsCreator.Create(ref outFileSystem, ref romFsStorage.Ref());
|
||||
}
|
||||
@ -218,22 +218,22 @@ public class NcaFileSystemServiceImpl
|
||||
ContentStorageId contentStorageId)
|
||||
{
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
Result rc;
|
||||
Result res;
|
||||
|
||||
// Open the appropriate base file system for the content storage ID
|
||||
switch (contentStorageId)
|
||||
{
|
||||
case ContentStorageId.System:
|
||||
rc = _config.BaseFsService.OpenBisFileSystem(ref fileSystem.Ref(), BisPartitionId.System);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _config.BaseFsService.OpenBisFileSystem(ref fileSystem.Ref(), BisPartitionId.System);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
break;
|
||||
case ContentStorageId.User:
|
||||
rc = _config.BaseFsService.OpenBisFileSystem(ref fileSystem.Ref(), BisPartitionId.User);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _config.BaseFsService.OpenBisFileSystem(ref fileSystem.Ref(), BisPartitionId.User);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
break;
|
||||
case ContentStorageId.SdCard:
|
||||
rc = _config.BaseFsService.OpenSdCardProxyFileSystem(ref fileSystem.Ref());
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _config.BaseFsService.OpenSdCardProxyFileSystem(ref fileSystem.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
break;
|
||||
default:
|
||||
return ResultFs.InvalidArgument.Log();
|
||||
@ -255,24 +255,24 @@ public class NcaFileSystemServiceImpl
|
||||
}
|
||||
|
||||
using var contentStoragePath = new Path();
|
||||
rc = PathFunctions.SetUpFixedPath(ref contentStoragePath.Ref(), contentStoragePathBuffer);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = PathFunctions.SetUpFixedPath(ref contentStoragePath.Ref(), contentStoragePathBuffer);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Make sure the content storage path exists
|
||||
rc = Utility.EnsureDirectory(fileSystem.Get, in contentStoragePath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = Utility.EnsureDirectory(fileSystem.Get, in contentStoragePath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var subDirFs = new SharedRef<IFileSystem>();
|
||||
rc = _config.SubDirectoryFsCreator.Create(ref subDirFs.Ref(), ref fileSystem.Ref(), in contentStoragePath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _config.SubDirectoryFsCreator.Create(ref subDirFs.Ref(), ref fileSystem.Ref(), in contentStoragePath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Only content on the SD card is encrypted
|
||||
if (contentStorageId == ContentStorageId.SdCard)
|
||||
{
|
||||
using SharedRef<IFileSystem> tempFileSystem = SharedRef<IFileSystem>.CreateMove(ref subDirFs.Ref());
|
||||
rc = _config.EncryptedFsCreator.Create(ref subDirFs.Ref(), ref tempFileSystem.Ref(),
|
||||
res = _config.EncryptedFsCreator.Create(ref subDirFs.Ref(), ref tempFileSystem.Ref(),
|
||||
IEncryptedFileSystemCreator.KeyId.Content, in _encryptionSeed);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
outFileSystem.SetByMove(ref subDirFs.Ref());
|
||||
|
||||
@ -351,8 +351,8 @@ public class NcaFileSystemServiceImpl
|
||||
|
||||
path = path.Slice(8);
|
||||
|
||||
Result rc = _config.BaseFsService.OpenGameCardFileSystem(ref outFileSystem, (uint)handle, partition);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = _config.BaseFsService.OpenGameCardFileSystem(ref outFileSystem, (uint)handle, partition);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
info.GcHandle = handle;
|
||||
info.IsGameCard = true;
|
||||
@ -364,8 +364,8 @@ public class NcaFileSystemServiceImpl
|
||||
{
|
||||
path = path.Slice(CommonPaths.ContentStorageSystemMountName.Length);
|
||||
|
||||
Result rc = OpenContentStorageFileSystem(ref outFileSystem, ContentStorageId.System);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = OpenContentStorageFileSystem(ref outFileSystem, ContentStorageId.System);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
info.CanMountNca = true;
|
||||
}
|
||||
@ -375,8 +375,8 @@ public class NcaFileSystemServiceImpl
|
||||
{
|
||||
path = path.Slice(CommonPaths.ContentStorageUserMountName.Length);
|
||||
|
||||
Result rc = OpenContentStorageFileSystem(ref outFileSystem, ContentStorageId.User);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = OpenContentStorageFileSystem(ref outFileSystem, ContentStorageId.User);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
info.CanMountNca = true;
|
||||
}
|
||||
@ -386,8 +386,8 @@ public class NcaFileSystemServiceImpl
|
||||
{
|
||||
path = path.Slice(CommonPaths.ContentStorageSdCardMountName.Length);
|
||||
|
||||
Result rc = OpenContentStorageFileSystem(ref outFileSystem, ContentStorageId.SdCard);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = OpenContentStorageFileSystem(ref outFileSystem, ContentStorageId.SdCard);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
info.CanMountNca = true;
|
||||
}
|
||||
@ -397,8 +397,8 @@ public class NcaFileSystemServiceImpl
|
||||
{
|
||||
path = path.Slice(CommonPaths.BisCalibrationFilePartitionMountName.Length);
|
||||
|
||||
Result rc = _config.BaseFsService.OpenBisFileSystem(ref outFileSystem, BisPartitionId.CalibrationFile);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = _config.BaseFsService.OpenBisFileSystem(ref outFileSystem, BisPartitionId.CalibrationFile);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
else if (StringUtils.Compare(path, CommonPaths.BisSafeModePartitionMountName,
|
||||
@ -406,8 +406,8 @@ public class NcaFileSystemServiceImpl
|
||||
{
|
||||
path = path.Slice(CommonPaths.BisSafeModePartitionMountName.Length);
|
||||
|
||||
Result rc = _config.BaseFsService.OpenBisFileSystem(ref outFileSystem, BisPartitionId.SafeMode);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = _config.BaseFsService.OpenBisFileSystem(ref outFileSystem, BisPartitionId.SafeMode);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
else if (StringUtils.Compare(path, CommonPaths.BisUserPartitionMountName,
|
||||
@ -415,8 +415,8 @@ public class NcaFileSystemServiceImpl
|
||||
{
|
||||
path = path.Slice(CommonPaths.BisUserPartitionMountName.Length);
|
||||
|
||||
Result rc = _config.BaseFsService.OpenBisFileSystem(ref outFileSystem, BisPartitionId.User);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = _config.BaseFsService.OpenBisFileSystem(ref outFileSystem, BisPartitionId.User);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
else if (StringUtils.Compare(path, CommonPaths.BisSystemPartitionMountName,
|
||||
@ -424,8 +424,8 @@ public class NcaFileSystemServiceImpl
|
||||
{
|
||||
path = path.Slice(CommonPaths.BisSystemPartitionMountName.Length);
|
||||
|
||||
Result rc = _config.BaseFsService.OpenBisFileSystem(ref outFileSystem, BisPartitionId.System);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = _config.BaseFsService.OpenBisFileSystem(ref outFileSystem, BisPartitionId.System);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
else if (StringUtils.Compare(path, CommonPaths.SdCardFileSystemMountName,
|
||||
@ -433,8 +433,8 @@ public class NcaFileSystemServiceImpl
|
||||
{
|
||||
path = path.Slice(CommonPaths.SdCardFileSystemMountName.Length);
|
||||
|
||||
Result rc = _config.BaseFsService.OpenSdCardProxyFileSystem(ref outFileSystem);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = _config.BaseFsService.OpenSdCardProxyFileSystem(ref outFileSystem);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
else if (StringUtils.Compare(path, CommonPaths.HostRootFileSystemMountName,
|
||||
@ -443,14 +443,14 @@ public class NcaFileSystemServiceImpl
|
||||
path = path.Slice(CommonPaths.HostRootFileSystemMountName.Length);
|
||||
|
||||
using var rootPathEmpty = new Path();
|
||||
Result rc = rootPathEmpty.InitializeAsEmpty();
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = rootPathEmpty.InitializeAsEmpty();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
info.IsHostFs = true;
|
||||
info.CanMountNca = true;
|
||||
|
||||
rc = OpenHostFileSystem(ref outFileSystem, in rootPathEmpty, openCaseSensitive: false);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = OpenHostFileSystem(ref outFileSystem, in rootPathEmpty, openCaseSensitive: false);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
else if (StringUtils.Compare(path, CommonPaths.RegisteredUpdatePartitionMountName,
|
||||
@ -519,8 +519,8 @@ public class NcaFileSystemServiceImpl
|
||||
ref SharedRef<IFileSystem> baseFileSystem, FileSystemProxyType fsType, bool preserveUnc)
|
||||
{
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
Result rc = _config.SubDirectoryFsCreator.Create(ref fileSystem.Ref(), ref baseFileSystem, in path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = _config.SubDirectoryFsCreator.Create(ref fileSystem.Ref(), ref baseFileSystem, in path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return ParseContentTypeForDirectory(ref outContentFileSystem, ref fileSystem.Ref(), fsType);
|
||||
}
|
||||
@ -531,19 +531,19 @@ public class NcaFileSystemServiceImpl
|
||||
using var pathRoot = new Path();
|
||||
using var pathData = new Path();
|
||||
|
||||
Result rc = PathFunctions.SetUpFixedPath(ref pathData.Ref(),
|
||||
Result res = PathFunctions.SetUpFixedPath(ref pathData.Ref(),
|
||||
new[] { (byte)'/', (byte)'d', (byte)'a', (byte)'t', (byte)'a' });
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = pathRoot.Combine(in path, in pathData);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = pathRoot.Combine(in path, in pathData);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _config.TargetManagerFsCreator.NormalizeCaseOfPath(out bool isSupported, ref pathRoot.Ref());
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _config.TargetManagerFsCreator.NormalizeCaseOfPath(out bool isSupported, ref pathRoot.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _config.TargetManagerFsCreator.Create(ref outFileSystem, in pathRoot, isSupported, false,
|
||||
res = _config.TargetManagerFsCreator.Create(ref outFileSystem, in pathRoot, isSupported, false,
|
||||
Result.Success);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -584,23 +584,23 @@ public class NcaFileSystemServiceImpl
|
||||
nspPathLen += 4;
|
||||
|
||||
using var pathNsp = new Path();
|
||||
Result rc = pathNsp.InitializeWithNormalization(path, nspPathLen);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = pathNsp.InitializeWithNormalization(path, nspPathLen);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var nspFileStorage = new SharedRef<FileStorageBasedFileSystem>(new FileStorageBasedFileSystem());
|
||||
|
||||
rc = nspFileStorage.Get.Initialize(ref baseFileSystem, in pathNsp, OpenMode.Read);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = nspFileStorage.Get.Initialize(ref baseFileSystem, in pathNsp, OpenMode.Read);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IStorage> tempStorage = SharedRef<IStorage>.CreateMove(ref nspFileStorage.Ref());
|
||||
rc = _config.PartitionFsCreator.Create(ref outFileSystem, ref tempStorage.Ref());
|
||||
res = _config.PartitionFsCreator.Create(ref outFileSystem, ref tempStorage.Ref());
|
||||
|
||||
if (rc.IsSuccess())
|
||||
if (res.IsSuccess())
|
||||
{
|
||||
path = path.Slice(nspPathLen);
|
||||
}
|
||||
|
||||
return rc;
|
||||
return res;
|
||||
}
|
||||
|
||||
private Result ParseNca(ref U8Span path, out Nca nca, ref SharedRef<IFileSystem> baseFileSystem, ulong ncaId)
|
||||
@ -611,14 +611,14 @@ public class NcaFileSystemServiceImpl
|
||||
var ncaFileStorage = new FileStorageBasedFileSystem();
|
||||
|
||||
using var pathNca = new Path();
|
||||
Result rc = pathNca.InitializeWithNormalization(path);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = pathNca.InitializeWithNormalization(path);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = ncaFileStorage.Initialize(ref baseFileSystem, in pathNca, OpenMode.Read);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = ncaFileStorage.Initialize(ref baseFileSystem, in pathNca, OpenMode.Read);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _config.StorageOnNcaCreator.OpenNca(out Nca ncaTemp, ncaFileStorage);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _config.StorageOnNcaCreator.OpenNca(out Nca ncaTemp, ncaFileStorage);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (ncaId == ulong.MaxValue)
|
||||
{
|
||||
@ -668,15 +668,15 @@ public class NcaFileSystemServiceImpl
|
||||
using var subDirFs = new SharedRef<IFileSystem>();
|
||||
|
||||
using var directoryPath = new Path();
|
||||
Result rc = PathFunctions.SetUpFixedPath(ref directoryPath.Ref(), dirName);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = PathFunctions.SetUpFixedPath(ref directoryPath.Ref(), dirName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (directoryPath.IsEmpty())
|
||||
return ResultFs.InvalidArgument.Log();
|
||||
|
||||
// Open the subdirectory filesystem
|
||||
rc = _config.SubDirectoryFsCreator.Create(ref subDirFs.Ref(), ref baseFileSystem, in directoryPath);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = _config.SubDirectoryFsCreator.Create(ref subDirFs.Ref(), ref baseFileSystem, in directoryPath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
outFileSystem.SetByMove(ref subDirFs.Ref());
|
||||
return Result.Success;
|
||||
@ -691,8 +691,8 @@ public class NcaFileSystemServiceImpl
|
||||
return Result.Success;
|
||||
|
||||
// ReSharper disable once UnusedVariable
|
||||
Result rc = _externalKeyManager.Get(rightsId, out AccessKey accessKey);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = _externalKeyManager.Get(rightsId, out AccessKey accessKey);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// todo: Set key in nca reader
|
||||
|
||||
@ -747,15 +747,15 @@ public class NcaFileSystemServiceImpl
|
||||
if (nca.Header.DistributionType == DistributionType.GameCard && !isGameCard)
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
|
||||
Result rc = SetExternalKeyForRightsId(nca);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = SetExternalKeyForRightsId(nca);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = GetPartitionIndex(out int sectionIndex, fsProxyType);
|
||||
if (rc.IsFailure()) return rc;
|
||||
res = GetPartitionIndex(out int sectionIndex, fsProxyType);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _config.StorageOnNcaCreator.Create(ref outNcaStorage, out NcaFsHeader fsHeader, nca,
|
||||
res = _config.StorageOnNcaCreator.Create(ref outNcaStorage, out NcaFsHeader fsHeader, nca,
|
||||
sectionIndex, fsProxyType == FileSystemProxyType.Code);
|
||||
if (rc.IsFailure()) return rc;
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
fsType = fsHeader.FormatType;
|
||||
return Result.Success;
|
||||
@ -783,14 +783,14 @@ public class NcaFileSystemServiceImpl
|
||||
|
||||
public Result ResolveProgramPath(out bool isDirectory, ref Path path, ProgramId programId, StorageId storageId)
|
||||
{
|
||||
Result rc = _locationResolverSet.ResolveProgramPath(out isDirectory, ref path, programId, storageId);
|
||||
if (rc.IsSuccess())
|
||||
Result res = _locationResolverSet.ResolveProgramPath(out isDirectory, ref path, programId, storageId);
|
||||
if (res.IsSuccess())
|
||||
return Result.Success;
|
||||
|
||||
isDirectory = false;
|
||||
|
||||
rc = _locationResolverSet.ResolveDataPath(ref path, new DataId(programId.Value), storageId);
|
||||
if (rc.IsSuccess())
|
||||
res = _locationResolverSet.ResolveDataPath(ref path, new DataId(programId.Value), storageId);
|
||||
if (res.IsSuccess())
|
||||
return Result.Success;
|
||||
|
||||
return ResultFs.TargetNotFound.Log();
|
||||
|
@ -46,8 +46,8 @@ internal readonly struct ProgramIndexRegistryService
|
||||
// Verify the caller's permissions
|
||||
using (var programRegistry = new ProgramRegistryImpl(_fsServer))
|
||||
{
|
||||
Result rc = programRegistry.GetProgramInfo(out ProgramInfo programInfo, _processId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = programRegistry.GetProgramInfo(out ProgramInfo programInfo, _processId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
if (!programInfo.AccessControl.CanCall(OperationType.RegisterProgramIndexMapInfo))
|
||||
return ResultFs.PermissionDenied.Log();
|
||||
@ -85,8 +85,8 @@ internal readonly struct ProgramIndexRegistryService
|
||||
UnsafeHelpers.SkipParamInit(out programIndex, out programCount);
|
||||
|
||||
// No permissions are needed to call this method
|
||||
Result rc = GetProgramInfo(out ProgramInfo programInfo, _processId);
|
||||
if (rc.IsFailure()) return rc;
|
||||
Result res = GetProgramInfo(out ProgramInfo programInfo, _processId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Try to get map info for this process
|
||||
Optional<ProgramIndexMapInfo> mapInfo = _serviceImpl.GetProgramIndexMapInfo(programInfo.ProgramId);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -100,8 +100,8 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
|
||||
_timeStampGetter = new TimeStampGetter(this);
|
||||
|
||||
Result rc = _saveFileSystemCacheManager.Initialize(_config.SaveDataFileSystemCacheCount);
|
||||
Abort.DoAbortUnless(rc.IsSuccess());
|
||||
Result res = _saveFileSystemCacheManager.Initialize(_config.SaveDataFileSystemCacheCount);
|
||||
Abort.DoAbortUnless(res.IsSuccess());
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
@ -121,31 +121,31 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
Result rc = OpenSaveDataDirectoryFileSystem(ref fileSystem.Ref(), spaceId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = OpenSaveDataDirectoryFileSystem(ref fileSystem.Ref(), spaceId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Get the path of the save data
|
||||
Unsafe.SkipInit(out Array18<byte> saveImageNameBuffer);
|
||||
|
||||
using var saveImageName = new Path();
|
||||
rc = PathFunctions.SetUpFixedPathSaveId(ref saveImageName.Ref(), saveImageNameBuffer.Items, saveDataId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = PathFunctions.SetUpFixedPathSaveId(ref saveImageName.Ref(), saveImageNameBuffer.Items, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = fileSystem.Get.GetEntryType(out _, in saveImageName);
|
||||
res = fileSystem.Get.GetEntryType(out _, in saveImageName);
|
||||
|
||||
if (rc.IsSuccess())
|
||||
if (res.IsSuccess())
|
||||
{
|
||||
exists = true;
|
||||
return Result.Success;
|
||||
}
|
||||
else if (ResultFs.PathNotFound.Includes(rc))
|
||||
else if (ResultFs.PathNotFound.Includes(res))
|
||||
{
|
||||
exists = false;
|
||||
return Result.Success;
|
||||
}
|
||||
else
|
||||
{
|
||||
return rc.Miss();
|
||||
return res.Miss();
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,8 +160,8 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
{
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
Result rc = OpenSaveDataDirectoryFileSystem(ref fileSystem.Ref(), spaceId, in saveDataRootPath, true);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = OpenSaveDataDirectoryFileSystem(ref fileSystem.Ref(), spaceId, in saveDataRootPath, true);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
bool isEmulatedOnHost = IsAllowedDirectorySaveData(spaceId, in saveDataRootPath);
|
||||
|
||||
@ -170,11 +170,11 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
// Create the save data directory on the host if needed.
|
||||
Unsafe.SkipInit(out Array18<byte> saveDirectoryNameBuffer);
|
||||
using var saveDirectoryName = new Path();
|
||||
rc = PathFunctions.SetUpFixedPathSaveId(ref saveDirectoryName.Ref(), saveDirectoryNameBuffer.Items, saveDataId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = PathFunctions.SetUpFixedPathSaveId(ref saveDirectoryName.Ref(), saveDirectoryNameBuffer.Items, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = FsSystem.Utility.EnsureDirectory(fileSystem.Get, in saveDirectoryName);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = FsSystem.Utility.EnsureDirectory(fileSystem.Get, in saveDirectoryName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
using var saveDataFs = new SharedRef<ISaveDataFileSystem>();
|
||||
@ -190,10 +190,10 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
bool openShared = SaveDataProperties.IsSharedOpenNeeded(type);
|
||||
bool isReconstructible = SaveDataProperties.IsReconstructible(type, spaceId);
|
||||
|
||||
rc = _config.SaveFsCreator.Create(ref saveDataFs.Ref(), ref fileSystem.Ref(), spaceId, saveDataId,
|
||||
res = _config.SaveFsCreator.Create(ref saveDataFs.Ref(), ref fileSystem.Ref(), spaceId, saveDataId,
|
||||
isEmulatedOnHost, isDeviceUniqueMac, isJournalingSupported, isMultiCommitSupported,
|
||||
openReadOnly, openShared, _timeStampGetter, isReconstructible);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
if (!isEmulatedOnHost && cacheExtraData)
|
||||
@ -201,8 +201,8 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
using SharedRef<ISaveDataExtraDataAccessor> extraDataAccessor =
|
||||
SharedRef<ISaveDataExtraDataAccessor>.CreateCopy(in saveDataFs);
|
||||
|
||||
rc = _saveExtraDataCacheManager.Register(in extraDataAccessor, spaceId, saveDataId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = _saveExtraDataCacheManager.Register(in extraDataAccessor, spaceId, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
}
|
||||
|
||||
@ -233,9 +233,9 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
Unsafe.SkipInit(out Array27<byte> saveDataMetaIdDirectoryNameBuffer);
|
||||
|
||||
using var saveDataMetaIdDirectoryName = new Path();
|
||||
Result rc = PathFunctions.SetUpFixedPathSaveMetaDir(ref saveDataMetaIdDirectoryName.Ref(),
|
||||
Result res = PathFunctions.SetUpFixedPathSaveMetaDir(ref saveDataMetaIdDirectoryName.Ref(),
|
||||
saveDataMetaIdDirectoryNameBuffer.Items, saveDataId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return OpenSaveDataDirectoryFileSystemImpl(ref outFileSystem, spaceId, in saveDataMetaIdDirectoryName).Ret();
|
||||
}
|
||||
@ -275,9 +275,9 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
|
||||
public Result FinishExtendSaveDataFileSystem(ulong saveDataId, SaveDataSpaceId spaceId)
|
||||
{
|
||||
Result rc = DeleteSaveDataMeta(saveDataId, spaceId, SaveDataMetaType.ExtensionContext);
|
||||
if (rc.IsFailure() && !ResultFs.PathNotFound.Includes(rc))
|
||||
return rc.Miss();
|
||||
Result res = DeleteSaveDataMeta(saveDataId, spaceId, SaveDataMetaType.ExtensionContext);
|
||||
if (res.IsFailure() && !ResultFs.PathNotFound.Includes(res))
|
||||
return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -286,9 +286,9 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
in Path saveDataRootPath)
|
||||
{
|
||||
using var saveDataFile = new UniqueRef<IFile>();
|
||||
Result rc = OpenSaveDataImageFile(ref saveDataFile.Ref(), spaceId, saveDataId, in saveDataRootPath);
|
||||
Result res = OpenSaveDataImageFile(ref saveDataFile.Ref(), spaceId, saveDataId, in saveDataRootPath);
|
||||
|
||||
if (rc.IsSuccess())
|
||||
if (res.IsSuccess())
|
||||
{
|
||||
saveDataFile.Get.SetSize(originalSize).IgnoreResult();
|
||||
}
|
||||
@ -308,18 +308,18 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
{
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
Result rc = OpenSaveDataMetaDirectoryFileSystem(ref fileSystem.Ref(), spaceId, saveDataId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = OpenSaveDataMetaDirectoryFileSystem(ref fileSystem.Ref(), spaceId, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Unsafe.SkipInit(out Array15<byte> saveDataMetaNameBuffer);
|
||||
|
||||
using var saveDataMetaName = new Path();
|
||||
rc = PathFunctions.SetUpFixedPathSaveMetaName(ref saveDataMetaName.Ref(), saveDataMetaNameBuffer.Items,
|
||||
res = PathFunctions.SetUpFixedPathSaveMetaName(ref saveDataMetaName.Ref(), saveDataMetaNameBuffer.Items,
|
||||
(uint)metaType);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = fileSystem.Get.CreateFile(in saveDataMetaName, metaFileSize);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fileSystem.Get.CreateFile(in saveDataMetaName, metaFileSize);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -328,18 +328,18 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
{
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
Result rc = OpenSaveDataMetaDirectoryFileSystem(ref fileSystem.Ref(), spaceId, saveDataId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = OpenSaveDataMetaDirectoryFileSystem(ref fileSystem.Ref(), spaceId, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Unsafe.SkipInit(out Array15<byte> saveDataMetaNameBuffer);
|
||||
|
||||
using var saveDataMetaName = new Path();
|
||||
rc = PathFunctions.SetUpFixedPathSaveMetaName(ref saveDataMetaName.Ref(), saveDataMetaNameBuffer.Items,
|
||||
res = PathFunctions.SetUpFixedPathSaveMetaName(ref saveDataMetaName.Ref(), saveDataMetaNameBuffer.Items,
|
||||
(uint)metaType);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = fileSystem.Get.DeleteFile(in saveDataMetaName);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fileSystem.Get.DeleteFile(in saveDataMetaName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -358,27 +358,27 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
using var saveDataMetaDirectoryName = new Path();
|
||||
Result rc = PathFunctions.SetUpFixedPath(ref saveDataMetaDirectoryName.Ref(), metaDirName);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = PathFunctions.SetUpFixedPath(ref saveDataMetaDirectoryName.Ref(), metaDirName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = OpenSaveDataDirectoryFileSystemImpl(ref fileSystem.Ref(), spaceId, in saveDataMetaDirectoryName,
|
||||
res = OpenSaveDataDirectoryFileSystemImpl(ref fileSystem.Ref(), spaceId, in saveDataMetaDirectoryName,
|
||||
createIfMissing: false);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var saveDataIdDirectoryName = new Path();
|
||||
PathFunctions.SetUpFixedPathSaveId(ref saveDataIdDirectoryName.Ref(), saveDataIdDirectoryNameBuffer.Items,
|
||||
saveDataId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Delete the save data's meta directory, ignoring the error if the directory is already gone
|
||||
rc = fileSystem.Get.DeleteDirectoryRecursively(in saveDataIdDirectoryName);
|
||||
res = fileSystem.Get.DeleteDirectoryRecursively(in saveDataIdDirectoryName);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
if (ResultFs.PathNotFound.Includes(rc))
|
||||
if (ResultFs.PathNotFound.Includes(res))
|
||||
return Result.Success;
|
||||
|
||||
return rc.Miss();
|
||||
return res.Miss();
|
||||
}
|
||||
|
||||
return Result.Success;
|
||||
@ -389,18 +389,18 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
{
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
Result rc = OpenSaveDataMetaDirectoryFileSystem(ref fileSystem.Ref(), spaceId, saveDataId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = OpenSaveDataMetaDirectoryFileSystem(ref fileSystem.Ref(), spaceId, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Unsafe.SkipInit(out Array15<byte> saveDataMetaNameBuffer);
|
||||
|
||||
using var saveDataMetaName = new Path();
|
||||
rc = PathFunctions.SetUpFixedPathSaveMetaName(ref saveDataMetaName.Ref(), saveDataMetaNameBuffer.Items,
|
||||
res = PathFunctions.SetUpFixedPathSaveMetaName(ref saveDataMetaName.Ref(), saveDataMetaNameBuffer.Items,
|
||||
(uint)metaType);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = fileSystem.Get.OpenFile(ref outMetaFile, in saveDataMetaName, OpenMode.ReadWrite);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fileSystem.Get.OpenFile(ref outMetaFile, in saveDataMetaName, OpenMode.ReadWrite);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -418,13 +418,13 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
|
||||
using var fileSystem = new SharedRef<IFileSystem>();
|
||||
|
||||
Result rc = OpenSaveDataDirectoryFileSystem(ref fileSystem.Ref(), creationInfo.SpaceId, in saveDataRootPath,
|
||||
Result res = OpenSaveDataDirectoryFileSystem(ref fileSystem.Ref(), creationInfo.SpaceId, in saveDataRootPath,
|
||||
allowEmulatedSave: false);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var saveImageName = new Path();
|
||||
rc = PathFunctions.SetUpFixedPathSaveId(ref saveImageName.Ref(), saveImageNameBuffer.Items, saveDataId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = PathFunctions.SetUpFixedPathSaveId(ref saveImageName.Ref(), saveImageNameBuffer.Items, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
bool isPseudoSaveFs = _config.IsPseudoSaveData();
|
||||
bool isCreationSuccessful = false;
|
||||
@ -433,8 +433,8 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
{
|
||||
if (isPseudoSaveFs)
|
||||
{
|
||||
rc = FsSystem.Utility.EnsureDirectory(fileSystem.Get, in saveImageName);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = FsSystem.Utility.EnsureDirectory(fileSystem.Get, in saveImageName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -445,8 +445,8 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
extraData.Attribute = creationInfo.Attribute;
|
||||
extraData.OwnerId = ownerId;
|
||||
|
||||
rc = GetSaveDataCommitTimeStamp(out extraData.TimeStamp);
|
||||
if (rc.IsFailure())
|
||||
res = GetSaveDataCommitTimeStamp(out extraData.TimeStamp);
|
||||
if (res.IsFailure())
|
||||
extraData.TimeStamp = 0;
|
||||
|
||||
extraData.CommitId = 0;
|
||||
@ -457,9 +457,9 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
extraData.JournalSize = journalSize;
|
||||
extraData.FormatType = creationInfo.FormatType;
|
||||
|
||||
rc = WriteSaveDataFileSystemExtraData(spaceId, saveDataId, in extraData, in saveDataRootPath,
|
||||
res = WriteSaveDataFileSystemExtraData(spaceId, saveDataId, in extraData, in saveDataRootPath,
|
||||
creationInfo.Attribute.Type, updateTimeStamp: true);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
isCreationSuccessful = true;
|
||||
return Result.Success;
|
||||
@ -491,22 +491,22 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
_saveFileSystemCacheManager.Unregister(spaceId, saveDataId);
|
||||
|
||||
// Open the directory containing the save data
|
||||
Result rc = OpenSaveDataDirectoryFileSystem(ref fileSystem.Ref(), spaceId, in saveDataRootPath, false);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = OpenSaveDataDirectoryFileSystem(ref fileSystem.Ref(), spaceId, in saveDataRootPath, false);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var saveImageName = new Path();
|
||||
rc = PathFunctions.SetUpFixedPathSaveId(ref saveImageName.Ref(), saveImageNameBuffer.Items, saveDataId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = PathFunctions.SetUpFixedPathSaveId(ref saveImageName.Ref(), saveImageNameBuffer.Items, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Check if the save data is a file or a directory
|
||||
rc = fileSystem.Get.GetEntryType(out DirectoryEntryType entryType, in saveImageName);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fileSystem.Get.GetEntryType(out DirectoryEntryType entryType, in saveImageName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Delete the save data, wiping the file if needed
|
||||
if (entryType == DirectoryEntryType.Directory)
|
||||
{
|
||||
rc = fileSystem.Get.DeleteDirectoryRecursively(in saveImageName);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fileSystem.Get.DeleteDirectoryRecursively(in saveImageName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -518,10 +518,10 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
if (GetDebugConfigurationService().Get(DebugOptionKey.SaveDataEncryption, 0) != 0)
|
||||
{
|
||||
using SharedRef<IFileSystem> tempFileSystem = SharedRef<IFileSystem>.CreateCopy(in fileSystem);
|
||||
rc = _config.SaveFsCreator.IsDataEncrypted(out isDataEncrypted, ref tempFileSystem.Ref(),
|
||||
res = _config.SaveFsCreator.IsDataEncrypted(out isDataEncrypted, ref tempFileSystem.Ref(),
|
||||
saveDataId, _config.BufferManager, IsDeviceUniqueMac(spaceId), isReconstructible: false);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
isDataEncrypted = false;
|
||||
}
|
||||
|
||||
@ -535,8 +535,8 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
}
|
||||
}
|
||||
|
||||
rc = fileSystem.Get.DeleteFile(in saveImageName);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = fileSystem.Get.DeleteFile(in saveImageName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
return Result.Success;
|
||||
@ -561,26 +561,26 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
using var extraDataAccessor = new SharedRef<ISaveDataExtraDataAccessor>();
|
||||
|
||||
// Try to grab an extra data accessor for the requested save from the cache.
|
||||
Result rc = _saveExtraDataCacheManager.GetCache(ref extraDataAccessor.Ref(), spaceId, saveDataId);
|
||||
Result res = _saveExtraDataCacheManager.GetCache(ref extraDataAccessor.Ref(), spaceId, saveDataId);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
// Try to open the extra data accessor if it's not in the cache.
|
||||
|
||||
// We won't actually use the returned save data FS.
|
||||
// Opening the FS should cache an extra data accessor for it.
|
||||
rc = OpenSaveDataFileSystem(ref unusedSaveDataFs.Ref(), spaceId, saveDataId, saveDataRootPath,
|
||||
res = OpenSaveDataFileSystem(ref unusedSaveDataFs.Ref(), spaceId, saveDataId, saveDataRootPath,
|
||||
openReadOnly: true, type, cacheExtraData: true);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Try to grab an accessor from the cache again.
|
||||
rc = _saveExtraDataCacheManager.GetCache(ref extraDataAccessor.Ref(), spaceId, saveDataId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = _saveExtraDataCacheManager.GetCache(ref extraDataAccessor.Ref(), spaceId, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
// We successfully got an extra data accessor. Read the extra data from it.
|
||||
rc = extraDataAccessor.Get.ReadExtraData(out extraData);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = extraDataAccessor.Get.ReadExtraData(out extraData);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -601,30 +601,30 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
using var extraDataAccessor = new SharedRef<ISaveDataExtraDataAccessor>();
|
||||
|
||||
// Try to grab an extra data accessor for the requested save from the cache.
|
||||
Result rc = _saveExtraDataCacheManager.GetCache(ref extraDataAccessor.Ref(), spaceId, saveDataId);
|
||||
Result res = _saveExtraDataCacheManager.GetCache(ref extraDataAccessor.Ref(), spaceId, saveDataId);
|
||||
|
||||
if (rc.IsFailure())
|
||||
if (res.IsFailure())
|
||||
{
|
||||
// No accessor was found in the cache. Try to open one.
|
||||
|
||||
// We won't actually use the returned save data FS.
|
||||
// Opening the FS should cache an extra data accessor for it.
|
||||
rc = OpenSaveDataFileSystem(ref unusedSaveDataFs.Ref(), spaceId, saveDataId, saveDataRootPath,
|
||||
res = OpenSaveDataFileSystem(ref unusedSaveDataFs.Ref(), spaceId, saveDataId, saveDataRootPath,
|
||||
openReadOnly: false, type, cacheExtraData: true);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
// Try to grab an accessor from the cache again.
|
||||
rc = _saveExtraDataCacheManager.GetCache(ref extraDataAccessor.Ref(), spaceId, saveDataId);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = _saveExtraDataCacheManager.GetCache(ref extraDataAccessor.Ref(), spaceId, saveDataId);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
// We should have a valid accessor if we've reached this point.
|
||||
// Write and commit the extra data.
|
||||
rc = extraDataAccessor.Get.WriteExtraData(in extraData);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = extraDataAccessor.Get.WriteExtraData(in extraData);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = extraDataAccessor.Get.CommitExtraData(updateTimeStamp);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = extraDataAccessor.Get.CommitExtraData(updateTimeStamp);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -656,7 +656,7 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
public Result OpenSaveDataDirectoryFileSystem(ref SharedRef<IFileSystem> outFileSystem,
|
||||
SaveDataSpaceId spaceId, in Path saveDataRootPath, bool allowEmulatedSave)
|
||||
{
|
||||
Result rc;
|
||||
Result res;
|
||||
|
||||
if (allowEmulatedSave && IsAllowedDirectorySaveData(spaceId, in saveDataRootPath))
|
||||
{
|
||||
@ -665,28 +665,28 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
using (var tmFileSystem = new SharedRef<IFileSystem>())
|
||||
{
|
||||
// Ensure the target save data directory exists
|
||||
rc = _config.TargetManagerFsCreator.Create(ref tmFileSystem.Ref(), in saveDataRootPath,
|
||||
res = _config.TargetManagerFsCreator.Create(ref tmFileSystem.Ref(), in saveDataRootPath,
|
||||
openCaseSensitive: false, ensureRootPathExists: true,
|
||||
ResultFs.SaveDataRootPathUnavailable.Value);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
using var path = new Path();
|
||||
rc = path.Initialize(in saveDataRootPath);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = path.Initialize(in saveDataRootPath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _config.TargetManagerFsCreator.NormalizeCaseOfPath(out bool isTargetFsCaseSensitive, ref path.Ref());
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = _config.TargetManagerFsCreator.NormalizeCaseOfPath(out bool isTargetFsCaseSensitive, ref path.Ref());
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _config.TargetManagerFsCreator.Create(ref outFileSystem, in path, isTargetFsCaseSensitive,
|
||||
res = _config.TargetManagerFsCreator.Create(ref outFileSystem, in path, isTargetFsCaseSensitive,
|
||||
ensureRootPathExists: false, ResultFs.SaveDataRootPathUnavailable.Value);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
else
|
||||
{
|
||||
rc = _config.LocalFsCreator.Create(ref outFileSystem, in saveDataRootPath, openCaseSensitive: true,
|
||||
res = _config.LocalFsCreator.Create(ref outFileSystem, in saveDataRootPath, openCaseSensitive: true,
|
||||
ensureRootPathExists: true, ResultFs.SaveDataRootPathUnavailable.Value);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
}
|
||||
|
||||
return Result.Success;
|
||||
@ -704,11 +704,11 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
saveDirName = new[] { (byte)'/', (byte)'s', (byte)'a', (byte)'v', (byte)'e' }; // /save
|
||||
}
|
||||
|
||||
rc = PathFunctions.SetUpFixedPath(ref saveDataAreaDirectoryName.Ref(), saveDirName);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = PathFunctions.SetUpFixedPath(ref saveDataAreaDirectoryName.Ref(), saveDirName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = OpenSaveDataDirectoryFileSystemImpl(ref outFileSystem, spaceId, in saveDataAreaDirectoryName);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = OpenSaveDataDirectoryFileSystemImpl(ref outFileSystem, spaceId, in saveDataAreaDirectoryName);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@ -728,13 +728,13 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
{
|
||||
case SaveDataSpaceId.System:
|
||||
{
|
||||
Result rc = _config.BaseFsService.OpenBisFileSystem(ref baseFileSystem.Ref(), BisPartitionId.System,
|
||||
Result res = _config.BaseFsService.OpenBisFileSystem(ref baseFileSystem.Ref(), BisPartitionId.System,
|
||||
caseSensitive: true);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = Utility.WrapSubDirectory(ref outFileSystem, ref baseFileSystem.Ref(), in directoryPath,
|
||||
res = Utility.WrapSubDirectory(ref outFileSystem, ref baseFileSystem.Ref(), in directoryPath,
|
||||
createIfMissing);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
break;
|
||||
}
|
||||
@ -742,13 +742,13 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
case SaveDataSpaceId.User:
|
||||
case SaveDataSpaceId.Temporary:
|
||||
{
|
||||
Result rc = _config.BaseFsService.OpenBisFileSystem(ref baseFileSystem.Ref(), BisPartitionId.User,
|
||||
Result res = _config.BaseFsService.OpenBisFileSystem(ref baseFileSystem.Ref(), BisPartitionId.User,
|
||||
caseSensitive: true);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = Utility.WrapSubDirectory(ref outFileSystem, ref baseFileSystem.Ref(), in directoryPath,
|
||||
res = Utility.WrapSubDirectory(ref outFileSystem, ref baseFileSystem.Ref(), in directoryPath,
|
||||
createIfMissing);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
break;
|
||||
}
|
||||
@ -756,55 +756,55 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
case SaveDataSpaceId.SdSystem:
|
||||
case SaveDataSpaceId.SdUser:
|
||||
{
|
||||
Result rc = _config.BaseFsService.OpenSdCardProxyFileSystem(ref baseFileSystem.Ref(),
|
||||
Result res = _config.BaseFsService.OpenSdCardProxyFileSystem(ref baseFileSystem.Ref(),
|
||||
openCaseSensitive: true);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
Unsafe.SkipInit(out Array64<byte> pathParentBuffer);
|
||||
|
||||
using var pathParent = new Path();
|
||||
rc = PathFunctions.SetUpFixedPathSingleEntry(ref pathParent.Ref(), pathParentBuffer.Items,
|
||||
res = PathFunctions.SetUpFixedPathSingleEntry(ref pathParent.Ref(), pathParentBuffer.Items,
|
||||
CommonPaths.SdCardNintendoRootDirectoryName);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using var pathSdRoot = new Path();
|
||||
rc = pathSdRoot.Combine(in pathParent, in directoryPath);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = pathSdRoot.Combine(in pathParent, in directoryPath);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
using SharedRef<IFileSystem> tempFileSystem = SharedRef<IFileSystem>.CreateMove(ref baseFileSystem.Ref());
|
||||
|
||||
rc = Utility.WrapSubDirectory(ref baseFileSystem.Ref(), ref tempFileSystem.Ref(), in pathSdRoot, createIfMissing);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
res = Utility.WrapSubDirectory(ref baseFileSystem.Ref(), ref tempFileSystem.Ref(), in pathSdRoot, createIfMissing);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = _config.EncryptedFsCreator.Create(ref outFileSystem, ref baseFileSystem.Ref(),
|
||||
res = _config.EncryptedFsCreator.Create(ref outFileSystem, ref baseFileSystem.Ref(),
|
||||
IEncryptedFileSystemCreator.KeyId.Save, in _encryptionSeed);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SaveDataSpaceId.ProperSystem:
|
||||
{
|
||||
Result rc = _config.BaseFsService.OpenBisFileSystem(ref baseFileSystem.Ref(),
|
||||
Result res = _config.BaseFsService.OpenBisFileSystem(ref baseFileSystem.Ref(),
|
||||
BisPartitionId.SystemProperPartition, caseSensitive: true);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = Utility.WrapSubDirectory(ref outFileSystem, ref baseFileSystem.Ref(), in directoryPath,
|
||||
res = Utility.WrapSubDirectory(ref outFileSystem, ref baseFileSystem.Ref(), in directoryPath,
|
||||
createIfMissing);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case SaveDataSpaceId.SafeMode:
|
||||
{
|
||||
Result rc = _config.BaseFsService.OpenBisFileSystem(ref baseFileSystem.Ref(), BisPartitionId.SafeMode,
|
||||
Result res = _config.BaseFsService.OpenBisFileSystem(ref baseFileSystem.Ref(), BisPartitionId.SafeMode,
|
||||
caseSensitive: true);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
rc = Utility.WrapSubDirectory(ref outFileSystem, ref baseFileSystem.Ref(), in directoryPath,
|
||||
res = Utility.WrapSubDirectory(ref outFileSystem, ref baseFileSystem.Ref(), in directoryPath,
|
||||
createIfMissing);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
break;
|
||||
}
|
||||
@ -890,8 +890,8 @@ public class SaveDataFileSystemServiceImpl : IDisposable
|
||||
UnsafeHelpers.SkipParamInit(out count);
|
||||
|
||||
using var accessor = new UniqueRef<SaveDataIndexerAccessor>();
|
||||
Result rc = OpenSaveDataIndexerAccessor(ref accessor.Ref(), out bool _, SaveDataSpaceId.User);
|
||||
if (rc.IsFailure()) return rc.Miss();
|
||||
Result res = OpenSaveDataIndexerAccessor(ref accessor.Ref(), out bool _, SaveDataSpaceId.User);
|
||||
if (res.IsFailure()) return res.Miss();
|
||||
|
||||
count = accessor.Get.GetInterface().GetIndexCount();
|
||||
return Result.Success;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user