From 2432b7b1e57ccc8d204ba99e004d6fb1e1093373 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 23 Aug 2007 11:53:47 -0400 Subject: venti: allow partition syntax in verifyarena (Michael Kaminsky) --- src/cmd/venti/srv/verifyarena.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/cmd/venti/srv/verifyarena.c b/src/cmd/venti/srv/verifyarena.c index fbaff9ca..662d5323 100644 --- a/src/cmd/venti/srv/verifyarena.c +++ b/src/cmd/venti/srv/verifyarena.c @@ -7,6 +7,7 @@ static int fd; static uchar *data; static int blocksize; static int sleepms; +static vlong offset0; void usage(void) @@ -22,7 +23,7 @@ preadblock(uchar *buf, int n, vlong off) for(nr = 0; nr < n; nr += m){ m = n - nr; - m = pread(fd, &buf[nr], m, off+nr); + m = pread(fd, &buf[nr], m, offset0+off+nr); if(m <= 0){ if(m == 0) werrstr("early eof"); @@ -175,7 +176,8 @@ threadmain(int argc, char *argv[]) char *p, *q, *table, *f[10], line[256]; vlong start, stop; ArenaPart ap; - + Part *part; + needzeroscore(); ventifmtinstall(); blocksize = MaxIoSize; @@ -201,8 +203,10 @@ threadmain(int argc, char *argv[]) threadexitsall(nil); } - if((fd = open(argv[0], OREAD)) < 0) - sysfatal("open %s: %r", argv[0]); + if((part = initpart(argv[0], OREAD)) == nil) + sysfatal("open partition %s: %r", argv[0]); + fd = part->fd; + offset0 = part->offset; if(preadblock(data, 8192, PartBlank) < 0) sysfatal("read arena part header: %r"); @@ -249,7 +253,7 @@ threadmain(int argc, char *argv[]) fprint(2, "%T %s: bad start,stop %lld,%lld\n", f[0], stop, start); continue; } - if(seek(fd, start, 0) < 0) + if(seek(fd, offset0+start, 0) < 0) fprint(2, "%T %s: seek to start: %r\n", f[0]); verifyarena(f[0], stop - start); } -- cgit v1.2.3