diff options
author | Petter Rodhelind <petter.rodhelind@gmail.com> | 2020-01-14 11:41:08 +0100 |
---|---|---|
committer | Petter Rodhelind <petter.rodhelind@gmail.com> | 2020-01-14 11:41:08 +0100 |
commit | 02d7aa8915f9c3a3288dab01f321eb94ba219e3b (patch) | |
tree | f053238978479e408a2b83571443e132f30586ab /src/cmd/venti/srv/hdisk.c | |
parent | c0c9d8f883dfd3a7f5a74499d91bb95884b15873 (diff) | |
parent | 3d1382b98a502d0c34d5ba2c462396acc515016e (diff) | |
download | plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.tar.gz plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.tar.bz2 plan9port-02d7aa8915f9c3a3288dab01f321eb94ba219e3b.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'src/cmd/venti/srv/hdisk.c')
-rw-r--r-- | src/cmd/venti/srv/hdisk.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/src/cmd/venti/srv/hdisk.c b/src/cmd/venti/srv/hdisk.c index 8cf937d1..e477b815 100644 --- a/src/cmd/venti/srv/hdisk.c +++ b/src/cmd/venti/srv/hdisk.c @@ -14,7 +14,7 @@ hdisk(HConnect *c) char *disk, *type; Part *p; int ret; - + if(hsethtml(c) < 0) return -1; @@ -42,7 +42,7 @@ hdisk(HConnect *c) return 0; } freepart(p); - return ret; + return ret; } static int @@ -51,7 +51,7 @@ disksummary(HConnect *c) int i; Index *ix; Part *p; - + hprint(&c->hout, "<h1>venti disks</h1>\n"); hprint(&c->hout, "<pre>\n"); ix = mainindex; @@ -83,7 +83,7 @@ readap(Part *p, ArenaPart *ap) { uchar *blk; char *table; - + blk = vtmalloc(8192); if(readpart(p, PartBlank, blk, 8192) != 8192) return nil; @@ -108,7 +108,7 @@ xfindarena(char *table, char *name, vlong *start, vlong *end) { int i, nline; char *p, *q, *f[4], line[256]; - + nline = atoi(table); p = strchr(table, '\n'); if(p) @@ -212,7 +212,7 @@ diskarenapart(HConnect *c, char *disk, Part *p) hprint(&c->hout, "%r\n"); goto out; } - + hprint(&c->hout, "<pre>\n"); hprint(&c->hout, "version=%d blocksize=%d base=%d\n", ap.version, ap.blocksize, ap.arenabase); @@ -223,12 +223,12 @@ diskarenapart(HConnect *c, char *disk, Part *p) diskarenatable(c, disk, table); goto out; } - + if(xfindarena(table, arenaname, &start, &end) < 0){ hprint(&c->hout, "no such arena %s\n", arenaname); goto out; } - + hprint(&c->hout, "<h2>arena %s</h2>\n", arenaname); hprint(&c->hout, "<pre>start=%#llx end=%#llx<pre>\n", start, end); if(end < start || end - start < HeadSize){ @@ -253,7 +253,7 @@ diskarenapart(HConnect *c, char *disk, Part *p) hprint(&c->hout, "head:\n<pre>\n"); hprint(&c->hout, "version=%d name=%s blocksize=%d size=%#llx clumpmagic=%#ux\n", - head.version, head.name, head.blocksize, head.size, + head.version, head.name, head.blocksize, head.size, head.clumpmagic); hprint(&c->hout, "</pre><br><br>\n"); @@ -281,7 +281,7 @@ diskarenapart(HConnect *c, char *disk, Part *p) scorecp(arena.score, blk+head.blocksize - VtScoreSize); vtfree(blk); - + hprint(&c->hout, "tail:\n<pre>\n"); hprint(&c->hout, "version=%d name=%s\n", arena.version, arena.name); hprint(&c->hout, "ctime=%d %s\n", arena.ctime, fmttime(tbuf, arena.ctime)); @@ -389,10 +389,10 @@ diskarenatoc(HConnect *c, Arena *arena) } unpackclumpinfo(&ci, blk+(i%arena->clumpmax)*ClumpInfoSize); if(i/arena->clumpmax == cib || i%arena->clumpmax == 0){ - hprint(&c->hout, "%5d %6d %7d %V", + hprint(&c->hout, "%5d %6d %7d %V", ci.type, ci.size, ci.uncsize, ci.score); if(coff >= 0) - hprint(&c->hout, " at <a href=\"%s&clump=%#llx&score=%V\">%#llx</a>", + hprint(&c->hout, " at <a href=\"%s&clump=%#llx&score=%V\">%#llx</a>", base, coff, ci.score, coff); if(i/arena->clumpmax != cib) hprint(&c->hout, " <font size=-1><a href=\"%s&cib=%d\">more</a></font>", base, i/arena->clumpmax); @@ -415,7 +415,7 @@ diskarenaclump(HConnect *c, Arena *arena, vlong off, char *scorestr) uchar xscore[VtScoreSize], score[VtScoreSize]; Unwhack uw; int n; - + if(scorestr){ if(vtparsescore(scorestr, nil, score) < 0){ hprint(&c->hout, "bad score %s: %r\n", scorestr); @@ -436,7 +436,7 @@ diskarenaclump(HConnect *c, Arena *arena, vlong off, char *scorestr) hprint(&c->hout, "bad offset %#llx\n", off); return -1; } - + off += arena->base; blk = vtmalloc(ClumpSize + VtMaxLumpSize); @@ -461,15 +461,15 @@ diskarenaclump(HConnect *c, Arena *arena, vlong off, char *scorestr) hprint(&c->hout, "<pre>type=%d size=%d uncsize=%d score=%V\n", cl.info.type, cl.info.size, cl.info.uncsize, cl.info.score); hprint(&c->hout, "encoding=%d creator=%d time=%d %s</pre>\n", cl.encoding, cl.creator, cl.time, fmttime(err, cl.time)); - + if(cl.info.type == VtCorruptType) hprint(&c->hout, "clump is marked corrupt<br>\n"); - + if(cl.info.size >= VtMaxLumpSize){ hprint(&c->hout, "clump too big\n"); goto error; } - + switch(cl.encoding){ case ClumpECompress: blk2 = vtmalloc(VtMaxLumpSize); @@ -493,7 +493,7 @@ diskarenaclump(HConnect *c, Arena *arena, vlong off, char *scorestr) scoremem(xscore, blk+ClumpSize, cl.info.size); break; } - + hprint(&c->hout, "score=%V<br>\n", xscore); if(scorestr && scorecmp(score, xscore) != 0) hprint(&c->hout, "score does NOT match expected %V\n", score); @@ -536,7 +536,7 @@ debugamap(HConnect *c) amap = mainindex->amap; for(i=0; i<mainindex->narenas; i++) - hprint(&c->hout, "%s %#llx %#llx\n", + hprint(&c->hout, "%s %#llx %#llx\n", amap[i].name, amap[i].start, amap[i].stop); } @@ -559,23 +559,23 @@ debugread(HConnect *c, u8int *score) hprint(&c->hout, "zero score\n"); return; } - + hprint(&c->hout, "<h2>index search %V</h2><pre>\n", score); if(icachelookup(score, -1, &ia) < 0) hprint(&c->hout, " icache: not found\n"); else hprint(&c->hout, " icache: addr=%#llx size=%d type=%d blocks=%d\n", ia.addr, ia.size, ia.type, ia.blocks); - + if(loadientry(mainindex, score, -1, &ie) < 0) hprint(&c->hout, " idisk: not found\n"); else hprint(&c->hout, " idisk: addr=%#llx size=%d type=%d blocks=%d\n", ie.ia.addr, ie.ia.size, ie.ia.type, ie.ia.blocks); - + hprint(&c->hout, "</pre><h2>lookup %V</h2>\n", score); hprint(&c->hout, "<pre>\n"); - + for(type=0; type < VtMaxType; type++){ hprint(&c->hout, "%V type %d:", score, type); u = lookuplump(score, type); @@ -584,14 +584,14 @@ debugread(HConnect *c, u8int *score) else hprint(&c->hout, " -cache"); putlump(u); - + if(lookupscore(score, type, &ia) < 0){ hprint(&c->hout, " -lookup\n"); continue; } hprint(&c->hout, "\n lookupscore: addr=%#llx size=%d blocks=%d\n", ia.addr, ia.size, ia.blocks); - + arena = amapitoa(mainindex, ia.addr, &aa); if(arena == nil){ hprint(&c->hout, " amapitoa failed: %r\n"); @@ -606,7 +606,7 @@ debugread(HConnect *c, u8int *score) hprint(&c->hout, " loadclump failed: %r\n"); continue; } - + hprint(&c->hout, " loadclump: uncsize=%d type=%d score=%V\n", cl.info.uncsize, cl.info.type, sc); if(ia.size != cl.info.uncsize || ia.type != cl.info.type || scorecmp(score, sc) != 0){ @@ -614,12 +614,12 @@ debugread(HConnect *c, u8int *score) continue; } } - + if(hargstr(c, "brute", "")[0] == 'y'){ hprint(&c->hout, "</pre>\n"); hprint(&c->hout, "<h2>brute force arena search %V</h2>\n", score); hprint(&c->hout, "<pre>\n"); - + for(i=0; i<mainindex->narenas; i++){ arena = mainindex->arenas[i]; hprint(&c->hout, "%s...\n", arena->name); @@ -637,10 +637,10 @@ static void debugmem(HConnect *c) { Index *ix; - + ix = mainindex; hprint(&c->hout, "<h2>memory</h2>\n"); - + hprint(&c->hout, "<pre>\n"); hprint(&c->hout, "ix=%p\n", ix); hprint(&c->hout, "\tarenas=%p\n", ix->arenas); @@ -660,7 +660,7 @@ hdebug(HConnect *c) { char *scorestr, *op; u8int score[VtScoreSize]; - + if(hsethtml(c) < 0) return -1; hprint(&c->hout, "<h1>venti debug</h1>\n"); @@ -670,7 +670,7 @@ hdebug(HConnect *c) hprint(&c->hout, "no op\n"); return 0; } - + if(strcmp(op, "amap") == 0){ debugamap(c); return 0; @@ -690,7 +690,7 @@ hdebug(HConnect *c) debugread(c, score); return 0; } - + hprint(&c->hout, "unknown op %s", op); return 0; } |