diff --git a/DiscImageChef.Filesystems/AppleHFS.cs b/DiscImageChef.Filesystems/AppleHFS.cs index e60daf7b..6f602a2b 100644 --- a/DiscImageChef.Filesystems/AppleHFS.cs +++ b/DiscImageChef.Filesystems/AppleHFS.cs @@ -49,12 +49,19 @@ namespace DiscImageChef.Plugins { class AppleHFS : Plugin { + /// + /// "BD", HFS magic + /// const UInt16 HFS_MAGIC = 0x4244; - // "BD" + /// + /// "H+", HFS+ magic + /// const UInt16 HFSP_MAGIC = 0x482B; - // "H+" + /// + /// "LK", HFS bootblock magic + /// const UInt16 HFSBB_MAGIC = 0x4C4B; - // "LK" + public AppleHFS() { Name = "Apple Hierarchical File System"; @@ -405,128 +412,133 @@ namespace DiscImageChef.Plugins return sector; } + /// + /// Master Directory Block, should be sector 2 in volume + /// struct HFS_MasterDirectoryBlock // Should be sector 2 in volume { + /// 0x000, Signature, 0x4244 public UInt16 drSigWord; - // 0x000, Signature, 0x4244 + /// 0x002, Volume creation date public UInt32 drCrDate; - // 0x002, Volume creation date + /// 0x006, Volume last modification date public UInt32 drLsMod; - // 0x006, Volume last modification date + /// 0x00A, Volume attributes public UInt16 drAtrb; - // 0x00A, Volume attributes + /// 0x00C, Files in root directory public UInt16 drNmFls; - // 0x00C, Files in root directory + /// 0x00E, Start 512-byte sector of volume bitmap public UInt16 drVBMSt; - // 0x00E, Start 512-byte sector of volume bitmap + /// 0x010, Allocation block to begin next allocation public UInt16 drAllocPtr; - // 0x010, Allocation block to begin next allocation + /// 0x012, Allocation blocks public UInt16 drNmAlBlks; - // 0x012, Allocation blocks + /// 0x014, Bytes per allocation block public UInt32 drAlBlkSiz; - // 0x014, Bytes per allocation block + /// 0x018, Bytes to allocate when extending a file public UInt32 drClpSiz; - // 0x018, Bytes to allocate when extending a file + /// 0x01C, Start 512-byte sector of first allocation block public UInt16 drAlBlSt; - // 0x01C, Start 512-byte sector of first allocation block + /// 0x01E, CNID for next file public UInt32 drNxtCNID; - // 0x01E, CNID for next file + /// 0x022, Free allocation blocks public UInt16 drFreeBks; - // 0x022, Free allocation blocks + /// 0x024, Volume name (28 bytes) public string drVN; - // 0x024, Volume name (28 bytes) + /// 0x040, Volume last backup time public UInt32 drVolBkUp; - // 0x040, Volume last backup time + /// 0x044, Volume backup sequence number public UInt16 drVSeqNum; - // 0x044, Volume backup sequence number + /// 0x046, Filesystem write count public UInt32 drWrCnt; - // 0x046, Filesystem write count + /// 0x04A, Bytes to allocate when extending the extents B-Tree public UInt32 drXTClpSiz; - // 0x04A, Bytes to allocate when extending the extents B-Tree + /// 0x04E, Bytes to allocate when extending the catalog B-Tree public UInt32 drCTClpSiz; - // 0x04E, Bytes to allocate when extending the catalog B-Tree + /// 0x052, Number of directories in root directory public UInt16 drNmRtDirs; - // 0x052, Number of directories in root directory + /// 0x054, Number of files in the volume public UInt32 drFilCnt; - // 0x054, Number of files in the volume + /// 0x058, Number of directories in the volume public UInt32 drDirCnt; - // 0x058, Number of directories in the volume + /// 0x05C, finderInfo[0], CNID for bootable system's directory public UInt32 drFndrInfo0; - // 0x05C, finderInfo[0], CNID for bootable system's directory + /// 0x060, finderInfo[1], CNID of the directory containing the boot application public UInt32 drFndrInfo1; - // 0x060, finderInfo[1], CNID of the directory containing the boot application + /// 0x064, finderInfo[2], CNID of the directory that should be opened on boot public UInt32 drFndrInfo2; - // 0x064, finderInfo[2], CNID of the directory that should be opened on boot + /// 0x068, finderInfo[3], CNID for Mac OS 8 or 9 directory public UInt32 drFndrInfo3; - // 0x068, finderInfo[3], CNID for Mac OS 8 or 9 directory + /// 0x06C, finderInfo[4], Reserved public UInt32 drFndrInfo4; - // 0x06C, finderInfo[4], Reserved + /// 0x070, finderInfo[5], CNID for Mac OS X directory public UInt32 drFndrInfo5; - // 0x070, finderInfo[5], CNID for Mac OS X directory + /// 0x074, finderInfo[6], first part of Mac OS X volume ID public UInt32 drFndrInfo6; - // 0x074, finderInfo[6], first part of Mac OS X volume ID + /// 0x078, finderInfo[7], second part of Mac OS X volume ID public UInt32 drFndrInfo7; - // 0x078, finderInfo[7], second part of Mac OS X volume ID // If wrapping HFS+ + /// 0x07C, Embedded volume signature, "H+" if HFS+ is embedded ignore following two fields if not public UInt16 drEmbedSigWord; - // 0x07C, Embedded volume signature, "H+" if HFS+ is embedded ignore following two fields if not + /// 0x07E, Starting block number of embedded HFS+ volume public UInt16 xdrStABNt; - // 0x07E, Starting block number of embedded HFS+ volume + /// 0x080, Allocation blocks used by embedded volume public UInt16 xdrNumABlks; - // 0x080, Allocation blocks used by embedded volume // If not + /// 0x07C, Size in blocks of volume cache public UInt16 drVCSize; - // 0x07C, Size in blocks of volume cache + /// 0x07E, Size in blocks of volume bitmap cache public UInt16 drVBMCSize; - // 0x07E, Size in blocks of volume bitmap cache + /// 0x080, Size in blocks of volume common cache public UInt16 drCtlCSize; - // 0x080, Size in blocks of volume common cache // End of variable variables :D + /// 0x082, Bytes in the extents B-Tree + /// 3 HFS extents following, 32 bits each public UInt32 drXTFlSize; - // 0x082, Bytes in the extents B-Tree - // 3 HFS extents following, 32 bits each + /// 0x092, Bytes in the catalog B-Tree + /// 3 HFS extents following, 32 bits each public UInt32 drCTFlSize; - // 0x092, Bytes in the catalog B-Tree - // 3 HFS extents following, 32 bits each } + /// + /// Should be sectors 0 and 1 in volume, followed by boot code + /// struct HFS_BootBlock // Should be sectors 0 and 1 in volume { + /// 0x000, Signature, 0x4C4B if bootable public UInt16 signature; - // 0x000, Signature, 0x4C4B if bootable + /// 0x002, Branch public UInt32 branch; - // 0x002, Branch + /// 0x006, Boot block flags public byte boot_flags; - // 0x006, Boot block flags + /// 0x007, Boot block version public byte boot_version; - // 0x007, Boot block version + /// 0x008, Allocate secondary buffers public Int16 sec_sv_pages; - // 0x008, Allocate secondary buffers + /// 0x00A, System file name (16 bytes) public string system_name; - // 0x00A, System file name (16 bytes) + /// 0x01A, Finder file name (16 bytes) public string finder_name; - // 0x01A, Finder file name (16 bytes) + /// 0x02A, Debugger file name (16 bytes) public string debug_name; - // 0x02A, Debugger file name (16 bytes) + /// 0x03A, Disassembler file name (16 bytes) public string disasm_name; - // 0x03A, Disassembler file name (16 bytes) + /// 0x04A, Startup screen file name (16 bytes) public string stupscr_name; - // 0x04A, Startup screen file name (16 bytes) + /// 0x05A, First program to execute on boot (16 bytes) public string bootup_name; - // 0x05A, First program to execute on boot (16 bytes) + /// 0x06A, Clipboard file name (16 bytes) public string clipbrd_name; - // 0x06A, Clipboard file name (16 bytes) + /// 0x07A, 1/4 of maximum opened at a time files public UInt16 max_files; - // 0x07A, 1/4 of maximum opened at a time files + /// 0x07C, Event queue size public UInt16 queue_size; - // 0x07C, Event queue size + /// 0x07E, Heap size on a Mac with 128KiB of RAM public UInt32 heap_128k; - // 0x07E, Heap size on a Mac with 128KiB of RAM + /// 0x082, Heap size on a Mac with 256KiB of RAM public UInt32 heap_256k; - // 0x082, Heap size on a Mac with 256KiB of RAM + /// 0x086, Heap size on a Mac with 512KiB of RAM or more public UInt32 heap_512k; - // 0x086, Heap size on a Mac with 512KiB of RAM or more } - // Follows boot code } } diff --git a/DiscImageChef.Filesystems/AppleHFSPlus.cs b/DiscImageChef.Filesystems/AppleHFSPlus.cs index cc405d15..81c0aff7 100644 --- a/DiscImageChef.Filesystems/AppleHFSPlus.cs +++ b/DiscImageChef.Filesystems/AppleHFSPlus.cs @@ -45,12 +45,19 @@ namespace DiscImageChef.Plugins { class AppleHFSPlus : Plugin { + /// + /// "BD", HFS magic + /// const UInt16 HFS_MAGIC = 0x4244; - // "BD" + /// + /// "H+", HFS+ magic + /// const UInt16 HFSP_MAGIC = 0x482B; - // "H+" + /// + /// "HX", HFSX magic + /// const UInt16 HFSX_MAGIC = 0x4858; - // "HX" + public AppleHFSPlus() { Name = "Apple HFS+ filesystem"; @@ -66,26 +73,26 @@ namespace DiscImageChef.Plugins UInt16 xdrStABNt; UInt16 drAlBlSt; UInt32 drAlBlkSiz; - + byte[] vh_sector; ulong hfsp_offset; vh_sector = imagePlugin.ReadSector(2 + partitionStart); // Read volume header, of HFS Wrapper MDB - + drSigWord = BigEndianBitConverter.ToUInt16(vh_sector, 0); // Check for HFS Wrapper MDB - + if (drSigWord == HFS_MAGIC) // "BD" { drSigWord = BigEndianBitConverter.ToUInt16(vh_sector, 0x07C); // Read embedded HFS+ signature - + if (drSigWord == HFSP_MAGIC) // "H+" { xdrStABNt = BigEndianBitConverter.ToUInt16(vh_sector, 0x07E); // Starting block number of embedded HFS+ volume - + drAlBlkSiz = BigEndianBitConverter.ToUInt32(vh_sector, 0x014); // Block size - + drAlBlSt = BigEndianBitConverter.ToUInt16(vh_sector, 0x01C); // Start of allocated blocks (in 512-byte/block) - + hfsp_offset = (drAlBlSt + xdrStABNt * (drAlBlkSiz / 512)) * (imagePlugin.GetSectorSize() / 512); } else @@ -97,9 +104,9 @@ namespace DiscImageChef.Plugins { hfsp_offset = 0; } - + vh_sector = imagePlugin.ReadSector(2 + partitionStart + hfsp_offset); // Read volume header - + drSigWord = BigEndianBitConverter.ToUInt16(vh_sector, 0); if (drSigWord == HFSP_MAGIC || drSigWord == HFSX_MAGIC) return true; @@ -109,25 +116,25 @@ namespace DiscImageChef.Plugins public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information) { information = ""; - + UInt16 drSigWord; UInt16 xdrStABNt; UInt16 drAlBlSt; UInt32 drAlBlkSiz; HFSPlusVolumeHeader HPVH = new HFSPlusVolumeHeader(); - + ulong hfsp_offset; bool wrapped; byte[] vh_sector; - + vh_sector = imagePlugin.ReadSector(2 + partitionStart); // Read volume header, of HFS Wrapper MDB drSigWord = BigEndianBitConverter.ToUInt16(vh_sector, 0); // Check for HFS Wrapper MDB - + if (drSigWord == HFS_MAGIC) // "BD" { drSigWord = BigEndianBitConverter.ToUInt16(vh_sector, 0x07C); // Read embedded HFS+ signature - + if (drSigWord == HFSP_MAGIC) // "H+" { xdrStABNt = BigEndianBitConverter.ToUInt16(vh_sector, 0x07E); // Starting block number of embedded HFS+ volume @@ -150,9 +157,9 @@ namespace DiscImageChef.Plugins hfsp_offset = 0; wrapped = false; } - + vh_sector = imagePlugin.ReadSector(2 + partitionStart + hfsp_offset); // Read volume header - + HPVH.signature = BigEndianBitConverter.ToUInt16(vh_sector, 0x000); if (HPVH.signature == HFSP_MAGIC || HPVH.signature == HFSX_MAGIC) { @@ -164,33 +171,33 @@ namespace DiscImageChef.Plugins sb.AppendLine("HFSX filesystem."); if (wrapped) sb.AppendLine("Volume is wrapped inside an HFS volume."); - + HPVH.version = BigEndianBitConverter.ToUInt16(vh_sector, 0x002); - + if (HPVH.version == 4 || HPVH.version == 5) { HPVH.attributes = BigEndianBitConverter.ToUInt32(vh_sector, 0x004); byte[] lastMountedVersion_b = new byte[4]; Array.Copy(vh_sector, 0x008, lastMountedVersion_b, 0, 4); - HPVH.lastMountedVersion = Encoding.ASCII.GetString(lastMountedVersion_b); - HPVH.journalInfoBlock = BigEndianBitConverter.ToUInt32(vh_sector, 0x00C); + HPVH.lastMountedVersion = Encoding.ASCII.GetString(lastMountedVersion_b); + HPVH.journalInfoBlock = BigEndianBitConverter.ToUInt32(vh_sector, 0x00C); - HPVH.createDate = BigEndianBitConverter.ToUInt32(vh_sector, 0x010); - HPVH.modifyDate = BigEndianBitConverter.ToUInt32(vh_sector, 0x018); - HPVH.backupDate = BigEndianBitConverter.ToUInt32(vh_sector, 0x020); - HPVH.checkedDate = BigEndianBitConverter.ToUInt32(vh_sector, 0x028); + HPVH.createDate = BigEndianBitConverter.ToUInt32(vh_sector, 0x010); + HPVH.modifyDate = BigEndianBitConverter.ToUInt32(vh_sector, 0x018); + HPVH.backupDate = BigEndianBitConverter.ToUInt32(vh_sector, 0x020); + HPVH.checkedDate = BigEndianBitConverter.ToUInt32(vh_sector, 0x028); - HPVH.fileCount = BigEndianBitConverter.ToUInt32(vh_sector, 0x030); - HPVH.folderCount = BigEndianBitConverter.ToUInt32(vh_sector, 0x034); + HPVH.fileCount = BigEndianBitConverter.ToUInt32(vh_sector, 0x030); + HPVH.folderCount = BigEndianBitConverter.ToUInt32(vh_sector, 0x034); - HPVH.blockSize = BigEndianBitConverter.ToUInt32(vh_sector, 0x038); - HPVH.totalBlocks = BigEndianBitConverter.ToUInt32(vh_sector, 0x03C); - HPVH.freeBlocks = BigEndianBitConverter.ToUInt32(vh_sector, 0x040); + HPVH.blockSize = BigEndianBitConverter.ToUInt32(vh_sector, 0x038); + HPVH.totalBlocks = BigEndianBitConverter.ToUInt32(vh_sector, 0x03C); + HPVH.freeBlocks = BigEndianBitConverter.ToUInt32(vh_sector, 0x040); - HPVH.nextAllocation = BigEndianBitConverter.ToUInt32(vh_sector, 0x044); - HPVH.rsrcClumpSize = BigEndianBitConverter.ToUInt32(vh_sector, 0x048); - HPVH.dataClumpSize = BigEndianBitConverter.ToUInt32(vh_sector, 0x04C); - HPVH.nextCatalogID = BigEndianBitConverter.ToUInt32(vh_sector, 0x050); + HPVH.nextAllocation = BigEndianBitConverter.ToUInt32(vh_sector, 0x044); + HPVH.rsrcClumpSize = BigEndianBitConverter.ToUInt32(vh_sector, 0x048); + HPVH.dataClumpSize = BigEndianBitConverter.ToUInt32(vh_sector, 0x04C); + HPVH.nextCatalogID = BigEndianBitConverter.ToUInt32(vh_sector, 0x050); HPVH.writeCount = BigEndianBitConverter.ToUInt32(vh_sector, 0x054); @@ -201,13 +208,13 @@ namespace DiscImageChef.Plugins HPVH.drFndrInfo5 = BigEndianBitConverter.ToUInt32(vh_sector, 0x074); HPVH.drFndrInfo6 = BigEndianBitConverter.ToUInt32(vh_sector, 0x078); HPVH.drFndrInfo7 = BigEndianBitConverter.ToUInt32(vh_sector, 0x07C); - + HPVH.allocationFile_logicalSize = BigEndianBitConverter.ToUInt64(vh_sector, 0x080); HPVH.extentsFile_logicalSize = BigEndianBitConverter.ToUInt64(vh_sector, 0x0D0); HPVH.catalogFile_logicalSize = BigEndianBitConverter.ToUInt64(vh_sector, 0x120); HPVH.attributesFile_logicalSize = BigEndianBitConverter.ToUInt64(vh_sector, 0x170); HPVH.startupFile_logicalSize = BigEndianBitConverter.ToUInt64(vh_sector, 0x1C0); - + sb.AppendFormat("Filesystem version is {0}.", HPVH.version).AppendLine(); if ((HPVH.attributes & 0x80) == 0x80) @@ -294,271 +301,274 @@ namespace DiscImageChef.Plugins sb.AppendFormat("Filesystem version is {0}.", HPVH.version).AppendLine(); sb.AppendLine("This version is not supported yet."); } - + information = sb.ToString(); } else return; } - // Size = 532 bytes - struct HFSPlusVolumeHeader // Should be offset 0x0400 bytes in volume + + /// + /// HFS+ Volume Header, should be at offset 0x0400 bytes in volume with a size of 532 bytes + /// + struct HFSPlusVolumeHeader { + /// 0x000, "H+" for HFS+, "HX" for HFSX public UInt16 signature; - // 0x000, "H+" for HFS+, "HX" for HFSX + /// 0x002, 4 for HFS+, 5 for HFSX public UInt16 version; - // 0x002, 4 for HFS+, 5 for HFSX + /// 0x004, Volume attributes public UInt32 attributes; - // 0x004, Volume attributes + /// 0x008, Implementation that last mounted the volume. + /// Reserved by Apple: + /// "8.10" Mac OS 8.1 to 9.2.2 + /// "10.0" Mac OS X + /// "HFSJ" Journaled implementation + /// "fsck" /sbin/fsck public string lastMountedVersion; - // 0x008, Implementation that last mounted the volume. - // Reserved by Apple: - // "8.10" Mac OS 8.1 to 9.2.2 - // "10.0" Mac OS X - // "HFSJ" Journaled implementation - // "fsck" /sbin/fsck + /// 0x00C, Allocation block number containing the journal public UInt32 journalInfoBlock; - // 0x00C, Allocation block number containing the journal + /// 0x010, Date of volume creation public ulong createDate; - // 0x010, Date of volume creation + /// 0x018, Date of last volume modification public ulong modifyDate; - // 0x018, Date of last volume modification + /// 0x020, Date of last backup public ulong backupDate; - // 0x020, Date of last backup + /// 0x028, Date of last consistency check public ulong checkedDate; - // 0x028, Date of last consistency check + /// 0x030, File on the volume public UInt32 fileCount; - // 0x030, File on the volume + /// 0x034, Folders on the volume public UInt32 folderCount; - // 0x034, Folders on the volume + /// 0x038, Bytes per allocation block public UInt32 blockSize; - // 0x038, Bytes per allocation block + /// 0x03C, Allocation blocks on the volume public UInt32 totalBlocks; - // 0x03C, Allocation blocks on the volume + /// 0x040, Free allocation blocks public UInt32 freeBlocks; - // 0x040, Free allocation blocks + /// 0x044, Hint for next allocation block public UInt32 nextAllocation; - // 0x044, Hint for next allocation block + /// 0x048, Resource fork clump size public UInt32 rsrcClumpSize; - // 0x048, Resource fork clump size + /// 0x04C, Data fork clump size public UInt32 dataClumpSize; - // 0x04C, Data fork clump size + /// 0x050, Next unused CNID public UInt32 nextCatalogID; - // 0x050, Next unused CNID + /// 0x054, Times that the volume has been mounted writable public UInt32 writeCount; - // 0x054, Times that the volume has been mounted writable + /// 0x058, Used text encoding hints public UInt64 encodingsBitmap; - // 0x058, Used text encoding hints + /// 0x060, finderInfo[0], CNID for bootable system's directory public UInt32 drFndrInfo0; - // 0x060, finderInfo[0], CNID for bootable system's directory + /// 0x064, finderInfo[1], CNID of the directory containing the boot application public UInt32 drFndrInfo1; - // 0x064, finderInfo[1], CNID of the directory containing the boot application + /// 0x068, finderInfo[2], CNID of the directory that should be opened on boot public UInt32 drFndrInfo2; - // 0x068, finderInfo[2], CNID of the directory that should be opened on boot + /// 0x06C, finderInfo[3], CNID for Mac OS 8 or 9 directory public UInt32 drFndrInfo3; - // 0x06C, finderInfo[3], CNID for Mac OS 8 or 9 directory + /// 0x070, finderInfo[4], Reserved public UInt32 drFndrInfo4; - // 0x070, finderInfo[4], Reserved + /// 0x074, finderInfo[5], CNID for Mac OS X directory public UInt32 drFndrInfo5; - // 0x074, finderInfo[5], CNID for Mac OS X directory + /// 0x078, finderInfo[6], first part of Mac OS X volume ID public UInt32 drFndrInfo6; - // 0x078, finderInfo[6], first part of Mac OS X volume ID + /// 0x07C, finderInfo[7], second part of Mac OS X volume ID public UInt32 drFndrInfo7; - // 0x07C, finderInfo[7], second part of Mac OS X volume ID // HFSPlusForkData allocationFile; + /// 0x080 public UInt64 allocationFile_logicalSize; - // 0x080 + /// 0x088 public UInt32 allocationFile_clumpSize; - // 0x088 + /// 0x08C public UInt32 allocationFile_totalBlocks; - // 0x08C + /// 0x090 public UInt32 allocationFile_extents_startBlock0; - // 0x090 + /// 0x094 public UInt32 allocationFile_extents_blockCount0; - // 0x094 + /// 0x098 public UInt32 allocationFile_extents_startBlock1; - // 0x098 + /// 0x09C public UInt32 allocationFile_extents_blockCount1; - // 0x09C + /// 0x0A0 public UInt32 allocationFile_extents_startBlock2; - // 0x0A0 + /// 0x0A4 public UInt32 allocationFile_extents_blockCount2; - // 0x0A4 + /// 0x0A8 public UInt32 allocationFile_extents_startBlock3; - // 0x0A8 + /// 0x0AC public UInt32 allocationFile_extents_blockCount3; - // 0x0AC + /// 0x0B0 public UInt32 allocationFile_extents_startBlock4; - // 0x0B0 + /// 0x0B4 public UInt32 allocationFile_extents_blockCount4; - // 0x0B4 + /// 0x0B8 public UInt32 allocationFile_extents_startBlock5; - // 0x0B8 + /// 0x0BC public UInt32 allocationFile_extents_blockCount5; - // 0x0BC + /// 0x0C0 public UInt32 allocationFile_extents_startBlock6; - // 0x0C0 + /// 0x0C4 public UInt32 allocationFile_extents_blockCount6; - // 0x0C4 + /// 0x0C8 public UInt32 allocationFile_extents_startBlock7; - // 0x0C8 + /// 0x0CC public UInt32 allocationFile_extents_blockCount7; - // 0x0CC // HFSPlusForkData extentsFile; + /// 0x0D0 public UInt64 extentsFile_logicalSize; - // 0x0D0 + /// 0x0D8 public UInt32 extentsFile_clumpSize; - // 0x0D8 + /// 0x0DC public UInt32 extentsFile_totalBlocks; - // 0x0DC + /// 0x0E0 public UInt32 extentsFile_extents_startBlock0; - // 0x0E0 + /// 0x0E4 public UInt32 extentsFile_extents_blockCount0; - // 0x0E4 + /// 0x0E8 public UInt32 extentsFile_extents_startBlock1; - // 0x0E8 + /// 0x0EC public UInt32 extentsFile_extents_blockCount1; - // 0x0EC + /// 0x0F0 public UInt32 extentsFile_extents_startBlock2; - // 0x0F0 + /// 0x0F4 public UInt32 extentsFile_extents_blockCount2; - // 0x0F4 + /// 0x0F8 public UInt32 extentsFile_extents_startBlock3; - // 0x0F8 + /// 0x0FC public UInt32 extentsFile_extents_blockCount3; - // 0x0FC + /// 0x100 public UInt32 extentsFile_extents_startBlock4; - // 0x100 + /// 0x104 public UInt32 extentsFile_extents_blockCount4; - // 0x104 + /// 0x108 public UInt32 extentsFile_extents_startBlock5; - // 0x108 + /// 0x10C public UInt32 extentsFile_extents_blockCount5; - // 0x10C + /// 0x110 public UInt32 extentsFile_extents_startBlock6; - // 0x110 + /// 0x114 public UInt32 extentsFile_extents_blockCount6; - // 0x114 + /// 0x118 public UInt32 extentsFile_extents_startBlock7; - // 0x118 + /// 0x11C public UInt32 extentsFile_extents_blockCount7; - // 0x11C // HFSPlusForkData catalogFile; + /// 0x120 public UInt64 catalogFile_logicalSize; - // 0x120 + /// 0x128 public UInt32 catalogFile_clumpSize; - // 0x128 + /// 0x12C public UInt32 catalogFile_totalBlocks; - // 0x12C + /// 0x130 public UInt32 catalogFile_extents_startBlock0; - // 0x130 + /// 0x134 public UInt32 catalogFile_extents_blockCount0; - // 0x134 + /// 0x138 public UInt32 catalogFile_extents_startBlock1; - // 0x138 + /// 0x13C public UInt32 catalogFile_extents_blockCount1; - // 0x13C + /// 0x140 public UInt32 catalogFile_extents_startBlock2; - // 0x140 + /// 0x144 public UInt32 catalogFile_extents_blockCount2; - // 0x144 + /// 0x148 public UInt32 catalogFile_extents_startBlock3; - // 0x148 + /// 0x14C public UInt32 catalogFile_extents_blockCount3; - // 0x14C + /// 0x150 public UInt32 catalogFile_extents_startBlock4; - // 0x150 + /// 0x154 public UInt32 catalogFile_extents_blockCount4; - // 0x154 + /// 0x158 public UInt32 catalogFile_extents_startBlock5; - // 0x158 + /// 0x15C public UInt32 catalogFile_extents_blockCount5; - // 0x15C + /// 0x160 public UInt32 catalogFile_extents_startBlock6; - // 0x160 + /// 0x164 public UInt32 catalogFile_extents_blockCount6; - // 0x164 + /// 0x168 public UInt32 catalogFile_extents_startBlock7; - // 0x168 + /// 0x16C public UInt32 catalogFile_extents_blockCount7; - // 0x16C // HFSPlusForkData attributesFile; + /// 0x170 public UInt64 attributesFile_logicalSize; - // 0x170 + /// 0x178 public UInt32 attributesFile_clumpSize; - // 0x178 + /// 0x17C public UInt32 attributesFile_totalBlocks; - // 0x17C + /// 0x180 public UInt32 attributesFile_extents_startBlock0; - // 0x180 + /// 0x184 public UInt32 attributesFile_extents_blockCount0; - // 0x184 + /// 0x188 public UInt32 attributesFile_extents_startBlock1; - // 0x188 + /// 0x18C public UInt32 attributesFile_extents_blockCount1; - // 0x18C + /// 0x190 public UInt32 attributesFile_extents_startBlock2; - // 0x190 + /// 0x194 public UInt32 attributesFile_extents_blockCount2; - // 0x194 + /// 0x198 public UInt32 attributesFile_extents_startBlock3; - // 0x198 + /// 0x19C public UInt32 attributesFile_extents_blockCount3; - // 0x19C + /// 0x1A0 public UInt32 attributesFile_extents_startBlock4; - // 0x1A0 + /// 0x1A4 public UInt32 attributesFile_extents_blockCount4; - // 0x1A4 + /// 0x1A8 public UInt32 attributesFile_extents_startBlock5; - // 0x1A8 + /// 0x1AC public UInt32 attributesFile_extents_blockCount5; - // 0x1AC + /// 0x1B0 public UInt32 attributesFile_extents_startBlock6; - // 0x1B0 + /// 0x1B4 public UInt32 attributesFile_extents_blockCount6; - // 0x1B4 + /// 0x1B8 public UInt32 attributesFile_extents_startBlock7; - // 0x1B8 + /// 0x1BC public UInt32 attributesFile_extents_blockCount7; - // 0x1BC // HFSPlusForkData startupFile; + /// 0x1C0 public UInt64 startupFile_logicalSize; - // 0x1C0 + /// 0x1C8 public UInt32 startupFile_clumpSize; - // 0x1C8 + /// 0x1CC public UInt32 startupFile_totalBlocks; - // 0x1CC + /// 0x1D0 public UInt32 startupFile_extents_startBlock0; - // 0x1D0 + /// 0x1D4 public UInt32 startupFile_extents_blockCount0; - // 0x1D4 + /// 0x1D8 public UInt32 startupFile_extents_startBlock1; - // 0x1D8 + /// 0x1E0 public UInt32 startupFile_extents_blockCount1; - // 0x1E0 + /// 0x1E4 public UInt32 startupFile_extents_startBlock2; - // 0x1E4 + /// 0x1E8 public UInt32 startupFile_extents_blockCount2; - // 0x1E8 + /// 0x1EC public UInt32 startupFile_extents_startBlock3; - // 0x1EC + /// 0x1F0 public UInt32 startupFile_extents_blockCount3; - // 0x1F0 + /// 0x1F4 public UInt32 startupFile_extents_startBlock4; - // 0x1F4 + /// 0x1F8 public UInt32 startupFile_extents_blockCount4; - // 0x1F8 + /// 0x1FC public UInt32 startupFile_extents_startBlock5; - // 0x1FC + /// 0x200 public UInt32 startupFile_extents_blockCount5; - // 0x200 + /// 0x204 public UInt32 startupFile_extents_startBlock6; - // 0x204 + /// 0x208 public UInt32 startupFile_extents_blockCount6; - // 0x208 + /// 0x20C public UInt32 startupFile_extents_startBlock7; - // 0x20C + /// 0x210 public UInt32 startupFile_extents_blockCount7; - // 0x210 } } } diff --git a/DiscImageChef.Filesystems/AppleMFS.cs b/DiscImageChef.Filesystems/AppleMFS.cs index 27587d29..fb87a84f 100644 --- a/DiscImageChef.Filesystems/AppleMFS.cs +++ b/DiscImageChef.Filesystems/AppleMFS.cs @@ -220,77 +220,82 @@ namespace DiscImageChef.Plugins return; } - struct MFS_MasterDirectoryBlock // Should be offset 0x0400 bytes in volume + /// + /// Master Directory Block, should be at offset 0x0400 bytes in volume + /// + struct MFS_MasterDirectoryBlock { - // 0x000, Signature, 0xD2D7 + /// 0x000, Signature, 0xD2D7 public UInt16 drSigWord; - // 0x002, Volume creation date + /// 0x002, Volume creation date public UInt32 drCrDate; - // 0x006, Volume last backup date + /// 0x006, Volume last backup date public UInt32 drLsBkUp; - // 0x00A, Volume attributes + /// 0x00A, Volume attributes public UInt16 drAtrb; - // 0x00C, Volume number of files + /// 0x00C, Volume number of files public UInt16 drNmFls; - // 0x00E, First directory block + /// 0x00E, First directory block public UInt16 drDirSt; - // 0x010, Length of directory in blocks + /// 0x010, Length of directory in blocks public UInt16 drBlLen; - // 0x012, Volume allocation blocks + /// 0x012, Volume allocation blocks public UInt16 drNmAlBlks; - // 0x014, Size of allocation blocks + /// 0x014, Size of allocation blocks public UInt32 drAlBlkSiz; - // 0x018, Number of bytes to allocate + /// 0x018, Number of bytes to allocate public UInt32 drClpSiz; - // 0x01C, First allocation block in block map + /// 0x01C, First allocation block in block map public UInt16 drAlBlSt; - // 0x01E. Next unused file number + /// 0x01E. Next unused file number public UInt32 drNxtFNum; - // 0x022, Number of unused allocation blocks + /// 0x022, Number of unused allocation blocks public UInt16 drFreeBks; - // 0x024, Length of volume name + /// 0x024, Length of volume name public byte drVNSiz; - // 0x025, Characters of volume name + /// 0x025, Characters of volume name public string drVN; } - struct MFS_BootBlock // Should be offset 0x0000 bytes in volume + /// + /// Should be at offset 0x0000 in volume, followed by boot code + /// + struct MFS_BootBlock { + /// 0x000, Signature, 0x4C4B if bootable public UInt16 signature; - // 0x000, Signature, 0x4C4B if bootable + /// 0x002, Branch public UInt32 branch; - // 0x002, Branch + /// 0x006, Boot block flags public byte boot_flags; - // 0x006, Boot block flags + /// 0x007, Boot block version public byte boot_version; - // 0x007, Boot block version + /// 0x008, Allocate secondary buffers public short sec_sv_pages; - // 0x008, Allocate secondary buffers + /// 0x00A, System file name (16 bytes) public string system_name; - // 0x00A, System file name (16 bytes) + /// 0x01A, Finder file name (16 bytes) public string finder_name; - // 0x01A, Finder file name (16 bytes) + /// 0x02A, Debugger file name (16 bytes) public string debug_name; - // 0x02A, Debugger file name (16 bytes) + /// 0x03A, Disassembler file name (16 bytes) public string disasm_name; - // 0x03A, Disassembler file name (16 bytes) + /// 0x04A, Startup screen file name (16 bytes) public string stupscr_name; - // 0x04A, Startup screen file name (16 bytes) + /// 0x05A, First program to execute on boot (16 bytes) public string bootup_name; - // 0x05A, First program to execute on boot (16 bytes) + /// 0x06A, Clipboard file name (16 bytes) public string clipbrd_name; - // 0x06A, Clipboard file name (16 bytes) + /// 0x07A, 1/4 of maximum opened at a time files public UInt16 max_files; - // 0x07A, 1/4 of maximum opened at a time files + /// 0x07C, Event queue size public UInt16 queue_size; - // 0x07C, Event queue size + /// 0x07E, Heap size on a Mac with 128KiB of RAM public UInt32 heap_128k; - // 0x07E, Heap size on a Mac with 128KiB of RAM + /// 0x082, Heap size on a Mac with 256KiB of RAM public UInt32 heap_256k; - // 0x082, Heap size on a Mac with 256KiB of RAM + /// 0x086, Heap size on a Mac with 512KiB of RAM or more public UInt32 heap_512k; - // 0x086, Heap size on a Mac with 512KiB of RAM or more } - // Follows boot code } } diff --git a/DiscImageChef.Filesystems/BFS.cs b/DiscImageChef.Filesystems/BFS.cs index 114686c4..8368e5b8 100644 --- a/DiscImageChef.Filesystems/BFS.cs +++ b/DiscImageChef.Filesystems/BFS.cs @@ -230,58 +230,61 @@ namespace DiscImageChef.Plugins xmlFSType.VolumeName = besb.name; } + /// + /// Be superblock + /// struct BeSuperBlock { + /// 0x000, Volume name, 32 bytes public string name; - // 0x000, Volume name, 32 bytes + /// 0x020, "BFS1", 0x42465331 public UInt32 magic1; - // 0x020, "BFS1", 0x42465331 + /// 0x024, "BIGE", 0x42494745 public UInt32 fs_byte_order; - // 0x024, "BIGE", 0x42494745 + /// 0x028, Bytes per block public UInt32 block_size; - // 0x028, Bytes per block + /// 0x02C, 1 << block_shift == block_size public UInt32 block_shift; - // 0x02C, 1 << block_shift == block_size + /// 0x030, Blocks in volume public Int64 num_blocks; - // 0x030, Blocks in volume + /// 0x038, Used blocks in volume public Int64 used_blocks; - // 0x038, Used blocks in volume + /// 0x040, Bytes per inode public Int32 inode_size; - // 0x040, Bytes per inode + /// 0x044, 0xDD121031 public UInt32 magic2; - // 0x044, 0xDD121031 + /// 0x048, Blocks per allocation group public Int32 blocks_per_ag; - // 0x048, Blocks per allocation group + /// 0x04C, 1 << ag_shift == blocks_per_ag public Int32 ag_shift; - // 0x04C, 1 << ag_shift == blocks_per_ag + /// 0x050, Allocation groups in volume public Int32 num_ags; - // 0x050, Allocation groups in volume + /// 0x054, 0x434c454e if clean, 0x44495254 if dirty public UInt32 flags; - // 0x054, 0x434c454e if clean, 0x44495254 if dirty + /// 0x058, Allocation group of journal public Int32 log_blocks_ag; - // 0x058, Allocation group of journal + /// 0x05C, Start block of journal, inside ag public UInt16 log_blocks_start; - // 0x05C, Start block of journal, inside ag + /// 0x05E, Length in blocks of journal, inside ag public UInt16 log_blocks_len; - // 0x05E, Length in blocks of journal, inside ag + /// 0x060, Start of journal public Int64 log_start; - // 0x060, Start of journal + /// 0x068, End of journal public Int64 log_end; - // 0x068, End of journal + /// 0x070, 0x15B6830E public UInt32 magic3; - // 0x070, 0x15B6830E + /// 0x074, Allocation group where root folder's i-node resides public Int32 root_dir_ag; - // 0x074, Allocation group where root folder's i-node resides + /// 0x078, Start in ag of root folder's i-node public UInt16 root_dir_start; - // 0x078, Start in ag of root folder's i-node + /// 0x07A, As this is part of inode_addr, this is 1 public UInt16 root_dir_len; - // 0x07A, As this is part of inode_addr, this is 1 + /// 0x07C, Allocation group where indices' i-node resides public Int32 indices_ag; - // 0x07C, Allocation group where indices' i-node resides + /// 0x080, Start in ag of indices' i-node public UInt16 indices_start; - // 0x080, Start in ag of indices' i-node + /// 0x082, As this is part of inode_addr, this is 1 public UInt16 indices_len; - // 0x082, As this is part of inode_addr, this is 1 } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ChangeLog b/DiscImageChef.Filesystems/ChangeLog index 46c321c4..ac834b3e 100644 --- a/DiscImageChef.Filesystems/ChangeLog +++ b/DiscImageChef.Filesystems/ChangeLog @@ -1,3 +1,23 @@ +2015-12-06 Natalia Portillo + + * ODS.cs: + * FFS.cs: + * BFS.cs: + * HPFS.cs: + * NTFS.cs: + * SysV.cs: + * Opera.cs: + * extFS.cs: + * ext2FS.cs: + * LisaFS.cs: + * SolarFS.cs: + * MinixFS.cs: + * UNIXBFS.cs: + * AppleMFS.cs: + * AppleHFS.cs: + * AppleHFSPlus.cs: + Moved comments to XML documentation. + 2015-12-06 Natalia Portillo * Plugin.cs: diff --git a/DiscImageChef.Filesystems/FFS.cs b/DiscImageChef.Filesystems/FFS.cs index 6eb44dc6..ce89d4de 100644 --- a/DiscImageChef.Filesystems/FFS.cs +++ b/DiscImageChef.Filesystems/FFS.cs @@ -128,12 +128,12 @@ namespace DiscImageChef.Plugins sb_size_in_sectors = block_size / 2048; else sb_size_in_sectors = block_size / imagePlugin.GetSectorSize(); - + if (imagePlugin.GetSectors() > (partitionStart + sb_start_floppy * sb_size_in_sectors + sb_size_in_sectors) && magic == 0) { ufs_sb_sectors = imagePlugin.ReadSectors(partitionStart + sb_start_floppy * sb_size_in_sectors, sb_size_in_sectors); magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C); - + if (magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC) sb_offset = partitionStart + sb_start_floppy * sb_size_in_sectors; else @@ -144,7 +144,7 @@ namespace DiscImageChef.Plugins { ufs_sb_sectors = imagePlugin.ReadSectors(partitionStart + sb_start_ufs1 * sb_size_in_sectors, sb_size_in_sectors); magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C); - + if (magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC) sb_offset = partitionStart + sb_start_ufs1 * sb_size_in_sectors; else @@ -155,7 +155,7 @@ namespace DiscImageChef.Plugins { ufs_sb_sectors = imagePlugin.ReadSectors(partitionStart + sb_start_ufs2 * sb_size_in_sectors, sb_size_in_sectors); magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C); - + if (magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC) sb_offset = partitionStart + sb_start_ufs2 * sb_size_in_sectors; else @@ -166,7 +166,7 @@ namespace DiscImageChef.Plugins { ufs_sb_sectors = imagePlugin.ReadSectors(partitionStart + sb_start_piggy * sb_size_in_sectors, sb_size_in_sectors); magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C); - + if (magic == UFS_MAGIC || magic == UFS_MAGIC_BW || magic == UFS2_MAGIC || magic == UFS_CIGAM || magic == UFS_BAD_MAGIC) sb_offset = partitionStart + sb_start_piggy * sb_size_in_sectors; else @@ -214,180 +214,180 @@ namespace DiscImageChef.Plugins byte[] strings_b; ufs_sb_sectors = imagePlugin.ReadSectors(sb_offset, sb_size_in_sectors); - ufs_sb.fs_link_42bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0000); // 0x0000 + ufs_sb.fs_link_42bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0000); /// 0x0000 ufs_sb.fs_state_sun = ufs_sb.fs_link_42bsd; - ufs_sb.fs_rlink = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0004); // 0x0004 UNUSED - ufs_sb.fs_sblkno = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0008); // 0x0008 addr of super-block in filesys - ufs_sb.fs_cblkno = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x000C); // 0x000C offset of cyl-block in filesys - ufs_sb.fs_iblkno = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0010); // 0x0010 offset of inode-blocks in filesys - ufs_sb.fs_dblkno = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0014); // 0x0014 offset of first data after cg - ufs_sb.fs_cgoffset = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0018); // 0x0018 cylinder group offset in cylinder - ufs_sb.fs_cgmask = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x001C); // 0x001C used to calc mod fs_ntrak - ufs_sb.fs_time_t = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0020); // 0x0020 last time written -- time_t - ufs_sb.fs_size = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0024); // 0x0024 number of blocks in fs - ufs_sb.fs_dsize = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0028); // 0x0028 number of data blocks in fs - ufs_sb.fs_ncg = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x002C); // 0x002C number of cylinder groups - ufs_sb.fs_bsize = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0030); // 0x0030 size of basic blocks in fs - ufs_sb.fs_fsize = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0034); // 0x0034 size of frag blocks in fs - ufs_sb.fs_frag = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0038); // 0x0038 number of frags in a block in fs + ufs_sb.fs_rlink = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0004); /// 0x0004 UNUSED + ufs_sb.fs_sblkno = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0008); /// 0x0008 addr of super-block in filesys + ufs_sb.fs_cblkno = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x000C); /// 0x000C offset of cyl-block in filesys + ufs_sb.fs_iblkno = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0010); /// 0x0010 offset of inode-blocks in filesys + ufs_sb.fs_dblkno = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0014); /// 0x0014 offset of first data after cg + ufs_sb.fs_cgoffset = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0018); /// 0x0018 cylinder group offset in cylinder + ufs_sb.fs_cgmask = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x001C); /// 0x001C used to calc mod fs_ntrak + ufs_sb.fs_time_t = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0020); /// 0x0020 last time written -- time_t + ufs_sb.fs_size = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0024); /// 0x0024 number of blocks in fs + ufs_sb.fs_dsize = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0028); /// 0x0028 number of data blocks in fs + ufs_sb.fs_ncg = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x002C); /// 0x002C number of cylinder groups + ufs_sb.fs_bsize = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0030); /// 0x0030 size of basic blocks in fs + ufs_sb.fs_fsize = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0034); /// 0x0034 size of frag blocks in fs + ufs_sb.fs_frag = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0038); /// 0x0038 number of frags in a block in fs // these are configuration parameters - ufs_sb.fs_minfree = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x003C); // 0x003C minimum percentage of free blocks - ufs_sb.fs_rotdelay = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0040); // 0x0040 num of ms for optimal next block - ufs_sb.fs_rps = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0044); // 0x0044 disk revolutions per second + ufs_sb.fs_minfree = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x003C); /// 0x003C minimum percentage of free blocks + ufs_sb.fs_rotdelay = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0040); /// 0x0040 num of ms for optimal next block + ufs_sb.fs_rps = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0044); /// 0x0044 disk revolutions per second // these fields can be computed from the others - ufs_sb.fs_bmask = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0048); // 0x0048 ``blkoff'' calc of blk offsets - ufs_sb.fs_fmask = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x004C); // 0x004C ``fragoff'' calc of frag offsets - ufs_sb.fs_bshift = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0050); // 0x0050 ``lblkno'' calc of logical blkno - ufs_sb.fs_fshift = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0054); // 0x0054 ``numfrags'' calc number of frags + ufs_sb.fs_bmask = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0048); /// 0x0048 ``blkoff'' calc of blk offsets + ufs_sb.fs_fmask = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x004C); /// 0x004C ``fragoff'' calc of frag offsets + ufs_sb.fs_bshift = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0050); /// 0x0050 ``lblkno'' calc of logical blkno + ufs_sb.fs_fshift = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0054); /// 0x0054 ``numfrags'' calc number of frags // these are configuration parameters - ufs_sb.fs_maxcontig = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0058); // 0x0058 max number of contiguous blks - ufs_sb.fs_maxbpg = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x005C); // 0x005C max number of blks per cyl group + ufs_sb.fs_maxcontig = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0058); /// 0x0058 max number of contiguous blks + ufs_sb.fs_maxbpg = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x005C); /// 0x005C max number of blks per cyl group // these fields can be computed from the others - ufs_sb.fs_fragshift = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0060); // 0x0060 block to frag shift - ufs_sb.fs_fsbtodb = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0064); // 0x0064 fsbtodb and dbtofsb shift constant - ufs_sb.fs_sbsize = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0068); // 0x0068 actual size of super block - ufs_sb.fs_csmask = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x006C); // 0x006C csum block offset - ufs_sb.fs_csshift = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0070); // 0x0070 csum block number - ufs_sb.fs_nindir = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0074); // 0x0074 value of NINDIR - ufs_sb.fs_inopb = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0078); // 0x0078 value of INOPB - ufs_sb.fs_nspf = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x007C); // 0x007C value of NSPF + ufs_sb.fs_fragshift = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0060); /// 0x0060 block to frag shift + ufs_sb.fs_fsbtodb = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0064); /// 0x0064 fsbtodb and dbtofsb shift constant + ufs_sb.fs_sbsize = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0068); /// 0x0068 actual size of super block + ufs_sb.fs_csmask = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x006C); /// 0x006C csum block offset + ufs_sb.fs_csshift = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0070); /// 0x0070 csum block number + ufs_sb.fs_nindir = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0074); /// 0x0074 value of NINDIR + ufs_sb.fs_inopb = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0078); /// 0x0078 value of INOPB + ufs_sb.fs_nspf = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x007C); /// 0x007C value of NSPF // yet another configuration parameter - ufs_sb.fs_optim = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0080); // 0x0080 optimization preference, see below + ufs_sb.fs_optim = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0080); /// 0x0080 optimization preference, see below // these fields are derived from the hardware #region Sun - ufs_sb.fs_npsect_sun = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0084); // 0x0084 # sectors/track including spares + ufs_sb.fs_npsect_sun = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0084); /// 0x0084 # sectors/track including spares #endregion Sun #region Sunx86 - ufs_sb.fs_state_t_sun86 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0084); // 0x0084 file system state time stamp + ufs_sb.fs_state_t_sun86 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0084); /// 0x0084 file system state time stamp #endregion Sunx86 #region COMMON - ufs_sb.fs_interleave = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0088); // 0x0088 hardware sector interleave - ufs_sb.fs_trackskew = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x008C); // 0x008C sector 0 skew, per track + ufs_sb.fs_interleave = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0088); /// 0x0088 hardware sector interleave + ufs_sb.fs_trackskew = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x008C); /// 0x008C sector 0 skew, per track #endregion COMMON // a unique id for this filesystem (currently unused and unmaintained) // In 4.3 Tahoe this space is used by fs_headswitch and fs_trkseek // Neither of those fields is used in the Tahoe code right now but // there could be problems if they are. #region COMMON - ufs_sb.fs_id_1 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0090); // 0x0090 - ufs_sb.fs_id_2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0094); // 0x0094 + ufs_sb.fs_id_1 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0090); /// 0x0090 + ufs_sb.fs_id_2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0094); /// 0x0094 #endregion COMMON #region 43BSD - ufs_sb.fs_headswitch_43bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0090); // 0x0090 - ufs_sb.fs_trkseek_43bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0094); // 0x0094 + ufs_sb.fs_headswitch_43bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0090); /// 0x0090 + ufs_sb.fs_trkseek_43bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0094); /// 0x0094 #endregion 43BSD #region COMMON // sizes determined by number of cylinder groups and their sizes - ufs_sb.fs_csaddr = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0098); // 0x0098 blk addr of cyl grp summary area - ufs_sb.fs_cssize = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x009C); // 0x009C size of cyl grp summary area - ufs_sb.fs_cgsize = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x00A0); // 0x00A0 cylinder group size + ufs_sb.fs_csaddr = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0098); /// 0x0098 blk addr of cyl grp summary area + ufs_sb.fs_cssize = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x009C); /// 0x009C size of cyl grp summary area + ufs_sb.fs_cgsize = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x00A0); /// 0x00A0 cylinder group size // these fields are derived from the hardware - ufs_sb.fs_ntrak = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x00A4); // 0x00A4 tracks per cylinder - ufs_sb.fs_nsect = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x00A8); // 0x00A8 sectors per track - ufs_sb.fs_spc = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x00AC); // 0x00AC sectors per cylinder + ufs_sb.fs_ntrak = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x00A4); /// 0x00A4 tracks per cylinder + ufs_sb.fs_nsect = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x00A8); /// 0x00A8 sectors per track + ufs_sb.fs_spc = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x00AC); /// 0x00AC sectors per cylinder // this comes from the disk driver partitioning - ufs_sb.fs_ncyl = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x00B0); // 0x00B0 cylinders in file system + ufs_sb.fs_ncyl = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x00B0); /// 0x00B0 cylinders in file system // these fields can be computed from the others - ufs_sb.fs_cpg = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x00B4); // 0x00B4 cylinders per group - ufs_sb.fs_ipg = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x00B8); // 0x00B8 inodes per cylinder group - ufs_sb.fs_fpg = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x00BC); // 0x00BC blocks per group * fs_frag + ufs_sb.fs_cpg = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x00B4); /// 0x00B4 cylinders per group + ufs_sb.fs_ipg = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x00B8); /// 0x00B8 inodes per cylinder group + ufs_sb.fs_fpg = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x00BC); /// 0x00BC blocks per group * fs_frag // this data must be re-computed after crashes - // struct ufs_csum fs_cstotal = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0000); // cylinder summary information - ufs_sb.fs_cstotal_ndir = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x00C0); // 0x00C0 number of directories - ufs_sb.fs_cstotal_nbfree = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x00C4); // 0x00C4 number of free blocks - ufs_sb.fs_cstotal_nifree = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x00C8); // 0x00C8 number of free inodes - ufs_sb.fs_cstotal_nffree = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x00CC); // 0x00CC number of free frags + // struct ufs_csum fs_cstotal = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0000); // cylinder summary information + ufs_sb.fs_cstotal_ndir = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x00C0); /// 0x00C0 number of directories + ufs_sb.fs_cstotal_nbfree = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x00C4); /// 0x00C4 number of free blocks + ufs_sb.fs_cstotal_nifree = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x00C8); /// 0x00C8 number of free inodes + ufs_sb.fs_cstotal_nffree = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x00CC); /// 0x00CC number of free frags // these fields are cleared at mount time - ufs_sb.fs_fmod = ufs_sb_sectors[0x00D0]; // 0x00D0 super block modified flag - ufs_sb.fs_clean = ufs_sb_sectors[0x00D1]; // 0x00D1 file system is clean flag - ufs_sb.fs_ronly = ufs_sb_sectors[0x00D2]; // 0x00D2 mounted read-only flag - ufs_sb.fs_flags = ufs_sb_sectors[0x00D3]; // 0x00D3 + ufs_sb.fs_fmod = ufs_sb_sectors[0x00D0]; /// 0x00D0 super block modified flag + ufs_sb.fs_clean = ufs_sb_sectors[0x00D1]; /// 0x00D1 file system is clean flag + ufs_sb.fs_ronly = ufs_sb_sectors[0x00D2]; /// 0x00D2 mounted read-only flag + ufs_sb.fs_flags = ufs_sb_sectors[0x00D3]; /// 0x00D3 #endregion COMMON #region UFS1 strings_b = new byte[512]; Array.Copy(ufs_sb_sectors, 0x00D4, strings_b, 0, 512); - ufs_sb.fs_fsmnt_ufs1 = StringHandlers.CToString(strings_b); // 0x00D4, 512 bytes, name mounted on - ufs_sb.fs_cgrotor_ufs1 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0000); // 0x02D4 last cg searched - Array.Copy(ufs_sb_sectors, 0x02D8, ufs_sb.fs_cs_ufs1, 0, 124); // 0x02D8, 124 bytes, UInt32s, list of fs_cs info buffers - ufs_sb.fs_maxcluster_ufs1 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0354); // 0x0354 - ufs_sb.fs_cpc_ufs1 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0358); // 0x0358 cyl per cycle in postbl - Array.Copy(ufs_sb_sectors, 0x035C, ufs_sb.fs_opostbl_ufs1, 0, 256); // 0x035C, 256 bytes, [16][8] matrix of UInt16s, old rotation block list head + ufs_sb.fs_fsmnt_ufs1 = StringHandlers.CToString(strings_b); /// 0x00D4, 512 bytes, name mounted on + ufs_sb.fs_cgrotor_ufs1 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0000); /// 0x02D4 last cg searched + Array.Copy(ufs_sb_sectors, 0x02D8, ufs_sb.fs_cs_ufs1, 0, 124); /// 0x02D8, 124 bytes, UInt32s, list of fs_cs info buffers + ufs_sb.fs_maxcluster_ufs1 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0354); /// 0x0354 + ufs_sb.fs_cpc_ufs1 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0358); /// 0x0358 cyl per cycle in postbl + Array.Copy(ufs_sb_sectors, 0x035C, ufs_sb.fs_opostbl_ufs1, 0, 256); /// 0x035C, 256 bytes, [16][8] matrix of UInt16s, old rotation block list head #endregion UFS1 #region UFS2 strings_b = new byte[468]; Array.Copy(ufs_sb_sectors, 0x00D4, strings_b, 0, 468); - ufs_sb.fs_fsmnt_ufs2 = StringHandlers.CToString(strings_b); // 0x00D4, 468 bytes, name mounted on + ufs_sb.fs_fsmnt_ufs2 = StringHandlers.CToString(strings_b); /// 0x00D4, 468 bytes, name mounted on strings_b = new byte[32]; Array.Copy(ufs_sb_sectors, 0x02A8, strings_b, 0, 32); - ufs_sb.fs_volname_ufs2 = StringHandlers.CToString(strings_b); // 0x02A8, 32 bytes, volume name - ufs_sb.fs_swuid_ufs2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x02C8); // 0x02C8 system-wide uid - ufs_sb.fs_pad_ufs2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x02D0); // 0x02D0 due to alignment of fs_swuid - ufs_sb.fs_cgrotor_ufs2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x02D4); // 0x02D4 last cg searched - Array.Copy(ufs_sb_sectors, 0x02D8, ufs_sb.fs_ocsp_ufs2, 0, 112); // 0x02D8, 112 bytes, UInt32s, list of fs_cs info buffers - ufs_sb.fs_contigdirs_ufs2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0348); // 0x0348 # of contiguously allocated dirs - ufs_sb.fs_csp_ufs2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x034C); // 0x034C cg summary info buffer for fs_cs - ufs_sb.fs_maxcluster_ufs2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0350); // 0x0350 - ufs_sb.fs_active_ufs2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0354); // 0x0354 used by snapshots to track fs - ufs_sb.fs_old_cpc_ufs2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0358); // 0x0358 cyl per cycle in postbl - ufs_sb.fs_maxbsize_ufs2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x035C); // 0x035C maximum blocking factor permitted - Array.Copy(ufs_sb_sectors, 0x0360, ufs_sb.fs_sparecon64_ufs2, 0, 136); // 0x0360, 136 bytes, UInt64s, old rotation block list head - ufs_sb.fs_sblockloc_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x03E8); // 0x03E8 byte offset of standard superblock + ufs_sb.fs_volname_ufs2 = StringHandlers.CToString(strings_b); /// 0x02A8, 32 bytes, volume name + ufs_sb.fs_swuid_ufs2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x02C8); /// 0x02C8 system-wide uid + ufs_sb.fs_pad_ufs2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x02D0); /// 0x02D0 due to alignment of fs_swuid + ufs_sb.fs_cgrotor_ufs2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x02D4); /// 0x02D4 last cg searched + Array.Copy(ufs_sb_sectors, 0x02D8, ufs_sb.fs_ocsp_ufs2, 0, 112); /// 0x02D8, 112 bytes, UInt32s, list of fs_cs info buffers + ufs_sb.fs_contigdirs_ufs2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0348); /// 0x0348 # of contiguously allocated dirs + ufs_sb.fs_csp_ufs2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x034C); /// 0x034C cg summary info buffer for fs_cs + ufs_sb.fs_maxcluster_ufs2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0350); /// 0x0350 + ufs_sb.fs_active_ufs2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0354); /// 0x0354 used by snapshots to track fs + ufs_sb.fs_old_cpc_ufs2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0358); /// 0x0358 cyl per cycle in postbl + ufs_sb.fs_maxbsize_ufs2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x035C); /// 0x035C maximum blocking factor permitted + Array.Copy(ufs_sb_sectors, 0x0360, ufs_sb.fs_sparecon64_ufs2, 0, 136); /// 0x0360, 136 bytes, UInt64s, old rotation block list head + ufs_sb.fs_sblockloc_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x03E8); /// 0x03E8 byte offset of standard superblock //cylinder summary information*/ - ufs_sb.fs_cstotal_ndir_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x03F0); // 0x03F0 number of directories - ufs_sb.fs_cstotal_nbfree_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x03F8); // 0x03F8 number of free blocks - ufs_sb.fs_cstotal_nifree_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x0400); // 0x0400 number of free inodes - ufs_sb.fs_cstotal_nffree_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x0408); // 0x0408 number of free frags - ufs_sb.fs_cstotal_numclusters_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x0410); // 0x0410 number of free clusters - ufs_sb.fs_cstotal_spare0_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x0418); // 0x0418 future expansion - ufs_sb.fs_cstotal_spare1_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x0420); // 0x0420 future expansion - ufs_sb.fs_cstotal_spare2_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x0428); // 0x0428 future expansion - ufs_sb.fs_time_sec_ufs2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0430); // 0x0430 last time written - ufs_sb.fs_time_usec_ufs2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0434); // 0x0434 last time written - ufs_sb.fs_size_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x0438); // 0x0438 number of blocks in fs - ufs_sb.fs_dsize_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x0440); // 0x0440 number of data blocks in fs - ufs_sb.fs_csaddr_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x0448); // 0x0448 blk addr of cyl grp summary area - ufs_sb.fs_pendingblocks_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x0450); // 0x0450 blocks in process of being freed - ufs_sb.fs_pendinginodes_ufs2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0458); // 0x0458 inodes in process of being freed + ufs_sb.fs_cstotal_ndir_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x03F0); /// 0x03F0 number of directories + ufs_sb.fs_cstotal_nbfree_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x03F8); /// 0x03F8 number of free blocks + ufs_sb.fs_cstotal_nifree_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x0400); /// 0x0400 number of free inodes + ufs_sb.fs_cstotal_nffree_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x0408); /// 0x0408 number of free frags + ufs_sb.fs_cstotal_numclusters_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x0410); /// 0x0410 number of free clusters + ufs_sb.fs_cstotal_spare0_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x0418); /// 0x0418 future expansion + ufs_sb.fs_cstotal_spare1_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x0420); /// 0x0420 future expansion + ufs_sb.fs_cstotal_spare2_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x0428); /// 0x0428 future expansion + ufs_sb.fs_time_sec_ufs2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0430); /// 0x0430 last time written + ufs_sb.fs_time_usec_ufs2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0434); /// 0x0434 last time written + ufs_sb.fs_size_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x0438); /// 0x0438 number of blocks in fs + ufs_sb.fs_dsize_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x0440); /// 0x0440 number of data blocks in fs + ufs_sb.fs_csaddr_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x0448); /// 0x0448 blk addr of cyl grp summary area + ufs_sb.fs_pendingblocks_ufs2 = BigEndianBitConverter.ToUInt64(ufs_sb_sectors, 0x0450); /// 0x0450 blocks in process of being freed + ufs_sb.fs_pendinginodes_ufs2 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0458); /// 0x0458 inodes in process of being freed #endregion UFS2 #region Sun - Array.Copy(ufs_sb_sectors, 0x045C, ufs_sb.fs_sparecon_sun, 0, 212); // 0x045C, 212 bytes, reserved for future constants - ufs_sb.fs_reclaim_sun = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0530); // 0x0530 - ufs_sb.fs_sparecon2_sun = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0534); // 0x0534 - ufs_sb.fs_state_t_sun = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0538); // 0x0538 file system state time stamp - ufs_sb.fs_qbmask0_sun = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x053C); // 0x053C ~usb_bmask - ufs_sb.fs_qbmask1_sun = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0540); // 0x0540 ~usb_bmask - ufs_sb.fs_qfmask0_sun = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0544); // 0x0544 ~usb_fmask - ufs_sb.fs_qfmask1_sun = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0548); // 0x0548 ~usb_fmask + Array.Copy(ufs_sb_sectors, 0x045C, ufs_sb.fs_sparecon_sun, 0, 212); /// 0x045C, 212 bytes, reserved for future constants + ufs_sb.fs_reclaim_sun = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0530); /// 0x0530 + ufs_sb.fs_sparecon2_sun = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0534); /// 0x0534 + ufs_sb.fs_state_t_sun = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0538); /// 0x0538 file system state time stamp + ufs_sb.fs_qbmask0_sun = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x053C); /// 0x053C ~usb_bmask + ufs_sb.fs_qbmask1_sun = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0540); /// 0x0540 ~usb_bmask + ufs_sb.fs_qfmask0_sun = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0544); /// 0x0544 ~usb_fmask + ufs_sb.fs_qfmask1_sun = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0548); /// 0x0548 ~usb_fmask #endregion Sun #region Sunx86 - Array.Copy(ufs_sb_sectors, 0x045C, ufs_sb.fs_sparecon_sun86, 0, 212); // 0x045C, 212 bytes, reserved for future constants - ufs_sb.fs_reclaim_sun86 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0530); // 0x0530 - ufs_sb.fs_sparecon2_sun86 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0534); // 0x0534 - ufs_sb.fs_npsect_sun86 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0538); // 0x0538 # sectors/track including spares - ufs_sb.fs_qbmask0_sun86 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x053C); // 0x053C ~usb_bmask - ufs_sb.fs_qbmask1_sun86 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0540); // 0x0540 ~usb_bmask - ufs_sb.fs_qfmask0_sun86 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0544); // 0x0544 ~usb_fmask - ufs_sb.fs_qfmask1_sun86 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0548); // 0x0548 ~usb_fmask + Array.Copy(ufs_sb_sectors, 0x045C, ufs_sb.fs_sparecon_sun86, 0, 212); /// 0x045C, 212 bytes, reserved for future constants + ufs_sb.fs_reclaim_sun86 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0530); /// 0x0530 + ufs_sb.fs_sparecon2_sun86 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0534); /// 0x0534 + ufs_sb.fs_npsect_sun86 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0538); /// 0x0538 # sectors/track including spares + ufs_sb.fs_qbmask0_sun86 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x053C); /// 0x053C ~usb_bmask + ufs_sb.fs_qbmask1_sun86 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0540); /// 0x0540 ~usb_bmask + ufs_sb.fs_qfmask0_sun86 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0544); /// 0x0544 ~usb_fmask + ufs_sb.fs_qfmask1_sun86 = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0548); /// 0x0548 ~usb_fmask #endregion Sunx86 #region 44BSD - Array.Copy(ufs_sb_sectors, 0x045C, ufs_sb.fs_sparecon_44bsd, 0, 200); // 0x045C, 200 bytes - ufs_sb.fs_contigsumsize_44bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0524); // 0x0524 size of cluster summary array - ufs_sb.fs_maxsymlinklen_44bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0528); // 0x0528 max length of an internal symlink - ufs_sb.fs_inodefmt_44bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x052C); // 0x052C format of on-disk inodes - ufs_sb.fs_maxfilesize0_44bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0530); // 0x0530 max representable file size - ufs_sb.fs_maxfilesize1_44bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0534); // 0x0534 max representable file size - ufs_sb.fs_qbmask0_44bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0538); // 0x0538 ~usb_bmask - ufs_sb.fs_qbmask1_44bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x053C); // 0x053C ~usb_bmask - ufs_sb.fs_qfmask0_44bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0540); // 0x0540 ~usb_fmask - ufs_sb.fs_qfmask1_44bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0544); // 0x0544 ~usb_fmask - ufs_sb.fs_state_t_44bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0548); // 0x0548 file system state time stamp + Array.Copy(ufs_sb_sectors, 0x045C, ufs_sb.fs_sparecon_44bsd, 0, 200); /// 0x045C, 200 bytes + ufs_sb.fs_contigsumsize_44bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0524); /// 0x0524 size of cluster summary array + ufs_sb.fs_maxsymlinklen_44bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0528); /// 0x0528 max length of an internal symlink + ufs_sb.fs_inodefmt_44bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x052C); /// 0x052C format of on-disk inodes + ufs_sb.fs_maxfilesize0_44bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0530); /// 0x0530 max representable file size + ufs_sb.fs_maxfilesize1_44bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0534); /// 0x0534 max representable file size + ufs_sb.fs_qbmask0_44bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0538); /// 0x0538 ~usb_bmask + ufs_sb.fs_qbmask1_44bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x053C); /// 0x053C ~usb_bmask + ufs_sb.fs_qfmask0_44bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0540); /// 0x0540 ~usb_fmask + ufs_sb.fs_qfmask1_44bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0544); /// 0x0544 ~usb_fmask + ufs_sb.fs_state_t_44bsd = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0548); /// 0x0548 file system state time stamp #endregion 44BSD - ufs_sb.fs_postblformat = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x054C); // 0x054C format of positional layout tables - ufs_sb.fs_nrpos = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0550); // 0x0550 number of rotational positions - ufs_sb.fs_postbloff = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0554); // 0x0554 (__s16) rotation block list head - ufs_sb.fs_rotbloff = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0558); // 0x0558 (__u8) blocks for each rotation - ufs_sb.fs_magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C); // 0x055C magic number - ufs_sb.fs_space = ufs_sb_sectors[0x0560]; // 0x0560 list of blocks for each rotation + ufs_sb.fs_postblformat = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x054C); /// 0x054C format of positional layout tables + ufs_sb.fs_nrpos = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0550); /// 0x0550 number of rotational positions + ufs_sb.fs_postbloff = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0554); /// 0x0554 (__s16) rotation block list head + ufs_sb.fs_rotbloff = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x0558); /// 0x0558 (__u8) blocks for each rotation + ufs_sb.fs_magic = BigEndianBitConverter.ToUInt32(ufs_sb_sectors, 0x055C); /// 0x055C magic number + ufs_sb.fs_space = ufs_sb_sectors[0x0560]; /// 0x0560 list of blocks for each rotation DicConsole.DebugWriteLine("FFS plugin", "ufs_sb offset: 0x{0:X8}", sb_offset); DicConsole.DebugWriteLine("FFS plugin", "fs_link_42bsd: 0x{0:X8}", ufs_sb.fs_link_42bsd); @@ -606,10 +606,10 @@ namespace DiscImageChef.Plugins sbInformation.AppendFormat("{0}% of blocks must be free", ufs_sb.fs_minfree).AppendLine(); sbInformation.AppendFormat("{0}ms for optimal next block", ufs_sb.fs_rotdelay).AppendLine(); sbInformation.AppendFormat("disk rotates {0} times per second ({1}rpm)", ufs_sb.fs_rps, ufs_sb.fs_rps * 60).AppendLine(); -/* sbInformation.AppendFormat("fs_bmask: 0x{0:X8}", ufs_sb.fs_bmask).AppendLine(); - sbInformation.AppendFormat("fs_fmask: 0x{0:X8}", ufs_sb.fs_fmask).AppendLine(); - sbInformation.AppendFormat("fs_bshift: 0x{0:X8}", ufs_sb.fs_bshift).AppendLine(); - sbInformation.AppendFormat("fs_fshift: 0x{0:X8}", ufs_sb.fs_fshift).AppendLine();*/ +/* sbInformation.AppendFormat("fs_bmask: 0x{0:X8}", ufs_sb.fs_bmask).AppendLine(); + sbInformation.AppendFormat("fs_fmask: 0x{0:X8}", ufs_sb.fs_fmask).AppendLine(); + sbInformation.AppendFormat("fs_bshift: 0x{0:X8}", ufs_sb.fs_bshift).AppendLine(); + sbInformation.AppendFormat("fs_fshift: 0x{0:X8}", ufs_sb.fs_fshift).AppendLine();*/ sbInformation.AppendFormat("{0} contiguous blocks at maximum", ufs_sb.fs_maxcontig).AppendLine(); sbInformation.AppendFormat("{0} blocks per cylinder group at maximum", ufs_sb.fs_maxbpg).AppendLine(); sbInformation.AppendFormat("Superblock is {0} bytes", ufs_sb.fs_sbsize).AppendLine(); @@ -719,379 +719,395 @@ namespace DiscImageChef.Plugins } const uint block_size = 8192; + // As specified in FreeBSD source code, FFS/UFS can start in any of four places - const ulong sb_start_floppy = 0; // For floppies, start at offset 0 - const ulong sb_start_ufs1 = 1; + const ulong sb_start_floppy = 0; // For normal devices, start at offset 8192 - const ulong sb_start_ufs2 = 8; + const ulong sb_start_ufs1 = 1; // For UFS2, start at offset 65536 - const ulong sb_start_piggy = 32; + const ulong sb_start_ufs2 = 8; // For piggy devices (?), start at offset 262144 + const ulong sb_start_piggy = 32; + // MAGICs - const UInt32 UFS_MAGIC = 0x00011954; // UFS magic - const UInt32 UFS_MAGIC_BW = 0x0f242697; + const UInt32 UFS_MAGIC = 0x00011954; // BorderWare UFS - const UInt32 UFS2_MAGIC = 0x19540119; + const UInt32 UFS_MAGIC_BW = 0x0f242697; // UFS2 magic - const UInt32 UFS_CIGAM = 0x54190100; + const UInt32 UFS2_MAGIC = 0x19540119; // byteswapped - const UInt32 UFS_BAD_MAGIC = 0x19960408; + const UInt32 UFS_CIGAM = 0x54190100; // Incomplete newfs - // On-disk superblock is quite a mixture of all the UFS/FFS variants - // There is no clear way to detect which one is correct - // And as C# does not support unions this struct will clearly appear quite dirty :p - // To clean up things a little, comment starts with relative superblock offset of field - // Biggest sized supleblock would be 1377 bytes + const UInt32 UFS_BAD_MAGIC = 0x19960408; + + /// + /// On-disk superblock is quite a mixture of all the UFS/FFS variants + /// There is no clear way to detect which one is correct + /// And as C# does not support unions this struct will clearly appear quite dirty :p + /// To clean up things a little, comment starts with relative superblock offset of field + /// Biggest sized supleblock would be 1377 bytes + /// public struct UFSSuperBlock { #region 42BSD + /// 0x0000 linked list of file systems public UInt32 fs_link_42bsd; - // 0x0000 linked list of file systems #endregion #region Sun + /// 0x0000 file system state flag public UInt32 fs_state_sun; - // 0x0000 file system state flag #endregion #region COMMON + /// 0x0004 used for incore super blocks public UInt32 fs_rlink; - // 0x0004 used for incore super blocks + /// 0x0008 addr of super-block in filesys public UInt32 fs_sblkno; - // 0x0008 addr of super-block in filesys + /// 0x000C offset of cyl-block in filesys public UInt32 fs_cblkno; - // 0x000C offset of cyl-block in filesys + /// 0x0010 offset of inode-blocks in filesys public UInt32 fs_iblkno; - // 0x0010 offset of inode-blocks in filesys + /// 0x0014 offset of first data after cg public UInt32 fs_dblkno; - // 0x0014 offset of first data after cg + /// 0x0018 cylinder group offset in cylinder public UInt32 fs_cgoffset; - // 0x0018 cylinder group offset in cylinder + /// 0x001C used to calc mod fs_ntrak public UInt32 fs_cgmask; - // 0x001C used to calc mod fs_ntrak + /// 0x0020 last time written -- time_t public UInt32 fs_time_t; - // 0x0020 last time written -- time_t + /// 0x0024 number of blocks in fs public UInt32 fs_size; - // 0x0024 number of blocks in fs + /// 0x0028 number of data blocks in fs public UInt32 fs_dsize; - // 0x0028 number of data blocks in fs + /// 0x002C number of cylinder groups public UInt32 fs_ncg; - // 0x002C number of cylinder groups + /// 0x0030 size of basic blocks in fs public UInt32 fs_bsize; - // 0x0030 size of basic blocks in fs + /// 0x0034 size of frag blocks in fs public UInt32 fs_fsize; - // 0x0034 size of frag blocks in fs + /// 0x0038 number of frags in a block in fs public UInt32 fs_frag; - // 0x0038 number of frags in a block in fs + // these are configuration parameters + /// 0x003C minimum percentage of free blocks public UInt32 fs_minfree; - // 0x003C minimum percentage of free blocks + /// 0x0040 num of ms for optimal next block public UInt32 fs_rotdelay; - // 0x0040 num of ms for optimal next block + /// 0x0044 disk revolutions per second public UInt32 fs_rps; - // 0x0044 disk revolutions per second + // these fields can be computed from the others + /// 0x0048 ``blkoff'' calc of blk offsets public UInt32 fs_bmask; - // 0x0048 ``blkoff'' calc of blk offsets + /// 0x004C ``fragoff'' calc of frag offsets public UInt32 fs_fmask; - // 0x004C ``fragoff'' calc of frag offsets + /// 0x0050 ``lblkno'' calc of logical blkno public UInt32 fs_bshift; - // 0x0050 ``lblkno'' calc of logical blkno + /// 0x0054 ``numfrags'' calc number of frags public UInt32 fs_fshift; - // 0x0054 ``numfrags'' calc number of frags + // these are configuration parameters + /// 0x0058 max number of contiguous blks public UInt32 fs_maxcontig; - // 0x0058 max number of contiguous blks + /// 0x005C max number of blks per cyl group public UInt32 fs_maxbpg; - // 0x005C max number of blks per cyl group + // these fields can be computed from the others + /// 0x0060 block to frag shift public UInt32 fs_fragshift; - // 0x0060 block to frag shift + /// 0x0064 fsbtodb and dbtofsb shift constant public UInt32 fs_fsbtodb; - // 0x0064 fsbtodb and dbtofsb shift constant + /// 0x0068 actual size of super block public UInt32 fs_sbsize; - // 0x0068 actual size of super block + /// 0x006C csum block offset public UInt32 fs_csmask; - // 0x006C csum block offset + /// 0x0070 csum block number public UInt32 fs_csshift; - // 0x0070 csum block number + /// 0x0074 value of NINDIR public UInt32 fs_nindir; - // 0x0074 value of NINDIR + /// 0x0078 value of INOPB public UInt32 fs_inopb; - // 0x0078 value of INOPB + /// 0x007C value of NSPF public UInt32 fs_nspf; - // 0x007C value of NSPF + // yet another configuration parameter + /// 0x0080 optimization preference, see below public UInt32 fs_optim; - // 0x0080 optimization preference, see below #endregion COMMON - // these fields are derived from the hardware #region Sun + // these fields are derived from the hardware + /// 0x0084 # sectors/track including spares public UInt32 fs_npsect_sun; - // 0x0084 # sectors/track including spares #endregion Sun #region Sunx86 + /// 0x0084 file system state time stamp public UInt32 fs_state_t_sun86; - // 0x0084 file system state time stamp #endregion Sunx86 #region COMMON + /// 0x0088 hardware sector interleave public UInt32 fs_interleave; - // 0x0088 hardware sector interleave + /// 0x008C sector 0 skew, per track public UInt32 fs_trackskew; - // 0x008C sector 0 skew, per track #endregion COMMON + + #region COMMON + // a unique id for this filesystem (currently unused and unmaintained) // In 4.3 Tahoe this space is used by fs_headswitch and fs_trkseek // Neither of those fields is used in the Tahoe code right now but // there could be problems if they are. - #region COMMON - + /// 0x0090 public UInt32 fs_id_1; - // 0x0090 + /// 0x0094 public UInt32 fs_id_2; - // 0x0094 #endregion COMMON #region 43BSD + /// 0x0090 head switch time, usec public UInt32 fs_headswitch_43bsd; - // 0x0090 head switch time, usec + /// 0x0094 track-to-track seek, usec public UInt32 fs_trkseek_43bsd; - // 0x0094 track-to-track seek, usec #endregion 43BSD #region COMMON // sizes determined by number of cylinder groups and their sizes + /// 0x0098 blk addr of cyl grp summary area public UInt32 fs_csaddr; - // 0x0098 blk addr of cyl grp summary area + /// 0x009C size of cyl grp summary area public UInt32 fs_cssize; - // 0x009C size of cyl grp summary area + /// 0x00A0 cylinder group size public UInt32 fs_cgsize; - // 0x00A0 cylinder group size + // these fields are derived from the hardware + /// 0x00A4 tracks per cylinder public UInt32 fs_ntrak; - // 0x00A4 tracks per cylinder + /// 0x00A8 sectors per track public UInt32 fs_nsect; - // 0x00A8 sectors per track + /// 0x00AC sectors per cylinder public UInt32 fs_spc; - // 0x00AC sectors per cylinder + // this comes from the disk driver partitioning + /// 0x00B0 cylinders in file system public UInt32 fs_ncyl; - // 0x00B0 cylinders in file system + // these fields can be computed from the others + /// 0x00B4 cylinders per group public UInt32 fs_cpg; - // 0x00B4 cylinders per group + /// 0x00B8 inodes per cylinder group public UInt32 fs_ipg; - // 0x00B8 inodes per cylinder group + /// 0x00BC blocks per group * fs_frag public UInt32 fs_fpg; - // 0x00BC blocks per group * fs_frag + // this data must be re-computed after crashes - // struct ufs_csum fs_cstotal; // cylinder summary information + // struct ufs_csum fs_cstotal; // cylinder summary information + /// 0x00C0 number of directories public UInt32 fs_cstotal_ndir; - // 0x00C0 number of directories + /// 0x00C4 number of free blocks public UInt32 fs_cstotal_nbfree; - // 0x00C4 number of free blocks + /// 0x00C8 number of free inodes public UInt32 fs_cstotal_nifree; - // 0x00C8 number of free inodes + /// 0x00CC number of free frags public UInt32 fs_cstotal_nffree; - // 0x00CC number of free frags + // these fields are cleared at mount time + /// 0x00D0 super block modified flag public byte fs_fmod; - // 0x00D0 super block modified flag + /// 0x00D1 file system is clean flag public byte fs_clean; - // 0x00D1 file system is clean flag + /// 0x00D2 mounted read-only flag public byte fs_ronly; - // 0x00D2 mounted read-only flag + /// 0x00D3 public byte fs_flags; - // 0x00D3 #endregion common #region UFS1 + /// 0x00D4, 512 bytes, name mounted on public string fs_fsmnt_ufs1; - // 0x00D4, 512 bytes, name mounted on + /// 0x02D4 last cg searched public UInt32 fs_cgrotor_ufs1; - // 0x02D4 last cg searched + /// 0x02D8, 124 bytes, UInt32s, list of fs_cs info buffers public byte[] fs_cs_ufs1; - // 0x02D8, 124 bytes, UInt32s, list of fs_cs info buffers + /// 0x0354 public UInt32 fs_maxcluster_ufs1; - // 0x0354 + /// 0x0358 cyl per cycle in postbl public UInt32 fs_cpc_ufs1; - // 0x0358 cyl per cycle in postbl + /// 0x035C, 256 bytes, [16][8] matrix of UInt16s, old rotation block list head public byte[] fs_opostbl_ufs1; - // 0x035C, 256 bytes, [16][8] matrix of UInt16s, old rotation block list head #endregion UFS1 #region UFS2 + /// 0x00D4, 468 bytes, name mounted on public string fs_fsmnt_ufs2; - // 0x00D4, 468 bytes, name mounted on + /// 0x02A8, 32 bytes, volume name public string fs_volname_ufs2; - // 0x02A8, 32 bytes, volume name + /// 0x02C8 system-wide uid public UInt64 fs_swuid_ufs2; - // 0x02C8 system-wide uid + /// 0x02D0 due to alignment of fs_swuid public UInt32 fs_pad_ufs2; - // 0x02D0 due to alignment of fs_swuid + /// 0x02D4 last cg searched public UInt32 fs_cgrotor_ufs2; - // 0x02D4 last cg searched + /// 0x02D8, 112 bytes, UInt32s, list of fs_cs info buffers public byte[] fs_ocsp_ufs2; - // 0x02D8, 112 bytes, UInt32s, list of fs_cs info buffers + /// 0x0348 # of contiguously allocated dirs public UInt32 fs_contigdirs_ufs2; - // 0x0348 # of contiguously allocated dirs + /// 0x034C cg summary info buffer for fs_cs public UInt32 fs_csp_ufs2; - // 0x034C cg summary info buffer for fs_cs + /// 0x0350 public UInt32 fs_maxcluster_ufs2; - // 0x0350 + /// 0x0354 used by snapshots to track fs public UInt32 fs_active_ufs2; - // 0x0354 used by snapshots to track fs + /// 0x0358 cyl per cycle in postbl public UInt32 fs_old_cpc_ufs2; - // 0x0358 cyl per cycle in postbl + /// 0x035C maximum blocking factor permitted public UInt32 fs_maxbsize_ufs2; - // 0x035C maximum blocking factor permitted + /// 0x0360, 136 bytes, UInt64s, old rotation block list head public byte[] fs_sparecon64_ufs2; - // 0x0360, 136 bytes, UInt64s, old rotation block list head + /// 0x03E8 byte offset of standard superblock public UInt64 fs_sblockloc_ufs2; - // 0x03E8 byte offset of standard superblock - //cylinder summary information*/ + + /// 0x03F0 number of directories public UInt64 fs_cstotal_ndir_ufs2; - // 0x03F0 number of directories + /// 0x03F8 number of free blocks public UInt64 fs_cstotal_nbfree_ufs2; - // 0x03F8 number of free blocks + /// 0x0400 number of free inodes public UInt64 fs_cstotal_nifree_ufs2; - // 0x0400 number of free inodes + /// 0x0408 number of free frags public UInt64 fs_cstotal_nffree_ufs2; - // 0x0408 number of free frags + /// 0x0410 number of free clusters public UInt64 fs_cstotal_numclusters_ufs2; - // 0x0410 number of free clusters + /// 0x0418 future expansion public UInt64 fs_cstotal_spare0_ufs2; - // 0x0418 future expansion + /// 0x0420 future expansion public UInt64 fs_cstotal_spare1_ufs2; - // 0x0420 future expansion + /// 0x0428 future expansion public UInt64 fs_cstotal_spare2_ufs2; - // 0x0428 future expansion + /// 0x0430 last time written public UInt32 fs_time_sec_ufs2; - // 0x0430 last time written + /// 0x0434 last time written public UInt32 fs_time_usec_ufs2; - // 0x0434 last time written + /// 0x0438 number of blocks in fs public UInt64 fs_size_ufs2; - // 0x0438 number of blocks in fs + /// 0x0440 number of data blocks in fs public UInt64 fs_dsize_ufs2; - // 0x0440 number of data blocks in fs + /// 0x0448 blk addr of cyl grp summary area public UInt64 fs_csaddr_ufs2; - // 0x0448 blk addr of cyl grp summary area + /// 0x0450 blocks in process of being freed public UInt64 fs_pendingblocks_ufs2; - // 0x0450 blocks in process of being freed + /// 0x0458 inodes in process of being freed public UInt32 fs_pendinginodes_ufs2; - // 0x0458 inodes in process of being freed #endregion UFS2 #region Sun + /// 0x045C, 212 bytes, reserved for future constants public byte[] fs_sparecon_sun; - // 0x045C, 212 bytes, reserved for future constants + /// 0x0530 public UInt32 fs_reclaim_sun; - // 0x0530 + /// 0x0534 public UInt32 fs_sparecon2_sun; - // 0x0534 + /// 0x0538 file system state time stamp public UInt32 fs_state_t_sun; - // 0x0538 file system state time stamp + /// 0x053C ~usb_bmask public UInt32 fs_qbmask0_sun; - // 0x053C ~usb_bmask + /// 0x0540 ~usb_bmask public UInt32 fs_qbmask1_sun; - // 0x0540 ~usb_bmask + /// 0x0544 ~usb_fmask public UInt32 fs_qfmask0_sun; - // 0x0544 ~usb_fmask + /// 0x0548 ~usb_fmask public UInt32 fs_qfmask1_sun; - // 0x0548 ~usb_fmask #endregion Sun #region Sunx86 + /// 0x045C, 212 bytes, reserved for future constants public byte[] fs_sparecon_sun86; - // 0x045C, 212 bytes, reserved for future constants + /// 0x0530 public UInt32 fs_reclaim_sun86; - // 0x0530 + /// 0x0534 public UInt32 fs_sparecon2_sun86; - // 0x0534 + /// 0x0538 # sectors/track including spares public UInt32 fs_npsect_sun86; - // 0x0538 # sectors/track including spares + /// 0x053C ~usb_bmask public UInt32 fs_qbmask0_sun86; - // 0x053C ~usb_bmask + /// 0x0540 ~usb_bmask public UInt32 fs_qbmask1_sun86; - // 0x0540 ~usb_bmask + /// 0x0544 ~usb_fmask public UInt32 fs_qfmask0_sun86; - // 0x0544 ~usb_fmask + /// 0x0548 ~usb_fmask public UInt32 fs_qfmask1_sun86; - // 0x0548 ~usb_fmask #endregion Sunx86 #region 44BSD + /// 0x045C, 200 bytes public byte[] fs_sparecon_44bsd; - // 0x045C, 200 bytes + /// 0x0524 size of cluster summary array public UInt32 fs_contigsumsize_44bsd; - // 0x0524 size of cluster summary array + /// 0x0528 max length of an internal symlink public UInt32 fs_maxsymlinklen_44bsd; - // 0x0528 max length of an internal symlink + /// 0x052C format of on-disk inodes public UInt32 fs_inodefmt_44bsd; - // 0x052C format of on-disk inodes + /// 0x0530 max representable file size public UInt32 fs_maxfilesize0_44bsd; - // 0x0530 max representable file size + /// 0x0534 max representable file size public UInt32 fs_maxfilesize1_44bsd; - // 0x0534 max representable file size + /// 0x0538 ~usb_bmask public UInt32 fs_qbmask0_44bsd; - // 0x0538 ~usb_bmask + /// 0x053C ~usb_bmask public UInt32 fs_qbmask1_44bsd; - // 0x053C ~usb_bmask + /// 0x0540 ~usb_fmask public UInt32 fs_qfmask0_44bsd; - // 0x0540 ~usb_fmask + /// 0x0544 ~usb_fmask public UInt32 fs_qfmask1_44bsd; - // 0x0544 ~usb_fmask + /// 0x0548 file system state time stamp public UInt32 fs_state_t_44bsd; - // 0x0548 file system state time stamp #endregion 44BSD + /// 0x054C format of positional layout tables public UInt32 fs_postblformat; - // 0x054C format of positional layout tables + /// 0x0550 number of rotational positions public UInt32 fs_nrpos; - // 0x0550 number of rotational positions + /// 0x0554 (__s16) rotation block list head public UInt32 fs_postbloff; - // 0x0554 (__s16) rotation block list head + /// 0x0558 (__u8) blocks for each rotation public UInt32 fs_rotbloff; - // 0x0558 (__u8) blocks for each rotation + /// 0x055C magic number public UInt32 fs_magic; - // 0x055C magic number + /// 0x0560 list of blocks for each rotation public byte fs_space; - // 0x0560 list of blocks for each rotation // 0x0561 } } diff --git a/DiscImageChef.Filesystems/HPFS.cs b/DiscImageChef.Filesystems/HPFS.cs index 5282b0c7..511457cb 100644 --- a/DiscImageChef.Filesystems/HPFS.cs +++ b/DiscImageChef.Filesystems/HPFS.cs @@ -259,132 +259,141 @@ namespace DiscImageChef.Plugins information = sb.ToString(); } - struct HPFS_BIOSParameterBlock // Sector 0 + /// + /// BIOS Parameter Block, at sector 0 + /// + struct HPFS_BIOSParameterBlock { + /// 0x000, Jump to boot code public byte jmp1; - // 0x000, Jump to boot code + /// 0x001, ...; public UInt16 jmp2; - // 0x001, ...; + /// 0x003, OEM Name, 8 bytes, space-padded public string OEMName; - // 0x003, OEM Name, 8 bytes, space-padded + /// 0x00B, Bytes per sector public UInt16 bps; - // 0x00B, Bytes per sector + /// 0x00D, Sectors per cluster public byte spc; - // 0x00D, Sectors per cluster + /// 0x00E, Reserved sectors between BPB and... does it have sense in HPFS? public UInt16 rsectors; - // 0x00E, Reserved sectors between BPB and... does it have sense in HPFS? + /// 0x010, Number of FATs... seriously? public byte fats_no; - // 0x010, Number of FATs... seriously? + /// 0x011, Number of entries on root directory... ok public UInt16 root_ent; - // 0x011, Number of entries on root directory... ok + /// 0x013, Sectors in volume... doubt it public UInt16 sectors; - // 0x013, Sectors in volume... doubt it + /// 0x015, Media descriptor public byte media; - // 0x015, Media descriptor + /// 0x016, Sectors per FAT... again public UInt16 spfat; - // 0x016, Sectors per FAT... again + /// 0x018, Sectors per track... you're kidding public UInt16 sptrk; - // 0x018, Sectors per track... you're kidding + /// 0x01A, Heads... stop! public UInt16 heads; - // 0x01A, Heads... stop! + /// 0x01C, Hidden sectors before BPB public UInt32 hsectors; - // 0x01C, Hidden sectors before BPB + /// 0x024, Sectors in volume if > 65535... public UInt32 big_sectors; - // 0x024, Sectors in volume if > 65535... + /// 0x028, Drive number public byte drive_no; - // 0x028, Drive number + /// 0x029, Volume flags? public byte nt_flags; - // 0x029, Volume flags? + /// 0x02A, EPB signature, 0x29 public byte signature; - // 0x02A, EPB signature, 0x29 + /// 0x02B, Volume serial number public UInt32 serial_no; - // 0x02B, Volume serial number + /// 0x02F, Volume label, 11 bytes, space-padded public string volume_label; - // 0x02F, Volume label, 11 bytes, space-padded + /// 0x03A, Filesystem type, 8 bytes, space-padded ("HPFS ") public string fs_type; - // 0x03A, Filesystem type, 8 bytes, space-padded ("HPFS ") } - struct HPFS_SuperBlock // Sector 16 + /// + /// HPFS superblock at sector 16 + /// + struct HPFS_SuperBlock { + /// 0x000, 0xF995E849 public UInt32 magic1; - // 0x000, 0xF995E849 + /// 0x004, 0xFA53E9C5 public UInt32 magic2; - // 0x004, 0xFA53E9C5 + /// 0x008, HPFS version public byte version; - // 0x008, HPFS version + /// 0x009, 2 if <= 4 GiB, 3 if > 4 GiB public byte func_version; - // 0x009, 2 if <= 4 GiB, 3 if > 4 GiB + /// 0x00A, Alignment public UInt16 dummy; - // 0x00A, Alignment + /// 0x00C, LSN pointer to root fnode public UInt32 root_fnode; - // 0x00C, LSN pointer to root fnode + /// 0x010, Sectors on volume public UInt32 sectors; - // 0x010, Sectors on volume + /// 0x014, Bad blocks on volume public UInt32 badblocks; - // 0x014, Bad blocks on volume + /// 0x018, LSN pointer to volume bitmap public UInt32 bitmap_lsn; - // 0x018, LSN pointer to volume bitmap + /// 0x01C, 0 public UInt32 zero1; - // 0x01C, 0 + /// 0x020, LSN pointer to badblock directory public UInt32 badblock_lsn; - // 0x020, LSN pointer to badblock directory + /// 0x024, 0 public UInt32 zero2; - // 0x024, 0 + /// 0x028, Time of last CHKDSK public Int32 last_chkdsk; - // 0x028, Time of last CHKDSK + /// 0x02C, Time of last optimization public Int32 last_optim; - // 0x02C, Time of last optimization + /// 0x030, Sectors of dir band public UInt32 dband_sectors; - // 0x030, Sectors of dir band + /// 0x034, Start sector of dir band public UInt32 dband_start; - // 0x034, Start sector of dir band + /// 0x038, Last sector of dir band public UInt32 dband_last; - // 0x038, Last sector of dir band + /// 0x03C, LSN of free space bitmap public UInt32 dband_bitmap; - // 0x03C, LSN of free space bitmap + /// 0x040, Can be used for volume name (32 bytes) public UInt64 zero3; - // 0x040, Can be used for volume name (32 bytes) + /// 0x048, ... public UInt64 zero4; - // 0x048, ... + /// 0x04C, ... public UInt64 zero5; - // 0x04C, ... + /// 0x050, ...; public UInt64 zero6; - // 0x050, ...; + /// 0x058, LSN pointer to ACLs (only HPFS386) public UInt32 acl_start; - // 0x058, LSN pointer to ACLs (only HPFS386) } - struct HPFS_SpareBlock // Sector 17 + /// + /// HPFS spareblock at sector 17 + /// + struct HPFS_SpareBlock { + /// 0x000, 0xF9911849 public UInt32 magic1; - // 0x000, 0xF9911849 + /// 0x004, 0xFA5229C5 public UInt32 magic2; - // 0x004, 0xFA5229C5 + /// 0x008, HPFS flags public byte flags1; - // 0x008, HPFS flags + /// 0x009, HPFS386 flags public byte flags2; - // 0x009, HPFS386 flags + /// 0x00A, Alignment public UInt16 dummy; - // 0x00A, Alignment + /// 0x00C, LSN of hotfix directory public UInt32 hotfix_start; - // 0x00C, LSN of hotfix directory + /// 0x010, Used hotfixes public UInt32 hotfix_used; - // 0x010, Used hotfixes + /// 0x014, Total hotfixes available public UInt32 hotfix_entries; - // 0x014, Total hotfixes available + /// 0x018, Unused spare dnodes public UInt32 spare_dnodes_free; - // 0x018, Unused spare dnodes + /// 0x01C, Length of spare dnodes list public UInt32 spare_dnodes; - // 0x01C, Length of spare dnodes list + /// 0x020, LSN of codepage directory public UInt32 codepage_lsn; - // 0x020, LSN of codepage directory + /// 0x024, Number of codepages used public UInt32 codepages; - // 0x024, Number of codepages used + /// 0x028, SuperBlock CRC32 (only HPFS386) public UInt32 sb_crc32; - // 0x028, SuperBlock CRC32 (only HPFS386) + /// 0x02C, SpareBlock CRC32 (only HPFS386) public UInt32 sp_crc32; - // 0x02C, SpareBlock CRC32 (only HPFS386) } } } diff --git a/DiscImageChef.Filesystems/LisaFS.cs b/DiscImageChef.Filesystems/LisaFS.cs index e7ece8d0..7d95a0cd 100644 --- a/DiscImageChef.Filesystems/LisaFS.cs +++ b/DiscImageChef.Filesystems/LisaFS.cs @@ -423,176 +423,176 @@ namespace DiscImageChef.Plugins struct Lisa_MDDF { - // 0x00, Filesystem version + /// 0x00, Filesystem version public UInt16 fsversion; - // 0x02, Volume ID + /// 0x02, Volume ID public UInt64 volid; - // 0x0A, Volume sequence number + /// 0x0A, Volume sequence number public UInt16 volnum; - // 0x0C, Pascal string, 32+1 bytes, volume name + /// 0x0C, Pascal string, 32+1 bytes, volume name public string volname; - // 0x2D, unknown, possible padding + /// 0x2D, unknown, possible padding public byte unknown1; - // 0x2E, Pascal string, 32+1 bytes, password + /// 0x2E, Pascal string, 32+1 bytes, password public string password; - // 0x4F, unknown, possible padding + /// 0x4F, unknown, possible padding public byte unknown2; - // 0x50, Lisa serial number that init'ed this disk + /// 0x50, Lisa serial number that init'ed this disk public UInt32 machine_id; - // 0x54, ID of the master copy ? no idea really + /// 0x54, ID of the master copy ? no idea really public UInt32 master_copy_id; - // 0x58, Date of volume creation + /// 0x58, Date of volume creation public DateTime dtvc; - // 0x5C, Date... + /// 0x5C, Date... public DateTime dtcc; - // 0x60, Date of volume backup + /// 0x60, Date of volume backup public DateTime dtvb; - // 0x64, Date of volume scavenging + /// 0x64, Date of volume scavenging public DateTime dtvs; - // 0x68, unknown + /// 0x68, unknown public UInt32 unknown3; - // 0x6C, block the MDDF is residing on + /// 0x6C, block the MDDF is residing on public UInt32 mddf_block; - // 0x70, volsize-1 + /// 0x70, volsize-1 public UInt32 volsize_minus_one; - // 0x74, volsize-1-mddf_block + /// 0x74, volsize-1-mddf_block public UInt32 volsize_minus_mddf_minus_one; - // 0x78, Volume size in blocks + /// 0x78, Volume size in blocks public UInt32 vol_size; - // 0x7C, Blocks size of underlying drive (data+tags) + /// 0x7C, Blocks size of underlying drive (data+tags) public UInt16 blocksize; - // 0x7E, Data only block size + /// 0x7E, Data only block size public UInt16 datasize; - // 0x80, unknown + /// 0x80, unknown public UInt16 unknown4; - // 0x82, unknown + /// 0x82, unknown public UInt32 unknown5; - // 0x86, unknown + /// 0x86, unknown public UInt32 unknown6; - // 0x8A, Size in sectors of filesystem clusters + /// 0x8A, Size in sectors of filesystem clusters public UInt16 clustersize; - // 0x8C, Filesystem size in blocks + /// 0x8C, Filesystem size in blocks public UInt32 fs_size; - // 0x90, unknown + /// 0x90, unknown public UInt32 unknown7; - // 0x94, unknown + /// 0x94, unknown public UInt32 unknown8; - // 0x98, unknown + /// 0x98, unknown public UInt32 unknown9; - // 0x9C, unknown + /// 0x9C, unknown public UInt32 unknown10; - // 0xA0, unknown + /// 0xA0, unknown public UInt32 unknown11; - // 0xA4, unknown + /// 0xA4, unknown public UInt32 unknown12; - // 0xA8, unknown + /// 0xA8, unknown public UInt32 unknown13; - // 0xAC, unknown + /// 0xAC, unknown public UInt32 unknown14; - // 0xB0, Files in volume + /// 0xB0, Files in volume public UInt16 filecount; - // 0xB2, unknown + /// 0xB2, unknown public UInt32 unknown15; - // 0xB6, unknown + /// 0xB6, unknown public UInt32 unknown16; - // 0xBA, Free blocks + /// 0xBA, Free blocks public UInt32 freecount; - // 0xBE, unknown + /// 0xBE, unknown public UInt16 unknown17; - // 0xC0, unknown + /// 0xC0, unknown public UInt32 unknown18; - // 0xC4, no idea + /// 0xC4, no idea public UInt64 overmount_stamp; - // 0xCC, serialization, lisa serial number authorized to use blocked software on this volume + /// 0xCC, serialization, lisa serial number authorized to use blocked software on this volume public UInt32 serialization; - // 0xD0, unknown + /// 0xD0, unknown public UInt32 unknown19; - // 0xD4, unknown, possible timestamp + /// 0xD4, unknown, possible timestamp public UInt32 unknown_timestamp; - // 0xD8, unknown + /// 0xD8, unknown public UInt32 unknown20; - // 0xDC, unknown + /// 0xDC, unknown public UInt32 unknown21; - // 0xE0, unknown + /// 0xE0, unknown public UInt32 unknown22; - // 0xE4, unknown + /// 0xE4, unknown public UInt32 unknown23; - // 0xE8, unknown + /// 0xE8, unknown public UInt32 unknown24; - // 0xEC, unknown + /// 0xEC, unknown public UInt32 unknown25; - // 0xF0, unknown + /// 0xF0, unknown public UInt32 unknown26; - // 0xF4, unknown + /// 0xF4, unknown public UInt32 unknown27; - // 0xF8, unknown + /// 0xF8, unknown public UInt32 unknown28; - // 0xFC, unknown + /// 0xFC, unknown public UInt32 unknown29; - // 0x100, unknown + /// 0x100, unknown public UInt32 unknown30; - // 0x104, unknown + /// 0x104, unknown public UInt32 unknown31; - // 0x108, unknown + /// 0x108, unknown public UInt32 unknown32; - // 0x10C, unknown + /// 0x10C, unknown public UInt32 unknown33; - // 0x110, unknown + /// 0x110, unknown public UInt32 unknown34; - // 0x114, unknown + /// 0x114, unknown public UInt32 unknown35; - // 0x118, ID of volume where this volume was backed up + /// 0x118, ID of volume where this volume was backed up public UInt64 backup_volid; - // 0x120, Size of LisaInfo label + /// 0x120, Size of LisaInfo label public UInt16 label_size; - // 0x122, not clear + /// 0x122, not clear public UInt16 fs_overhead; - // 0x124, Return code of Scavenger + /// 0x124, Return code of Scavenger public UInt16 result_scavenge; - // 0x126, No idea + /// 0x126, No idea public UInt16 boot_code; - // 0x128, No idea + /// 0x128, No idea public UInt16 boot_environ; - // 0x12A, unknown + /// 0x12A, unknown public UInt32 unknown36; - // 0x12E, unknown + /// 0x12E, unknown public UInt32 unknown37; - // 0x132, unknown + /// 0x132, unknown public UInt32 unknown38; - // 0x136, Total volumes in sequence + /// 0x136, Total volumes in sequence public UInt16 vol_sequence; - // 0x138, Volume is dirty? + /// 0x138, Volume is dirty? public byte vol_left_mounted; - // Is password present? (On-disk position unknown) + /// Is password present? (On-disk position unknown) public byte passwd_present; - // Opened files (memory-only?) (On-disk position unknown) + /// Opened files (memory-only?) (On-disk position unknown) public UInt32 opencount; - // No idea (On-disk position unknown) + /// No idea (On-disk position unknown) public UInt32 copy_thread; // Flags are boolean, but Pascal seems to use them as full unsigned 8 bit values - // No idea (On-disk position unknown) + /// No idea (On-disk position unknown) public byte privileged; - // Read-only volume (On-disk position unknown) + /// Read-only volume (On-disk position unknown) public byte write_protected; - // Master disk (On-disk position unknown) + /// Master disk (On-disk position unknown) public byte master; - // Copy disk (On-disk position unknown) + /// Copy disk (On-disk position unknown) public byte copy; - // No idea (On-disk position unknown) + /// No idea (On-disk position unknown) public byte copy_flag; - // No idea (On-disk position unknown) + /// No idea (On-disk position unknown) public byte scavenge_flag; } struct Lisa_Tag { - // 0x00 Unknown + /// 0x00 Unknown public UInt32 unknown1; - // 0x04 File ID + /// 0x04 File ID public UInt16 fileID; - // 0x06 Unknown + /// 0x06 Unknown public UInt16 unknown2; - // 0x08 Unknown + /// 0x08 Unknown public UInt32 unknown3; } } diff --git a/DiscImageChef.Filesystems/MinixFS.cs b/DiscImageChef.Filesystems/MinixFS.cs index d8eb0580..fb92299d 100644 --- a/DiscImageChef.Filesystems/MinixFS.cs +++ b/DiscImageChef.Filesystems/MinixFS.cs @@ -245,58 +245,64 @@ namespace DiscImageChef.Plugins information = sb.ToString(); } + /// + /// Superblock for Minix V1 and V2 filesystems + /// public struct MinixSuperBlock { + /// 0x00, inodes on volume public UInt16 s_ninodes; - // 0x00, inodes on volume + /// 0x02, zones on volume public UInt16 s_nzones; - // 0x02, zones on volume + /// 0x04, blocks on inode map public UInt16 s_imap_blocks; - // 0x04, blocks on inode map + /// 0x06, blocks on zone map public UInt16 s_zmap_blocks; - // 0x06, blocks on zone map + /// 0x08, first data zone public UInt16 s_firstdatazone; - // 0x08, first data zone + /// 0x0A, log2 of blocks/zone public UInt16 s_log_zone_size; - // 0x0A, log2 of blocks/zone + /// 0x0C, max file size public UInt32 s_max_size; - // 0x0C, max file size + /// 0x10, magic public UInt16 s_magic; - // 0x10, magic + /// 0x12, filesystem state public UInt16 s_state; - // 0x12, filesystem state + /// 0x14, number of zones public UInt32 s_zones; - // 0x14, number of zones } + /// + /// Superblock for Minix V3 filesystems + /// public struct Minix3SuperBlock { + /// 0x00, inodes on volume public UInt32 s_ninodes; - // 0x00, inodes on volume + /// 0x04, padding public UInt16 s_pad0; - // 0x04, padding + /// 0x06, blocks on inode map public UInt16 s_imap_blocks; - // 0x06, blocks on inode map + /// 0x08, blocks on zone map public UInt16 s_zmap_blocks; - // 0x08, blocks on zone map + /// 0x0A, first data zone public UInt16 s_firstdatazone; - // 0x0A, first data zone + /// 0x0C, log2 of blocks/zone public UInt16 s_log_zone_size; - // 0x0C, log2 of blocks/zone + /// 0x0E, padding public UInt16 s_pad1; - // 0x0E, padding + /// 0x10, max file size public UInt32 s_max_size; - // 0x10, max file size + /// 0x14, number of zones public UInt32 s_zones; - // 0x14, number of zones + /// 0x18, magic public UInt16 s_magic; - // 0x18, magic + /// 0x1A, padding public UInt16 s_pad2; - // 0x1A, padding + /// 0x1C, bytes in a block public UInt16 s_blocksize; - // 0x1C, bytes in a block + /// 0x1E, on-disk structures version public byte s_disk_version; - // 0x1E, on-disk structures version } } } diff --git a/DiscImageChef.Filesystems/NTFS.cs b/DiscImageChef.Filesystems/NTFS.cs index eb122ac8..fc60aace 100644 --- a/DiscImageChef.Filesystems/NTFS.cs +++ b/DiscImageChef.Filesystems/NTFS.cs @@ -176,72 +176,77 @@ namespace DiscImageChef.Plugins information = sb.ToString(); } - struct NTFS_BootBlock // Sector 0 + /// + /// NTFS $BOOT + /// + struct NTFS_BootBlock { - // BIOS Parameter Block + // Start of BIOS Parameter Block + /// 0x000, Jump to boot code public byte jmp1; - // 0x000, Jump to boot code + /// 0x001, ...; public UInt16 jmp2; - // 0x001, ...; + /// 0x003, OEM Name, 8 bytes, space-padded, must be "NTFS " public string OEMName; - // 0x003, OEM Name, 8 bytes, space-padded, must be "NTFS " + /// 0x00B, Bytes per sector public UInt16 bps; - // 0x00B, Bytes per sector + /// 0x00D, Sectors per cluster public byte spc; - // 0x00D, Sectors per cluster + /// 0x00E, Reserved sectors, seems 0 public UInt16 rsectors; - // 0x00E, Reserved sectors, seems 0 + /// 0x010, Number of FATs... obviously, 0 public byte fats_no; - // 0x010, Number of FATs... obviously, 0 + /// 0x011, Number of entries on root directory... 0 public UInt16 root_ent; - // 0x011, Number of entries on root directory... 0 + /// 0x013, Sectors in volume... 0 public UInt16 sml_sectors; - // 0x013, Sectors in volume... 0 + /// 0x015, Media descriptor public byte media; - // 0x015, Media descriptor + /// 0x016, Sectors per FAT... 0 public UInt16 spfat; - // 0x016, Sectors per FAT... 0 + /// 0x018, Sectors per track, required to boot public UInt16 sptrk; - // 0x018, Sectors per track, required to boot + /// 0x01A, Heads... required to boot public UInt16 heads; - // 0x01A, Heads... required to boot + /// 0x01C, Hidden sectors before BPB public UInt32 hsectors; - // 0x01C, Hidden sectors before BPB + /// 0x020, Sectors in volume if > 65535... 0 public UInt32 big_sectors; - // 0x020, Sectors in volume if > 65535... 0 + /// 0x024, Drive number public byte drive_no; - // 0x024, Drive number + /// 0x025, 0 public byte nt_flags; - // 0x025, 0 + /// 0x026, EPB signature, 0x80 public byte signature1; - // 0x026, EPB signature, 0x80 + /// 0x027, Alignment public byte dummy; - // 0x027, Alignment // End of BIOS Parameter Block - // NTFS real superblock + + // Start of NTFS real superblock + /// 0x028, Sectors on volume public Int64 sectors; - // 0x028, Sectors on volume + /// 0x030, LSN of $MFT public Int64 mft_lsn; - // 0x030, LSN of $MFT + /// 0x038, LSN of $MFTMirror public Int64 mftmirror_lsn; - // 0x038, LSN of $MFTMirror + /// 0x040, Clusters per MFT record public sbyte mft_rc_clusters; - // 0x040, Clusters per MFT record + /// 0x041, Alignment public byte dummy2; - // 0x041, Alignment + /// 0x042, Alignment public UInt16 dummy3; - // 0x042, Alignment + /// 0x044, Clusters per index block public sbyte index_blk_cts; - // 0x044, Clusters per index block + /// 0x045, Alignment public byte dummy4; - // 0x045, Alignment + /// 0x046, Alignment public UInt16 dummy5; - // 0x046, Alignment + /// 0x048, Volume serial number public UInt64 serial_no; - // 0x048, Volume serial number // End of NTFS superblock, followed by 430 bytes of boot code + + /// 0x1FE, 0xAA55 public UInt16 signature2; - // 0x1FE, 0xAA55 } } } diff --git a/DiscImageChef.Filesystems/ODS.cs b/DiscImageChef.Filesystems/ODS.cs index 174cc0a1..7eb3f2ef 100644 --- a/DiscImageChef.Filesystems/ODS.cs +++ b/DiscImageChef.Filesystems/ODS.cs @@ -279,98 +279,98 @@ namespace DiscImageChef.Plugins struct ODSHomeBlock { + /// 0x000, LBN of THIS home block public UInt32 homelbn; - // 0x000, LBN of THIS home block + /// 0x004, LBN of the secondary home block public UInt32 alhomelbn; - // 0x004, LBN of the secondary home block + /// 0x008, LBN of backup INDEXF.SYS;1 public UInt32 altidxlbn; - // 0x008, LBN of backup INDEXF.SYS;1 + /// 0x00C, High byte contains filesystem version (1, 2 or 5), low byte contains revision (1) public UInt16 struclev; - // 0x00C, High byte contains filesystem version (1, 2 or 5), low byte contains revision (1) + /// 0x00E, Number of blocks each bit of the volume bitmap represents public UInt16 cluster; - // 0x00E, Number of blocks each bit of the volume bitmap represents + /// 0x010, VBN of THIS home block public UInt16 homevbn; - // 0x010, VBN of THIS home block + /// 0x012, VBN of the secondary home block public UInt16 alhomevbn; - // 0x012, VBN of the secondary home block + /// 0x014, VBN of backup INDEXF.SYS;1 public UInt16 altidxvbn; - // 0x014, VBN of backup INDEXF.SYS;1 + /// 0x016, VBN of the bitmap public UInt16 ibmapvbn; - // 0x016, VBN of the bitmap + /// 0x018, LBN of the bitmap public UInt32 ibmaplbn; - // 0x018, LBN of the bitmap + /// 0x01C, Max files on volume public UInt32 maxfiles; - // 0x01C, Max files on volume + /// 0x020, Bitmap size in sectors public UInt16 ibmapsize; - // 0x020, Bitmap size in sectors + /// 0x022, Reserved files, 5 at minimum public UInt16 resfiles; - // 0x022, Reserved files, 5 at minimum + /// 0x024, Device type, ODS-2 defines it as always 0 public UInt16 devtype; - // 0x024, Device type, ODS-2 defines it as always 0 + /// 0x026, Relative volume number (number of the volume in a set) public UInt16 rvn; - // 0x026, Relative volume number (number of the volume in a set) + /// 0x028, Total number of volumes in the set this volume is public UInt16 setcount; - // 0x028, Total number of volumes in the set this volume is + /// 0x02A, Flags public UInt16 volchar; - // 0x02A, Flags + /// 0x02C, User ID of the volume owner public UInt32 volowner; - // 0x02C, User ID of the volume owner + /// 0x030, Security mask (??) public UInt32 sec_mask; - // 0x030, Security mask (??) + /// 0x034, Volume permissions (system, owner, group and other) public UInt16 protect; - // 0x034, Volume permissions (system, owner, group and other) + /// 0x036, Default file protection, unsupported in ODS-2 public UInt16 fileprot; - // 0x036, Default file protection, unsupported in ODS-2 + /// 0x038, Default file record protection public UInt16 recprot; - // 0x038, Default file record protection + /// 0x03A, Checksum of all preceding entries public UInt16 checksum1; - // 0x03A, Checksum of all preceding entries + /// 0x03C, Creation date public UInt64 credate; - // 0x03C, Creation date + /// 0x044, Window size (pointers for the window) public byte window; - // 0x044, Window size (pointers for the window) + /// 0x045, Directories to be stored in cache public byte lru_lim; - // 0x045, Directories to be stored in cache + /// 0x046, Default allocation size in blocks public UInt16 extend; - // 0x046, Default allocation size in blocks + /// 0x048, Minimum file retention period public UInt64 retainmin; - // 0x048, Minimum file retention period + /// 0x050, Maximum file retention period public UInt64 retainmax; - // 0x050, Maximum file retention period + /// 0x058, Last modification date public UInt64 revdate; - // 0x058, Last modification date + /// 0x060, Minimum security class, 20 bytes public byte[] min_class; - // 0x060, Minimum security class, 20 bytes + /// 0x074, Maximum security class, 20 bytes public byte[] max_class; - // 0x074, Maximum security class, 20 bytes + /// 0x088, File lookup table FID public UInt16 filetab_fid1; - // 0x088, File lookup table FID + /// 0x08A, File lookup table FID public UInt16 filetab_fid2; - // 0x08A, File lookup table FID + /// 0x08C, File lookup table FID public UInt16 filetab_fid3; - // 0x08C, File lookup table FID + /// 0x08E, Lowest structure level on the volume public UInt16 lowstruclev; - // 0x08E, Lowest structure level on the volume + /// 0x090, Highest structure level on the volume public UInt16 highstruclev; - // 0x090, Highest structure level on the volume + /// 0x092, Volume copy date (??) public UInt64 copydate; - // 0x092, Volume copy date (??) + /// 0x09A, 302 bytes public byte[] reserved1; - // 0x09A, 302 bytes + /// 0x1C8, Physical drive serial number public UInt32 serialnum; - // 0x1C8, Physical drive serial number + /// 0x1CC, Name of the volume set, 12 bytes public string strucname; - // 0x1CC, Name of the volume set, 12 bytes + /// 0x1D8, Volume label, 12 bytes public string volname; - // 0x1D8, Volume label, 12 bytes + /// 0x1E4, Name of the volume owner, 12 bytes public string ownername; - // 0x1E4, Name of the volume owner, 12 bytes + /// 0x1F0, ODS-2 defines it as "DECFILE11B", 12 bytes public string format; - // 0x1F0, ODS-2 defines it as "DECFILE11B", 12 bytes + /// 0x1FC, Reserved public UInt16 reserved2; - // 0x1FC, Reserved + /// 0x1FE, Checksum of preceding 255 words (16 bit units) public UInt16 checksum2; - // 0x1FE, Checksum of preceding 255 words (16 bit units) } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/Opera.cs b/DiscImageChef.Filesystems/Opera.cs index c1c63c6a..efe0b823 100644 --- a/DiscImageChef.Filesystems/Opera.cs +++ b/DiscImageChef.Filesystems/Opera.cs @@ -141,32 +141,32 @@ namespace DiscImageChef.Plugins struct OperaSuperBlock { + /// 0x000, Record type, must be 1 public byte record_type; - // 0x000, Record type, must be 1 + /// 0x001, 5 bytes, "ZZZZZ" public byte[] sync_bytes; - // 0x001, 5 bytes, "ZZZZZ" = new byte[5]; + /// 0x006, Record version, must be 1 public byte record_version; - // 0x006, Record version, must be 1 + /// 0x007, Volume flags public byte volume_flags; - // 0x007, Volume flags + /// 0x008, 32 bytes, volume comment public string volume_comment; - // 0x008, 32 bytes, volume comment + /// 0x028, 32 bytes, volume label public string volume_label; - // 0x028, 32 bytes, volume label + /// 0x048, Volume ID public Int32 volume_id; - // 0x048, Volume ID + /// 0x04C, Block size in bytes public Int32 block_size; - // 0x04C, Block size in bytes + /// 0x050, Blocks in volume public Int32 block_count; - // 0x050, Blocks in volume + /// 0x054, Root directory ID public Int32 root_dirid; - // 0x054, Root directory ID + /// 0x058, Root directory blocks public Int32 rootdir_blocks; - // 0x058, Root directory blocks + /// 0x05C, Root directory block size public Int32 rootdir_bsize; - // 0x05C, Root directory block size + /// 0x060, Last root directory copy public Int32 last_root_copy; - // 0x060, Last root directory copy } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/SolarFS.cs b/DiscImageChef.Filesystems/SolarFS.cs index 13f83e93..045342ad 100644 --- a/DiscImageChef.Filesystems/SolarFS.cs +++ b/DiscImageChef.Filesystems/SolarFS.cs @@ -59,7 +59,7 @@ namespace DiscImageChef.Plugins if ((2 + partitionStart) >= imagePlugin.GetSectors()) return false; - byte signature; // 0x29 + byte signature; /// 0x29 string fs_type; // "SOL_FS " byte[] bpb = imagePlugin.ReadSector(0 + partitionStart); @@ -160,38 +160,38 @@ namespace DiscImageChef.Plugins public struct SolarOSParameterBlock { + /// 0x00, x86 jump (3 bytes), jumps to 0x60 public byte[] x86_jump; - // 0x00, x86 jump (3 bytes), jumps to 0x60 + /// 0x03, 8 bytes, "SOLAR_OS" public string OEMName; - // 0x03, 8 bytes, "SOLAR_OS" + /// 0x0B, Bytes per sector public UInt16 bps; - // 0x0B, Bytes per sector + /// 0x0D, unknown, 0x01 public byte unk1; - // 0x0D, unknown, 0x01 + /// 0x0E, unknown, 0x0201 public UInt16 unk2; - // 0x0E, unknown, 0x0201 + /// 0x10, Number of entries on root directory ? (no root directory found) public UInt16 root_ent; - // 0x10, Number of entries on root directory ? (no root directory found) + /// 0x12, Sectors in volume public UInt16 sectors; - // 0x12, Sectors in volume + /// 0x14, Media descriptor public byte media; - // 0x14, Media descriptor + /// 0x15, Sectors per FAT ? (no FAT found) public UInt16 spfat; - // 0x15, Sectors per FAT ? (no FAT found) + /// 0x17, Sectors per track public UInt16 sptrk; - // 0x17, Sectors per track + /// 0x19, Heads public UInt16 heads; - // 0x19, Heads + /// 0x1B, unknown, 10 bytes, zero-filled public byte[] unk3; - // 0x1B, unknown, 10 bytes, zero-filled + /// 0x25, 0x29 public byte signature; - // 0x25, 0x29 + /// 0x26, unknown, zero-filled public UInt32 unk4; - // 0x26, unknown, zero-filled + /// 0x2A, 11 bytes, volume name, space-padded public string vol_name; - // 0x2A, 11 bytes, volume name, space-padded + /// 0x35, 8 bytes, "SOL_FS " public string fs_type; - // 0x35, 8 bytes, "SOL_FS " } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/SysV.cs b/DiscImageChef.Filesystems/SysV.cs index 900333ee..d90b008d 100644 --- a/DiscImageChef.Filesystems/SysV.cs +++ b/DiscImageChef.Filesystems/SysV.cs @@ -77,24 +77,24 @@ namespace DiscImageChef.Plugins UInt32 s_fsize; /*for(int j = 0; j<=(br.BaseStream.Length/0x200); j++) - { - br.BaseStream.Seek(offset + j*0x200 + 0x1F8, SeekOrigin.Begin); // System V magic location - magic = br.ReadUInt32(); + { + br.BaseStream.Seek(offset + j*0x200 + 0x1F8, SeekOrigin.Begin); // System V magic location + magic = br.ReadUInt32(); - if(magic == SYSV_MAGIC || magic == SYSV_CIGAM) - Console.WriteLine("0x{0:X8}: 0x{1:X8} FOUND", br.BaseStream.Position-4, magic); - else - Console.WriteLine("0x{0:X8}: 0x{1:X8}", br.BaseStream.Position-4, magic); - }*/ + if(magic == SYSV_MAGIC || magic == SYSV_CIGAM) + Console.WriteLine("0x{0:X8}: 0x{1:X8} FOUND", br.BaseStream.Position-4, magic); + else + Console.WriteLine("0x{0:X8}: 0x{1:X8}", br.BaseStream.Position-4, magic); + }*/ /*UInt32 number; - br.BaseStream.Seek(offset+0x3A00, SeekOrigin.Begin); - while((br.BaseStream.Position) <= (offset+0x3C00)) - { - number = br.ReadUInt32(); + br.BaseStream.Seek(offset+0x3A00, SeekOrigin.Begin); + while((br.BaseStream.Position) <= (offset+0x3C00)) + { + number = br.ReadUInt32(); - Console.WriteLine("@{0:X8}: 0x{1:X8} ({1})", br.BaseStream.Position-offset-4, number); - }*/ + Console.WriteLine("@{0:X8}: 0x{1:X8} ({1})", br.BaseStream.Position-offset-4, number); + }*/ byte sb_size_in_sectors; @@ -162,7 +162,7 @@ namespace DiscImageChef.Plugins public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information) { information = ""; - + StringBuilder sb = new StringBuilder(); BigEndianBitConverter.IsLittleEndian = true; // Start in little endian until we know what are we handling here int start; @@ -188,7 +188,7 @@ namespace DiscImageChef.Plugins { sb_sector = imagePlugin.ReadSectors((ulong)start + partitionStart, sb_size_in_sectors); magic = BigEndianBitConverter.ToUInt32(sb_sector, 0x3F8); // XENIX magic location - + if (magic == XENIX_MAGIC) { BigEndianBitConverter.IsLittleEndian = true; // Little endian @@ -203,7 +203,7 @@ namespace DiscImageChef.Plugins } magic = BigEndianBitConverter.ToUInt32(sb_sector, 0x1F8); // XENIX magic location - + if (magic == SYSV_MAGIC) { BigEndianBitConverter.IsLittleEndian = true; // Little endian @@ -222,8 +222,8 @@ namespace DiscImageChef.Plugins s_fname = StringHandlers.CToString(coherent_string); Array.Copy(sb_sector, 0x1EE, coherent_string, 0, 6); // Coherent UNIX s_fpack location s_fpack = StringHandlers.CToString(coherent_string); - - if (s_fname == COH_FNAME || s_fpack == COH_FPACK) + + if (s_fname == COH_FNAME || s_fpack == COH_FPACK) { BigEndianBitConverter.IsLittleEndian = true; // Coherent is in PDP endianness, use helper for that coherent = true; @@ -244,7 +244,7 @@ namespace DiscImageChef.Plugins s_nfree = (UInt16)(s_nfree >> 8); s_ninode = (UInt16)(s_ninode >> 8); } - + if ((s_fsize & 0xFF000000) == 0x00 && (s_nfree & 0xFF00) == 0x00 && (s_ninode & 0xFF00) == 0x00) { if (s_fsize < V7_MAXSIZE && s_nfree < V7_NICFREE && s_ninode < V7_NICINOD) @@ -269,7 +269,7 @@ namespace DiscImageChef.Plugins byte[] xenix_strings = new byte[6]; XenixSuperBlock xnx_sb = new XenixSuperBlock(); sb_sector = imagePlugin.ReadSectors((ulong)start + partitionStart, sb_size_in_sectors); - + xnx_sb.s_isize = BigEndianBitConverter.ToUInt16(sb_sector, 0x000); xnx_sb.s_fsize = BigEndianBitConverter.ToUInt32(sb_sector, 0x002); xnx_sb.s_nfree = BigEndianBitConverter.ToUInt16(sb_sector, 0x006); @@ -615,248 +615,248 @@ namespace DiscImageChef.Plugins struct XenixSuperBlock { + /// 0x000, index of first data zone public UInt16 s_isize; - // 0x000, index of first data zone + /// 0x002, total number of zones of this volume public UInt32 s_fsize; - // 0x002, total number of zones of this volume // the start of the free block list: + /// 0x006, blocks in s_free, <=100 public UInt16 s_nfree; - // 0x006, blocks in s_free, <=100 + /// 0x008, 100 entries, first free block list chunk public UInt32[] s_free; - // 0x008, 100 entries, first free block list chunk // the cache of free inodes: + /// 0x198, number of inodes in s_inode, <= 100 public UInt16 s_ninode; - // 0x198, number of inodes in s_inode, <= 100 + /// 0x19A, 100 entries, some free inodes public UInt16[] s_inode; - // 0x19A, 100 entries, some free inodes + /// 0x262, free block list manipulation lock public byte s_flock; - // 0x262, free block list manipulation lock + /// 0x263, inode cache manipulation lock public byte s_ilock; - // 0x263, inode cache manipulation lock + /// 0x264, superblock modification flag public byte s_fmod; - // 0x264, superblock modification flag + /// 0x265, read-only mounted flag public byte s_ronly; - // 0x265, read-only mounted flag + /// 0x266, time of last superblock update public UInt32 s_time; - // 0x266, time of last superblock update + /// 0x26A, total number of free zones public UInt32 s_tfree; - // 0x26A, total number of free zones + /// 0x26E, total number of free inodes public UInt16 s_tinode; - // 0x26E, total number of free inodes + /// 0x270, blocks per cylinder public UInt16 s_cylblks; - // 0x270, blocks per cylinder + /// 0x272, blocks per gap public UInt16 s_gapblks; - // 0x272, blocks per gap + /// 0x274, device information ?? public UInt16 s_dinfo0; - // 0x274, device information ?? + /// 0x276, device information ?? public UInt16 s_dinfo1; - // 0x276, device information ?? + /// 0x278, 6 bytes, volume name public string s_fname; - // 0x278, 6 bytes, volume name + /// 0x27E, 6 bytes, pack name public string s_fpack; - // 0x27E, 6 bytes, pack name + /// 0x284, 0x46 if volume is clean public byte s_clean; - // 0x284, 0x46 if volume is clean + /// 0x285, 371 bytes public byte[] s_fill; - // 0x285, 371 bytes + /// 0x3F8, magic public UInt32 s_magic; - // 0x3F8, magic + /// 0x3FC, filesystem type (1 = 512 bytes/blk, 2 = 1024 bytes/blk, 3 = 2048 bytes/blk) public UInt32 s_type; - // 0x3FC, filesystem type (1 = 512 bytes/blk, 2 = 1024 bytes/blk, 3 = 2048 bytes/blk) } struct SystemVRelease4SuperBlock { + /// 0x000, index of first data zone public UInt16 s_isize; - // 0x000, index of first data zone + /// 0x002, padding public UInt16 s_pad0; - // 0x002, padding + /// 0x004, total number of zones of this volume public UInt32 s_fsize; - // 0x004, total number of zones of this volume // the start of the free block list: + /// 0x008, blocks in s_free, <=100 public UInt16 s_nfree; - // 0x008, blocks in s_free, <=100 + /// 0x00A, padding public UInt16 s_pad1; - // 0x00A, padding + /// 0x00C, 50 entries, first free block list chunk public UInt32[] s_free; - // 0x00C, 50 entries, first free block list chunk // the cache of free inodes: + /// 0x0D4, number of inodes in s_inode, <= 100 public UInt16 s_ninode; - // 0x0D4, number of inodes in s_inode, <= 100 + /// 0x0D6, padding public UInt16 s_pad2; - // 0x0D6, padding + /// 0x0D8, 100 entries, some free inodes public UInt16[] s_inode; - // 0x0D8, 100 entries, some free inodes + /// 0x1A0, free block list manipulation lock public byte s_flock; - // 0x1A0, free block list manipulation lock + /// 0x1A1, inode cache manipulation lock public byte s_ilock; - // 0x1A1, inode cache manipulation lock + /// 0x1A2, superblock modification flag public byte s_fmod; - // 0x1A2, superblock modification flag + /// 0x1A3, read-only mounted flag public byte s_ronly; - // 0x1A3, read-only mounted flag + /// 0x1A4, time of last superblock update public UInt32 s_time; - // 0x1A4, time of last superblock update + /// 0x1A8, blocks per cylinder public UInt16 s_cylblks; - // 0x1A8, blocks per cylinder + /// 0x1AA, blocks per gap public UInt16 s_gapblks; - // 0x1AA, blocks per gap + /// 0x1AC, device information ?? public UInt16 s_dinfo0; - // 0x1AC, device information ?? + /// 0x1AE, device information ?? public UInt16 s_dinfo1; - // 0x1AE, device information ?? + /// 0x1B0, total number of free zones public UInt32 s_tfree; - // 0x1B0, total number of free zones + /// 0x1B4, total number of free inodes public UInt16 s_tinode; - // 0x1B4, total number of free inodes + /// 0x1B6, padding public UInt16 s_pad3; - // 0x1B6, padding + /// 0x1B8, 6 bytes, volume name public string s_fname; - // 0x1B8, 6 bytes, volume name + /// 0x1BE, 6 bytes, pack name public string s_fpack; - // 0x1BE, 6 bytes, pack name + /// 0x1C4, 48 bytes public byte[] s_fill; - // 0x1C4, 48 bytes + /// 0x1F4, if s_state == (0x7C269D38 - s_time) then filesystem is clean public UInt32 s_state; - // 0x1F4, if s_state == (0x7C269D38 - s_time) then filesystem is clean + /// 0x1F8, magic public UInt32 s_magic; - // 0x1F8, magic + /// 0x1FC, filesystem type (1 = 512 bytes/blk, 2 = 1024 bytes/blk) public UInt32 s_type; - // 0x1FC, filesystem type (1 = 512 bytes/blk, 2 = 1024 bytes/blk) } struct SystemVRelease2SuperBlock { + /// 0x000, index of first data zone public UInt16 s_isize; - // 0x000, index of first data zone + /// 0x002, total number of zones of this volume public UInt32 s_fsize; - // 0x002, total number of zones of this volume // the start of the free block list: + /// 0x006, blocks in s_free, <=100 public UInt16 s_nfree; - // 0x006, blocks in s_free, <=100 + /// 0x008, 50 entries, first free block list chunk public UInt32[] s_free; - // 0x008, 50 entries, first free block list chunk // the cache of free inodes: + /// 0x0D0, number of inodes in s_inode, <= 100 public UInt16 s_ninode; - // 0x0D0, number of inodes in s_inode, <= 100 + /// 0x0D2, 100 entries, some free inodes public UInt16[] s_inode; - // 0x0D2, 100 entries, some free inodes + /// 0x19A, free block list manipulation lock public byte s_flock; - // 0x19A, free block list manipulation lock + /// 0x19B, inode cache manipulation lock public byte s_ilock; - // 0x19B, inode cache manipulation lock + /// 0x19C, superblock modification flag public byte s_fmod; - // 0x19C, superblock modification flag + /// 0x19D, read-only mounted flag public byte s_ronly; - // 0x19D, read-only mounted flag + /// 0x19E, time of last superblock update public UInt32 s_time; - // 0x19E, time of last superblock update + /// 0x1A2, blocks per cylinder public UInt16 s_cylblks; - // 0x1A2, blocks per cylinder + /// 0x1A4, blocks per gap public UInt16 s_gapblks; - // 0x1A4, blocks per gap + /// 0x1A6, device information ?? public UInt16 s_dinfo0; - // 0x1A6, device information ?? + /// 0x1A8, device information ?? public UInt16 s_dinfo1; - // 0x1A8, device information ?? + /// 0x1AA, total number of free zones public UInt32 s_tfree; - // 0x1AA, total number of free zones + /// 0x1AE, total number of free inodes public UInt16 s_tinode; - // 0x1AE, total number of free inodes + /// 0x1B0, 6 bytes, volume name public string s_fname; - // 0x1B0, 6 bytes, volume name + /// 0x1B6, 6 bytes, pack name public string s_fpack; - // 0x1B6, 6 bytes, pack name + /// 0x1BC, 56 bytes public byte[] s_fill; - // 0x1BC, 56 bytes + /// 0x1F4, if s_state == (0x7C269D38 - s_time) then filesystem is clean public UInt32 s_state; - // 0x1F4, if s_state == (0x7C269D38 - s_time) then filesystem is clean + /// 0x1F8, magic public UInt32 s_magic; - // 0x1F8, magic + /// 0x1FC, filesystem type (1 = 512 bytes/blk, 2 = 1024 bytes/blk) public UInt32 s_type; - // 0x1FC, filesystem type (1 = 512 bytes/blk, 2 = 1024 bytes/blk) } struct UNIX7thEditionSuperBlock { + /// 0x000, index of first data zone public UInt16 s_isize; - // 0x000, index of first data zone + /// 0x002, total number of zones of this volume public UInt32 s_fsize; - // 0x002, total number of zones of this volume // the start of the free block list: + /// 0x006, blocks in s_free, <=100 public UInt16 s_nfree; - // 0x006, blocks in s_free, <=100 + /// 0x008, 50 entries, first free block list chunk public UInt32[] s_free; - // 0x008, 50 entries, first free block list chunk // the cache of free inodes: + /// 0x0D0, number of inodes in s_inode, <= 100 public UInt16 s_ninode; - // 0x0D0, number of inodes in s_inode, <= 100 + /// 0x0D2, 100 entries, some free inodes public UInt16[] s_inode; - // 0x0D2, 100 entries, some free inodes + /// 0x19A, free block list manipulation lock public byte s_flock; - // 0x19A, free block list manipulation lock + /// 0x19B, inode cache manipulation lock public byte s_ilock; - // 0x19B, inode cache manipulation lock + /// 0x19C, superblock modification flag public byte s_fmod; - // 0x19C, superblock modification flag + /// 0x19D, read-only mounted flag public byte s_ronly; - // 0x19D, read-only mounted flag + /// 0x19E, time of last superblock update public UInt32 s_time; - // 0x19E, time of last superblock update + /// 0x1A2, total number of free zones public UInt32 s_tfree; - // 0x1A2, total number of free zones + /// 0x1A6, total number of free inodes public UInt16 s_tinode; - // 0x1A6, total number of free inodes + /// 0x1A8, interleave factor public UInt16 s_int_m; - // 0x1A8, interleave factor + /// 0x1AA, interleave factor public UInt16 s_int_n; - // 0x1AA, interleave factor + /// 0x1AC, 6 bytes, volume name public string s_fname; - // 0x1AC, 6 bytes, volume name + /// 0x1B2, 6 bytes, pack name public string s_fpack; - // 0x1B2, 6 bytes, pack name } struct CoherentSuperBlock { + /// 0x000, index of first data zone public UInt16 s_isize; - // 0x000, index of first data zone + /// 0x002, total number of zones of this volume public UInt32 s_fsize; - // 0x002, total number of zones of this volume // the start of the free block list: + /// 0x006, blocks in s_free, <=100 public UInt16 s_nfree; - // 0x006, blocks in s_free, <=100 + /// 0x008, 64 entries, first free block list chunk public UInt32[] s_free; - // 0x008, 64 entries, first free block list chunk // the cache of free inodes: + /// 0x108, number of inodes in s_inode, <= 100 public UInt16 s_ninode; - // 0x108, number of inodes in s_inode, <= 100 + /// 0x10A, 100 entries, some free inodes public UInt16[] s_inode; - // 0x10A, 100 entries, some free inodes + /// 0x1D2, free block list manipulation lock public byte s_flock; - // 0x1D2, free block list manipulation lock + /// 0x1D3, inode cache manipulation lock public byte s_ilock; - // 0x1D3, inode cache manipulation lock + /// 0x1D4, superblock modification flag public byte s_fmod; - // 0x1D4, superblock modification flag + /// 0x1D5, read-only mounted flag public byte s_ronly; - // 0x1D5, read-only mounted flag + /// 0x1D6, time of last superblock update public UInt32 s_time; - // 0x1D6, time of last superblock update + /// 0x1DE, total number of free zones public UInt32 s_tfree; - // 0x1DE, total number of free zones + /// 0x1E2, total number of free inodes public UInt16 s_tinode; - // 0x1E2, total number of free inodes + /// 0x1E4, interleave factor public UInt16 s_int_m; - // 0x1E4, interleave factor + /// 0x1E6, interleave factor public UInt16 s_int_n; - // 0x1E6, interleave factor + /// 0x1E8, 6 bytes, volume name public string s_fname; - // 0x1E8, 6 bytes, volume name + /// 0x1EE, 6 bytes, pack name public string s_fpack; - // 0x1EE, 6 bytes, pack name + /// 0x1F4, zero-filled public UInt32 s_unique; - // 0x1F4, zero-filled } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/UNIXBFS.cs b/DiscImageChef.Filesystems/UNIXBFS.cs index f1daa651..2614e647 100644 --- a/DiscImageChef.Filesystems/UNIXBFS.cs +++ b/DiscImageChef.Filesystems/UNIXBFS.cs @@ -116,24 +116,24 @@ namespace DiscImageChef.Plugins struct BFSSuperBlock { + /// 0x00, 0x1BADFACE public UInt32 s_magic; - // 0x00, 0x1BADFACE + /// 0x04, start in bytes of volume public UInt32 s_start; - // 0x04, start in bytes of volume + /// 0x08, end in bytes of volume public UInt32 s_end; - // 0x08, end in bytes of volume + /// 0x0C, unknown :p public UInt32 s_from; - // 0x0C, unknown :p + /// 0x10, unknown :p public UInt32 s_to; - // 0x10, unknown :p + /// 0x14, unknown :p public Int32 s_bfrom; - // 0x14, unknown :p + /// 0x18, unknown :p public Int32 s_bto; - // 0x18, unknown :p + /// 0x1C, 6 bytes, filesystem name public string s_fsname; - // 0x1C, 6 bytes, filesystem name + /// 0x22, 6 bytes, volume name public string s_volume; - // 0x22, 6 bytes, volume name } } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/ext2FS.cs b/DiscImageChef.Filesystems/ext2FS.cs index 30f4ded4..95797233 100644 --- a/DiscImageChef.Filesystems/ext2FS.cs +++ b/DiscImageChef.Filesystems/ext2FS.cs @@ -59,7 +59,7 @@ namespace DiscImageChef.Plugins byte[] sb_sector = imagePlugin.ReadSector(2 + partitionStart); UInt16 magic = BitConverter.ToUInt16(sb_sector, 0x038); - + if (magic == ext2FSMagic || magic == ext2OldFSMagic) return true; return false; @@ -68,7 +68,7 @@ namespace DiscImageChef.Plugins public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information) { information = ""; - + StringBuilder sb = new StringBuilder(); ext2FSSuperBlock supblk = new ext2FSSuperBlock(); @@ -356,7 +356,7 @@ namespace DiscImageChef.Plugins } if (supblk.block_size == 0) // Then it is 1024 bytes - supblk.block_size = 1024; + supblk.block_size = 1024; sb.AppendFormat("Volume has {0} blocks of {1} bytes, for a total of {2} bytes", blocks, 1024<<(int)supblk.block_size, blocks * (ulong)(1024<<(int)supblk.block_size)).AppendLine(); xmlFSType.Clusters = (long)blocks; @@ -620,288 +620,312 @@ namespace DiscImageChef.Plugins information = sb.ToString(); } + /// + /// Same magic for ext2, ext3 and ext4 + /// public const UInt16 ext2FSMagic = 0xEF53; - // Same for ext3 and ext4 + public const UInt16 ext2OldFSMagic = 0xEF51; - // Size = 536 bytes + + /// + /// ext2/3/4 superblock + /// public struct ext2FSSuperBlock { + /// 0x000, inodes on volume public UInt32 inodes; - // 0x000, inodes on volume + /// 0x004, blocks on volume public UInt32 blocks; - // 0x004, blocks on volume + /// 0x008, reserved blocks public UInt32 reserved_blocks; - // 0x008, reserved blocks + /// 0x00C, free blocks count public UInt32 free_blocks; - // 0x00C, free blocks count + /// 0x010, free inodes count public UInt32 free_inodes; - // 0x010, free inodes count + /// 0x014, first data block public UInt32 first_block; - // 0x014, first data block + /// 0x018, block size public UInt32 block_size; - // 0x018, block size + /// 0x01C, fragment size public Int32 frag_size; - // 0x01C, fragment size + /// 0x020, blocks per group public UInt32 blocks_per_grp; - // 0x020, blocks per group + /// 0x024, fragments per group public UInt32 flags_per_grp; - // 0x024, fragments per group + /// 0x028, inodes per group public UInt32 inodes_per_grp; - // 0x028, inodes per group + /// 0x02C, last mount time public UInt32 mount_t; - // 0x02C, last mount time + /// 0x030, last write time public UInt32 write_t; - // 0x030, last write time + /// 0x034, mounts count public UInt16 mount_c; - // 0x034, mounts count + /// 0x036, max mounts public Int16 max_mount_c; - // 0x036, max mounts + /// 0x038, (little endian) public UInt16 magic; - // 0x038, (little endian) + /// 0x03A, filesystem state public UInt16 state; - // 0x03A, filesystem state + /// 0x03C, behaviour on errors public UInt16 err_behaviour; - // 0x03C, behaviour on errors + /// 0x03E, From 0.5b onward public UInt16 minor_revision; - // 0x03E, From 0.5b onward + /// 0x040, last check time public UInt32 check_t; - // 0x040, last check time + /// 0x044, max time between checks public UInt32 check_inv; - // 0x044, max time between checks + // From 0.5a onward + /// 0x048, Creation OS public UInt32 creator_os; - // 0x048, Creation OS + /// 0x04C, Revison level public UInt32 revision; - // 0x04C, Revison level + /// 0x050, Default UID for reserved blocks public UInt16 default_uid; - // 0x050, Default UID for reserved blocks + /// 0x052, Default GID for reserved blocks public UInt16 default_gid; - // 0x052, Default GID for reserved blocks + // From 0.5b onward + /// 0x054, First unreserved inode public UInt32 first_inode; - // 0x054, First unreserved inode + /// 0x058, inode size public UInt16 inode_size; - // 0x058, inode size + /// 0x05A, Block group number of THIS superblock public UInt16 block_group_no; - // 0x05A, Block group number of THIS superblock + /// 0x05C, Compatible features set public UInt32 ftr_compat; - // 0x05C, Compatible features set + /// 0x060, Incompatible features set public UInt32 ftr_incompat; - // 0x060, Incompatible features set + // Found on Linux 2.0.40 + /// 0x064, Read-only compatible features set public UInt32 ftr_ro_compat; - // 0x064, Read-only compatible features set + // Found on Linux 2.1.132 + /// 0x068, 16 bytes, UUID public Guid uuid; - // 0x068, 16 bytes, UUID + /// 0x078, 16 bytes, volume name public string volume_name; - // 0x078, 16 bytes, volume name + /// 0x088, 64 bytes, where last mounted public string last_mount_dir; - // 0x088, 64 bytes, where last mounted + /// 0x0C8, Usage bitmap algorithm, for compression public UInt32 algo_usage_bmp; - // 0x0C8, Usage bitmap algorithm, for compression + /// 0x0CC, Block to try to preallocate public byte prealloc_blks; - // 0x0CC, Block to try to preallocate + /// 0x0CD, Blocks to try to preallocate for directories public byte prealloc_dir_blks; - // 0x0CD, Blocks to try to preallocate for directories + /// 0x0CE, Per-group desc for online growth public UInt16 rsrvd_gdt_blocks; - // 0x0CE, Per-group desc for online growth + // Found on Linux 2.4 // ext3 + /// 0x0D0, 16 bytes, UUID of journal superblock public Guid journal_uuid; - // 0x0D0, 16 bytes, UUID of journal superblock + /// 0x0E0, inode no. of journal file public UInt32 journal_inode; - // 0x0E0, inode no. of journal file + /// 0x0E4, device no. of journal file public UInt32 journal_dev; - // 0x0E4, device no. of journal file + /// 0x0E8, Start of list of inodes to delete public UInt32 last_orphan; - // 0x0E8, Start of list of inodes to delete + /// 0x0EC, First byte of 128bit HTREE hash seed public UInt32 hash_seed_1; - // 0x0EC, First byte of 128bit HTREE hash seed + /// 0x0F0, Second byte of 128bit HTREE hash seed public UInt32 hash_seed_2; - // 0x0F0, Second byte of 128bit HTREE hash seed + /// 0x0F4, Third byte of 128bit HTREE hash seed public UInt32 hash_seed_3; - // 0x0F4, Third byte of 128bit HTREE hash seed + /// 0x0F8, Fourth byte of 128bit HTREE hash seed public UInt32 hash_seed_4; - // 0x0F8, Fourth byte of 128bit HTREE hash seed + /// 0x0FC, Hash version public byte hash_version; - // 0x0FC, Hash version + /// 0x0FD, Journal backup type public byte jnl_backup_type; - // 0x0FD, Journal backup type + /// 0x0FE, Size of group descriptor public UInt16 desc_grp_size; - // 0x0FE, Size of group descriptor + /// 0x100, Default mount options public UInt32 default_mnt_opts; - // 0x100, Default mount options + /// 0x104, First metablock block group public UInt32 first_meta_bg; - // 0x104, First metablock block group + // Introduced with ext4, some can be ext3 + /// 0x108, Filesystem creation time public UInt32 mkfs_t; - // 0x108, Filesystem creation time // Follows 17 uint32 (68 bytes) of journal inode backup // Following 3 fields are valid if EXT4_FEATURE_COMPAT_64BIT is set + /// 0x14C, High 32bits of blocks no. public UInt32 blocks_hi; - // 0x14C, High 32bits of blocks no. + /// 0x150, High 32bits of reserved blocks no. public UInt32 reserved_blocks_hi; - // 0x150, High 32bits of reserved blocks no. + /// 0x154, High 32bits of free blocks no. public UInt32 free_blocks_hi; - // 0x154, High 32bits of free blocks no. + /// 0x158, inodes minimal size in bytes public UInt16 min_inode_size; - // 0x158, inodes minimal size in bytes + /// 0x15A, Bytes reserved by new inodes public UInt16 rsv_inode_size; - // 0x15A, Bytes reserved by new inodes + /// 0x15C, Flags public UInt32 flags; - // 0x15C, Flags + /// 0x160, RAID stride public UInt16 raid_stride; - // 0x160, RAID stride + /// 0x162, Waiting seconds in MMP check public UInt16 mmp_interval; - // 0x162, Waiting seconds in MMP check + /// 0x164, Block for multi-mount protection public UInt64 mmp_block; - // 0x164, Block for multi-mount protection + /// 0x16C, Blocks on all data disks (N*stride) public UInt32 raid_stripe_width; - // 0x16C, Blocks on all data disks (N*stride) + /// 0x170, FLEX_BG group size public byte flex_bg_grp_size; - // 0x170, FLEX_BG group size + /// 0x171 Padding public byte padding; - // 0x171 + /// 0x172 Padding public UInt16 padding2; - // 0x172 + // Following are introduced with ext4 + /// 0x174, Kibibytes written in volume lifetime public UInt64 kbytes_written; - // 0x174, Kibibytes written in volume lifetime + /// 0x17C, Active snapshot inode number public UInt32 snapshot_inum; - // 0x17C, Active snapshot inode number + /// 0x180, Active snapshot sequential ID public UInt32 snapshot_id; - // 0x180, Active snapshot sequential ID + /// 0x184, Reserved blocks for active snapshot's future use public UInt64 snapshot_blocks; - // 0x184, Reserved blocks for active snapshot's future use + /// 0x18C, inode number of the on-disk start of the snapshot list public UInt32 snapshot_list; - // 0x18C, inode number of the on-disk start of the snapshot list + // Optional ext4 error-handling features + /// 0x190, total registered filesystem errors public UInt32 error_count; - // 0x190, total registered filesystem errors + /// 0x194, time on first error public UInt32 first_error_t; - // 0x194, time on first error + /// 0x198, inode involved in first error public UInt32 first_error_inode; - // 0x198, inode involved in first error + /// 0x19C, block involved of first error public UInt64 first_error_block; - // 0x19C, block involved of first error + /// 0x1A0, 32 bytes, function where the error happened public string first_error_func; - // 0x1A0, 32 bytes, function where the error happened + /// 0x1B0, line number where error happened public UInt32 first_error_line; - // 0x1B0, line number where error happened + /// 0x1B4, time of most recent error public UInt32 last_error_t; - // 0x1B4, time of most recent error + /// 0x1B8, inode involved in last error public UInt32 last_error_inode; - // 0x1B8, inode involved in last error + /// 0x1BC, line number where error happened public UInt32 last_error_line; - // 0x1BC, line number where error happened + /// 0x1C0, block involved of last error public UInt64 last_error_block; - // 0x1C0, block involved of last error + /// 0x1C8, 32 bytes, function where the error happened public string last_error_func; - // 0x1C8, 32 bytes, function where the error happened // End of optional error-handling features + + // 0x1D8, 64 bytes, last used mount options public string mount_options; - // 0x1D8, 64 bytes, last used mount options } + // ext? filesystem states + /// Cleanly-unmounted volume public const UInt16 EXT2_VALID_FS = 0x0001; - // Cleanly-unmounted volume + /// Dirty volume public const UInt16 EXT2_ERROR_FS = 0x0002; - // Dirty volume + /// Recovering orphan files public const UInt16 EXT3_ORPHAN_FS = 0x0004; - // Recovering orphan files + // ext? default mount flags + /// Enable debugging messages public const UInt32 EXT2_DEFM_DEBUG = 0x000001; - // Enable debugging messages + /// Emulates BSD behaviour on new file creation public const UInt32 EXT2_DEFM_BSDGROUPS = 0x000002; - // Emulates BSD behaviour on new file creation + /// Enable user xattrs public const UInt32 EXT2_DEFM_XATTR_USER = 0x000004; - // Enable user xattrs + /// Enable POSIX ACLs public const UInt32 EXT2_DEFM_ACL = 0x000008; - // Enable POSIX ACLs + /// Use 16bit UIDs public const UInt32 EXT2_DEFM_UID16 = 0x000010; - // Use 16bit UIDs + /// Journal data mode public const UInt32 EXT3_DEFM_JMODE_DATA = 0x000040; - // Journal data mode + /// Journal ordered mode public const UInt32 EXT3_DEFM_JMODE_ORDERED = 0x000080; - // Journal ordered mode + /// Journal writeback mode public const UInt32 EXT3_DEFM_JMODE_WBACK = 0x000100; - // Journal writeback mode + // Behaviour on errors + /// Continue execution public const UInt16 EXT2_ERRORS_CONTINUE = 1; - // Continue execution + /// Remount fs read-only public const UInt16 EXT2_ERRORS_RO = 2; - // Remount fs read-only + /// Panic public const UInt16 EXT2_ERRORS_PANIC = 3; - // Panic + // OS codes public const UInt32 EXT2_OS_LINUX = 0; public const UInt32 EXT2_OS_HURD = 1; public const UInt32 EXT2_OS_MASIX = 2; public const UInt32 EXT2_OS_FREEBSD = 3; public const UInt32 EXT2_OS_LITES = 4; + // Revision levels + /// The good old (original) format public const UInt32 EXT2_GOOD_OLD_REV = 0; - /* The good old (original) format */ + /// V2 format w/ dynamic inode sizes public const UInt32 EXT2_DYNAMIC_REV = 1; - /* V2 format w/ dynamic inode sizes */ + // Compatible features + /// Pre-allocate directories public const UInt32 EXT2_FEATURE_COMPAT_DIR_PREALLOC = 0x00000001; - // Pre-allocate directories + /// imagic inodes ? public const UInt32 EXT2_FEATURE_COMPAT_IMAGIC_INODES = 0x00000002; - // imagic inodes ? + /// Has journal (it's ext3) public const UInt32 EXT3_FEATURE_COMPAT_HAS_JOURNAL = 0x00000004; - // Has journal (it's ext3) + /// EA blocks public const UInt32 EXT2_FEATURE_COMPAT_EXT_ATTR = 0x00000008; - // EA blocks + /// Online filesystem resize reservations public const UInt32 EXT2_FEATURE_COMPAT_RESIZE_INO = 0x00000010; - // Online filesystem resize reservations + /// Can use hashed indexes on directories public const UInt32 EXT2_FEATURE_COMPAT_DIR_INDEX = 0x00000020; - // Can use hashed indexes on directories + // Read-only compatible features + /// Reduced number of superblocks public const UInt32 EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER = 0x00000001; - // Reduced number of superblocks + /// Can have files bigger than 2GiB public const UInt32 EXT2_FEATURE_RO_COMPAT_LARGE_FILE = 0x00000002; - // Can have files bigger than 2GiB + /// Use B-Tree for directories public const UInt32 EXT2_FEATURE_RO_COMPAT_BTREE_DIR = 0x00000004; - // Use B-Tree for directories + /// Can have files bigger than 2TiB *ext4* public const UInt32 EXT4_FEATURE_RO_COMPAT_HUGE_FILE = 0x00000008; - // Can have files bigger than 2TiB *ext4* + /// Group descriptor checksums and sparse inode table *ext4* public const UInt32 EXT4_FEATURE_RO_COMPAT_GDT_CSUM = 0x00000010; - // Group descriptor checksums and sparse inode table *ext4* + /// More than 32000 directory entries *ext4* public const UInt32 EXT4_FEATURE_RO_COMPAT_DIR_NLINK = 0x00000020; - // More than 32000 directory entries *ext4* + /// Nanosecond timestamps and creation time *ext4* public const UInt32 EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE = 0x00000040; - // Nanosecond timestamps and creation time *ext4* + // Incompatible features + /// Uses compression public const UInt32 EXT2_FEATURE_INCOMPAT_COMPRESSION = 0x00000001; - // Uses compression + /// Filetype in directory entries public const UInt32 EXT2_FEATURE_INCOMPAT_FILETYPE = 0x00000002; - // Filetype in directory entries + /// Journal needs recovery *ext3* public const UInt32 EXT3_FEATURE_INCOMPAT_RECOVER = 0x00000004; - // Journal needs recovery *ext3* + /// Has journal on another device *ext3* public const UInt32 EXT3_FEATURE_INCOMPAT_JOURNAL_DEV = 0x00000008; - // Has journal on another device *ext3* + /// Reduced block group backups public const UInt32 EXT2_FEATURE_INCOMPAT_META_BG = 0x00000010; - // Reduced block group backups + /// Volume use extents *ext4* public const UInt32 EXT4_FEATURE_INCOMPAT_EXTENTS = 0x00000040; - // Volume use extents *ext4* + /// Supports volumes bigger than 2^32 blocks *ext4* public const UInt32 EXT4_FEATURE_INCOMPAT_64BIT = 0x00000080; - // Supports volumes bigger than 2^32 blocks *ext4* + /// Multi-mount protection *ext4* public const UInt32 EXT4_FEATURE_INCOMPAT_MMP = 0x00000100; - // Multi-mount protection *ext4* + /// Flexible block group metadata location *ext4* public const UInt32 EXT4_FEATURE_INCOMPAT_FLEX_BG = 0x00000200; - // Flexible block group metadata location *ext4* + /// EA in inode *ext4* public const UInt32 EXT4_FEATURE_INCOMPAT_EA_INODE = 0x00000400; - // EA in inode *ext4* + /// Data can reside in directory entry *ext4* public const UInt32 EXT4_FEATURE_INCOMPAT_DIRDATA = 0x00001000; - // Data can reside in directory entry *ext4* + // Miscellaneous filesystem flags + /// Signed dirhash in use public const UInt32 EXT2_FLAGS_SIGNED_HASH = 0x00000001; - // Signed dirhash in use + /// Unsigned dirhash in use public const UInt32 EXT2_FLAGS_UNSIGNED_HASH = 0x00000002; - // Unsigned dirhash in use + /// Testing development code public const UInt32 EXT2_FLAGS_TEST_FILESYS = 0x00000004; - // Testing development code } } \ No newline at end of file diff --git a/DiscImageChef.Filesystems/extFS.cs b/DiscImageChef.Filesystems/extFS.cs index 5b035b84..5998b089 100644 --- a/DiscImageChef.Filesystems/extFS.cs +++ b/DiscImageChef.Filesystems/extFS.cs @@ -102,40 +102,46 @@ namespace DiscImageChef.Plugins information = sb.ToString(); } + /// + /// ext superblock magic + /// public const UInt16 extFSMagic = 0x137D; + /// + /// ext superblock + /// public struct extFSSuperBlock { + /// 0x000, inodes on volume public UInt32 inodes; - // 0x000, inodes on volume + /// 0x004, zones on volume public UInt32 zones; - // 0x004, zones on volume + /// 0x008, first free block public UInt32 firstfreeblk; - // 0x008, first free block + /// 0x00C, free blocks count public UInt32 freecountblk; - // 0x00C, free blocks count + /// 0x010, first free inode public UInt32 firstfreeind; - // 0x010, first free inode + /// 0x014, free inodes count public UInt32 freecountind; - // 0x014, free inodes count + /// 0x018, first data zone public UInt32 firstdatazone; - // 0x018, first data zone + /// 0x01C, log zone size public UInt32 logzonesize; - // 0x01C, log zone size + /// 0x020, max zone size public UInt32 maxsize; - // 0x020, max zone size + /// 0x024, reserved public UInt32 reserved1; - // 0x024, reserved + /// 0x028, reserved public UInt32 reserved2; - // 0x028, reserved + /// 0x02C, reserved public UInt32 reserved3; - // 0x02C, reserved + /// 0x030, reserved public UInt32 reserved4; - // 0x030, reserved + /// 0x034, reserved public UInt32 reserved5; - // 0x034, reserved + /// 0x038, 0x137D (little endian) public UInt16 magic; - // 0x038, 0x137D (little endian) } } } \ No newline at end of file