diff --git a/src/blockstore/blockstore_impl.cpp b/src/blockstore/blockstore_impl.cpp index 7f980646..a26e4688 100644 --- a/src/blockstore/blockstore_impl.cpp +++ b/src/blockstore/blockstore_impl.cpp @@ -20,7 +20,7 @@ blockstore_impl_t::blockstore_impl_t(blockstore_config_t & config, ring_loop_t * dsk.open_meta(); dsk.open_journal(); calc_lengths(); - data_alloc = new allocator(dsk.block_count); + data_alloc = new allocator_t(dsk.block_count); } catch (std::exception & e) { diff --git a/src/blockstore/blockstore_impl.h b/src/blockstore/blockstore_impl.h index bd613b67..0ea8ae8a 100644 --- a/src/blockstore/blockstore_impl.h +++ b/src/blockstore/blockstore_impl.h @@ -279,7 +279,7 @@ class blockstore_impl_t std::vector unsynced_big_writes, unsynced_small_writes; int unsynced_big_write_count = 0, unstable_unsynced = 0; int unsynced_queued_ops = 0; - allocator *data_alloc = NULL; + allocator_t *data_alloc = NULL; uint64_t used_blocks = 0; uint8_t *zero_object; diff --git a/src/disk_tool/disk_tool.h b/src/disk_tool/disk_tool.h index 8d83c133..c0bce95f 100644 --- a/src/disk_tool/disk_tool.h +++ b/src/disk_tool/disk_tool.h @@ -60,7 +60,7 @@ struct disk_tool_t bool first_block, first_entry; - allocator *data_alloc; + allocator_t *data_alloc; std::map data_remap; std::map::iterator remap_it; ring_loop_t *ringloop; diff --git a/src/disk_tool/disk_tool_resize.cpp b/src/disk_tool/disk_tool_resize.cpp index cbb5b468..0e405c09 100644 --- a/src/disk_tool/disk_tool_resize.cpp +++ b/src/disk_tool/disk_tool_resize.cpp @@ -27,7 +27,7 @@ int disk_tool_t::raw_resize() return r; // Check parameters and fill allocator fprintf(stderr, "Reading metadata\n"); - data_alloc = new allocator((new_data_len < dsk.data_len ? dsk.data_len : new_data_len) / dsk.data_block_size); + data_alloc = new allocator_t((new_data_len < dsk.data_len ? dsk.data_len : new_data_len) / dsk.data_block_size); r = process_meta( [this](blockstore_meta_header_v2_t *hdr) { diff --git a/src/test/test_allocator.cpp b/src/test/test_allocator.cpp index 38f2740a..5b524740 100644 --- a/src/test/test_allocator.cpp +++ b/src/test/test_allocator.cpp @@ -7,7 +7,7 @@ void alloc_all(int size) { - allocator *a = new allocator(size); + allocator_t *a = new allocator_t(size); for (int i = 0; i < size; i++) { uint64_t x = a->find_free(); diff --git a/src/util/allocator.cpp b/src/util/allocator.cpp index 045107bc..31886a3b 100644 --- a/src/util/allocator.cpp +++ b/src/util/allocator.cpp @@ -7,7 +7,7 @@ #include #include -allocator::allocator(uint64_t blocks) +allocator_t::allocator_t(uint64_t blocks) { if (blocks >= 0x80000000 || blocks <= 1) { @@ -32,12 +32,12 @@ allocator::allocator(uint64_t blocks) } } -allocator::~allocator() +allocator_t::~allocator_t() { delete[] mask; } -bool allocator::get(uint64_t addr) +bool allocator_t::get(uint64_t addr) { if (addr >= size) { @@ -52,7 +52,7 @@ bool allocator::get(uint64_t addr) return ((mask[offset + addr/64] >> (addr % 64)) & 1); } -void allocator::set(uint64_t addr, bool value) +void allocator_t::set(uint64_t addr, bool value) { if (addr >= size) { @@ -109,7 +109,7 @@ void allocator::set(uint64_t addr, bool value) } } -uint64_t allocator::find_free() +uint64_t allocator_t::find_free() { uint64_t p2 = 1, offset = 0, addr = 0, f, i; while (p2 < size) @@ -138,7 +138,7 @@ uint64_t allocator::find_free() return addr; } -uint64_t allocator::get_free_count() +uint64_t allocator_t::get_free_count() { return free; } diff --git a/src/util/allocator.h b/src/util/allocator.h index dd013b50..336a400d 100644 --- a/src/util/allocator.h +++ b/src/util/allocator.h @@ -6,7 +6,7 @@ #include // Hierarchical bitmap allocator -class allocator +class allocator_t { uint64_t total; uint64_t size; @@ -14,8 +14,8 @@ class allocator uint64_t last_one_mask; uint64_t *mask; public: - allocator(uint64_t blocks); - ~allocator(); + allocator_t(uint64_t blocks); + ~allocator_t(); bool get(uint64_t addr); void set(uint64_t addr, bool value); uint64_t find_free();