mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Code cleanup.
This commit is contained in:
@@ -42,23 +42,23 @@ namespace DiscImageChef.Filesystems
|
||||
{
|
||||
public class F2FS : IFilesystem
|
||||
{
|
||||
const uint F2FS_MAGIC = 0xF2F52010;
|
||||
const uint F2FS_MAGIC = 0xF2F52010;
|
||||
const uint F2FS_SUPER_OFFSET = 1024;
|
||||
const uint F2FS_MIN_SECTOR = 512;
|
||||
const uint F2FS_MAX_SECTOR = 4096;
|
||||
const uint F2FS_BLOCK_SIZE = 4096;
|
||||
const uint F2FS_MIN_SECTOR = 512;
|
||||
const uint F2FS_MAX_SECTOR = 4096;
|
||||
const uint F2FS_BLOCK_SIZE = 4096;
|
||||
|
||||
public FileSystemType XmlFsType { get; private set; }
|
||||
public Encoding Encoding { get; private set; }
|
||||
public string Name => "F2FS Plugin";
|
||||
public Guid Id => new Guid("82B0920F-5F0D-4063-9F57-ADE0AE02ECE5");
|
||||
public Encoding Encoding { get; private set; }
|
||||
public string Name => "F2FS Plugin";
|
||||
public Guid Id => new Guid("82B0920F-5F0D-4063-9F57-ADE0AE02ECE5");
|
||||
|
||||
public bool Identify(IMediaImage imagePlugin, Partition partition)
|
||||
{
|
||||
if(imagePlugin.Info.SectorSize < F2FS_MIN_SECTOR || imagePlugin.Info.SectorSize > F2FS_MAX_SECTOR)
|
||||
return false;
|
||||
|
||||
uint sbAddr = F2FS_SUPER_OFFSET / imagePlugin.Info.SectorSize;
|
||||
uint sbAddr = F2FS_SUPER_OFFSET / imagePlugin.Info.SectorSize;
|
||||
if(sbAddr == 0) sbAddr = 1;
|
||||
|
||||
F2FS_Superblock f2fsSb = new F2FS_Superblock();
|
||||
@@ -80,13 +80,13 @@ namespace DiscImageChef.Filesystems
|
||||
}
|
||||
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
|
||||
Encoding encoding)
|
||||
Encoding encoding)
|
||||
{
|
||||
Encoding = Encoding.Unicode;
|
||||
Encoding = Encoding.Unicode;
|
||||
information = "";
|
||||
if(imagePlugin.Info.SectorSize < F2FS_MIN_SECTOR || imagePlugin.Info.SectorSize > F2FS_MAX_SECTOR) return;
|
||||
|
||||
uint sbAddr = F2FS_SUPER_OFFSET / imagePlugin.Info.SectorSize;
|
||||
uint sbAddr = F2FS_SUPER_OFFSET / imagePlugin.Info.SectorSize;
|
||||
if(sbAddr == 0) sbAddr = 1;
|
||||
|
||||
F2FS_Superblock f2fsSb = new F2FS_Superblock();
|
||||
@@ -110,7 +110,7 @@ namespace DiscImageChef.Filesystems
|
||||
sb.AppendFormat("Version {0}.{1}", f2fsSb.major_ver, f2fsSb.minor_ver).AppendLine();
|
||||
sb.AppendFormat("{0} bytes per sector", 1 << (int)f2fsSb.log_sectorsize).AppendLine();
|
||||
sb.AppendFormat("{0} sectors ({1} bytes) per block", 1 << (int)f2fsSb.log_sectors_per_block,
|
||||
1 << (int)f2fsSb.log_blocksize).AppendLine();
|
||||
1 << (int)f2fsSb.log_blocksize).AppendLine();
|
||||
sb.AppendFormat("{0} blocks per segment", f2fsSb.log_blocks_per_seg).AppendLine();
|
||||
sb.AppendFormat("{0} blocks in volume", f2fsSb.block_count).AppendLine();
|
||||
sb.AppendFormat("{0} segments per section", f2fsSb.segs_per_sec).AppendLine();
|
||||
@@ -130,13 +130,13 @@ namespace DiscImageChef.Filesystems
|
||||
|
||||
XmlFsType = new FileSystemType
|
||||
{
|
||||
Type = "F2FS filesystem",
|
||||
SystemIdentifier = Encoding.ASCII.GetString(f2fsSb.version),
|
||||
Clusters = (long)f2fsSb.block_count,
|
||||
ClusterSize = 1 << (int)f2fsSb.log_blocksize,
|
||||
Type = "F2FS filesystem",
|
||||
SystemIdentifier = Encoding.ASCII.GetString(f2fsSb.version),
|
||||
Clusters = (long)f2fsSb.block_count,
|
||||
ClusterSize = 1 << (int)f2fsSb.log_blocksize,
|
||||
DataPreparerIdentifier = Encoding.ASCII.GetString(f2fsSb.init_version),
|
||||
VolumeName = StringHandlers.CToString(f2fsSb.volume_name, Encoding.Unicode, true),
|
||||
VolumeSerial = f2fsSb.uuid.ToString()
|
||||
VolumeName = StringHandlers.CToString(f2fsSb.volume_name, Encoding.Unicode, true),
|
||||
VolumeSerial = f2fsSb.uuid.ToString()
|
||||
};
|
||||
}
|
||||
|
||||
@@ -144,51 +144,64 @@ namespace DiscImageChef.Filesystems
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
struct F2FS_Superblock
|
||||
{
|
||||
public uint magic;
|
||||
public uint magic;
|
||||
public ushort major_ver;
|
||||
public ushort minor_ver;
|
||||
public uint log_sectorsize;
|
||||
public uint log_sectors_per_block;
|
||||
public uint log_blocksize;
|
||||
public uint log_blocks_per_seg;
|
||||
public uint segs_per_sec;
|
||||
public uint secs_per_zone;
|
||||
public uint checksum_offset;
|
||||
public ulong block_count;
|
||||
public uint section_count;
|
||||
public uint segment_count;
|
||||
public uint segment_count_ckpt;
|
||||
public uint segment_count_sit;
|
||||
public uint segment_count_nat;
|
||||
public uint segment_count_ssa;
|
||||
public uint segment_count_main;
|
||||
public uint segment0_blkaddr;
|
||||
public uint cp_blkaddr;
|
||||
public uint sit_blkaddr;
|
||||
public uint nat_blkaddr;
|
||||
public uint ssa_blkaddr;
|
||||
public uint main_blkaddr;
|
||||
public uint root_ino;
|
||||
public uint node_ino;
|
||||
public uint meta_ino;
|
||||
public Guid uuid;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1024)] public byte[] volume_name;
|
||||
public uint log_sectorsize;
|
||||
public uint log_sectors_per_block;
|
||||
public uint log_blocksize;
|
||||
public uint log_blocks_per_seg;
|
||||
public uint segs_per_sec;
|
||||
public uint secs_per_zone;
|
||||
public uint checksum_offset;
|
||||
public ulong block_count;
|
||||
public uint section_count;
|
||||
public uint segment_count;
|
||||
public uint segment_count_ckpt;
|
||||
public uint segment_count_sit;
|
||||
public uint segment_count_nat;
|
||||
public uint segment_count_ssa;
|
||||
public uint segment_count_main;
|
||||
public uint segment0_blkaddr;
|
||||
public uint cp_blkaddr;
|
||||
public uint sit_blkaddr;
|
||||
public uint nat_blkaddr;
|
||||
public uint ssa_blkaddr;
|
||||
public uint main_blkaddr;
|
||||
public uint root_ino;
|
||||
public uint node_ino;
|
||||
public uint meta_ino;
|
||||
public Guid uuid;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1024)]
|
||||
public byte[] volume_name;
|
||||
public uint extension_count;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] extension_list1;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] extension_list2;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] extension_list3;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] extension_list4;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] extension_list5;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] extension_list6;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] extension_list7;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] extension_list8;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
|
||||
public byte[] extension_list1;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
|
||||
public byte[] extension_list2;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
|
||||
public byte[] extension_list3;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
|
||||
public byte[] extension_list4;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
|
||||
public byte[] extension_list5;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
|
||||
public byte[] extension_list6;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
|
||||
public byte[] extension_list7;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
|
||||
public byte[] extension_list8;
|
||||
public uint cp_payload;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] version;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] init_version;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)]
|
||||
public byte[] version;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)]
|
||||
public byte[] init_version;
|
||||
public uint feature;
|
||||
public byte encryption_level;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] encrypt_pw_salt;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 871)] public byte[] reserved;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public byte[] encrypt_pw_salt;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 871)]
|
||||
public byte[] reserved;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user