-- FilePageMgrPrivateChunk.mesa
-- Last edited by:
-- Kolling on January 31, 1984 2:13:05 pm PST


DIRECTORY

AlpineEnvironment
USING[PageCount,PageNumber, wordsPerPage],
File
USING[propertyWords],
FileMap
USING[Handle],
VM
USING[PageCount, PageNumber, wordsPerPage];


FilePageMgrPrivateChunk: CEDAR DEFINITIONS =

BEGIN


RefChunk: TYPE = REF Chunk;

Chunk: TYPE = RECORD[
chunkType: ChunkType,
defWritePending: BOOLEAN,
state: ChunkState,
useCount: NAT,
fileHandle: FileMap.Handle,
startFilePageNumber: AlpineEnvironment.PageNumber,
startVMPageNumber: VM.PageNumber,
prev: RefChunk,
next: RefChunk,
rbColor: BOOL,
rbLLink, rbRLink: RefChunk];

ChunkType: TYPE = {normal, log, leader, treeHeader, lruHeader, ostGeneral};
ClientChunkType: TYPE = FilePageMgrPrivateChunk.ChunkType[normal..leader];
ListChunkType: TYPE = FilePageMgrPrivateChunk.ChunkType[normal..leader];

ChunkState: TYPE = {undefined, valid, readInProgress, writeInProgress};

NLeaderVMPages
: VM.PageCount =
(File.propertyWords + VM.wordsPerPage - 1)/VM.wordsPerPage;
NLeaderFilePages
: AlpineEnvironment.PageCount =
(File.propertyWords + AlpineEnvironment.wordsPerPage -
1)/AlpineEnvironment.wordsPerPage;

ChunkVMPageCount
: ARRAY ListChunkType OF VM.PageCount =
[normal: 4, log: 4, leader: NLeaderVMPages];
ChunkFilePageCount
: ARRAY ListChunkType OF VM.PageCount =
[normal: 4, log: 4, leader: NLeaderFilePages]; -- note all of leader fits exactly in one chunk.

-- because not every place is right yet.
CompileTimeCheck1: [VM.wordsPerPage..VM.wordsPerPage] =
AlpineEnvironment.wordsPerPage;
-- because File promised an integral number of vm pages and page aligned(latter checked elsewhere).
CompileTimeCheck2
:
[NLeaderVMPages*VM.wordsPerPage..NLeaderVMPages*VM.wordsPerPage] =
File.propertyWords;

-- For information about the significance of the Chunk fields, see FilePageMgrPrivateFileObject.


ChunkAllocator: PROCEDURE [chunkType: ChunkType, permanent: BOOLEAN] RETURNS
[refChunk: RefChunk];
-- non system-fatal errors: running out of vm is system fatal.

ChunkIsDirty
: PROCEDURE[refChunk: RefChunk] RETURNS [dirty: BOOLEAN];
-- non system-fatal errors: none.

Sweeper
: PROCEDURE[chunkType: FilePageMgrPrivateChunk.ChunkType];
-- non system-fatal errors: none.


-- misc.:

InternalFilePageMgrLogicError: ERROR;



END.

Edit Log

Initial: Kolling: 22-Feb-82 16:18:32: a private defs file for the File Page Manager which sits between the rest of Alpine and Pilot.