From 46439007cf417cbd9ac8049bb4122c890097a0fa Mon Sep 17 00:00:00 2001 From: "Charles.Forsyth" Date: Fri, 22 Dec 2006 20:52:35 +0000 Subject: 20060303-partial --- module/diskblocks.m | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 module/diskblocks.m (limited to 'module/diskblocks.m') diff --git a/module/diskblocks.m b/module/diskblocks.m new file mode 100644 index 00000000..44af5b22 --- /dev/null +++ b/module/diskblocks.m @@ -0,0 +1,26 @@ +Diskblocks: module { + PATH: con "/dis/lib/diskblocks.dis"; + + Block: adt { + addr: big; # address on file + n: int; # size in bytes + }; + + Disk: adt { + fd: ref Sys->FD; + addr: big; # length of temp file + free: array of list of ref Block; + maxblock: int; + gran: int; + lock: chan of int; + + 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; +}; -- cgit v1.2.3