General cleanup and refactor.

This commit is contained in:
2022-03-07 07:36:44 +00:00
parent bc6e432565
commit 762e3eb6d2
1321 changed files with 44657 additions and 45479 deletions

View File

@@ -30,17 +30,6 @@
// Copyright © 2011-2022 Natalia Portillo
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Text;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Helpers;
using Schemas;
// Commit count
using commitcnt_t = System.Int32;
@@ -55,7 +44,6 @@ using gfs_t = System.Int32;
// Inode number
using ino_t = System.Int32;
using Marshal = Aaru.Helpers.Marshal;
// Filesystem pack number
using pckno_t = System.Int16;
@@ -68,6 +56,18 @@ using time_t = System.Int32;
namespace Aaru.Filesystems;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Text;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Helpers;
using Schemas;
using Marshal = Aaru.Helpers.Marshal;
/// <inheritdoc />
/// <summary>Implements detection of the Locus filesystem</summary>
public sealed class Locus : IFilesystem
@@ -101,7 +101,7 @@ public sealed class Locus : IFilesystem
for(ulong location = 0; location <= 8; location++)
{
uint sbSize = (uint)(Marshal.SizeOf<Superblock>() / imagePlugin.Info.SectorSize);
var sbSize = (uint)(Marshal.SizeOf<Superblock>() / imagePlugin.Info.SectorSize);
if(Marshal.SizeOf<Superblock>() % imagePlugin.Info.SectorSize != 0)
sbSize++;
@@ -132,8 +132,7 @@ public sealed class Locus : IFilesystem
}
/// <inheritdoc />
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
{
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
@@ -146,7 +145,7 @@ public sealed class Locus : IFilesystem
for(ulong location = 0; location <= 8; location++)
{
uint sbSize = (uint)(Marshal.SizeOf<Superblock>() / imagePlugin.Info.SectorSize);
var sbSize = (uint)(Marshal.SizeOf<Superblock>() / imagePlugin.Info.SectorSize);
if(Marshal.SizeOf<Superblock>() % imagePlugin.Info.SectorSize != 0)
sbSize++;
@@ -217,8 +216,7 @@ public sealed class Locus : IFilesystem
AaruConsole.DebugWriteLine("Locus plugin", "LocusSb.s_fmod = {0}", locusSb.s_fmod);
AaruConsole.DebugWriteLine("Locus plugin", "LocusSb.s_version = {0}", locusSb.s_version);
sb.AppendFormat("Superblock last modified on {0}", DateHandlers.UnixToDateTime(locusSb.s_time)).
AppendLine();
sb.AppendFormat("Superblock last modified on {0}", DateHandlers.UnixToDateTime(locusSb.s_time)).AppendLine();
sb.AppendFormat("Volume has {0} blocks of {1} bytes each (total {2} bytes)", locusSb.s_fsize, blockSize,
locusSb.s_fsize * blockSize).AppendLine();
@@ -404,22 +402,26 @@ public sealed class Locus : IFilesystem
Flags]
enum Flags : ushort
{
SB_RDONLY = 0x1, /* no writes on filesystem */ SB_CLEAN = 0x2, /* fs unmounted cleanly (or checks run) */
SB_DIRTY = 0x4, /* fs mounted without CLEAN bit set */ SB_RMV = 0x8, /* fs is a removable file system */
SB_PRIMPACK = 0x10, /* This is the primary pack of the filesystem */
SB_REPLTYPE = 0x20, /* This is a replicated type filesystem. */
SB_USER = 0x40, /* This is a "user" replicated filesystem. */
SB_BACKBONE = 0x80, /* backbone pack ; complete copy of primary pack but not modifiable */
SB_RDONLY = 0x1, /* no writes on filesystem */
SB_CLEAN = 0x2, /* fs unmounted cleanly (or checks run) */
SB_DIRTY = 0x4, /* fs mounted without CLEAN bit set */
SB_RMV = 0x8, /* fs is a removable file system */
SB_PRIMPACK = 0x10, /* This is the primary pack of the filesystem */
SB_REPLTYPE = 0x20, /* This is a replicated type filesystem. */
SB_USER = 0x40, /* This is a "user" replicated filesystem. */
SB_BACKBONE = 0x80, /* backbone pack ; complete copy of primary pack but not modifiable */
SB_NFS = 0x100, /* This is a NFS type filesystem */
SB_BYHAND = 0x200, /* Inhibits automatic fscks on a mangled file system */
SB_NOSUID = 0x400, /* Set-uid/Set-gid is disabled */ SB_SYNCW = 0x800 /* Synchronous Write */
SB_NOSUID = 0x400, /* Set-uid/Set-gid is disabled */
SB_SYNCW = 0x800 /* Synchronous Write */
}
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "BuiltInTypeReferenceStyle"),
Flags]
enum Version : byte
{
SB_SB4096 = 1, /* smallblock filesys with 4096 byte blocks */ SB_B1024 = 2, /* 1024 byte block filesystem */
NUMSCANDEV = 5 /* Used by scangfs(), refed in space.h */
SB_SB4096 = 1, /* smallblock filesys with 4096 byte blocks */
SB_B1024 = 2, /* 1024 byte block filesystem */
NUMSCANDEV = 5 /* Used by scangfs(), refed in space.h */
}
}