mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Add recursiveness to BigEndianMarshal thanks to @darkstar suggestions.
This commit is contained in:
@@ -49,7 +49,7 @@ namespace DiscImageChef.Partitions
|
||||
const int SGI_MAGIC = 0x0BE5A941;
|
||||
|
||||
public string Name => "SGI Disk Volume Header";
|
||||
public Guid Id => new Guid("AEF5AB45-4880-4CE8-8735-F0A402E2E5F2");
|
||||
public Guid Id => new Guid("AEF5AB45-4880-4CE8-8735-F0A402E2E5F2");
|
||||
|
||||
public bool GetInformation(IMediaImage imagePlugin, out List<Partition> partitions, ulong sectorOffset)
|
||||
{
|
||||
@@ -60,11 +60,9 @@ namespace DiscImageChef.Partitions
|
||||
|
||||
SGILabel dvh = BigEndianMarshal.ByteArrayToStructureBigEndian<SGILabel>(sector);
|
||||
for(int i = 0; i < dvh.volume.Length; i++)
|
||||
dvh.volume[i] = BigEndianMarshal.SwapStructureMembersEndian(dvh.volume[i]);
|
||||
dvh.volume[i] = (SGIVolume)BigEndianMarshal.SwapStructureMembersEndian(dvh.volume[i]);
|
||||
for(int i = 0; i < dvh.partitions.Length; i++)
|
||||
dvh.partitions[i] = BigEndianMarshal.SwapStructureMembersEndian(dvh.partitions[i]);
|
||||
|
||||
dvh.device_params = BigEndianMarshal.SwapStructureMembersEndian(dvh.device_params);
|
||||
dvh.partitions[i] = (SGIPartition)BigEndianMarshal.SwapStructureMembersEndian(dvh.partitions[i]);
|
||||
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.magic = 0x{0:X8} (should be 0x{1:X8})", dvh.magic,
|
||||
SGI_MAGIC);
|
||||
@@ -80,13 +78,13 @@ namespace DiscImageChef.Partitions
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_gap2 = {0}", dvh.device_params.dp_gap2);
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_spares_cyl = {0}",
|
||||
dvh.device_params.dp_spares_cyl);
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_cyls = {0}", dvh.device_params.dp_cyls);
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_shd0 = {0}", dvh.device_params.dp_shd0);
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_cyls = {0}", dvh.device_params.dp_cyls);
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_shd0 = {0}", dvh.device_params.dp_shd0);
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_trks0 = {0}", dvh.device_params.dp_trks0);
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_ctq_depth = {0}",
|
||||
dvh.device_params.dp_ctq_depth);
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_cylshi = {0}", dvh.device_params.dp_cylshi);
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_secs = {0}", dvh.device_params.dp_secs);
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_secs = {0}", dvh.device_params.dp_secs);
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_secbytes = {0}",
|
||||
dvh.device_params.dp_secbytes);
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_interleave = {0}",
|
||||
@@ -96,11 +94,11 @@ namespace DiscImageChef.Partitions
|
||||
dvh.device_params.dp_datarate);
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_nretries = {0}",
|
||||
dvh.device_params.dp_nretries);
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_mspw = {0}", dvh.device_params.dp_mspw);
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_xgap1 = {0}", dvh.device_params.dp_xgap1);
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_xsync = {0}", dvh.device_params.dp_xsync);
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_xrdly = {0}", dvh.device_params.dp_xrdly);
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_xgap2 = {0}", dvh.device_params.dp_xgap2);
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_mspw = {0}", dvh.device_params.dp_mspw);
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_xgap1 = {0}", dvh.device_params.dp_xgap1);
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_xsync = {0}", dvh.device_params.dp_xsync);
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_xrdly = {0}", dvh.device_params.dp_xrdly);
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_xgap2 = {0}", dvh.device_params.dp_xgap2);
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_xrgate = {0}", dvh.device_params.dp_xrgate);
|
||||
DicConsole.DebugWriteLine("SGIVH plugin", "dvh.device_params.dp_xwcont = {0}", dvh.device_params.dp_xwcont);
|
||||
|
||||
@@ -118,15 +116,19 @@ namespace DiscImageChef.Partitions
|
||||
|
||||
Partition part = new Partition
|
||||
{
|
||||
Start = dvh.partitions[i].first_block * dvh.device_params.dp_secbytes / imagePlugin.Info.SectorSize,
|
||||
Offset = dvh.partitions[i].first_block * dvh.device_params.dp_secbytes,
|
||||
Length = dvh.partitions[i].num_blocks * dvh.device_params.dp_secbytes / imagePlugin.Info.SectorSize,
|
||||
Size = dvh.partitions[i].num_blocks * dvh.device_params.dp_secbytes,
|
||||
Type = TypeToString(dvh.partitions[i].type),
|
||||
Start = dvh.partitions[i].first_block * dvh.device_params.dp_secbytes /
|
||||
imagePlugin.Info.SectorSize,
|
||||
Offset = dvh.partitions[i].first_block *
|
||||
dvh.device_params.dp_secbytes,
|
||||
Length = dvh.partitions[i].num_blocks * dvh.device_params.dp_secbytes /
|
||||
imagePlugin.Info.SectorSize,
|
||||
Size = dvh.partitions[i].num_blocks *
|
||||
dvh.device_params.dp_secbytes,
|
||||
Type = TypeToString(dvh.partitions[i].type),
|
||||
Sequence = counter,
|
||||
Scheme = Name
|
||||
Scheme = Name
|
||||
};
|
||||
if(part.Size <= 0 || dvh.partitions[i].type == SGIType.Header ||
|
||||
if(part.Size <= 0 || dvh.partitions[i].type == SGIType.Header ||
|
||||
dvh.partitions[i].type == SGIType.Volume) continue;
|
||||
|
||||
partitions.Add(part);
|
||||
@@ -140,24 +142,24 @@ namespace DiscImageChef.Partitions
|
||||
{
|
||||
switch(typ)
|
||||
{
|
||||
case SGIType.Header: return "Volume header";
|
||||
case SGIType.TrkRepl: return "Track replacements";
|
||||
case SGIType.SecRepl: return "Sector replacements";
|
||||
case SGIType.Swap: return "Raw data (swap)";
|
||||
case SGIType.Bsd: return "4.2BSD Fast File System";
|
||||
case SGIType.SystemV: return "UNIX System V";
|
||||
case SGIType.Volume: return "Whole device";
|
||||
case SGIType.EFS: return "EFS";
|
||||
case SGIType.Lvol: return "Logical volume";
|
||||
case SGIType.Rlvol: return "Raw logical volume";
|
||||
case SGIType.XFS: return "XFS";
|
||||
case SGIType.Xlvol: return "XFS log device";
|
||||
case SGIType.Rxlvol: return "XLV volume";
|
||||
case SGIType.Xvm: return "SGI XVM";
|
||||
case SGIType.Header: return "Volume header";
|
||||
case SGIType.TrkRepl: return "Track replacements";
|
||||
case SGIType.SecRepl: return "Sector replacements";
|
||||
case SGIType.Swap: return "Raw data (swap)";
|
||||
case SGIType.Bsd: return "4.2BSD Fast File System";
|
||||
case SGIType.SystemV: return "UNIX System V";
|
||||
case SGIType.Volume: return "Whole device";
|
||||
case SGIType.EFS: return "EFS";
|
||||
case SGIType.Lvol: return "Logical volume";
|
||||
case SGIType.Rlvol: return "Raw logical volume";
|
||||
case SGIType.XFS: return "XFS";
|
||||
case SGIType.Xlvol: return "XFS log device";
|
||||
case SGIType.Rxlvol: return "XLV volume";
|
||||
case SGIType.Xvm: return "SGI XVM";
|
||||
case SGIType.LinuxSwap: return "Linux swap";
|
||||
case SGIType.Linux: return "Linux";
|
||||
case SGIType.Linux: return "Linux";
|
||||
case SGIType.LinuxRAID: return "Linux RAID";
|
||||
default: return "Unknown";
|
||||
default: return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,13 +173,16 @@ namespace DiscImageChef.Partitions
|
||||
/// <summary></summary>
|
||||
public short swap_part_num;
|
||||
/// <summary></summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] boot_file;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public byte[] boot_file;
|
||||
/// <summary></summary>
|
||||
public SGIDeviceParameters device_params;
|
||||
/// <summary></summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)] public SGIVolume[] volume;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)]
|
||||
public SGIVolume[] volume;
|
||||
/// <summary></summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public SGIPartition[] partitions;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public SGIPartition[] partitions;
|
||||
/// <summary></summary>
|
||||
public uint csum;
|
||||
/// <summary></summary>
|
||||
@@ -188,7 +193,8 @@ namespace DiscImageChef.Partitions
|
||||
struct SGIVolume
|
||||
{
|
||||
/// <summary></summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] name;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
||||
public byte[] name;
|
||||
/// <summary></summary>
|
||||
public uint block_num;
|
||||
/// <summary></summary>
|
||||
@@ -197,22 +203,22 @@ namespace DiscImageChef.Partitions
|
||||
|
||||
enum SGIType : uint
|
||||
{
|
||||
Header = 0,
|
||||
TrkRepl = 1,
|
||||
SecRepl = 2,
|
||||
Swap = 3,
|
||||
Bsd = 4,
|
||||
SystemV = 5,
|
||||
Volume = 6,
|
||||
EFS = 7,
|
||||
Lvol = 8,
|
||||
Rlvol = 9,
|
||||
XFS = 0xA,
|
||||
Xlvol = 0xB,
|
||||
Rxlvol = 0xC,
|
||||
Xvm = 0x0D,
|
||||
Header = 0,
|
||||
TrkRepl = 1,
|
||||
SecRepl = 2,
|
||||
Swap = 3,
|
||||
Bsd = 4,
|
||||
SystemV = 5,
|
||||
Volume = 6,
|
||||
EFS = 7,
|
||||
Lvol = 8,
|
||||
Rlvol = 9,
|
||||
XFS = 0xA,
|
||||
Xlvol = 0xB,
|
||||
Rxlvol = 0xC,
|
||||
Xvm = 0x0D,
|
||||
LinuxSwap = 0x82,
|
||||
Linux = 0x83,
|
||||
Linux = 0x83,
|
||||
LinuxRAID = 0xFD
|
||||
}
|
||||
|
||||
@@ -229,23 +235,23 @@ namespace DiscImageChef.Partitions
|
||||
|
||||
struct SGIDeviceParameters
|
||||
{
|
||||
public byte dp_skew;
|
||||
public byte dp_gap1;
|
||||
public byte dp_gap2;
|
||||
public byte dp_spares_cyl;
|
||||
public byte dp_skew;
|
||||
public byte dp_gap1;
|
||||
public byte dp_gap2;
|
||||
public byte dp_spares_cyl;
|
||||
public ushort dp_cyls;
|
||||
public ushort dp_shd0;
|
||||
public ushort dp_trks0;
|
||||
public byte dp_ctq_depth;
|
||||
public byte dp_cylshi;
|
||||
public byte dp_ctq_depth;
|
||||
public byte dp_cylshi;
|
||||
public ushort dp_unused;
|
||||
public ushort dp_secs;
|
||||
public ushort dp_secbytes;
|
||||
public ushort dp_interleave;
|
||||
public uint dp_flags;
|
||||
public uint dp_datarate;
|
||||
public uint dp_nretries;
|
||||
public uint dp_mspw;
|
||||
public uint dp_flags;
|
||||
public uint dp_datarate;
|
||||
public uint dp_nretries;
|
||||
public uint dp_mspw;
|
||||
public ushort dp_xgap1;
|
||||
public ushort dp_xsync;
|
||||
public ushort dp_xrdly;
|
||||
|
||||
Reference in New Issue
Block a user