mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Refactor, pass whole partition structure to filesystems.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// /***************************************************************************
|
||||
// /***************************************************************************
|
||||
// The Disc Image Chef
|
||||
// ----------------------------------------------------------------------------
|
||||
//
|
||||
@@ -34,6 +34,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using DiscImageChef.CommonTypes;
|
||||
|
||||
namespace DiscImageChef.Filesystems
|
||||
{
|
||||
@@ -46,7 +47,7 @@ namespace DiscImageChef.Filesystems
|
||||
CurrentEncoding = Encoding.UTF8;
|
||||
}
|
||||
|
||||
public Squash(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, Encoding encoding)
|
||||
public Squash(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
|
||||
{
|
||||
Name = "Squash filesystem";
|
||||
PluginUUID = new Guid("F8F6E46F-7A2A-48E3-9C0A-46AF4DC29E09");
|
||||
@@ -93,21 +94,21 @@ namespace DiscImageChef.Filesystems
|
||||
const uint Squash_MAGIC = 0x73717368;
|
||||
const uint Squash_CIGAM = 0x68737173;
|
||||
|
||||
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
|
||||
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
|
||||
{
|
||||
if(partitionStart >= partitionEnd)
|
||||
if(partition.PartitionStartSector >= partition.PartitionEndSector)
|
||||
return false;
|
||||
|
||||
byte[] sector = imagePlugin.ReadSector(partitionStart);
|
||||
byte[] sector = imagePlugin.ReadSector(partition.PartitionStartSector);
|
||||
|
||||
uint magic = BitConverter.ToUInt32(sector, 0x00);
|
||||
|
||||
return magic == Squash_MAGIC || magic == Squash_CIGAM;
|
||||
}
|
||||
|
||||
public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information)
|
||||
public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, Partition partition, out string information)
|
||||
{
|
||||
byte[] sector = imagePlugin.ReadSector(partitionStart);
|
||||
byte[] sector = imagePlugin.ReadSector(partition.PartitionStartSector);
|
||||
uint magic = BitConverter.ToUInt32(sector, 0x00);
|
||||
|
||||
SquashSuperBlock sqSb = new SquashSuperBlock();
|
||||
@@ -166,7 +167,7 @@ namespace DiscImageChef.Filesystems
|
||||
xmlFSType.Type = "Squash file system";
|
||||
xmlFSType.CreationDate = DateHandlers.UNIXUnsignedToDateTime(sqSb.mkfs_time);
|
||||
xmlFSType.CreationDateSpecified = true;
|
||||
xmlFSType.Clusters = (long)(((partitionEnd - partitionStart + 1) * imagePlugin.ImageInfo.sectorSize) / sqSb.block_size);
|
||||
xmlFSType.Clusters = (long)(((partition.PartitionEndSector - partition.PartitionStartSector + 1) * imagePlugin.ImageInfo.sectorSize) / sqSb.block_size);
|
||||
xmlFSType.ClusterSize = (int)sqSb.block_size;
|
||||
xmlFSType.Files = sqSb.inodes;
|
||||
xmlFSType.FilesSpecified = true;
|
||||
|
||||
Reference in New Issue
Block a user