mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
REFACTOR: Final cleanup of DiscImageChef.Filesystems.
This commit is contained in:
@@ -66,150 +66,39 @@ namespace DiscImageChef.Filesystems
|
||||
const int TP_BSIZE = 1024;
|
||||
|
||||
/// <summary>
|
||||
/// Dump tape header
|
||||
/// Dump tape header
|
||||
/// </summary>
|
||||
const short TS_TAPE = 1;
|
||||
/// <summary>
|
||||
/// Beginning of file record
|
||||
/// Beginning of file record
|
||||
/// </summary>
|
||||
const short TS_INODE = 2;
|
||||
/// <summary>
|
||||
/// Map of inodes on tape
|
||||
/// Map of inodes on tape
|
||||
/// </summary>
|
||||
const short TS_BITS = 3;
|
||||
/// <summary>
|
||||
/// Continuation of file record
|
||||
/// Continuation of file record
|
||||
/// </summary>
|
||||
const short TS_ADDR = 4;
|
||||
/// <summary>
|
||||
/// Map of inodes deleted since last dump
|
||||
/// Map of inodes deleted since last dump
|
||||
/// </summary>
|
||||
const short TS_END = 5;
|
||||
/// <summary>
|
||||
/// Inode bitmap
|
||||
/// Inode bitmap
|
||||
/// </summary>
|
||||
const short TS_CLRI = 6;
|
||||
const short TS_ACL = 7;
|
||||
const short TS_PCL = 8;
|
||||
|
||||
// Old 16-bit format record
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct spcl16
|
||||
{
|
||||
/// <summary>Record type</summary>
|
||||
public short c_type;
|
||||
/// <summary>Dump date</summary>
|
||||
public int c_date;
|
||||
/// <summary>Previous dump date</summary>
|
||||
public int c_ddate;
|
||||
/// <summary>Dump volume number</summary>
|
||||
public short c_volume;
|
||||
/// <summary>Logical block of this record</summary>
|
||||
public int c_tapea;
|
||||
/// <summary>Inode number</summary>
|
||||
public ushort c_inumber;
|
||||
/// <summary>Magic number</summary>
|
||||
public ushort c_magic;
|
||||
/// <summary>Record checksum</summary>
|
||||
public int c_checksum;
|
||||
// Unneeded for now
|
||||
/*
|
||||
struct dinode c_dinode;
|
||||
int c_count;
|
||||
char c_addr[BSIZE];
|
||||
*/
|
||||
}
|
||||
|
||||
// 32-bit AIX format record
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct spcl_aix
|
||||
{
|
||||
/// <summary>Record type</summary>
|
||||
public int c_type;
|
||||
/// <summary>Dump date</summary>
|
||||
public int c_date;
|
||||
/// <summary>Previous dump date</summary>
|
||||
public int c_ddate;
|
||||
/// <summary>Dump volume number</summary>
|
||||
public int c_volume;
|
||||
/// <summary>Logical block of this record</summary>
|
||||
public int c_tapea;
|
||||
public uint c_inumber;
|
||||
public uint c_magic;
|
||||
public int c_checksum;
|
||||
// Unneeded for now
|
||||
/*
|
||||
public bsd_dinode bsd_c_dinode;
|
||||
public int c_count;
|
||||
public char c_addr[TP_NINDIR];
|
||||
public int xix_flag;
|
||||
public dinode xix_dinode;
|
||||
*/
|
||||
}
|
||||
|
||||
const int TP_NINDIR = TP_BSIZE / 2;
|
||||
const int LBLSIZE = 16;
|
||||
const int NAMELEN = 64;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct s_spcl
|
||||
{
|
||||
public int c_type; /* record type (see below) */
|
||||
public int c_date; /* date of this dump */
|
||||
public int c_ddate; /* date of previous dump */
|
||||
public int c_volume; /* dump volume number */
|
||||
public int c_tapea; /* logical block of this record */
|
||||
public uint c_inumber; /* number of inode */
|
||||
public int c_magic; /* magic number (see above) */
|
||||
public int c_checksum; /* record checksum */
|
||||
public dinode c_dinode; /* ownership and mode of inode */
|
||||
public int c_count; /* number of valid c_addr entries */
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = TP_NINDIR)]
|
||||
public byte[] c_addr; /* 1 => data; 0 => hole in inode */
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LBLSIZE)] public byte[] c_label; /* dump label */
|
||||
public int c_level; /* level of this dump */
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NAMELEN)]
|
||||
public byte[] c_filesys; /* name of dumpped file system */
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NAMELEN)] public byte[] c_dev; /* name of dumpped device */
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NAMELEN)] public byte[] c_host; /* name of dumpped host */
|
||||
public int c_flags; /* additional information */
|
||||
public int c_firstrec; /* first record on volume */
|
||||
public long c_ndate; /* date of this dump */
|
||||
public long c_nddate; /* date of previous dump */
|
||||
public long c_ntapea; /* logical block of this record */
|
||||
public long c_nfirstrec; /* first record on volume */
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public int[] c_spare; /* reserved for future uses */
|
||||
}
|
||||
|
||||
const int NDADDR = 12;
|
||||
const int NIADDR = 3;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct dinode
|
||||
{
|
||||
public ushort di_mode; /* 0: IFMT, permissions; see below. */
|
||||
public short di_nlink; /* 2: File link count. */
|
||||
public int inumber; /* 4: Lfs: inode number. */
|
||||
public ulong di_size; /* 8: File byte count. */
|
||||
public int di_atime; /* 16: Last access time. */
|
||||
public int di_atimensec; /* 20: Last access time. */
|
||||
public int di_mtime; /* 24: Last modified time. */
|
||||
public int di_mtimensec; /* 28: Last modified time. */
|
||||
public int di_ctime; /* 32: Last inode change time. */
|
||||
public int di_ctimensec; /* 36: Last inode change time. */
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NDADDR)]
|
||||
public ufs_daddr_t[] di_db; /* 40: Direct disk blocks. */
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NIADDR)]
|
||||
public ufs_daddr_t[] di_ib; /* 88: Indirect disk blocks. */
|
||||
public uint di_flags; /* 100: Status flags (chflags). */
|
||||
public uint di_blocks; /* 104: Blocks actually held. */
|
||||
public int di_gen; /* 108: Generation number. */
|
||||
public uint di_uid; /* 112: File owner. */
|
||||
public uint di_gid; /* 116: File group. */
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
||||
public int[] di_spare; /* 120: Reserved; currently unused */
|
||||
}
|
||||
|
||||
public dump()
|
||||
{
|
||||
Name = "dump(8) Plugin";
|
||||
@@ -272,8 +161,7 @@ namespace DiscImageChef.Filesystems
|
||||
newHdr.c_magic == NFS_CIGAM || newHdr.c_magic == UFS2_MAGIC || newHdr.c_magic == UFS2_CIGAM;
|
||||
}
|
||||
|
||||
public override void GetInformation(ImagePlugin imagePlugin, Partition partition,
|
||||
out string information)
|
||||
public override void GetInformation(ImagePlugin imagePlugin, Partition partition, out string information)
|
||||
{
|
||||
information = "";
|
||||
if(imagePlugin.GetSectorSize() < 512) return;
|
||||
@@ -482,5 +370,116 @@ namespace DiscImageChef.Filesystems
|
||||
{
|
||||
return Errno.NotImplemented;
|
||||
}
|
||||
|
||||
// Old 16-bit format record
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct spcl16
|
||||
{
|
||||
/// <summary>Record type</summary>
|
||||
public short c_type;
|
||||
/// <summary>Dump date</summary>
|
||||
public int c_date;
|
||||
/// <summary>Previous dump date</summary>
|
||||
public int c_ddate;
|
||||
/// <summary>Dump volume number</summary>
|
||||
public short c_volume;
|
||||
/// <summary>Logical block of this record</summary>
|
||||
public int c_tapea;
|
||||
/// <summary>Inode number</summary>
|
||||
public ushort c_inumber;
|
||||
/// <summary>Magic number</summary>
|
||||
public ushort c_magic;
|
||||
/// <summary>Record checksum</summary>
|
||||
public int c_checksum;
|
||||
// Unneeded for now
|
||||
/*
|
||||
struct dinode c_dinode;
|
||||
int c_count;
|
||||
char c_addr[BSIZE];
|
||||
*/
|
||||
}
|
||||
|
||||
// 32-bit AIX format record
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct spcl_aix
|
||||
{
|
||||
/// <summary>Record type</summary>
|
||||
public int c_type;
|
||||
/// <summary>Dump date</summary>
|
||||
public int c_date;
|
||||
/// <summary>Previous dump date</summary>
|
||||
public int c_ddate;
|
||||
/// <summary>Dump volume number</summary>
|
||||
public int c_volume;
|
||||
/// <summary>Logical block of this record</summary>
|
||||
public int c_tapea;
|
||||
public uint c_inumber;
|
||||
public uint c_magic;
|
||||
public int c_checksum;
|
||||
// Unneeded for now
|
||||
/*
|
||||
public bsd_dinode bsd_c_dinode;
|
||||
public int c_count;
|
||||
public char c_addr[TP_NINDIR];
|
||||
public int xix_flag;
|
||||
public dinode xix_dinode;
|
||||
*/
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct s_spcl
|
||||
{
|
||||
public int c_type; /* record type (see below) */
|
||||
public int c_date; /* date of this dump */
|
||||
public int c_ddate; /* date of previous dump */
|
||||
public int c_volume; /* dump volume number */
|
||||
public int c_tapea; /* logical block of this record */
|
||||
public uint c_inumber; /* number of inode */
|
||||
public int c_magic; /* magic number (see above) */
|
||||
public int c_checksum; /* record checksum */
|
||||
public dinode c_dinode; /* ownership and mode of inode */
|
||||
public int c_count; /* number of valid c_addr entries */
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = TP_NINDIR)]
|
||||
public byte[] c_addr; /* 1 => data; 0 => hole in inode */
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = LBLSIZE)] public byte[] c_label; /* dump label */
|
||||
public int c_level; /* level of this dump */
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NAMELEN)]
|
||||
public byte[] c_filesys; /* name of dumpped file system */
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NAMELEN)] public byte[] c_dev; /* name of dumpped device */
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NAMELEN)] public byte[] c_host; /* name of dumpped host */
|
||||
public int c_flags; /* additional information */
|
||||
public int c_firstrec; /* first record on volume */
|
||||
public long c_ndate; /* date of this dump */
|
||||
public long c_nddate; /* date of previous dump */
|
||||
public long c_ntapea; /* logical block of this record */
|
||||
public long c_nfirstrec; /* first record on volume */
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public int[] c_spare; /* reserved for future uses */
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct dinode
|
||||
{
|
||||
public ushort di_mode; /* 0: IFMT, permissions; see below. */
|
||||
public short di_nlink; /* 2: File link count. */
|
||||
public int inumber; /* 4: Lfs: inode number. */
|
||||
public ulong di_size; /* 8: File byte count. */
|
||||
public int di_atime; /* 16: Last access time. */
|
||||
public int di_atimensec; /* 20: Last access time. */
|
||||
public int di_mtime; /* 24: Last modified time. */
|
||||
public int di_mtimensec; /* 28: Last modified time. */
|
||||
public int di_ctime; /* 32: Last inode change time. */
|
||||
public int di_ctimensec; /* 36: Last inode change time. */
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NDADDR)]
|
||||
public ufs_daddr_t[] di_db; /* 40: Direct disk blocks. */
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NIADDR)]
|
||||
public ufs_daddr_t[] di_ib; /* 88: Indirect disk blocks. */
|
||||
public uint di_flags; /* 100: Status flags (chflags). */
|
||||
public uint di_blocks; /* 104: Blocks actually held. */
|
||||
public int di_gen; /* 108: Generation number. */
|
||||
public uint di_uid; /* 112: File owner. */
|
||||
public uint di_gid; /* 116: File group. */
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
||||
public int[] di_spare; /* 120: Reserved; currently unused */
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user