changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > ventivac / changeset: change occurrances of "rabin" to "varblocks", since the idea is not specific to rabin fingerprinting, but to having variable-sized blocks.

changeset 96: 6830611f5d66
parent 95: 12540c444626
child 97: 1fef0e1807d4
author: Mechiel Lukkien <mechiel@ueber.net>
date: Mon, 06 Aug 2007 16:42:22 +0200
files: appl/lib/vac.b module/vac.m
description: change occurrances of "rabin" to "varblocks", since the idea is not specific to rabin fingerprinting, but to having variable-sized blocks.
     1.1--- a/appl/lib/vac.b	Mon Aug 06 14:45:16 2007 +0200
     1.2+++ b/appl/lib/vac.b	Mon Aug 06 16:42:22 2007 +0200
     1.3@@ -22,7 +22,6 @@
     1.4 
     1.5 Rootnamelen:	con 128;
     1.6 Rootversion:	con 2;
     1.7-Rootversionrabin:	con 3;
     1.8 Maxstringsize: con 1000;
     1.9 
    1.10 blankroot: Root;
    1.11@@ -131,7 +130,7 @@
    1.12 	}
    1.13 	r := ref blankroot;
    1.14 	r.version = g16(d, 0);
    1.15-	if(r.version != Rootversion && r.version != Rootversionrabin){
    1.16+	if(r.version != Rootversion && r.version != Rootversionvar){
    1.17 		sys->werrstr("unknown root version");
    1.18 		return nil;
    1.19 	}
    1.20@@ -198,8 +197,8 @@
    1.21 	i += Scoresize;
    1.22 	if((e.flags & Entryactive) == 0)
    1.23 		return e;
    1.24-	rabin := e.flags&Entryvarblocks;
    1.25-	if(!checksize(e.psize) || (rabin && e.dsize != 0 || !rabin && !checksize(e.dsize))){
    1.26+	varblocks := e.flags&Entryvarblocks;
    1.27+	if(!checksize(e.psize) || (varblocks && e.dsize != 0 || !varblocks && !checksize(e.dsize))){
    1.28 		sys->werrstr(sys->sprint("bad blocksize (%d or %d)", e.psize, e.dsize));
    1.29 		return nil;
    1.30 	}
    1.31@@ -412,11 +411,11 @@
    1.32 }
    1.33 
    1.34 
    1.35-Page.new(dsize: int, rabin: int): ref Page
    1.36+Page.new(dsize: int, varblocks: int): ref Page
    1.37 {
    1.38 	esize := Scoresize;
    1.39 	treesize := big 0;
    1.40-	if(rabin)
    1.41+	if(varblocks)
    1.42 		esize += BIT64SZ;
    1.43 	else
    1.44 		treesize = ~big 0;
    1.45@@ -456,11 +455,11 @@
    1.46 }
    1.47 
    1.48 
    1.49-File.new(s: ref Session, dtype, dsize, rabin: int): ref File
    1.50+File.new(s: ref Session, dtype, dsize, varblocks: int): ref File
    1.51 {
    1.52 	p := array[1] of ref Page;
    1.53-	p[0] = Page.new(dsize, rabin);
    1.54-	return ref File(p, dtype, dsize, big 0, s, rabin);
    1.55+	p[0] = Page.new(dsize, varblocks);
    1.56+	return ref File(p, dtype, dsize, big 0, s, varblocks);
    1.57 }
    1.58 
    1.59 fflush(f: ref File, last: int): (int, ref Entry)
    1.60@@ -473,7 +472,7 @@
    1.61 			flags |= i<<Entrydepthshift;
    1.62 			if(f.dtype & Dirtype)
    1.63 				flags |= Entrydir;
    1.64-			if(f.rabin)
    1.65+			if(f.varblocks)
    1.66 				flags |= Entryvarblocks;
    1.67 			d := f.p[i].data();
    1.68 			if(len d == 0)
    1.69@@ -481,22 +480,22 @@
    1.70 			d = d[:Scoresize];
    1.71 			score := Score(d);
    1.72 			dsize := f.dsize;
    1.73-			if(f.rabin)
    1.74+			if(f.varblocks)
    1.75 				dsize = 0;
    1.76 			return (0, Entry.new(len f.p[i].d, dsize, flags, f.size, score));
    1.77 		}
    1.78 		t := Pointertype0+i;
    1.79-		if(f.rabin)
    1.80+		if(f.varblocks)
    1.81 			t |= Pointervarmask;
    1.82 		(ok, score) := vwrite(f.s, t, f.p[i].data());
    1.83 		if(ok < 0)
    1.84 			return (-1, nil);
    1.85 		treesize := f.p[i].treesize;
    1.86-		f.p[i] = Page.new(f.dsize, f.rabin);
    1.87+		f.p[i] = Page.new(f.dsize, f.varblocks);
    1.88 		if(i+1 == len f.p) {
    1.89 			newp := array[len f.p+1] of ref Page;
    1.90 			newp[:] = f.p;
    1.91-			newp[len newp-1] = Page.new(f.dsize, f.rabin);
    1.92+			newp[len newp-1] = Page.new(f.dsize, f.varblocks);
    1.93 			f.p = newp;
    1.94 		}
    1.95 		f.p[i+1].add(score, treesize);
    1.96@@ -531,33 +530,33 @@
    1.97 	return e;
    1.98 }
    1.99 
   1.100-File.mkstate(session: ref Venti->Session, e: ref Entry, rabin: int): ref File
   1.101+File.mkstate(session: ref Venti->Session, e: ref Entry, varblocks: int): ref File
   1.102 {
   1.103 	s := e.score;
   1.104 	dsize := e.dsize;
   1.105 	if(dsize == 0)
   1.106 		dsize = Dsize;	# xxx not clean
   1.107 	if(e.depth == 0) {
   1.108-		p := Page.new(dsize, rabin);
   1.109-		return ref File(array[1] of {p}, Datatype, dsize, big 0, session, rabin);
   1.110+		p := Page.new(dsize, varblocks);
   1.111+		return ref File(array[1] of {p}, Datatype, dsize, big 0, session, varblocks);
   1.112 	}
   1.113-	f := ref File(array[e.depth] of ref Page, Datatype, dsize, big 0, session, rabin);
   1.114+	f := ref File(array[e.depth] of ref Page, Datatype, dsize, big 0, session, varblocks);
   1.115 say(sprint("mkstate, depth=%d", e.depth));
   1.116 	for(i := 0; i < e.depth; i++) {
   1.117 say(sprint("mkstate: reading score=%s", e.score.text()));
   1.118 		t := Pointertype0+e.depth-1-i;
   1.119-		if(f.rabin)
   1.120+		if(f.varblocks)
   1.121 			t |= Pointervarmask;
   1.122 		d := vread(session, s, t, Venti->Maxlumpsize);
   1.123 		if(d == nil)
   1.124 			return nil;
   1.125-		p := Page.new(dsize, rabin);
   1.126+		p := Page.new(dsize, varblocks);
   1.127 		p.d[:] = d;
   1.128 		p.o = len d-p.esize;
   1.129 		s = Score(p.d[p.o:p.o+Scoresize]);
   1.130 		f.p[i] = p;
   1.131 	}
   1.132-	if(rabin) {
   1.133+	if(varblocks) {
   1.134 		lp := f.p[len f.p-1];
   1.135 		bsize := g64(lp.d, lp.o+Scoresize);
   1.136 		f.size = e.size-bsize;
     2.1--- a/module/vac.m	Mon Aug 06 14:45:16 2007 +0200
     2.2+++ b/module/vac.m	Mon Aug 06 16:42:22 2007 +0200
     2.3@@ -110,7 +110,7 @@
     2.4 		esize:	int;
     2.5 		treesize:	big;
     2.6 
     2.7-		new:	fn(dsize: int, rabin: int): ref Page;
     2.8+		new:	fn(dsize: int, varblocks: int): ref Page;
     2.9 		npointers:	fn(p: self ref Page): int;
    2.10 		add:	fn(p: self ref Page, s: Venti->Score, size: big);
    2.11 		full:	fn(p: self ref Page): int;
    2.12@@ -123,12 +123,12 @@
    2.13 		dtype, dsize:	int;
    2.14 		size:	big;
    2.15 		s:	ref Venti->Session;
    2.16-		rabin:	int;
    2.17+		varblocks:	int;
    2.18 
    2.19-		new:	fn(s: ref Venti->Session, dtype, dsize, rabin: int): ref File;
    2.20+		new:	fn(s: ref Venti->Session, dtype, dsize, varblocks: int): ref File;
    2.21 		write:	fn(f: self ref File, d: array of byte): int;
    2.22 		finish:	fn(f: self ref File): ref Entry;
    2.23-		mkstate:	fn(session: ref Venti->Session, e: ref Entry, rabin: int): ref File;
    2.24+		mkstate:	fn(session: ref Venti->Session, e: ref Entry, varblocks: int): ref File;
    2.25 	};
    2.26 
    2.27 	# for writing venti directories (entries)