diff --git a/DiscImageChef.Filesystems/Acorn.cs b/DiscImageChef.Filesystems/Acorn.cs
new file mode 100644
index 00000000..7aece2ba
--- /dev/null
+++ b/DiscImageChef.Filesystems/Acorn.cs
@@ -0,0 +1,219 @@
+// /***************************************************************************
+// The Disc Image Chef
+// ----------------------------------------------------------------------------
+//
+// Filename : Acorn.cs
+// Version : 1.0
+// Author(s) : Natalia Portillo
+//
+// Component : Component
+//
+// Revision : $Revision$
+// Last change by : $Author$
+// Date : $Date$
+//
+// --[ Description ] ----------------------------------------------------------
+//
+// Description
+//
+// --[ License ] --------------------------------------------------------------
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// ----------------------------------------------------------------------------
+// Copyright (C) 2011-2015 Claunia.com
+// ****************************************************************************/
+// //$Id$
+using System;
+using System.Runtime.InteropServices;
+using System.Text;
+using DiscImageChef.Console;
+
+namespace DiscImageChef.Plugins
+{
+ class AcornADFS : Plugin
+ {
+ const ulong ADFS_SB_POS = 0xC00;
+
+ public AcornADFS()
+ {
+ Name = "Acorn Advanced Disc Filing System";
+ PluginUUID = new Guid("BAFC1E50-9C64-4CD3-8400-80628CC27AFA");
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ struct DiscRecord
+ {
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x1C0)]
+ public byte[] spare;
+ public byte log2secsize;
+ public byte spt;
+ public byte heads;
+ public byte density;
+ public byte idlen;
+ public byte log2bpmb;
+ public byte skew;
+ public byte bootoption;
+ public byte lowsector;
+ public byte nzones;
+ public short zone_spare;
+ public int root;
+ public uint disc_size;
+ public short disc_id;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
+ public byte[] disc_name;
+ public int disc_type;
+ public uint disc_size_high;
+ public byte flags;
+ public byte nzones_high;
+ public int format_version;
+ public int root_size;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
+ public byte[] reserved;
+ }
+
+ public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
+ {
+ if (partitionStart >= imagePlugin.GetSectors())
+ return false;
+
+ ulong sbSector;
+
+ if (imagePlugin.GetSectorSize() > ADFS_SB_POS)
+ sbSector = 0;
+ else
+ sbSector = ADFS_SB_POS / imagePlugin.GetSectorSize();
+
+ byte[] sector = imagePlugin.ReadSector(sbSector + partitionStart);
+
+ GCHandle handle = GCHandle.Alloc(sector, GCHandleType.Pinned);
+ DiscRecord drSb = (DiscRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(DiscRecord));
+ handle.Free();
+
+ if (drSb.log2secsize < 8 || drSb.log2secsize > 10)
+ return false;
+
+ if (drSb.idlen < (drSb.log2secsize + 3) || drSb.idlen > 19)
+ return false;
+
+ if ((drSb.disc_size_high >> drSb.log2secsize) != 0)
+ return false;
+
+ if (!ArrayHelpers.ArrayIsNullOrEmpty(drSb.reserved))
+ return false;
+
+ ulong bytes = drSb.disc_size_high;
+ bytes *= 0x100000000;
+ bytes += drSb.disc_size;
+
+ if (bytes > (imagePlugin.GetSectors() * (ulong)imagePlugin.GetSectorSize()))
+ return false;
+
+ return true;
+ }
+ public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information)
+ {
+ StringBuilder sbInformation = new StringBuilder();
+ xmlFSType = new Schemas.FileSystemType();
+ information = "";
+
+ ulong sbSector;
+
+ if (imagePlugin.GetSectorSize() > ADFS_SB_POS)
+ sbSector = 0;
+ else
+ sbSector = ADFS_SB_POS / imagePlugin.GetSectorSize();
+
+ byte[] sector = imagePlugin.ReadSector(sbSector + partitionStart);
+
+ GCHandle handle = GCHandle.Alloc(sector, GCHandleType.Pinned);
+ DiscRecord drSb = (DiscRecord)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(DiscRecord));
+ handle.Free();
+
+ DicConsole.DebugWriteLine("ADFS Plugin", "drSb.log2secsize = {0}", drSb.log2secsize);
+ DicConsole.DebugWriteLine("ADFS Plugin", "drSb.spt = {0}", drSb.spt);
+ DicConsole.DebugWriteLine("ADFS Plugin", "drSb.heads = {0}", drSb.heads);
+ DicConsole.DebugWriteLine("ADFS Plugin", "drSb.density = {0}", drSb.density);
+ DicConsole.DebugWriteLine("ADFS Plugin", "drSb.idlen = {0}", drSb.idlen);
+ DicConsole.DebugWriteLine("ADFS Plugin", "drSb.log2bpmb = {0}", drSb.log2bpmb);
+ DicConsole.DebugWriteLine("ADFS Plugin", "drSb.skew = {0}", drSb.skew);
+ DicConsole.DebugWriteLine("ADFS Plugin", "drSb.bootoption = {0}", drSb.bootoption);
+ DicConsole.DebugWriteLine("ADFS Plugin", "drSb.lowsector = {0}", drSb.lowsector);
+ DicConsole.DebugWriteLine("ADFS Plugin", "drSb.nzones = {0}", drSb.nzones);
+ DicConsole.DebugWriteLine("ADFS Plugin", "drSb.zone_spare = {0}", drSb.zone_spare);
+ DicConsole.DebugWriteLine("ADFS Plugin", "drSb.root = {0}", drSb.root);
+ DicConsole.DebugWriteLine("ADFS Plugin", "drSb.disc_size = {0}", drSb.disc_size);
+ DicConsole.DebugWriteLine("ADFS Plugin", "drSb.disc_id = {0}", drSb.disc_id);
+ DicConsole.DebugWriteLine("ADFS Plugin", "drSb.disc_name = {0}", StringHandlers.CToString(drSb.disc_name));
+ DicConsole.DebugWriteLine("ADFS Plugin", "drSb.disc_type = {0}", drSb.disc_type);
+ DicConsole.DebugWriteLine("ADFS Plugin", "drSb.disc_size_high = {0}", drSb.disc_size_high);
+ DicConsole.DebugWriteLine("ADFS Plugin", "drSb.flags = {0}", drSb.flags);
+ DicConsole.DebugWriteLine("ADFS Plugin", "drSb.nzones_high = {0}", drSb.nzones_high);
+ DicConsole.DebugWriteLine("ADFS Plugin", "drSb.format_version = {0}", drSb.format_version);
+ DicConsole.DebugWriteLine("ADFS Plugin", "drSb.root_size = {0}", drSb.root_size);
+
+ if (drSb.log2secsize < 8 || drSb.log2secsize > 10)
+ return;
+
+ if (drSb.idlen < (drSb.log2secsize + 3) || drSb.idlen > 19)
+ return;
+
+ if ((drSb.disc_size_high >> drSb.log2secsize) != 0)
+ return;
+
+ if (!ArrayHelpers.ArrayIsNullOrEmpty(drSb.reserved))
+ return;
+
+ ulong bytes = drSb.disc_size_high;
+ bytes *= 0x100000000;
+ bytes += drSb.disc_size;
+
+ ulong zones = drSb.nzones_high;
+ zones *= 0x100000000;
+ zones += drSb.nzones;
+
+ if (bytes > (imagePlugin.GetSectors() * (ulong)imagePlugin.GetSectorSize()))
+ return;
+
+ string discname = StringHandlers.CToString(drSb.disc_name);
+
+ sbInformation.AppendLine("Acorn Advanced Disc Filing System");
+ sbInformation.AppendLine();
+ sbInformation.AppendFormat("Version {0}", drSb.format_version).AppendLine();
+ sbInformation.AppendFormat("{0} bytes per sector", 1 << drSb.log2secsize).AppendLine();
+ sbInformation.AppendFormat("{0} sectors per track", drSb.spt).AppendLine();
+ sbInformation.AppendFormat("{0} heads", drSb.heads).AppendLine();
+ sbInformation.AppendFormat("Density code: {0}", drSb.density).AppendLine();
+ sbInformation.AppendFormat("Skew: {0}", drSb.skew).AppendLine();
+ sbInformation.AppendFormat("Boot option: {0}", drSb.bootoption).AppendLine();
+ sbInformation.AppendFormat("Root starts at byte {0}", drSb.root).AppendLine();
+ sbInformation.AppendFormat("Root is {0} bytes long", drSb.root_size).AppendLine();
+ sbInformation.AppendFormat("Volume has {0} bytes in {1} zones", bytes, zones).AppendLine();
+ sbInformation.AppendFormat("Volume flags: 0x{0:X4}", drSb.flags).AppendLine();
+ sbInformation.AppendFormat("Volume ID: {0}", drSb.disc_id).AppendLine();
+ sbInformation.AppendFormat("Volume name: {0}", discname).AppendLine();
+
+ information = sbInformation.ToString();
+
+ xmlFSType = new Schemas.FileSystemType();
+ xmlFSType.Bootable |= drSb.bootoption != 0; // Or not?
+ xmlFSType.Clusters = (long)(bytes / (ulong)(1 << drSb.log2secsize));
+ xmlFSType.ClusterSize = (1 << drSb.log2secsize);
+ xmlFSType.Type = "Acorn Advanced Disc Filing System";
+ xmlFSType.VolumeName = discname;
+ xmlFSType.VolumeSerial = string.Format("{0}", drSb.disc_id);
+ }
+ }
+}
+
diff --git a/DiscImageChef.Filesystems/ChangeLog b/DiscImageChef.Filesystems/ChangeLog
index e4dc6879..398f76eb 100644
--- a/DiscImageChef.Filesystems/ChangeLog
+++ b/DiscImageChef.Filesystems/ChangeLog
@@ -1,3 +1,12 @@
+2016-02-05 Natalia Portillo
+
+ * Acorn.cs:
+ * DiscImageChef.Filesystems.csproj:
+ Added support for Acorn ADFS.
+
+ * FFS.cs:
+ Correct FFS information.
+
2016-02-05 Natalia Portillo
* FAT.cs:
diff --git a/DiscImageChef.Filesystems/DiscImageChef.Filesystems.csproj b/DiscImageChef.Filesystems/DiscImageChef.Filesystems.csproj
index cf0c7f80..af340e09 100644
--- a/DiscImageChef.Filesystems/DiscImageChef.Filesystems.csproj
+++ b/DiscImageChef.Filesystems/DiscImageChef.Filesystems.csproj
@@ -57,6 +57,7 @@
+
diff --git a/DiscImageChef.Filesystems/FFS.cs b/DiscImageChef.Filesystems/FFS.cs
index 6ae6a2fc..e3a9ef8b 100644
--- a/DiscImageChef.Filesystems/FFS.cs
+++ b/DiscImageChef.Filesystems/FFS.cs
@@ -602,10 +602,10 @@ namespace DiscImageChef.Plugins
sbInformation.AppendFormat("First data block LBA: {0}", ufs_sb.fs_dblkno).AppendLine();
sbInformation.AppendFormat("Cylinder group offset in cylinder: {0}", ufs_sb.fs_cgoffset).AppendLine();
sbInformation.AppendFormat("Volume last written on {0}", DateHandlers.UNIXUnsignedToDateTime(ufs_sb.fs_time_t)).AppendLine();
- sbInformation.AppendFormat("{0} blocks in volume ({1} bytes)", ufs_sb.fs_size, ufs_sb.fs_size * ufs_sb.fs_bsize).AppendLine();
+ sbInformation.AppendFormat("{0} blocks in volume ({1} bytes)", ufs_sb.fs_size, (ulong)ufs_sb.fs_size * (ulong)1024).AppendLine();
xmlFSType.Clusters = ufs_sb.fs_size;
xmlFSType.ClusterSize = (int)ufs_sb.fs_bsize;
- sbInformation.AppendFormat("{0} data blocks in volume ({1} bytes)", ufs_sb.fs_dsize, ufs_sb.fs_dsize * ufs_sb.fs_bsize).AppendLine();
+ sbInformation.AppendFormat("{0} data blocks in volume ({1} bytes)", ufs_sb.fs_dsize, (ulong)ufs_sb.fs_dsize * (ulong)1024).AppendLine();
sbInformation.AppendFormat("{0} cylinder groups in volume", ufs_sb.fs_ncg).AppendLine();
sbInformation.AppendFormat("{0} bytes in a basic block", ufs_sb.fs_bsize).AppendLine();
sbInformation.AppendFormat("{0} bytes in a frag block", ufs_sb.fs_fsize).AppendLine();
diff --git a/DiscImageChef.Partitions/ChangeLog b/DiscImageChef.Partitions/ChangeLog
index d17abe6e..13553827 100644
--- a/DiscImageChef.Partitions/ChangeLog
+++ b/DiscImageChef.Partitions/ChangeLog
@@ -1,3 +1,9 @@
+2016-02-05 Natalia Portillo
+
+ * Sun.cs:
+ * DiscImageChef.Partitions.csproj:
+ Added support for Sun disklabel.
+
2016-02-03 Natalia Portillo
* AppleMap.cs:
diff --git a/DiscImageChef.Partitions/DiscImageChef.Partitions.csproj b/DiscImageChef.Partitions/DiscImageChef.Partitions.csproj
index 28ee18ab..2186ec6a 100644
--- a/DiscImageChef.Partitions/DiscImageChef.Partitions.csproj
+++ b/DiscImageChef.Partitions/DiscImageChef.Partitions.csproj
@@ -40,6 +40,7 @@
+
diff --git a/DiscImageChef.Partitions/Sun.cs b/DiscImageChef.Partitions/Sun.cs
new file mode 100644
index 00000000..5257de1e
--- /dev/null
+++ b/DiscImageChef.Partitions/Sun.cs
@@ -0,0 +1,407 @@
+// /***************************************************************************
+// The Disc Image Chef
+// ----------------------------------------------------------------------------
+//
+// Filename : Sun.cs
+// Version : 1.0
+// Author(s) : Natalia Portillo
+//
+// Component : Component
+//
+// Revision : $Revision$
+// Last change by : $Author$
+// Date : $Date$
+//
+// --[ Description ] ----------------------------------------------------------
+//
+// Description
+//
+// --[ License ] --------------------------------------------------------------
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program 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 General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// ----------------------------------------------------------------------------
+// Copyright (C) 2011-2015 Claunia.com
+// ****************************************************************************/
+// //$Id$
+using System;
+using System.Collections.Generic;
+using DiscImageChef.Console;
+
+namespace DiscImageChef.PartPlugins
+{
+ class SunDisklabel : PartPlugin
+ {
+ const UInt16 SUN_MAGIC = 0xDABE;
+ const UInt32 VTOC_MAGIC = 0x600DDEEE;
+
+ public enum SunTypes : ushort
+ {
+ SunEmpty = 0x0000,
+ SunBoot = 0x0001,
+ SunRoot = 0x0002,
+ SunSwap = 0x0003,
+ SunUsr = 0x0004,
+ SunWholeDisk = 0x0005,
+ SunStand = 0x0006,
+ SunVar = 0x0007,
+ SunHome = 0x0008,
+ LinuxSwap = 0x0082,
+ Linux = 0x0083,
+ LVM = 0x008E,
+ LinuxRaid = 0x00FD
+ }
+
+ [Flags]
+ public enum SunFlags : ushort
+ {
+ NoMount = 0x0001,
+ ReadOnly = 0x0010,
+ }
+
+ public SunDisklabel()
+ {
+ Name = "Sun Disklabel";
+ PluginUUID = new Guid("50F35CC4-8375-4445-8DCB-1BA550C931A3");
+ }
+
+ public override bool GetInformation(ImagePlugins.ImagePlugin imagePlugin, out List partitions)
+ {
+ partitions = new List();
+
+ byte[] sunSector = imagePlugin.ReadSector(0);
+ byte[] tmpString;
+ SunDiskLabel sdl = new SunDiskLabel();
+ sdl.vtoc = new SunVTOC();
+ sdl.spare = new byte[148];
+ sdl.vtoc.infos = new SunInfo[8];
+ sdl.vtoc.bootinfo = new uint[3];
+ sdl.vtoc.reserved = new byte[40];
+ sdl.vtoc.timestamp = new uint[8];
+ sdl.partitions = new SunPartition[8];
+
+ BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
+
+ tmpString = new byte[128];
+ Array.Copy(sunSector, 0, tmpString, 0, 128);
+ sdl.info = StringHandlers.CToString(tmpString);
+ sdl.vtoc.version = BigEndianBitConverter.ToUInt32(sunSector, 0x80 + 0x00);
+
+ tmpString = new byte[8];
+ Array.Copy(sunSector, 0x80 + 0x04, tmpString, 0, 8);
+ sdl.vtoc.volname = StringHandlers.CToString(tmpString);
+ sdl.vtoc.nparts = BigEndianBitConverter.ToUInt16(sunSector, 0x80 + 0x0C);
+ for (int i = 0; i < 8; i++)
+ {
+ sdl.vtoc.infos[i] = new SunInfo();
+ sdl.vtoc.infos[i].id = BigEndianBitConverter.ToUInt16(sunSector, 0x80 + 0x0E + i * 4 + 0x00);
+ sdl.vtoc.infos[i].flags = BigEndianBitConverter.ToUInt16(sunSector, 0x80 + 0x0E + i * 4 + 0x02);
+ }
+ sdl.vtoc.padding = BigEndianBitConverter.ToUInt16(sunSector, 0x80 + 0x2E);
+ for (int i = 0; i < 3; i++)
+ sdl.vtoc.bootinfo[i] = BigEndianBitConverter.ToUInt32(sunSector, 0x80 + 0x30 + i * 4);
+ sdl.vtoc.sanity = BigEndianBitConverter.ToUInt32(sunSector, 0x80 + 0x3C);
+ Array.Copy(sunSector, 0x80 + 0x40, sdl.vtoc.reserved, 0, 40);
+ for (int i = 0; i < 8; i++)
+ sdl.vtoc.timestamp[i] = BigEndianBitConverter.ToUInt32(sunSector, 0x80 + 0x68 + i * 4);
+
+ sdl.write_reinstruct = BigEndianBitConverter.ToUInt32(sunSector, 0x108);
+ sdl.read_reinstruct = BigEndianBitConverter.ToUInt32(sunSector, 0x10C);
+ Array.Copy(sunSector, 0x110, sdl.spare, 0, 148);
+ sdl.rspeed = BigEndianBitConverter.ToUInt16(sunSector, 0x1A4);
+ sdl.pcylcount = BigEndianBitConverter.ToUInt16(sunSector, 0x1A6);
+ sdl.sparecyl = BigEndianBitConverter.ToUInt16(sunSector, 0x1A8);
+ sdl.gap1 = BigEndianBitConverter.ToUInt16(sunSector, 0x1AA);
+ sdl.gap2 = BigEndianBitConverter.ToUInt16(sunSector, 0x1AC);
+ sdl.ilfact = BigEndianBitConverter.ToUInt16(sunSector, 0x1AE);
+ sdl.ncyl = BigEndianBitConverter.ToUInt16(sunSector, 0x1B0);
+ sdl.nacyl = BigEndianBitConverter.ToUInt16(sunSector, 0x1B2);
+ sdl.ntrks = BigEndianBitConverter.ToUInt16(sunSector, 0x1B4);
+ sdl.nsect = BigEndianBitConverter.ToUInt16(sunSector, 0x1B6);
+ sdl.bhead = BigEndianBitConverter.ToUInt16(sunSector, 0x1B8);
+ sdl.ppart = BigEndianBitConverter.ToUInt16(sunSector, 0x1BA);
+
+ for (int i = 0; i < 8; i++)
+ {
+ sdl.partitions[i] = new SunPartition();
+ sdl.partitions[i].start_cylinder = BigEndianBitConverter.ToUInt32(sunSector, 0x1BC + i * 8 + 0x00);
+ sdl.partitions[i].num_sectors = BigEndianBitConverter.ToUInt32(sunSector, 0x1BC + i * 8 + 0x04);
+ }
+
+ sdl.magic = BigEndianBitConverter.ToUInt16(sunSector, 0x1FC);
+ sdl.csum = BigEndianBitConverter.ToUInt16(sunSector, 0x1FE);
+
+ ushort csum = 0;
+ for (int i = 0; i < 510; i += 2)
+ csum ^= BigEndianBitConverter.ToUInt16(sunSector, i);
+
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.info = {0}", sdl.info);
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.version = {0}", sdl.vtoc.version);
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.volname = {0}", sdl.vtoc.volname);
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.nparts = {0}", sdl.vtoc.nparts);
+ for (int i = 0; i < 8; i++)
+ {
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.infos[{1}].id = 0x{0:X4}", sdl.vtoc.infos[i].id, i);
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.infos[{1}].flags = 0x{0:X4}", sdl.vtoc.infos[i].flags, i);
+ }
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.padding = 0x{0:X4}", sdl.vtoc.padding);
+ for (int i = 0; i < 3; i++)
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.bootinfo[{1}].id = 0x{0:X8}", sdl.vtoc.bootinfo[i], i);
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.sanity = 0x{0:X8}", sdl.vtoc.sanity);
+ for (int i = 0; i < 8; i++)
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.vtoc.timestamp[{1}] = 0x{0:X8}", sdl.vtoc.timestamp[i], i);
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.rspeed = {0}", sdl.rspeed);
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.pcylcount = {0}", sdl.pcylcount);
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.sparecyl = {0}", sdl.sparecyl);
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.gap1 = {0}", sdl.gap1);
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.gap2 = {0}", sdl.gap2);
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.ilfact = {0}", sdl.ilfact);
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.ncyl = {0}", sdl.ncyl);
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.nacyl = {0}", sdl.nacyl);
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.ntrks = {0}", sdl.ntrks);
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.nsect = {0}", sdl.nsect);
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.bhead = {0}", sdl.bhead);
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.ppart = {0}", sdl.ppart);
+ for (int i = 0; i < 8; i++)
+ {
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.partitions[{1}].start_cylinder = {0}", sdl.partitions[i].start_cylinder, i);
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.partitions[{1}].num_sectors = {0}", sdl.partitions[i].num_sectors, i);
+ }
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.magic = 0x{0:X4}", sdl.magic);
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "sdl.csum = 0x{0:X4}", sdl.csum);
+ DicConsole.DebugWriteLine("Sun Disklabel plugin", "csum = 0x{0:X4}", csum);
+
+ ulong sectorsPerCylinder = (ulong)(sdl.nsect * sdl.ntrks);
+
+ if (sectorsPerCylinder == 0 || sectorsPerCylinder * sdl.pcylcount > imagePlugin.GetSectors() || sdl.magic != SUN_MAGIC)
+ return false;
+
+ for (int i = 0; i < 8; i++)
+ {
+ if ((SunTypes)sdl.vtoc.infos[i].id != SunTypes.SunWholeDisk && sdl.partitions[i].num_sectors > 0)
+ {
+ CommonTypes.Partition part = new CommonTypes.Partition();
+ part.PartitionDescription = SunFlagsToString((SunFlags)sdl.vtoc.infos[i].flags);
+ part.PartitionLength = (ulong)sdl.partitions[i].num_sectors * (ulong)imagePlugin.GetSectorSize();
+ part.PartitionName = "";
+ part.PartitionSectors = sdl.partitions[i].num_sectors;
+ part.PartitionSequence = (ulong)i;
+ part.PartitionStart = (ulong)sdl.partitions[i].start_cylinder * (ulong)sectorsPerCylinder * (ulong)imagePlugin.GetSectorSize();
+ part.PartitionStartSector = sdl.partitions[i].start_cylinder * sectorsPerCylinder;
+ part.PartitionType = SunIdToString((SunTypes)sdl.vtoc.infos[i].id);
+
+ if (part.PartitionStartSector > imagePlugin.GetSectors() || (part.PartitionStartSector + part.PartitionSectors) > imagePlugin.GetSectors())
+ return false;
+
+ partitions.Add(part);
+ }
+ }
+
+ return true;
+ }
+
+ public static string SunFlagsToString(SunFlags flags)
+ {
+ System.Text.StringBuilder sb = new System.Text.StringBuilder();
+ if (flags.HasFlag(SunFlags.NoMount))
+ sb.AppendLine("Unmountable");
+ if (flags.HasFlag(SunFlags.ReadOnly))
+ sb.AppendLine("Read-only");
+ return sb.ToString();
+ }
+
+ public static string SunIdToString(SunTypes id)
+ {
+ switch (id)
+ {
+ case SunTypes.Linux:
+ return "Linux";
+ case SunTypes.LinuxRaid:
+ return "Linux RAID";
+ case SunTypes.LinuxSwap:
+ return "Linux swap";
+ case SunTypes.LVM:
+ return "LVM";
+ case SunTypes.SunBoot:
+ return "Sun boot";
+ case SunTypes.SunEmpty:
+ return "Empty";
+ case SunTypes.SunHome:
+ return "Sun /home";
+ case SunTypes.SunRoot:
+ return "Sun /";
+ case SunTypes.SunStand:
+ return "Sun /stand";
+ case SunTypes.SunSwap:
+ return "Sun swap";
+ case SunTypes.SunUsr:
+ return "Sun /usr";
+ case SunTypes.SunVar:
+ return "Sun /var";
+ case SunTypes.SunWholeDisk:
+ return "Whole disk";
+ default:
+ return "Unknown";
+ }
+ }
+
+ public struct SunDiskLabel
+ {
+ ///
+ /// Offset 0x000: Informative string, 128 bytes
+ ///
+ public string info;
+ ///
+ /// Offset 0x080: Volume Table Of Contents
+ ///
+ public SunVTOC vtoc;
+ ///
+ /// Offset 0x108: Sectors to skip on writes
+ ///
+ public uint write_reinstruct;
+ ///
+ /// Offset 0x10C: Sectors to skip in reads
+ ///
+ public uint read_reinstruct;
+ ///
+ /// Offset 0x110: Unused, 148 bytes
+ ///
+ public byte[] spare;
+ ///
+ /// Offset 0x1A4: Rotational speed
+ ///
+ public ushort rspeed;
+ ///
+ /// Offset 0x1A6: Physical cylinder count
+ ///
+ public ushort pcylcount;
+ ///
+ /// Offset 0x1A8: Extra sectors per cylinder
+ ///
+ public ushort sparecyl;
+ ///
+ /// Offset 0x1AA: Obsolete, gap
+ ///
+ public ushort gap1;
+ ///
+ /// Offset 0x1AC: Obsolete, gap
+ ///
+ public ushort gap2;
+ ///
+ /// Offset 0x1AE: Interleave factor
+ ///
+ public ushort ilfact;
+ ///
+ /// Offset 0x1B0: Cylinders
+ ///
+ public ushort ncyl;
+ ///
+ /// Offset 0x1B2: Alternate cylinders
+ ///
+ public ushort nacyl;
+ ///
+ /// Offset 0x1B4: Tracks per cylinder
+ ///
+ public ushort ntrks;
+ ///
+ /// Offset 0x1B6: Sectors per track
+ ///
+ public ushort nsect;
+ ///
+ /// Offset 0x1B8: Label head offset
+ ///
+ public ushort bhead;
+ ///
+ /// Offset 0x1BA: Physical partition
+ ///
+ public ushort ppart;
+ ///
+ /// Offset 0x1BC: Partitions
+ ///
+ public SunPartition[] partitions;
+ ///
+ /// Offset 0x1FC:
+ ///
+ public ushort magic;
+ ///
+ /// Offset 0x1FE: XOR of label
+ ///
+ public ushort csum;
+ }
+
+ public struct SunVTOC
+ {
+ ///
+ /// Offset 0x00: VTOC version
+ ///
+ public uint version;
+ ///
+ /// Offset 0x04: Volume name, 8 bytes
+ ///
+ public string volname;
+ ///
+ /// Offset 0x0C: Number of partitions
+ ///
+ public ushort nparts;
+ ///
+ /// Offset 0x0E: Partition information, 8 entries
+ ///
+ public SunInfo[] infos;
+ ///
+ /// Offset 0x2E: Padding
+ ///
+ public ushort padding;
+ ///
+ /// Offset 0x30: Information needed by mboot, 3 entries
+ ///
+ public uint[] bootinfo;
+ ///
+ /// Offset 0x3C: VTOC magic
+ ///
+ public uint sanity;
+ ///
+ /// Offset 0x40: Reserved, 40 bytes
+ ///
+ public byte[] reserved;
+ ///
+ /// Offset 0x68: Partition timestamps, 8 entries
+ ///
+ public uint[] timestamp;
+ }
+
+ public struct SunInfo
+ {
+ ///
+ /// Offset 0x00: Partition ID
+ ///
+ public ushort id;
+ ///
+ /// Offset 0x02: Partition flags
+ ///
+ public ushort flags;
+ }
+
+ public struct SunPartition
+ {
+ ///
+ /// Offset 0x00: Starting cylinder
+ ///
+ public uint start_cylinder;
+ ///
+ /// Offset 0x02: Sectors
+ ///
+ public uint num_sectors;
+ }
+ }
+}
\ No newline at end of file
diff --git a/DiscImageChef/ChangeLog b/DiscImageChef/ChangeLog
index d4bd5a16..c0e1ca06 100644
--- a/DiscImageChef/ChangeLog
+++ b/DiscImageChef/ChangeLog
@@ -1,3 +1,8 @@
+2016-02-05 Natalia Portillo
+
+ * Commands/DumpMedia.cs:
+ Correct physical/logical block size in sidecar.
+
2016-02-05 Natalia Portillo
* Commands/Analyze.cs:
diff --git a/DiscImageChef/Commands/DumpMedia.cs b/DiscImageChef/Commands/DumpMedia.cs
index 71b7c597..b43dc737 100644
--- a/DiscImageChef/Commands/DumpMedia.cs
+++ b/DiscImageChef/Commands/DumpMedia.cs
@@ -142,6 +142,8 @@ namespace DiscImageChef.Commands
byte[] tmpBuf;
MediaType dskType = MediaType.Unknown;
bool opticalDisc = false;
+ uint logicalBlockSize = 0;
+ uint physicalBlockSize = 0;
if (dev.IsRemovable)
{
@@ -262,6 +264,9 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Media has {0} blocks of {1} bytes/each. (for a total of {2} bytes)",
blocks, blockSize, blocks * (ulong)blockSize);
}
+
+ logicalBlockSize = blockSize;
+ physicalBlockSize = blockSize;
}
if (dev.SCSIType == DiscImageChef.Decoders.SCSI.PeripheralDeviceTypes.SequentialAccess)
@@ -545,6 +550,8 @@ namespace DiscImageChef.Commands
}
}
}
+
+ physicalBlockSize = 2448;
}
#endregion CompactDisc
else
@@ -1604,6 +1611,7 @@ namespace DiscImageChef.Commands
DicConsole.WriteLine("Reading {0} raw bytes ({1} cooked bytes) per sector.",
longBlockSize, blockSize);
blocksToRead = 1;
+ physicalBlockSize = longBlockSize;
blockSize = longBlockSize;
}
}
@@ -2235,7 +2243,8 @@ namespace DiscImageChef.Commands
sidecar.BlockMedia[0].Interface = "SCSI";
}
sidecar.BlockMedia[0].LogicalBlocks = (long)blocks;
- sidecar.BlockMedia[0].LogicalBlockSize = (int)blockSize;
+ sidecar.BlockMedia[0].PhysicalBlockSize = (int)physicalBlockSize;
+ sidecar.BlockMedia[0].LogicalBlockSize = (int)logicalBlockSize;
sidecar.BlockMedia[0].Manufacturer = dev.Manufacturer;
sidecar.BlockMedia[0].Model = dev.Model;
sidecar.BlockMedia[0].Serial = dev.Serial;
diff --git a/README.md b/README.md
index be659fdc..87348be6 100644
--- a/README.md
+++ b/README.md
@@ -54,6 +54,7 @@ Supported partitioning schemes
* NeXT disklabel
* Amiga Rigid Disk Block (RDB)
* Atari AHDI and ICDPro
+* Sun disklabel
Supported file systems
======================
@@ -88,6 +89,7 @@ Supported file systems
* Amiga Original File System, with international characters, directory cache and multi-user patches
* Amiga Fast File System, with international characters, directory cache and multi-user patches
* Amiga Fast File System v2, untested
+* Acorn Advanced Disc Filing System
Supported checksums
===================
diff --git a/TODO b/TODO
index c933f3ad..a6e92f3a 100644
--- a/TODO
+++ b/TODO
@@ -20,7 +20,6 @@
Filesystem plugins:
--- Add support for SFS filesystem
--- Add support for PFS3 filesystem
---- Add support for Acorn filesystems
--- Add support for Apple DOS filesystems
--- Add support for UCSD/Pascal filesystem
--- Add support for AMSDOS filesystem
@@ -48,7 +47,6 @@ Partitioning scheme plugins:
--- Add support for AIX partitions
--- Add support for EFI GPT
--- Add support for SGI partitions
---- Add support for Sun partitions
--- Add support for Ultrix partitions
Other things: