mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
* DiscImageChef.Filesystems/SFS.cs:
Code refactoring. * DiscImageChef.Filesystems/PFS.cs: Add volume name to XmlFs.
This commit is contained in:
@@ -33,7 +33,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using DiscImageChef.Console;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace DiscImageChef.Filesystems
|
namespace DiscImageChef.Filesystems
|
||||||
@@ -223,7 +222,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
|
|
||||||
sbInformation.AppendFormat("Volume name: {0}", StringHandlers.PascalToString(rootBlock.diskname)).AppendLine();
|
sbInformation.AppendFormat("Volume name: {0}", StringHandlers.PascalToString(rootBlock.diskname)).AppendLine();
|
||||||
sbInformation.AppendFormat("Volume has {0} free sectors of {1}", rootBlock.blocksfree, rootBlock.diskSize).AppendLine();
|
sbInformation.AppendFormat("Volume has {0} free sectors of {1}", rootBlock.blocksfree, rootBlock.diskSize).AppendLine();
|
||||||
sbInformation.AppendFormat("Volme created on {0}", DateHandlers.AmigaToDateTime(rootBlock.creationday, rootBlock.creationminute, rootBlock.creationtick)).AppendLine();
|
sbInformation.AppendFormat("Volume created on {0}", DateHandlers.AmigaToDateTime(rootBlock.creationday, rootBlock.creationminute, rootBlock.creationtick)).AppendLine();
|
||||||
if(rootBlock.extension > 0)
|
if(rootBlock.extension > 0)
|
||||||
sbInformation.AppendFormat("Root block extension resides at block {0}", rootBlock.extension).AppendLine();
|
sbInformation.AppendFormat("Root block extension resides at block {0}", rootBlock.extension).AppendLine();
|
||||||
|
|
||||||
@@ -235,6 +234,7 @@ namespace DiscImageChef.Filesystems
|
|||||||
xmlFSType.FreeClustersSpecified = true;
|
xmlFSType.FreeClustersSpecified = true;
|
||||||
xmlFSType.Clusters = rootBlock.diskSize / imagePlugin.GetSectorSize();
|
xmlFSType.Clusters = rootBlock.diskSize / imagePlugin.GetSectorSize();
|
||||||
xmlFSType.ClusterSize = (int)imagePlugin.GetSectorSize();
|
xmlFSType.ClusterSize = (int)imagePlugin.GetSectorSize();
|
||||||
|
xmlFSType.VolumeName = StringHandlers.PascalToString(rootBlock.diskname);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Errno Mount()
|
public override Errno Mount()
|
||||||
|
|||||||
@@ -31,26 +31,25 @@
|
|||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Text;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using DiscImageChef.Console;
|
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace DiscImageChef.Filesystems
|
namespace DiscImageChef.Filesystems
|
||||||
{
|
{
|
||||||
class SFS : Filesystem
|
class SFS : Filesystem
|
||||||
{
|
{
|
||||||
public SFS()
|
public SFS()
|
||||||
{
|
{
|
||||||
Name = "SmartFileSystem";
|
Name = "SmartFileSystem";
|
||||||
PluginUUID = new Guid("26550C19-3671-4A2D-BC2F-F20CEB7F48DC");
|
PluginUUID = new Guid("26550C19-3671-4A2D-BC2F-F20CEB7F48DC");
|
||||||
}
|
}
|
||||||
|
|
||||||
public SFS(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
|
public SFS(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
|
||||||
{
|
{
|
||||||
Name = "SmartFileSystem";
|
Name = "SmartFileSystem";
|
||||||
PluginUUID = new Guid("26550C19-3671-4A2D-BC2F-F20CEB7F48DC");
|
PluginUUID = new Guid("26550C19-3671-4A2D-BC2F-F20CEB7F48DC");
|
||||||
}
|
}
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
enum SFSFlags : byte
|
enum SFSFlags : byte
|
||||||
@@ -59,9 +58,9 @@ namespace DiscImageChef.Filesystems
|
|||||||
CaseSensitive = 128
|
CaseSensitive = 128
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
struct RootBlock
|
struct RootBlock
|
||||||
{
|
{
|
||||||
public uint blockId;
|
public uint blockId;
|
||||||
public uint blockChecksum;
|
public uint blockChecksum;
|
||||||
public uint blockSelfPointer;
|
public uint blockSelfPointer;
|
||||||
@@ -88,36 +87,36 @@ namespace DiscImageChef.Filesystems
|
|||||||
public uint objectnoderoot;
|
public uint objectnoderoot;
|
||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||||
public uint[] reserved4;
|
public uint[] reserved4;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Identifier for SFS v1
|
/// Identifier for SFS v1
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const uint SFS_MAGIC = 0x53465300;
|
const uint SFS_MAGIC = 0x53465300;
|
||||||
|
|
||||||
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
|
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
|
||||||
{
|
{
|
||||||
if(partitionStart >= partitionEnd)
|
if(partitionStart >= partitionEnd)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||||
|
|
||||||
byte[] sector = imagePlugin.ReadSector(partitionStart);
|
byte[] sector = imagePlugin.ReadSector(partitionStart);
|
||||||
|
|
||||||
uint magic = BigEndianBitConverter.ToUInt32(sector, 0x00);
|
uint magic = BigEndianBitConverter.ToUInt32(sector, 0x00);
|
||||||
|
|
||||||
return magic == SFS_MAGIC;
|
return magic == SFS_MAGIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information)
|
public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information)
|
||||||
{
|
{
|
||||||
byte[] RootBlockSector = imagePlugin.ReadSector(partitionStart);
|
byte[] RootBlockSector = imagePlugin.ReadSector(partitionStart);
|
||||||
RootBlock rootBlock = new RootBlock();
|
RootBlock rootBlock = new RootBlock();
|
||||||
rootBlock = BigEndianMarshal.ByteArrayToStructureBigEndian<RootBlock>(RootBlockSector);
|
rootBlock = BigEndianMarshal.ByteArrayToStructureBigEndian<RootBlock>(RootBlockSector);
|
||||||
|
|
||||||
StringBuilder sbInformation = new StringBuilder();
|
StringBuilder sbInformation = new StringBuilder();
|
||||||
|
|
||||||
sbInformation.AppendLine("SmartFileSystem");
|
sbInformation.AppendLine("SmartFileSystem");
|
||||||
|
|
||||||
sbInformation.AppendFormat("Volume version {0}", rootBlock.version).AppendLine();
|
sbInformation.AppendFormat("Volume version {0}", rootBlock.version).AppendLine();
|
||||||
sbInformation.AppendFormat("Volume starts on device byte {0} and ends on byte {1}", rootBlock.firstbyte, rootBlock.lastbyte).AppendLine();
|
sbInformation.AppendFormat("Volume starts on device byte {0} and ends on byte {1}", rootBlock.firstbyte, rootBlock.lastbyte).AppendLine();
|
||||||
@@ -137,69 +136,69 @@ namespace DiscImageChef.Filesystems
|
|||||||
xmlFSType = new Schemas.FileSystemType();
|
xmlFSType = new Schemas.FileSystemType();
|
||||||
xmlFSType.Type = "SmartFileSystem";
|
xmlFSType.Type = "SmartFileSystem";
|
||||||
xmlFSType.CreationDate = DateHandlers.UNIXUnsignedToDateTime(rootBlock.datecreated).AddYears(8);
|
xmlFSType.CreationDate = DateHandlers.UNIXUnsignedToDateTime(rootBlock.datecreated).AddYears(8);
|
||||||
xmlFSType.CreationDateSpecified = true;
|
xmlFSType.CreationDateSpecified = true;
|
||||||
xmlFSType.Clusters = rootBlock.totalblocks;
|
xmlFSType.Clusters = rootBlock.totalblocks;
|
||||||
xmlFSType.ClusterSize = (int)rootBlock.blocksize;
|
xmlFSType.ClusterSize = (int)rootBlock.blocksize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Errno Mount()
|
public override Errno Mount()
|
||||||
{
|
{
|
||||||
return Errno.NotImplemented;
|
return Errno.NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Errno Mount(bool debug)
|
public override Errno Mount(bool debug)
|
||||||
{
|
{
|
||||||
return Errno.NotImplemented;
|
return Errno.NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Errno Unmount()
|
public override Errno Unmount()
|
||||||
{
|
{
|
||||||
return Errno.NotImplemented;
|
return Errno.NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Errno MapBlock(string path, long fileBlock, ref long deviceBlock)
|
public override Errno MapBlock(string path, long fileBlock, ref long deviceBlock)
|
||||||
{
|
{
|
||||||
return Errno.NotImplemented;
|
return Errno.NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Errno GetAttributes(string path, ref FileAttributes attributes)
|
public override Errno GetAttributes(string path, ref FileAttributes attributes)
|
||||||
{
|
{
|
||||||
return Errno.NotImplemented;
|
return Errno.NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Errno ListXAttr(string path, ref List<string> xattrs)
|
public override Errno ListXAttr(string path, ref List<string> xattrs)
|
||||||
{
|
{
|
||||||
return Errno.NotImplemented;
|
return Errno.NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Errno GetXattr(string path, string xattr, ref byte[] buf)
|
public override Errno GetXattr(string path, string xattr, ref byte[] buf)
|
||||||
{
|
{
|
||||||
return Errno.NotImplemented;
|
return Errno.NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Errno Read(string path, long offset, long size, ref byte[] buf)
|
public override Errno Read(string path, long offset, long size, ref byte[] buf)
|
||||||
{
|
{
|
||||||
return Errno.NotImplemented;
|
return Errno.NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Errno ReadDir(string path, ref List<string> contents)
|
public override Errno ReadDir(string path, ref List<string> contents)
|
||||||
{
|
{
|
||||||
return Errno.NotImplemented;
|
return Errno.NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Errno StatFs(ref FileSystemInfo stat)
|
public override Errno StatFs(ref FileSystemInfo stat)
|
||||||
{
|
{
|
||||||
return Errno.NotImplemented;
|
return Errno.NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Errno Stat(string path, ref FileEntryInfo stat)
|
public override Errno Stat(string path, ref FileEntryInfo stat)
|
||||||
{
|
{
|
||||||
return Errno.NotImplemented;
|
return Errno.NotImplemented;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Errno ReadLink(string path, ref string dest)
|
public override Errno ReadLink(string path, ref string dest)
|
||||||
{
|
{
|
||||||
return Errno.NotImplemented;
|
return Errno.NotImplemented;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user