aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/venti
diff options
context:
space:
mode:
authorRuss Cox <rsc@swtch.com>2008-12-23 12:37:58 -0800
committerRuss Cox <rsc@swtch.com>2008-12-23 12:37:58 -0800
commit9b5f23c2de89bbd39d57f413cca78f2f11e7c395 (patch)
tree1ef47416f9a566a7ab274d1880ff07191979438f /src/cmd/venti
parentbeaf4875892ca8ae21f793a525f88f43b0653fab (diff)
downloadplan9port-9b5f23c2de89bbd39d57f413cca78f2f11e7c395.tar.gz
plan9port-9b5f23c2de89bbd39d57f413cca78f2f11e7c395.tar.bz2
plan9port-9b5f23c2de89bbd39d57f413cca78f2f11e7c395.zip
venti/verifyarena: shorter output, aligned i/o
Diffstat (limited to 'src/cmd/venti')
-rw-r--r--src/cmd/venti/srv/verifyarena.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/cmd/venti/srv/verifyarena.c b/src/cmd/venti/srv/verifyarena.c
index 662d5323..f53d17f2 100644
--- a/src/cmd/venti/srv/verifyarena.c
+++ b/src/cmd/venti/srv/verifyarena.c
@@ -60,7 +60,8 @@ verifyarena(char *name, vlong len)
u32int bs;
u8int score[VtScoreSize];
- fprint(2, "%T verify %s\n", name);
+ if(verbose)
+ fprint(2, "%T verify %s\n", name);
memset(&arena, 0, sizeof arena);
memset(&s, 0, sizeof s);
@@ -140,16 +141,19 @@ verifyarena(char *name, vlong len)
/*
* check for no checksum or the same
*/
- if(scorecmp(score, arena.score) == 0)
- fprint(2, "%T %s: verified score\n", name);
- else if(scorecmp(zeroscore, arena.score) == 0)
- fprint(2, "%T %s: unsealed\n", name);
- else{
+ if(scorecmp(score, arena.score) == 0) {
+ if(verbose)
+ fprint(2, "%T %s: verified score\n", name);
+ } else if(scorecmp(zeroscore, arena.score) == 0) {
+ if(verbose || arena.diskstats.used > 0)
+ fprint(2, "%T %s: unsealed %,lld bytes\n", name, arena.diskstats.used);
+ } else{
fprint(2, "%T %s: mismatch checksum - found=%V calculated=%V\n",
name, arena.score, score);
return;
}
- printarena(2, &arena);
+ if(verbose > 1)
+ printarena(2, &arena);
}
static int
@@ -196,7 +200,10 @@ threadmain(int argc, char *argv[])
break;
}ARGEND
- data = vtmalloc(blocksize);
+ data = vtmalloc(MaxIo + blocksize);
+ if((uintptr)data % MaxIo)
+ data += MaxIo - (uintptr)data%MaxIo;
+
if(argc == 0){
fd = 0;
verifyarena("<stdin>", 0);
@@ -212,8 +219,9 @@ threadmain(int argc, char *argv[])
sysfatal("read arena part header: %r");
if(unpackarenapart(&ap, data) < 0)
sysfatal("corrupted arena part header: %r");
- fprint(2, "%T # arena part version=%d blocksize=%d arenabase=%d\n",
- ap.version, ap.blocksize, ap.arenabase);
+ if(verbose)
+ fprint(2, "%T # arena part version=%d blocksize=%d arenabase=%d\n",
+ ap.version, ap.blocksize, ap.arenabase);
ap.tabbase = (PartBlank+HeadSize+ap.blocksize-1)&~(ap.blocksize-1);
ap.tabsize = ap.arenabase - ap.tabbase;
table = malloc(ap.tabsize+1);