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