AccessFloppy.mesa
Copyright Ó 1986 by Xerox Corporation. All rights reserved.
Last edited by CKabcenell on 16-Aug-82 17:26:37
Tim Diebert: December 16, 1986 12:54:13 pm PST
This interface is used for copying files between a file system on a rigid disk and floppies. In the interface description, the file on the rigid disk will be refered to as a disk file and a file on a floppy will be refered to as a floppy file.
DIRECTORY
BasicTime USING [GMT, nullGMT],
CommonSoftwareFileTypes USING [tCarryVolumeDirectory],
File USING [Type],
Floppy USING [FileHandle, PageCount, PageNumber, VolumeHandle],
NSString USING [String],
PrincOps USING [wordsPerPage];
AccessFloppy: CEDAR DEFINITIONS = BEGIN
Attributes: TYPE = REF AttributesRecord;
AttributesRecord: TYPE = MACHINE DEPENDENT RECORD[ -- used by directory or leader page.
identity attributes
seal: WORD ← sealValue, -- used to check consistency of a file.
version: CARDINAL, -- version of attributes record type.
type: --File.Type, -- CARD, -- file type of containing file.
activity attributes
createDate: Time, -- the creation data of the disk file.
lastWrittenDate: Time, -- the date the disk file was last modified prior to copying to the floppy.
file attributes
size: Floppy.PageCount ← 0, -- number of pages in the floppy file not including the leader page.
offset: Floppy.PageNumber ← 0, -- page number in the disk file correspoinding to the first page in the floppy file piece.
totalSize: Floppy.PageCount ← 0, -- number of pages in the disk file.
totalSizeInBytes: LengthInBytes ← 0, -- the number of bytes in the disk file
name attributes
length: CARDINAL ← 0,
maxLength: CARDINAL ← maxNameLength, -- so that @length is STRING.
name: PACKED ARRAY [0..maxNameLength) OF BYTE,
client attributes
clientDataLength: CARDINAL ← 0 ,-- number of component in client's private data.
clientData: SEQUENCE maxlength: CARDINAL OF UNSPECIFIED
];
LengthInBytes: TYPE = LONG CARDINAL;
Time: TYPE = BasicTime.GMT;
tFloppyLeaderPage: File.Type = CommonSoftwareFileTypes.tCarryVolumeDirectory;
Constants
currentVersion: CARDINAL = 1; -- update each time leader format changes
leaderLength: CARDINAL = 1;
leaderLength*Environment.wordsPerPage must be greater than SIZE[AttributesRecord]
maxDataSize: CARDINAL = leaderLength*PrincOps.wordsPerPage - SIZE[AttributesRecord];
maxNameLength: CARDINAL = 100;
includes words field.
nullTime: Time = BasicTime.nullGMT;
sealValue: WORD = 125252B; -- 1010101010101010 bits pattern
Volume operations
Open: PROCEDURE RETURNS[Floppy.VolumeHandle];
Close: PROCEDURE;
File operations
CreateFile: PROCEDURE [attributes: Attributes] RETURNS [Floppy.FileHandle];
Create a floppy file with the specified size and write information onto the leader page.
DeleteFile: PROCEDURE [name: NSString.String];
LookUp: PROCEDURE [name: NSString.String, attributes: Attributes] RETURNS [Floppy.FileHandle];
name is used as search key; The attributes of the found floppy file will be filled.
Attribute Operations
GetAttributes: PROCEDURE [file: Floppy.FileHandle, attributes: Attributes];
SetAttributes: PROCEDURE [file: Floppy.FileHandle, attributes: Attributes];
Signals and errors
Error: ERROR[type: ErrorType];
ErrorType: TYPE = {attributesNotAllowed, fileNotFound, invalidParameter, nameInUse, volumeNotOpen};
InconsistentFile: SIGNAL [file: Floppy.FileHandle];
InvalidVersion: SIGNAL [file: Floppy.FileHandle, version: CARDINAL];
NoRoomForClientData: ERROR [wordsNeeded: CARDINAL];
Raised by GetAttributes, cannot be RESUMEd.
END. -- AccessFloppy.
LOG
14-Jan-82 14:47:06 By Muntz: created file.
28-Jan-82 11:41:35 By Muntz: remove procedures to retrieve and store file on the floppy.
9-Feb-82 9:37:00 By Muntz: cleaned up and added comments.
12-Feb-82 10:40:05 By Muntz: Added NoRoomForClientData ERROR.
16-Aug-82 17:26:19 By CKabcenell: Converted to Filing 5.0.