Types
FileDescriptor: TYPE ~ REF;
FType: TYPE ~ SunNFS.FType -- { non(0), reg(1), dir(2), blk(3), chr(4), lnk(5) } -- ;
GMT: TYPE ~ BasicTime.GMT;
Mode: TYPE ~ CARD32 -- rwxrwxrwx, suid, sgid -- ;
ROPE: TYPE ~ Rope.ROPE;
ServerHandle: TYPE ~ RemoteFile.ServerHandle;
STREAM: TYPE ~ IO.STREAM;
Operations
Open:
PROC [h: Handle, path:
ROPE]
RETURNS [fD: FileDescriptor] ~
INLINE {
RETURN [h.procs.open[h.sH, path]] };
Open an existing file.
OpenProc: TYPE ~ PROC [sH: ServerHandle, path: ROPE] RETURNS [fD: FileDescriptor];
Close:
PROC [h: Handle, fD: FileDescriptor] ~
INLINE { h.procs.close[h.sH, fD] };
Close the designated file.
CloseProc: TYPE ~ PROC [sH: ServerHandle, fD: FileDescriptor];
Create:
PROC [h: Handle, path:
ROPE, mode: Mode]
RETURNS [fD: FileDescriptor] ~
INLINE {
RETURN [h.procs.create[h.sH, path, mode]] };
Create an empty file of the given name, smashing any existing one. The mode is the protection mode assigned to the new file.
CreateProc: TYPE ~ PROC [sH: ServerHandle, path: ROPE, mode: Mode] RETURNS [fD: FileDescriptor];
Delete:
PROC [h: Handle, path:
ROPE] ~
INLINE { h.procs.delete[h.sH, path] };
Delete the named file.
DeleteProc: TYPE ~ PROC [sH: ServerHandle, path: ROPE];
MkDir:
PROC [h: Handle, path:
ROPE, mode: Mode] ~
INLINE { h.procs.mkDir[h.sH, path, mode] };
Create a directory.
MkDirProc: TYPE ~ PROC [sH: ServerHandle, path: ROPE, mode: Mode];
RmDir:
PROC [h: Handle, path:
ROPE] ~
INLINE { h.procs.rmDir[h.sH, path] };
Remove an empty directory.
RmDirProc: TYPE ~ PROC [sH: ServerHandle, path: ROPE];
Link:
PROC [h: Handle, toPath, asPath:
ROPE] ~
INLINE { h.procs.link[h.sH, toPath, asPath] };
Create a hard link to file toPath under the name asPath. Since the link is hard, toPath must designate an existing file on the same file system volume as asPath.
LinkProc: TYPE ~ PROC [sH: ServerHandle, toPath, asPath: ROPE];
SymLink:
PROC [h: Handle, toPath, asPath:
ROPE] ~
INLINE { h.procs.symLink[h.sH, toPath, asPath] };
Create a Symbolic link to file toPath under the name asPath. No check to see whether the file exists.
SymLinkProc: TYPE ~ PROC [sH: ServerHandle, toPath, asPath: ROPE];
Rename:
PROC [h: Handle, fromPath, toPath:
ROPE] ~
INLINE { h.procs.rename[h.sH, fromPath, toPath] };
Rename atomically. The fromPath and toPath must be on the same file system volume.
RenameProc: TYPE ~ PROC [sH: ServerHandle, fromPath, toPath: ROPE];
EachNameProc: TYPE ~ PROC [name: ROPE] RETURNS [continue: BOOL ← TRUE];
Enumerate:
PROC [h: Handle, dirPath:
ROPE, pattern:
ROPE, eachName: EachNameProc] ~
INLINE { h.procs.enumerate[h.sH, dirPath, pattern, eachName] };
Enumerate files in directory designated by dirPath with names matching pattern.
EnumerateProc: TYPE ~ PROC [sH: ServerHandle, dirPath: ROPE, pattern: ROPE, eachName: EachNameProc];
GetInfo:
PROC [h: Handle, fD: FileDescriptor]
RETURNS [type: FType, size:
CARD, mode: Mode, mTime:
GMT] ~
INLINE {
[type, size, mode, mTime] ← h.procs.getInfo[h.sH, fD] };
Lookup information on given file.
GetInfoProc: TYPE ~ PROC [sH: ServerHandle, fD: FileDescriptor]
RETURNS [type: FType, size: CARD, mode: Mode, mTime: GMT];
SetInfo:
PROC [h: Handle, fD: FileDescriptor, mode: Mode, mTime:
GMT] ~
INLINE { h.procs.setInfo[h.sH, fD, mode, mTime] };
Set (selected) information about given file. If mode is CARDINAL.LAST it will not be changed. If mTime is BasicTime.nullGMT it will not be changed.
SetInfoProc: TYPE ~ PROC [sH: ServerHandle, fD: FileDescriptor, mode: Mode, mTime: GMT];
Read:
PROC [h: Handle, fD: FileDescriptor, offset, count:
CARD, bOffset:
CARD, block:
REF
TEXT]
RETURNS [bytesRead:
CARD] ~
INLINE { bytesRead ← h.procs.read[h.sH, fD, offset, count, bOffset, block] };
Read specified bytes of file into block. Return number of bytes read, update block.length.
ReadProc: TYPE ~ PROC [sH: ServerHandle, fD: FileDescriptor, offset, count: CARD, bOffset: CARD, block: REF TEXT] RETURNS [bytesRead: CARD];
Write:
PROC [h: Handle, fD: FileDescriptor, offset, count:
CARD, bOffset:
CARD, block:
REF
TEXT]
RETURNS [bytesWritten:
CARD] ~
INLINE { bytesWritten ← h.procs.write[h.sH, fD, offset, count, bOffset, block] };
Write specified bytes of file from block. Return number of bytes written.
WriteProc: TYPE ~ PROC [sH: ServerHandle, fD: FileDescriptor, offset, count: CARD, bOffset: CARD, block: REF TEXT] RETURNS [bytesWritten: CARD];
}...