From 3ed39253701797332db8a2a03c288c4fc7feafb0 Mon Sep 17 00:00:00 2001 From: Arusekk Date: Wed, 25 Mar 2020 15:58:02 +0100 Subject: [PATCH] Fix compilation with uClibc Closes #12 --- base/application.cc | 4 ++-- caching/cache_writeback.cc | 6 +++--- thin-provisioning/metadata_dumper.cc | 16 ++++++++-------- thin-provisioning/thin_dump.cc | 2 +- thin-provisioning/thin_ls.cc | 8 ++++---- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/base/application.cc b/base/application.cc index 3c5202c..61338ff 100644 --- a/base/application.cc +++ b/base/application.cc @@ -24,12 +24,12 @@ command::die(string const &msg) exit(1); } -uint64_t +::uint64_t command::parse_uint64(string const &str, string const &desc) { try { // FIXME: check trailing garbage is handled - return lexical_cast(str); + return lexical_cast<::uint64_t>(str); } catch (...) { ostringstream out; diff --git a/caching/cache_writeback.cc b/caching/cache_writeback.cc index 4438433..1f7fa59 100644 --- a/caching/cache_writeback.cc +++ b/caching/cache_writeback.cc @@ -193,10 +193,10 @@ namespace { if (call_count++ % 128) return; - uint64_t scanned = stats_.blocks_scanned * 100 / cache_blocks_; - uint64_t copied = safe_div(stats_.blocks_completed * 100, + ::uint64_t scanned = stats_.blocks_scanned * 100 / cache_blocks_; + ::uint64_t copied = safe_div(stats_.blocks_completed * 100, stats_.blocks_needed, 100ull); - uint64_t percent = min(scanned, copied); + ::uint64_t percent = min<::uint64_t>(scanned, copied); monitor_.update_percent(percent); } diff --git a/thin-provisioning/metadata_dumper.cc b/thin-provisioning/metadata_dumper.cc index 3fc3b30..be4b666 100644 --- a/thin-provisioning/metadata_dumper.cc +++ b/thin-provisioning/metadata_dumper.cc @@ -232,8 +232,8 @@ namespace { block_address b; unsigned values; - uint64_t key_low; - uint64_t key_high; + ::uint64_t key_low; + ::uint64_t key_high; //set devices; uint32_t age; map time_counts; @@ -477,7 +477,7 @@ namespace { // values refer to blocks, so we should have infos for them. auto n = to_node(rr); - uint64_t key_low = 0; + ::uint64_t key_low = 0; unsigned values = 0; for (unsigned i = 0; i < n.get_nr_entries(); i++) { @@ -541,7 +541,7 @@ namespace { info.nr_mappings += n.value_at(i).mapped_blocks_; } - } else if (vsize == sizeof(uint64_t)) { + } else if (vsize == sizeof(::uint64_t)) { auto n = to_node(rr); if (n.get_nr_entries()) { @@ -658,7 +658,7 @@ namespace { } private: - void start_mapping(uint64_t origin_block, block_time const &bt) { + void start_mapping(::uint64_t origin_block, block_time const &bt) { origin_start_ = origin_block; dest_start_ = bt.block_; time_ = bt.time_; @@ -677,7 +677,7 @@ namespace { } } - void add_mapping(uint64_t origin_block, block_time const &bt) { + void add_mapping(::uint64_t origin_block, block_time const &bt) { if (!in_range_) start_mapping(origin_block, bt); @@ -748,7 +748,7 @@ namespace { } private: - void emit_mappings(uint64_t dev_id, block_address subtree_root) { + void emit_mappings(::uint64_t dev_id, block_address subtree_root) { mapping_emit_visitor me(e_); // Since we're not mutating the btrees we don't need a real space map @@ -918,7 +918,7 @@ thin_provisioning::metadata_repair(block_manager<>::ptr bm, emitter::ptr e, over //---------------------------------------------------------------- void -thin_provisioning::metadata_dump_subtree(metadata::ptr md, emitter::ptr e, bool repair, uint64_t subtree_root) { +thin_provisioning::metadata_dump_subtree(metadata::ptr md, emitter::ptr e, bool repair, ::uint64_t subtree_root) { mapping_emit_visitor me(e); single_mapping_tree tree(*md->tm_, subtree_root, mapping_tree_detail::block_time_ref_counter(md->data_sm_)); diff --git a/thin-provisioning/thin_dump.cc b/thin-provisioning/thin_dump.cc index 1b9cee2..e049202 100644 --- a/thin-provisioning/thin_dump.cc +++ b/thin-provisioning/thin_dump.cc @@ -145,7 +145,7 @@ thin_dump_cmd::run(int argc, char **argv) const char shortopts[] = "hm::o:f:rV"; char *end_ptr; block_address metadata_snap = 0; - uint64_t dev_id; + ::uint64_t dev_id; struct flags flags; const struct option longopts[] = { diff --git a/thin-provisioning/thin_ls.cc b/thin-provisioning/thin_ls.cc index 03b8d63..fe608a7 100644 --- a/thin-provisioning/thin_ls.cc +++ b/thin-provisioning/thin_ls.cc @@ -236,9 +236,9 @@ namespace { } }; - void pass1(metadata::ptr md, mapping_set &mappings, uint64_t dev_id) { + void pass1(metadata::ptr md, mapping_set &mappings, ::uint64_t dev_id) { dev_tree::key k = {dev_id}; - optional dev_root = md->mappings_top_level_->lookup(k); + optional<::uint64_t> dev_root = md->mappings_top_level_->lookup(k); if (!dev_root) throw runtime_error("couldn't find mapping tree root"); @@ -252,9 +252,9 @@ namespace { } - block_address count_exclusives(metadata::ptr md, mapping_set const &mappings, uint64_t dev_id) { + block_address count_exclusives(metadata::ptr md, mapping_set const &mappings, ::uint64_t dev_id) { dev_tree::key k = {dev_id}; - optional dev_root = md->mappings_top_level_->lookup(k); + optional<::uint64_t> dev_root = md->mappings_top_level_->lookup(k); if (!dev_root) throw runtime_error("couldn't find mapping tree root");