2017-05-19 20:28:49 +01:00
|
|
|
// /***************************************************************************
|
2020-02-27 12:31:25 +00:00
|
|
|
// Aaru Data Preservation Suite
|
* DiscImageChef.Helpers/BigEndianStructure.cs:
* DiscImageChef.Helpers/DiscImageChef.Helpers.csproj:
Added code that directly marshals from a big-endian byte
array. But untested with nested structures.
* DiscImageChef.Partitions/Acorn.cs:
Added support for Acorn FileCore partition, closes #4.
* DiscImageChef.Partitions/BSD.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/DEC.cs:
Added support for DEC disklabels, closes #11.
* DiscImageChef.Partitions/DragonFlyBSD.cs:
Added support for DragonFly BSD 64-bit disklabels.
* DiscImageChef.Partitions/PC98.cs:
Added support for NEC PC-9800 partitions.
* DiscImageChef.Partitions/RioKarma.cs:
Added support for Rio Karma partitions.
* DiscImageChef.Partitions/SGI.cs:
Added support for SGI DVHs, closes #9.
* DiscImageChef.Partitions/UNIX.cs:
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* TODO:
* README.md:
* DiscImageChef.Partitions/DiscImageChef.Partitions.csproj:
Added support for Acorn FileCore partition, closes #4.
Added support for DEC disklabels, closes #11.
Added support for SGI DVHs, closes #9.
Moved BSD partitions from inside MBR code to separate code, as
they can (and do) appear on other architectures as the only
scheme.
Added support for DragonFly BSD 64-bit disklabels.
Added support for NEC PC-9800 partitions.
Added support for Rio Karma partitions.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/GPT.cs:
Added new partition type UUIDs.
* DiscImageChef.Partitions/MBR.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/Sun.cs:
Added new partition types.
Prepare structures for marshaling.
2016-08-21 08:27:43 +01:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// Filename : BSD.cs
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
//
|
|
|
|
|
// Component : Partitioning scheme plugins.
|
|
|
|
|
//
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// Manages BSD 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/>.
|
|
|
|
|
//
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2024-12-19 10:45:18 +00:00
|
|
|
// Copyright © 2011-2025 Natalia Portillo
|
* DiscImageChef.Helpers/BigEndianStructure.cs:
* DiscImageChef.Helpers/DiscImageChef.Helpers.csproj:
Added code that directly marshals from a big-endian byte
array. But untested with nested structures.
* DiscImageChef.Partitions/Acorn.cs:
Added support for Acorn FileCore partition, closes #4.
* DiscImageChef.Partitions/BSD.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/DEC.cs:
Added support for DEC disklabels, closes #11.
* DiscImageChef.Partitions/DragonFlyBSD.cs:
Added support for DragonFly BSD 64-bit disklabels.
* DiscImageChef.Partitions/PC98.cs:
Added support for NEC PC-9800 partitions.
* DiscImageChef.Partitions/RioKarma.cs:
Added support for Rio Karma partitions.
* DiscImageChef.Partitions/SGI.cs:
Added support for SGI DVHs, closes #9.
* DiscImageChef.Partitions/UNIX.cs:
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* TODO:
* README.md:
* DiscImageChef.Partitions/DiscImageChef.Partitions.csproj:
Added support for Acorn FileCore partition, closes #4.
Added support for DEC disklabels, closes #11.
Added support for SGI DVHs, closes #9.
Moved BSD partitions from inside MBR code to separate code, as
they can (and do) appear on other architectures as the only
scheme.
Added support for DragonFly BSD 64-bit disklabels.
Added support for NEC PC-9800 partitions.
Added support for Rio Karma partitions.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/GPT.cs:
Added new partition type UUIDs.
* DiscImageChef.Partitions/MBR.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/Sun.cs:
Added new partition types.
Prepare structures for marshaling.
2016-08-21 08:27:43 +01:00
|
|
|
// ****************************************************************************/
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2020-07-20 07:47:12 +01:00
|
|
|
using System.Diagnostics.CodeAnalysis;
|
2017-12-19 19:33:46 +00:00
|
|
|
using System.Linq;
|
* DiscImageChef.Helpers/BigEndianStructure.cs:
* DiscImageChef.Helpers/DiscImageChef.Helpers.csproj:
Added code that directly marshals from a big-endian byte
array. But untested with nested structures.
* DiscImageChef.Partitions/Acorn.cs:
Added support for Acorn FileCore partition, closes #4.
* DiscImageChef.Partitions/BSD.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/DEC.cs:
Added support for DEC disklabels, closes #11.
* DiscImageChef.Partitions/DragonFlyBSD.cs:
Added support for DragonFly BSD 64-bit disklabels.
* DiscImageChef.Partitions/PC98.cs:
Added support for NEC PC-9800 partitions.
* DiscImageChef.Partitions/RioKarma.cs:
Added support for Rio Karma partitions.
* DiscImageChef.Partitions/SGI.cs:
Added support for SGI DVHs, closes #9.
* DiscImageChef.Partitions/UNIX.cs:
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* TODO:
* README.md:
* DiscImageChef.Partitions/DiscImageChef.Partitions.csproj:
Added support for Acorn FileCore partition, closes #4.
Added support for DEC disklabels, closes #11.
Added support for SGI DVHs, closes #9.
Moved BSD partitions from inside MBR code to separate code, as
they can (and do) appear on other architectures as the only
scheme.
Added support for DragonFly BSD 64-bit disklabels.
Added support for NEC PC-9800 partitions.
Added support for Rio Karma partitions.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/GPT.cs:
Added new partition type UUIDs.
* DiscImageChef.Partitions/MBR.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/Sun.cs:
Added new partition types.
Prepare structures for marshaling.
2016-08-21 08:27:43 +01:00
|
|
|
using System.Runtime.InteropServices;
|
2020-02-27 00:33:26 +00:00
|
|
|
using Aaru.CommonTypes;
|
2025-10-21 12:00:30 +01:00
|
|
|
using Aaru.CommonTypes.Attributes;
|
2021-09-19 21:16:47 +01:00
|
|
|
using Aaru.CommonTypes.Enums;
|
2020-02-27 00:33:26 +00:00
|
|
|
using Aaru.CommonTypes.Interfaces;
|
2020-07-20 15:43:52 +01:00
|
|
|
using Aaru.Helpers;
|
2025-08-17 05:50:25 +01:00
|
|
|
using Aaru.Logging;
|
2020-02-27 00:33:26 +00:00
|
|
|
using Marshal = Aaru.Helpers.Marshal;
|
* DiscImageChef.Helpers/BigEndianStructure.cs:
* DiscImageChef.Helpers/DiscImageChef.Helpers.csproj:
Added code that directly marshals from a big-endian byte
array. But untested with nested structures.
* DiscImageChef.Partitions/Acorn.cs:
Added support for Acorn FileCore partition, closes #4.
* DiscImageChef.Partitions/BSD.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/DEC.cs:
Added support for DEC disklabels, closes #11.
* DiscImageChef.Partitions/DragonFlyBSD.cs:
Added support for DragonFly BSD 64-bit disklabels.
* DiscImageChef.Partitions/PC98.cs:
Added support for NEC PC-9800 partitions.
* DiscImageChef.Partitions/RioKarma.cs:
Added support for Rio Karma partitions.
* DiscImageChef.Partitions/SGI.cs:
Added support for SGI DVHs, closes #9.
* DiscImageChef.Partitions/UNIX.cs:
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* TODO:
* README.md:
* DiscImageChef.Partitions/DiscImageChef.Partitions.csproj:
Added support for Acorn FileCore partition, closes #4.
Added support for DEC disklabels, closes #11.
Added support for SGI DVHs, closes #9.
Moved BSD partitions from inside MBR code to separate code, as
they can (and do) appear on other architectures as the only
scheme.
Added support for DragonFly BSD 64-bit disklabels.
Added support for NEC PC-9800 partitions.
Added support for Rio Karma partitions.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/GPT.cs:
Added new partition type UUIDs.
* DiscImageChef.Partitions/MBR.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/Sun.cs:
Added new partition types.
Prepare structures for marshaling.
2016-08-21 08:27:43 +01:00
|
|
|
|
2022-11-15 15:58:43 +00:00
|
|
|
namespace Aaru.Partitions;
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
/// <inheritdoc />
|
|
|
|
|
/// <summary>Implements decoding of BSD disklabels</summary>
|
|
|
|
|
[SuppressMessage("ReSharper", "UnusedMember.Local")]
|
2025-10-21 12:00:30 +01:00
|
|
|
public sealed partial class BSD : IPartition
|
* DiscImageChef.Helpers/BigEndianStructure.cs:
* DiscImageChef.Helpers/DiscImageChef.Helpers.csproj:
Added code that directly marshals from a big-endian byte
array. But untested with nested structures.
* DiscImageChef.Partitions/Acorn.cs:
Added support for Acorn FileCore partition, closes #4.
* DiscImageChef.Partitions/BSD.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/DEC.cs:
Added support for DEC disklabels, closes #11.
* DiscImageChef.Partitions/DragonFlyBSD.cs:
Added support for DragonFly BSD 64-bit disklabels.
* DiscImageChef.Partitions/PC98.cs:
Added support for NEC PC-9800 partitions.
* DiscImageChef.Partitions/RioKarma.cs:
Added support for Rio Karma partitions.
* DiscImageChef.Partitions/SGI.cs:
Added support for SGI DVHs, closes #9.
* DiscImageChef.Partitions/UNIX.cs:
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* TODO:
* README.md:
* DiscImageChef.Partitions/DiscImageChef.Partitions.csproj:
Added support for Acorn FileCore partition, closes #4.
Added support for DEC disklabels, closes #11.
Added support for SGI DVHs, closes #9.
Moved BSD partitions from inside MBR code to separate code, as
they can (and do) appear on other architectures as the only
scheme.
Added support for DragonFly BSD 64-bit disklabels.
Added support for NEC PC-9800 partitions.
Added support for Rio Karma partitions.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/GPT.cs:
Added new partition type UUIDs.
* DiscImageChef.Partitions/MBR.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/Sun.cs:
Added new partition types.
Prepare structures for marshaling.
2016-08-21 08:27:43 +01:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
const uint DISK_MAGIC = 0x82564557;
|
|
|
|
|
const uint DISK_CIGAM = 0x57455682;
|
|
|
|
|
/// <summary>Maximum size of a disklabel with 22 partitions</summary>
|
|
|
|
|
const uint MAX_LABEL_SIZE = 500;
|
2023-10-03 18:46:31 +01:00
|
|
|
const string MODULE_NAME = "BSD disklabel plugin";
|
2022-03-06 13:29:38 +00:00
|
|
|
/// <summary>Known sector locations for BSD disklabel</summary>
|
2024-05-01 04:39:38 +01:00
|
|
|
readonly ulong[] _labelLocations = [0, 1, 2, 9];
|
2022-03-06 13:29:38 +00:00
|
|
|
/// <summary>Known byte offsets for BSD disklabel</summary>
|
2024-05-01 04:39:38 +01:00
|
|
|
readonly uint[] _labelOffsets = [0, 9, 64, 128, 516];
|
2023-10-03 23:36:49 +01:00
|
|
|
|
|
|
|
|
#region IPartition Members
|
* DiscImageChef.Helpers/BigEndianStructure.cs:
* DiscImageChef.Helpers/DiscImageChef.Helpers.csproj:
Added code that directly marshals from a big-endian byte
array. But untested with nested structures.
* DiscImageChef.Partitions/Acorn.cs:
Added support for Acorn FileCore partition, closes #4.
* DiscImageChef.Partitions/BSD.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/DEC.cs:
Added support for DEC disklabels, closes #11.
* DiscImageChef.Partitions/DragonFlyBSD.cs:
Added support for DragonFly BSD 64-bit disklabels.
* DiscImageChef.Partitions/PC98.cs:
Added support for NEC PC-9800 partitions.
* DiscImageChef.Partitions/RioKarma.cs:
Added support for Rio Karma partitions.
* DiscImageChef.Partitions/SGI.cs:
Added support for SGI DVHs, closes #9.
* DiscImageChef.Partitions/UNIX.cs:
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* TODO:
* README.md:
* DiscImageChef.Partitions/DiscImageChef.Partitions.csproj:
Added support for Acorn FileCore partition, closes #4.
Added support for DEC disklabels, closes #11.
Added support for SGI DVHs, closes #9.
Moved BSD partitions from inside MBR code to separate code, as
they can (and do) appear on other architectures as the only
scheme.
Added support for DragonFly BSD 64-bit disklabels.
Added support for NEC PC-9800 partitions.
Added support for Rio Karma partitions.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/GPT.cs:
Added new partition type UUIDs.
* DiscImageChef.Partitions/MBR.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/Sun.cs:
Added new partition types.
Prepare structures for marshaling.
2016-08-21 08:27:43 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
/// <inheritdoc />
|
2022-11-29 03:13:21 +00:00
|
|
|
public string Name => Localization.BSD_Name;
|
2023-10-03 23:36:49 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
/// <inheritdoc />
|
|
|
|
|
public Guid Id => new("246A6D93-4F1A-1F8A-344D-50187A5513A9");
|
2023-10-03 23:36:49 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
/// <inheritdoc />
|
2023-10-05 01:52:48 +01:00
|
|
|
public string Author => Authors.NATALIA_PORTILLO;
|
2021-09-19 21:16:47 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
/// <inheritdoc />
|
|
|
|
|
public bool GetInformation(IMediaImage imagePlugin, out List<Partition> partitions, ulong sectorOffset)
|
|
|
|
|
{
|
2024-05-01 04:39:38 +01:00
|
|
|
partitions = [];
|
2022-03-06 13:29:38 +00:00
|
|
|
uint run = (MAX_LABEL_SIZE + _labelOffsets.Last()) / imagePlugin.Info.SectorSize;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2024-05-01 04:05:22 +01:00
|
|
|
if((MAX_LABEL_SIZE + _labelOffsets.Last()) % imagePlugin.Info.SectorSize > 0) run++;
|
2019-05-03 00:25:22 +01:00
|
|
|
|
2025-10-22 14:28:58 +01:00
|
|
|
var dl = new DiskLabel();
|
|
|
|
|
var found = false;
|
2019-05-03 00:25:22 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
foreach(ulong location in _labelLocations)
|
|
|
|
|
{
|
2024-05-01 04:05:22 +01:00
|
|
|
if(location + run + sectorOffset >= imagePlugin.Info.Sectors) return false;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2025-10-23 03:07:43 +01:00
|
|
|
ErrorNumber errno = imagePlugin.ReadSectors(location + sectorOffset, false, run, out byte[] tmp, out _);
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2024-05-01 04:05:22 +01:00
|
|
|
if(errno != ErrorNumber.NoError) continue;
|
2017-12-21 06:06:19 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
foreach(uint offset in _labelOffsets)
|
|
|
|
|
{
|
2025-10-22 14:28:58 +01:00
|
|
|
var sector = new byte[MAX_LABEL_SIZE];
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2024-05-01 04:05:22 +01:00
|
|
|
if(offset + MAX_LABEL_SIZE > tmp.Length) break;
|
* DiscImageChef.Helpers/BigEndianStructure.cs:
* DiscImageChef.Helpers/DiscImageChef.Helpers.csproj:
Added code that directly marshals from a big-endian byte
array. But untested with nested structures.
* DiscImageChef.Partitions/Acorn.cs:
Added support for Acorn FileCore partition, closes #4.
* DiscImageChef.Partitions/BSD.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/DEC.cs:
Added support for DEC disklabels, closes #11.
* DiscImageChef.Partitions/DragonFlyBSD.cs:
Added support for DragonFly BSD 64-bit disklabels.
* DiscImageChef.Partitions/PC98.cs:
Added support for NEC PC-9800 partitions.
* DiscImageChef.Partitions/RioKarma.cs:
Added support for Rio Karma partitions.
* DiscImageChef.Partitions/SGI.cs:
Added support for SGI DVHs, closes #9.
* DiscImageChef.Partitions/UNIX.cs:
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* TODO:
* README.md:
* DiscImageChef.Partitions/DiscImageChef.Partitions.csproj:
Added support for Acorn FileCore partition, closes #4.
Added support for DEC disklabels, closes #11.
Added support for SGI DVHs, closes #9.
Moved BSD partitions from inside MBR code to separate code, as
they can (and do) appear on other architectures as the only
scheme.
Added support for DragonFly BSD 64-bit disklabels.
Added support for NEC PC-9800 partitions.
Added support for Rio Karma partitions.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/GPT.cs:
Added new partition type UUIDs.
* DiscImageChef.Partitions/MBR.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/Sun.cs:
Added new partition types.
Prepare structures for marshaling.
2016-08-21 08:27:43 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
Array.Copy(tmp, offset, sector, 0, MAX_LABEL_SIZE);
|
|
|
|
|
dl = Marshal.ByteArrayToStructureLittleEndian<DiskLabel>(sector);
|
* DiscImageChef.Helpers/BigEndianStructure.cs:
* DiscImageChef.Helpers/DiscImageChef.Helpers.csproj:
Added code that directly marshals from a big-endian byte
array. But untested with nested structures.
* DiscImageChef.Partitions/Acorn.cs:
Added support for Acorn FileCore partition, closes #4.
* DiscImageChef.Partitions/BSD.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/DEC.cs:
Added support for DEC disklabels, closes #11.
* DiscImageChef.Partitions/DragonFlyBSD.cs:
Added support for DragonFly BSD 64-bit disklabels.
* DiscImageChef.Partitions/PC98.cs:
Added support for NEC PC-9800 partitions.
* DiscImageChef.Partitions/RioKarma.cs:
Added support for Rio Karma partitions.
* DiscImageChef.Partitions/SGI.cs:
Added support for SGI DVHs, closes #9.
* DiscImageChef.Partitions/UNIX.cs:
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* TODO:
* README.md:
* DiscImageChef.Partitions/DiscImageChef.Partitions.csproj:
Added support for Acorn FileCore partition, closes #4.
Added support for DEC disklabels, closes #11.
Added support for SGI DVHs, closes #9.
Moved BSD partitions from inside MBR code to separate code, as
they can (and do) appear on other architectures as the only
scheme.
Added support for DragonFly BSD 64-bit disklabels.
Added support for NEC PC-9800 partitions.
Added support for Rio Karma partitions.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/GPT.cs:
Added new partition type UUIDs.
* DiscImageChef.Partitions/MBR.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/Sun.cs:
Added new partition types.
Prepare structures for marshaling.
2016-08-21 08:27:43 +01:00
|
|
|
|
2025-08-17 06:11:22 +01:00
|
|
|
AaruLogging.Debug(MODULE_NAME,
|
2025-10-21 12:00:30 +01:00
|
|
|
Localization
|
|
|
|
|
.BSD_GetInformation_dl_magic_on_sector_0_at_offset_1_equals_2_X8_expected_3_X8,
|
|
|
|
|
location + sectorOffset,
|
|
|
|
|
offset,
|
|
|
|
|
dl.d_magic,
|
|
|
|
|
DISK_MAGIC);
|
2017-07-26 23:46:42 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
if((dl.d_magic != DISK_MAGIC || dl.d_magic2 != DISK_MAGIC) &&
|
|
|
|
|
(dl.d_magic != DISK_CIGAM || dl.d_magic2 != DISK_CIGAM))
|
2020-02-29 18:03:35 +00:00
|
|
|
continue;
|
2018-03-08 20:00:01 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
found = true;
|
|
|
|
|
|
|
|
|
|
break;
|
* DiscImageChef.Helpers/BigEndianStructure.cs:
* DiscImageChef.Helpers/DiscImageChef.Helpers.csproj:
Added code that directly marshals from a big-endian byte
array. But untested with nested structures.
* DiscImageChef.Partitions/Acorn.cs:
Added support for Acorn FileCore partition, closes #4.
* DiscImageChef.Partitions/BSD.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/DEC.cs:
Added support for DEC disklabels, closes #11.
* DiscImageChef.Partitions/DragonFlyBSD.cs:
Added support for DragonFly BSD 64-bit disklabels.
* DiscImageChef.Partitions/PC98.cs:
Added support for NEC PC-9800 partitions.
* DiscImageChef.Partitions/RioKarma.cs:
Added support for Rio Karma partitions.
* DiscImageChef.Partitions/SGI.cs:
Added support for SGI DVHs, closes #9.
* DiscImageChef.Partitions/UNIX.cs:
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* TODO:
* README.md:
* DiscImageChef.Partitions/DiscImageChef.Partitions.csproj:
Added support for Acorn FileCore partition, closes #4.
Added support for DEC disklabels, closes #11.
Added support for SGI DVHs, closes #9.
Moved BSD partitions from inside MBR code to separate code, as
they can (and do) appear on other architectures as the only
scheme.
Added support for DragonFly BSD 64-bit disklabels.
Added support for NEC PC-9800 partitions.
Added support for Rio Karma partitions.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/GPT.cs:
Added new partition type UUIDs.
* DiscImageChef.Partitions/MBR.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/Sun.cs:
Added new partition types.
Prepare structures for marshaling.
2016-08-21 08:27:43 +01:00
|
|
|
}
|
|
|
|
|
|
2024-05-01 04:05:22 +01:00
|
|
|
if(found) break;
|
* DiscImageChef.Helpers/BigEndianStructure.cs:
* DiscImageChef.Helpers/DiscImageChef.Helpers.csproj:
Added code that directly marshals from a big-endian byte
array. But untested with nested structures.
* DiscImageChef.Partitions/Acorn.cs:
Added support for Acorn FileCore partition, closes #4.
* DiscImageChef.Partitions/BSD.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/DEC.cs:
Added support for DEC disklabels, closes #11.
* DiscImageChef.Partitions/DragonFlyBSD.cs:
Added support for DragonFly BSD 64-bit disklabels.
* DiscImageChef.Partitions/PC98.cs:
Added support for NEC PC-9800 partitions.
* DiscImageChef.Partitions/RioKarma.cs:
Added support for Rio Karma partitions.
* DiscImageChef.Partitions/SGI.cs:
Added support for SGI DVHs, closes #9.
* DiscImageChef.Partitions/UNIX.cs:
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* TODO:
* README.md:
* DiscImageChef.Partitions/DiscImageChef.Partitions.csproj:
Added support for Acorn FileCore partition, closes #4.
Added support for DEC disklabels, closes #11.
Added support for SGI DVHs, closes #9.
Moved BSD partitions from inside MBR code to separate code, as
they can (and do) appear on other architectures as the only
scheme.
Added support for DragonFly BSD 64-bit disklabels.
Added support for NEC PC-9800 partitions.
Added support for Rio Karma partitions.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/GPT.cs:
Added new partition type UUIDs.
* DiscImageChef.Partitions/MBR.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/Sun.cs:
Added new partition types.
Prepare structures for marshaling.
2016-08-21 08:27:43 +01:00
|
|
|
}
|
|
|
|
|
|
2024-05-01 04:05:22 +01:00
|
|
|
if(!found) return false;
|
2022-03-06 13:29:38 +00:00
|
|
|
|
2025-10-21 12:00:30 +01:00
|
|
|
if(dl is { d_magic: DISK_CIGAM, d_magic2: DISK_CIGAM }) dl = dl.SwapEndian();
|
2022-03-06 13:29:38 +00:00
|
|
|
|
2025-08-17 06:11:22 +01:00
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_type = {0}", dl.d_type);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_subtype = {0}", dl.d_subtype);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_typename = {0}", StringHandlers.CToString(dl.d_typename));
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_packname = {0}", StringHandlers.CToString(dl.d_packname));
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_secsize = {0}", dl.d_secsize);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_nsectors = {0}", dl.d_nsectors);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_ntracks = {0}", dl.d_ntracks);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_ncylinders = {0}", dl.d_ncylinders);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_secpercyl = {0}", dl.d_secpercyl);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_secperunit = {0}", dl.d_secperunit);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_sparespertrack = {0}", dl.d_sparespertrack);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_sparespercyl = {0}", dl.d_sparespercyl);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_acylinders = {0}", dl.d_acylinders);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_rpm = {0}", dl.d_rpm);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_interleave = {0}", dl.d_interleave);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_trackskew = {0}", dl.d_trackskew);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_cylskeew = {0}", dl.d_cylskeew);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_headswitch = {0}", dl.d_headswitch);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_trkseek = {0}", dl.d_trkseek);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_flags = {0}", dl.d_flags);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_drivedata[0] = {0}", dl.d_drivedata[0]);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_drivedata[1] = {0}", dl.d_drivedata[1]);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_drivedata[2] = {0}", dl.d_drivedata[2]);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_drivedata[3] = {0}", dl.d_drivedata[3]);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_drivedata[4] = {0}", dl.d_drivedata[4]);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_spare[0] = {0}", dl.d_spare[0]);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_spare[1] = {0}", dl.d_spare[1]);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_spare[2] = {0}", dl.d_spare[2]);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_spare[3] = {0}", dl.d_spare[3]);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_spare[4] = {0}", dl.d_spare[4]);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_magic2 = 0x{0:X8}", dl.d_magic2);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_checksum = 0x{0:X8}", dl.d_checksum);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_npartitions = {0}", dl.d_npartitions);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_bbsize = {0}", dl.d_bbsize);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_sbsize = {0}", dl.d_sbsize);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
|
|
|
|
ulong counter = 0;
|
2025-10-22 14:28:58 +01:00
|
|
|
var addSectorOffset = false;
|
2022-03-06 13:29:38 +00:00
|
|
|
|
2025-10-22 14:28:58 +01:00
|
|
|
for(var i = 0; i < dl.d_npartitions && i < 22; i++)
|
2017-12-24 03:11:33 +00:00
|
|
|
{
|
2025-08-17 06:11:22 +01:00
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_partitions[i].p_offset = {0}", dl.d_partitions[i].p_offset);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
2025-08-17 06:11:22 +01:00
|
|
|
AaruLogging.Debug(MODULE_NAME, "dl.d_partitions[i].p_size = {0}", dl.d_partitions[i].p_size);
|
2022-03-06 13:29:38 +00:00
|
|
|
|
2025-08-17 06:11:22 +01:00
|
|
|
AaruLogging.Debug(MODULE_NAME,
|
2025-10-21 12:00:30 +01:00
|
|
|
"dl.d_partitions[i].p_fstype = {0} ({1})",
|
|
|
|
|
dl.d_partitions[i].p_fstype,
|
|
|
|
|
FSTypeToString(dl.d_partitions[i].p_fstype));
|
2022-03-06 13:29:38 +00:00
|
|
|
|
|
|
|
|
var 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),
|
|
|
|
|
Sequence = counter,
|
|
|
|
|
Scheme = Name
|
|
|
|
|
};
|
|
|
|
|
|
2024-05-01 04:05:22 +01:00
|
|
|
if(dl.d_partitions[i].p_fstype == fsType.Unused) continue;
|
2022-03-06 13:29:38 +00:00
|
|
|
|
|
|
|
|
// Crude and dirty way to know if the disklabel is relative to its parent partition...
|
2024-05-01 04:05:22 +01:00
|
|
|
if(dl.d_partitions[i].p_offset < sectorOffset && !addSectorOffset) addSectorOffset = true;
|
2022-03-06 13:29:38 +00:00
|
|
|
|
|
|
|
|
if(addSectorOffset)
|
2017-12-24 03:11:33 +00:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
part.Start += sectorOffset;
|
|
|
|
|
part.Offset += sectorOffset * imagePlugin.Info.SectorSize;
|
2017-12-24 03:11:33 +00:00
|
|
|
}
|
2022-03-06 13:29:38 +00:00
|
|
|
|
2025-08-17 06:11:22 +01:00
|
|
|
AaruLogging.Debug(MODULE_NAME, "part.start = {0}", part.Start);
|
|
|
|
|
AaruLogging.Debug(MODULE_NAME, Localization.BSD_GetInformation_Adding_it);
|
2022-03-06 13:29:38 +00:00
|
|
|
partitions.Add(part);
|
|
|
|
|
counter++;
|
2017-12-24 03:11:33 +00:00
|
|
|
}
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
return partitions.Count > 0;
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-03 23:36:49 +01:00
|
|
|
#endregion
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
internal static string FSTypeToString(fsType typ)
|
|
|
|
|
{
|
2024-05-01 17:18:37 +01:00
|
|
|
return typ switch
|
|
|
|
|
{
|
|
|
|
|
fsType.Unused => Localization.Unused_entry,
|
|
|
|
|
fsType.Swap => Localization.Swap_partition,
|
|
|
|
|
fsType.V6 => Localization.UNIX_6th_Edition,
|
|
|
|
|
fsType.V7 => Localization.UNIX_7th_Edition,
|
|
|
|
|
fsType.SystemV => Localization.UNIX_System_V,
|
|
|
|
|
fsType.V7_1K => Localization.UNIX_7th_Edition_with_1K_blocks,
|
|
|
|
|
fsType.V8 => Localization.UNIX_8th_Edition_with_4K_blocks,
|
|
|
|
|
fsType.BSDFFS => Localization._4_2_BSD_Fast_File_System,
|
|
|
|
|
fsType.BSDLFS => Localization._4_4_LFS,
|
|
|
|
|
fsType.HPFS => Localization.HPFS,
|
|
|
|
|
fsType.ISO9660 => Localization.ISO9660,
|
|
|
|
|
fsType.Boot or fsType.SysVBoot => Localization.Boot,
|
|
|
|
|
fsType.AFFS => Localization.Amiga_FFS,
|
|
|
|
|
fsType.HFS => Localization.Apple_HFS,
|
|
|
|
|
fsType.ADVfs => Localization.Digital_Advanced_File_System,
|
|
|
|
|
fsType.LSMpublic => Localization.Digital_LSM_Public_Region,
|
|
|
|
|
fsType.LSMprivate => Localization.Digital_LSM_Private_Region,
|
|
|
|
|
fsType.LSMsimple => Localization.Digital_LSM_Simple_Disk,
|
|
|
|
|
fsType.CCD => Localization.Concatenated_disk,
|
|
|
|
|
fsType.JFS2 => Localization.IBM_JFS2,
|
|
|
|
|
fsType.HAMMER => Localization.Hammer,
|
|
|
|
|
fsType.HAMMER2 => Localization.Hammer2,
|
|
|
|
|
fsType.UDF => Localization.UDF,
|
|
|
|
|
fsType.EFS => Localization.EFS,
|
|
|
|
|
fsType.ZFS => Localization.ZFS,
|
|
|
|
|
fsType.NANDFS => Localization.FreeBSD_nandfs,
|
|
|
|
|
fsType.MSDOS => Localization.FAT,
|
|
|
|
|
fsType.Other => Localization.Other_or_unknown,
|
|
|
|
|
_ => Localization.Unknown_partition_type
|
|
|
|
|
};
|
2022-03-06 13:29:38 +00:00
|
|
|
}
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2023-10-03 23:36:49 +01:00
|
|
|
#region Nested type: BSDPartition
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
2025-10-21 12:00:30 +01:00
|
|
|
[SwapEndian]
|
|
|
|
|
partial struct BSDPartition
|
2023-10-03 23:36:49 +01:00
|
|
|
{
|
|
|
|
|
/// <summary>Sectors in partition</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public uint p_size;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Starting sector</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public uint p_offset;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Fragment size</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public uint p_fsize;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Filesystem type, <see cref="fsType" /></summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public fsType p_fstype;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Fragment size</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public byte p_frag;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Cylinder per group</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public ushort p_cpg;
|
2023-10-03 23:36:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Nested type: dFlags
|
|
|
|
|
|
|
|
|
|
/// <summary>Drive flags</summary>
|
|
|
|
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
|
|
|
|
[Flags]
|
|
|
|
|
enum dFlags : uint
|
|
|
|
|
{
|
|
|
|
|
/// <summary>Removable media</summary>
|
|
|
|
|
Removable = 0x01,
|
|
|
|
|
/// <summary>Drive supports ECC</summary>
|
|
|
|
|
ECC = 0x02,
|
|
|
|
|
/// <summary>Drive supports bad sector forwarding</summary>
|
|
|
|
|
BadSectorForward = 0x04,
|
|
|
|
|
/// <summary>Disk emulator</summary>
|
|
|
|
|
RAMDisk = 0x08,
|
|
|
|
|
/// <summary>Can do back to back transfer</summary>
|
|
|
|
|
Chain = 0x10,
|
|
|
|
|
/// <summary>Dynamic geometry device</summary>
|
|
|
|
|
DynamicGeometry = 0x20
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Nested type: DiskLabel
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
2025-10-21 12:00:30 +01:00
|
|
|
[SwapEndian]
|
|
|
|
|
partial struct DiskLabel
|
2023-10-03 23:36:49 +01:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <see cref="BSD.DISK_MAGIC" />
|
|
|
|
|
/// </summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public uint d_magic;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// <see cref="dType" />
|
|
|
|
|
/// </summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public dType d_type;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Disk subtype</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public ushort d_subtype;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Type name</summary>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
2025-10-21 12:00:30 +01:00
|
|
|
public byte[] d_typename;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Pack identifier</summary>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
2025-10-21 12:00:30 +01:00
|
|
|
public byte[] d_packname;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Bytes per sector</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public uint d_secsize;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Sectors per track</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public uint d_nsectors;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Tracks per cylinder</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public uint d_ntracks;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Cylinders per unit</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public uint d_ncylinders;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Sectors per cylinder</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public uint d_secpercyl;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Sectors per unit</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public uint d_secperunit;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Spare sectors per track</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public ushort d_sparespertrack;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Spare sectors per cylinder</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public ushort d_sparespercyl;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Alternate cylinders</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public uint d_acylinders;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Rotational speed</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public ushort d_rpm;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Hardware sector interleave</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public ushort d_interleave;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Sector 0 skew per track</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public ushort d_trackskew;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Sector 0 sker per cylinder</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public ushort d_cylskeew;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Head switch time in microseconds</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public uint d_headswitch;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Track to track seek in microseconds</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public uint d_trkseek;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// <see cref="dFlags" />
|
|
|
|
|
/// </summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public dFlags d_flags;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Drive-specific information</summary>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
|
2025-10-21 12:00:30 +01:00
|
|
|
public uint[] d_drivedata;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Reserved</summary>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
|
2025-10-21 12:00:30 +01:00
|
|
|
public uint[] d_spare;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary><see cref="BSD.DISK_MAGIC" /> again</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public uint d_magic2;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>XOR of data</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public ushort d_checksum;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>How many partitions</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public ushort d_npartitions;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Size of boot area in bytes</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public uint d_bbsize;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Maximum size of superblock in bytes</summary>
|
2025-10-21 12:00:30 +01:00
|
|
|
public uint d_sbsize;
|
2023-10-03 23:36:49 +01:00
|
|
|
/// <summary>Partitions</summary>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 22)]
|
2025-10-21 12:00:30 +01:00
|
|
|
public BSDPartition[] d_partitions;
|
2023-10-03 23:36:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Nested type: dType
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
/// <summary>Drive type</summary>
|
|
|
|
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
|
|
|
|
enum dType : ushort
|
|
|
|
|
{
|
|
|
|
|
/// <summary>SMD, XSMD</summary>
|
|
|
|
|
SMD = 1,
|
|
|
|
|
/// <summary>MSCP</summary>
|
|
|
|
|
MSCP = 2,
|
|
|
|
|
/// <summary>Other DEC (rk, rl)</summary>
|
|
|
|
|
DEC = 3,
|
|
|
|
|
/// <summary>SCSI</summary>
|
|
|
|
|
SCSI = 4,
|
|
|
|
|
/// <summary>ESDI</summary>
|
|
|
|
|
ESDI = 5,
|
|
|
|
|
/// <summary>ST506 et al</summary>
|
|
|
|
|
ST506 = 6,
|
|
|
|
|
/// <summary>CS/80 on HP-IB</summary>
|
|
|
|
|
HPIB = 7,
|
|
|
|
|
/// <summary>HP Fiber-link</summary>
|
|
|
|
|
HPFL = 8,
|
|
|
|
|
/// <summary>Floppy</summary>
|
|
|
|
|
FLOPPY = 10,
|
|
|
|
|
/// <summary>Concatenated disk</summary>
|
|
|
|
|
CCD = 11,
|
|
|
|
|
/// <summary>uvnode pseudo-disk</summary>
|
|
|
|
|
VND = 12,
|
|
|
|
|
/// <summary>DiskOnChip</summary>
|
|
|
|
|
DOC2K = 13,
|
|
|
|
|
/// <summary>ATAPI</summary>
|
|
|
|
|
ATAPI = 13,
|
|
|
|
|
/// <summary>CMU RAIDframe</summary>
|
|
|
|
|
RAID = 14,
|
|
|
|
|
/// <summary>Logical disk</summary>
|
|
|
|
|
LD = 15,
|
|
|
|
|
/// <summary>IBM JFS 2</summary>
|
|
|
|
|
JFS2 = 16,
|
|
|
|
|
/// <summary>Cryptographic pseudo-disk</summary>
|
|
|
|
|
CGD = 17,
|
|
|
|
|
/// <summary>Vinum volume</summary>
|
|
|
|
|
VINUM = 18,
|
|
|
|
|
/// <summary>Flash memory devices</summary>
|
|
|
|
|
FLASH = 19,
|
|
|
|
|
/// <summary>Device-mapper pseudo-disk devices</summary>
|
|
|
|
|
DM = 20,
|
|
|
|
|
/// <summary>Rump virtual disk</summary>
|
|
|
|
|
RUMPD = 21,
|
|
|
|
|
/// <summary>Memory disk</summary>
|
|
|
|
|
MD = 22
|
|
|
|
|
}
|
* DiscImageChef.Helpers/BigEndianStructure.cs:
* DiscImageChef.Helpers/DiscImageChef.Helpers.csproj:
Added code that directly marshals from a big-endian byte
array. But untested with nested structures.
* DiscImageChef.Partitions/Acorn.cs:
Added support for Acorn FileCore partition, closes #4.
* DiscImageChef.Partitions/BSD.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/DEC.cs:
Added support for DEC disklabels, closes #11.
* DiscImageChef.Partitions/DragonFlyBSD.cs:
Added support for DragonFly BSD 64-bit disklabels.
* DiscImageChef.Partitions/PC98.cs:
Added support for NEC PC-9800 partitions.
* DiscImageChef.Partitions/RioKarma.cs:
Added support for Rio Karma partitions.
* DiscImageChef.Partitions/SGI.cs:
Added support for SGI DVHs, closes #9.
* DiscImageChef.Partitions/UNIX.cs:
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* TODO:
* README.md:
* DiscImageChef.Partitions/DiscImageChef.Partitions.csproj:
Added support for Acorn FileCore partition, closes #4.
Added support for DEC disklabels, closes #11.
Added support for SGI DVHs, closes #9.
Moved BSD partitions from inside MBR code to separate code, as
they can (and do) appear on other architectures as the only
scheme.
Added support for DragonFly BSD 64-bit disklabels.
Added support for NEC PC-9800 partitions.
Added support for Rio Karma partitions.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/GPT.cs:
Added new partition type UUIDs.
* DiscImageChef.Partitions/MBR.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/Sun.cs:
Added new partition types.
Prepare structures for marshaling.
2016-08-21 08:27:43 +01:00
|
|
|
|
2023-10-03 23:36:49 +01:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Nested type: fsType
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
/// <summary>Filesystem type</summary>
|
|
|
|
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
2023-10-05 01:05:23 +01:00
|
|
|
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
2022-03-06 13:29:38 +00:00
|
|
|
internal enum fsType : byte
|
|
|
|
|
{
|
|
|
|
|
/// <summary>Unused entry</summary>
|
|
|
|
|
Unused = 0,
|
|
|
|
|
/// <summary>Swap partition</summary>
|
|
|
|
|
Swap = 1,
|
|
|
|
|
/// <summary>UNIX 6th Edition</summary>
|
|
|
|
|
V6 = 2,
|
|
|
|
|
/// <summary>UNIX 7th Edition</summary>
|
|
|
|
|
V7 = 3,
|
|
|
|
|
/// <summary>UNIX System V</summary>
|
|
|
|
|
SystemV = 4,
|
|
|
|
|
/// <summary>UNIX 7th Edition with 1K blocks</summary>
|
|
|
|
|
V7_1K = 5,
|
|
|
|
|
/// <summary>UNIX 8th Edition with 4K blocks</summary>
|
|
|
|
|
V8 = 6,
|
|
|
|
|
/// <summary>4.2BSD Fast File System</summary>
|
|
|
|
|
BSDFFS = 7,
|
|
|
|
|
/// <summary>MS-DOS filesystem</summary>
|
|
|
|
|
MSDOS = 8,
|
|
|
|
|
/// <summary>4.4LFS</summary>
|
|
|
|
|
BSDLFS = 9,
|
|
|
|
|
/// <summary>In use, unknown or unsupported</summary>
|
|
|
|
|
Other = 10,
|
|
|
|
|
/// <summary>HPFS</summary>
|
|
|
|
|
HPFS = 11,
|
|
|
|
|
/// <summary>ISO9660</summary>
|
|
|
|
|
ISO9660 = 12,
|
|
|
|
|
/// <summary>Boot partition</summary>
|
|
|
|
|
Boot = 13,
|
|
|
|
|
/// <summary>Amiga FFS</summary>
|
|
|
|
|
AFFS = 14,
|
|
|
|
|
/// <summary>Apple HFS</summary>
|
|
|
|
|
HFS = 15,
|
|
|
|
|
/// <summary>Acorn ADFS</summary>
|
|
|
|
|
FileCore = 16,
|
|
|
|
|
/// <summary>Digital Advanced File System</summary>
|
|
|
|
|
ADVfs = 16,
|
|
|
|
|
/// <summary>Digital LSM Public Region</summary>
|
|
|
|
|
LSMpublic = 17,
|
|
|
|
|
/// <summary>Linux ext2</summary>
|
|
|
|
|
ext2 = 17,
|
|
|
|
|
/// <summary>Digital LSM Private Region</summary>
|
|
|
|
|
LSMprivate = 18,
|
|
|
|
|
/// <summary>NTFS</summary>
|
|
|
|
|
NTFS = 18,
|
|
|
|
|
/// <summary>Digital LSM Simple Disk</summary>
|
|
|
|
|
LSMsimple = 19,
|
|
|
|
|
/// <summary>RAIDframe component</summary>
|
|
|
|
|
RAID = 19,
|
|
|
|
|
/// <summary>Concatenated disk component</summary>
|
|
|
|
|
CCD = 20,
|
|
|
|
|
/// <summary>IBM JFS2</summary>
|
|
|
|
|
JFS2 = 21,
|
|
|
|
|
/// <summary>Apple UFS</summary>
|
|
|
|
|
AppleUFS = 22,
|
|
|
|
|
/// <summary>Hammer filesystem</summary>
|
|
|
|
|
HAMMER = 22,
|
|
|
|
|
/// <summary>Hammer2 filesystem</summary>
|
|
|
|
|
HAMMER2 = 23,
|
|
|
|
|
/// <summary>UDF</summary>
|
|
|
|
|
UDF = 24,
|
|
|
|
|
/// <summary>System V Boot filesystem</summary>
|
|
|
|
|
SysVBoot = 25,
|
|
|
|
|
/// <summary>EFS</summary>
|
|
|
|
|
EFS = 26,
|
|
|
|
|
/// <summary>ZFS</summary>
|
|
|
|
|
ZFS = 27,
|
|
|
|
|
/// <summary>NiLFS</summary>
|
|
|
|
|
NILFS = 27,
|
|
|
|
|
/// <summary>Cryptographic disk</summary>
|
|
|
|
|
CGD = 28,
|
|
|
|
|
/// <summary>MINIX v3</summary>
|
|
|
|
|
MINIX = 29,
|
|
|
|
|
/// <summary>FreeBSD nandfs</summary>
|
|
|
|
|
NANDFS = 30
|
|
|
|
|
}
|
* DiscImageChef.Helpers/BigEndianStructure.cs:
* DiscImageChef.Helpers/DiscImageChef.Helpers.csproj:
Added code that directly marshals from a big-endian byte
array. But untested with nested structures.
* DiscImageChef.Partitions/Acorn.cs:
Added support for Acorn FileCore partition, closes #4.
* DiscImageChef.Partitions/BSD.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/DEC.cs:
Added support for DEC disklabels, closes #11.
* DiscImageChef.Partitions/DragonFlyBSD.cs:
Added support for DragonFly BSD 64-bit disklabels.
* DiscImageChef.Partitions/PC98.cs:
Added support for NEC PC-9800 partitions.
* DiscImageChef.Partitions/RioKarma.cs:
Added support for Rio Karma partitions.
* DiscImageChef.Partitions/SGI.cs:
Added support for SGI DVHs, closes #9.
* DiscImageChef.Partitions/UNIX.cs:
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* TODO:
* README.md:
* DiscImageChef.Partitions/DiscImageChef.Partitions.csproj:
Added support for Acorn FileCore partition, closes #4.
Added support for DEC disklabels, closes #11.
Added support for SGI DVHs, closes #9.
Moved BSD partitions from inside MBR code to separate code, as
they can (and do) appear on other architectures as the only
scheme.
Added support for DragonFly BSD 64-bit disklabels.
Added support for NEC PC-9800 partitions.
Added support for Rio Karma partitions.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/GPT.cs:
Added new partition type UUIDs.
* DiscImageChef.Partitions/MBR.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/Sun.cs:
Added new partition types.
Prepare structures for marshaling.
2016-08-21 08:27:43 +01:00
|
|
|
|
2023-10-03 23:36:49 +01:00
|
|
|
#endregion
|
* DiscImageChef.Helpers/BigEndianStructure.cs:
* DiscImageChef.Helpers/DiscImageChef.Helpers.csproj:
Added code that directly marshals from a big-endian byte
array. But untested with nested structures.
* DiscImageChef.Partitions/Acorn.cs:
Added support for Acorn FileCore partition, closes #4.
* DiscImageChef.Partitions/BSD.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/DEC.cs:
Added support for DEC disklabels, closes #11.
* DiscImageChef.Partitions/DragonFlyBSD.cs:
Added support for DragonFly BSD 64-bit disklabels.
* DiscImageChef.Partitions/PC98.cs:
Added support for NEC PC-9800 partitions.
* DiscImageChef.Partitions/RioKarma.cs:
Added support for Rio Karma partitions.
* DiscImageChef.Partitions/SGI.cs:
Added support for SGI DVHs, closes #9.
* DiscImageChef.Partitions/UNIX.cs:
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* TODO:
* README.md:
* DiscImageChef.Partitions/DiscImageChef.Partitions.csproj:
Added support for Acorn FileCore partition, closes #4.
Added support for DEC disklabels, closes #11.
Added support for SGI DVHs, closes #9.
Moved BSD partitions from inside MBR code to separate code, as
they can (and do) appear on other architectures as the only
scheme.
Added support for DragonFly BSD 64-bit disklabels.
Added support for NEC PC-9800 partitions.
Added support for Rio Karma partitions.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/GPT.cs:
Added new partition type UUIDs.
* DiscImageChef.Partitions/MBR.cs:
Moved BSD partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
Moved UNIX partitions from inside MBR code to separate code,
as they can (and do) appear on other architectures as the
only scheme.
* DiscImageChef.Partitions/Sun.cs:
Added new partition types.
Prepare structures for marshaling.
2016-08-21 08:27:43 +01:00
|
|
|
}
|