mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
Add recursiveness to BigEndianMarshal thanks to @darkstar suggestions.
This commit is contained in:
@@ -52,7 +52,7 @@ namespace DiscImageChef.Partitions
|
||||
readonly uint[] labelOffsets = {0, 9, 64, 128, 516};
|
||||
|
||||
public string Name => "BSD disklabel";
|
||||
public Guid Id => new Guid("246A6D93-4F1A-1F8A-344D-50187A5513A9");
|
||||
public Guid Id => new Guid("246A6D93-4F1A-1F8A-344D-50187A5513A9");
|
||||
|
||||
public bool GetInformation(IMediaImage imagePlugin, out List<Partition> partitions, ulong sectorOffset)
|
||||
{
|
||||
@@ -60,8 +60,8 @@ namespace DiscImageChef.Partitions
|
||||
uint run = (MAX_LABEL_SIZE + labelOffsets.Last()) / imagePlugin.Info.SectorSize;
|
||||
if((MAX_LABEL_SIZE + labelOffsets.Last()) % imagePlugin.Info.SectorSize > 0) run++;
|
||||
|
||||
DiskLabel dl = new DiskLabel();
|
||||
bool found = false;
|
||||
DiskLabel dl = new DiskLabel();
|
||||
bool found = false;
|
||||
|
||||
foreach(ulong location in labelLocations)
|
||||
{
|
||||
@@ -90,44 +90,46 @@ namespace DiscImageChef.Partitions
|
||||
|
||||
if(dl.d_magic == DISKCIGAM && dl.d_magic2 == DISKCIGAM) dl = SwapDiskLabel(dl);
|
||||
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_type = {0}", dl.d_type);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_type = {0}", dl.d_type);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_subtype = {0}", dl.d_subtype);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_typename = {0}", StringHandlers.CToString(dl.d_typename));
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_packname = {0}", StringHandlers.CToString(dl.d_packname));
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_secsize = {0}", dl.d_secsize);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_nsectors = {0}", dl.d_nsectors);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_ntracks = {0}", dl.d_ntracks);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_ncylinders = {0}", dl.d_ncylinders);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_secpercyl = {0}", dl.d_secpercyl);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_secperunit = {0}", dl.d_secperunit);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_typename = {0}",
|
||||
StringHandlers.CToString(dl.d_typename));
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_packname = {0}",
|
||||
StringHandlers.CToString(dl.d_packname));
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_secsize = {0}", dl.d_secsize);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_nsectors = {0}", dl.d_nsectors);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_ntracks = {0}", dl.d_ntracks);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_ncylinders = {0}", dl.d_ncylinders);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_secpercyl = {0}", dl.d_secpercyl);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_secperunit = {0}", dl.d_secperunit);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_sparespertrack = {0}", dl.d_sparespertrack);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_sparespercyl = {0}", dl.d_sparespercyl);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_acylinders = {0}", dl.d_acylinders);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_rpm = {0}", dl.d_rpm);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_interleave = {0}", dl.d_interleave);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_trackskew = {0}", dl.d_trackskew);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_cylskeew = {0}", dl.d_cylskeew);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_headswitch = {0}", dl.d_headswitch);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_trkseek = {0}", dl.d_trkseek);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_flags = {0}", dl.d_flags);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_drivedata[0] = {0}", dl.d_drivedata[0]);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_drivedata[1] = {0}", dl.d_drivedata[1]);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_drivedata[2] = {0}", dl.d_drivedata[2]);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_drivedata[3] = {0}", dl.d_drivedata[3]);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_drivedata[4] = {0}", dl.d_drivedata[4]);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_spare[0] = {0}", dl.d_spare[0]);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_spare[1] = {0}", dl.d_spare[1]);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_spare[2] = {0}", dl.d_spare[2]);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_spare[3] = {0}", dl.d_spare[3]);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_spare[4] = {0}", dl.d_spare[4]);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_magic2 = 0x{0:X8}", dl.d_magic2);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_checksum = 0x{0:X8}", dl.d_checksum);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_npartitions = {0}", dl.d_npartitions);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_bbsize = {0}", dl.d_bbsize);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_sbsize = {0}", dl.d_sbsize);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_sparespercyl = {0}", dl.d_sparespercyl);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_acylinders = {0}", dl.d_acylinders);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_rpm = {0}", dl.d_rpm);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_interleave = {0}", dl.d_interleave);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_trackskew = {0}", dl.d_trackskew);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_cylskeew = {0}", dl.d_cylskeew);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_headswitch = {0}", dl.d_headswitch);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_trkseek = {0}", dl.d_trkseek);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_flags = {0}", dl.d_flags);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_drivedata[0] = {0}", dl.d_drivedata[0]);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_drivedata[1] = {0}", dl.d_drivedata[1]);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_drivedata[2] = {0}", dl.d_drivedata[2]);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_drivedata[3] = {0}", dl.d_drivedata[3]);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_drivedata[4] = {0}", dl.d_drivedata[4]);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_spare[0] = {0}", dl.d_spare[0]);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_spare[1] = {0}", dl.d_spare[1]);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_spare[2] = {0}", dl.d_spare[2]);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_spare[3] = {0}", dl.d_spare[3]);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_spare[4] = {0}", dl.d_spare[4]);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_magic2 = 0x{0:X8}", dl.d_magic2);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_checksum = 0x{0:X8}", dl.d_checksum);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_npartitions = {0}", dl.d_npartitions);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_bbsize = {0}", dl.d_bbsize);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "dl.d_sbsize = {0}", dl.d_sbsize);
|
||||
|
||||
ulong counter = 0;
|
||||
bool addSectorOffset = false;
|
||||
ulong counter = 0;
|
||||
bool addSectorOffset = false;
|
||||
|
||||
for(int i = 0; i < dl.d_npartitions && i < 22; i++)
|
||||
{
|
||||
@@ -138,23 +140,25 @@ namespace DiscImageChef.Partitions
|
||||
dl.d_partitions[i].p_fstype, fsTypeToString(dl.d_partitions[i].p_fstype));
|
||||
Partition part = new Partition
|
||||
{
|
||||
Start = dl.d_partitions[i].p_offset * dl.d_secsize / imagePlugin.Info.SectorSize,
|
||||
Offset = dl.d_partitions[i].p_offset * dl.d_secsize,
|
||||
Length = dl.d_partitions[i].p_size * dl.d_secsize / imagePlugin.Info.SectorSize,
|
||||
Size = dl.d_partitions[i].p_size * dl.d_secsize,
|
||||
Type = fsTypeToString(dl.d_partitions[i].p_fstype),
|
||||
Start = dl.d_partitions[i].p_offset * dl.d_secsize / imagePlugin.Info.SectorSize,
|
||||
Offset = dl.d_partitions[i].p_offset * dl.d_secsize,
|
||||
Length = dl.d_partitions[i].p_size * dl.d_secsize / imagePlugin.Info.SectorSize,
|
||||
Size = dl.d_partitions[i].p_size * dl.d_secsize,
|
||||
Type = fsTypeToString(dl.d_partitions[i].p_fstype),
|
||||
Sequence = counter,
|
||||
Scheme = Name
|
||||
Scheme = Name
|
||||
};
|
||||
if(dl.d_partitions[i].p_fstype == fsType.Unused) continue;
|
||||
|
||||
// Crude and dirty way to know if the disklabel is relative to its parent partition...
|
||||
if(dl.d_partitions[i].p_offset < sectorOffset && !addSectorOffset) addSectorOffset = true;
|
||||
|
||||
if(addSectorOffset)
|
||||
{
|
||||
part.Start += sectorOffset;
|
||||
part.Start += sectorOffset;
|
||||
part.Offset += sectorOffset * imagePlugin.Info.SectorSize;
|
||||
}
|
||||
|
||||
DicConsole.DebugWriteLine("BSD plugin", "part.start = {0}", part.Start);
|
||||
DicConsole.DebugWriteLine("BSD plugin", "Adding it...");
|
||||
partitions.Add(part);
|
||||
@@ -168,54 +172,55 @@ namespace DiscImageChef.Partitions
|
||||
{
|
||||
switch(typ)
|
||||
{
|
||||
case fsType.Unused: return "Unused entry";
|
||||
case fsType.Swap: return "Swap partition";
|
||||
case fsType.V6: return "UNIX 6th Edition";
|
||||
case fsType.V7: return "UNIX 7th Edition";
|
||||
case fsType.Unused: return "Unused entry";
|
||||
case fsType.Swap: return "Swap partition";
|
||||
case fsType.V6: return "UNIX 6th Edition";
|
||||
case fsType.V7: return "UNIX 7th Edition";
|
||||
case fsType.SystemV: return "UNIX System V";
|
||||
case fsType.V7_1K: return "UNIX 7th Edition with 1K blocks";
|
||||
case fsType.V8: return "UNIX 8th Edition with 4K blocks";
|
||||
case fsType.BSDFFS: return "4.2BSD Fast File System";
|
||||
case fsType.BSDLFS: return "4.4LFS";
|
||||
case fsType.HPFS: return "HPFS";
|
||||
case fsType.V7_1K: return "UNIX 7th Edition with 1K blocks";
|
||||
case fsType.V8: return "UNIX 8th Edition with 4K blocks";
|
||||
case fsType.BSDFFS: return "4.2BSD Fast File System";
|
||||
case fsType.BSDLFS: return "4.4LFS";
|
||||
case fsType.HPFS: return "HPFS";
|
||||
case fsType.ISO9660: return "ISO9660";
|
||||
case fsType.Boot:
|
||||
case fsType.SysVBoot: return "Boot";
|
||||
case fsType.AFFS: return "Amiga FFS";
|
||||
case fsType.HFS: return "Apple HFS";
|
||||
case fsType.ADVfs: return "Digital Advanced File System";
|
||||
case fsType.LSMpublic: return "Digital LSM Public Region";
|
||||
case fsType.AFFS: return "Amiga FFS";
|
||||
case fsType.HFS: return "Apple HFS";
|
||||
case fsType.ADVfs: return "Digital Advanced File System";
|
||||
case fsType.LSMpublic: return "Digital LSM Public Region";
|
||||
case fsType.LSMprivate: return "Digital LSM Private Region";
|
||||
case fsType.LSMsimple: return "Digital LSM Simple Disk";
|
||||
case fsType.CCD: return "Concatenated disk";
|
||||
case fsType.JFS2: return "IBM JFS2";
|
||||
case fsType.HAMMER: return "Hammer";
|
||||
case fsType.HAMMER2: return "Hammer2";
|
||||
case fsType.UDF: return "UDF";
|
||||
case fsType.EFS: return "EFS";
|
||||
case fsType.ZFS: return "ZFS";
|
||||
case fsType.NANDFS: return "FreeBSD nandfs";
|
||||
case fsType.MSDOS: return "FAT";
|
||||
case fsType.Other: return "Other or unknown";
|
||||
default: return "Unknown";
|
||||
case fsType.LSMsimple: return "Digital LSM Simple Disk";
|
||||
case fsType.CCD: return "Concatenated disk";
|
||||
case fsType.JFS2: return "IBM JFS2";
|
||||
case fsType.HAMMER: return "Hammer";
|
||||
case fsType.HAMMER2: return "Hammer2";
|
||||
case fsType.UDF: return "UDF";
|
||||
case fsType.EFS: return "EFS";
|
||||
case fsType.ZFS: return "ZFS";
|
||||
case fsType.NANDFS: return "FreeBSD nandfs";
|
||||
case fsType.MSDOS: return "FAT";
|
||||
case fsType.Other: return "Other or unknown";
|
||||
default: return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
static DiskLabel GetDiskLabel(byte[] disklabel)
|
||||
{
|
||||
GCHandle handle = GCHandle.Alloc(disklabel, GCHandleType.Pinned);
|
||||
DiskLabel dl = (DiskLabel)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(DiskLabel));
|
||||
GCHandle handle = GCHandle.Alloc(disklabel, GCHandleType.Pinned);
|
||||
DiskLabel dl = (DiskLabel)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(DiskLabel));
|
||||
handle.Free();
|
||||
return dl;
|
||||
}
|
||||
|
||||
static DiskLabel SwapDiskLabel(DiskLabel disklabel)
|
||||
{
|
||||
DiskLabel dl = BigEndianMarshal.SwapStructureMembersEndian(disklabel);
|
||||
DiskLabel dl =
|
||||
(DiskLabel)BigEndianMarshal.SwapStructureMembersEndian(disklabel);
|
||||
for(int i = 0; i < dl.d_drivedata.Length; i++) dl.d_drivedata[i] = Swapping.Swap(dl.d_drivedata[i]);
|
||||
for(int i = 0; i < dl.d_spare.Length; i++) dl.d_spare[i] = Swapping.Swap(dl.d_spare[i]);
|
||||
for(int i = 0; i < dl.d_spare.Length; i++) dl.d_spare[i] = Swapping.Swap(dl.d_spare[i]);
|
||||
for(int i = 0; i < dl.d_partitions.Length; i++)
|
||||
dl.d_partitions[i] = BigEndianMarshal.SwapStructureMembersEndian(dl.d_partitions[i]);
|
||||
dl.d_partitions[i] = (BSDPartition)BigEndianMarshal.SwapStructureMembersEndian(dl.d_partitions[i]);
|
||||
|
||||
return dl;
|
||||
}
|
||||
@@ -382,9 +387,11 @@ namespace DiscImageChef.Partitions
|
||||
/// <summary>Disk subtype</summary>
|
||||
public ushort d_subtype;
|
||||
/// <summary>Type name</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] d_typename;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public byte[] d_typename;
|
||||
/// <summary>Pack identifier</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] d_packname;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public byte[] d_packname;
|
||||
/// <summary>Bytes per sector</summary>
|
||||
public uint d_secsize;
|
||||
/// <summary>Sectors per track</summary>
|
||||
@@ -420,9 +427,11 @@ namespace DiscImageChef.Partitions
|
||||
/// </summary>
|
||||
public dFlags d_flags;
|
||||
/// <summary>Drive-specific information</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public uint[] d_drivedata;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
|
||||
public uint[] d_drivedata;
|
||||
/// <summary>Reserved</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)] public uint[] d_spare;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
|
||||
public uint[] d_spare;
|
||||
/// <summary><see cref="DISKMAGIC" /> again</summary>
|
||||
public uint d_magic2;
|
||||
/// <summary>XOR of data</summary>
|
||||
@@ -434,7 +443,8 @@ namespace DiscImageChef.Partitions
|
||||
/// <summary>Maximum size of superblock in bytes</summary>
|
||||
public uint d_sbsize;
|
||||
/// <summary>Partitions</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 22)] public BSDPartition[] d_partitions;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 22)]
|
||||
public BSDPartition[] d_partitions;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
|
||||
@@ -45,14 +45,14 @@ namespace DiscImageChef.Partitions
|
||||
const uint X68K_MAGIC = 0x5836384B;
|
||||
|
||||
public string Name => "Human 68k partitions";
|
||||
public Guid Id => new Guid("246A6D93-4F1A-1F8A-344D-50187A5513A9");
|
||||
public Guid Id => new Guid("246A6D93-4F1A-1F8A-344D-50187A5513A9");
|
||||
|
||||
public bool GetInformation(IMediaImage imagePlugin, out List<Partition> partitions, ulong sectorOffset)
|
||||
{
|
||||
partitions = new List<Partition>();
|
||||
|
||||
byte[] sector;
|
||||
ulong sectsPerUnit;
|
||||
ulong sectsPerUnit;
|
||||
|
||||
DicConsole.DebugWriteLine("Human68k plugin", "sectorSize = {0}", imagePlugin.Info.SectorSize);
|
||||
|
||||
@@ -61,15 +61,15 @@ namespace DiscImageChef.Partitions
|
||||
switch(imagePlugin.Info.SectorSize)
|
||||
{
|
||||
case 256:
|
||||
sector = imagePlugin.ReadSector(4 + sectorOffset);
|
||||
sector = imagePlugin.ReadSector(4 + sectorOffset);
|
||||
sectsPerUnit = 1;
|
||||
break;
|
||||
case 512:
|
||||
sector = imagePlugin.ReadSector(4 + sectorOffset);
|
||||
sector = imagePlugin.ReadSector(4 + sectorOffset);
|
||||
sectsPerUnit = 2;
|
||||
break;
|
||||
case 1024:
|
||||
sector = imagePlugin.ReadSector(2 + sectorOffset);
|
||||
sector = imagePlugin.ReadSector(2 + sectorOffset);
|
||||
sectsPerUnit = 1;
|
||||
break;
|
||||
default: return false;
|
||||
@@ -82,10 +82,10 @@ namespace DiscImageChef.Partitions
|
||||
if(table.magic != X68K_MAGIC) return false;
|
||||
|
||||
for(int i = 0; i < table.entries.Length; i++)
|
||||
table.entries[i] = BigEndianMarshal.SwapStructureMembersEndian(table.entries[i]);
|
||||
table.entries[i] = (X68kEntry)BigEndianMarshal.SwapStructureMembersEndian(table.entries[i]);
|
||||
|
||||
DicConsole.DebugWriteLine("Human68k plugin", "table.size = {0:X4}", table.size);
|
||||
DicConsole.DebugWriteLine("Human68k plugin", "table.size2 = {0:X4}", table.size2);
|
||||
DicConsole.DebugWriteLine("Human68k plugin", "table.size = {0:X4}", table.size);
|
||||
DicConsole.DebugWriteLine("Human68k plugin", "table.size2 = {0:X4}", table.size2);
|
||||
DicConsole.DebugWriteLine("Human68k plugin", "table.unknown = {0:X4}", table.unknown);
|
||||
|
||||
ulong counter = 0;
|
||||
@@ -95,20 +95,20 @@ namespace DiscImageChef.Partitions
|
||||
DicConsole.DebugWriteLine("Human68k plugin", "entry.name = {0}",
|
||||
StringHandlers.CToString(entry.name, Encoding.GetEncoding(932)));
|
||||
DicConsole.DebugWriteLine("Human68k plugin", "entry.stateStart = {0}", entry.stateStart);
|
||||
DicConsole.DebugWriteLine("Human68k plugin", "entry.length = {0}", entry.length);
|
||||
DicConsole.DebugWriteLine("Human68k plugin", "entry.length = {0}", entry.length);
|
||||
DicConsole.DebugWriteLine("Human68k plugin", "sectsPerUnit = {0} {1}", sectsPerUnit,
|
||||
imagePlugin.Info.SectorSize);
|
||||
|
||||
Partition part = new Partition
|
||||
{
|
||||
Start = (entry.stateStart & 0xFFFFFF) * sectsPerUnit,
|
||||
Length = entry.length * sectsPerUnit,
|
||||
Type = StringHandlers.CToString(entry.name, Encoding.GetEncoding(932)),
|
||||
Start = (entry.stateStart & 0xFFFFFF) * sectsPerUnit,
|
||||
Length = entry.length * sectsPerUnit,
|
||||
Type = StringHandlers.CToString(entry.name, Encoding.GetEncoding(932)),
|
||||
Sequence = counter,
|
||||
Scheme = Name
|
||||
Scheme = Name
|
||||
};
|
||||
part.Offset = part.Start * (ulong)sector.Length;
|
||||
part.Size = part.Length * (ulong)sector.Length;
|
||||
part.Offset = part.Start * (ulong)sector.Length;
|
||||
part.Size = part.Length * (ulong)sector.Length;
|
||||
if(entry.length <= 0) continue;
|
||||
|
||||
partitions.Add(part);
|
||||
@@ -125,13 +125,15 @@ namespace DiscImageChef.Partitions
|
||||
public uint size;
|
||||
public uint size2;
|
||||
public uint unknown;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public X68kEntry[] entries;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
||||
public X68kEntry[] entries;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct X68kEntry
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] name;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
||||
public byte[] name;
|
||||
public uint stateStart;
|
||||
public uint length;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -65,13 +65,13 @@ namespace DiscImageChef.Partitions
|
||||
/// <summary>Size of padding in SunOS disk label</summary>
|
||||
const int LEN_DKL_PAD = DK_LABEL_SIZE - (LEN_DKL_ASCII + NDKMAP * 8 + 14 * 2);
|
||||
/// <summary>Size of padding in Solaris disk label with 8 partitions</summary>
|
||||
const int LEN_DKL_PAD8 = DK_LABEL_SIZE - (LEN_DKL_ASCII + 136 + // sizeof(dk_vtoc8)
|
||||
NDKMAP * 8 + 14 * 2 + 2 * 2);
|
||||
const int LEN_DKL_PAD16 = DK_LABEL_SIZE - (456 + // sizeof(dk_vtoc16)
|
||||
const int LEN_DKL_PAD8 = DK_LABEL_SIZE - (LEN_DKL_ASCII + 136 + // sizeof(dk_vtoc8)
|
||||
NDKMAP * 8 + 14 * 2 + 2 * 2);
|
||||
const int LEN_DKL_PAD16 = DK_LABEL_SIZE - (456 + // sizeof(dk_vtoc16)
|
||||
4 * 4 + 12 * 2 + 2 * 2);
|
||||
|
||||
public string Name => "Sun Disklabel";
|
||||
public Guid Id => new Guid("50F35CC4-8375-4445-8DCB-1BA550C931A3");
|
||||
public Guid Id => new Guid("50F35CC4-8375-4445-8DCB-1BA550C931A3");
|
||||
|
||||
public bool GetInformation(IMediaImage imagePlugin, out List<Partition> partitions, ulong sectorOffset)
|
||||
{
|
||||
@@ -85,42 +85,44 @@ namespace DiscImageChef.Partitions
|
||||
|
||||
byte[] sunSector = imagePlugin.ReadSector(sectorOffset);
|
||||
|
||||
GCHandle handle = GCHandle.Alloc(sunSector, GCHandleType.Pinned);
|
||||
dk_label dkl = (dk_label)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(dk_label));
|
||||
dk_label8 dkl8 = (dk_label8)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(dk_label8));
|
||||
dk_label16 dkl16 = (dk_label16)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(dk_label16));
|
||||
GCHandle handle = GCHandle.Alloc(sunSector, GCHandleType.Pinned);
|
||||
dk_label dkl = (dk_label)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(dk_label));
|
||||
dk_label8 dkl8 = (dk_label8)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(dk_label8));
|
||||
dk_label16 dkl16 = (dk_label16)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(dk_label16));
|
||||
handle.Free();
|
||||
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_magic = 0x{0:X4}", dkl.dkl_magic);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_vtoc.v_sanity = 0x{0:X8}", dkl8.dkl_vtoc.v_sanity);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_magic = 0x{0:X4}", dkl.dkl_magic);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_vtoc.v_sanity = 0x{0:X8}", dkl8.dkl_vtoc.v_sanity);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_sanity = 0x{0:X8}", dkl16.dkl_vtoc.v_sanity);
|
||||
|
||||
if(dkl.dkl_magic == DKL_MAGIC || dkl.dkl_magic == DKL_CIGAM)
|
||||
if(dkl16.dkl_vtoc.v_sanity == VTOC_SANE || dkl16.dkl_vtoc.v_sanity == VTOC_ENAS) useDkl16 = true;
|
||||
if(dkl16.dkl_vtoc.v_sanity == VTOC_SANE || dkl16.dkl_vtoc.v_sanity == VTOC_ENAS)
|
||||
useDkl16 = true;
|
||||
else if(dkl8.dkl_vtoc.v_sanity == VTOC_SANE || dkl8.dkl_vtoc.v_sanity == VTOC_ENAS) useDkl8 = true;
|
||||
else useDkl = true;
|
||||
else useDkl = true;
|
||||
|
||||
if(!useDkl && !useDkl8 && !useDkl16)
|
||||
{
|
||||
sunSector = imagePlugin.ReadSector(sectorOffset + 1);
|
||||
|
||||
handle = GCHandle.Alloc(sunSector, GCHandleType.Pinned);
|
||||
dkl = (dk_label)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(dk_label));
|
||||
dkl8 = (dk_label8)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(dk_label8));
|
||||
dkl16 = (dk_label16)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(dk_label16));
|
||||
dkl = (dk_label)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(dk_label));
|
||||
dkl8 = (dk_label8)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(dk_label8));
|
||||
dkl16 = (dk_label16)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(dk_label16));
|
||||
handle.Free();
|
||||
|
||||
if(dkl.dkl_magic == DKL_MAGIC || dkl.dkl_magic == DKL_CIGAM)
|
||||
if(dkl16.dkl_vtoc.v_sanity == VTOC_SANE || dkl16.dkl_vtoc.v_sanity == VTOC_ENAS) useDkl16 = true;
|
||||
if(dkl16.dkl_vtoc.v_sanity == VTOC_SANE || dkl16.dkl_vtoc.v_sanity == VTOC_ENAS)
|
||||
useDkl16 = true;
|
||||
else if(dkl8.dkl_vtoc.v_sanity == VTOC_SANE || dkl8.dkl_vtoc.v_sanity == VTOC_ENAS) useDkl8 = true;
|
||||
else useDkl = true;
|
||||
else useDkl = true;
|
||||
}
|
||||
|
||||
if(!useDkl && !useDkl8 && !useDkl16) return false;
|
||||
|
||||
if(useDkl16 && dkl16.dkl_magic == DKL_CIGAM) dkl16 = SwapDiskLabel(dkl16);
|
||||
else if(useDkl8 && dkl8.dkl_magic == DKL_CIGAM) dkl8 = SwapDiskLabel(dkl8);
|
||||
else if(useDkl && dkl.dkl_magic == DKL_CIGAM) dkl = SwapDiskLabel(dkl);
|
||||
if(useDkl16 && dkl16.dkl_magic == DKL_CIGAM) dkl16 = SwapDiskLabel(dkl16);
|
||||
else if(useDkl8 && dkl8.dkl_magic == DKL_CIGAM) dkl8 = SwapDiskLabel(dkl8);
|
||||
else if(useDkl && dkl.dkl_magic == DKL_CIGAM) dkl = SwapDiskLabel(dkl);
|
||||
|
||||
if(useDkl)
|
||||
{
|
||||
@@ -128,18 +130,18 @@ namespace DiscImageChef.Partitions
|
||||
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_asciilabel = \"{0}\"",
|
||||
StringHandlers.CToString(dkl.dkl_asciilabel));
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_rpm = {0}", dkl.dkl_rpm);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_pcyl = {0}", dkl.dkl_pcyl);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_apc = {0}", dkl.dkl_apc);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_gap1 = {0}", dkl.dkl_gap1);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_gap2 = {0}", dkl.dkl_gap2);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_rpm = {0}", dkl.dkl_rpm);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_pcyl = {0}", dkl.dkl_pcyl);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_apc = {0}", dkl.dkl_apc);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_gap1 = {0}", dkl.dkl_gap1);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_gap2 = {0}", dkl.dkl_gap2);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_intrlv = {0}", dkl.dkl_intrlv);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_ncyl = {0}", dkl.dkl_ncyl);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_acyl = {0}", dkl.dkl_acyl);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_nhead = {0}", dkl.dkl_nhead);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_nsect = {0}", dkl.dkl_nsect);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_bhead = {0}", dkl.dkl_bhead);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_ppart = {0}", dkl.dkl_ppart);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_ncyl = {0}", dkl.dkl_ncyl);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_acyl = {0}", dkl.dkl_acyl);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_nhead = {0}", dkl.dkl_nhead);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_nsect = {0}", dkl.dkl_nsect);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_bhead = {0}", dkl.dkl_bhead);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_ppart = {0}", dkl.dkl_ppart);
|
||||
for(int i = 0; i < NDKMAP; i++)
|
||||
{
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl.dkl_map[{0}].dkl_cylno = {1}", i,
|
||||
@@ -157,15 +159,14 @@ namespace DiscImageChef.Partitions
|
||||
{
|
||||
Partition part = new Partition
|
||||
{
|
||||
Size = (ulong)dkl.dkl_map[i].dkl_nblk * DK_LABEL_SIZE,
|
||||
Length =
|
||||
(ulong)(dkl.dkl_map[i].dkl_nblk * DK_LABEL_SIZE / imagePlugin.Info.SectorSize),
|
||||
Size = (ulong)dkl.dkl_map[i].dkl_nblk * DK_LABEL_SIZE,
|
||||
Length = (ulong)(dkl.dkl_map[i].dkl_nblk * DK_LABEL_SIZE / imagePlugin.Info.SectorSize),
|
||||
Sequence = (ulong)i,
|
||||
Offset =
|
||||
((ulong)dkl.dkl_map[i].dkl_cylno * sectorsPerCylinder + sectorOffset) * DK_LABEL_SIZE,
|
||||
Start = ((ulong)dkl.dkl_map[i].dkl_cylno * sectorsPerCylinder + sectorOffset) *
|
||||
DK_LABEL_SIZE / imagePlugin.Info.SectorSize,
|
||||
Type = "SunOS partition",
|
||||
Type = "SunOS partition",
|
||||
Scheme = Name
|
||||
};
|
||||
if(part.Start < imagePlugin.Info.Sectors && part.End <= imagePlugin.Info.Sectors)
|
||||
@@ -181,22 +182,22 @@ namespace DiscImageChef.Partitions
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_vtoc.v_version = {0}", dkl8.dkl_vtoc.v_version);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_vtoc.v_volume = \"{0}\"",
|
||||
StringHandlers.CToString(dkl8.dkl_vtoc.v_volume));
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_vtoc.v_nparts = {0}", dkl8.dkl_vtoc.v_nparts);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_vtoc.v_nparts = {0}", dkl8.dkl_vtoc.v_nparts);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_vtoc.v_sanity = 0x{0:X8}", dkl8.dkl_vtoc.v_sanity);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_write_reinstruct = {0}", dkl8.dkl_write_reinstruct);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_read_reinstruct = {0}", dkl8.dkl_read_reinstruct);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_rpm = {0}", dkl8.dkl_rpm);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_pcyl = {0}", dkl8.dkl_pcyl);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_apc = {0}", dkl8.dkl_apc);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_obs1 = {0}", dkl8.dkl_obs1);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_obs2 = {0}", dkl8.dkl_obs2);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_intrlv = {0}", dkl8.dkl_intrlv);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_ncyl = {0}", dkl8.dkl_ncyl);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_acyl = {0}", dkl8.dkl_acyl);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_nhead = {0}", dkl8.dkl_nhead);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_nsect = {0}", dkl8.dkl_nsect);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_obs3 = {0}", dkl8.dkl_obs3);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_obs4 = {0}", dkl8.dkl_obs4);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_write_reinstruct = {0}", dkl8.dkl_write_reinstruct);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_read_reinstruct = {0}", dkl8.dkl_read_reinstruct);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_rpm = {0}", dkl8.dkl_rpm);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_pcyl = {0}", dkl8.dkl_pcyl);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_apc = {0}", dkl8.dkl_apc);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_obs1 = {0}", dkl8.dkl_obs1);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_obs2 = {0}", dkl8.dkl_obs2);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_intrlv = {0}", dkl8.dkl_intrlv);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_ncyl = {0}", dkl8.dkl_ncyl);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_acyl = {0}", dkl8.dkl_acyl);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_nhead = {0}", dkl8.dkl_nhead);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_nsect = {0}", dkl8.dkl_nsect);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_obs3 = {0}", dkl8.dkl_obs3);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_obs4 = {0}", dkl8.dkl_obs4);
|
||||
for(int i = 0; i < NDKMAP; i++)
|
||||
{
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_map[{0}].dkl_cylno = {1}", i,
|
||||
@@ -213,18 +214,18 @@ namespace DiscImageChef.Partitions
|
||||
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_magic = 0x{0:X4}", dkl8.dkl_magic);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl8.dkl_cksum = 0x{0:X4}", dkl8.dkl_cksum);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "sectorsPerCylinder = {0}", sectorsPerCylinder);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "sectorsPerCylinder = {0}", sectorsPerCylinder);
|
||||
|
||||
if(dkl8.dkl_vtoc.v_nparts > NDKMAP) return false;
|
||||
|
||||
for(int i = 0; i < dkl8.dkl_vtoc.v_nparts; i++)
|
||||
if(dkl8.dkl_map[i].dkl_nblk > 0 && dkl8.dkl_vtoc.v_part[i].p_tag != SunTag.SunEmpty &&
|
||||
if(dkl8.dkl_map[i].dkl_nblk > 0 && dkl8.dkl_vtoc.v_part[i].p_tag != SunTag.SunEmpty &&
|
||||
dkl8.dkl_vtoc.v_part[i].p_tag != SunTag.SunWholeDisk)
|
||||
{
|
||||
Partition part = new Partition
|
||||
{
|
||||
Description = SunFlagsToString(dkl8.dkl_vtoc.v_part[i].p_flag),
|
||||
Size = (ulong)dkl8.dkl_map[i].dkl_nblk * DK_LABEL_SIZE,
|
||||
Size = (ulong)dkl8.dkl_map[i].dkl_nblk * DK_LABEL_SIZE,
|
||||
Length =
|
||||
(ulong)(dkl8.dkl_map[i].dkl_nblk * DK_LABEL_SIZE / imagePlugin.Info.SectorSize),
|
||||
Sequence = (ulong)i,
|
||||
@@ -232,7 +233,7 @@ namespace DiscImageChef.Partitions
|
||||
((ulong)dkl8.dkl_map[i].dkl_cylno * sectorsPerCylinder + sectorOffset) * DK_LABEL_SIZE,
|
||||
Start = ((ulong)dkl8.dkl_map[i].dkl_cylno * sectorsPerCylinder + sectorOffset) *
|
||||
DK_LABEL_SIZE / imagePlugin.Info.SectorSize,
|
||||
Type = SunIdToString(dkl8.dkl_vtoc.v_part[i].p_tag),
|
||||
Type = SunIdToString(dkl8.dkl_vtoc.v_part[i].p_tag),
|
||||
Scheme = Name
|
||||
};
|
||||
if(dkl8.dkl_vtoc.v_timestamp[i] != 0)
|
||||
@@ -246,25 +247,25 @@ namespace DiscImageChef.Partitions
|
||||
else
|
||||
{
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_sanity = 0x{0:X8}", dkl16.dkl_vtoc.v_sanity);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_version = {0}", dkl16.dkl_vtoc.v_version);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_version = {0}", dkl16.dkl_vtoc.v_version);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_volume = \"{0}\"",
|
||||
StringHandlers.CToString(dkl16.dkl_vtoc.v_volume));
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_sectorsz = {0}", dkl16.dkl_vtoc.v_sectorsz);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_nparts = {0}", dkl16.dkl_vtoc.v_nparts);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_nparts = {0}", dkl16.dkl_vtoc.v_nparts);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_asciilabel = \"{0}\"",
|
||||
StringHandlers.CToString(dkl16.dkl_vtoc.v_asciilabel));
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_pcyl = {0}", dkl16.dkl_pcyl);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_ncyl = {0}", dkl16.dkl_ncyl);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_acyl = {0}", dkl16.dkl_acyl);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_bcyl = {0}", dkl16.dkl_bcyl);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_nhead = {0}", dkl16.dkl_nhead);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_nsect = {0}", dkl16.dkl_nsect);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_intrlv = {0}", dkl16.dkl_intrlv);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_skew = {0}", dkl16.dkl_skew);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_apc = {0}", dkl16.dkl_apc);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_rpm = {0}", dkl16.dkl_rpm);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_pcyl = {0}", dkl16.dkl_pcyl);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_ncyl = {0}", dkl16.dkl_ncyl);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_acyl = {0}", dkl16.dkl_acyl);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_bcyl = {0}", dkl16.dkl_bcyl);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_nhead = {0}", dkl16.dkl_nhead);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_nsect = {0}", dkl16.dkl_nsect);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_intrlv = {0}", dkl16.dkl_intrlv);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_skew = {0}", dkl16.dkl_skew);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_apc = {0}", dkl16.dkl_apc);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_rpm = {0}", dkl16.dkl_rpm);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_write_reinstruct = {0}", dkl16.dkl_write_reinstruct);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_read_reinstruct = {0}", dkl16.dkl_read_reinstruct);
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_read_reinstruct = {0}", dkl16.dkl_read_reinstruct);
|
||||
for(int i = 0; i < NDKMAP16; i++)
|
||||
{
|
||||
DicConsole.DebugWriteLine("Sun plugin", "dkl16.dkl_vtoc.v_part[{0}].p_start = {1}", i,
|
||||
@@ -286,12 +287,12 @@ namespace DiscImageChef.Partitions
|
||||
|
||||
for(int i = 0; i < dkl16.dkl_vtoc.v_nparts; i++)
|
||||
if(dkl16.dkl_vtoc.v_part[i].p_size > 0 && dkl16.dkl_vtoc.v_part[i].p_tag != SunTag.SunEmpty &&
|
||||
dkl16.dkl_vtoc.v_part[i].p_tag != SunTag.SunWholeDisk)
|
||||
dkl16.dkl_vtoc.v_part[i].p_tag != SunTag.SunWholeDisk)
|
||||
{
|
||||
Partition part = new Partition
|
||||
{
|
||||
Description = SunFlagsToString(dkl16.dkl_vtoc.v_part[i].p_flag),
|
||||
Size = (ulong)dkl16.dkl_vtoc.v_part[i].p_size * dkl16.dkl_vtoc.v_sectorsz,
|
||||
Size = (ulong)dkl16.dkl_vtoc.v_part[i].p_size * dkl16.dkl_vtoc.v_sectorsz,
|
||||
Length =
|
||||
(ulong)(dkl16.dkl_vtoc.v_part[i].p_size * dkl16.dkl_vtoc.v_sectorsz /
|
||||
imagePlugin.Info.SectorSize),
|
||||
@@ -300,7 +301,7 @@ namespace DiscImageChef.Partitions
|
||||
((ulong)dkl16.dkl_vtoc.v_part[i].p_start + sectorOffset) * dkl16.dkl_vtoc.v_sectorsz,
|
||||
Start = ((ulong)dkl16.dkl_vtoc.v_part[i].p_start + sectorOffset) *
|
||||
dkl16.dkl_vtoc.v_sectorsz / imagePlugin.Info.SectorSize,
|
||||
Type = SunIdToString(dkl16.dkl_vtoc.v_part[i].p_tag),
|
||||
Type = SunIdToString(dkl16.dkl_vtoc.v_part[i].p_tag),
|
||||
Scheme = Name
|
||||
};
|
||||
if(dkl16.dkl_vtoc.v_timestamp[i] != 0)
|
||||
@@ -317,9 +318,9 @@ namespace DiscImageChef.Partitions
|
||||
static dk_label SwapDiskLabel(dk_label label)
|
||||
{
|
||||
DicConsole.DebugWriteLine("Sun plugin", "Swapping dk_label");
|
||||
dk_label lebal = BigEndianMarshal.SwapStructureMembersEndian(label);
|
||||
dk_label lebal = (dk_label)BigEndianMarshal.SwapStructureMembersEndian(label);
|
||||
for(int i = 0; i < label.dkl_map.Length; i++)
|
||||
lebal.dkl_map[i] = BigEndianMarshal.SwapStructureMembersEndian(label.dkl_map[i]);
|
||||
lebal.dkl_map[i] = (dk_map)BigEndianMarshal.SwapStructureMembersEndian(label.dkl_map[i]);
|
||||
|
||||
return lebal;
|
||||
}
|
||||
@@ -327,17 +328,17 @@ namespace DiscImageChef.Partitions
|
||||
static dk_label8 SwapDiskLabel(dk_label8 label)
|
||||
{
|
||||
DicConsole.DebugWriteLine("Sun plugin", "Swapping dk_label8");
|
||||
dk_label8 lebal = BigEndianMarshal.SwapStructureMembersEndian(label);
|
||||
lebal.dkl_vtoc = BigEndianMarshal.SwapStructureMembersEndian(label.dkl_vtoc);
|
||||
dk_label8 lebal = (dk_label8)BigEndianMarshal.SwapStructureMembersEndian(label);
|
||||
for(int i = 0; i < label.dkl_map.Length; i++)
|
||||
lebal.dkl_map[i] = BigEndianMarshal.SwapStructureMembersEndian(label.dkl_map[i]);
|
||||
lebal.dkl_map[i] = (dk_map)BigEndianMarshal.SwapStructureMembersEndian(label.dkl_map[i]);
|
||||
for(int i = 0; i < label.dkl_vtoc.v_bootinfo.Length; i++)
|
||||
lebal.dkl_vtoc.v_bootinfo[i] = Swapping.Swap(label.dkl_vtoc.v_bootinfo[i]);
|
||||
for(int i = 0; i < label.dkl_vtoc.v_part.Length; i++)
|
||||
{
|
||||
lebal.dkl_vtoc.v_part[i].p_flag = (SunFlags)Swapping.Swap((ushort)label.dkl_vtoc.v_part[i].p_flag);
|
||||
lebal.dkl_vtoc.v_part[i].p_tag = (SunTag)Swapping.Swap((ushort)label.dkl_vtoc.v_part[i].p_tag);
|
||||
lebal.dkl_vtoc.v_part[i].p_tag = (SunTag)Swapping.Swap((ushort)label.dkl_vtoc.v_part[i].p_tag);
|
||||
}
|
||||
|
||||
for(int i = 0; i < label.dkl_vtoc.v_timestamp.Length; i++)
|
||||
lebal.dkl_vtoc.v_timestamp[i] = Swapping.Swap(label.dkl_vtoc.v_timestamp[i]);
|
||||
for(int i = 0; i < label.dkl_vtoc.v_reserved.Length; i++)
|
||||
@@ -349,17 +350,17 @@ namespace DiscImageChef.Partitions
|
||||
static dk_label16 SwapDiskLabel(dk_label16 label)
|
||||
{
|
||||
DicConsole.DebugWriteLine("Sun plugin", "Swapping dk_label16");
|
||||
dk_label16 lebal = BigEndianMarshal.SwapStructureMembersEndian(label);
|
||||
lebal.dkl_vtoc = BigEndianMarshal.SwapStructureMembersEndian(label.dkl_vtoc);
|
||||
dk_label16 lebal = (dk_label16)BigEndianMarshal.SwapStructureMembersEndian(label);
|
||||
for(int i = 0; i < label.dkl_vtoc.v_bootinfo.Length; i++)
|
||||
lebal.dkl_vtoc.v_bootinfo[i] = Swapping.Swap(label.dkl_vtoc.v_bootinfo[i]);
|
||||
for(int i = 0; i < label.dkl_vtoc.v_part.Length; i++)
|
||||
{
|
||||
lebal.dkl_vtoc.v_part[i].p_flag = (SunFlags)Swapping.Swap((ushort)label.dkl_vtoc.v_part[i].p_flag);
|
||||
lebal.dkl_vtoc.v_part[i].p_tag = (SunTag)Swapping.Swap((ushort)label.dkl_vtoc.v_part[i].p_tag);
|
||||
lebal.dkl_vtoc.v_part[i].p_size = Swapping.Swap(label.dkl_vtoc.v_part[i].p_size);
|
||||
lebal.dkl_vtoc.v_part[i].p_flag = (SunFlags)Swapping.Swap((ushort)label.dkl_vtoc.v_part[i].p_flag);
|
||||
lebal.dkl_vtoc.v_part[i].p_tag = (SunTag)Swapping.Swap((ushort)label.dkl_vtoc.v_part[i].p_tag);
|
||||
lebal.dkl_vtoc.v_part[i].p_size = Swapping.Swap(label.dkl_vtoc.v_part[i].p_size);
|
||||
lebal.dkl_vtoc.v_part[i].p_start = Swapping.Swap(label.dkl_vtoc.v_part[i].p_start);
|
||||
}
|
||||
|
||||
for(int i = 0; i < label.dkl_vtoc.v_timestamp.Length; i++)
|
||||
lebal.dkl_vtoc.v_timestamp[i] = Swapping.Swap(label.dkl_vtoc.v_timestamp[i]);
|
||||
for(int i = 0; i < label.dkl_vtoc.v_reserved.Length; i++)
|
||||
@@ -380,66 +381,66 @@ namespace DiscImageChef.Partitions
|
||||
{
|
||||
switch(id)
|
||||
{
|
||||
case SunTag.Linux: return "Linux";
|
||||
case SunTag.LinuxRaid: return "Linux RAID";
|
||||
case SunTag.LinuxSwap: return "Linux swap";
|
||||
case SunTag.LVM: return "LVM";
|
||||
case SunTag.SunBoot: return "Sun boot";
|
||||
case SunTag.SunEmpty: return "Empty";
|
||||
case SunTag.SunHome: return "Sun /home";
|
||||
case SunTag.SunRoot: return "Sun /";
|
||||
case SunTag.SunStand: return "Sun /stand";
|
||||
case SunTag.SunSwap: return "Sun swap";
|
||||
case SunTag.SunUsr: return "Sun /usr";
|
||||
case SunTag.SunVar: return "Sun /var";
|
||||
case SunTag.SunWholeDisk: return "Whole disk";
|
||||
case SunTag.SunAlt: return "Replacement sectors";
|
||||
case SunTag.SunCache: return "Sun cachefs";
|
||||
case SunTag.SunReserved: return "Reserved for SMI";
|
||||
case SunTag.VxVmPublic: return "Veritas public";
|
||||
case SunTag.VxVmPrivate: return "Veritas private";
|
||||
case SunTag.NetBSD: return "NetBSD";
|
||||
case SunTag.FreeBSD_Swap: return "FreeBSD swap";
|
||||
case SunTag.FreeBSD_UFS: return "FreeBSD";
|
||||
case SunTag.FreeBSD_Vinum: return "Vinum";
|
||||
case SunTag.FreeBSD_ZFS: return "FreeBSD ZFS";
|
||||
case SunTag.Linux: return "Linux";
|
||||
case SunTag.LinuxRaid: return "Linux RAID";
|
||||
case SunTag.LinuxSwap: return "Linux swap";
|
||||
case SunTag.LVM: return "LVM";
|
||||
case SunTag.SunBoot: return "Sun boot";
|
||||
case SunTag.SunEmpty: return "Empty";
|
||||
case SunTag.SunHome: return "Sun /home";
|
||||
case SunTag.SunRoot: return "Sun /";
|
||||
case SunTag.SunStand: return "Sun /stand";
|
||||
case SunTag.SunSwap: return "Sun swap";
|
||||
case SunTag.SunUsr: return "Sun /usr";
|
||||
case SunTag.SunVar: return "Sun /var";
|
||||
case SunTag.SunWholeDisk: return "Whole disk";
|
||||
case SunTag.SunAlt: return "Replacement sectors";
|
||||
case SunTag.SunCache: return "Sun cachefs";
|
||||
case SunTag.SunReserved: return "Reserved for SMI";
|
||||
case SunTag.VxVmPublic: return "Veritas public";
|
||||
case SunTag.VxVmPrivate: return "Veritas private";
|
||||
case SunTag.NetBSD: return "NetBSD";
|
||||
case SunTag.FreeBSD_Swap: return "FreeBSD swap";
|
||||
case SunTag.FreeBSD_UFS: return "FreeBSD";
|
||||
case SunTag.FreeBSD_Vinum: return "Vinum";
|
||||
case SunTag.FreeBSD_ZFS: return "FreeBSD ZFS";
|
||||
case SunTag.FreeBSD_NANDFS: return "FreeBSD nandfs";
|
||||
default: return "Unknown";
|
||||
default: return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
enum SunTag : ushort
|
||||
{
|
||||
SunEmpty = 0x0000,
|
||||
SunBoot = 0x0001,
|
||||
SunRoot = 0x0002,
|
||||
SunSwap = 0x0003,
|
||||
SunUsr = 0x0004,
|
||||
SunWholeDisk = 0x0005,
|
||||
SunStand = 0x0006,
|
||||
SunVar = 0x0007,
|
||||
SunHome = 0x0008,
|
||||
SunAlt = 0x0009,
|
||||
SunCache = 0x000A,
|
||||
SunReserved = 0x000B,
|
||||
VxVmPublic = 0x000E,
|
||||
VxVmPrivate = 0x000F,
|
||||
LinuxSwap = 0x0082,
|
||||
Linux = 0x0083,
|
||||
LVM = 0x008E,
|
||||
LinuxRaid = 0x00FD,
|
||||
NetBSD = 0x00FF,
|
||||
FreeBSD_Swap = 0x0901,
|
||||
FreeBSD_UFS = 0x0902,
|
||||
FreeBSD_Vinum = 0x0903,
|
||||
FreeBSD_ZFS = 0x0904,
|
||||
SunEmpty = 0x0000,
|
||||
SunBoot = 0x0001,
|
||||
SunRoot = 0x0002,
|
||||
SunSwap = 0x0003,
|
||||
SunUsr = 0x0004,
|
||||
SunWholeDisk = 0x0005,
|
||||
SunStand = 0x0006,
|
||||
SunVar = 0x0007,
|
||||
SunHome = 0x0008,
|
||||
SunAlt = 0x0009,
|
||||
SunCache = 0x000A,
|
||||
SunReserved = 0x000B,
|
||||
VxVmPublic = 0x000E,
|
||||
VxVmPrivate = 0x000F,
|
||||
LinuxSwap = 0x0082,
|
||||
Linux = 0x0083,
|
||||
LVM = 0x008E,
|
||||
LinuxRaid = 0x00FD,
|
||||
NetBSD = 0x00FF,
|
||||
FreeBSD_Swap = 0x0901,
|
||||
FreeBSD_UFS = 0x0902,
|
||||
FreeBSD_Vinum = 0x0903,
|
||||
FreeBSD_ZFS = 0x0904,
|
||||
FreeBSD_NANDFS = 0x0905
|
||||
}
|
||||
|
||||
[Flags]
|
||||
enum SunFlags : ushort
|
||||
{
|
||||
NoMount = 0x0001,
|
||||
NoMount = 0x0001,
|
||||
ReadOnly = 0x0010
|
||||
}
|
||||
|
||||
@@ -458,9 +459,11 @@ namespace DiscImageChef.Partitions
|
||||
struct dk_label
|
||||
{
|
||||
/// <summary>Informative string</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_ASCII)] public byte[] dkl_asciilabel;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_ASCII)]
|
||||
public byte[] dkl_asciilabel;
|
||||
/// <summary>Padding</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_PAD)] public byte[] dkl_pad;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_PAD)]
|
||||
public byte[] dkl_pad;
|
||||
/// <summary>rotations per minute</summary>
|
||||
public ushort dkl_rpm;
|
||||
/// <summary># physical cylinders</summary>
|
||||
@@ -486,7 +489,8 @@ namespace DiscImageChef.Partitions
|
||||
/// <summary>physical partition #</summary>
|
||||
public ushort dkl_ppart;
|
||||
/// <summary>Logical partitions</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NDKMAP)] public dk_map[] dkl_map;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NDKMAP)]
|
||||
public dk_map[] dkl_map;
|
||||
/// <summary>identifies this label format</summary>
|
||||
public ushort dkl_magic;
|
||||
/// <summary>xor checksum of sector</summary>
|
||||
@@ -523,53 +527,65 @@ namespace DiscImageChef.Partitions
|
||||
/// <summary> layout version</summary>
|
||||
public uint v_version;
|
||||
/// <summary> volume name</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_VVOL)] public byte[] v_volume;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_VVOL)]
|
||||
public byte[] v_volume;
|
||||
/// <summary> number of partitions </summary>
|
||||
public ushort v_nparts;
|
||||
/// <summary> partition hdrs, sec 2</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NDKMAP)] public dk_map2[] v_part;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NDKMAP)]
|
||||
public dk_map2[] v_part;
|
||||
/// <summary>Alignment</summary>
|
||||
public ushort padding;
|
||||
/// <summary> info needed by mboot</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public uint[] v_bootinfo;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
public uint[] v_bootinfo;
|
||||
/// <summary> to verify vtoc sanity</summary>
|
||||
public uint v_sanity;
|
||||
/// <summary> free space</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public uint[] v_reserved;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
|
||||
public uint[] v_reserved;
|
||||
/// <summary> partition timestamp</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NDKMAP)] public int[] v_timestamp;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NDKMAP)]
|
||||
public int[] v_timestamp;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct dk_vtoc16
|
||||
{
|
||||
/// <summary>info needed by mboot</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)] public uint[] v_bootinfo;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
public uint[] v_bootinfo;
|
||||
/// <summary>to verify vtoc sanity</summary>
|
||||
public uint v_sanity;
|
||||
/// <summary>layout version</summary>
|
||||
public uint v_version;
|
||||
/// <summary>volume name</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_VVOL)] public byte[] v_volume;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_VVOL)]
|
||||
public byte[] v_volume;
|
||||
/// <summary>sector size in bytes</summary>
|
||||
public ushort v_sectorsz;
|
||||
/// <summary>number of partitions</summary>
|
||||
public ushort v_nparts;
|
||||
/// <summary>free space</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)] public uint[] v_reserved;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
|
||||
public uint[] v_reserved;
|
||||
/// <summary>partition headers</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NDKMAP16)] public dkl_partition[] v_part;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NDKMAP16)]
|
||||
public dkl_partition[] v_part;
|
||||
/// <summary>partition timestamp</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NDKMAP16)] public int[] v_timestamp;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NDKMAP16)]
|
||||
public int[] v_timestamp;
|
||||
/// <summary>for compatibility</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_ASCII)] public byte[] v_asciilabel;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_ASCII)]
|
||||
public byte[] v_asciilabel;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct dk_label8
|
||||
{
|
||||
/// <summary>for compatibility</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_ASCII)] public byte[] dkl_asciilabel;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_ASCII)]
|
||||
public byte[] dkl_asciilabel;
|
||||
/// <summary>vtoc inclusions from AT&T SVr4</summary>
|
||||
public dk_vtoc8 dkl_vtoc;
|
||||
/// <summary># sectors to skip, writes</summary>
|
||||
@@ -577,7 +593,8 @@ namespace DiscImageChef.Partitions
|
||||
/// <summary># sectors to skip, reads</summary>
|
||||
public ushort dkl_read_reinstruct;
|
||||
/// <summary>unused part of 512 bytes</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_PAD8)] public byte[] dkl_pad;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_PAD8)]
|
||||
public byte[] dkl_pad;
|
||||
/// <summary>rotations per minute</summary>
|
||||
public ushort dkl_rpm;
|
||||
/// <summary># physical cylinders</summary>
|
||||
@@ -603,7 +620,8 @@ namespace DiscImageChef.Partitions
|
||||
/// <summary>obsolete</summary>
|
||||
public ushort dkl_obs4;
|
||||
/// <summary>logical partition headers</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NDKMAP)] public dk_map[] dkl_map;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NDKMAP)]
|
||||
public dk_map[] dkl_map;
|
||||
/// <summary>identifies this label format</summary>
|
||||
public ushort dkl_magic;
|
||||
/// <summary>xor checksum of sector</summary>
|
||||
@@ -640,9 +658,11 @@ namespace DiscImageChef.Partitions
|
||||
/// <summary># sectors to skip, reads </summary>
|
||||
public ushort dkl_read_reinstruct;
|
||||
/// <summary>for compatible expansion</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public ushort[] dkl_extra;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
|
||||
public ushort[] dkl_extra;
|
||||
/// <summary>unused part of 512 bytes</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_PAD16)] public byte[] dkl_pad;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LEN_DKL_PAD16)]
|
||||
public byte[] dkl_pad;
|
||||
/// <summary>identifies this label format</summary>
|
||||
public ushort dkl_magic;
|
||||
/// <summary>xor checksum of sector</summary>
|
||||
|
||||
Reference in New Issue
Block a user