mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[Aaru.Filesystems] Reformat and cleanup.
This commit is contained in:
@@ -26,9 +26,9 @@
|
||||
// Copyright © 2011-2023 Natalia Portillo
|
||||
// ****************************************************************************/
|
||||
|
||||
using hammer_crc_t = System.UInt32;
|
||||
using hammer_off_t = System.UInt64;
|
||||
using hammer_tid_t = System.UInt64;
|
||||
using hammer_crc_t = uint;
|
||||
using hammer_off_t = ulong;
|
||||
using hammer_tid_t = ulong;
|
||||
|
||||
#pragma warning disable 169
|
||||
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
|
||||
using System;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using hammer_crc_t = System.UInt32;
|
||||
using hammer_off_t = System.UInt64;
|
||||
using hammer_tid_t = System.UInt64;
|
||||
using hammer_crc_t = uint;
|
||||
using hammer_off_t = ulong;
|
||||
using hammer_tid_t = ulong;
|
||||
|
||||
#pragma warning disable 169
|
||||
|
||||
@@ -40,10 +40,16 @@ namespace Aaru.Filesystems;
|
||||
/// <summary>Implements detection for the HAMMER filesystem</summary>
|
||||
public sealed partial class HAMMER : IFilesystem
|
||||
{
|
||||
#region IFilesystem Members
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.HAMMER_Name;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new("91A188BF-5FD7-4677-BBD3-F59EBA9C864D");
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Author => Authors.NataliaPortillo;
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -32,9 +32,9 @@ using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.Helpers;
|
||||
using hammer_crc_t = System.UInt32;
|
||||
using hammer_off_t = System.UInt64;
|
||||
using hammer_tid_t = System.UInt64;
|
||||
using hammer_crc_t = uint;
|
||||
using hammer_off_t = ulong;
|
||||
using hammer_tid_t = ulong;
|
||||
using Partition = Aaru.CommonTypes.Partition;
|
||||
|
||||
#pragma warning disable 169
|
||||
@@ -45,6 +45,8 @@ namespace Aaru.Filesystems;
|
||||
/// <summary>Implements detection for the HAMMER filesystem</summary>
|
||||
public sealed partial class HAMMER
|
||||
{
|
||||
#region IFilesystem Members
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool Identify(IMediaImage imagePlugin, Partition partition)
|
||||
{
|
||||
@@ -61,7 +63,7 @@ public sealed partial class HAMMER
|
||||
if(errno != ErrorNumber.NoError)
|
||||
return false;
|
||||
|
||||
ulong magic = BitConverter.ToUInt64(sbSector, 0);
|
||||
var magic = BitConverter.ToUInt64(sbSector, 0);
|
||||
|
||||
return magic is HAMMER_FSBUF_VOLUME or HAMMER_FSBUF_VOLUME_REV;
|
||||
}
|
||||
@@ -86,7 +88,7 @@ public sealed partial class HAMMER
|
||||
if(errno != ErrorNumber.NoError)
|
||||
return;
|
||||
|
||||
ulong magic = BitConverter.ToUInt64(sbSector, 0);
|
||||
var magic = BitConverter.ToUInt64(sbSector, 0);
|
||||
|
||||
SuperBlock superBlock = magic == HAMMER_FSBUF_VOLUME
|
||||
? Marshal.ByteArrayToStructureLittleEndian<SuperBlock>(sbSector)
|
||||
@@ -102,12 +104,12 @@ public sealed partial class HAMMER
|
||||
sb.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(superBlock.vol_label, encoding)).
|
||||
AppendLine();
|
||||
|
||||
sb.AppendFormat(Localization.Volume_serial_0, superBlock.vol_fsid).AppendLine();
|
||||
sb.AppendFormat(Localization.Filesystem_type_0, superBlock.vol_fstype).AppendLine();
|
||||
sb.AppendFormat(Localization.Boot_area_starts_at_0, superBlock.vol_bot_beg).AppendLine();
|
||||
sb.AppendFormat(Localization.Memory_log_starts_at_0, superBlock.vol_mem_beg).AppendLine();
|
||||
sb.AppendFormat(Localization.Volume_serial_0, superBlock.vol_fsid).AppendLine();
|
||||
sb.AppendFormat(Localization.Filesystem_type_0, superBlock.vol_fstype).AppendLine();
|
||||
sb.AppendFormat(Localization.Boot_area_starts_at_0, superBlock.vol_bot_beg).AppendLine();
|
||||
sb.AppendFormat(Localization.Memory_log_starts_at_0, superBlock.vol_mem_beg).AppendLine();
|
||||
sb.AppendFormat(Localization.First_volume_buffer_starts_at_0, superBlock.vol_buf_beg).AppendLine();
|
||||
sb.AppendFormat(Localization.Volume_ends_at_0, superBlock.vol_buf_end).AppendLine();
|
||||
sb.AppendFormat(Localization.Volume_ends_at_0, superBlock.vol_buf_end).AppendLine();
|
||||
|
||||
metadata = new FileSystem
|
||||
{
|
||||
@@ -139,4 +141,6 @@ public sealed partial class HAMMER
|
||||
|
||||
information = sb.ToString();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -29,9 +29,9 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
using hammer_crc_t = System.UInt32;
|
||||
using hammer_off_t = System.UInt64;
|
||||
using hammer_tid_t = System.UInt64;
|
||||
using hammer_crc_t = uint;
|
||||
using hammer_off_t = ulong;
|
||||
using hammer_tid_t = ulong;
|
||||
|
||||
#pragma warning disable 169
|
||||
|
||||
@@ -41,8 +41,31 @@ namespace Aaru.Filesystems;
|
||||
/// <summary>Implements detection for the HAMMER filesystem</summary>
|
||||
public sealed partial class HAMMER
|
||||
{
|
||||
#region Nested type: HammerBlockMap
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
[SuppressMessage("ReSharper", "BuiltInTypeReferenceStyle")]
|
||||
struct HammerBlockMap
|
||||
{
|
||||
/// <summary>zone-2 offset only used by zone-4</summary>
|
||||
public hammer_off_t phys_offset;
|
||||
/// <summary>zone-X offset only used by zone-3</summary>
|
||||
public hammer_off_t first_offset;
|
||||
/// <summary>zone-X offset for allocation</summary>
|
||||
public hammer_off_t next_offset;
|
||||
/// <summary>zone-X offset only used by zone-3</summary>
|
||||
public hammer_off_t alloc_offset;
|
||||
public uint reserved01;
|
||||
public hammer_crc_t entry_crc;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Nested type: SuperBlock
|
||||
|
||||
/// <summary>Hammer superblock</summary>
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1), SuppressMessage("ReSharper", "BuiltInTypeReferenceStyle")]
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
[SuppressMessage("ReSharper", "BuiltInTypeReferenceStyle")]
|
||||
readonly struct SuperBlock
|
||||
{
|
||||
/// <summary><see cref="HAMMER_FSBUF_VOLUME" /> for a valid header</summary>
|
||||
@@ -117,18 +140,5 @@ public sealed partial class HAMMER
|
||||
public readonly hammer_off_t[] vol0_undo_array;
|
||||
}
|
||||
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming"), SuppressMessage("ReSharper", "BuiltInTypeReferenceStyle")]
|
||||
struct HammerBlockMap
|
||||
{
|
||||
/// <summary>zone-2 offset only used by zone-4</summary>
|
||||
public hammer_off_t phys_offset;
|
||||
/// <summary>zone-X offset only used by zone-3</summary>
|
||||
public hammer_off_t first_offset;
|
||||
/// <summary>zone-X offset for allocation</summary>
|
||||
public hammer_off_t next_offset;
|
||||
/// <summary>zone-X offset only used by zone-3</summary>
|
||||
public hammer_off_t alloc_offset;
|
||||
public uint reserved01;
|
||||
public hammer_crc_t entry_crc;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user