Public Member Functions | |
| Ext4RecoveryImpl (DiskReader &reader) | |
| bool | recover (uint64_t volume_offset, const std::string &output_dir, std::vector< RecoveredFileRecord > &recovered, std::vector< std::string > &logs, std::string &error) |
Private Member Functions | |
| bool | load_superblock (std::string &error) |
| uint64_t | block_to_offset (uint64_t block) const |
| bool | read_fs_block (uint64_t block_no, unsigned char *buffer, size_t len) |
| bool | read_volume_bytes_replayed (uint64_t volume_rel_offset, unsigned char *buffer, size_t len) |
| void | build_journal_replay_map (std::vector< std::string > &logs) |
| bool | read_group_desc (uint32_t group, std::vector< unsigned char > &out) |
| bool | inode_marked_allocated (uint32_t inode_no) |
| bool | read_inode (uint32_t inode_no, Ext4Inode &inode, std::string &error) |
| uint64_t | inode_size_bytes (const Ext4Inode &inode) const |
| bool | inode_is_dir (const Ext4Inode &inode) const |
| bool | inode_is_reg (const Ext4Inode &inode) const |
| bool | inode_uses_extents (const Ext4Inode &inode) const |
| bool | find_inline_xattr_system_data (const Ext4Inode &inode, std::vector< unsigned char > &out) const |
| bool | collect_extents_from_node (uint64_t node_phys_block, std::vector< ExtentRef > &extents, std::string &error) |
| bool | inode_extents (const Ext4Inode &inode, std::vector< ExtentRef > &extents, std::string &error) |
| bool | read_u32_block (uint64_t block_no, std::vector< uint32_t > &out, std::string &error) |
| bool | inode_block_map_classic (const Ext4Inode &inode, std::vector< uint64_t > &blocks, std::string &error) |
| bool | inode_ranges (const Ext4Inode &inode, std::vector< ExportRange > &ranges, std::string &error) |
| bool | export_file (uint32_t inode_no, const std::string &name, const Ext4Inode &inode, const fs::path &out_dir, std::vector< RecoveredFileRecord > &recovered, std::vector< std::string > &logs, std::string &error) |
| void | scan_journal_dirents (const std::vector< unsigned char > &block, uint32_t target_block, uint32_t sequence, std::vector< JournalDirentCandidate > &out) |
| void | export_journal (const fs::path &out_root, std::vector< RecoveredFileRecord > &recovered, std::vector< std::string > &logs) |
| bool | recover_directory (uint32_t inode_no, const fs::path &out_dir, std::vector< RecoveredFileRecord > &recovered, std::vector< std::string > &logs, std::string &error, std::set< uint32_t > &dir_guard, int depth) |
Static Private Member Functions | |
| static bool | looks_like_printable_name (const unsigned char *p, size_t len) |
| static std::string | ext4_file_type_name (uint8_t t) |
Private Attributes | |
| DiskReader & | reader_ |
| uint64_t | volume_offset_ {0} |
| uint64_t | block_size_ {0} |
| uint32_t | blocks_per_group_ {0} |
| uint32_t | inodes_per_group_ {0} |
| uint16_t | inode_size_ {0} |
| uint64_t | desc_table_offset_ {0} |
| uint16_t | desc_size_ {32} |
| uint32_t | first_data_block_ {0} |
| uint64_t | total_inodes_ {0} |
| uint32_t | journal_inode_ {0} |
| std::map< uint64_t, std::pair< uint32_t, std::vector< unsigned char > > > | journal_replay_blocks_ |
| std::set< uint64_t > | journal_revoked_blocks_ |
| size_t | committed_transactions_ {0} |
| size_t | revoke_records_ {0} |
Definition at line 155 of file ext4_recovery.cpp.
|
inlineexplicit |
Definition at line 157 of file ext4_recovery.cpp.
References reader_.
|
inlineprivate |
Definition at line 234 of file ext4_recovery.cpp.
References block_size_, and volume_offset_.
Referenced by build_journal_replay_map(), inode_ranges(), and read_fs_block().
|
inlineprivate |
Definition at line 267 of file ext4_recovery.cpp.
References anonymous_namespace{ext4_recovery.cpp}::be32(), block_size_, block_to_offset(), committed_transactions_, inode_ranges(), inode_size_bytes(), journal_inode_, journal_replay_blocks_, journal_revoked_blocks_, DiskReader::read_at(), read_inode(), reader_, revoke_records_, trs(), and volume_offset_.
Referenced by recover().
|
inlineprivate |
Definition at line 547 of file ext4_recovery.cpp.
References anonymous_namespace{ext4_recovery.cpp}::ExtentRef::block_count, block_size_, collect_extents_from_node(), anonymous_namespace{ext4_recovery.cpp}::le16(), anonymous_namespace{ext4_recovery.cpp}::le32(), anonymous_namespace{ext4_recovery.cpp}::ExtentRef::logical_block, anonymous_namespace{ext4_recovery.cpp}::ExtentRef::physical_block, read_fs_block(), trs(), and anonymous_namespace{ext4_recovery.cpp}::ExtentRef::uninitialized.
Referenced by collect_extents_from_node(), and inode_extents().
|
inlineprivate |
Definition at line 752 of file ext4_recovery.cpp.
References anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::block, find_inline_xattr_system_data(), anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::flags, inode_is_reg(), inode_ranges(), inode_size_bytes(), read_volume_bytes_replayed(), anonymous_namespace{ext4_recovery.cpp}::sanitize_path_component(), trs(), volume_offset_, and anonymous_namespace{ext4_recovery.cpp}::write_ranges_to_file().
Referenced by export_journal(), and recover_directory().
|
inlineprivate |
Definition at line 911 of file ext4_recovery.cpp.
References anonymous_namespace{ext4_recovery.cpp}::be32(), block_size_, export_file(), ext4_file_type_name(), inode_is_reg(), inode_marked_allocated(), inode_ranges(), inode_size_bytes(), journal_inode_, journal_replay_blocks_, DiskReader::read_at(), read_inode(), reader_, anonymous_namespace{ext4_recovery.cpp}::sanitize_path_component(), scan_journal_dirents(), trs(), and anonymous_namespace{ext4_recovery.cpp}::write_ranges_to_file().
Referenced by recover().
|
inlinestaticprivate |
Definition at line 874 of file ext4_recovery.cpp.
Referenced by export_journal().
|
inlineprivate |
Definition at line 500 of file ext4_recovery.cpp.
References anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::extra_bytes, anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::extra_isize, anonymous_namespace{ext4_recovery.cpp}::le16(), and anonymous_namespace{ext4_recovery.cpp}::le32().
Referenced by export_file().
|
inlineprivate |
Definition at line 642 of file ext4_recovery.cpp.
References anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::block, block_size_, inode_size_bytes(), anonymous_namespace{ext4_recovery.cpp}::le32(), and read_u32_block().
Referenced by inode_ranges().
|
inlineprivate |
Definition at line 590 of file ext4_recovery.cpp.
References anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::block, anonymous_namespace{ext4_recovery.cpp}::ExtentRef::block_count, collect_extents_from_node(), inode_uses_extents(), anonymous_namespace{ext4_recovery.cpp}::le16(), anonymous_namespace{ext4_recovery.cpp}::le32(), anonymous_namespace{ext4_recovery.cpp}::ExtentRef::logical_block, anonymous_namespace{ext4_recovery.cpp}::ExtentRef::physical_block, trs(), and anonymous_namespace{ext4_recovery.cpp}::ExtentRef::uninitialized.
Referenced by inode_ranges().
|
inlineprivate |
Definition at line 474 of file ext4_recovery.cpp.
References anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::mode.
Referenced by recover_directory().
|
inlineprivate |
Definition at line 475 of file ext4_recovery.cpp.
References anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::mode.
Referenced by export_file(), and export_journal().
|
inlineprivate |
Definition at line 381 of file ext4_recovery.cpp.
References block_size_, desc_size_, inodes_per_group_, anonymous_namespace{ext4_recovery.cpp}::le32(), read_fs_block(), read_group_desc(), and total_inodes_.
Referenced by export_journal(), and read_inode().
|
inlineprivate |
Definition at line 695 of file ext4_recovery.cpp.
References block_size_, block_to_offset(), inode_block_map_classic(), inode_extents(), inode_uses_extents(), anonymous_namespace{ext4_recovery.cpp}::ExportRange::length, and anonymous_namespace{ext4_recovery.cpp}::ExportRange::zero_fill.
Referenced by build_journal_replay_map(), export_file(), export_journal(), and recover_directory().
|
inlineprivate |
Definition at line 465 of file ext4_recovery.cpp.
References anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::size_high, and anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::size_lo.
Referenced by build_journal_replay_map(), export_file(), export_journal(), and inode_block_map_classic().
|
inlineprivate |
Definition at line 476 of file ext4_recovery.cpp.
References anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::flags.
Referenced by inode_extents(), and inode_ranges().
|
inlineprivate |
Definition at line 201 of file ext4_recovery.cpp.
References block_size_, blocks_per_group_, desc_size_, desc_table_offset_, first_data_block_, inode_size_, inodes_per_group_, journal_inode_, anonymous_namespace{ext4_recovery.cpp}::le16(), anonymous_namespace{ext4_recovery.cpp}::le32(), DiskReader::read_at(), reader_, total_inodes_, trs(), and volume_offset_.
Referenced by recover().
|
inlinestaticprivate |
Definition at line 864 of file ext4_recovery.cpp.
Referenced by scan_journal_dirents().
|
inlineprivate |
Definition at line 238 of file ext4_recovery.cpp.
References block_size_, block_to_offset(), journal_replay_blocks_, journal_revoked_blocks_, DiskReader::read_at(), and reader_.
Referenced by collect_extents_from_node(), inode_marked_allocated(), read_u32_block(), and read_volume_bytes_replayed().
|
inlineprivate |
Definition at line 375 of file ext4_recovery.cpp.
References desc_size_, desc_table_offset_, read_volume_bytes_replayed(), and volume_offset_.
Referenced by inode_marked_allocated(), and read_inode().
|
inlineprivate |
Definition at line 400 of file ext4_recovery.cpp.
References anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::allocated, anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::atime, anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::block, block_size_, anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::blocks_lo, anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::ctime, desc_size_, anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::dtime, anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::extra_bytes, anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::extra_isize, anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::file_acl_lo, anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::flags, anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::generation, anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::gid, inode_marked_allocated(), inode_size_, inodes_per_group_, anonymous_namespace{ext4_recovery.cpp}::le16(), anonymous_namespace{ext4_recovery.cpp}::le32(), anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::links_count, anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::mode, anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::mtime, read_group_desc(), read_volume_bytes_replayed(), anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::size_high, anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::size_lo, total_inodes_, trs(), and anonymous_namespace{ext4_recovery.cpp}::Ext4Inode::uid.
Referenced by build_journal_replay_map(), export_journal(), and recover_directory().
|
inlineprivate |
Definition at line 631 of file ext4_recovery.cpp.
References block_size_, anonymous_namespace{ext4_recovery.cpp}::le32(), read_fs_block(), and trs().
Referenced by inode_block_map_classic().
|
inlineprivate |
Definition at line 250 of file ext4_recovery.cpp.
References block_size_, and read_fs_block().
Referenced by export_file(), read_group_desc(), read_inode(), and recover_directory().
|
inline |
Definition at line 159 of file ext4_recovery.cpp.
References block_size_, build_journal_replay_map(), export_journal(), inode_size_, load_superblock(), recover_directory(), trs(), and volume_offset_.
|
inlineprivate |
Definition at line 1054 of file ext4_recovery.cpp.
References block_size_, export_file(), inode_is_dir(), inode_ranges(), anonymous_namespace{ext4_recovery.cpp}::le16(), anonymous_namespace{ext4_recovery.cpp}::le32(), read_inode(), read_volume_bytes_replayed(), recover_directory(), anonymous_namespace{ext4_recovery.cpp}::sanitize_path_component(), trs(), and volume_offset_.
Referenced by recover(), and recover_directory().
|
inlineprivate |
Definition at line 887 of file ext4_recovery.cpp.
References anonymous_namespace{ext4_recovery.cpp}::le16(), anonymous_namespace{ext4_recovery.cpp}::le32(), and looks_like_printable_name().
Referenced by export_journal().
|
private |
Definition at line 187 of file ext4_recovery.cpp.
Referenced by block_to_offset(), build_journal_replay_map(), collect_extents_from_node(), export_journal(), inode_block_map_classic(), inode_marked_allocated(), inode_ranges(), load_superblock(), read_fs_block(), read_inode(), read_u32_block(), read_volume_bytes_replayed(), recover(), and recover_directory().
|
private |
Definition at line 188 of file ext4_recovery.cpp.
Referenced by load_superblock().
|
private |
Definition at line 198 of file ext4_recovery.cpp.
Referenced by build_journal_replay_map().
|
private |
Definition at line 192 of file ext4_recovery.cpp.
Referenced by inode_marked_allocated(), load_superblock(), read_group_desc(), and read_inode().
|
private |
Definition at line 191 of file ext4_recovery.cpp.
Referenced by load_superblock(), and read_group_desc().
|
private |
Definition at line 193 of file ext4_recovery.cpp.
Referenced by load_superblock().
|
private |
Definition at line 190 of file ext4_recovery.cpp.
Referenced by load_superblock(), read_inode(), and recover().
|
private |
Definition at line 189 of file ext4_recovery.cpp.
Referenced by inode_marked_allocated(), load_superblock(), and read_inode().
|
private |
Definition at line 195 of file ext4_recovery.cpp.
Referenced by build_journal_replay_map(), export_journal(), and load_superblock().
|
private |
Definition at line 196 of file ext4_recovery.cpp.
Referenced by build_journal_replay_map(), export_journal(), and read_fs_block().
|
private |
Definition at line 197 of file ext4_recovery.cpp.
Referenced by build_journal_replay_map(), and read_fs_block().
|
private |
Definition at line 185 of file ext4_recovery.cpp.
Referenced by build_journal_replay_map(), export_journal(), Ext4RecoveryImpl(), load_superblock(), and read_fs_block().
|
private |
Definition at line 199 of file ext4_recovery.cpp.
Referenced by build_journal_replay_map().
|
private |
Definition at line 194 of file ext4_recovery.cpp.
Referenced by inode_marked_allocated(), load_superblock(), and read_inode().
|
private |
Definition at line 186 of file ext4_recovery.cpp.
Referenced by block_to_offset(), build_journal_replay_map(), export_file(), load_superblock(), read_group_desc(), recover(), and recover_directory().