diff --git a/include/dwarfs/global_entry_data.h b/include/dwarfs/global_entry_data.h index b749e797..153e67aa 100644 --- a/include/dwarfs/global_entry_data.h +++ b/include/dwarfs/global_entry_data.h @@ -49,11 +49,11 @@ class global_entry_data { void add_ctime(uint64_t time); void add_name(std::string const& name) { names_.emplace(name, 0); } - void add_link(std::string const& link) { links_.emplace(link, 0); } + void add_link(std::string const& link) { symlinks_.emplace(link, 0); } void index() { index(names_); - index(links_); + index(symlinks_); } uint16_t get_uid_index(uint16_t uid) const; @@ -61,7 +61,7 @@ class global_entry_data { uint16_t get_mode_index(uint16_t mode) const; uint32_t get_name_index(std::string const& name) const; - uint32_t get_link_index(std::string const& link) const; + uint32_t get_symlink_index(std::string const& link) const; uint64_t get_mtime_offset(uint64_t time) const; uint64_t get_atime_offset(uint64_t time) const; @@ -72,7 +72,7 @@ class global_entry_data { std::vector get_modes() const; std::vector get_names() const; - std::vector get_links() const; + std::vector get_symlinks() const; uint64_t get_timestamp_base() const; @@ -98,7 +98,7 @@ class global_entry_data { map_type gids_; map_type modes_; map_type names_; - map_type links_; + map_type symlinks_; uint16_t next_uid_index_{0}; uint16_t next_gid_index_{0}; uint16_t next_mode_index_{0}; diff --git a/include/dwarfs/progress.h b/include/dwarfs/progress.h index 33b339af..0d78ea09 100644 --- a/include/dwarfs/progress.h +++ b/include/dwarfs/progress.h @@ -59,8 +59,8 @@ class progress { std::atomic files_scanned{0}; std::atomic dirs_found{0}; std::atomic dirs_scanned{0}; - std::atomic links_found{0}; - std::atomic links_scanned{0}; + std::atomic symlinks_found{0}; + std::atomic symlinks_scanned{0}; std::atomic specials_found{0}; std::atomic duplicate_files{0}; std::atomic hardlinks{0}; diff --git a/src/dwarfs/console_writer.cpp b/src/dwarfs/console_writer.cpp index 3888019b..e3cf23ac 100644 --- a/src/dwarfs/console_writer.cpp +++ b/src/dwarfs/console_writer.cpp @@ -172,7 +172,7 @@ void console_writer::update(const progress& p, bool last) { << newline; } - oss << p.dirs_scanned << " dirs, " << p.links_scanned << "/" + oss << p.dirs_scanned << " dirs, " << p.symlinks_scanned << "/" << p.hardlinks << " soft/hard links, " << p.files_scanned << "/" << p.files_found << " files, " << p.specials_found << " other" << newline diff --git a/src/dwarfs/global_entry_data.cpp b/src/dwarfs/global_entry_data.cpp index 2f1eb475..eb9ee178 100644 --- a/src/dwarfs/global_entry_data.cpp +++ b/src/dwarfs/global_entry_data.cpp @@ -51,8 +51,8 @@ std::vector global_entry_data::get_names() const { return get_vector(names_); } -std::vector global_entry_data::get_links() const { - return get_vector(links_); +std::vector global_entry_data::get_symlinks() const { + return get_vector(symlinks_); } void global_entry_data::index(map_type& map) { @@ -100,8 +100,8 @@ uint32_t global_entry_data::get_name_index(std::string const& name) const { return DWARFS_NOTHROW(names_.at(name)); } -uint32_t global_entry_data::get_link_index(std::string const& link) const { - return DWARFS_NOTHROW(links_.at(link)); +uint32_t global_entry_data::get_symlink_index(std::string const& link) const { + return DWARFS_NOTHROW(symlinks_.at(link)); } void global_entry_data::add_uid(uint16_t uid) { diff --git a/src/dwarfs/metadata_v2.cpp b/src/dwarfs/metadata_v2.cpp index cd33c124..40e6cc67 100644 --- a/src/dwarfs/metadata_v2.cpp +++ b/src/dwarfs/metadata_v2.cpp @@ -115,32 +115,32 @@ class metadata_ final : public metadata_v2::impl { , root_(meta_.entries()[meta_.entry_index()[0]], &meta_) , log_(lgr) , inode_offset_(inode_offset) - , link_index_offset_(find_index_offset(inode_rank::INO_LNK)) + , symlink_index_offset_(find_index_offset(inode_rank::INO_LNK)) , chunk_index_offset_(find_index_offset(inode_rank::INO_REG)) , dev_index_offset_(find_index_offset(inode_rank::INO_DEV)) , nlinks_(build_nlinks(options)) , options_(options) { - LOG_DEBUG << "link index offset: " << link_index_offset_; + LOG_DEBUG << "symlink index offset: " << symlink_index_offset_; LOG_DEBUG << "chunk index offset: " << chunk_index_offset_; LOG_DEBUG << "device index offset: " << dev_index_offset_; - if (int(meta_.directories().size() - 1) != link_index_offset_) { + if (int(meta_.directories().size() - 1) != symlink_index_offset_) { DWARFS_THROW( runtime_error, fmt::format("metadata inconsistency: number of directories ({}) does " "not match link index ({})", - meta_.directories().size() - 1, link_index_offset_)); + meta_.directories().size() - 1, symlink_index_offset_)); } - if (int(meta_.link_index().size()) != - (chunk_index_offset_ - link_index_offset_)) { + if (int(meta_.symlink_index().size()) != + (chunk_index_offset_ - symlink_index_offset_)) { DWARFS_THROW( runtime_error, fmt::format( - "metadata inconsistency: number of links ({}) does not match " - "chunk/link index delta ({} - {} = {})", - meta_.link_index().size(), chunk_index_offset_, - link_index_offset_, chunk_index_offset_ - link_index_offset_)); + "metadata inconsistency: number of symlinks ({}) does not match " + "chunk/symlink index delta ({} - {} = {})", + meta_.symlink_index().size(), chunk_index_offset_, + symlink_index_offset_, chunk_index_offset_ - symlink_index_offset_)); } if (int(meta_.chunk_index().size() - 1) != @@ -395,7 +395,7 @@ class metadata_ final : public metadata_v2::impl { std::string_view link_value(entry_view entry) const { return meta_ - .links()[meta_.link_index()[entry.inode() - link_index_offset_]]; + .symlinks()[meta_.symlink_index()[entry.inode() - symlink_index_offset_]]; } uint64_t get_device_id(int inode) const { @@ -433,7 +433,7 @@ class metadata_ final : public metadata_v2::impl { entry_view root_; log_proxy log_; const int inode_offset_; - const int link_index_offset_; + const int symlink_index_offset_; const int chunk_index_offset_; const int dev_index_offset_; const std::vector nlinks_; diff --git a/src/dwarfs/scanner.cpp b/src/dwarfs/scanner.cpp index 18d2be9e..b9e3bc7c 100644 --- a/src/dwarfs/scanner.cpp +++ b/src/dwarfs/scanner.cpp @@ -209,9 +209,9 @@ class pipe_set_inode_visitor : public visitor_base { uint32_t& inode_no_; }; -class names_and_links_visitor : public entry_visitor { +class names_and_symlinks_visitor : public entry_visitor { public: - explicit names_and_links_visitor(global_entry_data& data) + explicit names_and_symlinks_visitor(global_entry_data& data) : data_(data) {} void visit(file* p) override { data_.add_name(p->name()); } @@ -417,9 +417,9 @@ scanner_::scan_tree(const std::string& path, progress& prog) { break; case entry::E_LINK: - prog.links_found++; + prog.symlinks_found++; pe->scan(*os_, prog); - prog.links_scanned++; + prog.symlinks_scanned++; break; case entry::E_DEVICE: @@ -506,7 +506,7 @@ void scanner_::scan(filesystem_writer& fsw, global_entry_data ge_data(options_); thrift::metadata::metadata mv2; - mv2.link_index.resize(first_file_inode - first_link_inode); + mv2.symlink_index.resize(first_file_inode - first_link_inode); LOG_INFO << "assigning device inodes..."; uint32_t first_device_inode = first_file_inode + im.count(); @@ -522,8 +522,8 @@ void scanner_::scan(filesystem_writer& fsw, LOG_INFO << "building metadata..."; wg_.add_job([&] { - LOG_INFO << "saving names and links..."; - names_and_links_visitor nlv(ge_data); + LOG_INFO << "saving names and symlinks..."; + names_and_symlinks_visitor nlv(ge_data); root->accept(nlv); ge_data.index(); @@ -532,8 +532,8 @@ void scanner_::scan(filesystem_writer& fsw, root->walk([&](entry* ep) { ep->update(ge_data); if (auto lp = dynamic_cast(ep)) { - DWARFS_NOTHROW(mv2.link_index.at(ep->inode_num() - first_link_inode)) = - ge_data.get_link_index(lp->linkname()); + DWARFS_NOTHROW(mv2.symlink_index.at(ep->inode_num() - first_link_inode)) = + ge_data.get_symlink_index(lp->linkname()); } }); }); @@ -607,7 +607,7 @@ void scanner_::scan(filesystem_writer& fsw, mv2.gids = ge_data.get_gids(); mv2.modes = ge_data.get_modes(); mv2.names = ge_data.get_names(); - mv2.links = ge_data.get_links(); + mv2.symlinks = ge_data.get_symlinks(); mv2.timestamp_base = ge_data.get_timestamp_base(); mv2.block_size = UINT32_C(1) << cfg_.block_size_bits; mv2.total_fs_size = prog.original_size; diff --git a/thrift/metadata.thrift b/thrift/metadata.thrift index b146165a..f5fa5fd7 100644 --- a/thrift/metadata.thrift +++ b/thrift/metadata.thrift @@ -141,7 +141,7 @@ struct metadata { 5: required list entry_index, // link index, indexed by (inode - link_index_offset) - 6: required list link_index, + 6: required list symlink_index, // user ids, for lookup by index in entry.owner 7: required list uids, @@ -155,8 +155,8 @@ struct metadata { // entry names, for lookup by index in entry.name_index 10: required list names, - // link targets, for lookup by index from link_index - 11: required list links, + // link targets, for lookup by index from symlink_index + 11: required list symlinks, // timestamp base for all entry timestamps 12: required UInt64 timestamp_base,