diff --git a/src/stasis/bufferManager.c b/src/stasis/bufferManager.c index cc34d70..5a4dffd 100644 --- a/src/stasis/bufferManager.c +++ b/src/stasis/bufferManager.c @@ -125,7 +125,7 @@ static void bufManSimulateBufferManagerCrash(); static int bufManBufInit() { - releasePage = bufManReleasePage; + releasePageImpl = bufManReleasePage; loadPageImpl = bufManLoadPage; writeBackPage = pageWrite; forcePages = forcePageFile; @@ -503,7 +503,7 @@ static compensated_function Page *bufManLoadPage(int xid, int pageid) { } Page * (*loadPageImpl)(int xid, int pageid) = 0; -void (*releasePage)(Page * p) = 0; +void (*releasePageImpl)(Page * p) = 0; void (*writeBackPage)(Page * p) = 0; void (*forcePages)() = 0; void (*bufDeinit)() = 0; @@ -519,6 +519,10 @@ Page * loadPage(int xid, int pageid) { } +void releasePage(Page * p) { + releasePageImpl(p); +} + int bufInit(int type) { bufferManagerType = type; static int lastType = 0; diff --git a/src/stasis/bufferManager/bufferHash.c b/src/stasis/bufferManager/bufferHash.c index bb79c85..1076a2f 100644 --- a/src/stasis/bufferManager/bufferHash.c +++ b/src/stasis/bufferManager/bufferHash.c @@ -319,7 +319,7 @@ void bhBufInit() { #endif loadPageImpl = bhLoadPageImpl; - releasePage = bhReleasePage; + releasePageImpl = bhReleasePage; writeBackPage = bhWriteBackPage; forcePages = bhForcePages; bufDeinit = bhBufDeinit; diff --git a/src/stasis/bufferManager/pageArray.c b/src/stasis/bufferManager/pageArray.c index 5f8a962..82ac03a 100644 --- a/src/stasis/bufferManager/pageArray.c +++ b/src/stasis/bufferManager/pageArray.c @@ -58,7 +58,7 @@ static void paBufDeinit() { void paBufInit () { - releasePage = paReleasePage; + releasePageImpl = paReleasePage; loadPageImpl = paLoadPage; writeBackPage = paWriteBackPage; forcePages = paForcePages; diff --git a/stasis/bufferManager.h b/stasis/bufferManager.h index 279e009..6b0b6ed 100644 --- a/stasis/bufferManager.h +++ b/stasis/bufferManager.h @@ -126,7 +126,13 @@ extern Page * (*loadPageImpl)(int xid, int pageid); loadPage aquires a lock when it is called, effectively pinning it in memory. releasePage releases this lock. */ -extern void (*releasePage)(Page * p); +void releasePage(Page *p); + +/** + This is the function pointer that bufInit sets in order to + override releasePage. +*/ +extern void (*releasePageImpl)(Page * p); /** * initialize buffer manager * @return 0 on success