mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[HAMMER] Use new source generator based big endian marshaller
This commit is contained in:
@@ -84,7 +84,7 @@ public sealed partial class HAMMER
|
|||||||
|
|
||||||
SuperBlock superBlock = magic == HAMMER_FSBUF_VOLUME
|
SuperBlock superBlock = magic == HAMMER_FSBUF_VOLUME
|
||||||
? Marshal.ByteArrayToStructureLittleEndian<SuperBlock>(sbSector)
|
? Marshal.ByteArrayToStructureLittleEndian<SuperBlock>(sbSector)
|
||||||
: Marshal.ByteArrayToStructureBigEndian<SuperBlock>(sbSector);
|
: Marshal.ByteArrayToStructureBigEndianGenerated<SuperBlock>(sbSector);
|
||||||
|
|
||||||
sb.AppendLine(Localization.HAMMER_filesystem);
|
sb.AppendLine(Localization.HAMMER_filesystem);
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using Aaru.CommonTypes.Attributes;
|
||||||
using hammer_crc_t = uint;
|
using hammer_crc_t = uint;
|
||||||
using hammer_off_t = ulong;
|
using hammer_off_t = ulong;
|
||||||
using hammer_tid_t = ulong;
|
using hammer_tid_t = ulong;
|
||||||
@@ -45,7 +46,8 @@ public sealed partial class HAMMER
|
|||||||
|
|
||||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||||
[SuppressMessage("ReSharper", "BuiltInTypeReferenceStyle")]
|
[SuppressMessage("ReSharper", "BuiltInTypeReferenceStyle")]
|
||||||
struct HammerBlockMap
|
[SwapEndian]
|
||||||
|
partial struct HammerBlockMap
|
||||||
{
|
{
|
||||||
/// <summary>zone-2 offset only used by zone-4</summary>
|
/// <summary>zone-2 offset only used by zone-4</summary>
|
||||||
public hammer_off_t phys_offset;
|
public hammer_off_t phys_offset;
|
||||||
@@ -66,46 +68,47 @@ public sealed partial class HAMMER
|
|||||||
/// <summary>Hammer superblock</summary>
|
/// <summary>Hammer superblock</summary>
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
[SuppressMessage("ReSharper", "BuiltInTypeReferenceStyle")]
|
[SuppressMessage("ReSharper", "BuiltInTypeReferenceStyle")]
|
||||||
readonly struct SuperBlock
|
[SwapEndian]
|
||||||
|
partial struct SuperBlock
|
||||||
{
|
{
|
||||||
/// <summary><see cref="HAMMER_FSBUF_VOLUME" /> for a valid header</summary>
|
/// <summary><see cref="HAMMER_FSBUF_VOLUME" /> for a valid header</summary>
|
||||||
public readonly ulong vol_signature;
|
public ulong vol_signature;
|
||||||
|
|
||||||
/* These are relative to block device offset, not zone offsets. */
|
/* These are relative to block device offset, not zone offsets. */
|
||||||
/// <summary>offset of boot area</summary>
|
/// <summary>offset of boot area</summary>
|
||||||
public readonly long vol_bot_beg;
|
public long vol_bot_beg;
|
||||||
/// <summary>offset of memory log</summary>
|
/// <summary>offset of memory log</summary>
|
||||||
public readonly long vol_mem_beg;
|
public long vol_mem_beg;
|
||||||
/// <summary>offset of the first buffer in volume</summary>
|
/// <summary>offset of the first buffer in volume</summary>
|
||||||
public readonly long vol_buf_beg;
|
public long vol_buf_beg;
|
||||||
/// <summary>offset of volume EOF (on buffer boundary)</summary>
|
/// <summary>offset of volume EOF (on buffer boundary)</summary>
|
||||||
public readonly long vol_buf_end;
|
public long vol_buf_end;
|
||||||
public readonly long vol_reserved01;
|
public long vol_reserved01;
|
||||||
|
|
||||||
/// <summary>identify filesystem</summary>
|
/// <summary>identify filesystem</summary>
|
||||||
public readonly Guid vol_fsid;
|
public Guid vol_fsid;
|
||||||
/// <summary>identify filesystem type</summary>
|
/// <summary>identify filesystem type</summary>
|
||||||
public readonly Guid vol_fstype;
|
public Guid vol_fstype;
|
||||||
/// <summary>filesystem label</summary>
|
/// <summary>filesystem label</summary>
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
|
||||||
public readonly byte[] vol_label;
|
public byte[] vol_label;
|
||||||
|
|
||||||
/// <summary>volume number within filesystem</summary>
|
/// <summary>volume number within filesystem</summary>
|
||||||
public readonly int vol_no;
|
public int vol_no;
|
||||||
/// <summary>number of volumes making up filesystem</summary>
|
/// <summary>number of volumes making up filesystem</summary>
|
||||||
public readonly int vol_count;
|
public int vol_count;
|
||||||
|
|
||||||
/// <summary>version control information</summary>
|
/// <summary>version control information</summary>
|
||||||
public readonly uint vol_version;
|
public uint vol_version;
|
||||||
/// <summary>header crc</summary>
|
/// <summary>header crc</summary>
|
||||||
public readonly hammer_crc_t vol_crc;
|
public hammer_crc_t vol_crc;
|
||||||
/// <summary>volume flags</summary>
|
/// <summary>volume flags</summary>
|
||||||
public readonly uint vol_flags;
|
public uint vol_flags;
|
||||||
/// <summary>the root volume number (must be 0)</summary>
|
/// <summary>the root volume number (must be 0)</summary>
|
||||||
public readonly uint vol_rootvol;
|
public uint vol_rootvol;
|
||||||
|
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
||||||
public readonly uint[] vol_reserved;
|
public uint[] vol_reserved;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These fields are initialized and space is reserved in every
|
* These fields are initialized and space is reserved in every
|
||||||
@@ -115,29 +118,29 @@ public sealed partial class HAMMER
|
|||||||
* by newfs_hammer(8).
|
* by newfs_hammer(8).
|
||||||
*/
|
*/
|
||||||
/// <summary>total big-blocks when fs is empty</summary>
|
/// <summary>total big-blocks when fs is empty</summary>
|
||||||
public readonly long vol0_stat_bigblocks;
|
public long vol0_stat_bigblocks;
|
||||||
/// <summary>number of free big-blocks</summary>
|
/// <summary>number of free big-blocks</summary>
|
||||||
public readonly long vol0_stat_freebigblocks;
|
public long vol0_stat_freebigblocks;
|
||||||
public readonly long vol0_reserved01;
|
public long vol0_reserved01;
|
||||||
/// <summary>for statfs only</summary>
|
/// <summary>for statfs only</summary>
|
||||||
public readonly long vol0_stat_inodes;
|
public long vol0_stat_inodes;
|
||||||
public readonly long vol0_reserved02;
|
public long vol0_reserved02;
|
||||||
/// <summary>B-Tree root offset in zone-8</summary>
|
/// <summary>B-Tree root offset in zone-8</summary>
|
||||||
public readonly hammer_off_t vol0_btree_root;
|
public hammer_off_t vol0_btree_root;
|
||||||
/// <summary>highest partially synchronized TID</summary>
|
/// <summary>highest partially synchronized TID</summary>
|
||||||
public readonly hammer_tid_t vol0_next_tid;
|
public hammer_tid_t vol0_next_tid;
|
||||||
public readonly hammer_off_t vol0_reserved03;
|
public hammer_off_t vol0_reserved03;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Blockmaps for zones. Not all zones use a blockmap. Note that the entire root blockmap is cached in the
|
/// Blockmaps for zones. Not all zones use a blockmap. Note that the entire root blockmap is cached in the
|
||||||
/// hammer_mount structure.
|
/// hammer_mount structure.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||||
public readonly HammerBlockMap[] vol0_blockmap;
|
public HammerBlockMap[] vol0_blockmap;
|
||||||
|
|
||||||
/// <summary>Array of zone-2 addresses for undo FIFO.</summary>
|
/// <summary>Array of zone-2 addresses for undo FIFO.</summary>
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
|
||||||
public readonly hammer_off_t[] vol0_undo_array;
|
public hammer_off_t[] vol0_undo_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Reference in New Issue
Block a user