[BeFS] Use new source generator based big endian marshaller

This commit is contained in:
2025-10-21 02:44:34 +01:00
parent bb9a224679
commit 9c764a4076
2 changed files with 28 additions and 26 deletions

View File

@@ -132,7 +132,7 @@ public sealed partial class BeFS
besb = littleEndian
? Marshal.ByteArrayToStructureLittleEndian<SuperBlock>(sbSector)
: Marshal.ByteArrayToStructureBigEndian<SuperBlock>(sbSector);
: Marshal.ByteArrayToStructureBigEndianGenerated<SuperBlock>(sbSector);
sb.AppendLine(littleEndian ? Localization.Little_endian_BeFS : Localization.Big_endian_BeFS);

View File

@@ -28,6 +28,7 @@
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using Aaru.CommonTypes.Attributes;
namespace Aaru.Filesystems;
@@ -41,59 +42,60 @@ public sealed partial class BeFS
/// <summary>Be superblock</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct SuperBlock
[SwapEndian]
partial struct SuperBlock
{
/// <summary>0x000, Volume name, 32 bytes</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public readonly byte[] name;
public byte[] name;
/// <summary>0x020, "BFS1", 0x42465331</summary>
public uint magic1;
/// <summary>0x024, "BIGE", 0x42494745</summary>
public readonly uint fs_byte_order;
public uint fs_byte_order;
/// <summary>0x028, Bytes per block</summary>
public readonly uint block_size;
public uint block_size;
/// <summary>0x02C, 1 &lt;&lt; block_shift == block_size</summary>
public readonly uint block_shift;
public uint block_shift;
/// <summary>0x030, Blocks in volume</summary>
public readonly long num_blocks;
public long num_blocks;
/// <summary>0x038, Used blocks in volume</summary>
public readonly long used_blocks;
public long used_blocks;
/// <summary>0x040, Bytes per inode</summary>
public readonly int inode_size;
public int inode_size;
/// <summary>0x044, 0xDD121031</summary>
public readonly uint magic2;
public uint magic2;
/// <summary>0x048, Blocks per allocation group</summary>
public readonly int blocks_per_ag;
public int blocks_per_ag;
/// <summary>0x04C, 1 &lt;&lt; ag_shift == blocks_per_ag</summary>
public readonly int ag_shift;
public int ag_shift;
/// <summary>0x050, Allocation groups in volume</summary>
public readonly int num_ags;
public int num_ags;
/// <summary>0x054, 0x434c454e if clean, 0x44495254 if dirty</summary>
public readonly uint flags;
public uint flags;
/// <summary>0x058, Allocation group of journal</summary>
public readonly int log_blocks_ag;
public int log_blocks_ag;
/// <summary>0x05C, Start block of journal, inside ag</summary>
public readonly ushort log_blocks_start;
public ushort log_blocks_start;
/// <summary>0x05E, Length in blocks of journal, inside ag</summary>
public readonly ushort log_blocks_len;
public ushort log_blocks_len;
/// <summary>0x060, Start of journal</summary>
public readonly long log_start;
public long log_start;
/// <summary>0x068, End of journal</summary>
public readonly long log_end;
public long log_end;
/// <summary>0x070, 0x15B6830E</summary>
public readonly uint magic3;
public uint magic3;
/// <summary>0x074, Allocation group where root folder's i-node resides</summary>
public readonly int root_dir_ag;
public int root_dir_ag;
/// <summary>0x078, Start in ag of root folder's i-node</summary>
public readonly ushort root_dir_start;
public ushort root_dir_start;
/// <summary>0x07A, As this is part of inode_addr, this is 1</summary>
public readonly ushort root_dir_len;
public ushort root_dir_len;
/// <summary>0x07C, Allocation group where indices' i-node resides</summary>
public readonly int indices_ag;
public int indices_ag;
/// <summary>0x080, Start in ag of indices' i-node</summary>
public readonly ushort indices_start;
public ushort indices_start;
/// <summary>0x082, As this is part of inode_addr, this is 1</summary>
public readonly ushort indices_len;
public ushort indices_len;
}
#endregion