2017-07-19 16:31:08 +01:00
|
|
|
|
// /***************************************************************************
|
2020-02-27 12:31:25 +00:00
|
|
|
|
// Aaru Data Preservation Suite
|
2016-09-02 05:23:59 +01:00
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Filename : QNX4.cs
|
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Component : QNX4 filesystem plugin.
|
2016-09-02 05:23:59 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
|
//
|
2016-09-02 06:03:58 +01:00
|
|
|
|
// Identifies the QNX4 filesystem and shows information.
|
2016-09-02 05:23:59 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ 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/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2020-01-03 17:51:30 +00:00
|
|
|
|
// Copyright © 2011-2020 Natalia Portillo
|
2016-09-02 05:23:59 +01:00
|
|
|
|
// ****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
using System;
|
2020-07-20 07:47:12 +01:00
|
|
|
|
using System.Diagnostics.CodeAnalysis;
|
2016-09-02 05:23:59 +01:00
|
|
|
|
using System.Linq;
|
2016-09-02 06:03:58 +01:00
|
|
|
|
using System.Runtime.InteropServices;
|
2017-06-06 21:23:20 +01:00
|
|
|
|
using System.Text;
|
2020-02-27 00:33:26 +00:00
|
|
|
|
using Aaru.CommonTypes;
|
|
|
|
|
|
using Aaru.CommonTypes.Interfaces;
|
2020-07-20 15:43:52 +01:00
|
|
|
|
using Aaru.Helpers;
|
2017-12-21 14:30:38 +00:00
|
|
|
|
using Schemas;
|
2020-02-27 00:33:26 +00:00
|
|
|
|
using Marshal = Aaru.Helpers.Marshal;
|
2016-09-02 05:23:59 +01:00
|
|
|
|
|
2020-02-27 00:33:26 +00:00
|
|
|
|
namespace Aaru.Filesystems
|
2016-09-02 05:23:59 +01:00
|
|
|
|
{
|
2020-07-20 07:47:12 +01:00
|
|
|
|
[SuppressMessage("ReSharper", "UnusedType.Local")]
|
2020-07-22 13:20:25 +01:00
|
|
|
|
public sealed class QNX4 : IFilesystem
|
2016-09-02 05:23:59 +01:00
|
|
|
|
{
|
2020-07-20 21:11:32 +01:00
|
|
|
|
readonly byte[] _rootDirFname =
|
2018-08-29 22:15:43 +01:00
|
|
|
|
{
|
|
|
|
|
|
0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
|
|
|
|
};
|
2016-09-02 05:23:59 +01:00
|
|
|
|
|
2017-12-26 08:01:40 +00:00
|
|
|
|
public FileSystemType XmlFsType { get; private set; }
|
2018-06-22 08:08:38 +01:00
|
|
|
|
public Encoding Encoding { get; private set; }
|
|
|
|
|
|
public string Name => "QNX4 Plugin";
|
|
|
|
|
|
public Guid Id => new Guid("E73A63FA-B5B0-48BF-BF82-DA5F0A8170D2");
|
2018-08-29 22:15:43 +01:00
|
|
|
|
public string Author => "Natalia Portillo";
|
2016-09-02 05:23:59 +01:00
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public bool Identify(IMediaImage imagePlugin, Partition partition)
|
2016-09-02 05:23:59 +01:00
|
|
|
|
{
|
2020-02-29 18:03:35 +00:00
|
|
|
|
if(partition.Start + 1 >= imagePlugin.Info.Sectors)
|
|
|
|
|
|
return false;
|
2017-11-08 17:05:00 +00:00
|
|
|
|
|
2017-07-19 16:37:11 +01:00
|
|
|
|
byte[] sector = imagePlugin.ReadSector(partition.Start + 1);
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
|
|
|
|
|
if(sector.Length < 512)
|
|
|
|
|
|
return false;
|
2016-09-02 05:23:59 +01:00
|
|
|
|
|
2020-07-20 21:11:32 +01:00
|
|
|
|
Superblock qnxSb = Marshal.ByteArrayToStructureLittleEndian<Superblock>(sector);
|
2016-09-02 05:23:59 +01:00
|
|
|
|
|
|
|
|
|
|
// Check root directory name
|
2020-07-20 21:11:32 +01:00
|
|
|
|
if(!_rootDirFname.SequenceEqual(qnxSb.rootDir.di_fname))
|
2020-02-29 18:03:35 +00:00
|
|
|
|
return false;
|
2016-09-02 05:23:59 +01:00
|
|
|
|
|
|
|
|
|
|
// Check sizes are multiple of blocks
|
2020-02-29 18:03:35 +00:00
|
|
|
|
if(qnxSb.rootDir.di_size % 512 != 0 ||
|
|
|
|
|
|
qnxSb.inode.di_size % 512 != 0 ||
|
|
|
|
|
|
qnxSb.boot.di_size % 512 != 0 ||
|
|
|
|
|
|
qnxSb.altBoot.di_size % 512 != 0)
|
|
|
|
|
|
return false;
|
2016-09-02 05:23:59 +01:00
|
|
|
|
|
|
|
|
|
|
// Check extents are not past device
|
2017-07-19 16:37:11 +01:00
|
|
|
|
if(qnxSb.rootDir.di_first_xtnt.block + partition.Start >= partition.End ||
|
2018-06-22 08:08:38 +01:00
|
|
|
|
qnxSb.inode.di_first_xtnt.block + partition.Start >= partition.End ||
|
|
|
|
|
|
qnxSb.boot.di_first_xtnt.block + partition.Start >= partition.End ||
|
2020-02-29 18:03:35 +00:00
|
|
|
|
qnxSb.altBoot.di_first_xtnt.block + partition.Start >= partition.End)
|
|
|
|
|
|
return false;
|
2016-09-02 05:23:59 +01:00
|
|
|
|
|
|
|
|
|
|
// Check inodes are in use
|
2020-02-29 18:03:35 +00:00
|
|
|
|
if((qnxSb.rootDir.di_status & 0x01) != 0x01 ||
|
|
|
|
|
|
(qnxSb.inode.di_status & 0x01) != 0x01 ||
|
|
|
|
|
|
(qnxSb.boot.di_status & 0x01) != 0x01)
|
|
|
|
|
|
return false;
|
2016-09-02 05:23:59 +01:00
|
|
|
|
|
|
|
|
|
|
// All hail filesystems without identification marks
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
|
2020-02-29 18:03:35 +00:00
|
|
|
|
Encoding encoding)
|
2016-09-02 05:23:59 +01:00
|
|
|
|
{
|
2018-06-22 08:08:38 +01:00
|
|
|
|
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
|
2016-09-02 05:23:59 +01:00
|
|
|
|
information = "";
|
2017-07-19 16:37:11 +01:00
|
|
|
|
byte[] sector = imagePlugin.ReadSector(partition.Start + 1);
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
|
|
|
|
|
if(sector.Length < 512)
|
|
|
|
|
|
return;
|
2016-09-02 05:23:59 +01:00
|
|
|
|
|
2020-07-20 21:11:32 +01:00
|
|
|
|
Superblock qnxSb = Marshal.ByteArrayToStructureLittleEndian<Superblock>(sector);
|
2016-09-02 05:23:59 +01:00
|
|
|
|
|
|
|
|
|
|
// Too much useless information
|
|
|
|
|
|
/*
|
2020-02-27 23:48:41 +00:00
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.rootDir.di_fname = {0}", CurrentEncoding.GetString(qnxSb.rootDir.di_fname));
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.rootDir.di_size = {0}", qnxSb.rootDir.di_size);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.rootDir.di_first_xtnt.block = {0}", qnxSb.rootDir.di_first_xtnt.block);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.rootDir.di_first_xtnt.length = {0}", qnxSb.rootDir.di_first_xtnt.length);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.rootDir.di_xblk = {0}", qnxSb.rootDir.di_xblk);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.rootDir.di_ftime = {0}", DateHandlers.UNIXUnsignedToDateTime(qnxSb.rootDir.di_ftime));
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.rootDir.di_mtime = {0}", DateHandlers.UNIXUnsignedToDateTime(qnxSb.rootDir.di_mtime));
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.rootDir.di_atime = {0}", DateHandlers.UNIXUnsignedToDateTime(qnxSb.rootDir.di_atime));
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.rootDir.di_ctime = {0}", DateHandlers.UNIXUnsignedToDateTime(qnxSb.rootDir.di_ctime));
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.rootDir.di_num_xtnts = {0}", qnxSb.rootDir.di_num_xtnts);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.rootDir.di_mode = {0}", Convert.ToString(qnxSb.rootDir.di_mode, 8));
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.rootDir.di_uid = {0}", qnxSb.rootDir.di_uid);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.rootDir.di_gid = {0}", qnxSb.rootDir.di_gid);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.rootDir.di_nlink = {0}", qnxSb.rootDir.di_nlink);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.rootDir.di_zero = {0}", qnxSb.rootDir.di_zero);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.rootDir.di_type = {0}", qnxSb.rootDir.di_type);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.rootDir.di_status = {0}", qnxSb.rootDir.di_status);
|
|
|
|
|
|
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.inode.di_fname = {0}", CurrentEncoding.GetString(qnxSb.inode.di_fname));
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.inode.di_size = {0}", qnxSb.inode.di_size);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.inode.di_first_xtnt.block = {0}", qnxSb.inode.di_first_xtnt.block);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.inode.di_first_xtnt.length = {0}", qnxSb.inode.di_first_xtnt.length);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.inode.di_xblk = {0}", qnxSb.inode.di_xblk);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.inode.di_ftime = {0}", DateHandlers.UNIXUnsignedToDateTime(qnxSb.inode.di_ftime));
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.inode.di_mtime = {0}", DateHandlers.UNIXUnsignedToDateTime(qnxSb.inode.di_mtime));
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.inode.di_atime = {0}", DateHandlers.UNIXUnsignedToDateTime(qnxSb.inode.di_atime));
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.inode.di_ctime = {0}", DateHandlers.UNIXUnsignedToDateTime(qnxSb.inode.di_ctime));
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.inode.di_num_xtnts = {0}", qnxSb.inode.di_num_xtnts);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.inode.di_mode = {0}", Convert.ToString(qnxSb.inode.di_mode, 8));
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.inode.di_uid = {0}", qnxSb.inode.di_uid);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.inode.di_gid = {0}", qnxSb.inode.di_gid);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.inode.di_nlink = {0}", qnxSb.inode.di_nlink);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.inode.di_zero = {0}", qnxSb.inode.di_zero);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.inode.di_type = {0}", qnxSb.inode.di_type);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.inode.di_status = {0}", qnxSb.inode.di_status);
|
|
|
|
|
|
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.boot.di_fname = {0}", CurrentEncoding.GetString(qnxSb.boot.di_fname));
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.boot.di_size = {0}", qnxSb.boot.di_size);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.boot.di_first_xtnt.block = {0}", qnxSb.boot.di_first_xtnt.block);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.boot.di_first_xtnt.length = {0}", qnxSb.boot.di_first_xtnt.length);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.boot.di_xblk = {0}", qnxSb.boot.di_xblk);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.boot.di_ftime = {0}", DateHandlers.UNIXUnsignedToDateTime(qnxSb.boot.di_ftime));
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.boot.di_mtime = {0}", DateHandlers.UNIXUnsignedToDateTime(qnxSb.boot.di_mtime));
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.boot.di_atime = {0}", DateHandlers.UNIXUnsignedToDateTime(qnxSb.boot.di_atime));
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.boot.di_ctime = {0}", DateHandlers.UNIXUnsignedToDateTime(qnxSb.boot.di_ctime));
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.boot.di_num_xtnts = {0}", qnxSb.boot.di_num_xtnts);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.boot.di_mode = {0}", Convert.ToString(qnxSb.boot.di_mode, 8));
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.boot.di_uid = {0}", qnxSb.boot.di_uid);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.boot.di_gid = {0}", qnxSb.boot.di_gid);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.boot.di_nlink = {0}", qnxSb.boot.di_nlink);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.boot.di_zero = {0}", qnxSb.boot.di_zero);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.boot.di_type = {0}", qnxSb.boot.di_type);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.boot.di_status = {0}", qnxSb.boot.di_status);
|
|
|
|
|
|
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.altBoot.di_fname = {0}", CurrentEncoding.GetString(qnxSb.altBoot.di_fname));
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.altBoot.di_size = {0}", qnxSb.altBoot.di_size);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.altBoot.di_first_xtnt.block = {0}", qnxSb.altBoot.di_first_xtnt.block);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.altBoot.di_first_xtnt.length = {0}", qnxSb.altBoot.di_first_xtnt.length);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.altBoot.di_xblk = {0}", qnxSb.altBoot.di_xblk);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.altBoot.di_ftime = {0}", DateHandlers.UNIXUnsignedToDateTime(qnxSb.altBoot.di_ftime));
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.altBoot.di_mtime = {0}", DateHandlers.UNIXUnsignedToDateTime(qnxSb.altBoot.di_mtime));
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.altBoot.di_atime = {0}", DateHandlers.UNIXUnsignedToDateTime(qnxSb.altBoot.di_atime));
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.altBoot.di_ctime = {0}", DateHandlers.UNIXUnsignedToDateTime(qnxSb.altBoot.di_ctime));
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.altBoot.di_num_xtnts = {0}", qnxSb.altBoot.di_num_xtnts);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.altBoot.di_mode = {0}", Convert.ToString(qnxSb.altBoot.di_mode, 8));
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.altBoot.di_uid = {0}", qnxSb.altBoot.di_uid);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.altBoot.di_gid = {0}", qnxSb.altBoot.di_gid);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.altBoot.di_nlink = {0}", qnxSb.altBoot.di_nlink);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.altBoot.di_zero = {0}", qnxSb.altBoot.di_zero);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.altBoot.di_type = {0}", qnxSb.altBoot.di_type);
|
|
|
|
|
|
AaruConsole.DebugWriteLine("QNX4 plugin", "qnxSb.altBoot.di_status = {0}", qnxSb.altBoot.di_status);
|
2016-09-02 05:23:59 +01:00
|
|
|
|
*/
|
|
|
|
|
|
|
2017-12-21 17:58:51 +00:00
|
|
|
|
information =
|
2017-12-23 03:59:48 +00:00
|
|
|
|
$"QNX4 filesystem\nCreated on {DateHandlers.UnixUnsignedToDateTime(qnxSb.rootDir.di_ftime)}\n";
|
2016-09-02 05:23:59 +01:00
|
|
|
|
|
2017-12-26 08:01:40 +00:00
|
|
|
|
XmlFsType = new FileSystemType
|
2017-07-25 03:27:47 +01:00
|
|
|
|
{
|
2020-07-20 04:34:16 +01:00
|
|
|
|
Type = "QNX4 filesystem",
|
|
|
|
|
|
Clusters = partition.Length,
|
|
|
|
|
|
ClusterSize = 512,
|
2018-06-22 08:08:38 +01:00
|
|
|
|
CreationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.rootDir.di_ftime),
|
|
|
|
|
|
CreationDateSpecified = true,
|
|
|
|
|
|
ModificationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.rootDir.di_mtime),
|
2017-07-25 03:27:47 +01:00
|
|
|
|
ModificationDateSpecified = true
|
|
|
|
|
|
};
|
2020-02-29 18:03:35 +00:00
|
|
|
|
|
2017-12-26 08:01:40 +00:00
|
|
|
|
XmlFsType.Bootable |= qnxSb.boot.di_size != 0 || qnxSb.altBoot.di_size != 0;
|
2016-09-02 05:23:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-07-20 21:11:32 +01:00
|
|
|
|
struct Extent
|
2017-12-24 02:37:41 +00:00
|
|
|
|
{
|
|
|
|
|
|
public uint block;
|
|
|
|
|
|
public uint length;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
2020-07-20 21:11:32 +01:00
|
|
|
|
struct Inode
|
2017-12-24 02:37:41 +00:00
|
|
|
|
{
|
2018-06-22 08:08:38 +01:00
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly byte[] di_fname;
|
2020-07-20 21:11:32 +01:00
|
|
|
|
public readonly uint di_size;
|
|
|
|
|
|
public readonly Extent di_first_xtnt;
|
|
|
|
|
|
public readonly uint di_xblk;
|
|
|
|
|
|
public readonly uint di_ftime;
|
|
|
|
|
|
public readonly uint di_mtime;
|
|
|
|
|
|
public readonly uint di_atime;
|
|
|
|
|
|
public readonly uint di_ctime;
|
|
|
|
|
|
public readonly ushort di_num_xtnts;
|
|
|
|
|
|
public readonly ushort di_mode;
|
|
|
|
|
|
public readonly ushort di_uid;
|
|
|
|
|
|
public readonly ushort di_gid;
|
|
|
|
|
|
public readonly ushort di_nlink;
|
|
|
|
|
|
public readonly uint di_zero;
|
|
|
|
|
|
public readonly byte di_type;
|
|
|
|
|
|
public readonly byte di_status;
|
2017-12-24 02:37:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
2020-07-20 21:11:32 +01:00
|
|
|
|
struct LinkInfo
|
2017-12-24 02:37:41 +00:00
|
|
|
|
{
|
2018-06-22 08:08:38 +01:00
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 48)]
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly byte[] dl_fname;
|
|
|
|
|
|
public readonly uint dl_inode_blk;
|
|
|
|
|
|
public readonly byte dl_inode_ndx;
|
2018-06-22 08:08:38 +01:00
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly byte[] dl_spare;
|
|
|
|
|
|
public readonly byte dl_status;
|
2017-12-24 02:37:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
2020-07-20 21:11:32 +01:00
|
|
|
|
struct ExtentBlock
|
2017-12-24 02:37:41 +00:00
|
|
|
|
{
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly uint next_xblk;
|
|
|
|
|
|
public readonly uint prev_xblk;
|
|
|
|
|
|
public readonly byte num_xtnts;
|
2018-06-22 08:08:38 +01:00
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly byte[] spare;
|
|
|
|
|
|
public readonly uint num_blocks;
|
2018-06-22 08:08:38 +01:00
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 60)]
|
2020-07-20 21:11:32 +01:00
|
|
|
|
public readonly Extent[] xtnts;
|
2018-06-22 08:08:38 +01:00
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
2019-04-23 01:38:33 +01:00
|
|
|
|
public readonly byte[] signature;
|
2020-07-20 21:11:32 +01:00
|
|
|
|
public readonly Extent first_xtnt;
|
2017-12-24 02:37:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
2020-07-20 21:11:32 +01:00
|
|
|
|
struct Superblock
|
2017-12-24 02:37:41 +00:00
|
|
|
|
{
|
2020-07-20 21:11:32 +01:00
|
|
|
|
public readonly Inode rootDir;
|
|
|
|
|
|
public readonly Inode inode;
|
|
|
|
|
|
public readonly Inode boot;
|
|
|
|
|
|
public readonly Inode altBoot;
|
2017-12-24 02:37:41 +00:00
|
|
|
|
}
|
2016-09-02 05:23:59 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|