renamed open/deleteLogWriter

This commit is contained in:
Sears Russell 2008-12-29 19:46:51 +00:00
parent 97ab7670db
commit 6f809b00e2
5 changed files with 24 additions and 25 deletions

View file

@ -185,7 +185,7 @@ static inline lsn_t nextEntry_LogWriter(stasis_log_t* log,
return nextEntry(e);
}
stasis_log_t* openLogWriter(const char * filename,
stasis_log_t* stasis_log_safe_writes_open(const char * filename,
int filemode, int fileperm) {
log_filename = strdup(filename);
@ -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);
}

View file

@ -141,7 +141,7 @@ int Tinit() {
setupOperationsTable();
dirtyPagesInit();
if(LOG_TO_FILE == loggerType) {
stasis_log_file = openLogWriter(stasis_log_file_name,
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) {

View file

@ -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 <stasis/common.h>
#include <stasis/logger/logger2.h>
#include <stasis/logger/logEntry.h>
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

View file

@ -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,7 +394,7 @@ 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 = stasis_log_safe_writes_open(stasis_log_file_name,
stasis_log_file_mode,
stasis_log_file_permissions);
} else if(LOG_TO_MEMORY == loggerType) {
@ -425,7 +425,7 @@ 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 = stasis_log_safe_writes_open(stasis_log_file_name,
stasis_log_file_mode,
stasis_log_file_permissions);
} else if(LOG_TO_MEMORY == loggerType) {
@ -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

View file

@ -63,9 +63,9 @@ int main() {
setupOperationsTable();
stasis_log_t* log;
if(NULL == (log = openLogWriter(stasis_log_file_name,
if(NULL == (log = stasis_log_safe_writes_open(stasis_log_file_name,
stasis_log_file_mode,
stasis_log_file_permissions))) {
stasis_log_file_permissions))){
printf("Couldn't open log.\n");
}