diff options
| author | rsc <devnull@localhost> | 2003-11-23 17:54:58 +0000 |
|---|---|---|
| committer | rsc <devnull@localhost> | 2003-11-23 17:54:58 +0000 |
| commit | 7a4ee46d253e291044bba2d0c54b818b67ac013c (patch) | |
| tree | 7bdcaf69a15ecd24c057a697936b67bbde93e00b /src/cmd/venti/whack.h | |
| parent | 4fbfdd7acd4bf4fc71b1329230e05fc761907566 (diff) | |
| download | plan9port-7a4ee46d253e291044bba2d0c54b818b67ac013c.tar.gz plan9port-7a4ee46d253e291044bba2d0c54b818b67ac013c.zip | |
Initial stab at Venti.
Diffstat (limited to 'src/cmd/venti/whack.h')
| -rw-r--r-- | src/cmd/venti/whack.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/cmd/venti/whack.h b/src/cmd/venti/whack.h new file mode 100644 index 00000000..fb966169 --- /dev/null +++ b/src/cmd/venti/whack.h @@ -0,0 +1,40 @@ +typedef struct Whack Whack; +typedef struct Unwhack Unwhack; + +enum +{ + WhackStats = 8, + WhackErrLen = 64, /* max length of error message from thwack or unthwack */ + WhackMaxOff = 16*1024, /* max allowed offset */ + + HashLog = 14, + HashSize = 1<<HashLog, + HashMask = HashSize - 1, + + MinMatch = 3, /* shortest match possible */ + + MinDecode = 8, /* minimum bits to decode a match or lit; >= 8 */ + + MaxSeqMask = 8, /* number of bits in coding block mask */ + MaxSeqStart = 256 /* max offset of initial coding block */ +}; + +struct Whack +{ + ushort begin; /* time of first byte in hash */ + ushort hash[HashSize]; + ushort next[WhackMaxOff]; + uchar *data; +}; + +struct Unwhack +{ + char err[WhackErrLen]; +}; + +void whackinit(Whack*, int level); +void unwhackinit(Unwhack*); +int whack(Whack*, uchar *dst, uchar *src, int nsrc, ulong stats[WhackStats]); +int unwhack(Unwhack*, uchar *dst, int ndst, uchar *src, int nsrc); + +int whackblock(uchar *dst, uchar *src, int ssize); |
