home *** CD-ROM | disk | FTP | other *** search
- /*
- cPLog.h - Emerald checkPoint log file manager
-
- Copyright 1987,1988 Clinton Jeffery
- Last edit: 4/28/88
-
- *** PRIMITIVES ***
-
- CP_StartRecover() Start the recovery process (prepare for reads)
- CP_Recover() Read and reconstruct a log file entry
- CP_EndRecover() End the recovery procss (prepare for writes)
-
- *** IMITATION LARGE MESSAGE SEND ***
- CP_StartEntry() Start a new (appending) log file entry
- CP_PutData() Put some data (appending) into the log file entry
- CP_EndEntry() Complete the current log file entry (and flush)
-
- * Side effects
- Space is allocated to hold the input data by CP_Recover
- If the module is compiled with -DCPNEWLOG, it generates a new
- (garbage-collected) login file with each kernel startup. For this
- reason, CP_StartEntry AND CP_ReadEntry return the offset k at which
- the object is located (in the new log file).
-
- Revision history:
- 4/28/88 cjeffery : Mods to use replicants as the standard logfile unit
- */
-
- /* here are some read-only variables; they are defined for macros */
- extern FILE *LF;
-
- extern long CP_StartEntry();
-
- #define CP_GetData(x,y,n) replicant_read((x),(y),(n))
- #define CP_PutData(data,n) replicant_write(CP_replicant,(char *)(data),(n))
- #define CP_Seek(rp,offset,fromwhere) replicant_seek((replicantPtr)(rp),(offset),(fromwhere))
- #define CP_EndEntry(f) replicant_diskwrite(CP_replicant,(f))
- #define CP_CurrentPosition (CP_replicant->ptr)
-
- /*
- CP_InitRecover opens the log file specified for reading/writing.
- -DCPNEWLOG causes it to also open strcat(name,".cpnewlog") for writing.
- EndRecover seeks to the end of the log file; -DCPNEWLOG causes it
- to instead close both files, delete the old log file, and rename and
- reopen the new log file to the old name.
- */
-
- extern CP_InitRecover();
- extern CP_EndRecover();
- extern CP_Recover();
-
- #define FAIL(s) { \
- KMDTrace("Checkpoint", 3, s); \
- return -1; \
- }
-
- #define SUCCEED return 1
-