venti: allow partition syntax in verifyarena (Michael Kaminsky)
This commit is contained in:
parent
6610dac99c
commit
2432b7b1e5
1 changed files with 9 additions and 5 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue