changelog shortlog tags branches files raw gz bz2 help

Mercurial > hg > ventivac / changeset: print commands to descent the hash tree (only for the root block and for entries, not for the pointer blocks).

changeset 79: 81eaee4f0f64
parent 78: 810e5315a6dc
child 80: fb2e789fd6bd
author: Mechiel Lukkien <mechiel@ueber.net>
date: Wed, 18 Jul 2007 14:53:15 +0200
files: appl/cmd/venti/parse.b
description: print commands to descent the hash tree (only for the root block and for entries, not for the pointer blocks).
     1.1--- a/appl/cmd/venti/parse.b	Wed Jul 18 13:49:37 2007 +0200
     1.2+++ b/appl/cmd/venti/parse.b	Wed Jul 18 14:53:15 2007 +0200
     1.3@@ -13,8 +13,8 @@
     1.4 vac: Vac;
     1.5 
     1.6 fprint, sprint, print, fildes: import sys;
     1.7-Score, Scoresize: import venti;
     1.8-Root, Entry, Direntry, Metablock, Metaentry, Entrysize, Metablocksize, Metaentrysize: import vac;
     1.9+Score, Scoresize, Dirtype, Datatype, Pointertype0: import venti;
    1.10+Pointervarmask, Root, Entry, Direntry, Metablock, Metaentry, Entrysize, Metablocksize, Metaentrysize, Entrydir: import vac;
    1.11 
    1.12 Ventiparse: module {
    1.13 	init:	fn(nil: ref Draw->Context, args: list of string);
    1.14@@ -101,6 +101,7 @@
    1.15 	print("\tscore=%s\n", r.score.text());
    1.16 	print("\tblocksize=%d\n", r.blocksize);
    1.17 	print("\tprev=%s\n", (*r.prev).text());
    1.18+	print("venti/read %d %s | venti/parse entries\n", Dirtype, r.score.text());
    1.19 }
    1.20 
    1.21 entry(d: array of byte)
    1.22@@ -129,6 +130,23 @@
    1.23 	print("\tdepth=%d\n", e.depth);
    1.24 	print("\tsize=%bd\n", e.size);
    1.25 	print("\tscore=%s\n", e.score.text());
    1.26+	if(e.depth > 0) {
    1.27+		which := "pointers";
    1.28+		dtype := Pointertype0+e.depth-1;
    1.29+		if(e.flags & Vac->Entryvarblocks) {
    1.30+			which = "rpointers";
    1.31+			dtype |= Pointervarmask;
    1.32+		}
    1.33+		print("venti/read %d %s | venti/parse %s\n", dtype, e.score.text(), which);
    1.34+	} else {
    1.35+		dtype := Datatype;
    1.36+		pipe := "";
    1.37+		if(e.flags & Entrydir) {
    1.38+			dtype = Dirtype;
    1.39+			pipe = " | venti/parse entries";
    1.40+		}
    1.41+		print("venti/read %d %s%s\n", dtype, e.score.text(), pipe);
    1.42+	}
    1.43 }
    1.44 
    1.45 direntry(d: array of byte)