aboutsummaryrefslogtreecommitdiffstats
path: root/linker/linker_block_allocator.cpp
diff options
context:
space:
mode:
authorDmitriy Ivanov <dimitry@google.com>2015-03-10 15:43:50 -0700
committerDmitriy Ivanov <dimitry@google.com>2015-03-10 15:43:50 -0700
commit600bc3cb9342fbb1dc16ea25f5b676ce072e3e1b (patch)
tree5892626ab8bfc8648476ba15f71d20e03e90da11 /linker/linker_block_allocator.cpp
parentc9ce70d7838b6aae074fc3615cdf04e5c9ac612a (diff)
downloadandroid_bionic-600bc3cb9342fbb1dc16ea25f5b676ce072e3e1b.tar.gz
android_bionic-600bc3cb9342fbb1dc16ea25f5b676ce072e3e1b.tar.bz2
android_bionic-600bc3cb9342fbb1dc16ea25f5b676ce072e3e1b.zip
Rename LinkerAllocator and LinkerAllocatorPage
Change-Id: I87d80fbcd4ec26c0ee4f601b9c4c64f600418dd9
Diffstat (limited to 'linker/linker_block_allocator.cpp')
-rw-r--r--linker/linker_block_allocator.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/linker/linker_block_allocator.cpp b/linker/linker_block_allocator.cpp
index 4545c4ae2..fc9a75b15 100644
--- a/linker/linker_block_allocator.cpp
+++ b/linker/linker_block_allocator.cpp
@@ -22,9 +22,9 @@
#include "private/bionic_prctl.h"
-struct LinkerAllocatorPage {
- LinkerAllocatorPage* next;
- uint8_t bytes[PAGE_SIZE-sizeof(LinkerAllocatorPage*)];
+struct LinkerBlockAllocatorPage {
+ LinkerBlockAllocatorPage* next;
+ uint8_t bytes[PAGE_SIZE-sizeof(LinkerBlockAllocatorPage*)];
};
struct FreeBlockInfo {
@@ -64,7 +64,7 @@ void LinkerBlockAllocator::free(void* block) {
return;
}
- LinkerAllocatorPage* page = find_page(block);
+ LinkerBlockAllocatorPage* page = find_page(block);
if (page == nullptr) {
abort();
@@ -87,7 +87,7 @@ void LinkerBlockAllocator::free(void* block) {
}
void LinkerBlockAllocator::protect_all(int prot) {
- for (LinkerAllocatorPage* page = page_list_; page != nullptr; page = page->next) {
+ for (LinkerBlockAllocatorPage* page = page_list_; page != nullptr; page = page->next) {
if (mprotect(page, PAGE_SIZE, prot) == -1) {
abort();
}
@@ -95,8 +95,9 @@ void LinkerBlockAllocator::protect_all(int prot) {
}
void LinkerBlockAllocator::create_new_page() {
- LinkerAllocatorPage* page = reinterpret_cast<LinkerAllocatorPage*>(mmap(nullptr, PAGE_SIZE,
- PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0));
+ LinkerBlockAllocatorPage* page = reinterpret_cast<LinkerBlockAllocatorPage*>(
+ mmap(nullptr, PAGE_SIZE, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0));
+
if (page == MAP_FAILED) {
abort(); // oom
}
@@ -107,7 +108,7 @@ void LinkerBlockAllocator::create_new_page() {
FreeBlockInfo* first_block = reinterpret_cast<FreeBlockInfo*>(page->bytes);
first_block->next_block = free_block_list_;
- first_block->num_free_blocks = (PAGE_SIZE - sizeof(LinkerAllocatorPage*))/block_size_;
+ first_block->num_free_blocks = (PAGE_SIZE - sizeof(LinkerBlockAllocatorPage*))/block_size_;
free_block_list_ = first_block;
@@ -115,12 +116,12 @@ void LinkerBlockAllocator::create_new_page() {
page_list_ = page;
}
-LinkerAllocatorPage* LinkerBlockAllocator::find_page(void* block) {
+LinkerBlockAllocatorPage* LinkerBlockAllocator::find_page(void* block) {
if (block == nullptr) {
abort();
}
- LinkerAllocatorPage* page = page_list_;
+ LinkerBlockAllocatorPage* page = page_list_;
while (page != nullptr) {
const uint8_t* page_ptr = reinterpret_cast<const uint8_t*>(page);
if (block >= (page_ptr + sizeof(page->next)) && block < (page_ptr + PAGE_SIZE)) {