<> <> <> DIRECTORY Basics USING [logBytesPerWord], Camelot USING [optrT, tidT], IO USING [STREAM], Mach USING [pointerT], YggDID USING [DID], YggDIDMap USING [RunList], YggInternal USING[FileHandle]; YggFile: CEDAR DEFINITIONS = BEGIN <> <> <<>> <> RC: TYPE = { -- extension of "Reason" for internal use. ok, inconsistent, -- the volume's (or file's) permanent data structures look inconsistent software, -- i.e. label-check. The page on disk is not the one the software expected. hardware, -- the disk hardware/microcode detected a hard disk error unknownFile, -- the file does not exist (possibly deleted since it was opened) unknownPage, -- the page would be beyond the end of the file volumeFull -- the volume has no free pages (and one is needed!) }; Reason: TYPE = RC[SUCC[ok]..LAST[RC]]; -- error reason Error: ERROR [why: Reason, diskPage: INT _ -1]; <> PageNumber: TYPE = RECORD[INT]; <> PageCount: TYPE = INT; <> Add: PROC[p: PageNumber, n: PageCount] RETURNS[PageNumber] = INLINE { RETURN[ [p+n] ] }; -- "n" may be negative -- <<>> bytesPerPage: NAT = 4096; logBytesPerPage: NAT = 12; wordsPerPage: NAT = bytesPerPage/BYTES[WORD]; logWordsPerPage: NAT = logBytesPerPage-Basics.logBytesPerWord; <> PagesForBytes: PROC [bytes: CARD] RETURNS [pages: PageCount]; BytesForPages: PROC [pages: PageCount] RETURNS [bytes: CARD]; PagesForWords: PROC [words: CARD] RETURNS [pages: PageCount]; WordsForPages: PROC [pages: PageCount] RETURNS [words: CARD]; FileHandle: TYPE = YggInternal.FileHandle; FileHandleRep: TYPE; <> <> Open: PROC [runList: YggDIDMap.RunList, did: YggDID.DID, fileUse: ATOM, verifyLeaderNow: BOOL _ FALSE] RETURNS [file: FileHandle]; <> Create: PROC [size: PageCount, did: YggDID.DID, fileUse: ATOM, nearToDid: YggDID.DID, tid: Camelot.tidT] RETURNS [FileHandle]; Delete: PROC [file: FileHandle, tid: Camelot.tidT]; <> Info: PROC [file: FileHandle, tid: Camelot.tidT] RETURNS [did: YggDID.DID, size: PageCount, runList: YggDIDMap.RunList]; SetSize: PROC [file: FileHandle, size: PageCount, tid: Camelot.tidT]; SetByteSize: PROC [file: FileHandle, byteSize: PageCount, tid: Camelot.tidT]; Locate: PROC [file: FileHandle, tid: Camelot.tidT, from: PageNumber, nPages: PageCount] RETURNS [runList: YggDIDMap.RunList]; <> <<>> <> <> FileFromComponentFiles: PROC [componentFiles: LIST OF YggInternal.FileHandle, fileUse: ATOM] RETURNS [file: YggInternal.FileHandle]; <