-- DirectoryInternal.mesa (last edited by: Keith on: October 8, 1980 11:06 PM) DIRECTORY Directory USING [maxDirectoryNameLength, maxPathNameLength], Environment USING [wordsPerPage], File USING [Capability, nullCapability], Space USING [Handle, PageCount]; DirectoryInternal: DEFINITIONS = -- this interface defines the global data types used by the directory system BEGIN -- Monitor/Module Control DirectoryLock: MONITORLOCK; swapUnitSize: Space.PageCount = 1; -- size of uniform swap units assigned by directory -- Directory B-Tree definitions DirectoryPageHandle: TYPE = LONG BASE POINTER TO DirectoryPage; PagePointer: TYPE = DirectoryPageHandle RELATIVE POINTER [0..65535] TO DirectoryPage; nilPagePointer: PagePointer = LAST[PagePointer]; DirectoryEntryHandle: TYPE = LONG POINTER TO DirectoryEntry; DirectoryEntry: TYPE = MACHINE DEPENDENT RECORD [ cap: File.Capability, pointer: PagePointer, name: StringBody _ [length: 0, maxlength: Directory.maxDirectoryNameLength, text:]]; DirectoryPage: TYPE = MACHINE DEPENDENT RECORD [ size(0:0..8): [0.. 256], -- number of words used in this page free(0:9.. 9): BOOLEAN, -- TRUE if page is not in use filler(0: 10.. 15): [0.. 64), -- used for B-Tree validation top(1:0..15): PagePointer, -- if this is the first page, this field points to the root parent(2:0..15): PagePointer, -- the parent of this page lastPointer(3:0..15): PagePointer, -- the last pointer in this page entries(emptySize:0..(Environment.wordsPerPage-emptySize)*16 - 1): ARRAY [0..Environment.wordsPerPage-emptySize) OF UNSPECIFIED -- the entries ]; emptySize: CARDINAL = 4; -- the size of an empty page overhead: CARDINAL = SIZE[File.Capability] + SIZE[PagePointer]; DirectoryDescriptor: TYPE = RECORD [ base: DirectoryPageHandle _ NIL, top: PagePointer _ nilPagePointer, size: CARDINAL, -- in pages space: Space.Handle]; -- Directory Tree Definitions -- The directory tree (or D-Tree) is a multiway tree which is used to store the subdirectory structure of -- a volume. This way, we don't have to open up a bunch of directories in order to translate a path -- name. The format of the tree is: -- Node 0 (top): level -1. Son pointer points to RootDir, bro pointer to free node list. Capability -- is capability of the directory tree file (with full permissions). Name is empty. -- Node 1, level 0. RootDir. Bro pointer points to self, son pointer to first son. -- Subsequent nodes. Son pointer points to first son, bro to sibling. If no son, son pointer points to self. -- If no sibling, bro pointer points to parent. PDT: TYPE = LONG BASE POINTER TO DTNode; PDTNode: TYPE = PDT RELATIVE POINTER [0.. 65535] TO DTNode; pDTnil: PDTNode = LAST[PDTNode]; DTNode: TYPE = RECORD [ name: StringBody _ [length: 0, maxlength: Directory.maxDirectoryNameLength, text: ], array: PACKED ARRAY [0.. Directory.maxDirectoryNameLength) OF CHARACTER _ ALL [' ], cap: File.Capability _ File.nullCapability, son: PDTNode _ pDTnil, bro: PDTNode _ pDTnil, level: CARDINAL _ 0]; -- Directory Contexts Definitions Context: TYPE = RECORD [ wdName: StringBody _ [length: 0, maxlength: Directory.maxPathNameLength, text:], array: PACKED ARRAY [0.. Directory.maxPathNameLength) OF CHARACTER _ ALL [' ], pDC: CARDINAL _ 0, valid: BOOLEAN _ FALSE, pSP: LONG POINTER TO SPRecord _ NIL]; SPRecord: TYPE = RECORD [ spName: StringBody _ [length: 0, maxlength: Directory.maxPathNameLength, text:], array: PACKED ARRAY [0.. Directory.maxPathNameLength) OF CHARACTER _ ALL[' ], pSP: LONG POINTER TO SPRecord _ NIL, pDC: CARDINAL _ 0, -- the SP element directory defined: BOOLEAN _ FALSE, v: SELECT type: * FROM noWD => NULL, withWD => [ cap: File.Capability _ File.nullCapability, -- what we think the WD cap is pWD: LONG POINTER TO Context -- the qualifying working Directory-- ], ENDCASE ]; -- Directory Leader Page Constants and others leaderPageSize: CARDINAL = 1; leaderPageOffset: CARDINAL = 64; -- word in leader page at which the Directory Prop List starts initDirSize: Space.PageCount = 16; -- initial size of a directory initDTSize: Space.PageCount = 16; -- initial size of a directory tree file directoryIncrement: CARDINAL = 10; -- number of pages the directories and D-Trees will grow maxDirSize: CARDINAL = 256 - leaderPageSize; -- number of data pages in directory/D-Tree -- note that the module DirectoryTreesImpl makes the assumption that -- maxDirSize = n * directoryIncrement + initDirSize (or initDTSize) for some integer n. END. LOG Time: August 21, 1980 10:52 AM By: Keith Action: Created File(1792)\4b17B6i53I226i73I15bi22BI72i50I9bi28BI559i33I28i5I4i22I38i28I36i56I39i23I43i29I142i11I41i25I207i9I35bi26BI5i299I7i134I7i18I10i219I498bi30BI6b7B907bi31BI1bi10BI70i65I41i27I40i38I36i59I47i211I13i Time: October 6, 1980 5:34 PM By: Keith Action: Changed WD length in Context to maxPathNameLength. Added documentation (!).\i71b7B