blob: 17897fd0447d0cf64d7a442f4048f0d9cc96029d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
Dbm: module
{
PATH: con "/dis/lib/dbm.dis";
Datum: type array of byte;
Dbf: adt {
create: fn(file: string, perm: int): ref Dbf;
open: fn(file: string, flags: int): ref Dbf;
fetch: fn(db: self ref Dbf, key: Datum): Datum;
delete: fn(db: self ref Dbf, key: Datum): int;
store: fn(db: self ref Dbf, key: Datum, dat: Datum, replace: int): int;
firstkey: fn(db: self ref Dbf): Datum;
nextkey: fn(db: self ref Dbf, key: Datum): Datum;
flush: fn(db: self ref Dbf);
isrdonly: fn(db: self ref Dbf): int;
dirf: ref Sys->FD; # directory
pagf: ref Sys->FD; # page
flags: int;
maxbno: int; # last `bno' in page file
bitno: int;
hmask: int;
blkno: int; # current page to read/write
pagbno: int; # current page in pagbuf
pagbuf: array of byte; # [PBLKSIZ]
dirbno: int; # current block in dirbuf
dirbuf: array of byte; # [DBLKSIZ]
};
init: fn();
};
|