mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
REFACTOR: Reformat code.
This commit is contained in:
@@ -43,29 +43,29 @@ namespace DiscImageChef.Filesystems
|
||||
[Flags]
|
||||
enum JFS_Flags : uint
|
||||
{
|
||||
Unicode = 0x00000001,
|
||||
RemountRO = 0x00000002,
|
||||
Continue = 0x00000004,
|
||||
Panic = 0x00000008,
|
||||
UserQuota = 0x00000010,
|
||||
GroupQuota = 0x00000020,
|
||||
NoJournal = 0x00000040,
|
||||
Discard = 0x00000080,
|
||||
GroupCommit = 0x00000100,
|
||||
LazyCommit = 0x00000200,
|
||||
Temporary = 0x00000400,
|
||||
InlineLog = 0x00000800,
|
||||
Unicode = 0x00000001,
|
||||
RemountRO = 0x00000002,
|
||||
Continue = 0x00000004,
|
||||
Panic = 0x00000008,
|
||||
UserQuota = 0x00000010,
|
||||
GroupQuota = 0x00000020,
|
||||
NoJournal = 0x00000040,
|
||||
Discard = 0x00000080,
|
||||
GroupCommit = 0x00000100,
|
||||
LazyCommit = 0x00000200,
|
||||
Temporary = 0x00000400,
|
||||
InlineLog = 0x00000800,
|
||||
InlineMoving = 0x00001000,
|
||||
BadSAIT = 0x00010000,
|
||||
Sparse = 0x00020000,
|
||||
DASDEnabled = 0x00040000,
|
||||
DASDPrime = 0x00080000,
|
||||
SwapBytes = 0x00100000,
|
||||
DirIndex = 0x00200000,
|
||||
Linux = 0x10000000,
|
||||
DFS = 0x20000000,
|
||||
OS2 = 0x40000000,
|
||||
AIX = 0x80000000
|
||||
BadSAIT = 0x00010000,
|
||||
Sparse = 0x00020000,
|
||||
DASDEnabled = 0x00040000,
|
||||
DASDPrime = 0x00080000,
|
||||
SwapBytes = 0x00100000,
|
||||
DirIndex = 0x00200000,
|
||||
Linux = 0x10000000,
|
||||
DFS = 0x20000000,
|
||||
OS2 = 0x40000000,
|
||||
AIX = 0x80000000
|
||||
}
|
||||
|
||||
[Flags]
|
||||
@@ -120,14 +120,12 @@ namespace DiscImageChef.Filesystems
|
||||
public JFS_TimeStruct s_time;
|
||||
public uint s_fsckloglen;
|
||||
public sbyte s_fscklog;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]
|
||||
public byte[] s_fpack;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)] public byte[] s_fpack;
|
||||
public ulong s_xsize;
|
||||
public JFS_Extent s_xfsckpxd;
|
||||
public JFS_Extent s_xlogpxd;
|
||||
public Guid s_uuid;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public byte[] s_label;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] s_label;
|
||||
public Guid s_loguuid;
|
||||
}
|
||||
|
||||
@@ -145,31 +143,25 @@ namespace DiscImageChef.Filesystems
|
||||
{
|
||||
Name = "JFS Plugin";
|
||||
PluginUUID = new Guid("D3BE2A41-8F28-4055-94DC-BB6C72A0E9C4");
|
||||
if(encoding == null)
|
||||
CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
|
||||
else
|
||||
CurrentEncoding = encoding;
|
||||
if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
|
||||
else CurrentEncoding = encoding;
|
||||
}
|
||||
|
||||
public JFS(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
|
||||
{
|
||||
Name = "JFS Plugin";
|
||||
PluginUUID = new Guid("D3BE2A41-8F28-4055-94DC-BB6C72A0E9C4");
|
||||
if(encoding == null)
|
||||
CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
|
||||
else
|
||||
CurrentEncoding = encoding;
|
||||
if(encoding == null) CurrentEncoding = Encoding.GetEncoding("iso-8859-15");
|
||||
else CurrentEncoding = encoding;
|
||||
}
|
||||
|
||||
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
|
||||
{
|
||||
uint bootSectors = JFS_BootBlocksSize / imagePlugin.GetSectorSize();
|
||||
if(partition.Start + bootSectors >= partition.End)
|
||||
return false;
|
||||
|
||||
if(partition.Start + bootSectors >= partition.End) return false;
|
||||
|
||||
byte[] sector = imagePlugin.ReadSector(partition.Start + bootSectors);
|
||||
if(sector.Length < 512)
|
||||
return false;
|
||||
if(sector.Length < 512) return false;
|
||||
|
||||
JFS_SuperBlock jfsSb = new JFS_SuperBlock();
|
||||
IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(jfsSb));
|
||||
@@ -180,14 +172,14 @@ namespace DiscImageChef.Filesystems
|
||||
return jfsSb.s_magic == JFS_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)
|
||||
{
|
||||
information = "";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
uint bootSectors = JFS_BootBlocksSize / imagePlugin.GetSectorSize();
|
||||
byte[] sector = imagePlugin.ReadSector(partition.Start + bootSectors);
|
||||
if(sector.Length < 512)
|
||||
return;
|
||||
if(sector.Length < 512) return;
|
||||
|
||||
JFS_SuperBlock jfsSb = new JFS_SuperBlock();
|
||||
IntPtr sbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(jfsSb));
|
||||
@@ -200,59 +192,38 @@ namespace DiscImageChef.Filesystems
|
||||
sb.AppendFormat("{0} blocks of {1} bytes", jfsSb.s_size, jfsSb.s_bsize).AppendLine();
|
||||
sb.AppendFormat("{0} blocks per allocation group", jfsSb.s_agsize).AppendLine();
|
||||
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.Unicode))
|
||||
sb.AppendLine("Volume uses Unicode for directory entries");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.RemountRO))
|
||||
sb.AppendLine("Volume remounts read-only on error");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.Continue))
|
||||
sb.AppendLine("Volume continues on error");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.Panic))
|
||||
sb.AppendLine("Volume panics on error");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.UserQuota))
|
||||
sb.AppendLine("Volume has user quotas enabled");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.GroupQuota))
|
||||
sb.AppendLine("Volume has group quotas enabled");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.NoJournal))
|
||||
sb.AppendLine("Volume is not using any journal");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.Unicode)) sb.AppendLine("Volume uses Unicode for directory entries");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.RemountRO)) sb.AppendLine("Volume remounts read-only on error");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.Continue)) sb.AppendLine("Volume continues on error");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.Panic)) sb.AppendLine("Volume panics on error");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.UserQuota)) sb.AppendLine("Volume has user quotas enabled");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.GroupQuota)) sb.AppendLine("Volume has group quotas enabled");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.NoJournal)) sb.AppendLine("Volume is not using any journal");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.Discard))
|
||||
sb.AppendLine("Volume sends TRIM/UNMAP commands to underlying device");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.GroupCommit))
|
||||
sb.AppendLine("Volume commits in groups of 1");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.LazyCommit))
|
||||
sb.AppendLine("Volume commits lazy");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.Temporary))
|
||||
sb.AppendLine("Volume does not commit to log");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.InlineLog))
|
||||
sb.AppendLine("Volume has log withing itself");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.GroupCommit)) sb.AppendLine("Volume commits in groups of 1");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.LazyCommit)) sb.AppendLine("Volume commits lazy");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.Temporary)) sb.AppendLine("Volume does not commit to log");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.InlineLog)) sb.AppendLine("Volume has log withing itself");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.InlineMoving))
|
||||
sb.AppendLine("Volume has log withing itself and is moving it out");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.BadSAIT))
|
||||
sb.AppendLine("Volume has bad current secondary ait");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.Sparse))
|
||||
sb.AppendLine("Volume supports sparse files");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.DASDEnabled))
|
||||
sb.AppendLine("Volume has DASD limits enabled");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.DASDPrime))
|
||||
sb.AppendLine("Volume primes DASD on boot");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.SwapBytes))
|
||||
sb.AppendLine("Volume is in a big-endian system");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.DirIndex))
|
||||
sb.AppendLine("Volume has presistent indexes");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.Linux))
|
||||
sb.AppendLine("Volume supports Linux");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.DFS))
|
||||
sb.AppendLine("Volume supports DCE DFS LFS");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.OS2))
|
||||
sb.AppendLine("Volume supports OS/2, and is case insensitive");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.AIX))
|
||||
sb.AppendLine("Volume supports AIX");
|
||||
if(jfsSb.s_state != 0)
|
||||
sb.AppendLine("Volume is dirty");
|
||||
sb.AppendFormat("Volume was last updated on {0}", DateHandlers.UNIXUnsignedToDateTime(jfsSb.s_time.tv_sec, jfsSb.s_time.tv_nsec)).AppendLine();
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.BadSAIT)) sb.AppendLine("Volume has bad current secondary ait");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.Sparse)) sb.AppendLine("Volume supports sparse files");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.DASDEnabled)) sb.AppendLine("Volume has DASD limits enabled");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.DASDPrime)) sb.AppendLine("Volume primes DASD on boot");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.SwapBytes)) sb.AppendLine("Volume is in a big-endian system");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.DirIndex)) sb.AppendLine("Volume has presistent indexes");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.Linux)) sb.AppendLine("Volume supports Linux");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.DFS)) sb.AppendLine("Volume supports DCE DFS LFS");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.OS2)) sb.AppendLine("Volume supports OS/2, and is case insensitive");
|
||||
if(jfsSb.s_flags.HasFlag(JFS_Flags.AIX)) sb.AppendLine("Volume supports AIX");
|
||||
if(jfsSb.s_state != 0) sb.AppendLine("Volume is dirty");
|
||||
sb.AppendFormat("Volume was last updated on {0}",
|
||||
DateHandlers.UNIXUnsignedToDateTime(jfsSb.s_time.tv_sec, jfsSb.s_time.tv_nsec))
|
||||
.AppendLine();
|
||||
if(jfsSb.s_version == 1)
|
||||
sb.AppendFormat("Volume name: {0}", CurrentEncoding.GetString(jfsSb.s_fpack)).AppendLine();
|
||||
else
|
||||
sb.AppendFormat("Volume name: {0}", CurrentEncoding.GetString(jfsSb.s_label)).AppendLine();
|
||||
else sb.AppendFormat("Volume name: {0}", CurrentEncoding.GetString(jfsSb.s_label)).AppendLine();
|
||||
sb.AppendFormat("Volume UUID: {0}", jfsSb.s_uuid).AppendLine();
|
||||
|
||||
xmlFSType = new Schemas.FileSystemType();
|
||||
@@ -260,15 +231,12 @@ namespace DiscImageChef.Filesystems
|
||||
xmlFSType.Clusters = (long)jfsSb.s_size;
|
||||
xmlFSType.ClusterSize = (int)jfsSb.s_bsize;
|
||||
xmlFSType.Bootable = true;
|
||||
if(jfsSb.s_version == 1)
|
||||
xmlFSType.VolumeName = CurrentEncoding.GetString(jfsSb.s_fpack);
|
||||
else
|
||||
xmlFSType.VolumeName = CurrentEncoding.GetString(jfsSb.s_label);
|
||||
if(jfsSb.s_version == 1) xmlFSType.VolumeName = CurrentEncoding.GetString(jfsSb.s_fpack);
|
||||
else xmlFSType.VolumeName = CurrentEncoding.GetString(jfsSb.s_label);
|
||||
xmlFSType.VolumeSerial = string.Format("{0}", jfsSb.s_uuid);
|
||||
xmlFSType.ModificationDate = DateHandlers.UNIXUnsignedToDateTime(jfsSb.s_time.tv_sec, jfsSb.s_time.tv_nsec);
|
||||
xmlFSType.ModificationDateSpecified = true;
|
||||
if(jfsSb.s_state != 0)
|
||||
xmlFSType.Dirty = true;
|
||||
if(jfsSb.s_state != 0) xmlFSType.Dirty = true;
|
||||
|
||||
information = sb.ToString();
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user