UnixDirEnt.mesa
Copyright Ó 1988, 1991 by Xerox Corporation. All rights reserved.
CHauser, November 10, 1988 5:17:19 pm PST
Demers, November 10, 1988 5:17:21 pm PST
Carl Hauser, November 10, 1988 5:37:18 pm PST
Directory structures from <sys/dirent.h>.
DIRECTORY
UnixTypes
;
UnixDirEnt: CEDAR DEFINITIONS
~ {
Filesystem-independent directory information. Directory entry structures are of variable length. Each directory entry is a struct dirent containing its file number, the offset of the next entry (a cookie interpretable only the filesystem type that generated it), the length of the entry, and the length of the name contained in the entry. These are followed by the name. The entire entry is padded with null bytes to a 4 byte boundary. All names are guaranteed null terminated. The maximum length of a name in a directory is MAXNAMLEN, plus a null byte.
DirEnt: TYPE ~ WORD16 MACHINE DEPENDENT RECORD [
offset(0): UnixTypes.Offset,
fileNo(2): CARD32,
recLen(4): CARD16,
nameLen(5): CARD16,
name(6): PACKED SEQUENCE COMPUTED CARD OF CHAR
];
MaxNameLen: CARD ~ 255;
DirSiz: PROC [dp: POINTER TO DirEnt] RETURNS [INT] ~ TRUSTED INLINE {
roundSize: CARD ¬ SIZE[DirEnt] + dp.nameLen+3;
RETURN [roundSize - (roundSize MOD 4)];
};
}.