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 : DragonFlyBSD.cs
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
//
|
|
|
|
|
// Component : Partitioning scheme plugins.
|
|
|
|
|
//
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// Manages DragonFly BSD 64-bit 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;
|
* 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;
|
2021-09-19 21:16:47 +01:00
|
|
|
using Aaru.CommonTypes.Enums;
|
2020-02-27 00:33:26 +00:00
|
|
|
using Aaru.CommonTypes.Interfaces;
|
|
|
|
|
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 DragonFly BSD disklabels</summary>
|
|
|
|
|
[SuppressMessage("ReSharper", "UnusedMember.Local")]
|
|
|
|
|
public sealed class DragonFlyBSD : 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_MAGIC64 = 0xC4464C59;
|
* 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
|
|
|
#region IPartition Members
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
/// <inheritdoc />
|
2022-11-29 03:13:21 +00:00
|
|
|
public string Name => Localization.DragonFlyBSD_Name;
|
2023-10-03 23:36:49 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
/// <inheritdoc />
|
|
|
|
|
public Guid Id => new("D49E41A6-D952-4760-9D94-03DAE2450C5F");
|
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;
|
* 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 />
|
|
|
|
|
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 nSectors = 2048 / imagePlugin.Info.SectorSize;
|
* 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(2048 % imagePlugin.Info.SectorSize > 0) nSectors++;
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2024-05-01 04:05:22 +01:00
|
|
|
if(sectorOffset + nSectors >= imagePlugin.Info.Sectors) return false;
|
2017-07-24 23:35:33 +01:00
|
|
|
|
2025-10-23 03:07:43 +01:00
|
|
|
ErrorNumber errno = imagePlugin.ReadSectors(sectorOffset, false, nSectors, out byte[] sectors, out _);
|
2020-02-29 18:03:35 +00:00
|
|
|
|
2024-05-01 04:05:22 +01:00
|
|
|
if(errno != ErrorNumber.NoError || sectors.Length < 2048) return false;
|
* 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
|
|
|
Disklabel64 disklabel = Marshal.ByteArrayToStructureLittleEndian<Disklabel64>(sectors);
|
* 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(disklabel.d_magic != 0xC4464C59) return false;
|
* 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
|
|
|
ulong counter = 0;
|
* 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
|
|
|
foreach(Partition64 entry in disklabel.d_partitions)
|
|
|
|
|
{
|
|
|
|
|
var part = new Partition
|
* 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
|
|
|
Start = entry.p_boffset / imagePlugin.Info.SectorSize + sectorOffset,
|
|
|
|
|
Offset = entry.p_boffset + sectorOffset * imagePlugin.Info.SectorSize,
|
2022-03-06 13:29:38 +00:00
|
|
|
Size = entry.p_bsize,
|
|
|
|
|
Length = entry.p_bsize / imagePlugin.Info.SectorSize,
|
|
|
|
|
Name = entry.p_stor_uuid.ToString(),
|
|
|
|
|
Sequence = counter,
|
|
|
|
|
Scheme = Name,
|
2023-10-03 23:36:49 +01:00
|
|
|
Type = (BSD.fsType)entry.p_fstype == BSD.fsType.Other
|
|
|
|
|
? entry.p_type_uuid.ToString()
|
2022-03-06 13:29:38 +00:00
|
|
|
: BSD.FSTypeToString((BSD.fsType)entry.p_fstype)
|
|
|
|
|
};
|
|
|
|
|
|
2024-05-01 04:05:22 +01:00
|
|
|
if(entry.p_bsize % imagePlugin.Info.SectorSize > 0) part.Length++;
|
2022-03-06 13:29:38 +00:00
|
|
|
|
2024-05-01 04:05:22 +01:00
|
|
|
if(entry.p_bsize <= 0 || entry.p_boffset <= 0) continue;
|
2022-03-06 13:29:38 +00:00
|
|
|
|
|
|
|
|
partitions.Add(part);
|
|
|
|
|
counter++;
|
* 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
|
|
|
return true;
|
|
|
|
|
}
|
* 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: Disklabel64
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
|
|
|
readonly struct Disklabel64
|
|
|
|
|
{
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)]
|
|
|
|
|
public readonly byte[] d_reserved0;
|
|
|
|
|
public readonly uint d_magic;
|
|
|
|
|
public readonly uint d_crc;
|
|
|
|
|
public readonly uint d_align;
|
|
|
|
|
public readonly uint d_npartitions;
|
|
|
|
|
public readonly Guid d_stor_uuid;
|
|
|
|
|
public readonly ulong d_total_size;
|
|
|
|
|
public readonly ulong d_bbase;
|
|
|
|
|
public readonly ulong d_pbase;
|
|
|
|
|
public readonly ulong d_pstop;
|
|
|
|
|
public readonly ulong d_abase;
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
|
|
|
|
|
public readonly byte[] d_packname;
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
|
|
|
|
|
public readonly byte[] d_reserved;
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
|
|
|
|
public readonly Partition64[] d_partitions;
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-03 23:36:49 +01:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Nested type: Partition64
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
|
|
|
readonly struct Partition64
|
|
|
|
|
{
|
|
|
|
|
public readonly ulong p_boffset;
|
|
|
|
|
public readonly ulong p_bsize;
|
|
|
|
|
public readonly byte p_fstype;
|
|
|
|
|
public readonly byte p_unused01;
|
|
|
|
|
public readonly byte p_unused02;
|
|
|
|
|
public readonly byte p_unused03;
|
|
|
|
|
public readonly uint p_unused04;
|
|
|
|
|
public readonly uint p_unused05;
|
|
|
|
|
public readonly uint p_unused06;
|
|
|
|
|
public readonly Guid p_type_uuid;
|
|
|
|
|
public readonly Guid p_stor_uuid;
|
* 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
|
|
|
}
|