From 5e8b47554c306b52207dbe57334f77e1b168cd13 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 2 Aug 2017 13:57:04 +0100 Subject: [PATCH] Corrected some NEC types. --- DiscImageChef.CommonTypes/MediaType.cs | 14 +- DiscImageChef.DiscImages/D88.cs | 41 ++++ DiscImageChef.DiscImages/ZZZRawImage.cs | 11 +- DiscImageChef.Partitions/XENIX.cs | 297 ++++++++++++++++++++++++ DiscImageChef.Tests/Partitions/VTOC.cs | 104 +++++++++ 5 files changed, 456 insertions(+), 11 deletions(-) create mode 100644 DiscImageChef.DiscImages/D88.cs create mode 100644 DiscImageChef.Partitions/XENIX.cs create mode 100644 DiscImageChef.Tests/Partitions/VTOC.cs diff --git a/DiscImageChef.CommonTypes/MediaType.cs b/DiscImageChef.CommonTypes/MediaType.cs index 954130745..e5d4af078 100644 --- a/DiscImageChef.CommonTypes/MediaType.cs +++ b/DiscImageChef.CommonTypes/MediaType.cs @@ -382,22 +382,24 @@ namespace DiscImageChef.CommonTypes NEC_525_SD, /// 8", SS, SD, 77 tracks, 26 spt, 256 bytes/sector, MFM? NEC_525_DD, - /// 5,25", DS, HD, 80 tracks, 8 spt, 1024 bytes/sector, MFM + /// 5,25", DS, HD, 77 tracks, 8 spt, 1024 bytes/sector, MFM NEC_525_HD, - /// 3,5", DS, HD, 80 tracks, 8 spt, 1024 bytes/sector, MFM + /// 3,5", DS, HD, 77 tracks, 8 spt, 1024 bytes/sector, MFM, aka mode 3 NEC_35_HD_8, /// 3,5", DS, HD, 80 tracks, 15 spt, 512 bytes/sector, MFM NEC_35_HD_15, + /// 3,5", DS, TD, 240 tracks, 38 spt, 512 bytes/sector, MFM + NEC_35_TD, #endregion NEC standard floppy formats #region SHARP standard floppy formats - /// 5,25", DS, HD, 77 tracks, 8 spt, 1024 bytes/sector, FM + /// 5,25", DS, HD, 77 tracks, 8 spt, 1024 bytes/sector, MFM SHARP_525, - /// 3,5", DS, HD, 80 tracks, 9 spt, 1024 bytes/sector, FM + /// 3,5", DS, HD, 80 tracks, 9 spt, 1024 bytes/sector, MFM SHARP_525_9, - /// 3,5", DS, HD, 77 tracks, 8 spt, 1024 bytes/sector, FM + /// 3,5", DS, HD, 77 tracks, 8 spt, 1024 bytes/sector, MFM SHARP_35, - /// 3,5", DS, HD, 80 tracks, 9 spt, 1024 bytes/sector, FM + /// 3,5", DS, HD, 80 tracks, 9 spt, 1024 bytes/sector, MFM SHARP_35_9, #endregion SHARP standard floppy formats diff --git a/DiscImageChef.DiscImages/D88.cs b/DiscImageChef.DiscImages/D88.cs new file mode 100644 index 000000000..3d4cd806e --- /dev/null +++ b/DiscImageChef.DiscImages/D88.cs @@ -0,0 +1,41 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : D88.cs +// Author(s) : Natalia Portillo +// +// Component : Component +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2017 Natalia Portillo +// ****************************************************************************/ +using System; +namespace DiscImageChef.DiscImages +{ + public class D88 + { + public D88() + { + } + } +} diff --git a/DiscImageChef.DiscImages/ZZZRawImage.cs b/DiscImageChef.DiscImages/ZZZRawImage.cs index 3ad7f6921..56b56dfc7 100644 --- a/DiscImageChef.DiscImages/ZZZRawImage.cs +++ b/DiscImageChef.DiscImages/ZZZRawImage.cs @@ -181,7 +181,6 @@ namespace DiscImageChef.ImagePlugins case 1304320: // T0S0 = 128bps, T0S1 = 256bps case 1255168: // T0S0 = 128bps, T0S1 = 256bps case 1261568: - case 1310720: case 1638400: ImageInfo.sectorSize = 1024; break; @@ -710,11 +709,11 @@ namespace DiscImageChef.ImagePlugins case 1255168: return MediaType.ECMA_69_8; case 1261568: - return MediaType.NEC_8_DD; - case 1304320: + if(extension == ".hdm") + return MediaType.NEC_525_HD; + return MediaType.NEC_8_DD; + case 1304320: return MediaType.ECMA_99_8; - case 1310720: - return MediaType.NEC_525_HD; case 1427456: return MediaType.FDFORMAT_525_HD; case 1474560: @@ -733,6 +732,8 @@ namespace DiscImageChef.ImagePlugins return MediaType.XDF_35; case 2949120: return MediaType.DOS_35_ED; + case 9338880: + return MediaType.NEC_35_TD; case 40387584: return MediaType.PocketZip; case 126222336: diff --git a/DiscImageChef.Partitions/XENIX.cs b/DiscImageChef.Partitions/XENIX.cs new file mode 100644 index 000000000..14636b23e --- /dev/null +++ b/DiscImageChef.Partitions/XENIX.cs @@ -0,0 +1,297 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : UNIX.cs +// Author(s) : Natalia Portillo +// +// Component : Component +// +// --[ Description ] ---------------------------------------------------------- +// +// Description +// +// --[ 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 . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2017 Natalia Portillo +// ****************************************************************************/ +using System; +using System.Collections.Generic; +using DiscImageChef.CommonTypes; +using DiscImageChef.ImagePlugins; +using System.Linq; + +namespace DiscImageChef.PartPlugins +{ + // These partitions are hardwired in kernel sources for some UNIX versions predating System V. + // They depend on exact device, indeed the kernel chooses what to use depending on the disk driver, so that's what we do. + // Currently only DEC devices used in Ultrix are added, probably it's missing a lot of entries. + public class UNIX : PartPlugin + { + public UNIX() + { + Name = "UNIX hardwired"; + PluginUUID = new Guid("9ED7E30B-53BF-4619-87A0-5D2002155617"); + } + + public override bool GetInformation(ImagePlugin imagePlugin, out List partitions, ulong sectorOffset) + { + partitions = new List(); + Partition[] parts = new Partition[0]; + + if(sectorOffset != 0) + return false; + + switch(imagePlugin.ImageInfo.mediaType) + { + case MediaType.RA60: + parts = RA60; + break; + case MediaType.RA80: + parts = RA80; + break; + case MediaType.RA81: + parts = RA81; + break; + case MediaType.RC25: + parts = RC25; + break; + case MediaType.RD31: + parts = RD31; + break; + case MediaType.RD32: + parts = RD32; + break; + case MediaType.RD51: + parts = RD51; + break; + case MediaType.RD52: + parts = RD52; + break; + case MediaType.RD53: + parts = RD53; + break; + case MediaType.RD54: + parts = RD54; + break; + case MediaType.RK06: + parts = RK06; + break; + case MediaType.RK07: + parts = RK07; + break; + case MediaType.RM02: + case MediaType.RM03: + parts = RM02; + break; + case MediaType.RM05: + parts = RM05; + break; + case MediaType.RP02: + parts = RP02; + break; + case MediaType.RP03: + parts = RP03; + break; + case MediaType.RP04: + case MediaType.RP05: + parts = RP04; + break; + case MediaType.RP06: + parts = RP06; + break; + default: + return false; + } + + for(int i = 0; i < parts.Length; i++) + parts[i].Scheme = ""; + + partitions = parts.ToList(); + + return partitions.Count > 0; + } + + readonly Partition[] RA60 = { + new Partition{ Description = null, Name = "/", Type = "data", Length = 9600, Start = 0, Size = 4915200, Offset = 0, Sequence = 0 }, + new Partition{ Description = null, Name = "/usr", Type = "data", Length = 20000, Start = 9600, Size = 10240000, Offset = 4915200, Sequence = 1 }, + new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 200, Start = 29600, Size = 102400, Offset = 15155200, Sequence = 2 }, + new Partition{ Description = null, Name = "swap", Type = "swap", Length = 6000, Start = 29800, Size = 3072000, Offset = 15257600, Sequence = 2 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 363376, Start = 35800, Size = 186048512, Offset = 18329600, Sequence = 3 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 181688, Start = 35800, Size = 93024256, Offset = 18329600, Sequence = 4 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 181688, Start = 217488, Size = 93024256, Offset = 111353856, Sequence = 5 }, + new Partition{ Description = null, Name = "maintenance area", Type = "maintenance", Length = 1000, Start = 399176, Size = 512000, Offset = 204378112, Sequence = 8 }, + }; + + readonly Partition[] RA80 = { + new Partition{ Description = null, Name = "/", Type = "data", Length = 9600, Start = 0, Size = 4915200, Offset = 0, Sequence = 0 }, + new Partition{ Description = null, Name = "/usr", Type = "data", Length = 20000, Start = 9600, Size = 10240000, Offset = 4915200, Sequence = 1 }, + new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 200, Start = 29600, Size = 102400, Offset = 15155200, Sequence = 2 }, + new Partition{ Description = null, Name = "swap", Type = "swap", Length = 6000, Start = 29800, Size = 3072000, Offset = 15257600, Sequence = 2 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 200412, Start = 35800, Size = 102610944, Offset = 18329600, Sequence = 3 }, + new Partition{ Description = null, Name = "maintenance area", Type = "maintenance", Length = 1000, Start = 236212, Size = 512000, Offset = 120940544, Sequence = 8 }, + }; + + readonly Partition[] RA81 = { + new Partition{ Description = null, Name = "/", Type = "data", Length = 9600, Start = 0, Size = 4915200, Offset = 0, Sequence = 0 }, + new Partition{ Description = null, Name = "/usr", Type = "data", Length = 20000, Start = 9600, Size = 10240000, Offset = 4915200, Sequence = 1 }, + new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 200, Start = 29600, Size = 102400, Offset = 15155200, Sequence = 2 }, + new Partition{ Description = null, Name = "swap", Type = "swap", Length = 6000, Start = 29800, Size = 3072000, Offset = 15257600, Sequence = 2 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 854272, Start = 35800, Size = 437387264, Offset = 18329600, Sequence = 3 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 181688, Start = 35800, Size = 93024256, Offset = 18329600, Sequence = 4 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 181688, Start = 217488, Size = 93024256, Offset = 111353856, Sequence = 5 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 490896, Start = 399176, Size = 251338752, Offset = 204378112, Sequence = 6 }, + new Partition{ Description = null, Name = "maintenance area", Type = "maintenance", Length = 1000, Start = 890072, Size = 512000, Offset = 455716864, Sequence = 8 }, + }; + + readonly Partition[] RC25 = { + new Partition{ Description = null, Name = "/", Type = "data", Length = 9000, Start = 0, Size = 4608000, Offset = 0, Sequence = 0 }, + new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 200, Start = 9000, Size = 102400, Offset = 4608000, Sequence = 2 }, + new Partition{ Description = null, Name = "swap", Type = "swap", Length = 4000, Start = 9200, Size = 2048000, Offset = 4710400, Sequence = 2 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 37600, Start = 13200, Size = 19251200, Offset = 6758400, Sequence = 3 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 12000, Start = 13200, Size = 6144000, Offset = 6758400, Sequence = 4 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 25600, Start = 25200, Size = 13107200, Offset = 6758400, Sequence = 5 }, + new Partition{ Description = null, Name = "maintenance area", Type = "maintenance", Length = 102, Start = 890072, Size = 50800, Offset = 26009600, Sequence = 8 }, + }; + + readonly Partition[] RD31 = { + new Partition{ Description = null, Name = "/", Type = "data", Length = 9700, Start = 0, Size = 4966400, Offset = 0, Sequence = 0 }, + new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 100, Start = 9700, Size = 51200, Offset = 4966400, Sequence = 5 }, + new Partition{ Description = null, Name = "swap", Type = "swap", Length = 3000, Start = 9800, Size = 1536000, Offset = 5017600, Sequence = 5 }, + new Partition{ Description = null, Name = "/usr", Type = "data", Length = 28728, Start = 12800, Size = 14708736, Offset = 6553600, Sequence = 6 }, + new Partition{ Description = null, Name = "maintenance area", Type = "maintenance", Length = 32, Start = 41528, Size = 16384, Offset = 21262336, Sequence = 8 }, + }; + + readonly Partition[] RD32 = { + new Partition{ Description = null, Name = "/", Type = "data", Length = 9700, Start = 0, Size = 4966400, Offset = 0, Sequence = 0 }, + new Partition{ Description = null, Name = "/usr", Type = "data", Length = 17300, Start = 9700, Size = 102400, Offset = 4966400, Sequence = 1 }, + new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 100, Start = 27000, Size = 51200, Offset = 13824000, Sequence = 2 }, + new Partition{ Description = null, Name = "swap", Type = "swap", Length = 3000, Start = 27100, Size = 1536000, Offset = 13875200, Sequence = 2 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 53072, Start = 30100, Size = 27172864, Offset = 15411200, Sequence = 3 }, + new Partition{ Description = null, Name = "maintenance area", Type = "maintenance", Length = 32, Start = 83172, Size = 16384, Offset = 42584064, Sequence = 8 }, + }; + + readonly Partition[] RD51 = { + new Partition{ Description = null, Name = "/", Type = "data", Length = 7460, Start = 0, Size = 4608000, Offset = 0, Sequence = 0 }, + new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 40, Start = 0, Size = 20480, Offset = 0, Sequence = 0 }, + new Partition{ Description = null, Name = "swap", Type = "swap", Length = 2200, Start = 0, Size = 1126400, Offset = 0, Sequence = 0 }, + new Partition{ Description = null, Name = "/usr", Type = "data", Length = 11868, Start = 9700, Size = 6076416, Offset = 6758400, Sequence = 4 }, + new Partition{ Description = null, Name = "maintenance area", Type = "maintenance", Length = 32, Start = 21568, Size = 16384, Offset = 11042816, Sequence = 8 }, + }; + + readonly Partition[] RD52 = { + new Partition{ Description = null, Name = "/", Type = "data", Length = 9700, Start = 0, Size = 4966400, Offset = 0, Sequence = 0 }, + new Partition{ Description = null, Name = "/usr", Type = "data", Length = 17300, Start = 9700, Size = 8857600, Offset = 4966400, Sequence = 1 }, + new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 100, Start = 27000, Size = 51200, Offset = 13824000, Sequence = 2 }, + new Partition{ Description = null, Name = "swap", Type = "swap", Length = 3000, Start = 27100, Size = 1536000, Offset = 13875200, Sequence = 2 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 30348, Start = 30100, Size = 15538176, Offset = 15411200, Sequence = 3 }, + new Partition{ Description = null, Name = "maintenance area", Type = "maintenance", Length = 32, Start = 60448, Size = 16384, Offset = 30949376, Sequence = 8 }, + }; + + readonly Partition[] RD53 = { + new Partition{ Description = null, Name = "/", Type = "data", Length = 9700, Start = 0, Size = 4966400, Offset = 0, Sequence = 0 }, + new Partition{ Description = null, Name = "/usr", Type = "data", Length = 17300, Start = 9700, Size = 8857600, Offset = 4966400, Sequence = 1 }, + new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 100, Start = 27000, Size = 51200, Offset = 13824000, Sequence = 2 }, + new Partition{ Description = null, Name = "swap", Type = "swap", Length = 3000, Start = 27100, Size = 1536000, Offset = 13875200, Sequence = 2 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 108540, Start = 30100, Size = 55572480, Offset = 15411200, Sequence = 3 }, + new Partition{ Description = null, Name = "maintenance area", Type = "maintenance", Length = 32, Start = 138640, Size = 16384, Offset = 70983680, Sequence = 8 }, + }; + + readonly Partition[] RD54 = { + new Partition{ Description = null, Name = "/", Type = "data", Length = 9700, Start = 0, Size = 4966400, Offset = 0, Sequence = 0 }, + new Partition{ Description = null, Name = "/usr", Type = "data", Length = 17300, Start = 9700, Size = 8857600, Offset = 4966400, Sequence = 1 }, + new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 100, Start = 27000, Size = 51200, Offset = 13824000, Sequence = 2 }, + new Partition{ Description = null, Name = "swap", Type = "swap", Length = 3000, Start = 27100, Size = 1536000, Offset = 13875200, Sequence = 2 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 281068, Start = 30100, Size = 143906816, Offset = 15411200, Sequence = 3 }, + new Partition{ Description = null, Name = "maintenance area", Type = "maintenance", Length = 32, Start = 311168, Size = 16384, Offset = 159318016, Sequence = 8 }, + }; + + readonly Partition[] RK06 = { + new Partition{ Description = null, Name = "/", Type = "data", Length = 7920, Start = 0, Size = 4055040, Offset = 0, Sequence = 0 }, + new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 100, Start = 7920, Size = 51200, Offset = 4055040, Sequence = 1 }, + new Partition{ Description = null, Name = "swap", Type = "swap", Length = 2936, Start = 8020, Size = 1503232, Offset = 4106240, Sequence = 1 }, + new Partition{ Description = null, Name = "/usr", Type = "data", Length = 16126, Start = 10956, Size = 8256512, Offset = 5609472, Sequence = 2 }, + new Partition{ Description = null, Name = "bad sector file", Type = "bad", Length = 44, Start = 27082, Size = 22528, Offset = 13865984, Sequence = 8 }, + }; + + readonly Partition[] RK07 = { + new Partition{ Description = null, Name = "/", Type = "data", Length = 7920, Start = 0, Size = 4055040, Offset = 0, Sequence = 0 }, + new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 100, Start = 7920, Size = 51200, Offset = 4055040, Sequence = 1 }, + new Partition{ Description = null, Name = "swap", Type = "swap", Length = 2936, Start = 8020, Size = 1503232, Offset = 4106240, Sequence = 1 }, + new Partition{ Description = null, Name = "/usr", Type = "data", Length = 42790, Start = 10956, Size = 21908480, Offset = 5609472, Sequence = 3 }, + new Partition{ Description = null, Name = "bad sector file", Type = "bad", Length = 44, Start = 53746, Size = 22528, Offset = 27517952, Sequence = 8 }, + }; + + readonly Partition[] RP02 = { + new Partition{ Description = null, Name = "/", Type = "data", Length = 8400, Start = 0, Size = 4300800, Offset = 0, Sequence = 0 }, + new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 100, Start = 8400, Size = 51200, Offset = 4300800, Sequence = 1 }, + new Partition{ Description = null, Name = "swap", Type = "swap", Length = 3100, Start = 8500, Size = 1587200, Offset = 4352000, Sequence = 1 }, + new Partition{ Description = null, Name = "/usr", Type = "data", Length = 28400, Start = 11600, Size = 14540800, Offset = 5939200, Sequence = 2 }, + }; + + readonly Partition[] RP03 = { + new Partition{ Description = null, Name = "/", Type = "data", Length = 8400, Start = 0, Size = 4300800, Offset = 0, Sequence = 0 }, + new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 100, Start = 8400, Size = 51200, Offset = 4300800, Sequence = 1 }, + new Partition{ Description = null, Name = "swap", Type = "swap", Length = 3100, Start = 8500, Size = 1587200, Offset = 4352000, Sequence = 1 }, + new Partition{ Description = null, Name = "/usr", Type = "data", Length = 68400, Start = 11600, Size = 35020800, Offset = 5939200, Sequence = 2 }, + }; + + readonly Partition[] RP04 = { + new Partition{ Description = null, Name = "/", Type = "data", Length = 9614, Start = 0, Size = 4922368, Offset = 0, Sequence = 0 }, + new Partition{ Description = null, Name = "/usr", Type = "data", Length = 20064, Start = 9614, Size = 10272768, Offset = 4922368, Sequence = 1 }, + new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 200, Start = 29678, Size = 102400, Offset = 15195136, Sequence = 2 }, + new Partition{ Description = null, Name = "swap", Type = "swap", Length = 6070, Start = 29878, Size = 1587200, Offset = 15297536, Sequence = 2 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 135806, Start = 35948, Size = 69532672, Offset = 18405376, Sequence = 3 }, + new Partition{ Description = null, Name = "bad sector file", Type = "bad", Length = 44, Start = 171754, Size = 22528, Offset = 87938048, Sequence = 8 }, + }; + + readonly Partition[] RP06 = { + new Partition{ Description = null, Name = "/", Type = "data", Length = 9614, Start = 0, Size = 4922368, Offset = 0, Sequence = 0 }, + new Partition{ Description = null, Name = "/usr", Type = "data", Length = 20064, Start = 9614, Size = 10272768, Offset = 4922368, Sequence = 1 }, + new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 200, Start = 29678, Size = 102400, Offset = 15195136, Sequence = 2 }, + new Partition{ Description = null, Name = "swap", Type = "swap", Length = 6070, Start = 29878, Size = 1587200, Offset = 15297536, Sequence = 2 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 135806, Start = 35948, Size = 69532672, Offset = 18405376, Sequence = 3 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 304678, Start = 35948, Size = 155995136, Offset = 18405376, Sequence = 4 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 166828, Start = 171798, Size = 85415936, Offset = 87960576, Sequence = 5 }, + new Partition{ Description = null, Name = "bad sector file", Type = "bad", Length = 44, Start = 340626, Size = 22528, Offset = 174400512, Sequence = 8 }, + }; + + readonly Partition[] RM02 = { + new Partition{ Description = null, Name = "/", Type = "data", Length = 9120, Start = 0, Size = 4669440, Offset = 0, Sequence = 0 }, + new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 200, Start = 9120, Size = 102400, Offset = 4669440, Sequence = 1 }, + new Partition{ Description = null, Name = "swap", Type = "swap", Length = 5400, Start = 9320, Size = 2764800, Offset = 2764800, Sequence = 1 }, + new Partition{ Description = null, Name = "/usr", Type = "data", Length = 5600, Start = 29120, Size = 2867200, Offset = 14909440, Sequence = 2 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 96896, Start = 34720, Size = 49610752, Offset = 17776640, Sequence = 3 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 32160, Start = 34720, Size = 16465920, Offset = 17776640, Sequence = 4 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 32160, Start = 66880, Size = 16465920, Offset = 34242560, Sequence = 5 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 32576, Start = 99040, Size = 16678912, Offset = 50708480, Sequence = 6 }, + new Partition{ Description = null, Name = "bad sector file", Type = "bad", Length = 64, Start = 131616, Size = 32768, Offset = 67387392, Sequence = 8 }, + }; + + readonly Partition[] RM05 = { + new Partition{ Description = null, Name = "/", Type = "data", Length = 10336, Start = 0, Size = 5292032, Offset = 0, Sequence = 0 }, + new Partition{ Description = null, Name = "/usr", Type = "data", Length = 21280, Start = 10336, Size = 10895360, Offset = 5292032, Sequence = 1 }, + new Partition{ Description = null, Name = "error log", Type = "errorlog", Length = 200, Start = 31616, Size = 102400, Offset = 16187392, Sequence = 2 }, + new Partition{ Description = null, Name = "swap", Type = "swap", Length = 6388, Start = 31816, Size = 3270656, Offset = 16289792, Sequence = 2 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 462016, Start = 38304, Size = 236552192, Offset = 19611648, Sequence = 3 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 153824, Start = 38304, Size = 78757888, Offset = 19611648, Sequence = 4 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 153824, Start = 192128, Size = 78757888, Offset = 98369536, Sequence = 5 }, + new Partition{ Description = null, Name = "user", Type = "data", Length = 154368, Start = 192128, Size = 79036416, Offset = 98369536, Sequence = 6 }, + new Partition{ Description = null, Name = "bad sector file", Type = "bad", Length = 64, Start = 421312, Size = 32768, Offset = 215711744, Sequence = 8 }, + }; + } +} diff --git a/DiscImageChef.Tests/Partitions/VTOC.cs b/DiscImageChef.Tests/Partitions/VTOC.cs new file mode 100644 index 000000000..25c08fc4b --- /dev/null +++ b/DiscImageChef.Tests/Partitions/VTOC.cs @@ -0,0 +1,104 @@ +// /*************************************************************************** +// 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.Collections.Generic; +using System.IO; +using DiscImageChef.CommonTypes; +using DiscImageChef.DiscImages; +using DiscImageChef.Filesystems; +using DiscImageChef.Filters; +using DiscImageChef.ImagePlugins; +using DiscImageChef.PartPlugins; +using NUnit.Framework; + +namespace DiscImageChef.Tests.Partitions +{ + // TODO: Get SunOS and VTOC16 disk labels + [TestFixture] + public class Sun + { + readonly string[] testfiles = { + "linux.vdi.lz","parted.vdi.lz", + }; + + readonly Partition[][] wanted = { + // Linux's fdisk + new []{ + new Partition{ Description = null, Name = null, Type = "Linux", Length = 204800, Sequence = 0, Start = 0 }, + new Partition{ Description = null, Name = null, Type = "Sun boot", Length = 102400, Sequence = 1, Start = 208845 }, + new Partition{ Description = null, Name = null, Type = "Sun /", Length = 102400, Sequence = 2, Start = 321300 }, + new Partition{ Description = null, Name = null, Type = "Sun /home", Length = 102400, Sequence = 3, Start = 433755 }, + new Partition{ Description = null, Name = null, Type = "Sun swap", Length = 153600, Sequence = 4, Start = 546210 }, + new Partition{ Description = null, Name = null, Type = "Sun /usr", Length = 208845, Sequence = 5, Start = 706860 }, + new Partition{ Description = null, Name = null, Type = "Linux swap", Length = 96390, Sequence = 6, Start = 915705 }, + }, + // GNU Parted + new []{ + new Partition{ Description = null, Name = null, Type = "Linux", Length = 49152, Sequence = 0, Start = 0 }, + new Partition{ Description = null, Name = null, Type = "Linux", Length = 80325, Sequence = 1, Start = 64260 }, + new Partition{ Description = null, Name = null, Type = "Linux", Length = 96390, Sequence = 2, Start = 144585 }, + }, + }; + + [Test] + public void Test() + { + for(int i = 0; i < testfiles.Length; i++) + { + string location = Path.Combine(Consts.TestFilesRoot, "partitions", "sun", testfiles[i]); + Filter filter = new LZip(); + filter.Open(location); + ImagePlugin image = new VDI(); + Assert.AreEqual(true, image.OpenImage(filter), testfiles[i]); + List partitions = Core.Partitions.GetAll(image); + Assert.AreEqual(wanted[i].Length, partitions.Count, testfiles[i]); + for(int j = 0; j < partitions.Count; j++) + { + // Too chatty + //Assert.AreEqual(wanted[i][j].PartitionDescription, partitions[j].PartitionDescription, testfiles[i]); + Assert.AreEqual(wanted[i][j].Length * 512, partitions[j].Size, testfiles[i]); +// Assert.AreEqual(wanted[i][j].Name, partitions[j].Name, testfiles[i]); + Assert.AreEqual(wanted[i][j].Type, partitions[j].Type, testfiles[i]); + Assert.AreEqual(wanted[i][j].Start * 512, partitions[j].Offset, testfiles[i]); + Assert.AreEqual(wanted[i][j].Length, partitions[j].Length, testfiles[i]); + Assert.AreEqual(wanted[i][j].Sequence, partitions[j].Sequence, testfiles[i]); + Assert.AreEqual(wanted[i][j].Start, partitions[j].Start, testfiles[i]); + } + } + } + } +}