diff options
author | Russ Cox <rsc@swtch.com> | 2007-08-23 11:53:47 -0400 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2007-08-23 11:53:47 -0400 |
commit | 2432b7b1e57ccc8d204ba99e004d6fb1e1093373 (patch) | |
tree | 051b904b97334fef0a6cea397858d4639fe80b8f /src | |
parent | 6610dac99c6e7370aa0a1d6d0521e301533dc61e (diff) | |
download | plan9port-2432b7b1e57ccc8d204ba99e004d6fb1e1093373.tar.gz plan9port-2432b7b1e57ccc8d204ba99e004d6fb1e1093373.tar.bz2 plan9port-2432b7b1e57ccc8d204ba99e004d6fb1e1093373.zip |
venti: allow partition syntax in verifyarena (Michael Kaminsky)
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd/venti/srv/verifyarena.c | 14 |
1 files changed, 9 insertions, 5 deletions
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); } |