include "diskblocks.m";
diskblocks := load Diskblocks Diskblocks->PATH;
Block: adt {
addr: big; # address on file
n: int; # size in bytes
};
Disk: adt {
init: fn(fd: ref Sys->FD, gran: int, maxblock: int): ref Disk;
new: fn(d: self ref Disk, n: int): ref Block;
release: fn(d: self ref Disk, b: ref Block);
read: fn(d: self ref Disk, b: ref Block,
a: array of byte, n: int): int;
write: fn(d: self ref Disk, b: ref Block,
a: array of byte, n: int): ref Block;
};
init: fn();
tempfile: fn(): ref Sys->FD;
Init must be called before any other function in the module.
Each block has an address and a size in bytes, represented by a value of type Block.
Each file is represented by the type Disk, providing the following operations:
Tempfile returns a file descriptor referring to a newly-created temporary file, suitable for use by Disk.init. The file will be removed automatically when the file descriptor is closed.
| DISKBLOCKS(2 ) | Rev: Thu Feb 15 14:43:27 GMT 2007 |