Skeleton for reading Opera filesystem.

This commit is contained in:
2019-08-01 16:21:10 +01:00
parent 1890d6ac28
commit ba754e01a5
9 changed files with 177 additions and 77 deletions

View File

@@ -79,6 +79,13 @@
<Compile Include="ISO9660\PathTable.cs" />
<Compile Include="ISO9660\Super.cs" />
<Compile Include="ISO9660\Xattr.cs" />
<Compile Include="Opera\Consts.cs" />
<Compile Include="Opera\Dir.cs" />
<Compile Include="Opera\File.cs" />
<Compile Include="Opera\Info.cs" />
<Compile Include="Opera\Opera.cs" />
<Compile Include="Opera\Structs.cs" />
<Compile Include="Opera\Super.cs" />
<Compile Include="PCFX.cs" />
<Compile Include="AmigaDOS.cs" />
<Compile Include="AppleHFS.cs" />
@@ -91,7 +98,6 @@
<Compile Include="MinixFS.cs" />
<Compile Include="NTFS.cs" />
<Compile Include="ODS.cs" />
<Compile Include="Opera.cs" />
<Compile Include="PCEngine.cs" />
<Compile Include="ProDOS.cs" />
<Compile Include="ReFS.cs" />

View File

@@ -0,0 +1,4 @@
namespace DiscImageChef.Filesystems
{
public partial class OperaFS { }
}

View File

@@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Structs;
namespace DiscImageChef.Filesystems
{
public partial class OperaFS
{
public Errno ReadDir(string path, out List<string> contents) => throw new NotImplementedException();
}
}

View File

@@ -0,0 +1,16 @@
using System;
using DiscImageChef.CommonTypes.Structs;
namespace DiscImageChef.Filesystems
{
public partial class OperaFS
{
public Errno MapBlock(string path, long fileBlock, out long deviceBlock) => throw new NotImplementedException();
public Errno GetAttributes(string path, out FileAttributes attributes) => throw new NotImplementedException();
public Errno Read(string path, long offset, long size, ref byte[] buf) => throw new NotImplementedException();
public Errno Stat(string path, out FileEntryInfo stat) => throw new NotImplementedException();
}
}

View File

@@ -1,53 +1,14 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Opera.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Opera filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the Opera filesystem 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-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.CommonTypes.Interfaces;
using DiscImageChef.Helpers;
using Schemas;
using Marshal = DiscImageChef.Helpers.Marshal;
namespace DiscImageChef.Filesystems
{
public class OperaFS : IFilesystem
public partial class OperaFS
{
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Opera Filesystem Plugin";
public Guid Id => new Guid("0ec84ec7-eae6-4196-83fe-943b3fe46dbd");
public string Author => "Natalia Portillo";
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
if(2 + partition.Start >= partition.End) return false;
@@ -127,39 +88,5 @@ namespace DiscImageChef.Filesystems
Clusters = (ulong)sb.block_count
};
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct OperaSuperBlock
{
/// <summary>0x000, Record type, must be 1</summary>
public readonly byte record_type;
/// <summary>0x001, 5 bytes, "ZZZZZ"</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
public byte[] sync_bytes;
/// <summary>0x006, Record version, must be 1</summary>
public readonly byte record_version;
/// <summary>0x007, Volume flags</summary>
public readonly byte volume_flags;
/// <summary>0x008, 32 bytes, volume comment</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public readonly byte[] volume_comment;
/// <summary>0x028, 32 bytes, volume label</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public readonly byte[] volume_label;
/// <summary>0x048, Volume ID</summary>
public readonly int volume_id;
/// <summary>0x04C, Block size in bytes</summary>
public readonly int block_size;
/// <summary>0x050, Blocks in volume</summary>
public readonly int block_count;
/// <summary>0x054, Root directory ID</summary>
public readonly int root_dirid;
/// <summary>0x058, Root directory blocks</summary>
public readonly int rootdir_blocks;
/// <summary>0x05C, Root directory block size</summary>
public readonly int rootdir_bsize;
/// <summary>0x060, Last root directory copy</summary>
public readonly int last_root_copy;
}
}
}

View File

@@ -0,0 +1,72 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Opera.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Opera filesystem plugin.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the Opera filesystem 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-2019 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using DiscImageChef.CommonTypes.Interfaces;
using DiscImageChef.CommonTypes.Structs;
using Schemas;
namespace DiscImageChef.Filesystems
{
public partial class OperaFS : IReadOnlyFilesystem
{
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Opera Filesystem Plugin";
public Guid Id => new Guid("0ec84ec7-eae6-4196-83fe-943b3fe46dbd");
public string Author => "Natalia Portillo";
public Errno ListXAttr(string path, out List<string> xattrs)
{
xattrs = null;
return Errno.NotSupported;
}
public Errno GetXattr(string path, string xattr, ref byte[] buf) => Errno.NotSupported;
public Errno ReadLink(string path, out string dest)
{
dest = null;
return Errno.NotSupported;
}
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
new (string name, Type type, string description)[] { };
public Dictionary<string, string> Namespaces => null;
static Dictionary<string, string> GetDefaultOptions() =>
new Dictionary<string, string> {{"debug", false.ToString()}};
}
}

View File

@@ -0,0 +1,41 @@
using System.Runtime.InteropServices;
namespace DiscImageChef.Filesystems
{
public partial class OperaFS
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct OperaSuperBlock
{
/// <summary>0x000, Record type, must be 1</summary>
public readonly byte record_type;
/// <summary>0x001, 5 bytes, "ZZZZZ"</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
public byte[] sync_bytes;
/// <summary>0x006, Record version, must be 1</summary>
public readonly byte record_version;
/// <summary>0x007, Volume flags</summary>
public readonly byte volume_flags;
/// <summary>0x008, 32 bytes, volume comment</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public readonly byte[] volume_comment;
/// <summary>0x028, 32 bytes, volume label</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public readonly byte[] volume_label;
/// <summary>0x048, Volume ID</summary>
public readonly int volume_id;
/// <summary>0x04C, Block size in bytes</summary>
public readonly int block_size;
/// <summary>0x050, Blocks in volume</summary>
public readonly int block_count;
/// <summary>0x054, Root directory ID</summary>
public readonly int root_dirid;
/// <summary>0x058, Root directory blocks</summary>
public readonly int rootdir_blocks;
/// <summary>0x05C, Root directory block size</summary>
public readonly int rootdir_bsize;
/// <summary>0x060, Last root directory copy</summary>
public readonly int last_root_copy;
}
}
}

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.CommonTypes.Interfaces;
using DiscImageChef.CommonTypes.Structs;
namespace DiscImageChef.Filesystems
{
public partial class OperaFS
{
public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding,
Dictionary<string, string> options, string @namespace) =>
throw new NotImplementedException();
public Errno Unmount() => throw new NotImplementedException();
public Errno StatFs(out FileSystemInfo stat) => throw new NotImplementedException();
}
}