// IfsLeafVMem.decl - Leaf VMem - Declarations
// Copyright Xerox Corporation 1979, 1980

// Last modified by Wobber, November 21, 1980  1:14 PM

get "IfsVmem.decl"

manifest
[
leafVMemPages = 40; lastLeafPage = leafVMemPages-1; lenLeafHashTable = 256;
logVPagesPerLeafPage = 2; leafPageGroupSize = logVPagesPerLeafPage;
logLenLeafHashTable = 8; probeMask = #377;
firstFreePage = 128; freePageMask = 128; maxFreePageCount = 128; noFree = 0;
]

//---------------------------------------------------------------------------
structure LeafPage:
//---------------------------------------------------------------------------
[
address word  // N.B. LeafLock assumes address is first word
lvmd word; page word;
flagByte byte =
[
dirty bit 1; blank bit 1; dontRead bit 1;
flushLock bit 5 = [ writing bit 1; locked bit 1; readRefs bit 3; ]
]
probe byte;
]
manifest lenLeafPage = size LeafPage/16;
manifest logLenLeafPage = 2;


//---------------------------------------------------------------------------
structure LeafVMI:
//---------------------------------------------------------------------------
[
vmi @VMI
vmd @VMD
lvmdQueue: [ head word; tail word; ]
lastFreeProbe word  // next entry index to use is passed back here by LeafHash
hashTable↑0,lenLeafHashTable-1 byte
freePage word;
freePageCount word
fullProbes word 2
freeProbes word 2
pages↑0,leafVMemPages @LeafPage  // waste the 0 entry
]
manifest lenLeafVMI = size LeafVMI/16;

//---------------------------------------------------------------------------
structure LeafILD:
//---------------------------------------------------------------------------
[
@ILD;
blank word (2*256 - size ILD/16); // Position fmap on 2nd half of leader page.
fmapWritten @TIME
fmapChecksum word;
fmapLast word;
fmapFP @FP;
fmapSeal word;
fmap↑0,0 word
]
manifest lenLeafFMap = 32; manifest leafFMapDelta = 32;  // must be even
manifest maxLenOldFMap = (3*256 - offset LeafILD.fmap/16);