mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[XFS] Use new source generator based big endian marshaller
This commit is contained in:
@@ -70,7 +70,7 @@ public sealed partial class XFS
|
||||
{
|
||||
Array.Copy(sector, location, sbpiece, 0, Marshal.SizeOf<Superblock>());
|
||||
|
||||
Superblock xfsSb = Marshal.ByteArrayToStructureBigEndian<Superblock>(sbpiece);
|
||||
Superblock xfsSb = Marshal.ByteArrayToStructureBigEndianGenerated<Superblock>(sbpiece);
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME,
|
||||
Localization.magic_at_0_X3_equals_1_expected_2,
|
||||
@@ -100,7 +100,7 @@ public sealed partial class XFS
|
||||
|
||||
if(sector.Length < Marshal.SizeOf<Superblock>()) return false;
|
||||
|
||||
Superblock xfsSb = Marshal.ByteArrayToStructureBigEndian<Superblock>(sector);
|
||||
Superblock xfsSb = Marshal.ByteArrayToStructureBigEndianGenerated<Superblock>(sector);
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME,
|
||||
Localization.magic_at_0_equals_1_expected_2,
|
||||
@@ -147,7 +147,7 @@ public sealed partial class XFS
|
||||
{
|
||||
Array.Copy(sector, location, sbpiece, 0, Marshal.SizeOf<Superblock>());
|
||||
|
||||
xfsSb = Marshal.ByteArrayToStructureBigEndian<Superblock>(sbpiece);
|
||||
xfsSb = Marshal.ByteArrayToStructureBigEndianGenerated<Superblock>(sbpiece);
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME,
|
||||
Localization.magic_at_0_X3_equals_1_expected_2,
|
||||
@@ -174,7 +174,7 @@ public sealed partial class XFS
|
||||
|
||||
if(errno != ErrorNumber.NoError || sector.Length < Marshal.SizeOf<Superblock>()) return;
|
||||
|
||||
xfsSb = Marshal.ByteArrayToStructureBigEndian<Superblock>(sector);
|
||||
xfsSb = Marshal.ByteArrayToStructureBigEndianGenerated<Superblock>(sector);
|
||||
|
||||
AaruLogging.Debug(MODULE_NAME,
|
||||
Localization.magic_at_0_equals_1_expected_2,
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Aaru.CommonTypes.Attributes;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
|
||||
@@ -38,66 +39,67 @@ public sealed partial class XFS
|
||||
#region Nested type: Superblock
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct Superblock
|
||||
[SwapEndian]
|
||||
partial struct Superblock
|
||||
{
|
||||
public readonly uint magicnum;
|
||||
public readonly uint blocksize;
|
||||
public readonly ulong dblocks;
|
||||
public readonly ulong rblocks;
|
||||
public readonly ulong rextents;
|
||||
public readonly Guid uuid;
|
||||
public readonly ulong logstat;
|
||||
public readonly ulong rootino;
|
||||
public readonly ulong rbmino;
|
||||
public readonly ulong rsumino;
|
||||
public readonly uint rextsize;
|
||||
public readonly uint agblocks;
|
||||
public readonly uint agcount;
|
||||
public readonly uint rbmblocks;
|
||||
public readonly uint logblocks;
|
||||
public readonly ushort version;
|
||||
public readonly ushort sectsize;
|
||||
public readonly ushort inodesize;
|
||||
public readonly ushort inopblock;
|
||||
public uint magicnum;
|
||||
public uint blocksize;
|
||||
public ulong dblocks;
|
||||
public ulong rblocks;
|
||||
public ulong rextents;
|
||||
public Guid uuid;
|
||||
public ulong logstat;
|
||||
public ulong rootino;
|
||||
public ulong rbmino;
|
||||
public ulong rsumino;
|
||||
public uint rextsize;
|
||||
public uint agblocks;
|
||||
public uint agcount;
|
||||
public uint rbmblocks;
|
||||
public uint logblocks;
|
||||
public ushort version;
|
||||
public ushort sectsize;
|
||||
public ushort inodesize;
|
||||
public ushort inopblock;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
|
||||
public readonly byte[] fname;
|
||||
public readonly byte blocklog;
|
||||
public readonly byte sectlog;
|
||||
public readonly byte inodelog;
|
||||
public readonly byte inopblog;
|
||||
public readonly byte agblklog;
|
||||
public readonly byte rextslog;
|
||||
public readonly byte inprogress;
|
||||
public readonly byte imax_pct;
|
||||
public readonly ulong icount;
|
||||
public readonly ulong ifree;
|
||||
public readonly ulong fdblocks;
|
||||
public readonly ulong frextents;
|
||||
public readonly ulong uquotino;
|
||||
public readonly ulong gquotino;
|
||||
public readonly ushort qflags;
|
||||
public readonly byte flags;
|
||||
public readonly byte shared_vn;
|
||||
public readonly ulong inoalignmt;
|
||||
public readonly ulong unit;
|
||||
public readonly ulong width;
|
||||
public readonly byte dirblklog;
|
||||
public readonly byte logsectlog;
|
||||
public readonly ushort logsectsize;
|
||||
public readonly uint logsunit;
|
||||
public readonly uint features2;
|
||||
public readonly uint bad_features2;
|
||||
public readonly uint features_compat;
|
||||
public readonly uint features_ro_compat;
|
||||
public readonly uint features_incompat;
|
||||
public readonly uint features_log_incompat;
|
||||
public byte[] fname;
|
||||
public byte blocklog;
|
||||
public byte sectlog;
|
||||
public byte inodelog;
|
||||
public byte inopblog;
|
||||
public byte agblklog;
|
||||
public byte rextslog;
|
||||
public byte inprogress;
|
||||
public byte imax_pct;
|
||||
public ulong icount;
|
||||
public ulong ifree;
|
||||
public ulong fdblocks;
|
||||
public ulong frextents;
|
||||
public ulong uquotino;
|
||||
public ulong gquotino;
|
||||
public ushort qflags;
|
||||
public byte flags;
|
||||
public byte shared_vn;
|
||||
public ulong inoalignmt;
|
||||
public ulong unit;
|
||||
public ulong width;
|
||||
public byte dirblklog;
|
||||
public byte logsectlog;
|
||||
public ushort logsectsize;
|
||||
public uint logsunit;
|
||||
public uint features2;
|
||||
public uint bad_features2;
|
||||
public uint features_compat;
|
||||
public uint features_ro_compat;
|
||||
public uint features_incompat;
|
||||
public uint features_log_incompat;
|
||||
|
||||
// This field is little-endian while rest of superblock is big-endian
|
||||
public readonly uint crc;
|
||||
public readonly uint spino_align;
|
||||
public readonly ulong pquotino;
|
||||
public readonly ulong lsn;
|
||||
public readonly Guid meta_uuid;
|
||||
public uint crc;
|
||||
public uint spino_align;
|
||||
public ulong pquotino;
|
||||
public ulong lsn;
|
||||
public Guid meta_uuid;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user