Reorganize filesystems.

This commit is contained in:
2022-12-07 13:07:31 +00:00
parent 4be18eb09c
commit 5744119b9c
310 changed files with 12901 additions and 6408 deletions

View File

@@ -0,0 +1,56 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : AODOS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Commodore file system plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the AO-DOS file system and shows information.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Text;
using Aaru.CommonTypes.Interfaces;
using Schemas;
namespace Aaru.Filesystems;
// Information has been extracted looking at available disk images
// This may be missing fields, or not, I don't know russian so any help is appreciated
/// <inheritdoc />
/// <summary>Implements detection of the AO-DOS filesystem</summary>
public sealed partial class AODOS : IFilesystem
{
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public string Name => Localization.AODOS_Name;
/// <inheritdoc />
public Guid Id => new("668E5039-9DDD-442A-BE1B-A315D6E38E26");
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
}

View File

@@ -0,0 +1,46 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Consts.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Commodore file system plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the AO-DOS file system and shows information.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
namespace Aaru.Filesystems;
// Information has been extracted looking at available disk images
// This may be missing fields, or not, I don't know russian so any help is appreciated
/// <inheritdoc />
/// <summary>Implements detection of the AO-DOS filesystem</summary>
public sealed partial class AODOS
{
const string FS_TYPE = "aodos";
readonly byte[] _identifier =
{
0x20, 0x41, 0x4F, 0x2D, 0x44, 0x4F, 0x53, 0x20
};
}

View File

@@ -2,7 +2,7 @@
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : AODOS.cs
// Filename : Info.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Commodore file system plugin.
@@ -30,16 +30,13 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Helpers;
using Schemas;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Filesystems;
@@ -47,24 +44,8 @@ namespace Aaru.Filesystems;
// This may be missing fields, or not, I don't know russian so any help is appreciated
/// <inheritdoc />
/// <summary>Implements detection of the AO-DOS filesystem</summary>
public sealed class AODOS : IFilesystem
public sealed partial class AODOS
{
const string FS_TYPE = "aodos";
readonly byte[] _identifier =
{
0x20, 0x41, 0x4F, 0x2D, 0x44, 0x4F, 0x53, 0x20
};
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public string Name => Localization.AODOS_Name;
/// <inheritdoc />
public Guid Id => new("668E5039-9DDD-442A-BE1B-A315D6E38E26");
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
/// <inheritdoc />
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
@@ -128,25 +109,4 @@ public sealed class AODOS : IFilesystem
information = sbInformation.ToString();
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct BootBlock
{
/// <summary>A NOP opcode</summary>
public readonly byte nop;
/// <summary>A branch to real bootloader</summary>
public readonly ushort branch;
/// <summary>Unused</summary>
public readonly byte unused;
/// <summary>" AO-DOS "</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] identifier;
/// <summary>Volume label</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
public readonly byte[] volumeLabel;
/// <summary>How many files are present in disk</summary>
public readonly ushort files;
/// <summary>How many sectors are used</summary>
public readonly ushort usedSectors;
}
}

View File

@@ -0,0 +1,63 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Structs.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Commodore file system plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the AO-DOS file system and shows information.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System.Runtime.InteropServices;
namespace Aaru.Filesystems;
// Information has been extracted looking at available disk images
// This may be missing fields, or not, I don't know russian so any help is appreciated
/// <inheritdoc />
/// <summary>Implements detection of the AO-DOS filesystem</summary>
public sealed partial class AODOS
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct BootBlock
{
/// <summary>A NOP opcode</summary>
public readonly byte nop;
/// <summary>A branch to real bootloader</summary>
public readonly ushort branch;
/// <summary>Unused</summary>
public readonly byte unused;
/// <summary>" AO-DOS "</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] identifier;
/// <summary>Volume label</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
public readonly byte[] volumeLabel;
/// <summary>How many files are present in disk</summary>
public readonly ushort files;
/// <summary>How many sectors are used</summary>
public readonly ushort usedSectors;
}
}

View File

@@ -0,0 +1,52 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : APFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Apple filesystem plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Aaru.CommonTypes.Interfaces;
using Schemas;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the Apple File System (APFS)</summary>
[SuppressMessage("ReSharper", "UnusedMember.Local")]
public sealed partial class APFS : IFilesystem
{
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Name => Localization.APFS_Name;
/// <inheritdoc />
public Guid Id => new("A4060F9D-2909-42E2-9D95-DB31FA7EA797");
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
}

View File

@@ -0,0 +1,41 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Consts.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Apple filesystem plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the Apple File System (APFS)</summary>
[SuppressMessage("ReSharper", "UnusedMember.Local")]
public sealed partial class APFS
{
const uint APFS_CONTAINER_MAGIC = 0x4253584E; // "NXSB"
const uint APFS_VOLUME_MAGIC = 0x42535041; // "APSB"
const string FS_TYPE = "apfs";
}

View File

@@ -2,15 +2,11 @@
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : APFS.cs
// Filename : Info.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Apple filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the Apple filesystem and shows information.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
@@ -30,37 +26,21 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Text;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Helpers;
using Schemas;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the Apple File System (APFS)</summary>
[SuppressMessage("ReSharper", "UnusedMember.Local")]
public sealed class APFS : IFilesystem
public sealed partial class APFS
{
const uint APFS_CONTAINER_MAGIC = 0x4253584E; // "NXSB"
const uint APFS_VOLUME_MAGIC = 0x42535041; // "APSB"
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Name => Localization.APFS_Name;
/// <inheritdoc />
public Guid Id => new("A4060F9D-2909-42E2-9D95-DB31FA7EA797");
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
/// <inheritdoc />
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
@@ -133,18 +113,4 @@ public sealed class APFS : IFilesystem
Type = FS_TYPE
};
}
const string FS_TYPE = "apfs";
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct ContainerSuperBlock
{
public readonly ulong unknown1; // Varies between copies of the superblock
public readonly ulong unknown2;
public readonly ulong unknown3; // Varies by 1 between copies of the superblock
public readonly ulong unknown4;
public readonly uint magic;
public readonly uint blockSize;
public readonly ulong containerBlocks;
}
}

View File

@@ -0,0 +1,50 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Structs.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Apple filesystem plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the Apple File System (APFS)</summary>
[SuppressMessage("ReSharper", "UnusedMember.Local")]
public sealed partial class APFS
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct ContainerSuperBlock
{
public readonly ulong unknown1; // Varies between copies of the superblock
public readonly ulong unknown2;
public readonly ulong unknown3; // Varies by 1 between copies of the superblock
public readonly ulong unknown4;
public readonly uint magic;
public readonly uint blockSize;
public readonly ulong containerBlocks;
}
}

View File

@@ -1,16 +1,57 @@
<wpf:ResourceDictionary xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="clr-namespace:System;assembly=mscorlib"
xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xml:space="preserve">
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=acorn/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=amigados/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=aodos/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=apfs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=applecommon/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=appledos/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=applehfs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=applehfsplus/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=applemfs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=atheos/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=bfs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=btrfs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=cbm/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=cpm/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=cram/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=dump/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=ecma67/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=efs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=exfat/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=ext2fs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=extfs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=f2fs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=fat/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=fatx/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=ffs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=fossil/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=hammer/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=hpfs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=hpofs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
@@ -19,7 +60,68 @@
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=iso9660_005Cconsts/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=iso9660_005Cstructs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=jfs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=lif/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=localization/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=opera/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=locus/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=microdos/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=minixfs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=nilfs2/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=nintendo/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=ntfs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=ods/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=opera/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=pcengine/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=pcfx/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=pfs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=prodos/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=qnx4/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=qnx6/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=rbf/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=refs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=reiser/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=reiser4/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=rt11/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=sfs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=solarfs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=squash/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=sysv/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=udf/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=unicos/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=unixbfs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=vmfs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=vxfs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=xfs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=xia/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=zfs/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@@ -0,0 +1,50 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Acorn.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Acorn filesystem plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Text;
using Aaru.CommonTypes.Interfaces;
using Schemas;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of Acorn's Advanced Data Filing System (ADFS)</summary>
public sealed partial class AcornADFS : IFilesystem
{
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public string Name => Localization.AcornADFS_Name;
/// <inheritdoc />
public Guid Id => new("BAFC1E50-9C64-4CD3-8400-80628CC27AFA");
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
}

View File

@@ -0,0 +1,54 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Consts.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Acorn filesystem plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of Acorn's Advanced Data Filing System (ADFS)</summary>
public sealed partial class AcornADFS
{
/// <summary>Location for boot block, in bytes</summary>
const ulong BOOT_BLOCK_LOCATION = 0xC00;
/// <summary>Size of boot block, in bytes</summary>
const uint BOOT_BLOCK_SIZE = 0x200;
/// <summary>Location of new directory, in bytes</summary>
const ulong NEW_DIRECTORY_LOCATION = 0x400;
/// <summary>Location of old directory, in bytes</summary>
const ulong OLD_DIRECTORY_LOCATION = 0x200;
/// <summary>Size of old directory</summary>
const uint OLD_DIRECTORY_SIZE = 1280;
/// <summary>Size of new directory</summary>
const uint NEW_DIRECTORY_SIZE = 2048;
/// <summary>New directory format magic number, "Nick"</summary>
const uint NEW_DIR_MAGIC = 0x6B63694E;
/// <summary>Old directory format magic number, "Hugo"</summary>
const uint OLD_DIR_MAGIC = 0x6F677548;
const string FS_TYPE = "adfs";
}

View File

@@ -0,0 +1,114 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Helpers.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Acorn filesystem plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of Acorn's Advanced Data Filing System (ADFS)</summary>
public sealed partial class AcornADFS
{
static byte AcornMapChecksum(byte[] data, int length)
{
int sum = 0;
int carry = 0;
if(length > data.Length)
length = data.Length;
// ADC r0, r0, r1
// MOVS r0, r0, LSL #24
// MOV r0, r0, LSR #24
for(int i = length - 1; i >= 0; i--)
{
sum += data[i] + carry;
if(sum > 0xFF)
{
carry = 1;
sum &= 0xFF;
}
else
carry = 0;
}
return (byte)(sum & 0xFF);
}
static byte NewMapChecksum(byte[] mapBase)
{
uint rover;
uint sumVector0 = 0;
uint sumVector1 = 0;
uint sumVector2 = 0;
uint sumVector3 = 0;
for(rover = (uint)(mapBase.Length - 4); rover > 0; rover -= 4)
{
sumVector0 += mapBase[rover + 0] + (sumVector3 >> 8);
sumVector3 &= 0xff;
sumVector1 += mapBase[rover + 1] + (sumVector0 >> 8);
sumVector0 &= 0xff;
sumVector2 += mapBase[rover + 2] + (sumVector1 >> 8);
sumVector1 &= 0xff;
sumVector3 += mapBase[rover + 3] + (sumVector2 >> 8);
sumVector2 &= 0xff;
}
/*
Don't add the check byte when calculating its value
*/
sumVector0 += sumVector3 >> 8;
sumVector1 += mapBase[1] + (sumVector0 >> 8);
sumVector2 += mapBase[2] + (sumVector1 >> 8);
sumVector3 += mapBase[3] + (sumVector2 >> 8);
return (byte)((sumVector0 ^ sumVector1 ^ sumVector2 ^ sumVector3) & 0xff);
}
// TODO: This is not correct...
static byte AcornDirectoryChecksum(IList<byte> data, int length)
{
uint sum = 0;
if(length > data.Count)
length = data.Count;
// EOR r0, r1, r0, ROR #13
for(int i = 0; i < length; i++)
{
uint carry = sum & 0x1FFF;
sum >>= 13;
sum ^= data[i];
sum += carry << 19;
}
return (byte)(((sum & 0xFF000000) >> 24) ^ ((sum & 0xFF0000) >> 16) ^ ((sum & 0xFF00) >> 8) ^ (sum & 0xFF));
}
}

View File

@@ -2,15 +2,11 @@
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Acorn.cs
// Filename : Info.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Acorn filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the Acorn filesystem and shows information.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
@@ -31,8 +27,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
@@ -40,45 +34,13 @@ using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Helpers;
using Schemas;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of Acorn's Advanced Data Filing System (ADFS)</summary>
public sealed class AcornADFS : IFilesystem
public sealed partial class AcornADFS
{
/// <summary>Location for boot block, in bytes</summary>
const ulong BOOT_BLOCK_LOCATION = 0xC00;
/// <summary>Size of boot block, in bytes</summary>
const uint BOOT_BLOCK_SIZE = 0x200;
/// <summary>Location of new directory, in bytes</summary>
const ulong NEW_DIRECTORY_LOCATION = 0x400;
/// <summary>Location of old directory, in bytes</summary>
const ulong OLD_DIRECTORY_LOCATION = 0x200;
/// <summary>Size of old directory</summary>
const uint OLD_DIRECTORY_SIZE = 1280;
/// <summary>Size of new directory</summary>
const uint NEW_DIRECTORY_SIZE = 2048;
/// <summary>New directory format magic number, "Nick"</summary>
const uint NEW_DIR_MAGIC = 0x6B63694E;
/// <summary>Old directory format magic number, "Hugo"</summary>
const uint OLD_DIR_MAGIC = 0x6F677548;
const string FS_TYPE = "adfs";
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public string Name => Localization.AcornADFS_Name;
/// <inheritdoc />
public Guid Id => new("BAFC1E50-9C64-4CD3-8400-80628CC27AFA");
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
// TODO: BBC Master hard disks are untested...
/// <inheritdoc />
public bool Identify(IMediaImage imagePlugin, Partition partition)
@@ -604,239 +566,4 @@ public sealed class AcornADFS : IFilesystem
XmlFsType.ClusterSize = (uint)(1 << drSb.log2secsize);
XmlFsType.Type = FS_TYPE;
}
static byte AcornMapChecksum(byte[] data, int length)
{
int sum = 0;
int carry = 0;
if(length > data.Length)
length = data.Length;
// ADC r0, r0, r1
// MOVS r0, r0, LSL #24
// MOV r0, r0, LSR #24
for(int i = length - 1; i >= 0; i--)
{
sum += data[i] + carry;
if(sum > 0xFF)
{
carry = 1;
sum &= 0xFF;
}
else
carry = 0;
}
return (byte)(sum & 0xFF);
}
static byte NewMapChecksum(byte[] mapBase)
{
uint rover;
uint sumVector0 = 0;
uint sumVector1 = 0;
uint sumVector2 = 0;
uint sumVector3 = 0;
for(rover = (uint)(mapBase.Length - 4); rover > 0; rover -= 4)
{
sumVector0 += mapBase[rover + 0] + (sumVector3 >> 8);
sumVector3 &= 0xff;
sumVector1 += mapBase[rover + 1] + (sumVector0 >> 8);
sumVector0 &= 0xff;
sumVector2 += mapBase[rover + 2] + (sumVector1 >> 8);
sumVector1 &= 0xff;
sumVector3 += mapBase[rover + 3] + (sumVector2 >> 8);
sumVector2 &= 0xff;
}
/*
Don't add the check byte when calculating its value
*/
sumVector0 += sumVector3 >> 8;
sumVector1 += mapBase[1] + (sumVector0 >> 8);
sumVector2 += mapBase[2] + (sumVector1 >> 8);
sumVector3 += mapBase[3] + (sumVector2 >> 8);
return (byte)((sumVector0 ^ sumVector1 ^ sumVector2 ^ sumVector3) & 0xff);
}
// TODO: This is not correct...
static byte AcornDirectoryChecksum(IList<byte> data, int length)
{
uint sum = 0;
if(length > data.Count)
length = data.Count;
// EOR r0, r1, r0, ROR #13
for(int i = 0; i < length; i++)
{
uint carry = sum & 0x1FFF;
sum >>= 13;
sum ^= data[i];
sum += carry << 19;
}
return (byte)(((sum & 0xFF000000) >> 24) ^ ((sum & 0xFF0000) >> 16) ^ ((sum & 0xFF00) >> 8) ^ (sum & 0xFF));
}
/// <summary>Boot block, used in hard disks and ADFS-F and higher.</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct BootBlock
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x1C0)]
public readonly byte[] spare;
public readonly DiscRecord discRecord;
public readonly byte flags;
public readonly ushort startCylinder;
public readonly byte checksum;
}
/// <summary>Disc record, used in hard disks and ADFS-E and higher.</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct DiscRecord
{
public readonly byte log2secsize;
public readonly byte spt;
public readonly byte heads;
public readonly byte density;
public readonly byte idlen;
public readonly byte log2bpmb;
public readonly byte skew;
public readonly byte bootoption;
public readonly byte lowsector;
public readonly byte nzones;
public readonly ushort zone_spare;
public readonly uint root;
public readonly uint disc_size;
public readonly ushort disc_id;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
public readonly byte[] disc_name;
public readonly uint disc_type;
public readonly uint disc_size_high;
public readonly byte flags;
public readonly byte nzones_high;
public readonly uint format_version;
public readonly uint root_size;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] reserved;
}
/// <summary>Free block map, sector 0, used in ADFS-S, ADFS-L, ADFS-M and ADFS-D</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct OldMapSector0
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 82 * 3)]
public readonly byte[] freeStart;
public readonly byte reserved;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
public readonly byte[] name;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] size;
public readonly byte checksum;
}
/// <summary>Free block map, sector 1, used in ADFS-S, ADFS-L, ADFS-M and ADFS-D</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct OldMapSector1
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 82 * 3)]
public readonly byte[] freeStart;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
public readonly byte[] name;
public readonly ushort discId;
public readonly byte boot;
public readonly byte freeEnd;
public readonly byte checksum;
}
/// <summary>Free block map, sector 0, used in ADFS-E</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct NewMap
{
public readonly byte zoneChecksum;
public readonly ushort freeLink;
public readonly byte crossChecksum;
public readonly DiscRecord discRecord;
}
/// <summary>Directory header, common to "old" and "new" directories</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct DirectoryHeader
{
public readonly byte masterSequence;
public readonly uint magic;
}
/// <summary>Directory header, common to "old" and "new" directories</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct DirectoryEntry
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
public readonly byte[] name;
public readonly uint load;
public readonly uint exec;
public readonly uint length;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] address;
public readonly byte atts;
}
/// <summary>Directory tail, new format</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct NewDirectoryTail
{
public readonly byte lastMark;
public readonly ushort reserved;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] parent;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)]
public readonly byte[] title;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
public readonly byte[] name;
public readonly byte endMasSeq;
public readonly uint magic;
public readonly byte checkByte;
}
/// <summary>Directory tail, old format</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct OldDirectoryTail
{
public readonly byte lastMark;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
public readonly byte[] name;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] parent;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)]
public readonly byte[] title;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)]
public readonly byte[] reserved;
public readonly byte endMasSeq;
public readonly uint magic;
public readonly byte checkByte;
}
/// <summary>Directory, old format</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct OldDirectory
{
public readonly DirectoryHeader header;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 47)]
public readonly DirectoryEntry[] entries;
public readonly OldDirectoryTail tail;
}
/// <summary>Directory, new format</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct NewDirectory
{
public readonly DirectoryHeader header;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 77)]
public readonly DirectoryEntry[] entries;
public readonly NewDirectoryTail tail;
}
}

View File

@@ -0,0 +1,193 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Structs.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Acorn filesystem plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System.Runtime.InteropServices;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of Acorn's Advanced Data Filing System (ADFS)</summary>
public sealed partial class AcornADFS
{
/// <summary>Boot block, used in hard disks and ADFS-F and higher.</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct BootBlock
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x1C0)]
public readonly byte[] spare;
public readonly DiscRecord discRecord;
public readonly byte flags;
public readonly ushort startCylinder;
public readonly byte checksum;
}
/// <summary>Disc record, used in hard disks and ADFS-E and higher.</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct DiscRecord
{
public readonly byte log2secsize;
public readonly byte spt;
public readonly byte heads;
public readonly byte density;
public readonly byte idlen;
public readonly byte log2bpmb;
public readonly byte skew;
public readonly byte bootoption;
public readonly byte lowsector;
public readonly byte nzones;
public readonly ushort zone_spare;
public readonly uint root;
public readonly uint disc_size;
public readonly ushort disc_id;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
public readonly byte[] disc_name;
public readonly uint disc_type;
public readonly uint disc_size_high;
public readonly byte flags;
public readonly byte nzones_high;
public readonly uint format_version;
public readonly uint root_size;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public readonly byte[] reserved;
}
/// <summary>Free block map, sector 0, used in ADFS-S, ADFS-L, ADFS-M and ADFS-D</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct OldMapSector0
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 82 * 3)]
public readonly byte[] freeStart;
public readonly byte reserved;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
public readonly byte[] name;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] size;
public readonly byte checksum;
}
/// <summary>Free block map, sector 1, used in ADFS-S, ADFS-L, ADFS-M and ADFS-D</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct OldMapSector1
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 82 * 3)]
public readonly byte[] freeStart;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
public readonly byte[] name;
public readonly ushort discId;
public readonly byte boot;
public readonly byte freeEnd;
public readonly byte checksum;
}
/// <summary>Free block map, sector 0, used in ADFS-E</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct NewMap
{
public readonly byte zoneChecksum;
public readonly ushort freeLink;
public readonly byte crossChecksum;
public readonly DiscRecord discRecord;
}
/// <summary>Directory header, common to "old" and "new" directories</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct DirectoryHeader
{
public readonly byte masterSequence;
public readonly uint magic;
}
/// <summary>Directory header, common to "old" and "new" directories</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct DirectoryEntry
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
public readonly byte[] name;
public readonly uint load;
public readonly uint exec;
public readonly uint length;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] address;
public readonly byte atts;
}
/// <summary>Directory tail, new format</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct NewDirectoryTail
{
public readonly byte lastMark;
public readonly ushort reserved;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] parent;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)]
public readonly byte[] title;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
public readonly byte[] name;
public readonly byte endMasSeq;
public readonly uint magic;
public readonly byte checkByte;
}
/// <summary>Directory tail, old format</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct OldDirectoryTail
{
public readonly byte lastMark;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
public readonly byte[] name;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] parent;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 19)]
public readonly byte[] title;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)]
public readonly byte[] reserved;
public readonly byte endMasSeq;
public readonly uint magic;
public readonly byte checkByte;
}
/// <summary>Directory, old format</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct OldDirectory
{
public readonly DirectoryHeader header;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 47)]
public readonly DirectoryEntry[] entries;
public readonly OldDirectoryTail tail;
}
/// <summary>Directory, new format</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct NewDirectory
{
public readonly DirectoryHeader header;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 77)]
public readonly DirectoryEntry[] entries;
public readonly NewDirectoryTail tail;
}
}

View File

@@ -0,0 +1,50 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : AmigaDOS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Amiga Fast File System plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Text;
using Aaru.CommonTypes.Interfaces;
using Schemas;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of Amiga Fast File System (AFFS)</summary>
public sealed partial class AmigaDOSPlugin : IFilesystem
{
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public string Name => Localization.AmigaDOSPlugin_Name;
/// <inheritdoc />
public Guid Id => new("3c882400-208c-427d-a086-9119852a1bc7");
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
}

View File

@@ -0,0 +1,45 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Consts.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Amiga Fast File System plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of Amiga Fast File System (AFFS)</summary>
public sealed partial class AmigaDOSPlugin
{
const uint FFS_MASK = 0x444F5300;
const uint MUFS_MASK = 0x6D754600;
const uint TYPE_HEADER = 2;
const uint SUBTYPE_ROOT = 1;
const string FS_TYPE_OFS = "aofs";
const string FS_TYPE_FFS = "affs";
const string FS_TYPE_OFS2 = "aofs2";
const string FS_TYPE_FFS2 = "affs2";
}

View File

@@ -0,0 +1,76 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Helpers.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Amiga Fast File System plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using Aaru.Helpers;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of Amiga Fast File System (AFFS)</summary>
public sealed partial class AmigaDOSPlugin
{
static RootBlock MarshalRootBlock(byte[] block)
{
byte[] tmp = new byte[228];
Array.Copy(block, 0, tmp, 0, 24);
Array.Copy(block, block.Length - 200, tmp, 28, 200);
RootBlock root = Marshal.ByteArrayToStructureBigEndian<RootBlock>(tmp);
root.hashTable = new uint[(block.Length - 224) / 4];
for(int i = 0; i < root.hashTable.Length; i++)
root.hashTable[i] = BigEndianBitConverter.ToUInt32(block, 24 + (i * 4));
return root;
}
static uint AmigaChecksum(byte[] data)
{
uint sum = 0;
for(int i = 0; i < data.Length; i += 4)
sum += (uint)((data[i] << 24) + (data[i + 1] << 16) + (data[i + 2] << 8) + data[i + 3]);
return (uint)-sum;
}
static uint AmigaBootChecksum(byte[] data)
{
uint sum = 0;
for(int i = 0; i < data.Length; i += 4)
{
uint psum = sum;
if((sum += (uint)((data[i] << 24) + (data[i + 1] << 16) + (data[i + 2] << 8) + data[i + 3])) < psum)
sum++;
}
return ~sum;
}
}

View File

@@ -2,15 +2,11 @@
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : AmigaDOS.cs
// Filename : Info.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Amiga Fast File System plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the Amiga Fast File System and shows information.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
@@ -32,7 +28,6 @@
using System;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Aaru.Checksums;
using Aaru.CommonTypes;
@@ -41,36 +36,13 @@ using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Helpers;
using Schemas;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of Amiga Fast File System (AFFS)</summary>
public sealed class AmigaDOSPlugin : IFilesystem
public sealed partial class AmigaDOSPlugin
{
const uint FFS_MASK = 0x444F5300;
const uint MUFS_MASK = 0x6D754600;
const uint TYPE_HEADER = 2;
const uint SUBTYPE_ROOT = 1;
const string FS_TYPE_OFS = "aofs";
const string FS_TYPE_FFS = "affs";
const string FS_TYPE_OFS2 = "aofs2";
const string FS_TYPE_FFS2 = "affs2";
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public string Name => Localization.AmigaDOSPlugin_Name;
/// <inheritdoc />
public Guid Id => new("3c882400-208c-427d-a086-9119852a1bc7");
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
/// <inheritdoc />
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
@@ -409,123 +381,4 @@ public sealed class AmigaDOSPlugin : IFilesystem
// Useful as a serial
XmlFsType.VolumeSerial = $"{rootBlk.checksum:X8}";
}
static RootBlock MarshalRootBlock(byte[] block)
{
byte[] tmp = new byte[228];
Array.Copy(block, 0, tmp, 0, 24);
Array.Copy(block, block.Length - 200, tmp, 28, 200);
RootBlock root = Marshal.ByteArrayToStructureBigEndian<RootBlock>(tmp);
root.hashTable = new uint[(block.Length - 224) / 4];
for(int i = 0; i < root.hashTable.Length; i++)
root.hashTable[i] = BigEndianBitConverter.ToUInt32(block, 24 + (i * 4));
return root;
}
static uint AmigaChecksum(byte[] data)
{
uint sum = 0;
for(int i = 0; i < data.Length; i += 4)
sum += (uint)((data[i] << 24) + (data[i + 1] << 16) + (data[i + 2] << 8) + data[i + 3]);
return (uint)-sum;
}
static uint AmigaBootChecksum(byte[] data)
{
uint sum = 0;
for(int i = 0; i < data.Length; i += 4)
{
uint psum = sum;
if((sum += (uint)((data[i] << 24) + (data[i + 1] << 16) + (data[i + 2] << 8) + data[i + 3])) < psum)
sum++;
}
return ~sum;
}
/// <summary>Boot block, first 2 sectors</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct BootBlock
{
/// <summary>Offset 0x00, "DOSx" disk type</summary>
public readonly uint diskType;
/// <summary>Offset 0x04, Checksum</summary>
public readonly uint checksum;
/// <summary>Offset 0x08, Pointer to root block, mostly invalid</summary>
public readonly uint root_ptr;
/// <summary>Offset 0x0C, Boot code, til completion. Size is intentionally incorrect to allow marshaling to work.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
public byte[] bootCode;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct RootBlock
{
/// <summary>Offset 0x00, block type, value = T_HEADER (2)</summary>
public uint type;
/// <summary>Offset 0x04, unused</summary>
public readonly uint headerKey;
/// <summary>Offset 0x08, unused</summary>
public readonly uint highSeq;
/// <summary>Offset 0x0C, longs used by hash table</summary>
public uint hashTableSize;
/// <summary>Offset 0x10, unused</summary>
public readonly uint firstData;
/// <summary>Offset 0x14, Rootblock checksum</summary>
public uint checksum;
/// <summary>
/// Offset 0x18, Hashtable, size = (block size / 4) - 56 or size = hashTableSize. Size intentionally bad to allow
/// marshalling to work.
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
public uint[] hashTable;
/// <summary>Offset 0x18+hashTableSize*4+0, bitmap flag, 0xFFFFFFFF if valid</summary>
public readonly uint bitmapFlag;
/// <summary>Offset 0x18+hashTableSize*4+4, bitmap pages, 25 entries</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 25)]
public readonly uint[] bitmapPages;
/// <summary>Offset 0x18+hashTableSize*4+104, pointer to bitmap extension block</summary>
public readonly uint bitmapExtensionBlock;
/// <summary>Offset 0x18+hashTableSize*4+108, last root alteration days since 1978/01/01</summary>
public readonly uint rDays;
/// <summary>Offset 0x18+hashTableSize*4+112, last root alteration minutes past midnight</summary>
public readonly uint rMins;
/// <summary>Offset 0x18+hashTableSize*4+116, last root alteration ticks (1/50 secs)</summary>
public readonly uint rTicks;
/// <summary>Offset 0x18+hashTableSize*4+120, disk name, pascal string, 31 bytes</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 31)]
public readonly byte[] diskName;
/// <summary>Offset 0x18+hashTableSize*4+151, unused</summary>
public readonly byte padding;
/// <summary>Offset 0x18+hashTableSize*4+152, unused</summary>
public readonly uint reserved1;
/// <summary>Offset 0x18+hashTableSize*4+156, unused</summary>
public readonly uint reserved2;
/// <summary>Offset 0x18+hashTableSize*4+160, last disk alteration days since 1978/01/01</summary>
public readonly uint vDays;
/// <summary>Offset 0x18+hashTableSize*4+164, last disk alteration minutes past midnight</summary>
public readonly uint vMins;
/// <summary>Offset 0x18+hashTableSize*4+168, last disk alteration ticks (1/50 secs)</summary>
public readonly uint vTicks;
/// <summary>Offset 0x18+hashTableSize*4+172, filesystem creation days since 1978/01/01</summary>
public readonly uint cDays;
/// <summary>Offset 0x18+hashTableSize*4+176, filesystem creation minutes since 1978/01/01</summary>
public readonly uint cMins;
/// <summary>Offset 0x18+hashTableSize*4+180, filesystem creation ticks since 1978/01/01</summary>
public readonly uint cTicks;
/// <summary>Offset 0x18+hashTableSize*4+184, unused</summary>
public readonly uint nextHash;
/// <summary>Offset 0x18+hashTableSize*4+188, unused</summary>
public readonly uint parentDir;
/// <summary>Offset 0x18+hashTableSize*4+192, first directory cache block</summary>
public readonly uint extension;
/// <summary>Offset 0x18+hashTableSize*4+196, block secondary type = ST_ROOT (1)</summary>
public uint sec_type;
}
}

View File

@@ -0,0 +1,116 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Structs.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Amiga Fast File System plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System.Runtime.InteropServices;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of Amiga Fast File System (AFFS)</summary>
public sealed partial class AmigaDOSPlugin
{
/// <summary>Boot block, first 2 sectors</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct BootBlock
{
/// <summary>Offset 0x00, "DOSx" disk type</summary>
public readonly uint diskType;
/// <summary>Offset 0x04, Checksum</summary>
public readonly uint checksum;
/// <summary>Offset 0x08, Pointer to root block, mostly invalid</summary>
public readonly uint root_ptr;
/// <summary>Offset 0x0C, Boot code, til completion. Size is intentionally incorrect to allow marshaling to work.</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
public byte[] bootCode;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct RootBlock
{
/// <summary>Offset 0x00, block type, value = T_HEADER (2)</summary>
public uint type;
/// <summary>Offset 0x04, unused</summary>
public readonly uint headerKey;
/// <summary>Offset 0x08, unused</summary>
public readonly uint highSeq;
/// <summary>Offset 0x0C, longs used by hash table</summary>
public uint hashTableSize;
/// <summary>Offset 0x10, unused</summary>
public readonly uint firstData;
/// <summary>Offset 0x14, Rootblock checksum</summary>
public uint checksum;
/// <summary>
/// Offset 0x18, Hashtable, size = (block size / 4) - 56 or size = hashTableSize. Size intentionally bad to allow
/// marshalling to work.
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
public uint[] hashTable;
/// <summary>Offset 0x18+hashTableSize*4+0, bitmap flag, 0xFFFFFFFF if valid</summary>
public readonly uint bitmapFlag;
/// <summary>Offset 0x18+hashTableSize*4+4, bitmap pages, 25 entries</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 25)]
public readonly uint[] bitmapPages;
/// <summary>Offset 0x18+hashTableSize*4+104, pointer to bitmap extension block</summary>
public readonly uint bitmapExtensionBlock;
/// <summary>Offset 0x18+hashTableSize*4+108, last root alteration days since 1978/01/01</summary>
public readonly uint rDays;
/// <summary>Offset 0x18+hashTableSize*4+112, last root alteration minutes past midnight</summary>
public readonly uint rMins;
/// <summary>Offset 0x18+hashTableSize*4+116, last root alteration ticks (1/50 secs)</summary>
public readonly uint rTicks;
/// <summary>Offset 0x18+hashTableSize*4+120, disk name, pascal string, 31 bytes</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 31)]
public readonly byte[] diskName;
/// <summary>Offset 0x18+hashTableSize*4+151, unused</summary>
public readonly byte padding;
/// <summary>Offset 0x18+hashTableSize*4+152, unused</summary>
public readonly uint reserved1;
/// <summary>Offset 0x18+hashTableSize*4+156, unused</summary>
public readonly uint reserved2;
/// <summary>Offset 0x18+hashTableSize*4+160, last disk alteration days since 1978/01/01</summary>
public readonly uint vDays;
/// <summary>Offset 0x18+hashTableSize*4+164, last disk alteration minutes past midnight</summary>
public readonly uint vMins;
/// <summary>Offset 0x18+hashTableSize*4+168, last disk alteration ticks (1/50 secs)</summary>
public readonly uint vTicks;
/// <summary>Offset 0x18+hashTableSize*4+172, filesystem creation days since 1978/01/01</summary>
public readonly uint cDays;
/// <summary>Offset 0x18+hashTableSize*4+176, filesystem creation minutes since 1978/01/01</summary>
public readonly uint cMins;
/// <summary>Offset 0x18+hashTableSize*4+180, filesystem creation ticks since 1978/01/01</summary>
public readonly uint cTicks;
/// <summary>Offset 0x18+hashTableSize*4+184, unused</summary>
public readonly uint nextHash;
/// <summary>Offset 0x18+hashTableSize*4+188, unused</summary>
public readonly uint parentDir;
/// <summary>Offset 0x18+hashTableSize*4+192, first directory cache block</summary>
public readonly uint extension;
/// <summary>Offset 0x18+hashTableSize*4+196, block secondary type = ST_ROOT (1)</summary>
public uint sec_type;
}
}

View File

@@ -7,10 +7,6 @@
//
// Component : Common Apple file systems.
//
// --[ Description ] ----------------------------------------------------------
//
// Common Apple file systems constants.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Common Apple file systems.
//
// --[ Description ] ----------------------------------------------------------
//
// Common Apple file systems enumerations.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Common Apple file systems.
//
// --[ Description ] ----------------------------------------------------------
//
// Apple Macintosh Boot Block information.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Common Apple file systems.
//
// --[ Description ] ----------------------------------------------------------
//
// Common Apple file systems structures.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Apple DOS filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Constructors and common variables for the Apple DOS filesystem plugin.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Apple DOS filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Methods to handle files.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Apple DOS filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the Apple DOS filesystem and shows information.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Apple DOS filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Apple DOS filesystem structures.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Apple DOS filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Handles mounting and umounting the Apple DOS filesystem.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Apple Hierarchical File System plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Apple Hierarchical File System constants.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Apple Hierarchical File System plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Apple Hierarchical File System enumerations.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Apple Hierarchical File System plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the Apple Hierarchical File System and shows information.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Apple Hierarchical File System plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Apple Hierarchical File System structures.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -0,0 +1,51 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : AppleHFSPlus.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Apple Hierarchical File System Plus plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Text;
using Aaru.CommonTypes.Interfaces;
using Schemas;
namespace Aaru.Filesystems;
// Information from Apple TechNote 1150: https://developer.apple.com/legacy/library/technotes/tn/tn1150.html
/// <inheritdoc />
/// <summary>Implements detection of Apple Hierarchical File System Plus (HFS+)</summary>
public sealed partial class AppleHFSPlus : IFilesystem
{
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Name => Localization.AppleHFSPlus_Name;
/// <inheritdoc />
public Guid Id => new("36405F8D-0D26-6EBE-436F-62F0586B4F08");
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
}

View File

@@ -0,0 +1,38 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Consts.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Apple Hierarchical File System Plus plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
namespace Aaru.Filesystems;
// Information from Apple TechNote 1150: https://developer.apple.com/legacy/library/technotes/tn/tn1150.html
/// <inheritdoc />
/// <summary>Implements detection of Apple Hierarchical File System Plus (HFS+)</summary>
public sealed partial class AppleHFSPlus
{
const string FS_TYPE_HFSP = "hfsplus";
const string FS_TYPE_HFSX = "hfsx";
}

View File

@@ -0,0 +1,313 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Info.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Apple Hierarchical File System Plus plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Text;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Helpers;
using Schemas;
namespace Aaru.Filesystems;
// Information from Apple TechNote 1150: https://developer.apple.com/legacy/library/technotes/tn/tn1150.html
/// <inheritdoc />
/// <summary>Implements detection of Apple Hierarchical File System Plus (HFS+)</summary>
public sealed partial class AppleHFSPlus
{
/// <inheritdoc />
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
if(2 + partition.Start >= partition.End)
return false;
ulong hfspOffset;
uint sectorsToRead = 0x800 / imagePlugin.Info.SectorSize;
if(0x800 % imagePlugin.Info.SectorSize > 0)
sectorsToRead++;
ErrorNumber errno = imagePlugin.ReadSectors(partition.Start, sectorsToRead, out byte[] vhSector);
if(errno != ErrorNumber.NoError)
return false;
if(vhSector.Length < 0x800)
return false;
ushort drSigWord = BigEndianBitConverter.ToUInt16(vhSector, 0x400);
if(drSigWord == AppleCommon.HFS_MAGIC) // "BD"
{
drSigWord = BigEndianBitConverter.ToUInt16(vhSector, 0x47C); // Read embedded HFS+ signature
if(drSigWord == AppleCommon.HFSP_MAGIC) // "H+"
{
// ReSharper disable once InconsistentNaming
ushort xdrStABNt = BigEndianBitConverter.ToUInt16(vhSector, 0x47E);
uint drAlBlkSiz = BigEndianBitConverter.ToUInt32(vhSector, 0x414);
ushort drAlBlSt = BigEndianBitConverter.ToUInt16(vhSector, 0x41C);
hfspOffset = (ulong)(((drAlBlSt * 512) + (xdrStABNt * drAlBlkSiz)) / imagePlugin.Info.SectorSize);
}
else
hfspOffset = 0;
}
else
hfspOffset = 0;
errno = imagePlugin.ReadSectors(partition.Start + hfspOffset, sectorsToRead,
out vhSector); // Read volume header
if(errno != ErrorNumber.NoError)
return false;
drSigWord = BigEndianBitConverter.ToUInt16(vhSector, 0x400);
return drSigWord is AppleCommon.HFSP_MAGIC or AppleCommon.HFSX_MAGIC;
}
/// <inheritdoc />
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
{
Encoding = Encoding.BigEndianUnicode;
information = "";
var vh = new VolumeHeader();
ulong hfspOffset;
bool wrapped;
uint sectorsToRead = 0x800 / imagePlugin.Info.SectorSize;
if(0x800 % imagePlugin.Info.SectorSize > 0)
sectorsToRead++;
ErrorNumber errno = imagePlugin.ReadSectors(partition.Start, sectorsToRead, out byte[] vhSector);
if(errno != ErrorNumber.NoError)
return;
ushort drSigWord = BigEndianBitConverter.ToUInt16(vhSector, 0x400);
if(drSigWord == AppleCommon.HFS_MAGIC) // "BD"
{
drSigWord = BigEndianBitConverter.ToUInt16(vhSector, 0x47C); // Read embedded HFS+ signature
if(drSigWord == AppleCommon.HFSP_MAGIC) // "H+"
{
// ReSharper disable once InconsistentNaming
ushort xdrStABNt = BigEndianBitConverter.ToUInt16(vhSector, 0x47E);
uint drAlBlkSiz = BigEndianBitConverter.ToUInt32(vhSector, 0x414);
ushort drAlBlSt = BigEndianBitConverter.ToUInt16(vhSector, 0x41C);
hfspOffset = (ulong)(((drAlBlSt * 512) + (xdrStABNt * drAlBlkSiz)) / imagePlugin.Info.SectorSize);
wrapped = true;
}
else
{
hfspOffset = 0;
wrapped = false;
}
}
else
{
hfspOffset = 0;
wrapped = false;
}
errno = imagePlugin.ReadSectors(partition.Start + hfspOffset, sectorsToRead,
out vhSector); // Read volume header
if(errno != ErrorNumber.NoError)
return;
vh.signature = BigEndianBitConverter.ToUInt16(vhSector, 0x400);
if(vh.signature != AppleCommon.HFSP_MAGIC &&
vh.signature != AppleCommon.HFSX_MAGIC)
return;
var sb = new StringBuilder();
switch(vh.signature)
{
case 0x482B:
sb.AppendLine(Localization.HFS_filesystem);
break;
case 0x4858:
sb.AppendLine(Localization.HFSX_filesystem);
break;
}
if(wrapped)
sb.AppendLine(Localization.Volume_is_wrapped_inside_an_HFS_volume);
byte[] tmp = new byte[0x400];
Array.Copy(vhSector, 0x400, tmp, 0, 0x400);
vhSector = tmp;
vh = Marshal.ByteArrayToStructureBigEndian<VolumeHeader>(vhSector);
if(vh.version is 4 or 5)
{
sb.AppendFormat(Localization.Filesystem_version_is_0, vh.version).AppendLine();
if((vh.attributes & 0x80) == 0x80)
sb.AppendLine(Localization.Volume_is_locked_on_hardware);
if((vh.attributes & 0x100) == 0x100)
sb.AppendLine(Localization.Volume_is_unmounted);
if((vh.attributes & 0x200) == 0x200)
sb.AppendLine(Localization.There_are_bad_blocks_in_the_extents_file);
if((vh.attributes & 0x400) == 0x400)
sb.AppendLine(Localization.Volume_does_not_require_cache);
if((vh.attributes & 0x800) == 0x800)
sb.AppendLine(Localization.Volume_state_is_inconsistent);
if((vh.attributes & 0x1000) == 0x1000)
sb.AppendLine(Localization.There_are_reused_CNIDs);
if((vh.attributes & 0x2000) == 0x2000)
sb.AppendLine(Localization.Volume_is_journaled);
if((vh.attributes & 0x8000) == 0x8000)
sb.AppendLine(Localization.Volume_is_locked_on_software);
sb.AppendFormat(Localization.Implementation_that_last_mounted_the_volume_0,
Encoding.ASCII.GetString(vh.lastMountedVersion)).AppendLine();
if((vh.attributes & 0x2000) == 0x2000)
sb.AppendFormat(Localization.Journal_starts_at_allocation_block_0, vh.journalInfoBlock).AppendLine();
sb.AppendFormat(Localization.Creation_date_0, DateHandlers.MacToDateTime(vh.createDate)).AppendLine();
sb.AppendFormat(Localization.Last_modification_date_0, DateHandlers.MacToDateTime(vh.modifyDate)).
AppendLine();
if(vh.backupDate > 0)
sb.AppendFormat(Localization.Last_backup_date_0, DateHandlers.MacToDateTime(vh.backupDate)).
AppendLine();
else
sb.AppendLine(Localization.Volume_has_never_been_backed_up);
if(vh.backupDate > 0)
sb.AppendFormat(Localization.Last_check_date_0, DateHandlers.MacToDateTime(vh.checkedDate)).
AppendLine();
else
sb.AppendLine(Localization.Volume_has_never_been_checked_up);
sb.AppendFormat(Localization._0_files_on_volume, vh.fileCount).AppendLine();
sb.AppendFormat(Localization._0_folders_on_volume, vh.folderCount).AppendLine();
sb.AppendFormat(Localization._0_bytes_per_allocation_block, vh.blockSize).AppendLine();
sb.AppendFormat(Localization._0_allocation_blocks, vh.totalBlocks).AppendLine();
sb.AppendFormat(Localization._0_free_blocks, vh.freeBlocks).AppendLine();
sb.AppendFormat(Localization.Next_allocation_block_0, vh.nextAllocation).AppendLine();
sb.AppendFormat(Localization.Resource_fork_clump_size_0_bytes, vh.rsrcClumpSize).AppendLine();
sb.AppendFormat(Localization.Data_fork_clump_size_0_bytes, vh.dataClumpSize).AppendLine();
sb.AppendFormat(Localization.Next_unused_CNID_0, vh.nextCatalogID).AppendLine();
sb.AppendFormat(Localization.Volume_has_been_mounted_writable_0_times, vh.writeCount).AppendLine();
sb.AppendFormat(Localization.Allocation_File_is_0_bytes, vh.allocationFile_logicalSize).AppendLine();
sb.AppendFormat(Localization.Extents_File_is_0_bytes, vh.extentsFile_logicalSize).AppendLine();
sb.AppendFormat(Localization.Catalog_File_is_0_bytes, vh.catalogFile_logicalSize).AppendLine();
sb.AppendFormat(Localization.Attributes_File_is_0_bytes, vh.attributesFile_logicalSize).AppendLine();
sb.AppendFormat(Localization.Startup_File_is_0_bytes, vh.startupFile_logicalSize).AppendLine();
sb.AppendLine(Localization.Finder_info);
sb.AppendFormat(Localization.CNID_of_bootable_system_directory_0, vh.drFndrInfo0).AppendLine();
sb.AppendFormat(Localization.CNID_of_first_run_application_directory_0, vh.drFndrInfo1).AppendLine();
sb.AppendFormat(Localization.CNID_of_previously_opened_directory_0, vh.drFndrInfo2).AppendLine();
sb.AppendFormat(Localization.CNID_of_bootable_Mac_OS_8_or_9_directory_0, vh.drFndrInfo3).AppendLine();
sb.AppendFormat(Localization.CNID_of_bootable_Mac_OS_X_directory_0, vh.drFndrInfo5).AppendLine();
if(vh.drFndrInfo6 != 0 &&
vh.drFndrInfo7 != 0)
sb.AppendFormat(Localization.Mac_OS_X_Volume_ID_0_1, vh.drFndrInfo6, vh.drFndrInfo7).AppendLine();
XmlFsType = new FileSystemType();
if(vh.backupDate > 0)
{
XmlFsType.BackupDate = DateHandlers.MacToDateTime(vh.backupDate);
XmlFsType.BackupDateSpecified = true;
}
XmlFsType.Bootable |= vh.drFndrInfo0 != 0 || vh.drFndrInfo3 != 0 || vh.drFndrInfo5 != 0;
XmlFsType.Clusters = vh.totalBlocks;
XmlFsType.ClusterSize = vh.blockSize;
if(vh.createDate > 0)
{
XmlFsType.CreationDate = DateHandlers.MacToDateTime(vh.createDate);
XmlFsType.CreationDateSpecified = true;
}
XmlFsType.Dirty = (vh.attributes & 0x100) != 0x100;
XmlFsType.Files = vh.fileCount;
XmlFsType.FilesSpecified = true;
XmlFsType.FreeClusters = vh.freeBlocks;
XmlFsType.FreeClustersSpecified = true;
if(vh.modifyDate > 0)
{
XmlFsType.ModificationDate = DateHandlers.MacToDateTime(vh.modifyDate);
XmlFsType.ModificationDateSpecified = true;
}
XmlFsType.Type = vh.signature switch
{
0x482B => FS_TYPE_HFSP,
0x4858 => FS_TYPE_HFSX,
_ => XmlFsType.Type
};
if(vh.drFndrInfo6 != 0 &&
vh.drFndrInfo7 != 0)
XmlFsType.VolumeSerial = $"{vh.drFndrInfo6:X8}{vh.drFndrInfo7:X8}";
XmlFsType.SystemIdentifier = Encoding.ASCII.GetString(vh.lastMountedVersion);
}
else
{
sb.AppendFormat(Localization.Filesystem_version_is_0, vh.version).AppendLine();
sb.AppendLine(Localization.This_version_is_not_supported_yet);
}
information = sb.ToString();
}
}

View File

@@ -2,15 +2,11 @@
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : AppleHFSPlus.cs
// Filename : Structs.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Apple Hierarchical File System Plus plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the Apple Hierarchical File System Plus and shows information.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
@@ -30,306 +26,15 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Runtime.InteropServices;
using System.Text;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Helpers;
using Schemas;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Filesystems;
// Information from Apple TechNote 1150: https://developer.apple.com/legacy/library/technotes/tn/tn1150.html
/// <inheritdoc />
/// <summary>Implements detection of Apple Hierarchical File System Plus (HFS+)</summary>
public sealed class AppleHFSPlus : IFilesystem
public sealed partial class AppleHFSPlus
{
const string FS_TYPE_HFSP = "hfsplus";
const string FS_TYPE_HFSX = "hfsx";
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Name => Localization.AppleHFSPlus_Name;
/// <inheritdoc />
public Guid Id => new("36405F8D-0D26-6EBE-436F-62F0586B4F08");
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
/// <inheritdoc />
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
if(2 + partition.Start >= partition.End)
return false;
ulong hfspOffset;
uint sectorsToRead = 0x800 / imagePlugin.Info.SectorSize;
if(0x800 % imagePlugin.Info.SectorSize > 0)
sectorsToRead++;
ErrorNumber errno = imagePlugin.ReadSectors(partition.Start, sectorsToRead, out byte[] vhSector);
if(errno != ErrorNumber.NoError)
return false;
if(vhSector.Length < 0x800)
return false;
ushort drSigWord = BigEndianBitConverter.ToUInt16(vhSector, 0x400);
if(drSigWord == AppleCommon.HFS_MAGIC) // "BD"
{
drSigWord = BigEndianBitConverter.ToUInt16(vhSector, 0x47C); // Read embedded HFS+ signature
if(drSigWord == AppleCommon.HFSP_MAGIC) // "H+"
{
// ReSharper disable once InconsistentNaming
ushort xdrStABNt = BigEndianBitConverter.ToUInt16(vhSector, 0x47E);
uint drAlBlkSiz = BigEndianBitConverter.ToUInt32(vhSector, 0x414);
ushort drAlBlSt = BigEndianBitConverter.ToUInt16(vhSector, 0x41C);
hfspOffset = (ulong)(((drAlBlSt * 512) + (xdrStABNt * drAlBlkSiz)) / imagePlugin.Info.SectorSize);
}
else
hfspOffset = 0;
}
else
hfspOffset = 0;
errno = imagePlugin.ReadSectors(partition.Start + hfspOffset, sectorsToRead,
out vhSector); // Read volume header
if(errno != ErrorNumber.NoError)
return false;
drSigWord = BigEndianBitConverter.ToUInt16(vhSector, 0x400);
return drSigWord is AppleCommon.HFSP_MAGIC or AppleCommon.HFSX_MAGIC;
}
/// <inheritdoc />
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
{
Encoding = Encoding.BigEndianUnicode;
information = "";
var vh = new VolumeHeader();
ulong hfspOffset;
bool wrapped;
uint sectorsToRead = 0x800 / imagePlugin.Info.SectorSize;
if(0x800 % imagePlugin.Info.SectorSize > 0)
sectorsToRead++;
ErrorNumber errno = imagePlugin.ReadSectors(partition.Start, sectorsToRead, out byte[] vhSector);
if(errno != ErrorNumber.NoError)
return;
ushort drSigWord = BigEndianBitConverter.ToUInt16(vhSector, 0x400);
if(drSigWord == AppleCommon.HFS_MAGIC) // "BD"
{
drSigWord = BigEndianBitConverter.ToUInt16(vhSector, 0x47C); // Read embedded HFS+ signature
if(drSigWord == AppleCommon.HFSP_MAGIC) // "H+"
{
// ReSharper disable once InconsistentNaming
ushort xdrStABNt = BigEndianBitConverter.ToUInt16(vhSector, 0x47E);
uint drAlBlkSiz = BigEndianBitConverter.ToUInt32(vhSector, 0x414);
ushort drAlBlSt = BigEndianBitConverter.ToUInt16(vhSector, 0x41C);
hfspOffset = (ulong)(((drAlBlSt * 512) + (xdrStABNt * drAlBlkSiz)) / imagePlugin.Info.SectorSize);
wrapped = true;
}
else
{
hfspOffset = 0;
wrapped = false;
}
}
else
{
hfspOffset = 0;
wrapped = false;
}
errno = imagePlugin.ReadSectors(partition.Start + hfspOffset, sectorsToRead,
out vhSector); // Read volume header
if(errno != ErrorNumber.NoError)
return;
vh.signature = BigEndianBitConverter.ToUInt16(vhSector, 0x400);
if(vh.signature != AppleCommon.HFSP_MAGIC &&
vh.signature != AppleCommon.HFSX_MAGIC)
return;
var sb = new StringBuilder();
switch(vh.signature)
{
case 0x482B:
sb.AppendLine(Localization.HFS_filesystem);
break;
case 0x4858:
sb.AppendLine(Localization.HFSX_filesystem);
break;
}
if(wrapped)
sb.AppendLine(Localization.Volume_is_wrapped_inside_an_HFS_volume);
byte[] tmp = new byte[0x400];
Array.Copy(vhSector, 0x400, tmp, 0, 0x400);
vhSector = tmp;
vh = Marshal.ByteArrayToStructureBigEndian<VolumeHeader>(vhSector);
if(vh.version is 4 or 5)
{
sb.AppendFormat(Localization.Filesystem_version_is_0, vh.version).AppendLine();
if((vh.attributes & 0x80) == 0x80)
sb.AppendLine(Localization.Volume_is_locked_on_hardware);
if((vh.attributes & 0x100) == 0x100)
sb.AppendLine(Localization.Volume_is_unmounted);
if((vh.attributes & 0x200) == 0x200)
sb.AppendLine(Localization.There_are_bad_blocks_in_the_extents_file);
if((vh.attributes & 0x400) == 0x400)
sb.AppendLine(Localization.Volume_does_not_require_cache);
if((vh.attributes & 0x800) == 0x800)
sb.AppendLine(Localization.Volume_state_is_inconsistent);
if((vh.attributes & 0x1000) == 0x1000)
sb.AppendLine(Localization.There_are_reused_CNIDs);
if((vh.attributes & 0x2000) == 0x2000)
sb.AppendLine(Localization.Volume_is_journaled);
if((vh.attributes & 0x8000) == 0x8000)
sb.AppendLine(Localization.Volume_is_locked_on_software);
sb.AppendFormat(Localization.Implementation_that_last_mounted_the_volume_0,
Encoding.ASCII.GetString(vh.lastMountedVersion)).AppendLine();
if((vh.attributes & 0x2000) == 0x2000)
sb.AppendFormat(Localization.Journal_starts_at_allocation_block_0, vh.journalInfoBlock).AppendLine();
sb.AppendFormat(Localization.Creation_date_0, DateHandlers.MacToDateTime(vh.createDate)).AppendLine();
sb.AppendFormat(Localization.Last_modification_date_0, DateHandlers.MacToDateTime(vh.modifyDate)).
AppendLine();
if(vh.backupDate > 0)
sb.AppendFormat(Localization.Last_backup_date_0, DateHandlers.MacToDateTime(vh.backupDate)).
AppendLine();
else
sb.AppendLine(Localization.Volume_has_never_been_backed_up);
if(vh.backupDate > 0)
sb.AppendFormat(Localization.Last_check_date_0, DateHandlers.MacToDateTime(vh.checkedDate)).
AppendLine();
else
sb.AppendLine(Localization.Volume_has_never_been_checked_up);
sb.AppendFormat(Localization._0_files_on_volume, vh.fileCount).AppendLine();
sb.AppendFormat(Localization._0_folders_on_volume, vh.folderCount).AppendLine();
sb.AppendFormat(Localization._0_bytes_per_allocation_block, vh.blockSize).AppendLine();
sb.AppendFormat(Localization._0_allocation_blocks, vh.totalBlocks).AppendLine();
sb.AppendFormat(Localization._0_free_blocks, vh.freeBlocks).AppendLine();
sb.AppendFormat(Localization.Next_allocation_block_0, vh.nextAllocation).AppendLine();
sb.AppendFormat(Localization.Resource_fork_clump_size_0_bytes, vh.rsrcClumpSize).AppendLine();
sb.AppendFormat(Localization.Data_fork_clump_size_0_bytes, vh.dataClumpSize).AppendLine();
sb.AppendFormat(Localization.Next_unused_CNID_0, vh.nextCatalogID).AppendLine();
sb.AppendFormat(Localization.Volume_has_been_mounted_writable_0_times, vh.writeCount).AppendLine();
sb.AppendFormat(Localization.Allocation_File_is_0_bytes, vh.allocationFile_logicalSize).AppendLine();
sb.AppendFormat(Localization.Extents_File_is_0_bytes, vh.extentsFile_logicalSize).AppendLine();
sb.AppendFormat(Localization.Catalog_File_is_0_bytes, vh.catalogFile_logicalSize).AppendLine();
sb.AppendFormat(Localization.Attributes_File_is_0_bytes, vh.attributesFile_logicalSize).AppendLine();
sb.AppendFormat(Localization.Startup_File_is_0_bytes, vh.startupFile_logicalSize).AppendLine();
sb.AppendLine(Localization.Finder_info);
sb.AppendFormat(Localization.CNID_of_bootable_system_directory_0, vh.drFndrInfo0).AppendLine();
sb.AppendFormat(Localization.CNID_of_first_run_application_directory_0, vh.drFndrInfo1).AppendLine();
sb.AppendFormat(Localization.CNID_of_previously_opened_directory_0, vh.drFndrInfo2).AppendLine();
sb.AppendFormat(Localization.CNID_of_bootable_Mac_OS_8_or_9_directory_0, vh.drFndrInfo3).AppendLine();
sb.AppendFormat(Localization.CNID_of_bootable_Mac_OS_X_directory_0, vh.drFndrInfo5).AppendLine();
if(vh.drFndrInfo6 != 0 &&
vh.drFndrInfo7 != 0)
sb.AppendFormat(Localization.Mac_OS_X_Volume_ID_0_1, vh.drFndrInfo6, vh.drFndrInfo7).AppendLine();
XmlFsType = new FileSystemType();
if(vh.backupDate > 0)
{
XmlFsType.BackupDate = DateHandlers.MacToDateTime(vh.backupDate);
XmlFsType.BackupDateSpecified = true;
}
XmlFsType.Bootable |= vh.drFndrInfo0 != 0 || vh.drFndrInfo3 != 0 || vh.drFndrInfo5 != 0;
XmlFsType.Clusters = vh.totalBlocks;
XmlFsType.ClusterSize = vh.blockSize;
if(vh.createDate > 0)
{
XmlFsType.CreationDate = DateHandlers.MacToDateTime(vh.createDate);
XmlFsType.CreationDateSpecified = true;
}
XmlFsType.Dirty = (vh.attributes & 0x100) != 0x100;
XmlFsType.Files = vh.fileCount;
XmlFsType.FilesSpecified = true;
XmlFsType.FreeClusters = vh.freeBlocks;
XmlFsType.FreeClustersSpecified = true;
if(vh.modifyDate > 0)
{
XmlFsType.ModificationDate = DateHandlers.MacToDateTime(vh.modifyDate);
XmlFsType.ModificationDateSpecified = true;
}
XmlFsType.Type = vh.signature switch
{
0x482B => FS_TYPE_HFSP,
0x4858 => FS_TYPE_HFSX,
_ => XmlFsType.Type
};
if(vh.drFndrInfo6 != 0 &&
vh.drFndrInfo7 != 0)
XmlFsType.VolumeSerial = $"{vh.drFndrInfo6:X8}{vh.drFndrInfo7:X8}";
XmlFsType.SystemIdentifier = Encoding.ASCII.GetString(vh.lastMountedVersion);
}
else
{
sb.AppendFormat(Localization.Filesystem_version_is_0, vh.version).AppendLine();
sb.AppendLine(Localization.This_version_is_not_supported_yet);
}
information = sb.ToString();
}
/// <summary>HFS+ Volume Header, should be at offset 0x0400 bytes in volume with a size of 532 bytes</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct VolumeHeader

View File

@@ -7,10 +7,6 @@
//
// Component : Apple Macintosh File System plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Constructors and common variables for the Apple Macintosh File System plugin.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Apple Macintosh File System plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Apple Macintosh File System constants.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Apple Macintosh File System plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Methods to handle the Apple Macintosh File System directory.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Apple Macintosh File System plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Methods to handle files.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Apple Macintosh File System plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the Apple Macintosh File System and shows information.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Apple Macintosh File System plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Apple Macintosh File System structures.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Apple Macintosh File System plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Handles mounting and umounting the Apple Macintosh File System.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -0,0 +1,52 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Atheos.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Atheos filesystem plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Aaru.CommonTypes.Interfaces;
using Schemas;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection for the AtheOS filesystem</summary>
[SuppressMessage("ReSharper", "UnusedMember.Local")]
public sealed partial class AtheOS : IFilesystem
{
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Name => Localization.AtheOS_Name;
/// <inheritdoc />
public Guid Id => new("AAB2C4F1-DC07-49EE-A948-576CC51B58C5");
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
}

View File

@@ -0,0 +1,48 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Consts.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Atheos filesystem plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection for the AtheOS filesystem</summary>
[SuppressMessage("ReSharper", "UnusedMember.Local")]
public sealed partial class AtheOS
{
// Little endian constants (that is, as read by .NET :p)
const uint AFS_MAGIC1 = 0x41465331;
const uint AFS_MAGIC2 = 0xDD121031;
const uint AFS_MAGIC3 = 0x15B6830E;
// Common constants
const uint AFS_SUPERBLOCK_SIZE = 1024;
const uint AFS_BOOTBLOCK_SIZE = AFS_SUPERBLOCK_SIZE;
const string FS_TYPE = "atheos";
}

View File

@@ -2,15 +2,11 @@
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Atheos.cs
// Filename : Info.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Atheos filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the Atheos filesystem and shows information.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
@@ -32,42 +28,20 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Text;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Helpers;
using Schemas;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection for the AtheOS filesystem</summary>
[SuppressMessage("ReSharper", "UnusedMember.Local")]
public sealed class AtheOS : IFilesystem
public sealed partial class AtheOS
{
// Little endian constants (that is, as read by .NET :p)
const uint AFS_MAGIC1 = 0x41465331;
const uint AFS_MAGIC2 = 0xDD121031;
const uint AFS_MAGIC3 = 0x15B6830E;
// Common constants
const uint AFS_SUPERBLOCK_SIZE = 1024;
const uint AFS_BOOTBLOCK_SIZE = AFS_SUPERBLOCK_SIZE;
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Name => Localization.AtheOS_Name;
/// <inheritdoc />
public Guid Id => new("AAB2C4F1-DC07-49EE-A948-576CC51B58C5");
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
/// <inheritdoc />
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
@@ -182,73 +156,4 @@ public sealed class AtheOS : IFilesystem
VolumeName = StringHandlers.CToString(afsSb.name, Encoding)
};
}
const string FS_TYPE = "atheos";
/// <summary>Be superblock</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct SuperBlock
{
/// <summary>0x000, Volume name, 32 bytes</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public readonly byte[] name;
/// <summary>0x020, "AFS1", 0x41465331</summary>
public readonly uint magic1;
/// <summary>0x024, "BIGE", 0x42494745</summary>
public readonly uint fs_byte_order;
/// <summary>0x028, Bytes per block</summary>
public readonly uint block_size;
/// <summary>0x02C, 1 &lt;&lt; block_shift == block_size</summary>
public readonly uint block_shift;
/// <summary>0x030, Blocks in volume</summary>
public readonly long num_blocks;
/// <summary>0x038, Used blocks in volume</summary>
public readonly long used_blocks;
/// <summary>0x040, Bytes per inode</summary>
public readonly int inode_size;
/// <summary>0x044, 0xDD121031</summary>
public readonly uint magic2;
/// <summary>0x048, Blocks per allocation group</summary>
public readonly int blocks_per_ag;
/// <summary>0x04C, 1 &lt;&lt; ag_shift == blocks_per_ag</summary>
public readonly int ag_shift;
/// <summary>0x050, Allocation groups in volume</summary>
public readonly int num_ags;
/// <summary>0x054, 0x434c454e if clean, 0x44495254 if dirty</summary>
public readonly uint flags;
/// <summary>0x058, Allocation group of journal</summary>
public readonly int log_blocks_ag;
/// <summary>0x05C, Start block of journal, inside ag</summary>
public readonly ushort log_blocks_start;
/// <summary>0x05E, Length in blocks of journal, inside ag</summary>
public readonly ushort log_blocks_len;
/// <summary>0x060, Start of journal</summary>
public readonly long log_start;
/// <summary>0x068, Valid block logs</summary>
public readonly int log_valid_blocks;
/// <summary>0x06C, Log size</summary>
public readonly int log_size;
/// <summary>0x070, 0x15B6830E</summary>
public readonly uint magic3;
/// <summary>0x074, Allocation group where root folder's i-node resides</summary>
public readonly int root_dir_ag;
/// <summary>0x078, Start in ag of root folder's i-node</summary>
public readonly ushort root_dir_start;
/// <summary>0x07A, As this is part of inode_addr, this is 1</summary>
public readonly ushort root_dir_len;
/// <summary>0x07C, Allocation group where pending-delete-files' i-node resides</summary>
public readonly int deleted_ag;
/// <summary>0x080, Start in ag of pending-delete-files' i-node</summary>
public readonly ushort deleted_start;
/// <summary>0x082, As this is part of inode_addr, this is 1</summary>
public readonly ushort deleted_len;
/// <summary>0x084, Allocation group where indices' i-node resides</summary>
public readonly int indices_ag;
/// <summary>0x088, Start in ag of indices' i-node</summary>
public readonly ushort indices_start;
/// <summary>0x08A, As this is part of inode_addr, this is 1</summary>
public readonly ushort indices_len;
/// <summary>0x08C, Size of bootloader</summary>
public readonly int boot_size;
}
}

View File

@@ -0,0 +1,105 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Structs.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Atheos filesystem plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection for the AtheOS filesystem</summary>
[SuppressMessage("ReSharper", "UnusedMember.Local")]
public sealed partial class AtheOS
{
/// <summary>Be superblock</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct SuperBlock
{
/// <summary>0x000, Volume name, 32 bytes</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public readonly byte[] name;
/// <summary>0x020, "AFS1", 0x41465331</summary>
public readonly uint magic1;
/// <summary>0x024, "BIGE", 0x42494745</summary>
public readonly uint fs_byte_order;
/// <summary>0x028, Bytes per block</summary>
public readonly uint block_size;
/// <summary>0x02C, 1 &lt;&lt; block_shift == block_size</summary>
public readonly uint block_shift;
/// <summary>0x030, Blocks in volume</summary>
public readonly long num_blocks;
/// <summary>0x038, Used blocks in volume</summary>
public readonly long used_blocks;
/// <summary>0x040, Bytes per inode</summary>
public readonly int inode_size;
/// <summary>0x044, 0xDD121031</summary>
public readonly uint magic2;
/// <summary>0x048, Blocks per allocation group</summary>
public readonly int blocks_per_ag;
/// <summary>0x04C, 1 &lt;&lt; ag_shift == blocks_per_ag</summary>
public readonly int ag_shift;
/// <summary>0x050, Allocation groups in volume</summary>
public readonly int num_ags;
/// <summary>0x054, 0x434c454e if clean, 0x44495254 if dirty</summary>
public readonly uint flags;
/// <summary>0x058, Allocation group of journal</summary>
public readonly int log_blocks_ag;
/// <summary>0x05C, Start block of journal, inside ag</summary>
public readonly ushort log_blocks_start;
/// <summary>0x05E, Length in blocks of journal, inside ag</summary>
public readonly ushort log_blocks_len;
/// <summary>0x060, Start of journal</summary>
public readonly long log_start;
/// <summary>0x068, Valid block logs</summary>
public readonly int log_valid_blocks;
/// <summary>0x06C, Log size</summary>
public readonly int log_size;
/// <summary>0x070, 0x15B6830E</summary>
public readonly uint magic3;
/// <summary>0x074, Allocation group where root folder's i-node resides</summary>
public readonly int root_dir_ag;
/// <summary>0x078, Start in ag of root folder's i-node</summary>
public readonly ushort root_dir_start;
/// <summary>0x07A, As this is part of inode_addr, this is 1</summary>
public readonly ushort root_dir_len;
/// <summary>0x07C, Allocation group where pending-delete-files' i-node resides</summary>
public readonly int deleted_ag;
/// <summary>0x080, Start in ag of pending-delete-files' i-node</summary>
public readonly ushort deleted_start;
/// <summary>0x082, As this is part of inode_addr, this is 1</summary>
public readonly ushort deleted_len;
/// <summary>0x084, Allocation group where indices' i-node resides</summary>
public readonly int indices_ag;
/// <summary>0x088, Start in ag of indices' i-node</summary>
public readonly ushort indices_start;
/// <summary>0x08A, As this is part of inode_addr, this is 1</summary>
public readonly ushort indices_len;
/// <summary>0x08C, Size of bootloader</summary>
public readonly int boot_size;
}
}

View File

@@ -0,0 +1,53 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : BFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : BeOS filesystem plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Aaru.CommonTypes.Interfaces;
using Schemas;
namespace Aaru.Filesystems;
// Information from Practical Filesystem Design, ISBN 1-55860-497-9
/// <inheritdoc />
/// <summary>Implements detection of the Be (new) filesystem</summary>
[SuppressMessage("ReSharper", "UnusedMember.Local")]
public sealed partial class BeFS : IFilesystem
{
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Name => Localization.BeFS_Name;
/// <inheritdoc />
public Guid Id => new("dc8572b3-b6ad-46e4-8de9-cbe123ff6672");
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
}

View File

@@ -0,0 +1,54 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Consts.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : BeOS filesystem plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
namespace Aaru.Filesystems;
// Information from Practical Filesystem Design, ISBN 1-55860-497-9
/// <inheritdoc />
/// <summary>Implements detection of the Be (new) filesystem</summary>
[SuppressMessage("ReSharper", "UnusedMember.Local")]
public sealed partial class BeFS
{
// Little endian constants (that is, as read by .NET :p)
const uint BEFS_MAGIC1 = 0x42465331;
const uint BEFS_MAGIC2 = 0xDD121031;
const uint BEFS_MAGIC3 = 0x15B6830E;
const uint BEFS_ENDIAN = 0x42494745;
// Big endian constants
const uint BEFS_CIGAM1 = 0x31534642;
const uint BEFS_NAIDNE = 0x45474942;
// Common constants
const uint BEFS_CLEAN = 0x434C454E;
const uint BEFS_DIRTY = 0x44495254;
const string FS_TYPE = "befs";
}

View File

@@ -2,15 +2,11 @@
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : BFS.cs
// Filename : Info.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : BeOS filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the BeOS filesystem and shows information.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
@@ -32,14 +28,12 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Text;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Helpers;
using Schemas;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Filesystems;
@@ -47,33 +41,8 @@ namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the Be (new) filesystem</summary>
[SuppressMessage("ReSharper", "UnusedMember.Local")]
public sealed class BeFS : IFilesystem
public sealed partial class BeFS
{
// Little endian constants (that is, as read by .NET :p)
const uint BEFS_MAGIC1 = 0x42465331;
const uint BEFS_MAGIC2 = 0xDD121031;
const uint BEFS_MAGIC3 = 0x15B6830E;
const uint BEFS_ENDIAN = 0x42494745;
// Big endian constants
const uint BEFS_CIGAM1 = 0x31534642;
const uint BEFS_NAIDNE = 0x45474942;
// Common constants
const uint BEFS_CLEAN = 0x434C454E;
const uint BEFS_DIRTY = 0x44495254;
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Name => Localization.BeFS_Name;
/// <inheritdoc />
public Guid Id => new("dc8572b3-b6ad-46e4-8de9-cbe123ff6672");
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
/// <inheritdoc />
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
@@ -259,63 +228,4 @@ public sealed class BeFS : IFilesystem
VolumeName = StringHandlers.CToString(besb.name, Encoding)
};
}
const string FS_TYPE = "befs";
/// <summary>Be superblock</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct SuperBlock
{
/// <summary>0x000, Volume name, 32 bytes</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public readonly byte[] name;
/// <summary>0x020, "BFS1", 0x42465331</summary>
public uint magic1;
/// <summary>0x024, "BIGE", 0x42494745</summary>
public readonly uint fs_byte_order;
/// <summary>0x028, Bytes per block</summary>
public readonly uint block_size;
/// <summary>0x02C, 1 &lt;&lt; block_shift == block_size</summary>
public readonly uint block_shift;
/// <summary>0x030, Blocks in volume</summary>
public readonly long num_blocks;
/// <summary>0x038, Used blocks in volume</summary>
public readonly long used_blocks;
/// <summary>0x040, Bytes per inode</summary>
public readonly int inode_size;
/// <summary>0x044, 0xDD121031</summary>
public readonly uint magic2;
/// <summary>0x048, Blocks per allocation group</summary>
public readonly int blocks_per_ag;
/// <summary>0x04C, 1 &lt;&lt; ag_shift == blocks_per_ag</summary>
public readonly int ag_shift;
/// <summary>0x050, Allocation groups in volume</summary>
public readonly int num_ags;
/// <summary>0x054, 0x434c454e if clean, 0x44495254 if dirty</summary>
public readonly uint flags;
/// <summary>0x058, Allocation group of journal</summary>
public readonly int log_blocks_ag;
/// <summary>0x05C, Start block of journal, inside ag</summary>
public readonly ushort log_blocks_start;
/// <summary>0x05E, Length in blocks of journal, inside ag</summary>
public readonly ushort log_blocks_len;
/// <summary>0x060, Start of journal</summary>
public readonly long log_start;
/// <summary>0x068, End of journal</summary>
public readonly long log_end;
/// <summary>0x070, 0x15B6830E</summary>
public readonly uint magic3;
/// <summary>0x074, Allocation group where root folder's i-node resides</summary>
public readonly int root_dir_ag;
/// <summary>0x078, Start in ag of root folder's i-node</summary>
public readonly ushort root_dir_start;
/// <summary>0x07A, As this is part of inode_addr, this is 1</summary>
public readonly ushort root_dir_len;
/// <summary>0x07C, Allocation group where indices' i-node resides</summary>
public readonly int indices_ag;
/// <summary>0x080, Start in ag of indices' i-node</summary>
public readonly ushort indices_start;
/// <summary>0x082, As this is part of inode_addr, this is 1</summary>
public readonly ushort indices_len;
}
}

View File

@@ -0,0 +1,96 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Structs.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : BeOS filesystem plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
namespace Aaru.Filesystems;
// Information from Practical Filesystem Design, ISBN 1-55860-497-9
/// <inheritdoc />
/// <summary>Implements detection of the Be (new) filesystem</summary>
[SuppressMessage("ReSharper", "UnusedMember.Local")]
public sealed partial class BeFS
{
/// <summary>Be superblock</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct SuperBlock
{
/// <summary>0x000, Volume name, 32 bytes</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public readonly byte[] name;
/// <summary>0x020, "BFS1", 0x42465331</summary>
public uint magic1;
/// <summary>0x024, "BIGE", 0x42494745</summary>
public readonly uint fs_byte_order;
/// <summary>0x028, Bytes per block</summary>
public readonly uint block_size;
/// <summary>0x02C, 1 &lt;&lt; block_shift == block_size</summary>
public readonly uint block_shift;
/// <summary>0x030, Blocks in volume</summary>
public readonly long num_blocks;
/// <summary>0x038, Used blocks in volume</summary>
public readonly long used_blocks;
/// <summary>0x040, Bytes per inode</summary>
public readonly int inode_size;
/// <summary>0x044, 0xDD121031</summary>
public readonly uint magic2;
/// <summary>0x048, Blocks per allocation group</summary>
public readonly int blocks_per_ag;
/// <summary>0x04C, 1 &lt;&lt; ag_shift == blocks_per_ag</summary>
public readonly int ag_shift;
/// <summary>0x050, Allocation groups in volume</summary>
public readonly int num_ags;
/// <summary>0x054, 0x434c454e if clean, 0x44495254 if dirty</summary>
public readonly uint flags;
/// <summary>0x058, Allocation group of journal</summary>
public readonly int log_blocks_ag;
/// <summary>0x05C, Start block of journal, inside ag</summary>
public readonly ushort log_blocks_start;
/// <summary>0x05E, Length in blocks of journal, inside ag</summary>
public readonly ushort log_blocks_len;
/// <summary>0x060, Start of journal</summary>
public readonly long log_start;
/// <summary>0x068, End of journal</summary>
public readonly long log_end;
/// <summary>0x070, 0x15B6830E</summary>
public readonly uint magic3;
/// <summary>0x074, Allocation group where root folder's i-node resides</summary>
public readonly int root_dir_ag;
/// <summary>0x078, Start in ag of root folder's i-node</summary>
public readonly ushort root_dir_start;
/// <summary>0x07A, As this is part of inode_addr, this is 1</summary>
public readonly ushort root_dir_len;
/// <summary>0x07C, Allocation group where indices' i-node resides</summary>
public readonly int indices_ag;
/// <summary>0x080, Start in ag of indices' i-node</summary>
public readonly ushort indices_start;
/// <summary>0x082, As this is part of inode_addr, this is 1</summary>
public readonly ushort indices_len;
}
}

View File

@@ -0,0 +1,54 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : BTRFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : B-tree file system plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the B-tree file system and shows information.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Text;
using Aaru.CommonTypes.Interfaces;
using Schemas;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the b-tree filesystem (btrfs)</summary>
public sealed partial class BTRFS : IFilesystem
{
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Name => Localization.BTRFS_Name;
/// <inheritdoc />
public Guid Id => new("C904CF15-5222-446B-B7DB-02EAC5D781B3");
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
}

View File

@@ -0,0 +1,43 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Consts.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : B-tree file system plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the B-tree file system and shows information.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the b-tree filesystem (btrfs)</summary>
public sealed partial class BTRFS
{
/// <summary>BTRFS magic "_BHRfS_M"</summary>
const ulong BTRFS_MAGIC = 0x4D5F53665248425F;
const string FS_TYPE = "btrfs";
}

View File

@@ -2,7 +2,7 @@
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : BTRFS.cs
// Filename : Info.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : B-tree file system plugin.
@@ -30,38 +30,20 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Runtime.InteropServices;
using System.Text;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Helpers;
using Schemas;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the b-tree filesystem (btrfs)</summary>
public sealed class BTRFS : IFilesystem
public sealed partial class BTRFS
{
/// <summary>BTRFS magic "_BHRfS_M"</summary>
const ulong BTRFS_MAGIC = 0x4D5F53665248425F;
const string FS_TYPE = "btrfs";
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Name => Localization.BTRFS_Name;
/// <inheritdoc />
public Guid Id => new("C904CF15-5222-446B-B7DB-02EAC5D781B3");
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
/// <inheritdoc />
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
@@ -214,65 +196,4 @@ public sealed class BTRFS : IFilesystem
XmlFsType.FreeClusters = XmlFsType.Clusters - (btrfsSb.bytes_used / btrfsSb.sectorsize);
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct SuperBlock
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x20)]
public readonly byte[] checksum;
public readonly Guid uuid;
public readonly ulong pba;
public readonly ulong flags;
public readonly ulong magic;
public readonly ulong generation;
public readonly ulong root_lba;
public readonly ulong chunk_lba;
public readonly ulong log_lba;
public readonly ulong log_root_transid;
public readonly ulong total_bytes;
public readonly ulong bytes_used;
public readonly ulong root_dir_objectid;
public readonly ulong num_devices;
public readonly uint sectorsize;
public readonly uint nodesize;
public readonly uint leafsize;
public readonly uint stripesize;
public readonly uint n;
public readonly ulong chunk_root_generation;
public readonly ulong compat_flags;
public readonly ulong compat_ro_flags;
public readonly ulong incompat_flags;
public readonly ushort csum_type;
public readonly byte root_level;
public readonly byte chunk_root_level;
public readonly byte log_root_level;
public readonly DevItem dev_item;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x100)]
public readonly string label;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x100)]
public readonly byte[] reserved;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x800)]
public readonly byte[] chunkpairs;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x4D5)]
public readonly byte[] unused;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct DevItem
{
public readonly ulong id;
public readonly ulong bytes;
public readonly ulong used;
public readonly uint optimal_align;
public readonly uint optimal_width;
public readonly uint minimal_size;
public readonly ulong type;
public readonly ulong generation;
public readonly ulong start_offset;
public readonly uint dev_group;
public readonly byte seek_speed;
public readonly byte bandwidth;
public readonly Guid device_uuid;
public readonly Guid uuid;
}
}

View File

@@ -0,0 +1,102 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Structs.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : B-tree file system plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the B-tree file system and shows information.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Runtime.InteropServices;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the b-tree filesystem (btrfs)</summary>
public sealed partial class BTRFS
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct SuperBlock
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x20)]
public readonly byte[] checksum;
public readonly Guid uuid;
public readonly ulong pba;
public readonly ulong flags;
public readonly ulong magic;
public readonly ulong generation;
public readonly ulong root_lba;
public readonly ulong chunk_lba;
public readonly ulong log_lba;
public readonly ulong log_root_transid;
public readonly ulong total_bytes;
public readonly ulong bytes_used;
public readonly ulong root_dir_objectid;
public readonly ulong num_devices;
public readonly uint sectorsize;
public readonly uint nodesize;
public readonly uint leafsize;
public readonly uint stripesize;
public readonly uint n;
public readonly ulong chunk_root_generation;
public readonly ulong compat_flags;
public readonly ulong compat_ro_flags;
public readonly ulong incompat_flags;
public readonly ushort csum_type;
public readonly byte root_level;
public readonly byte chunk_root_level;
public readonly byte log_root_level;
public readonly DevItem dev_item;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x100)]
public readonly string label;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x100)]
public readonly byte[] reserved;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x800)]
public readonly byte[] chunkpairs;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x4D5)]
public readonly byte[] unused;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct DevItem
{
public readonly ulong id;
public readonly ulong bytes;
public readonly ulong used;
public readonly uint optimal_align;
public readonly uint optimal_width;
public readonly uint minimal_size;
public readonly ulong type;
public readonly ulong generation;
public readonly ulong start_offset;
public readonly uint dev_group;
public readonly byte seek_speed;
public readonly byte bandwidth;
public readonly Guid device_uuid;
public readonly Guid uuid;
}
}

View File

@@ -0,0 +1,50 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : CBM.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Commodore file system plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Text;
using Aaru.CommonTypes.Interfaces;
using Schemas;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the filesystem used in 8-bit Commodore microcomputers</summary>
public sealed partial class CBM : IFilesystem
{
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public string Name => Localization.CBM_Name;
/// <inheritdoc />
public Guid Id => new("D104744E-A376-450C-BAC0-1347C93F983B");
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
}

View File

@@ -0,0 +1,36 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Consts.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Commodore file system plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the filesystem used in 8-bit Commodore microcomputers</summary>
public sealed partial class CBM
{
const string FS_TYPE = "cbmfs";
}

View File

@@ -2,15 +2,11 @@
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : CBM.cs
// Filename : Info.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Commodore file system plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the Commodore file system and shows information.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
@@ -31,7 +27,6 @@
// ****************************************************************************/
using System;
using System.Runtime.InteropServices;
using System.Text;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
@@ -40,26 +35,13 @@ using Aaru.Helpers;
using Claunia.Encoding;
using Schemas;
using Encoding = System.Text.Encoding;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the filesystem used in 8-bit Commodore microcomputers</summary>
public sealed class CBM : IFilesystem
public sealed partial class CBM
{
const string FS_TYPE = "cbmfs";
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public string Name => Localization.CBM_Name;
/// <inheritdoc />
public Guid Id => new("D104744E-A376-450C-BAC0-1347C93F983B");
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
/// <inheritdoc />
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
@@ -190,75 +172,4 @@ public sealed class CBM : IFilesystem
information = sbInformation.ToString();
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct BAM
{
/// <summary>Track where directory starts</summary>
public readonly byte directoryTrack;
/// <summary>Sector where directory starts</summary>
public readonly byte directorySector;
/// <summary>Disk DOS version, 0x41</summary>
public readonly byte dosVersion;
/// <summary>Set to 0x80 if 1571, 0x00 if not</summary>
public readonly byte doubleSided;
/// <summary>Block allocation map</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 140)]
public readonly byte[] bam;
/// <summary>Disk name</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public readonly byte[] name;
/// <summary>Filled with 0xA0</summary>
public readonly ushort fill1;
/// <summary>Disk ID</summary>
public readonly ushort diskId;
/// <summary>Filled with 0xA0</summary>
public readonly byte fill2;
/// <summary>DOS type</summary>
public readonly ushort dosType;
/// <summary>Filled with 0xA0</summary>
public readonly uint fill3;
/// <summary>Unused</summary>
public readonly byte unused1;
/// <summary>Block allocation map for Dolphin DOS extended tracks</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
public readonly byte[] dolphinBam;
/// <summary>Block allocation map for Speed DOS extended tracks</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
public readonly byte[] speedBam;
/// <summary>Unused</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)]
public readonly byte[] unused2;
/// <summary>Free sector count for second side in 1571</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)]
public readonly byte[] freeCount;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct Header
{
/// <summary>Track where directory starts</summary>
public readonly byte directoryTrack;
/// <summary>Sector where directory starts</summary>
public readonly byte directorySector;
/// <summary>Disk DOS version, 0x44</summary>
public readonly byte diskDosVersion;
/// <summary>Unusued</summary>
public readonly byte unused1;
/// <summary>Disk name</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public readonly byte[] name;
/// <summary>Filled with 0xA0</summary>
public readonly ushort fill1;
/// <summary>Disk ID</summary>
public readonly ushort diskId;
/// <summary>Filled with 0xA0</summary>
public readonly byte fill2;
/// <summary>DOS version ('3')</summary>
public readonly byte dosVersion;
/// <summary>Disk version ('D')</summary>
public readonly byte diskVersion;
/// <summary>Filled with 0xA0</summary>
public readonly short fill3;
}
}

View File

@@ -0,0 +1,107 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Structs.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Commodore file system plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System.Runtime.InteropServices;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the filesystem used in 8-bit Commodore microcomputers</summary>
public sealed partial class CBM
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct BAM
{
/// <summary>Track where directory starts</summary>
public readonly byte directoryTrack;
/// <summary>Sector where directory starts</summary>
public readonly byte directorySector;
/// <summary>Disk DOS version, 0x41</summary>
public readonly byte dosVersion;
/// <summary>Set to 0x80 if 1571, 0x00 if not</summary>
public readonly byte doubleSided;
/// <summary>Block allocation map</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 140)]
public readonly byte[] bam;
/// <summary>Disk name</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public readonly byte[] name;
/// <summary>Filled with 0xA0</summary>
public readonly ushort fill1;
/// <summary>Disk ID</summary>
public readonly ushort diskId;
/// <summary>Filled with 0xA0</summary>
public readonly byte fill2;
/// <summary>DOS type</summary>
public readonly ushort dosType;
/// <summary>Filled with 0xA0</summary>
public readonly uint fill3;
/// <summary>Unused</summary>
public readonly byte unused1;
/// <summary>Block allocation map for Dolphin DOS extended tracks</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
public readonly byte[] dolphinBam;
/// <summary>Block allocation map for Speed DOS extended tracks</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
public readonly byte[] speedBam;
/// <summary>Unused</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)]
public readonly byte[] unused2;
/// <summary>Free sector count for second side in 1571</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 9)]
public readonly byte[] freeCount;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct Header
{
/// <summary>Track where directory starts</summary>
public readonly byte directoryTrack;
/// <summary>Sector where directory starts</summary>
public readonly byte directorySector;
/// <summary>Disk DOS version, 0x44</summary>
public readonly byte diskDosVersion;
/// <summary>Unusued</summary>
public readonly byte unused1;
/// <summary>Disk name</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public readonly byte[] name;
/// <summary>Filled with 0xA0</summary>
public readonly ushort fill1;
/// <summary>Disk ID</summary>
public readonly ushort diskId;
/// <summary>Filled with 0xA0</summary>
public readonly byte fill2;
/// <summary>DOS version ('3')</summary>
public readonly byte dosVersion;
/// <summary>Disk version ('D')</summary>
public readonly byte diskVersion;
/// <summary>Filled with 0xA0</summary>
public readonly short fill3;
}
}

View File

@@ -7,10 +7,6 @@
//
// Component : CP/M filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Methods to handle files.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -0,0 +1,45 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Consts.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Cram file system plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
// ReSharper disable UnusedMember.Local
using System.Diagnostics.CodeAnalysis;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the CRAM filesystem</summary>
[SuppressMessage("ReSharper", "UnusedType.Local")]
public sealed partial class Cram
{
/// <summary>Identifier for Cram</summary>
const uint CRAM_MAGIC = 0x28CD3D45;
const uint CRAM_CIGAM = 0x453DCD28;
const string FS_TYPE = "cramfs";
}

View File

@@ -0,0 +1,54 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Cram.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Cram file system plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
// ReSharper disable UnusedMember.Local
using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Aaru.CommonTypes.Interfaces;
using Schemas;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the CRAM filesystem</summary>
[SuppressMessage("ReSharper", "UnusedType.Local")]
public sealed partial class Cram : IFilesystem
{
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Name => Localization.Cram_Name;
/// <inheritdoc />
public Guid Id => new("F8F6E46F-7A2A-48E3-9C0A-46AF4DC29E09");
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
}

View File

@@ -0,0 +1,45 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Enums.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Cram file system plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
// ReSharper disable UnusedMember.Local
using System.Diagnostics.CodeAnalysis;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the CRAM filesystem</summary>
[SuppressMessage("ReSharper", "UnusedType.Local")]
public sealed partial class Cram
{
enum CramCompression : ushort
{
Zlib = 1, Lzma = 2, Lzo = 3,
Xz = 4, Lz4 = 5
}
}

View File

@@ -2,15 +2,11 @@
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Cram.cs
// Filename : Info.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Cram file system plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the Cram file system and shows information.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
@@ -34,37 +30,20 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Text;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Helpers;
using Schemas;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the CRAM filesystem</summary>
[SuppressMessage("ReSharper", "UnusedType.Local")]
public sealed class Cram : IFilesystem
public sealed partial class Cram
{
/// <summary>Identifier for Cram</summary>
const uint CRAM_MAGIC = 0x28CD3D45;
const uint CRAM_CIGAM = 0x453DCD28;
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Name => Localization.Cram_Name;
/// <inheritdoc />
public Guid Id => new("F8F6E46F-7A2A-48E3-9C0A-46AF4DC29E09");
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
/// <inheritdoc />
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
@@ -135,29 +114,4 @@ public sealed class Cram : IFilesystem
FreeClustersSpecified = true
};
}
const string FS_TYPE = "cramfs";
enum CramCompression : ushort
{
Zlib = 1, Lzma = 2, Lzo = 3,
Xz = 4, Lz4 = 5
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct SuperBlock
{
public readonly uint magic;
public readonly uint size;
public readonly uint flags;
public readonly uint future;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public readonly byte[] signature;
public readonly uint crc;
public readonly uint edition;
public readonly uint blocks;
public readonly uint files;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public readonly byte[] name;
}
}

View File

@@ -0,0 +1,57 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Structs.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Cram file system plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
// ReSharper disable UnusedMember.Local
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the CRAM filesystem</summary>
[SuppressMessage("ReSharper", "UnusedType.Local")]
public sealed partial class Cram
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct SuperBlock
{
public readonly uint magic;
public readonly uint size;
public readonly uint flags;
public readonly uint future;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public readonly byte[] signature;
public readonly uint crc;
public readonly uint edition;
public readonly uint blocks;
public readonly uint files;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public readonly byte[] name;
}
}

View File

@@ -0,0 +1,44 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Consts.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : ECMA-67 plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the ECMA-67 file system and shows information.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the filesystem described in ECMA-67</summary>
public sealed partial class ECMA67
{
const string FS_TYPE = "ecma67";
readonly byte[] _magic =
{
0x56, 0x4F, 0x4C
};
}

View File

@@ -0,0 +1,54 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : ECMA67.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : ECMA-67 plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the ECMA-67 file system and shows information.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Text;
using Aaru.CommonTypes.Interfaces;
using Schemas;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the filesystem described in ECMA-67</summary>
public sealed partial class ECMA67 : IFilesystem
{
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Name => Localization.ECMA67_Name;
/// <inheritdoc />
public Guid Id => new("62A2D44A-CBC1-4377-B4B6-28C5C92034A1");
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
}

View File

@@ -2,7 +2,7 @@
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : ECMA67.cs
// Filename : Info.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : ECMA-67 plugin.
@@ -30,39 +30,20 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Helpers;
using Schemas;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the filesystem described in ECMA-67</summary>
public sealed class ECMA67 : IFilesystem
public sealed partial class ECMA67
{
const string FS_TYPE = "ecma67";
readonly byte[] _magic =
{
0x56, 0x4F, 0x4C
};
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Name => Localization.ECMA67_Name;
/// <inheritdoc />
public Guid Id => new("62A2D44A-CBC1-4377-B4B6-28C5C92034A1");
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
/// <inheritdoc />
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
@@ -116,31 +97,4 @@ public sealed class ECMA67 : IFilesystem
information = sbInformation.ToString();
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct VolumeLabel
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] labelIdentifier;
public readonly byte labelNumber;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public readonly byte[] volumeIdentifier;
public readonly byte volumeAccessibility;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 26)]
public readonly byte[] reserved1;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)]
public readonly byte[] owner;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
public readonly byte[] reserved2;
public readonly byte surface;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] reserved3;
public readonly byte recordLength;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public readonly byte[] reserved4;
public readonly byte fileLabelAllocation;
public readonly byte labelStandardVersion;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 48)]
public readonly byte[] reserved5;
}
}

View File

@@ -0,0 +1,67 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Structs.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : ECMA-67 plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the ECMA-67 file system and shows information.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System.Runtime.InteropServices;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the filesystem described in ECMA-67</summary>
public sealed partial class ECMA67
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct VolumeLabel
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] labelIdentifier;
public readonly byte labelNumber;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public readonly byte[] volumeIdentifier;
public readonly byte volumeAccessibility;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 26)]
public readonly byte[] reserved1;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)]
public readonly byte[] owner;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
public readonly byte[] reserved2;
public readonly byte surface;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly byte[] reserved3;
public readonly byte recordLength;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public readonly byte[] reserved4;
public readonly byte fileLabelAllocation;
public readonly byte labelStandardVersion;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 48)]
public readonly byte[] reserved5;
}
}

View File

@@ -0,0 +1,39 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Consts.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Extent File System plugin
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements identification for the SGI Extent FileSystem</summary>
public sealed partial class EFS
{
const uint EFS_MAGIC = 0x00072959;
const uint EFS_MAGIC_NEW = 0x0007295A;
const string FS_TYPE = "efs";
}

View File

@@ -0,0 +1,50 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : EFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Extent File System plugin
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Text;
using Aaru.CommonTypes.Interfaces;
using Schemas;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements identification for the SGI Extent FileSystem</summary>
public sealed partial class EFS : IFilesystem
{
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Name => Localization.EFS_Name;
/// <inheritdoc />
public Guid Id => new("52A43F90-9AF3-4391-ADFE-65598DEEABAB");
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
}

View File

@@ -2,15 +2,11 @@
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : EFS.cs
// Filename : Info.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Extent File System plugin
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the Extent File System and shows information.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
@@ -31,8 +27,6 @@
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Text;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
@@ -40,30 +34,13 @@ using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Helpers;
using Schemas;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements identification for the SGI Extent FileSystem</summary>
public sealed class EFS : IFilesystem
public sealed partial class EFS
{
const uint EFS_MAGIC = 0x00072959;
const uint EFS_MAGIC_NEW = 0x0007295A;
const string FS_TYPE = "efs";
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Name => Localization.EFS_Name;
/// <inheritdoc />
public Guid Id => new("52A43F90-9AF3-4391-ADFE-65598DEEABAB");
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
/// <inheritdoc />
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
@@ -237,54 +214,4 @@ public sealed class EFS : IFilesystem
CreationDateSpecified = true
};
}
[StructLayout(LayoutKind.Sequential, Pack = 1), SuppressMessage("ReSharper", "InconsistentNaming")]
readonly struct Superblock
{
/* 0: fs size incl. bb 0 (in bb) */
public readonly int sb_size;
/* 4: first cg offset (in bb) */
public readonly int sb_firstcg;
/* 8: cg size (in bb) */
public readonly int sb_cgfsize;
/* 12: inodes/cg (in bb) */
public readonly short sb_cgisize;
/* 14: geom: sectors/track */
public readonly short sb_sectors;
/* 16: geom: heads/cylinder (unused) */
public readonly short sb_heads;
/* 18: num of cg's in the filesystem */
public readonly short sb_ncg;
/* 20: non-0 indicates fsck required */
public readonly short sb_dirty;
/* 22: */
public readonly short sb_pad0;
/* 24: superblock ctime */
public readonly int sb_time;
/* 28: magic [0] */
public readonly uint sb_magic;
/* 32: name of filesystem */
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public readonly byte[] sb_fname;
/* 38: name of filesystem pack */
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public readonly byte[] sb_fpack;
/* 44: bitmap size (in bytes) */
public readonly int sb_bmsize;
/* 48: total free data blocks */
public readonly int sb_tfree;
/* 52: total free inodes */
public readonly int sb_tinode;
/* 56: bitmap offset (grown fs) */
public readonly int sb_bmblock;
/* 62: repl. superblock offset */
public readonly int sb_replsb;
/* 64: last allocated inode */
public readonly int sb_lastinode;
/* 68: unused */
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
public readonly byte[] sb_spare;
/* 88: checksum (all above) */
public readonly uint sb_checksum;
}
}

View File

@@ -0,0 +1,87 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Structs.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Extent File System plugin
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements identification for the SGI Extent FileSystem</summary>
public sealed partial class EFS
{
[StructLayout(LayoutKind.Sequential, Pack = 1), SuppressMessage("ReSharper", "InconsistentNaming")]
readonly struct Superblock
{
/* 0: fs size incl. bb 0 (in bb) */
public readonly int sb_size;
/* 4: first cg offset (in bb) */
public readonly int sb_firstcg;
/* 8: cg size (in bb) */
public readonly int sb_cgfsize;
/* 12: inodes/cg (in bb) */
public readonly short sb_cgisize;
/* 14: geom: sectors/track */
public readonly short sb_sectors;
/* 16: geom: heads/cylinder (unused) */
public readonly short sb_heads;
/* 18: num of cg's in the filesystem */
public readonly short sb_ncg;
/* 20: non-0 indicates fsck required */
public readonly short sb_dirty;
/* 22: */
public readonly short sb_pad0;
/* 24: superblock ctime */
public readonly int sb_time;
/* 28: magic [0] */
public readonly uint sb_magic;
/* 32: name of filesystem */
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public readonly byte[] sb_fname;
/* 38: name of filesystem pack */
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public readonly byte[] sb_fpack;
/* 44: bitmap size (in bytes) */
public readonly int sb_bmsize;
/* 48: total free data blocks */
public readonly int sb_tfree;
/* 52: total free inodes */
public readonly int sb_tinode;
/* 56: bitmap offset (grown fs) */
public readonly int sb_bmblock;
/* 62: repl. superblock offset */
public readonly int sb_replsb;
/* 64: last allocated inode */
public readonly int sb_lastinode;
/* 68: unused */
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
public readonly byte[] sb_spare;
/* 88: checksum (all above) */
public readonly uint sb_checksum;
}
}

View File

@@ -0,0 +1,48 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Consts.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : F2FS filesystem plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the Flash-Friendly File System (F2FS)</summary>
[SuppressMessage("ReSharper", "UnusedMember.Local")]
public sealed partial class F2FS
{
// ReSharper disable InconsistentNaming
const uint F2FS_MAGIC = 0xF2F52010;
const uint F2FS_SUPER_OFFSET = 1024;
const uint F2FS_MIN_SECTOR = 512;
const uint F2FS_MAX_SECTOR = 4096;
const uint F2FS_BLOCK_SIZE = 4096;
// ReSharper restore InconsistentNaming
const string FS_TYPE = "f2fs";
}

View File

@@ -0,0 +1,52 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : F2FS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : F2FS filesystem plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Aaru.CommonTypes.Interfaces;
using Schemas;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the Flash-Friendly File System (F2FS)</summary>
[SuppressMessage("ReSharper", "UnusedMember.Local")]
public sealed partial class F2FS : IFilesystem
{
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Name => Localization.F2FS_Name;
/// <inheritdoc />
public Guid Id => new("82B0920F-5F0D-4063-9F57-ADE0AE02ECE5");
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
}

View File

@@ -2,15 +2,11 @@
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : F2FS.cs
// Filename : Info.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : F2FS filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the F2FS filesystem and shows information.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
@@ -30,44 +26,21 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Text;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.Helpers;
using Schemas;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the Flash-Friendly File System (F2FS)</summary>
[SuppressMessage("ReSharper", "UnusedMember.Local")]
public sealed class F2FS : IFilesystem
public sealed partial class F2FS
{
// ReSharper disable InconsistentNaming
const uint F2FS_MAGIC = 0xF2F52010;
const uint F2FS_SUPER_OFFSET = 1024;
const uint F2FS_MIN_SECTOR = 512;
const uint F2FS_MAX_SECTOR = 4096;
const uint F2FS_BLOCK_SIZE = 4096;
// ReSharper restore InconsistentNaming
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Name => Localization.F2FS_Name;
/// <inheritdoc />
public Guid Id => new("82B0920F-5F0D-4063-9F57-ADE0AE02ECE5");
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
/// <inheritdoc />
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
@@ -173,69 +146,4 @@ public sealed class F2FS : IFilesystem
VolumeSerial = f2fsSb.uuid.ToString()
};
}
const string FS_TYPE = "f2fs";
[StructLayout(LayoutKind.Sequential, Pack = 1), SuppressMessage("ReSharper", "InconsistentNaming")]
readonly struct Superblock
{
public readonly uint magic;
public readonly ushort major_ver;
public readonly ushort minor_ver;
public readonly uint log_sectorsize;
public readonly uint log_sectors_per_block;
public readonly uint log_blocksize;
public readonly uint log_blocks_per_seg;
public readonly uint segs_per_sec;
public readonly uint secs_per_zone;
public readonly uint checksum_offset;
public readonly ulong block_count;
public readonly uint section_count;
public readonly uint segment_count;
public readonly uint segment_count_ckpt;
public readonly uint segment_count_sit;
public readonly uint segment_count_nat;
public readonly uint segment_count_ssa;
public readonly uint segment_count_main;
public readonly uint segment0_blkaddr;
public readonly uint cp_blkaddr;
public readonly uint sit_blkaddr;
public readonly uint nat_blkaddr;
public readonly uint ssa_blkaddr;
public readonly uint main_blkaddr;
public readonly uint root_ino;
public readonly uint node_ino;
public readonly uint meta_ino;
public readonly Guid uuid;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1024)]
public readonly byte[] volume_name;
public readonly uint extension_count;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public readonly byte[] extension_list1;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public readonly byte[] extension_list2;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public readonly byte[] extension_list3;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public readonly byte[] extension_list4;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public readonly byte[] extension_list5;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public readonly byte[] extension_list6;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public readonly byte[] extension_list7;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public readonly byte[] extension_list8;
public readonly uint cp_payload;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)]
public readonly byte[] version;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)]
public readonly byte[] init_version;
public readonly uint feature;
public readonly byte encryption_level;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public readonly byte[] encrypt_pw_salt;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 871)]
public readonly byte[] reserved;
}
}

View File

@@ -0,0 +1,102 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Structs.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : F2FS filesystem plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of the Flash-Friendly File System (F2FS)</summary>
[SuppressMessage("ReSharper", "UnusedMember.Local")]
public sealed partial class F2FS
{
[StructLayout(LayoutKind.Sequential, Pack = 1), SuppressMessage("ReSharper", "InconsistentNaming")]
readonly struct Superblock
{
public readonly uint magic;
public readonly ushort major_ver;
public readonly ushort minor_ver;
public readonly uint log_sectorsize;
public readonly uint log_sectors_per_block;
public readonly uint log_blocksize;
public readonly uint log_blocks_per_seg;
public readonly uint segs_per_sec;
public readonly uint secs_per_zone;
public readonly uint checksum_offset;
public readonly ulong block_count;
public readonly uint section_count;
public readonly uint segment_count;
public readonly uint segment_count_ckpt;
public readonly uint segment_count_sit;
public readonly uint segment_count_nat;
public readonly uint segment_count_ssa;
public readonly uint segment_count_main;
public readonly uint segment0_blkaddr;
public readonly uint cp_blkaddr;
public readonly uint sit_blkaddr;
public readonly uint nat_blkaddr;
public readonly uint ssa_blkaddr;
public readonly uint main_blkaddr;
public readonly uint root_ino;
public readonly uint node_ino;
public readonly uint meta_ino;
public readonly Guid uuid;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1024)]
public readonly byte[] volume_name;
public readonly uint extension_count;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public readonly byte[] extension_list1;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public readonly byte[] extension_list2;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public readonly byte[] extension_list3;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public readonly byte[] extension_list4;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public readonly byte[] extension_list5;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public readonly byte[] extension_list6;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public readonly byte[] extension_list7;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public readonly byte[] extension_list8;
public readonly uint cp_payload;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)]
public readonly byte[] version;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)]
public readonly byte[] init_version;
public readonly uint feature;
public readonly byte encryption_level;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
public readonly byte[] encrypt_pw_salt;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 871)]
public readonly byte[] reserved;
}
}

View File

@@ -7,10 +7,6 @@
//
// Component : Microsoft FAT filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the Microsoft FAT Boot Parameter Block variant.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Microsoft FAT filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Microsoft FAT filesystem constants.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Microsoft FAT filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Methods to handle Microsoft FAT filesystem directories.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Microsoft FAT filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the Microsoft FAT filesystem and shows information.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Microsoft FAT filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Methods to handle files.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Microsoft FAT filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the Microsoft FAT filesystem and shows information.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Microsoft FAT filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Microsoft FAT filesystem structures.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Microsoft FAT filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Handles mounting and umounting the Microsoft FAT filesystem.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : Microsoft FAT filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Methods to handle Microsoft FAT extended attributes.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : FATX filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// FATX filesystem constants.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : FATX filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Methods to show the FATX directories.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : FATX filesystem plugin
//
// --[ Description ] ----------------------------------------------------------
//
// Constructors and common variables for the FATX filesystem plugin.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : FATX filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Methods to handle files.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : FATX filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the FATX filesystem and shows information.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : FATX filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// FATX filesystem structures.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -7,10 +7,6 @@
//
// Component : FATX filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Handles mounting and umounting the FATX filesystem.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify

View File

@@ -0,0 +1,86 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Consts.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : BSD Fast File System plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
using time_t = System.Int32;
using ufs_daddr_t = System.Int32;
namespace Aaru.Filesystems;
// Using information from Linux kernel headers
/// <inheritdoc />
/// <summary>Implements detection of BSD Fast File System (FFS, aka UNIX File System)</summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
public sealed partial class FFSPlugin
{
const uint block_size = 8192;
// FreeBSD specifies starts at byte offsets 0, 8192, 65536 and 262144, but in other cases it's following sectors
// Without bootcode
const ulong sb_start_floppy = 0;
// With bootcode
const ulong sb_start_boot = 1;
// Dunno, longer boot code
const ulong sb_start_long_boot = 8;
// Found on AT&T for MD-2D floppieslzio
const ulong sb_start_att_dsdd = 14;
// Found on hard disks (Atari UNIX e.g.)
const ulong sb_start_piggy = 32;
// MAGICs
// UFS magic
const uint UFS_MAGIC = 0x00011954;
// Big-endian UFS magic
const uint UFS_CIGAM = 0x54190100;
// BorderWare UFS
const uint UFS_MAGIC_BW = 0x0F242697;
// Big-endian BorderWare UFS
const uint UFS_CIGAM_BW = 0x9726240F;
// UFS2 magic
const uint UFS2_MAGIC = 0x19540119;
// Big-endian UFS2 magic
const uint UFS2_CIGAM = 0x19015419;
// Incomplete newfs
const uint UFS_BAD_MAGIC = 0x19960408;
// Big-endian incomplete newfs
const uint UFS_BAD_CIGAM = 0x08049619;
const string FS_TYPE_UFS = "ufs";
const string FS_TYPE_UFS2 = "ufs2";
}

View File

@@ -0,0 +1,55 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : FFS.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : BSD Fast File System plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Aaru.CommonTypes.Interfaces;
using Schemas;
using time_t = System.Int32;
using ufs_daddr_t = System.Int32;
namespace Aaru.Filesystems;
// Using information from Linux kernel headers
/// <inheritdoc />
/// <summary>Implements detection of BSD Fast File System (FFS, aka UNIX File System)</summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
public sealed partial class FFSPlugin : IFilesystem
{
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Name => Localization.FFSPlugin_Name;
/// <inheritdoc />
public Guid Id => new("CC90D342-05DB-48A8-988C-C1FE000034A3");
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
}

View File

@@ -2,15 +2,11 @@
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : FFS.cs
// Filename : Info.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : BSD Fast File System plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the BSD Fast File System and shows information.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
@@ -33,7 +29,6 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
@@ -41,7 +36,6 @@ using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Helpers;
using Schemas;
using Marshal = Aaru.Helpers.Marshal;
using time_t = System.Int32;
using ufs_daddr_t = System.Int32;
@@ -51,62 +45,8 @@ namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection of BSD Fast File System (FFS, aka UNIX File System)</summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
public sealed class FFSPlugin : IFilesystem
public sealed partial class FFSPlugin
{
const uint block_size = 8192;
// FreeBSD specifies starts at byte offsets 0, 8192, 65536 and 262144, but in other cases it's following sectors
// Without bootcode
const ulong sb_start_floppy = 0;
// With bootcode
const ulong sb_start_boot = 1;
// Dunno, longer boot code
const ulong sb_start_long_boot = 8;
// Found on AT&T for MD-2D floppieslzio
const ulong sb_start_att_dsdd = 14;
// Found on hard disks (Atari UNIX e.g.)
const ulong sb_start_piggy = 32;
// MAGICs
// UFS magic
const uint UFS_MAGIC = 0x00011954;
// Big-endian UFS magic
const uint UFS_CIGAM = 0x54190100;
// BorderWare UFS
const uint UFS_MAGIC_BW = 0x0F242697;
// Big-endian BorderWare UFS
const uint UFS_CIGAM_BW = 0x9726240F;
// UFS2 magic
const uint UFS2_MAGIC = 0x19540119;
// Big-endian UFS2 magic
const uint UFS2_CIGAM = 0x19015419;
// Incomplete newfs
const uint UFS_BAD_MAGIC = 0x19960408;
// Big-endian incomplete newfs
const uint UFS_BAD_CIGAM = 0x08049619;
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Name => Localization.FFSPlugin_Name;
/// <inheritdoc />
public Guid Id => new("CC90D342-05DB-48A8-988C-C1FE000034A3");
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
/// <inheritdoc />
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
@@ -152,9 +92,6 @@ public sealed class FFSPlugin : IFilesystem
}
}
const string FS_TYPE_UFS = "ufs";
const string FS_TYPE_UFS2 = "ufs2";
/// <inheritdoc />
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
{
@@ -606,255 +543,4 @@ public sealed class FFSPlugin : IFilesystem
information = sbInformation.ToString();
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct csum
{
/// <summary>number of directories</summary>
public int cs_ndir;
/// <summary>number of free blocks</summary>
public int cs_nbfree;
/// <summary>number of free inodes</summary>
public int cs_nifree;
/// <summary>number of free frags</summary>
public int cs_nffree;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct csum_total
{
/// <summary>number of directories</summary>
public long cs_ndir;
/// <summary>number of free blocks</summary>
public long cs_nbfree;
/// <summary>number of free inodes</summary>
public long cs_nifree;
/// <summary>number of free frags</summary>
public long cs_nffree;
/// <summary>number of free clusters</summary>
public long cs_numclusters;
/// <summary>future expansion</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly long[] cs_spare;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct SuperBlock
{
/// <summary>linked list of file systems</summary>
public readonly uint fs_link;
/// <summary>used for incore super blocks on Sun: uint fs_rolled; // logging only: fs fully rolled</summary>
public readonly uint fs_rlink;
/// <summary>addr of super-block in filesys</summary>
public readonly int fs_sblkno;
/// <summary>offset of cyl-block in filesys</summary>
public readonly int fs_cblkno;
/// <summary>offset of inode-blocks in filesys</summary>
public readonly int fs_iblkno;
/// <summary>offset of first data after cg</summary>
public readonly int fs_dblkno;
/// <summary>cylinder group offset in cylinder</summary>
public readonly int fs_old_cgoffset;
/// <summary>used to calc mod fs_ntrak</summary>
public readonly int fs_old_cgmask;
/// <summary>last time written</summary>
public readonly int fs_old_time;
/// <summary>number of blocks in fs</summary>
public readonly int fs_old_size;
/// <summary>number of data blocks in fs</summary>
public readonly int fs_old_dsize;
/// <summary>number of cylinder groups</summary>
public readonly int fs_ncg;
/// <summary>size of basic blocks in fs</summary>
public readonly int fs_bsize;
/// <summary>size of frag blocks in fs</summary>
public readonly int fs_fsize;
/// <summary>number of frags in a block in fs</summary>
public readonly int fs_frag;
/* these are configuration parameters */
/// <summary>minimum percentage of free blocks</summary>
public readonly int fs_minfree;
/// <summary>num of ms for optimal next block</summary>
public readonly int fs_old_rotdelay;
/// <summary>disk revolutions per second</summary>
public readonly int fs_old_rps;
/* these fields can be computed from the others */
/// <summary>``blkoff'' calc of blk offsets</summary>
public readonly int fs_bmask;
/// <summary>``fragoff'' calc of frag offsets</summary>
public readonly int fs_fmask;
/// <summary>``lblkno'' calc of logical blkno</summary>
public readonly int fs_bshift;
/// <summary>``numfrags'' calc number of frags</summary>
public readonly int fs_fshift;
/* these are configuration parameters */
/// <summary>max number of contiguous blks</summary>
public readonly int fs_maxcontig;
/// <summary>max number of blks per cyl group</summary>
public readonly int fs_maxbpg;
/* these fields can be computed from the others */
/// <summary>block to frag shift</summary>
public readonly int fs_fragshift;
/// <summary>fsbtodb and dbtofsb shift constant</summary>
public readonly int fs_fsbtodb;
/// <summary>actual size of super block</summary>
public readonly int fs_sbsize;
/// <summary>csum block offset</summary>
public readonly int fs_csmask;
/// <summary>csum block number</summary>
public readonly int fs_csshift;
/// <summary>value of NINDIR</summary>
public readonly int fs_nindir;
/// <summary>value of INOPB</summary>
public readonly uint fs_inopb;
/// <summary>value of NSPF</summary>
public readonly int fs_old_nspf;
/* yet another configuration parameter */
/// <summary>optimization preference, see below On SVR: int fs_state; // file system state</summary>
public readonly int fs_optim;
/// <summary># sectors/track including spares</summary>
public readonly int fs_old_npsect;
/// <summary>hardware sector interleave</summary>
public readonly int fs_old_interleave;
/// <summary>sector 0 skew, per track On A/UX: int fs_state; // file system state</summary>
public readonly int fs_old_trackskew;
/// <summary>unique filesystem id On old: int fs_headswitch; // head switch time, usec</summary>
public readonly int fs_id_1;
/// <summary>unique filesystem id On old: int fs_trkseek; // track-to-track seek, usec</summary>
public readonly int fs_id_2;
/* sizes determined by number of cylinder groups and their sizes */
/// <summary>blk addr of cyl grp summary area</summary>
public readonly int fs_old_csaddr;
/// <summary>size of cyl grp summary area</summary>
public readonly int fs_cssize;
/// <summary>cylinder group size</summary>
public readonly int fs_cgsize;
/* these fields are derived from the hardware */
/// <summary>tracks per cylinder</summary>
public readonly int fs_old_ntrak;
/// <summary>sectors per track</summary>
public readonly int fs_old_nsect;
/// <summary>sectors per cylinder</summary>
public readonly int fs_old_spc;
/* this comes from the disk driver partitioning */
/// <summary>cylinders in filesystem</summary>
public readonly int fs_old_ncyl;
/* these fields can be computed from the others */
/// <summary>cylinders per group</summary>
public readonly int fs_old_cpg;
/// <summary>inodes per group</summary>
public readonly int fs_ipg;
/// <summary>blocks per group * fs_frag</summary>
public readonly int fs_fpg;
/* this data must be re-computed after crashes */
/// <summary>cylinder summary information</summary>
public csum fs_old_cstotal;
/* these fields are cleared at mount time */
/// <summary>super block modified flag</summary>
public readonly sbyte fs_fmod;
/// <summary>filesystem is clean flag</summary>
public readonly sbyte fs_clean;
/// <summary>mounted read-only flag</summary>
public readonly sbyte fs_ronly;
/// <summary>old FS_ flags</summary>
public readonly sbyte fs_old_flags;
/// <summary>name mounted on</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 468)]
public readonly byte[] fs_fsmnt;
/// <summary>volume name</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public readonly byte[] fs_volname;
/// <summary>system-wide uid</summary>
public readonly ulong fs_swuid;
/// <summary>due to alignment of fs_swuid</summary>
public readonly int fs_pad;
/* these fields retain the current block allocation info */
/// <summary>last cg searched</summary>
public readonly int fs_cgrotor;
/// <summary>padding; was list of fs_cs buffers</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)]
public readonly uint[] fs_ocsp;
/// <summary>(u) # of contig. allocated dirs</summary>
public readonly uint fs_contigdirs;
/// <summary>(u) cg summary info buffer</summary>
public readonly uint fs_csp;
/// <summary>(u) max cluster in each cyl group</summary>
public readonly uint fs_maxcluster;
/// <summary>(u) used by snapshots to track fs</summary>
public readonly uint fs_active;
/// <summary>cyl per cycle in postbl</summary>
public readonly int fs_old_cpc;
/// <summary>maximum blocking factor permitted</summary>
public readonly int fs_maxbsize;
/// <summary>number of unreferenced inodes</summary>
public readonly long fs_unrefs;
/// <summary>size of underlying GEOM provider</summary>
public readonly long fs_providersize;
/// <summary>size of area reserved for metadata</summary>
public readonly long fs_metaspace;
/// <summary>old rotation block list head</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)]
public readonly long[] fs_sparecon64;
/// <summary>byte offset of standard superblock</summary>
public readonly long fs_sblockloc;
/// <summary>(u) cylinder summary information</summary>
public csum_total fs_cstotal;
/// <summary>last time written</summary>
public readonly long fs_time;
/// <summary>number of blocks in fs</summary>
public readonly long fs_size;
/// <summary>number of data blocks in fs</summary>
public readonly long fs_dsize;
/// <summary>blk addr of cyl grp summary area</summary>
public readonly long fs_csaddr;
/// <summary>(u) blocks being freed</summary>
public readonly long fs_pendingblocks;
/// <summary>(u) inodes being freed</summary>
public readonly uint fs_pendinginodes;
/// <summary>list of snapshot inode numbers</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
public readonly uint[] fs_snapinum;
/// <summary>expected average file size</summary>
public readonly uint fs_avgfilesize;
/// <summary>expected # of files per directory</summary>
public readonly uint fs_avgfpdir;
/// <summary>save real cg size to use fs_bsize</summary>
public readonly int fs_save_cgsize;
/// <summary>Last mount or fsck time.</summary>
public readonly long fs_mtime;
/// <summary>SUJ free list</summary>
public readonly int fs_sujfree;
/// <summary>reserved for future constants</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 23)]
public readonly int[] fs_sparecon32;
/// <summary>see FS_ flags below</summary>
public readonly int fs_flags;
/// <summary>size of cluster summary array</summary>
public readonly int fs_contigsumsize;
/// <summary>max length of an internal symlink</summary>
public readonly int fs_maxsymlinklen;
/// <summary>format of on-disk inodes</summary>
public readonly int fs_old_inodefmt;
/// <summary>maximum representable file size</summary>
public readonly ulong fs_maxfilesize;
/// <summary>~fs_bmask for use with 64-bit size</summary>
public readonly long fs_qbmask;
/// <summary>~fs_fmask for use with 64-bit size</summary>
public readonly long fs_qfmask;
/// <summary>validate fs_clean field</summary>
public readonly int fs_state;
/// <summary>format of positional layout tables</summary>
public readonly int fs_old_postblformat;
/// <summary>number of rotational positions</summary>
public readonly int fs_old_nrpos;
/// <summary>(short) rotation block list head</summary>
public readonly int fs_old_postbloff;
/// <summary>(uchar_t) blocks for each rotation</summary>
public readonly int fs_old_rotbloff;
/// <summary>magic number</summary>
public readonly uint fs_magic;
/// <summary>list of blocks for each rotation</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
public readonly byte[] fs_rotbl;
}
}

View File

@@ -0,0 +1,292 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Structs.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : BSD Fast File System plugin.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using time_t = System.Int32;
using ufs_daddr_t = System.Int32;
namespace Aaru.Filesystems;
// Using information from Linux kernel headers
/// <inheritdoc />
/// <summary>Implements detection of BSD Fast File System (FFS, aka UNIX File System)</summary>
[SuppressMessage("ReSharper", "InconsistentNaming")]
public sealed partial class FFSPlugin
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct csum
{
/// <summary>number of directories</summary>
public int cs_ndir;
/// <summary>number of free blocks</summary>
public int cs_nbfree;
/// <summary>number of free inodes</summary>
public int cs_nifree;
/// <summary>number of free frags</summary>
public int cs_nffree;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct csum_total
{
/// <summary>number of directories</summary>
public long cs_ndir;
/// <summary>number of free blocks</summary>
public long cs_nbfree;
/// <summary>number of free inodes</summary>
public long cs_nifree;
/// <summary>number of free frags</summary>
public long cs_nffree;
/// <summary>number of free clusters</summary>
public long cs_numclusters;
/// <summary>future expansion</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public readonly long[] cs_spare;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct SuperBlock
{
/// <summary>linked list of file systems</summary>
public readonly uint fs_link;
/// <summary>used for incore super blocks on Sun: uint fs_rolled; // logging only: fs fully rolled</summary>
public readonly uint fs_rlink;
/// <summary>addr of super-block in filesys</summary>
public readonly int fs_sblkno;
/// <summary>offset of cyl-block in filesys</summary>
public readonly int fs_cblkno;
/// <summary>offset of inode-blocks in filesys</summary>
public readonly int fs_iblkno;
/// <summary>offset of first data after cg</summary>
public readonly int fs_dblkno;
/// <summary>cylinder group offset in cylinder</summary>
public readonly int fs_old_cgoffset;
/// <summary>used to calc mod fs_ntrak</summary>
public readonly int fs_old_cgmask;
/// <summary>last time written</summary>
public readonly int fs_old_time;
/// <summary>number of blocks in fs</summary>
public readonly int fs_old_size;
/// <summary>number of data blocks in fs</summary>
public readonly int fs_old_dsize;
/// <summary>number of cylinder groups</summary>
public readonly int fs_ncg;
/// <summary>size of basic blocks in fs</summary>
public readonly int fs_bsize;
/// <summary>size of frag blocks in fs</summary>
public readonly int fs_fsize;
/// <summary>number of frags in a block in fs</summary>
public readonly int fs_frag;
/* these are configuration parameters */
/// <summary>minimum percentage of free blocks</summary>
public readonly int fs_minfree;
/// <summary>num of ms for optimal next block</summary>
public readonly int fs_old_rotdelay;
/// <summary>disk revolutions per second</summary>
public readonly int fs_old_rps;
/* these fields can be computed from the others */
/// <summary>``blkoff'' calc of blk offsets</summary>
public readonly int fs_bmask;
/// <summary>``fragoff'' calc of frag offsets</summary>
public readonly int fs_fmask;
/// <summary>``lblkno'' calc of logical blkno</summary>
public readonly int fs_bshift;
/// <summary>``numfrags'' calc number of frags</summary>
public readonly int fs_fshift;
/* these are configuration parameters */
/// <summary>max number of contiguous blks</summary>
public readonly int fs_maxcontig;
/// <summary>max number of blks per cyl group</summary>
public readonly int fs_maxbpg;
/* these fields can be computed from the others */
/// <summary>block to frag shift</summary>
public readonly int fs_fragshift;
/// <summary>fsbtodb and dbtofsb shift constant</summary>
public readonly int fs_fsbtodb;
/// <summary>actual size of super block</summary>
public readonly int fs_sbsize;
/// <summary>csum block offset</summary>
public readonly int fs_csmask;
/// <summary>csum block number</summary>
public readonly int fs_csshift;
/// <summary>value of NINDIR</summary>
public readonly int fs_nindir;
/// <summary>value of INOPB</summary>
public readonly uint fs_inopb;
/// <summary>value of NSPF</summary>
public readonly int fs_old_nspf;
/* yet another configuration parameter */
/// <summary>optimization preference, see below On SVR: int fs_state; // file system state</summary>
public readonly int fs_optim;
/// <summary># sectors/track including spares</summary>
public readonly int fs_old_npsect;
/// <summary>hardware sector interleave</summary>
public readonly int fs_old_interleave;
/// <summary>sector 0 skew, per track On A/UX: int fs_state; // file system state</summary>
public readonly int fs_old_trackskew;
/// <summary>unique filesystem id On old: int fs_headswitch; // head switch time, usec</summary>
public readonly int fs_id_1;
/// <summary>unique filesystem id On old: int fs_trkseek; // track-to-track seek, usec</summary>
public readonly int fs_id_2;
/* sizes determined by number of cylinder groups and their sizes */
/// <summary>blk addr of cyl grp summary area</summary>
public readonly int fs_old_csaddr;
/// <summary>size of cyl grp summary area</summary>
public readonly int fs_cssize;
/// <summary>cylinder group size</summary>
public readonly int fs_cgsize;
/* these fields are derived from the hardware */
/// <summary>tracks per cylinder</summary>
public readonly int fs_old_ntrak;
/// <summary>sectors per track</summary>
public readonly int fs_old_nsect;
/// <summary>sectors per cylinder</summary>
public readonly int fs_old_spc;
/* this comes from the disk driver partitioning */
/// <summary>cylinders in filesystem</summary>
public readonly int fs_old_ncyl;
/* these fields can be computed from the others */
/// <summary>cylinders per group</summary>
public readonly int fs_old_cpg;
/// <summary>inodes per group</summary>
public readonly int fs_ipg;
/// <summary>blocks per group * fs_frag</summary>
public readonly int fs_fpg;
/* this data must be re-computed after crashes */
/// <summary>cylinder summary information</summary>
public csum fs_old_cstotal;
/* these fields are cleared at mount time */
/// <summary>super block modified flag</summary>
public readonly sbyte fs_fmod;
/// <summary>filesystem is clean flag</summary>
public readonly sbyte fs_clean;
/// <summary>mounted read-only flag</summary>
public readonly sbyte fs_ronly;
/// <summary>old FS_ flags</summary>
public readonly sbyte fs_old_flags;
/// <summary>name mounted on</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 468)]
public readonly byte[] fs_fsmnt;
/// <summary>volume name</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public readonly byte[] fs_volname;
/// <summary>system-wide uid</summary>
public readonly ulong fs_swuid;
/// <summary>due to alignment of fs_swuid</summary>
public readonly int fs_pad;
/* these fields retain the current block allocation info */
/// <summary>last cg searched</summary>
public readonly int fs_cgrotor;
/// <summary>padding; was list of fs_cs buffers</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)]
public readonly uint[] fs_ocsp;
/// <summary>(u) # of contig. allocated dirs</summary>
public readonly uint fs_contigdirs;
/// <summary>(u) cg summary info buffer</summary>
public readonly uint fs_csp;
/// <summary>(u) max cluster in each cyl group</summary>
public readonly uint fs_maxcluster;
/// <summary>(u) used by snapshots to track fs</summary>
public readonly uint fs_active;
/// <summary>cyl per cycle in postbl</summary>
public readonly int fs_old_cpc;
/// <summary>maximum blocking factor permitted</summary>
public readonly int fs_maxbsize;
/// <summary>number of unreferenced inodes</summary>
public readonly long fs_unrefs;
/// <summary>size of underlying GEOM provider</summary>
public readonly long fs_providersize;
/// <summary>size of area reserved for metadata</summary>
public readonly long fs_metaspace;
/// <summary>old rotation block list head</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 14)]
public readonly long[] fs_sparecon64;
/// <summary>byte offset of standard superblock</summary>
public readonly long fs_sblockloc;
/// <summary>(u) cylinder summary information</summary>
public csum_total fs_cstotal;
/// <summary>last time written</summary>
public readonly long fs_time;
/// <summary>number of blocks in fs</summary>
public readonly long fs_size;
/// <summary>number of data blocks in fs</summary>
public readonly long fs_dsize;
/// <summary>blk addr of cyl grp summary area</summary>
public readonly long fs_csaddr;
/// <summary>(u) blocks being freed</summary>
public readonly long fs_pendingblocks;
/// <summary>(u) inodes being freed</summary>
public readonly uint fs_pendinginodes;
/// <summary>list of snapshot inode numbers</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
public readonly uint[] fs_snapinum;
/// <summary>expected average file size</summary>
public readonly uint fs_avgfilesize;
/// <summary>expected # of files per directory</summary>
public readonly uint fs_avgfpdir;
/// <summary>save real cg size to use fs_bsize</summary>
public readonly int fs_save_cgsize;
/// <summary>Last mount or fsck time.</summary>
public readonly long fs_mtime;
/// <summary>SUJ free list</summary>
public readonly int fs_sujfree;
/// <summary>reserved for future constants</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 23)]
public readonly int[] fs_sparecon32;
/// <summary>see FS_ flags below</summary>
public readonly int fs_flags;
/// <summary>size of cluster summary array</summary>
public readonly int fs_contigsumsize;
/// <summary>max length of an internal symlink</summary>
public readonly int fs_maxsymlinklen;
/// <summary>format of on-disk inodes</summary>
public readonly int fs_old_inodefmt;
/// <summary>maximum representable file size</summary>
public readonly ulong fs_maxfilesize;
/// <summary>~fs_bmask for use with 64-bit size</summary>
public readonly long fs_qbmask;
/// <summary>~fs_fmask for use with 64-bit size</summary>
public readonly long fs_qfmask;
/// <summary>validate fs_clean field</summary>
public readonly int fs_state;
/// <summary>format of positional layout tables</summary>
public readonly int fs_old_postblformat;
/// <summary>number of rotational positions</summary>
public readonly int fs_old_nrpos;
/// <summary>(short) rotation block list head</summary>
public readonly int fs_old_postbloff;
/// <summary>(uchar_t) blocks for each rotation</summary>
public readonly int fs_old_rotbloff;
/// <summary>magic number</summary>
public readonly uint fs_magic;
/// <summary>list of blocks for each rotation</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1)]
public readonly byte[] fs_rotbl;
}
}

View File

@@ -0,0 +1,42 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Consts.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Fossil filesystem plugin
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection for the Plan-9 Fossil on-disk filesystem</summary>
public sealed partial class Fossil
{
const uint FOSSIL_HDR_MAGIC = 0x3776AE89;
const uint FOSSIL_SB_MAGIC = 0x2340A3B1;
// Fossil header starts at 128KiB
const ulong HEADER_POS = 128 * 1024;
const string FS_TYPE = "fossil";
}

View File

@@ -0,0 +1,50 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Fossil.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Fossil filesystem plugin
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Text;
using Aaru.CommonTypes.Interfaces;
using Schemas;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection for the Plan-9 Fossil on-disk filesystem</summary>
public sealed partial class Fossil : IFilesystem
{
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Name => Localization.Fossil_Name;
/// <inheritdoc />
public Guid Id => new("932BF104-43F6-494F-973C-45EF58A51DA9");
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
}

View File

@@ -2,15 +2,11 @@
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Fossil.cs
// Filename : Info.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Fossil filesystem plugin
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the Fossil filesystem and shows information.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
@@ -30,8 +26,6 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Runtime.InteropServices;
using System.Text;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
@@ -39,33 +33,13 @@ using Aaru.CommonTypes.Interfaces;
using Aaru.Console;
using Aaru.Helpers;
using Schemas;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.Filesystems;
/// <inheritdoc />
/// <summary>Implements detection for the Plan-9 Fossil on-disk filesystem</summary>
public sealed class Fossil : IFilesystem
public sealed partial class Fossil
{
const uint FOSSIL_HDR_MAGIC = 0x3776AE89;
const uint FOSSIL_SB_MAGIC = 0x2340A3B1;
// Fossil header starts at 128KiB
const ulong HEADER_POS = 128 * 1024;
const string FS_TYPE = "fossil";
/// <inheritdoc />
public FileSystemType XmlFsType { get; private set; }
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Name => Localization.Fossil_Name;
/// <inheritdoc />
public Guid Id => new("932BF104-43F6-494F-973C-45EF58A51DA9");
/// <inheritdoc />
public string Author => Authors.NataliaPortillo;
/// <inheritdoc />
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
@@ -148,50 +122,4 @@ public sealed class Fossil : IFilesystem
information = sb.ToString();
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct Header
{
/// <summary>Magic number</summary>
public readonly uint magic;
/// <summary>Header version</summary>
public readonly ushort version;
/// <summary>Block size</summary>
public readonly ushort blockSize;
/// <summary>Block containing superblock</summary>
public readonly uint super;
/// <summary>Block containing labels</summary>
public readonly uint label;
/// <summary>Where do data blocks start</summary>
public readonly uint data;
/// <summary>How many data blocks does it have</summary>
public readonly uint end;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct SuperBlock
{
/// <summary>Magic number</summary>
public readonly uint magic;
/// <summary>Header version</summary>
public readonly ushort version;
/// <summary>file system low epoch</summary>
public readonly uint epochLow;
/// <summary>file system high(active) epoch</summary>
public readonly uint epochHigh;
/// <summary>next qid to allocate</summary>
public readonly ulong qid;
/// <summary>data block number: root of active file system</summary>
public readonly int active;
/// <summary>data block number: root of next file system to archive</summary>
public readonly int next;
/// <summary>data block number: root of file system currently being archived</summary>
public readonly int current;
/// <summary>Venti score of last successful archive</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)]
public readonly byte[] last;
/// <summary>name of file system(just a comment)</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public readonly byte[] name;
}
}

Some files were not shown because too many files have changed in this diff Show More