changelog shortlog tags branches changeset file revisions annotate raw help

Mercurial > hg > ventivac / appl/cmd/ventisrv.b

revision 129: 636d77883598
parent 111: 8fd6132b12be
     1.1--- a/appl/cmd/ventisrv.b	Mon Aug 20 13:54:40 2007 +0200
     1.2+++ b/appl/cmd/ventisrv.b	Mon Aug 20 14:24:44 2007 +0200
     1.3@@ -203,6 +203,7 @@
     1.4 statsdir := "/chan/";
     1.5 statsfile := "ventisrvstats";
     1.6 debug, Cflag, cflag, qflag, verbose: int;
     1.7+verifyoffset := big -1;
     1.8 raddrs, waddrs: list of string;
     1.9 
    1.10 indexfd, datafd: ref Sys->FD;
    1.11@@ -248,10 +249,11 @@
    1.12 	venti->init();
    1.13 
    1.14 	arg->init(args);
    1.15-	arg->setusage(arg->progname()+ " [-DcCqv] [-i index] [-d data] [-s statsfile] [-r addr] [-w addr] maxdatasize meanblocksize");
    1.16+	arg->setusage(arg->progname()+ " [-DcCqv] [-I indexoffset] [-i index] [-d data] [-s statsfile] [-r addr] [-w addr] maxdatasize meanblocksize");
    1.17 	while((c := arg->opt()) != 0)
    1.18 		case c {
    1.19 		'D' =>	debug++;
    1.20+		'I' =>	verifyoffset = big arg->earg();
    1.21 		'c' =>	cflag++;
    1.22 			Cflag++;
    1.23 		'C' =>	Cflag++;
    1.24@@ -409,9 +411,16 @@
    1.25 		fail(sprint("index file not multiple of iheadersize (indexsize=%bd iheadersize=%d)", indexsize, Ihdrsize));
    1.26 
    1.27 	doffset := big 0;
    1.28-	io := indexsize-big (Iverify*Ihdrsize);
    1.29-	if(io < big 0)
    1.30-		io = big 0;
    1.31+	io := verifyoffset;
    1.32+	if(io < big 0) {
    1.33+		io = indexsize-big (Iverify*Ihdrsize);
    1.34+		if(io < big 0)
    1.35+			io = big 0;
    1.36+	} else if(io > indexsize)
    1.37+		fail(sprint("index file offset to verify at lies outsize index file"));
    1.38+	else
    1.39+		if(verbose) say(sprint("starting index file verification at offset=%bd", io));
    1.40+		
    1.41 	if(indexsize > big 0) {
    1.42 		if(debug) say(sprint("config: verifying last entries in index file at offset=%bd", io));
    1.43 		ih := getihdr(io);