diff options
| author | bhgv <bhgv.empire@gmail.com> | 2018-03-01 16:54:45 +0200 |
|---|---|---|
| committer | bhgv <bhgv.empire@gmail.com> | 2018-03-01 16:54:45 +0200 |
| commit | b786f20bbab5a59046aa78a2c6c2a11536497202 (patch) | |
| tree | 0851ecdec889eb9b7ba3751cc04d4f0b474e4a9e /module/dbm.m | |
inferno-os tree was separated from the inferno-os-android (separated from the Android driver)
Diffstat (limited to 'module/dbm.m')
| -rw-r--r-- | module/dbm.m | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/module/dbm.m b/module/dbm.m new file mode 100644 index 0000000..17897fd --- /dev/null +++ b/module/dbm.m @@ -0,0 +1,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(); +}; |
