From 5670f2fd485c1843896416cc7a88e345d84dc0f8 Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Fri, 24 Dec 2021 16:25:06 -0700 Subject: [PATCH] Add summary docs to ReadOnlySpan strings --- src/LibHac/Fs/AccessLog.cs | 58 +++++++++++++++++++-- src/LibHac/Fs/Fsa/FileSystemAccessor.cs | 14 +++++ src/LibHac/FsSrv/AccessLogService.cs | 3 +- src/LibHac/FsSrv/Impl/MultiCommitManager.cs | 4 +- 4 files changed, 73 insertions(+), 6 deletions(-) diff --git a/src/LibHac/Fs/AccessLog.cs b/src/LibHac/Fs/AccessLog.cs index 48dcf385..b1a68511 100644 --- a/src/LibHac/Fs/AccessLog.cs +++ b/src/LibHac/Fs/AccessLog.cs @@ -730,23 +730,29 @@ namespace LibHac.Fs.Impl internal static class AccessLogStrings { + /// "$fs" public static ReadOnlySpan FsModuleName => // "$fs" new[] { (byte)'$', (byte)'f', (byte)'s' }; - public static ReadOnlySpan LogLibHacVersion => // "0.13.0" + /// "0.15.0" + public static ReadOnlySpan LogLibHacVersion => // "0.15.0" new[] { - (byte)'0', (byte)'.', (byte)'1', (byte)'3', (byte)'.', (byte)'0' + (byte)'0', (byte)'.', (byte)'1', (byte)'5', (byte)'.', (byte)'0' }; + /// """ public static byte LogQuote => (byte)'"'; + /// "true" public static ReadOnlySpan LogTrue => // "true" new[] { (byte)'t', (byte)'r', (byte)'u', (byte)'e' }; + /// "false" public static ReadOnlySpan LogFalse => // "false" new[] { (byte)'f', (byte)'a', (byte)'l', (byte)'s', (byte)'e' }; + /// ", entry_buffer_count: " public static ReadOnlySpan LogEntryBufferCount => // ", entry_buffer_count: " new[] { @@ -755,6 +761,7 @@ namespace LibHac.Fs.Impl (byte)'o', (byte)'u', (byte)'n', (byte)'t', (byte)':', (byte)' ' }; + /// ", entry_count: " public static ReadOnlySpan LogEntryCount => // ", entry_count: " new[] { @@ -762,6 +769,7 @@ namespace LibHac.Fs.Impl (byte)'c', (byte)'o', (byte)'u', (byte)'n', (byte)'t', (byte)':', (byte)' ' }; + /// ", offset: " public static ReadOnlySpan LogOffset => // ", offset: " new[] { @@ -769,12 +777,14 @@ namespace LibHac.Fs.Impl (byte)':', (byte)' ' }; + /// ", size: " public static ReadOnlySpan LogSize => // ", size: " new[] { (byte)',', (byte)' ', (byte)'s', (byte)'i', (byte)'z', (byte)'e', (byte)':', (byte)' ' }; + /// ", read_size: " public static ReadOnlySpan LogReadSize => // ", read_size: " new[] { @@ -782,6 +792,7 @@ namespace LibHac.Fs.Impl (byte)'i', (byte)'z', (byte)'e', (byte)':', (byte)' ' }; + /// ", write_option: Flush" public static ReadOnlySpan LogWriteOptionFlush => // ", write_option: Flush" new[] { @@ -790,6 +801,7 @@ namespace LibHac.Fs.Impl (byte)'F', (byte)'l', (byte)'u', (byte)'s', (byte)'h' }; + /// ", open_mode: 0x" public static ReadOnlySpan LogOpenMode => // ", open_mode: 0x" new[] { @@ -797,6 +809,7 @@ namespace LibHac.Fs.Impl (byte)'o', (byte)'d', (byte)'e', (byte)':', (byte)' ', (byte)'0', (byte)'x' }; + /// ", path: "" public static ReadOnlySpan LogPath => // ", path: "" new[] { @@ -804,6 +817,7 @@ namespace LibHac.Fs.Impl (byte)'"' }; + /// "", new_path: "" public static ReadOnlySpan LogNewPath => // "", new_path: "" new[] { @@ -811,6 +825,7 @@ namespace LibHac.Fs.Impl (byte)'a', (byte)'t', (byte)'h', (byte)':', (byte)' ', (byte)'"' }; + /// "", entry_type: " public static ReadOnlySpan LogEntryType => // "", entry_type: " new[] { @@ -818,6 +833,7 @@ namespace LibHac.Fs.Impl (byte)'_', (byte)'t', (byte)'y', (byte)'p', (byte)'e', (byte)':', (byte)' ' }; + /// ", name: "" public static ReadOnlySpan LogName => // ", name: "" new[] { @@ -825,6 +841,7 @@ namespace LibHac.Fs.Impl (byte)'"' }; + /// "", commit_option: 0x" public static ReadOnlySpan LogCommitOption => // "", commit_option: 0x" new[] { @@ -833,6 +850,7 @@ namespace LibHac.Fs.Impl (byte)':', (byte)' ', (byte)'0', (byte)'x' }; + /// "", is_mounted: "" public static ReadOnlySpan LogIsMounted => // "", is_mounted: "" new[] { @@ -840,6 +858,7 @@ namespace LibHac.Fs.Impl (byte)'u', (byte)'n', (byte)'t', (byte)'e', (byte)'d', (byte)':', (byte)' ', (byte)'"' }; + /// ", applicationid: 0x" public static ReadOnlySpan LogApplicationId => // ", applicationid: 0x" new[] { @@ -848,6 +867,7 @@ namespace LibHac.Fs.Impl (byte)' ', (byte)'0', (byte)'x' }; + /// ", programid: 0x" public static ReadOnlySpan LogProgramId => // ", programid: 0x" new[] { @@ -855,6 +875,7 @@ namespace LibHac.Fs.Impl (byte)'m', (byte)'i', (byte)'d', (byte)':', (byte)' ', (byte)'0', (byte)'x' }; + /// ", dataid: 0x" public static ReadOnlySpan LogDataId => // ", dataid: 0x" new[] { @@ -862,6 +883,7 @@ namespace LibHac.Fs.Impl (byte)':', (byte)' ', (byte)'0', (byte)'x' }; + /// ", bispartitionid: " public static ReadOnlySpan LogBisPartitionId => // ", bispartitionid: " new[] { @@ -870,6 +892,7 @@ namespace LibHac.Fs.Impl (byte)':', (byte)' ' }; + /// ", content_type: " public static ReadOnlySpan LogContentType => // ", content_type: " new[] { @@ -877,6 +900,7 @@ namespace LibHac.Fs.Impl (byte)'t', (byte)'_', (byte)'t', (byte)'y', (byte)'p', (byte)'e', (byte)':', (byte)' ' }; + /// ", contentstorageid: " public static ReadOnlySpan LogContentStorageId => // ", contentstorageid: " new[] { @@ -885,6 +909,7 @@ namespace LibHac.Fs.Impl (byte)'i', (byte)'d', (byte)':', (byte)' ' }; + /// ", gamecard_handle: 0x" public static ReadOnlySpan LogGameCardHandle => // ", gamecard_handle: 0x" new[] { @@ -893,6 +918,7 @@ namespace LibHac.Fs.Impl (byte)'e', (byte)':', (byte)' ', (byte)'0', (byte)'x' }; + /// ", gamecard_partition: " public static ReadOnlySpan LogGameCardPartition => // ", gamecard_partition: " new[] { @@ -901,6 +927,7 @@ namespace LibHac.Fs.Impl (byte)'t', (byte)'i', (byte)'o', (byte)'n', (byte)':', (byte)' ' }; + /// ", mount_host_option: " public static ReadOnlySpan LogMountHostOption => // ", mount_host_option: " new[] { @@ -909,6 +936,7 @@ namespace LibHac.Fs.Impl (byte)'i', (byte)'o', (byte)'n', (byte)':', (byte)' ' }; + /// ", root_path: "" public static ReadOnlySpan LogRootPath => // ", root_path: "" new[] { @@ -916,6 +944,7 @@ namespace LibHac.Fs.Impl (byte)'a', (byte)'t', (byte)'h', (byte)':', (byte)' ', (byte)'"' }; + /// ", userid: 0x" public static ReadOnlySpan LogUserId => // ", userid: 0x" new[] { @@ -923,6 +952,7 @@ namespace LibHac.Fs.Impl (byte)':', (byte)' ', (byte)'0', (byte)'x' }; + /// ", index: " public static ReadOnlySpan LogIndex => // ", index: " new[] { @@ -930,6 +960,7 @@ namespace LibHac.Fs.Impl (byte)' ' }; + /// ", save_data_owner_id: 0x" public static ReadOnlySpan LogSaveDataOwnerId => // ", save_data_owner_id: 0x" new[] { @@ -938,6 +969,7 @@ namespace LibHac.Fs.Impl (byte)'r', (byte)'_', (byte)'i', (byte)'d', (byte)':', (byte)' ', (byte)'0', (byte)'x' }; + /// ", save_data_size: " public static ReadOnlySpan LogSaveDataSize => // ", save_data_size: " new[] { @@ -946,6 +978,7 @@ namespace LibHac.Fs.Impl (byte)':', (byte)' ' }; + /// ", save_data_journal_size: " public static ReadOnlySpan LogSaveDataJournalSize => // ", save_data_journal_size: " new[] { @@ -955,6 +988,7 @@ namespace LibHac.Fs.Impl (byte)':', (byte)' ' }; + /// ", save_data_flags: 0x" public static ReadOnlySpan LogSaveDataFlags => // ", save_data_flags: 0x" new[] { @@ -963,6 +997,7 @@ namespace LibHac.Fs.Impl (byte)'s', (byte)':', (byte)' ', (byte)'0', (byte)'x' }; + /// ", savedataid: 0x" public static ReadOnlySpan LogSaveDataId => // ", savedataid: 0x" new[] { @@ -970,6 +1005,7 @@ namespace LibHac.Fs.Impl (byte)'t', (byte)'a', (byte)'i', (byte)'d', (byte)':', (byte)' ', (byte)'0', (byte)'x' }; + /// ", savedataspaceid: " public static ReadOnlySpan LogSaveDataSpaceId => // ", savedataspaceid: " new[] { @@ -978,6 +1014,7 @@ namespace LibHac.Fs.Impl (byte)'d', (byte)':', (byte)' ' }; + /// ", save_data_time_stamp: " public static ReadOnlySpan LogSaveDataTimeStamp => // ", save_data_time_stamp: " new[] { @@ -986,6 +1023,7 @@ namespace LibHac.Fs.Impl (byte)'_', (byte)'s', (byte)'t', (byte)'a', (byte)'m', (byte)'p', (byte)':', (byte)' ' }; + /// ", save_data_commit_id: 0x" public static ReadOnlySpan LogSaveDataCommitId => // ", save_data_commit_id: 0x" new[] { @@ -995,6 +1033,7 @@ namespace LibHac.Fs.Impl (byte)'x' }; + /// ", restore_flag: " public static ReadOnlySpan LogRestoreFlag => // ", restore_flag: " new[] { @@ -1002,6 +1041,7 @@ namespace LibHac.Fs.Impl (byte)'e', (byte)'_', (byte)'f', (byte)'l', (byte)'a', (byte)'g', (byte)':', (byte)' ' }; + /// "sdk_version: " public static ReadOnlySpan LogSdkVersion => // "sdk_version: " new[] { @@ -1009,15 +1049,18 @@ namespace LibHac.Fs.Impl (byte)'i', (byte)'o', (byte)'n', (byte)':', (byte)' ' }; + /// ", spec: " public static ReadOnlySpan LogSpec => // ", spec: " new[] { (byte)',', (byte)' ', (byte)'s', (byte)'p', (byte)'e', (byte)'c', (byte)':', (byte)' ' }; + /// "NX" public static ReadOnlySpan LogNx => // "NX" new[] { (byte)'N', (byte)'X' }; + /// ", program_index: " public static ReadOnlySpan LogProgramIndex => // ", program_index: " new[] { @@ -1026,6 +1069,7 @@ namespace LibHac.Fs.Impl (byte)' ' }; + /// ", for_system: true" public static ReadOnlySpan LogForSystem => // ", for_system: true" new[] { @@ -1034,6 +1078,7 @@ namespace LibHac.Fs.Impl (byte)'u', (byte)'e' }; + /// ""FS_ACCESS: { " public static ReadOnlySpan LogLineStart => // "FS_ACCESS: { " new[] { @@ -1041,21 +1086,25 @@ namespace LibHac.Fs.Impl (byte)'S', (byte)':', (byte)' ', (byte)'{', (byte)' ' }; + /// " }\n" public static ReadOnlySpan LogLineEnd => // " }\n" new[] { (byte)' ', (byte)'}', (byte)'\n' }; + /// "start: " public static ReadOnlySpan LogStart => // "start: " new[] { (byte)'s', (byte)'t', (byte)'a', (byte)'r', (byte)'t', (byte)':', (byte)' ' }; + /// ", end: " public static ReadOnlySpan LogEnd => // ", end: " new[] { (byte)',', (byte)' ', (byte)'e', (byte)'n', (byte)'d', (byte)':', (byte)' ' }; + /// ", result: 0x" public static ReadOnlySpan LogResult => // ", result: 0x" new[] { @@ -1063,6 +1112,7 @@ namespace LibHac.Fs.Impl (byte)':', (byte)' ', (byte)'0', (byte)'x' }; + /// ", handle: 0x" public static ReadOnlySpan LogHandle => // ", handle: 0x" new[] { @@ -1070,6 +1120,7 @@ namespace LibHac.Fs.Impl (byte)':', (byte)' ', (byte)'0', (byte)'x' }; + /// ", priority: " public static ReadOnlySpan LogPriority => // ", priority: " new[] { @@ -1077,6 +1128,7 @@ namespace LibHac.Fs.Impl (byte)'t', (byte)'y', (byte)':', (byte)' ' }; + /// ", function: "" public static ReadOnlySpan LogFunction => // ", function: "" new[] { @@ -1084,4 +1136,4 @@ namespace LibHac.Fs.Impl (byte)'o', (byte)'n', (byte)':', (byte)' ', (byte)'"' }; } -} +} \ No newline at end of file diff --git a/src/LibHac/Fs/Fsa/FileSystemAccessor.cs b/src/LibHac/Fs/Fsa/FileSystemAccessor.cs index d24c7b91..5f13dbfe 100644 --- a/src/LibHac/Fs/Fsa/FileSystemAccessor.cs +++ b/src/LibHac/Fs/Fsa/FileSystemAccessor.cs @@ -525,8 +525,10 @@ internal class FileSystemAccessor : IDisposable Remove(_openDirectories, directory); } + /// "$fs" private static ReadOnlySpan LogFsModuleName => new[] { (byte)'$', (byte)'f', (byte)'s' }; // "$fs" + /// "------ FS ERROR INFORMATION ------\n" private static ReadOnlySpan LogFsErrorInfo => // "------ FS ERROR INFORMATION ------\n" new[] { @@ -537,6 +539,7 @@ internal class FileSystemAccessor : IDisposable (byte)'-', (byte)'-', (byte)'\\', (byte)'n' }; + /// "Error: File not closed" private static ReadOnlySpan LogFileNotClosed => // "Error: File not closed" new[] { @@ -545,6 +548,7 @@ internal class FileSystemAccessor : IDisposable (byte)'c', (byte)'l', (byte)'o', (byte)'s', (byte)'e', (byte)'d' }; + /// "Error: Directory not closed" private static ReadOnlySpan LogDirectoryNotClosed => // "Error: Directory not closed" new[] { @@ -554,6 +558,7 @@ internal class FileSystemAccessor : IDisposable (byte)'s', (byte)'e', (byte)'d' }; + /// " (mount_name: "" private static ReadOnlySpan LogMountName => // " (mount_name: "" new[] { @@ -561,6 +566,7 @@ internal class FileSystemAccessor : IDisposable (byte)'n', (byte)'a', (byte)'m', (byte)'e', (byte)':', (byte)' ', (byte)'"' }; + /// "", count: " private static ReadOnlySpan LogCount => // "", count: " new[] { @@ -568,10 +574,13 @@ internal class FileSystemAccessor : IDisposable (byte)':', (byte)' ' }; + /// ")\n" public static ReadOnlySpan LogLineEnd => new[] { (byte)')', (byte)'\\', (byte)'n' }; // ")\n" + /// " | " public static ReadOnlySpan LogOrOperator => new[] { (byte)' ', (byte)'|', (byte)' ' }; // " | " + /// "OpenMode_Read" private static ReadOnlySpan LogOpenModeRead => // "OpenMode_Read" new[] { @@ -579,6 +588,7 @@ internal class FileSystemAccessor : IDisposable (byte)'_', (byte)'R', (byte)'e', (byte)'a', (byte)'d' }; + /// "OpenMode_Write" private static ReadOnlySpan LogOpenModeWrite => // "OpenMode_Write" new[] { @@ -586,6 +596,7 @@ internal class FileSystemAccessor : IDisposable (byte)'_', (byte)'W', (byte)'r', (byte)'i', (byte)'t', (byte)'e' }; + /// "OpenMode_AllowAppend" private static ReadOnlySpan LogOpenModeAppend => // "OpenMode_AllowAppend" new[] { @@ -594,6 +605,7 @@ internal class FileSystemAccessor : IDisposable (byte)'p', (byte)'e', (byte)'n', (byte)'d' }; + /// " handle: 0x" private static ReadOnlySpan LogHandle => // " handle: 0x" new[] { @@ -601,6 +613,7 @@ internal class FileSystemAccessor : IDisposable (byte)'d', (byte)'l', (byte)'e', (byte)':', (byte)' ', (byte)'0', (byte)'x' }; + /// ", open_mode: " private static ReadOnlySpan LogOpenMode => // ", open_mode: " new[] { @@ -608,6 +621,7 @@ internal class FileSystemAccessor : IDisposable (byte)'o', (byte)'d', (byte)'e', (byte)':', (byte)' ' }; + /// ", size:" private static ReadOnlySpan LogSize => // ", size: " new[] { diff --git a/src/LibHac/FsSrv/AccessLogService.cs b/src/LibHac/FsSrv/AccessLogService.cs index 549bebd4..4808ab15 100644 --- a/src/LibHac/FsSrv/AccessLogService.cs +++ b/src/LibHac/FsSrv/AccessLogService.cs @@ -63,6 +63,7 @@ internal readonly struct AccessLogService return _serviceImpl.GetProgramInfo(out programInfo, _processId); } + /// "FS_ACCESS: { multi_program_tag: true }\n" private static ReadOnlySpan MultiProgramTag => // FS_ACCESS: { multi_program_tag: true }\n new[] { @@ -72,4 +73,4 @@ internal readonly struct AccessLogService (byte) 'a', (byte) 'm', (byte) '_', (byte) 't', (byte) 'a', (byte) 'g', (byte) ':', (byte) ' ', (byte) 't', (byte) 'r', (byte) 'u', (byte) 'e', (byte) ' ', (byte) '}', (byte) '\n' }; -} +} \ No newline at end of file diff --git a/src/LibHac/FsSrv/Impl/MultiCommitManager.cs b/src/LibHac/FsSrv/Impl/MultiCommitManager.cs index d3d849c8..7c847132 100644 --- a/src/LibHac/FsSrv/Impl/MultiCommitManager.cs +++ b/src/LibHac/FsSrv/Impl/MultiCommitManager.cs @@ -55,7 +55,7 @@ internal class MultiCommitManager : IMultiCommitManager private const int CurrentCommitContextVersion = 0x10000; private const long CommitContextFileSize = 0x200; - // /commitinfo + /// "/commitinfo" private static ReadOnlySpan CommitContextFileName => new[] { (byte)'/', (byte)'c', (byte)'o', (byte)'m', (byte)'m', (byte)'i', (byte)'t', (byte)'i', (byte)'n', (byte)'f', (byte)'o' }; @@ -640,4 +640,4 @@ internal class MultiCommitManager : IMultiCommitManager return Result.Success; } } -} +} \ No newline at end of file