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