fix config.h error for installed copies of stasis

This commit is contained in:
Sears Russell 2009-04-29 21:31:39 +00:00
parent f947a2b417
commit b5b414490a
6 changed files with 20 additions and 16 deletions

View file

@ -131,7 +131,7 @@ lsn_t sizeofLogEntry(const LogEntry * e) {
switch (e->type) { switch (e->type) {
case CLRLOG: case CLRLOG:
{ {
const LogEntry * contents = getCLRCompensated(e); const LogEntry * contents = getCLRCompensated((const CLRLogEntry*) e);
assert(contents->type != CLRLOG); assert(contents->type != CLRLOG);
return sizeof(struct __raw_log_entry) + sizeofLogEntry(contents); return sizeof(struct __raw_log_entry) + sizeofLogEntry(contents);
} }

View file

@ -152,16 +152,20 @@ lsn_t LogCLR(stasis_log_t* log, const LogEntry * old_e) {
lsn_t LogDummyCLR(stasis_log_t* log, int xid, lsn_t prevLSN, lsn_t LogDummyCLR(stasis_log_t* log, int xid, lsn_t prevLSN,
lsn_t compensatedLSN) { lsn_t compensatedLSN) {
LogEntry * e; const LogEntry * const_e;
if(compensatedLSN == -1) { LogEntry * e;
e = allocUpdateLogEntry(prevLSN, xid, OPERATION_NOOP, if(compensatedLSN == -1) {
INVALID_PAGE, NULL, 0); const_e = allocUpdateLogEntry(prevLSN, xid, OPERATION_NOOP,
} else { INVALID_PAGE, NULL, 0);
e = log->read_entry(log, compensatedLSN); } else {
} const_e = log->read_entry(log, compensatedLSN);
}
e = malloc(sizeofLogEntry(const_e));
memcpy(e, const_e, sizeofLogEntry(const_e));
e->LSN = compensatedLSN; e->LSN = compensatedLSN;
lsn_t ret = LogCLR(log, e); lsn_t ret = LogCLR(log, e);
freeLogEntry(e); freeLogEntry(const_e);
free(e);
return ret; return ret;
} }

View file

@ -4,6 +4,8 @@
#include <stasis/allocationPolicy.h> #include <stasis/allocationPolicy.h>
#include <stasis/blobManager.h> #include <stasis/blobManager.h>
#include <stasis/page.h> #include <stasis/page.h>
#include <string.h>
#include <assert.h> #include <assert.h>
//try{ //try{
/** /**

View file

@ -203,7 +203,7 @@ static void stasis_recovery_redo(stasis_log_t* log) {
// if compensated_lsn == -1, then this clr is closing a nested top // if compensated_lsn == -1, then this clr is closing a nested top
// action that was performed during undo. Therefore, we do not // action that was performed during undo. Therefore, we do not
// want to undo it again. // want to undo it again.
const LogEntry * ce = getCLRCompensated(e); const LogEntry * ce = getCLRCompensated((const CLRLogEntry*)e);
if(-1 != ce->LSN) { if(-1 != ce->LSN) {
if(ce->update.page == INVALID_PAGE) { if(ce->update.page == INVALID_PAGE) {
// logical redo of end of NTA; no-op // logical redo of end of NTA; no-op
@ -308,7 +308,7 @@ static void stasis_recovery_undo(stasis_log_t* log, int recovery) {
} }
case CLRLOG: case CLRLOG:
{ {
const LogEntry * ce = getCLRCompensated(e); const LogEntry * ce = getCLRCompensated((const CLRLogEntry*) e);
if(-1 != ce->LSN) { if(-1 != ce->LSN) {
if(ce->update.page == INVALID_PAGE) { if(ce->update.page == INVALID_PAGE) {
DEBUG("logical clr\n"); DEBUG("logical clr\n");

View file

@ -53,18 +53,16 @@ terms specified in this license.
* the right thing' and build, even if they do not \#include the * the right thing' and build, even if they do not \#include the
* config.h file that all of the Stasis stuff uses. * config.h file that all of the Stasis stuff uses.
* *
* @todo Figure out how to let Stasis users avoid config.h.
*
* $Id$ * $Id$
*/ */
//#define NDEBUG 1 //#define NDEBUG 1
#include "config.h"
#ifndef __stasis_common_h #ifndef __stasis_common_h
#define __stasis_common_h #define __stasis_common_h
#include <sys/types.h> // for size_t
#ifdef __cplusplus #ifdef __cplusplus
# define BEGIN_C_DECLS extern "C" { # define BEGIN_C_DECLS extern "C" {
# define END_C_DECLS } # define END_C_DECLS }

View file

@ -130,7 +130,7 @@ const void * getUpdateArgs(const LogEntry * e);
/** /**
@return a copy of the log entry that this CLR compensated. @return a copy of the log entry that this CLR compensated.
*/ */
static inline const LogEntry * getCLRCompensated(const LogEntry * e) { static inline const LogEntry * getCLRCompensated(const CLRLogEntry * e) {
return (const LogEntry*)( return (const LogEntry*)(
((const struct __raw_log_entry*)e)+1 ((const struct __raw_log_entry*)e)+1
); );