Added support for SFSv2.

This commit is contained in:
2017-08-09 04:52:36 +01:00
parent 1638792085
commit 15f251ba9f

View File

@@ -95,10 +95,10 @@ namespace DiscImageChef.Filesystems
public uint[] reserved4; public uint[] reserved4;
} }
/// <summary> /// <summary>Identifier for SFS v1</summary>
/// Identifier for SFS v1
/// </summary>
const uint SFS_MAGIC = 0x53465300; const uint SFS_MAGIC = 0x53465300;
/// <summary>Identifier for SFS v2</summary>
const uint SFS2_MAGIC = 0x53465302;
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition) public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
{ {
@@ -111,7 +111,7 @@ namespace DiscImageChef.Filesystems
uint magic = BigEndianBitConverter.ToUInt32(sector, 0x00); uint magic = BigEndianBitConverter.ToUInt32(sector, 0x00);
return magic == SFS_MAGIC; return magic == SFS_MAGIC || magic == SFS2_MAGIC;
} }
public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information) public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information)
@@ -122,7 +122,10 @@ namespace DiscImageChef.Filesystems
StringBuilder sbInformation = new StringBuilder(); StringBuilder sbInformation = new StringBuilder();
sbInformation.AppendLine("SmartFileSystem"); if(rootBlock.blockId == SFS2_MAGIC)
sbInformation.AppendLine("SmartFileSystem 2");
else
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();
@@ -139,12 +142,17 @@ namespace DiscImageChef.Filesystems
sbInformation.AppendLine("Volume moves deleted files to a recycled folder"); sbInformation.AppendLine("Volume moves deleted files to a recycled folder");
information = sbInformation.ToString(); information = sbInformation.ToString();
xmlFSType = new Schemas.FileSystemType(); xmlFSType = new Schemas.FileSystemType
xmlFSType.Type = "SmartFileSystem"; {
xmlFSType.CreationDate = DateHandlers.UNIXUnsignedToDateTime(rootBlock.datecreated).AddYears(8); CreationDate = DateHandlers.UNIXUnsignedToDateTime(rootBlock.datecreated).AddYears(8),
xmlFSType.CreationDateSpecified = true; CreationDateSpecified = true,
xmlFSType.Clusters = rootBlock.totalblocks; Clusters = rootBlock.totalblocks,
xmlFSType.ClusterSize = (int)rootBlock.blocksize; ClusterSize = (int)rootBlock.blocksize
};
if(rootBlock.blockId == SFS2_MAGIC)
xmlFSType.Type = "SmartFileSystem 2";
else
xmlFSType.Type = "SmartFileSystem";
} }
public override Errno Mount() public override Errno Mount()