From 2d4fc9aae9ad24084edf80c95929c633c680e11f Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Wed, 2 Jan 2013 19:18:43 -0800 Subject: [PATCH] snapshot: more renaming addMemoryRegionToSnapShot -> snapshot_add_memory_region rollBack -> snapshot_roll_back takeSnapshot -> take_snapshot --- snapshot-interface.cc | 8 ++++---- snapshot.cc | 16 ++++++++-------- snapshot.h | 6 +++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/snapshot-interface.cc b/snapshot-interface.cc index 974e436..a627dab 100644 --- a/snapshot-interface.cc +++ b/snapshot-interface.cc @@ -58,7 +58,7 @@ static void SnapshotGlobalSegments() if (w == 'w' && (strstr(regionname, MYBINARYNAME) || strstr(regionname, MYLIBRARYNAME))) { size_t len = ((uintptr_t)end - (uintptr_t)begin) / PAGESIZE; if (len != 0) - addMemoryRegionToSnapShot(begin, len); + snapshot_add_memory_region(begin, len); } } pclose(map); @@ -98,7 +98,7 @@ static void SnapshotGlobalSegments() if (w == 'w' && (strstr(regionname, binary_name) || strstr(regionname, MYLIBRARYNAME))) { size_t len = ((uintptr_t)end - (uintptr_t)begin) / PAGESIZE; if (len != 0) - addMemoryRegionToSnapShot(begin, len); + snapshot_add_memory_region(begin, len); DEBUG("%55s: %18p - %18p\t%c%c%c%c\n", regionname, begin, end, r, w, x, p); } } @@ -128,7 +128,7 @@ int SnapshotStack::backTrackBeforeStep(int seqindex) while (true) { if (stack->index <= seqindex) { //have right entry - rollBack(stack->snapshotid); + snapshot_roll_back(stack->snapshotid); return stack->index; } struct stackEntry *tmp = stack; @@ -143,6 +143,6 @@ void SnapshotStack::snapshotStep(int seqindex) struct stackEntry *tmp = (struct stackEntry *)model_malloc(sizeof(struct stackEntry)); tmp->next = stack; tmp->index = seqindex; - tmp->snapshotid = takeSnapshot(); + tmp->snapshotid = take_snapshot(); stack = tmp; } diff --git a/snapshot.cc b/snapshot.cc index 6d6b450..16b0b61 100644 --- a/snapshot.cc +++ b/snapshot.cc @@ -174,12 +174,12 @@ static void mprot_snapshot_init(unsigned int numbackingpages, void *basemySpace = model_malloc((numheappages + 1) * PAGESIZE); void *pagealignedbase = PageAlignAddressUpward(basemySpace); user_snapshot_space = create_mspace_with_base(pagealignedbase, numheappages * PAGESIZE, 1); - addMemoryRegionToSnapShot(pagealignedbase, numheappages); + snapshot_add_memory_region(pagealignedbase, numheappages); void *base_model_snapshot_space = model_malloc((numheappages + 1) * PAGESIZE); pagealignedbase = PageAlignAddressUpward(base_model_snapshot_space); model_snapshot_space = create_mspace_with_base(pagealignedbase, numheappages * PAGESIZE, 1); - addMemoryRegionToSnapShot(pagealignedbase, numheappages); + snapshot_add_memory_region(pagealignedbase, numheappages); entryPoint(); } @@ -412,8 +412,8 @@ void initSnapshotLibrary(unsigned int numbackingpages, #endif } -/** The addMemoryRegionToSnapShot function assumes that addr is page aligned. */ -void addMemoryRegionToSnapShot(void *addr, unsigned int numPages) +/** Assumes that addr is page aligned. */ +void snapshot_add_memory_region(void *addr, unsigned int numPages) { #if USE_MPROTECT_SNAPSHOT mprot_add_to_snapshot(addr, numPages); @@ -422,10 +422,10 @@ void addMemoryRegionToSnapShot(void *addr, unsigned int numPages) #endif } -/** The takeSnapshot function takes a snapshot. +/** Takes a snapshot of memory. * @return The snapshot identifier. */ -snapshot_id takeSnapshot() +snapshot_id take_snapshot() { #if USE_MPROTECT_SNAPSHOT return mprot_take_snapshot(); @@ -434,10 +434,10 @@ snapshot_id takeSnapshot() #endif } -/** The rollBack function rollback to the given snapshot identifier. +/** Rolls the memory state back to the given snapshot identifier. * @param theID is the snapshot identifier to rollback to. */ -void rollBack(snapshot_id theID) +void snapshot_roll_back(snapshot_id theID) { #if USE_MPROTECT_SNAPSHOT mprot_roll_back(theID); diff --git a/snapshot.h b/snapshot.h index 8d37934..d3fc7b8 100644 --- a/snapshot.h +++ b/snapshot.h @@ -9,9 +9,9 @@ #include "config.h" #include "mymemory.h" -void addMemoryRegionToSnapShot(void *ptr, unsigned int numPages); -snapshot_id takeSnapshot(); -void rollBack(snapshot_id theSnapShot); +void snapshot_add_memory_region(void *ptr, unsigned int numPages); +snapshot_id take_snapshot(); +void snapshot_roll_back(snapshot_id theSnapShot); #if !USE_MPROTECT_SNAPSHOT mspace create_shared_mspace(); -- 2.34.1