Move IFileSystem etc. into fsa namespace

This commit is contained in:
Alex Barney 2020-06-09 22:55:59 -07:00
parent ef1481b04c
commit 106c36492b
136 changed files with 133 additions and 727 deletions

View File

@ -1,4 +1,5 @@
using System;
using LibHac.Fs.Fsa;
namespace LibHac.Fs.Accessors
{

View File

@ -1,4 +1,5 @@
using System;
using LibHac.Fs.Fsa;
namespace LibHac.Fs.Accessors
{

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using LibHac.Common;
using LibHac.Fs.Fsa;
namespace LibHac.Fs.Accessors
{

View File

@ -1,6 +1,7 @@
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using LibHac.Fs.Fsa;
namespace LibHac.Fs
{

View File

@ -1,4 +1,5 @@
using LibHac.Common;
using LibHac.Fs.Fsa;
namespace LibHac.Fs
{

View File

@ -1,6 +1,7 @@
using System;
using LibHac.Common;
using LibHac.Fs.Accessors;
using LibHac.Fs.Fsa;
namespace LibHac.Fs
{

View File

@ -3,6 +3,7 @@ using System.Diagnostics;
using System.Runtime.InteropServices;
using LibHac.Common;
using LibHac.Fs.Accessors;
using LibHac.Fs.Fsa;
using LibHac.FsService;
using LibHac.FsSystem;

View File

@ -3,6 +3,7 @@ using System.Buffers;
using System.Collections.Generic;
using LibHac.Common;
using LibHac.Fs.Accessors;
using LibHac.Fs.Fsa;
using LibHac.FsSystem;
namespace LibHac.Fs

View File

@ -1,4 +1,5 @@
using System;
using LibHac.Fs.Fsa;
namespace LibHac.Fs
{

View File

@ -1,6 +1,6 @@
using LibHac.Common;
namespace LibHac.Fs
namespace LibHac.Fs.Fsa
{
// ReSharper disable once InconsistentNaming
public abstract class IAttributeFileSystem : IFileSystem

View File

@ -1,6 +1,6 @@
using System;
namespace LibHac.Fs
namespace LibHac.Fs.Fsa
{
// ReSharper disable once InconsistentNaming
/// <summary>

View File

@ -1,55 +0,0 @@
using System;
namespace LibHac.Fs.Fsa
{
// ReSharper disable once InconsistentNaming
/// <summary>
/// Provides an interface for enumerating the child entries of a directory.
/// </summary>
public abstract class IDirectory2 : IDisposable
{
/// <summary>
/// Retrieves the next entries that this directory contains. Does not search subdirectories.
/// </summary>
/// <param name="entriesRead">The number of <see cref="DirectoryEntry"/>s that
/// were read into <paramref name="entryBuffer"/>.</param>
/// <param name="entryBuffer">The buffer the entries will be read into.</param>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
/// <remarks>With each call of <see cref="Read"/>, the <see cref="IDirectory2"/> object will
/// continue to iterate through all the entries it contains.
/// Each call will attempt to read as many entries as the buffer can contain.
/// Once all the entries have been read, all subsequent calls to <see cref="Read"/> will
/// read 0 entries into the buffer.</remarks>
public Result Read(out long entriesRead, Span<DirectoryEntry> entryBuffer)
{
if (entryBuffer.IsEmpty)
{
entriesRead = 0;
return Result.Success;
}
return DoRead(out entriesRead, entryBuffer);
}
/// <summary>
/// Retrieves the number of file system entries that this directory contains. Does not search subdirectories.
/// </summary>
/// <param name="entryCount">The number of child entries the directory contains.</param>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
public Result GetEntryCount(out long entryCount)
{
return DoGetEntryCount(out entryCount);
}
protected abstract Result DoRead(out long entriesRead, Span<DirectoryEntry> entryBuffer);
protected abstract Result DoGetEntryCount(out long entryCount);
protected virtual void Dispose(bool disposing) { }
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
}
}

View File

@ -1,7 +1,7 @@
using System;
using LibHac.Diag;
namespace LibHac.Fs
namespace LibHac.Fs.Fsa
{
// ReSharper disable once InconsistentNaming
/// <summary>

View File

@ -1,248 +0,0 @@
using System;
using LibHac.Diag;
namespace LibHac.Fs.Fsa
{
// ReSharper disable once InconsistentNaming
/// <summary>
/// Provides an interface for reading and writing a sequence of bytes.
/// </summary>
/// <remarks><see cref="IFile"/> is similar to <see cref="IStorage"/>, and has a few main differences:
///
/// - <see cref="IFile"/> allows an <see cref="OpenMode"/> to be set that controls read, write
/// and append permissions for the file.
///
/// - If the <see cref="IFile"/> cannot read or write as many bytes as requested, it will read
/// or write as many bytes as it can and return that number of bytes to the caller.
///
/// - If <see cref="Write"/> is called on an offset past the end of the <see cref="IFile"/>,
/// the <see cref="OpenMode.AllowAppend"/> mode is set and the file supports expansion,
/// the file will be expanded so that it is large enough to contain the written data.</remarks>
public abstract class IFile2 : IDisposable
{
/// <summary>
/// Reads a sequence of bytes from the current <see cref="IFile"/>.
/// </summary>
/// <param name="bytesRead">If the operation returns successfully, The total number of bytes read into
/// the buffer. This can be less than the size of the buffer if the IFile is too short to fulfill the request.</param>
/// <param name="offset">The offset in the <see cref="IFile"/> at which to begin reading.</param>
/// <param name="destination">The buffer where the read bytes will be stored.
/// The number of bytes read will be no larger than the length of the buffer.</param>
/// <param name="option">Options for reading from the <see cref="IFile"/>.</param>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
public Result Read(out long bytesRead, long offset, Span<byte> destination, in ReadOption option)
{
if (destination.IsEmpty)
{
bytesRead = 0;
return Result.Success;
}
if (offset < 0)
{
bytesRead = 0;
return ResultFs.OutOfRange.Log();
}
if (long.MaxValue - offset < destination.Length)
{
bytesRead = 0;
return ResultFs.OutOfRange.Log();
}
return DoRead(out bytesRead, offset, destination, in option);
}
/// <summary>
/// Reads a sequence of bytes from the current <see cref="IFile"/> with no <see cref="ReadOption"/>s.
/// </summary>
/// <param name="bytesRead">If the operation returns successfully, The total number of bytes read into
/// the buffer. This can be less than the size of the buffer if the IFile is too short to fulfill the request.</param>
/// <param name="offset">The offset in the <see cref="IFile"/> at which to begin reading.</param>
/// <param name="destination">The buffer where the read bytes will be stored.
/// The number of bytes read will be no larger than the length of the buffer.</param>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
public Result Read(out long bytesRead, long offset, Span<byte> destination)
{
return Read(out bytesRead, offset, destination, ReadOption.None);
}
/// <summary>
/// Writes a sequence of bytes to the current <see cref="IFile"/>.
/// </summary>
/// <param name="offset">The offset in the <see cref="IStorage"/> at which to begin writing.</param>
/// <param name="source">The buffer containing the bytes to be written.</param>
/// <param name="option">Options for writing to the <see cref="IFile"/>.</param>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
public Result Write(long offset, ReadOnlySpan<byte> source, in WriteOption option)
{
if (source.IsEmpty)
{
if (option.HasFlushFlag())
{
Result rc = Flush();
if (rc.IsFailure()) return rc;
}
return Result.Success;
}
if (offset < 0)
return ResultFs.OutOfRange.Log();
if (long.MaxValue - offset < source.Length)
return ResultFs.OutOfRange.Log();
return DoWrite(offset, source, in option);
}
/// <summary>
/// Causes any buffered data to be written to the underlying device.
/// </summary>
public Result Flush()
{
return DoFlush();
}
/// <summary>
/// Sets the size of the file in bytes.
/// </summary>
/// <param name="size">The desired size of the file in bytes.</param>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
public Result SetSize(long size)
{
if (size < 0)
return ResultFs.OutOfRange.Log();
return DoSetSize(size);
}
/// <summary>
/// Gets the number of bytes in the file.
/// </summary>
/// <param name="size">If the operation returns successfully, the length of the file in bytes.</param>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
public Result GetSize(out long size)
{
return DoGetSize(out size);
}
/// <summary>
/// Performs various operations on the file. Used to extend the functionality of the <see cref="IFile"/> interface.
/// </summary>
/// <param name="outBuffer">A buffer that will contain the response from the operation.</param>
/// <param name="operationId">The operation to be performed.</param>
/// <param name="offset">The offset of the range to operate on.</param>
/// <param name="size">The size of the range to operate on.</param>
/// <param name="inBuffer">An input buffer. Size may vary depending on the operation performed.</param>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
public Result OperateRange(Span<byte> outBuffer, OperationId operationId, long offset, long size,
ReadOnlySpan<byte> inBuffer)
{
return DoOperateRange(outBuffer, operationId, offset, size, inBuffer);
}
/// <summary>
/// Performs various operations on the file. Used to extend the functionality of the <see cref="IFile"/> interface.
/// </summary>
/// <param name="operationId">The operation to be performed.</param>
/// <param name="offset">The offset of the range to operate on.</param>
/// <param name="size">The size of the range to operate on.</param>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
public Result OperateRange(OperationId operationId, long offset, long size)
{
return DoOperateRange(Span<byte>.Empty, operationId, offset, size, ReadOnlySpan<byte>.Empty);
}
protected Result DryRead(out long readableBytes, long offset, long size, in ReadOption option,
OpenMode openMode)
{
// Check that we can read.
if (!openMode.HasFlag(OpenMode.Read))
{
readableBytes = default;
return ResultFs.InvalidOpenModeForRead.Log();
}
// Get the file size, and validate our offset.
Result rc = GetSize(out long fileSize);
if (rc.IsFailure())
{
readableBytes = default;
return rc;
}
if (offset > fileSize)
{
readableBytes = default;
return ResultFs.OutOfRange.Log();
}
readableBytes = Math.Min(fileSize - offset, size);
return Result.Success;
}
protected Result DrySetSize(long size, OpenMode openMode)
{
// Check that we can write.
if (!openMode.HasFlag(OpenMode.Write))
return ResultFs.InvalidOpenModeForWrite.Log();
Assert.AssertTrue(size >= 0);
return Result.Success;
}
protected Result DryWrite(out bool needsAppend, long offset, long size, in WriteOption option,
OpenMode openMode)
{
// Check that we can write.
if (!openMode.HasFlag(OpenMode.Write))
{
needsAppend = default;
return ResultFs.InvalidOpenModeForWrite.Log();
}
// Get the file size.
Result rc = GetSize(out long fileSize);
if (rc.IsFailure())
{
needsAppend = default;
return rc;
}
if (fileSize < offset + size)
{
if (!openMode.HasFlag(OpenMode.AllowAppend))
{
needsAppend = default;
return ResultFs.FileExtensionWithoutOpenModeAllowAppend.Log();
}
needsAppend = true;
}
else
{
needsAppend = false;
}
return Result.Success;
}
protected abstract Result DoRead(out long bytesRead, long offset, Span<byte> destination, in ReadOption option);
protected abstract Result DoWrite(long offset, ReadOnlySpan<byte> source, in WriteOption option);
protected abstract Result DoFlush();
protected abstract Result DoSetSize(long size);
protected abstract Result DoGetSize(out long size);
protected abstract Result DoOperateRange(Span<byte> outBuffer, OperationId operationId, long offset, long size,
ReadOnlySpan<byte> inBuffer);
protected virtual void Dispose(bool disposing) { }
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
}
}

View File

@ -2,7 +2,7 @@
using LibHac.Common;
using LibHac.FsSystem;
namespace LibHac.Fs
namespace LibHac.Fs.Fsa
{
// ReSharper disable once InconsistentNaming
/// <summary>

View File

@ -1,408 +0,0 @@
using System;
using LibHac.Common;
namespace LibHac.Fs.Fsa
{
// ReSharper disable once InconsistentNaming
/// <summary>
/// Provides an interface for accessing a file system. <c>/</c> is used as the path delimiter.
/// </summary>
public abstract class IFileSystem2 : IDisposable
{
/// <summary>
/// Creates or overwrites a file at the specified path.
/// </summary>
/// <param name="path">The full path of the file to create.</param>
/// <param name="size">The initial size of the created file.</param>
/// <param name="option">Flags to control how the file is created.
/// Should usually be <see cref="CreateFileOptions.None"/></param>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
/// <remarks>
/// The following <see cref="Result"/> codes may be returned under certain conditions:
///
/// The parent directory of the specified path does not exist: <see cref="ResultFs.PathNotFound"/>
/// Specified path already exists as either a file or directory: <see cref="ResultFs.PathAlreadyExists"/>
/// Insufficient free space to create the file: <see cref="ResultFs.InsufficientFreeSpace"/>
/// </remarks>
public Result CreateFile(U8Span path, long size, CreateFileOptions option)
{
if (path.IsNull())
return ResultFs.NullptrArgument.Log();
if (size < 0)
return ResultFs.OutOfRange.Log();
return DoCreateFile(path, size, option);
}
/// <summary>
/// Deletes the specified file.
/// </summary>
/// <param name="path">The full path of the file to delete.</param>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
/// <remarks>
/// The following <see cref="Result"/> codes may be returned under certain conditions:
///
/// The specified path does not exist or is a directory: <see cref="ResultFs.PathNotFound"/>
/// </remarks>
public Result DeleteFile(U8Span path)
{
if (path.IsNull())
return ResultFs.NullptrArgument.Log();
return DoDeleteFile(path);
}
/// <summary>
/// Creates all directories and subdirectories in the specified path unless they already exist.
/// </summary>
/// <param name="path">The full path of the directory to create.</param>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
/// <remarks>
/// The following <see cref="Result"/> codes may be returned under certain conditions:
///
/// The parent directory of the specified path does not exist: <see cref="ResultFs.PathNotFound"/>
/// Specified path already exists as either a file or directory: <see cref="ResultFs.PathAlreadyExists"/>
/// Insufficient free space to create the directory: <see cref="ResultFs.InsufficientFreeSpace"/>
/// </remarks>
public Result CreateDirectory(U8Span path)
{
if (path.IsNull())
return ResultFs.NullptrArgument.Log();
return DoCreateDirectory(path);
}
/// <summary>
/// Deletes the specified directory.
/// </summary>
/// <param name="path">The full path of the directory to delete.</param>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
/// <remarks>
/// The following <see cref="Result"/> codes may be returned under certain conditions:
///
/// The specified path does not exist or is a file: <see cref="ResultFs.PathNotFound"/>
/// The specified directory is not empty: <see cref="ResultFs.DirectoryNotEmpty"/>
/// </remarks>
public Result DeleteDirectory(U8Span path)
{
if (path.IsNull())
return ResultFs.NullptrArgument.Log();
return DoDeleteDirectory(path);
}
/// <summary>
/// Deletes the specified directory and any subdirectories and files in the directory.
/// </summary>
/// <param name="path">The full path of the directory to delete.</param>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
/// <remarks>
/// The following <see cref="Result"/> codes may be returned under certain conditions:
///
/// The specified path does not exist or is a file: <see cref="ResultFs.PathNotFound"/>
/// </remarks>
public Result DeleteDirectoryRecursively(U8Span path)
{
if (path.IsNull())
return ResultFs.NullptrArgument.Log();
return DoDeleteDirectoryRecursively(path);
}
/// <summary>
/// Deletes any subdirectories and files in the specified directory.
/// </summary>
/// <param name="path">The full path of the directory to clean.</param>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
/// <remarks>
/// The following <see cref="Result"/> codes may be returned under certain conditions:
///
/// The specified path does not exist or is a file: <see cref="ResultFs.PathNotFound"/>
/// </remarks>
public Result CleanDirectoryRecursively(U8Span path)
{
if (path.IsNull())
return ResultFs.NullptrArgument.Log();
return DoCleanDirectoryRecursively(path);
}
/// <summary>
/// Renames or moves a file to a new location.
/// </summary>
/// <param name="oldPath">The full path of the file to rename.</param>
/// <param name="newPath">The new full path of the file.</param>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
/// <remarks>
/// If <paramref name="oldPath"/> and <paramref name="newPath"/> are the same, this function does nothing and returns successfully.
/// The following <see cref="Result"/> codes may be returned under certain conditions:
///
/// <paramref name="oldPath"/> does not exist or is a directory: <see cref="ResultFs.PathNotFound"/>
/// <paramref name="newPath"/>'s parent directory does not exist: <see cref="ResultFs.PathNotFound"/>
/// <paramref name="newPath"/> already exists as either a file or directory: <see cref="ResultFs.PathAlreadyExists"/>
/// </remarks>
public Result RenameFile(U8Span oldPath, U8Span newPath)
{
if (oldPath.IsNull())
return ResultFs.NullptrArgument.Log();
if (newPath.IsNull())
return ResultFs.NullptrArgument.Log();
return DoRenameFile(oldPath, newPath);
}
/// <summary>
/// Renames or moves a directory to a new location.
/// </summary>
/// <param name="oldPath">The full path of the directory to rename.</param>
/// <param name="newPath">The new full path of the directory.</param>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
/// <remarks>
/// If <paramref name="oldPath"/> and <paramref name="newPath"/> are the same, this function does nothing and returns <see cref="Result.Success"/>.
/// The following <see cref="Result"/> codes may be returned under certain conditions:
///
/// <paramref name="oldPath"/> does not exist or is a file: <see cref="ResultFs.PathNotFound"/>
/// <paramref name="newPath"/>'s parent directory does not exist: <see cref="ResultFs.PathNotFound"/>
/// <paramref name="newPath"/> already exists as either a file or directory: <see cref="ResultFs.PathAlreadyExists"/>
/// Either <paramref name="oldPath"/> or <paramref name="newPath"/> is a subpath of the other: <see cref="ResultFs.DestinationIsSubPathOfSource"/>
/// </remarks>
public Result RenameDirectory(U8Span oldPath, U8Span newPath)
{
if (oldPath.IsNull())
return ResultFs.NullptrArgument.Log();
if (newPath.IsNull())
return ResultFs.NullptrArgument.Log();
return DoRenameDirectory(oldPath, newPath);
}
/// <summary>
/// Determines whether the specified path is a file or directory, or does not exist.
/// </summary>
/// <param name="entryType">If the operation returns successfully, the <see cref="DirectoryEntryType"/> of the file.</param>
/// <param name="path">The full path to check.</param>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
public Result GetEntryType(out DirectoryEntryType entryType, U8Span path)
{
if (path.IsNull())
{
entryType = default;
return ResultFs.NullptrArgument.Log();
}
return DoGetEntryType(out entryType, path);
}
/// <summary>
/// Gets the amount of available free space on a drive, in bytes.
/// </summary>
/// <param name="freeSpace">If the operation returns successfully, the amount of free space available on the drive, in bytes.</param>
/// <param name="path">The path of the drive to query. Unused in almost all cases.</param>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
public Result GetFreeSpaceSize(out long freeSpace, U8Span path)
{
if (path.IsNull())
{
freeSpace = default;
return ResultFs.NullptrArgument.Log();
}
return DoGetFreeSpaceSize(out freeSpace, path);
}
/// <summary>
/// Gets the total size of storage space on a drive, in bytes.
/// </summary>
/// <param name="totalSpace">If the operation returns successfully, the total size of the drive, in bytes.</param>
/// <param name="path">The path of the drive to query. Unused in almost all cases.</param>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
public Result GetTotalSpaceSize(out long totalSpace, U8Span path)
{
if (path.IsNull())
{
totalSpace = default;
return ResultFs.NullptrArgument.Log();
}
return DoGetTotalSpaceSize(out totalSpace, path);
}
/// <summary>
/// Opens an <see cref="IFile"/> instance for the specified path.
/// </summary>
/// <param name="file">If the operation returns successfully,
/// An <see cref="IFile"/> instance for the specified path.</param>
/// <param name="path">The full path of the file to open.</param>
/// <param name="mode">Specifies the access permissions of the created <see cref="IFile"/>.</param>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
/// <remarks>
/// The following <see cref="Result"/> codes may be returned under certain conditions:
///
/// The specified path does not exist or is a directory: <see cref="ResultFs.PathNotFound"/>
/// </remarks>
public Result OpenFile(out IFile2 file, U8Span path, OpenMode mode)
{
if (path.IsNull())
{
file = default;
return ResultFs.NullptrArgument.Log();
}
if ((mode & OpenMode.ReadWrite) == 0)
{
file = default;
return ResultFs.InvalidOpenMode.Log();
}
if ((mode & ~OpenMode.All) != 0)
{
file = default;
return ResultFs.InvalidOpenMode.Log();
}
return DoOpenFile(out file, path, mode);
}
/// <summary>
/// Creates an <see cref="IDirectory"/> instance for enumerating the specified directory.
/// </summary>
/// <param name="directory">If the operation returns successfully,
/// An <see cref="IDirectory"/> instance for the specified directory.</param>
/// <param name="path">The directory's full path.</param>
/// <param name="mode">Specifies which sub-entries should be enumerated.</param>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
/// <remarks>
/// The following <see cref="Result"/> codes may be returned under certain conditions:
///
/// The specified path does not exist or is a file: <see cref="ResultFs.PathNotFound"/>
/// </remarks>
public Result OpenDirectory(out IDirectory2 directory, U8Span path, OpenDirectoryMode mode)
{
if (path.IsNull())
{
directory = default;
return ResultFs.NullptrArgument.Log();
}
if ((mode & OpenDirectoryMode.All) == 0)
{
directory = default;
return ResultFs.InvalidOpenMode.Log();
}
if ((mode & ~(OpenDirectoryMode.All | OpenDirectoryMode.NoFileSize)) != 0)
{
directory = default;
return ResultFs.InvalidOpenMode.Log();
}
return DoOpenDirectory(out directory, path, mode);
}
/// <summary>
/// Commits any changes to a transactional file system.
/// Does nothing if called on a non-transactional file system.
/// </summary>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
public Result Commit() => DoCommit();
public Result CommitProvisionally(long counter) => DoCommitProvisionally(counter);
public Result Rollback() => DoRollback();
public Result Flush() => DoFlush();
/// <summary>
/// Gets the creation, last accessed, and last modified timestamps of a file or directory.
/// </summary>
/// <param name="timeStamp">If the operation returns successfully, the timestamps for the specified file or directory.
/// These value are expressed as Unix timestamps.</param>
/// <param name="path">The path of the file or directory.</param>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
/// <remarks>
/// The following <see cref="Result"/> codes may be returned under certain conditions:
///
/// The specified path does not exist: <see cref="ResultFs.PathNotFound"/>
/// </remarks>
public Result GetFileTimeStampRaw(out FileTimeStampRaw timeStamp, U8Span path)
{
if (path.IsNull())
{
timeStamp = default;
return ResultFs.NullptrArgument.Log();
}
return DoGetFileTimeStampRaw(out timeStamp, path);
}
/// <summary>
/// Performs a query on the specified file.
/// </summary>
/// <remarks>This method allows implementers of <see cref="IFileSystem"/> to accept queries and operations
/// not included in the IFileSystem interface itself.</remarks>
/// <param name="outBuffer">The buffer for receiving data from the query operation.
/// May be unused depending on the query type.</param>
/// <param name="inBuffer">The buffer for sending data to the query operation.
/// May be unused depending on the query type.</param>
/// <param name="queryId">The type of query to perform.</param>
/// <param name="path">The full path of the file to query.</param>
/// <returns>The <see cref="Result"/> of the requested operation.</returns>
public Result QueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId, U8Span path)
{
if (path.IsNull())
return ResultFs.NullptrArgument.Log();
return DoQueryEntry(outBuffer, inBuffer, queryId, path);
}
protected abstract Result DoCreateFile(U8Span path, long size, CreateFileOptions option);
protected abstract Result DoDeleteFile(U8Span path);
protected abstract Result DoCreateDirectory(U8Span path);
protected abstract Result DoDeleteDirectory(U8Span path);
protected abstract Result DoDeleteDirectoryRecursively(U8Span path);
protected abstract Result DoCleanDirectoryRecursively(U8Span path);
protected abstract Result DoRenameFile(U8Span oldPath, U8Span newPath);
protected abstract Result DoRenameDirectory(U8Span oldPath, U8Span newPath);
protected abstract Result DoGetEntryType(out DirectoryEntryType entryType, U8Span path);
protected virtual Result DoGetFreeSpaceSize(out long freeSpace, U8Span path)
{
freeSpace = default;
return ResultFs.NotImplemented.Log();
}
protected virtual Result DoGetTotalSpaceSize(out long totalSpace, U8Span path)
{
totalSpace = default;
return ResultFs.NotImplemented.Log();
}
protected abstract Result DoOpenFile(out IFile2 file, U8Span path, OpenMode mode);
protected abstract Result DoOpenDirectory(out IDirectory2 directory, U8Span path, OpenDirectoryMode mode);
protected abstract Result DoCommit();
protected virtual Result DoCommitProvisionally(long counter) => ResultFs.NotImplemented.Log();
protected virtual Result DoRollback() => ResultFs.NotImplemented.Log();
protected virtual Result DoFlush() => ResultFs.NotImplemented.Log();
protected virtual Result DoGetFileTimeStampRaw(out FileTimeStampRaw timeStamp, U8Span path)
{
timeStamp = default;
return ResultFs.NotImplemented.Log();
}
protected virtual Result DoQueryEntry(Span<byte> outBuffer, ReadOnlySpan<byte> inBuffer, QueryId queryId,
U8Span path) => ResultFs.NotImplemented.Log();
protected virtual void Dispose(bool disposing) { }
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
}
}

View File

@ -2,6 +2,7 @@
using System.Diagnostics;
using System.IO;
using LibHac.Common;
using LibHac.Fs.Fsa;
using LibHac.FsSystem;
namespace LibHac.Fs

View File

@ -1,5 +1,6 @@
using System;
using LibHac.Common;
using LibHac.Fs.Fsa;
using LibHac.FsService;
using LibHac.FsSystem;

View File

@ -1,5 +1,6 @@
using System;
using LibHac.Common;
using LibHac.Fs.Fsa;
using LibHac.FsService;
using LibHac.Ncm;

View File

@ -1,6 +1,7 @@
using System;
using System.Diagnostics;
using LibHac.Common;
using LibHac.Fs.Fsa;
using LibHac.FsService;
using LibHac.FsSystem;
using static LibHac.Fs.CommonMountNames;

View File

@ -1,5 +1,6 @@
using System;
using LibHac.Common;
using LibHac.Fs.Fsa;
using LibHac.FsService;
using LibHac.FsSystem;
using LibHac.Ncm;

View File

@ -1,5 +1,6 @@
using System;
using LibHac.Common;
using LibHac.Fs.Fsa;
using LibHac.FsService;
namespace LibHac.Fs.Shim

View File

@ -1,5 +1,6 @@
using System;
using LibHac.Common;
using LibHac.Fs.Fsa;
using LibHac.FsService;
namespace LibHac.Fs.Shim

View File

@ -1,5 +1,6 @@
using System;
using LibHac.Common;
using LibHac.Fs.Fsa;
using LibHac.FsService;
namespace LibHac.Fs.Shim

View File

@ -2,6 +2,7 @@
using System.Diagnostics;
using System.Runtime.CompilerServices;
using LibHac.Common;
using LibHac.Fs.Fsa;
using LibHac.FsService;
using LibHac.FsSystem;
using static LibHac.Fs.CommonMountNames;

View File

@ -1,5 +1,6 @@
using System;
using LibHac.Common;
using LibHac.Fs.Fsa;
using LibHac.FsService;
using LibHac.Ncm;

View File

@ -1,5 +1,6 @@
using System;
using LibHac.Common;
using LibHac.Fs.Fsa;
using LibHac.FsService;
namespace LibHac.Fs.Shim

View File

@ -1,4 +1,5 @@
using LibHac.Common;
using LibHac.Fs.Fsa;
using LibHac.FsService;
namespace LibHac.Fs.Shim

View File

@ -1,5 +1,6 @@
using System.Diagnostics;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsService.Creators
{

View File

@ -1,5 +1,6 @@
using System.Diagnostics;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsService.Creators
{

View File

@ -1,4 +1,5 @@
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsService.Creators
{

View File

@ -1,5 +1,6 @@
using System;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsService.Creators
{

View File

@ -1,5 +1,6 @@
using System;
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.FsSystem;
namespace LibHac.FsService.Creators

View File

@ -1,4 +1,5 @@
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsService.Creators
{

View File

@ -1,5 +1,5 @@
using System;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsService.Creators
{

View File

@ -1,4 +1,5 @@
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsService.Creators
{

View File

@ -1,4 +1,5 @@
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsService.Creators
{

View File

@ -1,4 +1,4 @@
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsService.Creators
{

View File

@ -1,4 +1,5 @@
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsService.Creators
{

View File

@ -1,4 +1,5 @@
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsService.Creators
{

View File

@ -1,6 +1,7 @@
using System;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.FsSystem.Save;
namespace LibHac.FsService.Creators

View File

@ -1,4 +1,4 @@
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsService.Creators
{

View File

@ -1,4 +1,5 @@
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.FsSystem.NcaUtils;
namespace LibHac.FsService.Creators

View File

@ -1,5 +1,5 @@
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsService.Creators
{

View File

@ -1,5 +1,5 @@
using System;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsService.Creators
{

View File

@ -1,4 +1,5 @@
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.FsSystem;
using LibHac.FsSystem.Detail;

View File

@ -1,4 +1,5 @@
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.FsSystem.RomFs;
namespace LibHac.FsService.Creators

View File

@ -1,6 +1,7 @@
using System;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.FsSystem;
using LibHac.FsSystem.Save;

View File

@ -1,5 +1,6 @@
using System;
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.FsSystem;
using LibHac.FsSystem.Detail;
using LibHac.FsSystem.NcaUtils;

View File

@ -1,5 +1,5 @@
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.FsSystem;
namespace LibHac.FsService.Creators

View File

@ -1,5 +1,5 @@
using System;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsService.Creators
{

View File

@ -1,4 +1,4 @@
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.FsService.Creators;
namespace LibHac.FsService

View File

@ -2,6 +2,7 @@
using System.Runtime.CompilerServices;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.FsService.Impl;
using LibHac.FsSystem;
using LibHac.Kvdb;

View File

@ -3,6 +3,7 @@ using System.Buffers.Text;
using System.Runtime.CompilerServices;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.Fs.Shim;
using LibHac.FsSystem;
using LibHac.FsService.Creators;

View File

@ -1,6 +1,7 @@
using System;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.FsSystem;
using LibHac.Ncm;
using LibHac.Spl;

View File

@ -1,4 +1,4 @@
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsService
{

View File

@ -2,6 +2,7 @@
using System.Runtime.InteropServices;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.Fs.Shim;
namespace LibHac.FsService.Impl

View File

@ -1,5 +1,6 @@
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.FsSystem;
namespace LibHac.FsService

View File

@ -1,6 +1,7 @@
using System;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -1,6 +1,7 @@
using System;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -3,6 +3,7 @@ using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -2,6 +2,7 @@
using System.Diagnostics;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -2,6 +2,7 @@
using System.Runtime.InteropServices;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -4,6 +4,7 @@ using System.Diagnostics;
using System.Linq;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Runtime.InteropServices;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -1,5 +1,6 @@
using System;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -1,6 +1,7 @@
using System;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -1,6 +1,7 @@
using System;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -2,7 +2,7 @@
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -1,5 +1,6 @@
using System;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.IO;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -2,6 +2,7 @@
using System.Collections.Generic;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -4,6 +4,7 @@ using System.IO;
using System.Runtime.CompilerServices;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -2,6 +2,7 @@
using System.IO;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -4,6 +4,7 @@ using System.IO;
using System.Threading;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.FsSystem.RomFs;
using LibHac.Spl;

View File

@ -3,6 +3,7 @@ using System.Buffers.Binary;
using System.Diagnostics;
using LibHac.Crypto;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem.NcaUtils
{

View File

@ -1,5 +1,6 @@
using System;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -1,6 +1,7 @@
using System;
using System.IO;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -3,6 +3,7 @@ using System.IO;
using System.Text;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -1,5 +1,6 @@
using System;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -6,6 +6,7 @@ using System.Text;
using LibHac.Common;
using LibHac.Crypto;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -6,6 +6,7 @@ using System.Text;
using LibHac.Common;
using LibHac.Crypto;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -3,6 +3,7 @@ using System.Runtime.CompilerServices;
using LibHac.Common;
using LibHac.Crypto;
using LibHac.Fs;
using LibHac.Fs.Fsa;
using LibHac.FsSystem.Detail;
namespace LibHac.FsSystem

View File

@ -1,5 +1,6 @@
using System;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -1,5 +1,6 @@
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -4,6 +4,7 @@ using System.IO;
using System.Linq;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem.RomFs
{

View File

@ -2,6 +2,7 @@
using System.Text;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem.RomFs
{

View File

@ -1,5 +1,6 @@
using System;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem.RomFs
{

View File

@ -1,5 +1,6 @@
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem.RomFs
{

View File

@ -2,6 +2,7 @@
using System.Text;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem.Save
{

View File

@ -2,6 +2,7 @@
using System.IO;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem.Save
{

View File

@ -3,6 +3,7 @@ using System.IO;
using LibHac.Common;
using LibHac.Crypto;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem.Save
{

View File

@ -1,6 +1,7 @@
using System.IO;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem.Save
{

View File

@ -3,6 +3,7 @@ using System.Buffers;
using System.IO;
using System.Runtime.InteropServices;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -1,5 +1,6 @@
using System;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -1,6 +1,7 @@
using System;
using System.IO;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -2,6 +2,7 @@
using System.Diagnostics;
using LibHac.Common;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

View File

@ -4,6 +4,7 @@ using System.Threading;
using LibHac.Common;
using LibHac.Diag;
using LibHac.Fs;
using LibHac.Fs.Fsa;
namespace LibHac.FsSystem
{

Some files were not shown because too many files have changed in this diff Show More