public int ReadFrom(byte[] buffer, int offset) { offset += ReadHeader(buffer, offset); BestFree = new BlockDirectoryDataFree[3]; for (int i = 0; i < BestFree.Length; i++) { var free = new BlockDirectoryDataFree(); offset += free.ReadFrom(buffer, offset); BestFree[i] = free; } offset += HeaderPadding; var entries = new List <BlockDirectoryData>(); var eof = buffer.Length; while (offset < eof) { BlockDirectoryData entry; if (buffer[offset] == 0xff && buffer[offset + 0x1] == 0xff) { //unused entry = new BlockDirectoryDataUnused(); } else { entry = new BlockDirectoryDataEntry(_context); } offset += entry.ReadFrom(buffer, offset); entries.Add(entry); } Entries = entries.ToArray(); return(buffer.Length - offset); }
public int ReadFrom(byte[] buffer, int offset) { Magic = Utilities.ToUInt32BigEndian(buffer, offset); BestFree = new BlockDirectoryDataFree[3]; offset += 0x4; for (int i = 0; i < BestFree.Length; i++) { var free = new BlockDirectoryDataFree(); offset += free.ReadFrom(buffer, offset); BestFree[i] = free; } var entries = new List <BlockDirectoryData>(); var eof = buffer.Length; while (offset < eof) { BlockDirectoryData entry; if (buffer[offset] == 0xff && buffer[offset + 0x1] == 0xff) { //unused entry = new BlockDirectoryDataUnused(); } else { entry = new BlockDirectoryDataEntry(); } offset += entry.ReadFrom(buffer, offset); entries.Add(entry); } Entries = entries.ToArray(); return(buffer.Length - offset); }
public int ReadFrom(byte[] buffer, int offset) { if (sb_ok == false) { throw new IOException("not initial SuperBlock"); } Magic = EndianUtilities.ToUInt32BigEndian(buffer, offset); BestFree = new BlockDirectoryDataFree[3]; if (Magic == BlockDirectory.HeaderMagicV5) { offset += 48;//xfs_dir3_blk_hdr } else { offset += 0x4; } for (int i = 0; i < BestFree.Length; i++) { var free = new BlockDirectoryDataFree(); offset += free.ReadFrom(buffer, offset); BestFree[i] = free; } if (Magic == BlockDirectory.HeaderMagicV5) { offset += 4;//__be32 xfs_dir3_data_hdr.pad } LeafStale = EndianUtilities.ToUInt32BigEndian(buffer, buffer.Length - 0x4); LeafCount = EndianUtilities.ToUInt32BigEndian(buffer, buffer.Length - 0x8); var entries = new List <BlockDirectoryData>(); var eof = buffer.Length - 0x8 - LeafCount * 0x8; while (offset < eof) { BlockDirectoryData entry; if (buffer[offset] == 0xff && buffer[offset + 0x1] == 0xff) { //unused entry = new BlockDirectoryDataUnused(SuperBlock); } else { entry = new BlockDirectoryDataEntry(SuperBlock); } offset += entry.ReadFrom(buffer, offset); entries.Add(entry); } Entries = entries.ToArray(); return(buffer.Length - offset); }
public int ReadFrom(byte[] buffer, int offset) { Magic = EndianUtilities.ToUInt32BigEndian(buffer, offset); BestFree = new BlockDirectoryDataFree[3]; if (Magic == HeaderMagicV5) { offset += 48;//xfs_dir3_blk_hdr } else { offset += 0x4; } for (int i = 0; i < BestFree.Length; i++) { var free = new BlockDirectoryDataFree(); offset += free.ReadFrom(buffer, offset); BestFree[i] = free; } if (Magic == HeaderMagicV5) { offset += 4;//__be32 xfs_dir3_data_hdr.pad } var entries = new List <BlockDirectoryData>(); var eof = buffer.Length; while (offset < eof) { BlockDirectoryData entry; if (buffer[offset] == 0xff && buffer[offset + 0x1] == 0xff) { //unused entry = new BlockDirectoryDataUnused(superblock); } else { entry = new BlockDirectoryDataEntry(superblock); } offset += entry.ReadFrom(buffer, offset); entries.Add(entry); } Entries = entries.ToArray(); return(buffer.Length - offset); }