// IFSDirs.decl -- declarations for IFS directory operations
// Copyright Xerox Corporation 1979, 1981, 1982
// Last modified May 11, 1982 6:12 PM by Taft
//---------------------------------------------------------------------------
structure LC: // Lookup Control word
//---------------------------------------------------------------------------
[
create bit // allowed to create new file
multiple bit // allowed to designate multiple files with "*"
blank bit 6
vc byte // version control specification
]
manifest
[
// lookup control word (parallel to structure LC)
lcCreate = 100000b // allowed to create new file
lcMultiple = 40000b // "*" allowed in filename template
// version control specifications
lcVHighest = 1 // highest existing version
lcVNext = 2 // highest existing version +1
lcVLowest = 3 // lowest existing version
lcVExplicit = 4 // explicit version (internal use only)
lcVAll = 5 // all versions (equivalent to "!*")
// OpenFile modes
modeRead = 1
modeWrite = 2
modeReadWrite = 3
modeAppend = 4
modeReadWriteShared = 5
// LookupStatus definitions
lsNoLookup = 0 // no lookup has been done yet
lsNonexistent = 1 // no such file exists
lsOtherVersion = 2 // this version doesn't exist but another one does
lsExists = 3 // this file already exists
// lockMode argument to LookupFD -- order is important (see LookupFD)
lockNone = 0 // leave directory unlocked upon return (default)
lockAlready = 1 // caller has already locked the directory; leave it
// that way upon return
lockRead = 2 // leave directory read-locked upon return
lockWrite = 3 // leave directory write-locked upon return
]
//---------------------------------------------------------------------------
structure FD: // File Descriptor (for lookup and open files)
//---------------------------------------------------------------------------
[
fs word // -> file system in which file exists
lc @LC // lookup control specification
lookupStatus byte // lookup status (result of LookupFD)
mode byte // mode in which file is open
dirVersion word // directory version for which lookupStatus is valid
oldPageNumber word // page number of last existing page
lenDirString byte // number of chars in "
" portion of dr
lenSubDirString byte // number of chars in "subdir>...subdir>" portion
lenBodyString byte // number of chars in "name!" portion
iFirstStar byte // index of first "*" in template (if any)
version word // parsed version number
dr word // -> directory record for file
template word // -> KPM template (multi-file designator), if nonzero
pathStk word // -> BTree PathStk from previous lookup, if nonzero;
// invariant: if pathStk is present then it is the
// result of doing a B-Tree lookup on this FD.
]
manifest lenFD = size FD/16
compileif offset FD.lenBodyString/16 ne 6 % offset FD.version/16 ne 7 %
offset FD.dr/16 ne 8 then
[ Barf("FD structure disagrees with assumptions in IfsDirKey.asm") ]
manifest
[
// Error codes for IFSError
ecLookupImpossibleCase = 100
ecOFTFull = 101
ecOFTUnlockError = 102
ecReturnFromReturned = 103
ecUndefinedOpenMode = 104
ecIllegalExistingName = 105
ecNotDIFRec = 106
ecDirEntryAlreadyExists = 107
ecCantDeleteDirEntry = 108
ecFileNotDIF = 109
ecCantFindDIF = 110
ecCantTFSNewDisk = 111
ecCantFindIFSDir = 112
ecCantEnterSystemFile = 113
ecCantDestroyOFT = 114
ecCreateEssentialFile = 115
ecIllegalLookupControl = 116
ecInvalidFD = 117
ecMalformedDIF = 118
ecDirNotLocked = 119
ecBadDR = 120
ecCantTFSInit = 121
ecNotOnLine = 122
// Error codes returned by IFS directory operations.
// Should be in a group for efficient dispatch.
ecNameMalformed = 201 // illegal filename
ecIllegalChar = 202 // illegal character in filename
ecIllegalStar = 203 // illegal use of "*"
ecIllegalVersion = 204 // illegal version number
ecNameTooLong = 205
ecIllegalDIFAccess = 206 // not allowed to access DIF
ecFileNotFound = 207
ecAccessDenied = 208 // file protected
ecFileBusy = 209 // already open in conflicting way
ecDirNotFound = 210 // no such directory
ecAllocExceeded = 211 // allocation exceeded
ecFileSystemFull = 212
ecVMemFull = ecFileSystemFull
ecCreateStreamFailed = 213 // probably disk error in file
ecFileAlreadyExists = 214 // rename "to" file already exists
ecFileUndeletable = 215
ecUserName = 216 // failures from login/connect
ecUserPassword = 217
ecFilesOnly = 218
ecConnectName = 219
ecConnectPassword = 220
ecUnknownUserName = 221 // I never heard of that user name, and
// Grapevine is unresponsive
ecDiskError = 222
ecNamePasswordRequired = 223
]