diff --git a/src/stasis/logger/logWriter.c b/src/stasis/logger/logWriter.c index bb97d13..d82d0d2 100644 --- a/src/stasis/logger/logWriter.c +++ b/src/stasis/logger/logWriter.c @@ -185,8 +185,8 @@ static inline lsn_t nextEntry_LogWriter(stasis_log_t* log, return nextEntry(e); } -stasis_log_t* openLogWriter(const char * filename, - int filemode, int fileperm) { +stasis_log_t* stasis_log_safe_writes_open(const char * filename, + int filemode, int fileperm) { log_filename = strdup(filename); log_scratch_filename = malloc(strlen(log_filename) + 2); @@ -556,7 +556,7 @@ static int close_LogWriter(stasis_log_t* log) { return 0; } -void deleteLogWriter() { +void stasis_log_safe_writes_delete(const char* log_filename) { remove(log_filename); } diff --git a/src/stasis/transactional2.c b/src/stasis/transactional2.c index 3b5ff17..dc979ac 100644 --- a/src/stasis/transactional2.c +++ b/src/stasis/transactional2.c @@ -141,9 +141,9 @@ int Tinit() { setupOperationsTable(); dirtyPagesInit(); if(LOG_TO_FILE == loggerType) { - stasis_log_file = openLogWriter(stasis_log_file_name, - stasis_log_file_mode, - stasis_log_file_permissions); + stasis_log_file = stasis_log_safe_writes_open(stasis_log_file_name, + stasis_log_file_mode, + stasis_log_file_permissions); } else if(LOG_TO_MEMORY == loggerType) { stasis_log_file = open_InMemoryLog(); } else { diff --git a/stasis/logger/logWriter.h b/stasis/logger/logWriter.h index c772c17..2c91cb8 100644 --- a/stasis/logger/logWriter.h +++ b/stasis/logger/logWriter.h @@ -1,3 +1,6 @@ +#ifndef __LOGWRITER_H__ +#define __LOGWRITER_H__ + /*--- This software is copyrighted by the Regents of the University of California, and other parties. The following terms apply to all files @@ -67,12 +70,8 @@ terms specified in this license. * */ -#ifndef __LOGWRITER_H__ -#define __LOGWRITER_H__ - #include #include -#include BEGIN_C_DECLS /** @@ -82,7 +81,7 @@ BEGIN_C_DECLS @return NULL on error */ -stasis_log_t* openLogWriter(const char * filename, +stasis_log_t* stasis_log_safe_writes_open(const char * filename, int filemode, int fileperm); @@ -94,7 +93,7 @@ stasis_log_t* openLogWriter(const char * filename, @todo This only exists because the tests use it...once the logfile name isn't hardcoded, remove this function. */ -void deleteLogWriter(); +void stasis_log_safe_writes_delete(const char * filename); END_C_DECLS diff --git a/test/stasis/check_logWriter.c b/test/stasis/check_logWriter.c index 40e15ad..8001015 100644 --- a/test/stasis/check_logWriter.c +++ b/test/stasis/check_logWriter.c @@ -68,7 +68,7 @@ static void setup_log() { int i; lsn_t prevLSN = -1; int xid = 42; - deleteLogWriter(); + stasis_log_safe_writes_delete(stasis_log_file_name); stasis_truncation_automatic = 0; Tinit(); lsn_t firstLSN = -1; @@ -154,7 +154,7 @@ START_TEST(loggerTest) assert(i == 3000); - deleteLogWriter(); + stasis_log_safe_writes_delete(stasis_log_file_name); Tdeinit(); } END_TEST @@ -394,9 +394,9 @@ void reopenLogWorkload(int truncating) { stasis_transaction_table_active_transaction_count_set(0); if(LOG_TO_FILE == loggerType) { - stasis_log_file = openLogWriter(stasis_log_file_name, - stasis_log_file_mode, - stasis_log_file_permissions); + stasis_log_file = stasis_log_safe_writes_open(stasis_log_file_name, + stasis_log_file_mode, + stasis_log_file_permissions); } else if(LOG_TO_MEMORY == loggerType) { stasis_log_file = open_InMemoryLog(); } else { @@ -425,9 +425,9 @@ void reopenLogWorkload(int truncating) { stasis_log_file->deinit(stasis_log_file); if(LOG_TO_FILE == loggerType) { - stasis_log_file = openLogWriter(stasis_log_file_name, - stasis_log_file_mode, - stasis_log_file_permissions); + stasis_log_file = stasis_log_safe_writes_open(stasis_log_file_name, + stasis_log_file_mode, + stasis_log_file_permissions); } else if(LOG_TO_MEMORY == loggerType) { stasis_log_file = open_InMemoryLog(); } else { @@ -498,13 +498,13 @@ void reopenLogWorkload(int truncating) { } START_TEST(loggerReopenTest) { - deleteLogWriter(); + stasis_log_safe_writes_delete(stasis_log_file_name); reopenLogWorkload(0); } END_TEST START_TEST(loggerTruncateReopenTest) { - deleteLogWriter(); + stasis_log_safe_writes_delete(stasis_log_file_name); reopenLogWorkload(1); } END_TEST diff --git a/utilities/logfile_dump.c b/utilities/logfile_dump.c index ea20144..f49a3b5 100644 --- a/utilities/logfile_dump.c +++ b/utilities/logfile_dump.c @@ -63,9 +63,9 @@ int main() { setupOperationsTable(); stasis_log_t* log; - if(NULL == (log = openLogWriter(stasis_log_file_name, - stasis_log_file_mode, - stasis_log_file_permissions))) { + if(NULL == (log = stasis_log_safe_writes_open(stasis_log_file_name, + stasis_log_file_mode, + stasis_log_file_permissions))){ printf("Couldn't open log.\n"); }