2016-07-28 18:13:49 +01:00
|
|
|
// /***************************************************************************
|
|
|
|
|
// The Disc Image Chef
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// Filename : NeXT.cs
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
//
|
|
|
|
|
// Component : Partitioning scheme plugins.
|
|
|
|
|
//
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// Manages NeXTStep and OpenStep disklabels.
|
|
|
|
|
//
|
|
|
|
|
// --[ License ] --------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// This library is free software; you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU Lesser General Public License as
|
|
|
|
|
// published by the Free Software Foundation; either version 2.1 of the
|
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
//
|
|
|
|
|
// This library is distributed in the hope that it will be useful, but
|
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
|
//
|
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
//
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2017-12-19 03:50:57 +00:00
|
|
|
// Copyright © 2011-2018 Natalia Portillo
|
2016-07-28 18:13:49 +01:00
|
|
|
// ****************************************************************************/
|
2014-04-17 19:58:14 +00:00
|
|
|
|
2011-03-25 20:45:28 +00:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2017-12-21 07:08:26 +00:00
|
|
|
using System.Linq;
|
2017-07-13 01:55:48 +01:00
|
|
|
using System.Runtime.InteropServices;
|
2014-04-14 02:29:13 +00:00
|
|
|
using System.Text;
|
2017-12-21 14:30:38 +00:00
|
|
|
using DiscImageChef.CommonTypes;
|
2018-06-25 19:08:16 +01:00
|
|
|
using DiscImageChef.CommonTypes.Interfaces;
|
2017-07-13 01:55:48 +01:00
|
|
|
using DiscImageChef.Console;
|
2011-03-25 20:45:28 +00:00
|
|
|
|
2014-04-17 19:58:14 +00:00
|
|
|
// Information learnt from XNU source and testing against real disks
|
2017-12-20 17:15:26 +00:00
|
|
|
namespace DiscImageChef.Partitions
|
2011-03-25 20:45:28 +00:00
|
|
|
{
|
2017-12-26 06:05:12 +00:00
|
|
|
public class NeXTDisklabel : IPartition
|
2014-04-14 01:14:20 +00:00
|
|
|
{
|
2017-12-26 06:05:12 +00:00
|
|
|
/// <summary>"NeXT"</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
const uint NEXT_MAGIC1 = 0x4E655854;
|
2017-12-26 06:05:12 +00:00
|
|
|
/// <summary>"dlV2"</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
const uint NEXT_MAGIC2 = 0x646C5632;
|
2017-12-26 06:05:12 +00:00
|
|
|
/// <summary>"dlV3"</summary>
|
2016-07-28 22:25:26 +01:00
|
|
|
const uint NEXT_MAGIC3 = 0x646C5633;
|
2017-12-26 06:05:12 +00:00
|
|
|
/// <summary>180</summary>
|
2017-12-22 16:53:11 +00:00
|
|
|
const ushort DISKTAB_START = 0xB4;
|
2017-12-26 06:05:12 +00:00
|
|
|
/// <summary>44</summary>
|
2017-12-22 16:53:11 +00:00
|
|
|
const ushort DISKTAB_ENTRY_SIZE = 0x2C;
|
2017-12-19 20:33:03 +00:00
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
public string Name => "NeXT Disklabel";
|
2018-06-22 08:08:38 +01:00
|
|
|
public Guid Id => new Guid("246A6D93-4F1A-1F8A-344D-50187A5513A9");
|
2014-04-14 01:14:20 +00:00
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
public bool GetInformation(IMediaImage imagePlugin, out List<Partition> partitions, ulong sectorOffset)
|
2014-04-14 01:14:20 +00:00
|
|
|
{
|
2018-06-22 08:08:38 +01:00
|
|
|
bool magicFound = false;
|
2017-12-22 16:53:11 +00:00
|
|
|
byte[] labelSector;
|
2016-04-19 02:11:47 +01:00
|
|
|
|
2017-12-22 16:53:11 +00:00
|
|
|
uint sectorSize;
|
2014-04-14 01:14:20 +00:00
|
|
|
|
2017-12-26 06:05:12 +00:00
|
|
|
if(imagePlugin.Info.SectorSize == 2352 || imagePlugin.Info.SectorSize == 2448) sectorSize = 2048;
|
2018-06-22 08:08:38 +01:00
|
|
|
else
|
|
|
|
|
sectorSize =
|
|
|
|
|
imagePlugin.Info.SectorSize;
|
2016-04-19 02:11:47 +01:00
|
|
|
|
2017-12-21 14:30:38 +00:00
|
|
|
partitions = new List<Partition>();
|
2014-04-14 01:14:20 +00:00
|
|
|
|
2017-07-15 01:35:05 +01:00
|
|
|
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
|
|
|
|
|
2017-12-22 16:53:11 +00:00
|
|
|
ulong labelPosition = 0;
|
2014-04-14 01:14:20 +00:00
|
|
|
|
2017-12-26 06:05:12 +00:00
|
|
|
foreach(ulong i in new ulong[] {0, 4, 15, 16}.TakeWhile(i => i + sectorOffset < imagePlugin.Info.Sectors))
|
2017-12-22 16:53:11 +00:00
|
|
|
{
|
|
|
|
|
labelSector = imagePlugin.ReadSector(i + sectorOffset);
|
|
|
|
|
uint magic = BigEndianBitConverter.ToUInt32(labelSector, 0x00);
|
2017-12-21 06:06:19 +00:00
|
|
|
if(magic != NEXT_MAGIC1 && magic != NEXT_MAGIC2 && magic != NEXT_MAGIC3) continue;
|
|
|
|
|
|
2018-06-22 08:08:38 +01:00
|
|
|
magicFound = true;
|
2017-12-22 16:53:11 +00:00
|
|
|
labelPosition = i + sectorOffset;
|
2017-12-21 06:06:19 +00:00
|
|
|
break;
|
2014-04-14 01:14:20 +00:00
|
|
|
}
|
2016-04-19 02:11:47 +01:00
|
|
|
|
2017-12-22 16:53:11 +00:00
|
|
|
if(!magicFound) return false;
|
2017-07-13 01:55:48 +01:00
|
|
|
|
2017-12-26 06:05:12 +00:00
|
|
|
uint sectorsToRead = 7680 / imagePlugin.Info.SectorSize;
|
|
|
|
|
if(7680 % imagePlugin.Info.SectorSize > 0) sectorsToRead++;
|
2017-07-13 01:55:48 +01:00
|
|
|
|
2017-12-22 16:53:11 +00:00
|
|
|
labelSector = imagePlugin.ReadSectors(labelPosition, sectorsToRead);
|
2017-07-13 01:55:48 +01:00
|
|
|
|
2018-06-22 08:08:38 +01:00
|
|
|
NeXTLabel label = BigEndianMarshal.ByteArrayToStructureBigEndian<NeXTLabel>(labelSector);
|
|
|
|
|
byte[] disktabB = new byte[498];
|
2017-12-22 16:53:11 +00:00
|
|
|
Array.Copy(labelSector, 44, disktabB, 0, 498);
|
2018-06-22 08:08:38 +01:00
|
|
|
label.dl_dt = BigEndianMarshal.ByteArrayToStructureBigEndian<NeXTDiskTab>(disktabB);
|
2017-07-13 01:55:48 +01:00
|
|
|
label.dl_dt.d_partitions = new NeXTEntry[8];
|
2012-08-05 03:02:55 +00:00
|
|
|
|
2017-07-13 01:55:48 +01:00
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_version = 0x{0:X8}", label.dl_version);
|
2018-06-22 08:08:38 +01:00
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_label_blkno = {0}", label.dl_label_blkno);
|
|
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_size = {0}", label.dl_size);
|
2017-12-19 20:33:03 +00:00
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_label = \"{0}\"",
|
|
|
|
|
StringHandlers.CToString(label.dl_label));
|
2018-06-22 08:08:38 +01:00
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_flags = {0}", label.dl_flags);
|
2017-07-13 01:55:48 +01:00
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_tag = 0x{0:X8}", label.dl_tag);
|
2017-12-19 20:33:03 +00:00
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_name = \"{0}\"",
|
|
|
|
|
StringHandlers.CToString(label.dl_dt.d_name));
|
|
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_type = \"{0}\"",
|
|
|
|
|
StringHandlers.CToString(label.dl_dt.d_type));
|
2018-06-22 08:08:38 +01:00
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_secsize = {0}", label.dl_dt.d_secsize);
|
|
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_ntracks = {0}", label.dl_dt.d_ntracks);
|
|
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_nsectors = {0}", label.dl_dt.d_nsectors);
|
2017-07-13 01:55:48 +01:00
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_ncylinders = {0}", label.dl_dt.d_ncylinders);
|
2018-06-22 08:08:38 +01:00
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_rpm = {0}", label.dl_dt.d_rpm);
|
|
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_front = {0}", label.dl_dt.d_front);
|
|
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_back = {0}", label.dl_dt.d_back);
|
|
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_ngroups = {0}", label.dl_dt.d_ngroups);
|
|
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_ag_size = {0}", label.dl_dt.d_ag_size);
|
|
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_ag_alts = {0}", label.dl_dt.d_ag_alts);
|
|
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_ag_off = {0}", label.dl_dt.d_ag_off);
|
2017-12-19 20:33:03 +00:00
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_boot0_blkno[0] = {0}",
|
|
|
|
|
label.dl_dt.d_boot0_blkno[0]);
|
|
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_boot0_blkno[1] = {0}",
|
|
|
|
|
label.dl_dt.d_boot0_blkno[1]);
|
|
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_bootfile = \"{0}\"",
|
|
|
|
|
StringHandlers.CToString(label.dl_dt.d_bootfile));
|
|
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_hostname = \"{0}\"",
|
|
|
|
|
StringHandlers.CToString(label.dl_dt.d_hostname));
|
2017-07-13 01:55:48 +01:00
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_rootpartition = {0}", label.dl_dt.d_rootpartition);
|
2018-06-22 08:08:38 +01:00
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_rwpartition = {0}", label.dl_dt.d_rwpartition);
|
2017-07-13 01:55:48 +01:00
|
|
|
|
|
|
|
|
for(int i = 0; i < 8; i++)
|
2014-04-14 01:14:20 +00:00
|
|
|
{
|
2017-12-22 16:53:11 +00:00
|
|
|
byte[] partB = new byte[44];
|
|
|
|
|
Array.Copy(labelSector, 44 + 146 + 44 * i, partB, 0, 44);
|
|
|
|
|
label.dl_dt.d_partitions[i] = BigEndianMarshal.ByteArrayToStructureBigEndian<NeXTEntry>(partB);
|
2017-12-19 20:33:03 +00:00
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_base = {1}", i,
|
|
|
|
|
label.dl_dt.d_partitions[i].p_base);
|
|
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_size = {1}", i,
|
|
|
|
|
label.dl_dt.d_partitions[i].p_size);
|
|
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_bsize = {1}", i,
|
|
|
|
|
label.dl_dt.d_partitions[i].p_bsize);
|
|
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_fsize = {1}", i,
|
|
|
|
|
label.dl_dt.d_partitions[i].p_fsize);
|
|
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_opt = {1}", i,
|
|
|
|
|
label.dl_dt.d_partitions[i].p_opt);
|
|
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_cpg = {1}", i,
|
|
|
|
|
label.dl_dt.d_partitions[i].p_cpg);
|
|
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_density = {1}", i,
|
|
|
|
|
label.dl_dt.d_partitions[i].p_density);
|
|
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_minfree = {1}", i,
|
|
|
|
|
label.dl_dt.d_partitions[i].p_minfree);
|
|
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_newfs = {1}", i,
|
|
|
|
|
label.dl_dt.d_partitions[i].p_newfs);
|
|
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_mountpt = \"{1}\"", i,
|
|
|
|
|
StringHandlers.CToString(label.dl_dt.d_partitions[i].p_mountpt));
|
|
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_automnt = {1}", i,
|
|
|
|
|
label.dl_dt.d_partitions[i].p_automnt);
|
|
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_type = \"{1}\"", i,
|
|
|
|
|
StringHandlers.CToString(label.dl_dt.d_partitions[i].p_type));
|
2017-07-13 01:55:48 +01:00
|
|
|
|
2018-06-22 08:08:38 +01:00
|
|
|
if(label.dl_dt.d_partitions[i].p_size <= 0 || label.dl_dt.d_partitions[i].p_base < 0 ||
|
2017-12-21 06:06:19 +00:00
|
|
|
label.dl_dt.d_partitions[i].p_bsize < 0) continue;
|
|
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
2017-12-21 14:30:38 +00:00
|
|
|
Partition part = new Partition
|
2017-12-21 06:06:19 +00:00
|
|
|
{
|
|
|
|
|
Size = (ulong)(label.dl_dt.d_partitions[i].p_size * label.dl_dt.d_secsize),
|
|
|
|
|
Offset =
|
|
|
|
|
(ulong)((label.dl_dt.d_partitions[i].p_base + label.dl_dt.d_front) * label.dl_dt.d_secsize),
|
2018-06-22 08:08:38 +01:00
|
|
|
Type = StringHandlers.CToString(label.dl_dt.d_partitions[i].p_type),
|
2017-12-21 06:06:19 +00:00
|
|
|
Sequence = (ulong)i,
|
2018-06-22 08:08:38 +01:00
|
|
|
Name = StringHandlers.CToString(label.dl_dt.d_partitions[i].p_mountpt),
|
|
|
|
|
Length = (ulong)(label.dl_dt.d_partitions[i].p_size * label.dl_dt.d_secsize / sectorSize),
|
2017-12-22 16:53:11 +00:00
|
|
|
Start = (ulong)((label.dl_dt.d_partitions[i].p_base + label.dl_dt.d_front) * label.dl_dt.d_secsize /
|
|
|
|
|
sectorSize),
|
2017-12-21 06:06:19 +00:00
|
|
|
Scheme = Name
|
|
|
|
|
};
|
|
|
|
|
|
2017-12-26 06:05:12 +00:00
|
|
|
if(part.Start + part.Length > imagePlugin.Info.Sectors)
|
2014-04-14 01:14:20 +00:00
|
|
|
{
|
2017-12-21 06:06:19 +00:00
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "Partition bigger than device, reducing...");
|
2017-12-26 06:05:12 +00:00
|
|
|
part.Length = imagePlugin.Info.Sectors - part.Start;
|
2018-06-22 08:08:38 +01:00
|
|
|
part.Size = part.Length * sectorSize;
|
2017-12-21 06:06:19 +00:00
|
|
|
DicConsole.DebugWriteLine("NeXT Plugin", "label.dl_dt.d_partitions[{0}].p_size = {1}", i,
|
|
|
|
|
part.Length);
|
2017-07-13 01:55:48 +01:00
|
|
|
}
|
2017-12-21 06:06:19 +00:00
|
|
|
|
|
|
|
|
sb.AppendFormat("{0} bytes per block", label.dl_dt.d_partitions[i].p_bsize).AppendLine();
|
|
|
|
|
sb.AppendFormat("{0} bytes per fragment", label.dl_dt.d_partitions[i].p_fsize).AppendLine();
|
2018-06-22 08:08:38 +01:00
|
|
|
if(label.dl_dt.d_partitions[i].p_opt == 's') sb.AppendLine("Space optimized");
|
2017-12-21 06:06:19 +00:00
|
|
|
else if(label.dl_dt.d_partitions[i].p_opt == 't') sb.AppendLine("Time optimized");
|
|
|
|
|
else sb.AppendFormat("Unknown optimization {0:X2}", label.dl_dt.d_partitions[i].p_opt).AppendLine();
|
|
|
|
|
sb.AppendFormat("{0} cylinders per group", label.dl_dt.d_partitions[i].p_cpg).AppendLine();
|
|
|
|
|
sb.AppendFormat("{0} bytes per inode", label.dl_dt.d_partitions[i].p_density).AppendLine();
|
|
|
|
|
sb.AppendFormat("{0}% of space must be free at minimum", label.dl_dt.d_partitions[i].p_minfree)
|
|
|
|
|
.AppendLine();
|
2017-12-22 16:53:11 +00:00
|
|
|
if(label.dl_dt.d_partitions[i].p_newfs != 1) sb.AppendLine("Filesystem should be formatted at start");
|
2017-12-21 06:06:19 +00:00
|
|
|
if(label.dl_dt.d_partitions[i].p_automnt == 1)
|
|
|
|
|
sb.AppendLine("Filesystem should be automatically mounted");
|
|
|
|
|
|
|
|
|
|
part.Description = sb.ToString();
|
|
|
|
|
|
|
|
|
|
partitions.Add(part);
|
2014-04-14 01:14:20 +00:00
|
|
|
}
|
2017-07-13 01:55:48 +01:00
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2017-12-22 16:53:11 +00:00
|
|
|
/// NeXT v3 disklabel, 544 bytes
|
2017-07-13 01:55:48 +01:00
|
|
|
/// </summary>
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
2017-12-20 02:08:37 +00:00
|
|
|
struct NeXTLabel
|
2017-07-13 01:55:48 +01:00
|
|
|
{
|
|
|
|
|
/// <summary>Signature</summary>
|
|
|
|
|
public uint dl_version;
|
|
|
|
|
/// <summary>Block on which this label resides</summary>
|
|
|
|
|
public int dl_label_blkno;
|
|
|
|
|
/// <summary>Device size in blocks</summary>
|
|
|
|
|
public int dl_size;
|
|
|
|
|
/// <summary>Device name</summary>
|
2018-06-22 08:08:38 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)]
|
|
|
|
|
public byte[] dl_label;
|
2017-07-13 01:55:48 +01:00
|
|
|
/// <summary>Device flags</summary>
|
|
|
|
|
public uint dl_flags;
|
|
|
|
|
/// <summary>Device tag</summary>
|
|
|
|
|
public uint dl_tag;
|
|
|
|
|
/// <summary>Device info and partitions</summary>
|
|
|
|
|
public NeXTDiskTab dl_dt;
|
|
|
|
|
/// <summary>Checksum</summary>
|
|
|
|
|
public ushort dl_v3_checksum;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2017-12-22 16:53:11 +00:00
|
|
|
/// NeXT v1 and v2 disklabel, 7224 bytes
|
2017-07-13 01:55:48 +01:00
|
|
|
/// </summary>
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
2017-12-20 02:08:37 +00:00
|
|
|
struct NeXTLabelOld
|
2017-07-13 01:55:48 +01:00
|
|
|
{
|
|
|
|
|
/// <summary>Signature</summary>
|
|
|
|
|
public uint dl_version;
|
|
|
|
|
/// <summary>Block on which this label resides</summary>
|
|
|
|
|
public int dl_label_blkno;
|
|
|
|
|
/// <summary>Device size in blocks</summary>
|
|
|
|
|
public int dl_size;
|
|
|
|
|
/// <summary>Device name</summary>
|
2018-06-22 08:08:38 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)]
|
|
|
|
|
public byte[] dl_label;
|
2017-07-13 01:55:48 +01:00
|
|
|
/// <summary>Device flags</summary>
|
|
|
|
|
public uint dl_flags;
|
|
|
|
|
/// <summary>Device tag</summary>
|
|
|
|
|
public uint dl_tag;
|
|
|
|
|
/// <summary>Device info and partitions</summary>
|
|
|
|
|
public NeXTDiskTab dl_dt;
|
|
|
|
|
/// <summary>Bad sector table</summary>
|
2018-06-22 08:08:38 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1670)]
|
|
|
|
|
public int[] dl_bad;
|
2017-07-13 01:55:48 +01:00
|
|
|
/// <summary>Checksum</summary>
|
|
|
|
|
public ushort dl_checksum;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2017-12-22 16:53:11 +00:00
|
|
|
/// NeXT disktab and partitions, 498 bytes
|
2017-07-13 01:55:48 +01:00
|
|
|
/// </summary>
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
2017-12-20 02:08:37 +00:00
|
|
|
struct NeXTDiskTab
|
2017-07-13 01:55:48 +01:00
|
|
|
{
|
|
|
|
|
/// <summary>Drive name</summary>
|
2018-06-22 08:08:38 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)]
|
|
|
|
|
public byte[] d_name;
|
2017-07-13 01:55:48 +01:00
|
|
|
/// <summary>Drive type</summary>
|
2018-06-22 08:08:38 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)]
|
|
|
|
|
public byte[] d_type;
|
2017-07-13 01:55:48 +01:00
|
|
|
/// <summary>Sector size</summary>
|
|
|
|
|
public int d_secsize;
|
|
|
|
|
/// <summary>tracks/cylinder</summary>
|
|
|
|
|
public int d_ntracks;
|
|
|
|
|
/// <summary>sectors/track</summary>
|
|
|
|
|
public int d_nsectors;
|
|
|
|
|
/// <summary>cylinders</summary>
|
|
|
|
|
public int d_ncylinders;
|
|
|
|
|
/// <summary>revolutions/minute</summary>
|
|
|
|
|
public int d_rpm;
|
|
|
|
|
/// <summary>size of front porch in sectors</summary>
|
|
|
|
|
public short d_front;
|
|
|
|
|
/// <summary>size of back porch in sectors</summary>
|
|
|
|
|
public short d_back;
|
|
|
|
|
/// <summary>number of alt groups</summary>
|
|
|
|
|
public short d_ngroups;
|
|
|
|
|
/// <summary>alt group size in sectors</summary>
|
|
|
|
|
public short d_ag_size;
|
|
|
|
|
/// <summary>alternate sectors per alt group</summary>
|
|
|
|
|
public short d_ag_alts;
|
|
|
|
|
/// <summary>sector offset to first alternate</summary>
|
|
|
|
|
public short d_ag_off;
|
|
|
|
|
/// <summary>"blk 0" boot locations</summary>
|
2018-06-22 08:08:38 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
|
|
|
|
public int[] d_boot0_blkno;
|
2017-07-13 01:55:48 +01:00
|
|
|
/// <summary>default bootfile</summary>
|
2018-06-22 08:08:38 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 24)]
|
|
|
|
|
public byte[] d_bootfile;
|
2017-07-13 01:55:48 +01:00
|
|
|
/// <summary>host name</summary>
|
2018-06-22 08:08:38 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
|
|
|
|
public byte[] d_hostname;
|
2017-07-13 01:55:48 +01:00
|
|
|
/// <summary>root partition</summary>
|
|
|
|
|
public byte d_rootpartition;
|
|
|
|
|
/// <summary>r/w partition</summary>
|
|
|
|
|
public byte d_rwpartition;
|
|
|
|
|
/// <summary>partitions</summary>
|
2018-06-22 08:08:38 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
|
|
|
|
public NeXTEntry[] d_partitions;
|
2014-04-14 01:14:20 +00:00
|
|
|
}
|
|
|
|
|
|
2017-07-13 01:55:48 +01:00
|
|
|
/// <summary>
|
2017-12-22 16:53:11 +00:00
|
|
|
/// Partition entries, 44 bytes each
|
2017-07-13 01:55:48 +01:00
|
|
|
/// </summary>
|
2017-07-15 01:35:05 +01:00
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 2)]
|
2017-12-20 02:08:37 +00:00
|
|
|
struct NeXTEntry
|
2014-04-14 01:14:20 +00:00
|
|
|
{
|
2017-07-13 01:55:48 +01:00
|
|
|
/// <summary>Sector of start, counting from front porch</summary>
|
|
|
|
|
public int p_base;
|
|
|
|
|
/// <summary>Length in sectors</summary>
|
|
|
|
|
public int p_size;
|
|
|
|
|
/// <summary>Filesystem's block size</summary>
|
|
|
|
|
public short p_bsize;
|
|
|
|
|
/// <summary>Filesystem's fragment size</summary>
|
|
|
|
|
public short p_fsize;
|
|
|
|
|
/// <summary>'s'pace or 't'ime</summary>
|
|
|
|
|
public byte p_opt;
|
|
|
|
|
/// <summary>Cylinders per group</summary>
|
|
|
|
|
public short p_cpg;
|
|
|
|
|
/// <summary>Bytes per inode</summary>
|
|
|
|
|
public short p_density;
|
|
|
|
|
/// <summary>% of minimum free space</summary>
|
|
|
|
|
public byte p_minfree;
|
|
|
|
|
/// <summary>Should newfs be run on first start?</summary>
|
|
|
|
|
public byte p_newfs;
|
|
|
|
|
/// <summary>Mount point or empty if mount where you want</summary>
|
2018-06-22 08:08:38 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
|
|
|
|
public byte[] p_mountpt;
|
2017-07-13 01:55:48 +01:00
|
|
|
/// <summary>Should automount</summary>
|
|
|
|
|
public byte p_automnt;
|
|
|
|
|
/// <summary>Filesystem type, always "4.3BSD"?</summary>
|
2018-06-22 08:08:38 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
|
|
|
|
public byte[] p_type;
|
2014-04-14 01:14:20 +00:00
|
|
|
}
|
|
|
|
|
}
|
2011-03-25 20:45:28 +00:00
|
|
|
}
|