Improve dwarfsck output

This commit is contained in:
Marcus Holland-Moritz 2021-03-20 06:30:32 +01:00
parent e4e03fa687
commit 13eeaba658
2 changed files with 14 additions and 9 deletions

View File

@ -479,7 +479,9 @@ void filesystem_v2::identify(logger& lgr, std::shared_ptr<mmif> mm,
LOG_PROXY(debug_logger_policy, lgr); LOG_PROXY(debug_logger_policy, lgr);
filesystem_parser parser(mm); filesystem_parser parser(mm);
os << "FILESYSTEM version " << parser.version() << std::endl; if (detail_level > 0) {
os << "FILESYSTEM version " << parser.version() << std::endl;
}
section_map sections; section_map sections;
@ -489,10 +491,12 @@ void filesystem_v2::identify(logger& lgr, std::shared_ptr<mmif> mm,
s->length(), tmp); s->length(), tmp);
float compression_ratio = float(s->length()) / bd.uncompressed_size(); float compression_ratio = float(s->length()) / bd.uncompressed_size();
os << "SECTION " << s->description() if (detail_level > 2) {
<< ", blocksize=" << bd.uncompressed_size() os << "SECTION " << s->description()
<< ", ratio=" << fmt::format("{:.2f}%", 100.0 * compression_ratio) << ", blocksize=" << bd.uncompressed_size()
<< std::endl; << ", ratio=" << fmt::format("{:.2f}%", 100.0 * compression_ratio)
<< std::endl;
}
// TODO: don't throw if we're just checking the file system // TODO: don't throw if we're just checking the file system

View File

@ -777,8 +777,7 @@ void metadata_<LoggerPolicy>::dump(
} }
} }
if (detail_level > 1) { if (detail_level > 2) {
os << "inode_count: " << inode_count_ << std::endl;
os << "symlink_inode_offset: " << symlink_inode_offset_ << std::endl; os << "symlink_inode_offset: " << symlink_inode_offset_ << std::endl;
os << "file_inode_offset: " << file_inode_offset_ << std::endl; os << "file_inode_offset: " << file_inode_offset_ << std::endl;
os << "dev_inode_offset: " << dev_inode_offset_ << std::endl; os << "dev_inode_offset: " << dev_inode_offset_ << std::endl;
@ -801,15 +800,17 @@ void metadata_<LoggerPolicy>::dump(
} }
if (auto sfp = meta_.shared_files_table()) { if (auto sfp = meta_.shared_files_table()) {
if (meta_.options()->packed_shared_files_table()) { if (meta_.options()->packed_shared_files_table()) {
os << "compressed shared_files_table: " << sfp->size() << std::endl; os << "packed shared_files_table: " << sfp->size() << std::endl;
os << "decompressed shared_files_table: " << shared_files_.size() os << "unpacked shared_files_table: " << shared_files_.size()
<< std::endl; << std::endl;
} else { } else {
os << "shared_files_table: " << sfp->size() << std::endl; os << "shared_files_table: " << sfp->size() << std::endl;
} }
os << "unique files: " << unique_files_ << std::endl; os << "unique files: " << unique_files_ << std::endl;
} }
}
if (detail_level > 1) {
analyze_frozen(os, meta_, data_.size(), detail_level); analyze_frozen(os, meta_, data_.size(), detail_level);
} }