Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms.
This commit is contained in:
parent
226d80b821
commit
cbeb0b26e4
492 changed files with 3218 additions and 3167 deletions
|
|
@ -257,7 +257,7 @@ writearena(Arena *arena, u64int aa, u8int *clbuf, u32int n)
|
|||
if(m > n - nn)
|
||||
m = n - nn;
|
||||
memmove(&b->data[off], &clbuf[nn], m);
|
||||
// ok = writepart(arena->part, a, b->data, blocksize);
|
||||
/* ok = writepart(arena->part, a, b->data, blocksize); */
|
||||
ok = 0;
|
||||
putdblock(b);
|
||||
if(ok < 0){
|
||||
|
|
@ -329,7 +329,7 @@ writeaclump(Arena *arena, Clump *c, u8int *clbuf, u64int start, u64int *pa)
|
|||
if(m > n - nn)
|
||||
m = n - nn;
|
||||
memmove(&b->data[off], &clbuf[nn], m);
|
||||
// ok = writepart(arena->part, a, b->data, blocksize);
|
||||
/* ok = writepart(arena->part, a, b->data, blocksize); */
|
||||
ok = 0;
|
||||
putdblock(b);
|
||||
if(ok < 0){
|
||||
|
|
@ -595,7 +595,7 @@ wbarenahead(Arena *arena)
|
|||
b = alloczblock(arena->blocksize, 1, arena->part->blocksize);
|
||||
if(b == nil){
|
||||
logerr(EAdmin, "can't write arena header: %r");
|
||||
///ZZZ add error message?
|
||||
/*/ZZZ add error message? */
|
||||
return -1;
|
||||
}
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ wbarenapart(ArenaPart *ap)
|
|||
return -1;
|
||||
b = alloczblock(HeadSize, 1, 0);
|
||||
if(b == nil)
|
||||
//ZZZ set error message?
|
||||
/*ZZZ set error message? */
|
||||
return -1;
|
||||
|
||||
if(packarenapart(ap, b->data) < 0){
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ initiestream(Part *part, u64int off, u64int clumps, u32int size)
|
|||
{
|
||||
IEStream *ies;
|
||||
|
||||
//ZZZ out of memory?
|
||||
/*ZZZ out of memory? */
|
||||
ies = MKZ(IEStream);
|
||||
ies->buf = MKN(u8int, size);
|
||||
ies->epos = ies->buf;
|
||||
|
|
@ -61,7 +61,7 @@ peekientry(IEStream *ies)
|
|||
nn -= n;
|
||||
if(nn == 0)
|
||||
return nil;
|
||||
//fprint(2, "peek %d from %llud into %p\n", nn, ies->off, ies->epos);
|
||||
/*fprint(2, "peek %d from %llud into %p\n", nn, ies->off, ies->epos); */
|
||||
if(readpart(ies->part, ies->off, ies->epos, nn) < 0){
|
||||
seterr(EOk, "can't read sorted index entries: %r");
|
||||
return nil;
|
||||
|
|
@ -101,7 +101,7 @@ buildbucket(Index *ix, IEStream *ies, IBucket *ib, uint maxdata)
|
|||
b = peekientry(ies);
|
||||
if(b == nil)
|
||||
return TWID32;
|
||||
//fprint(2, "b=%p ies->n=%lld ib.n=%d buck=%d score=%V\n", b, ies->n, ib->n, iebuck(ix, b, ib, ies), b);
|
||||
/*fprint(2, "b=%p ies->n=%lld ib.n=%d buck=%d score=%V\n", b, ies->n, ib->n, iebuck(ix, b, ib, ies), b); */
|
||||
if(ib->n == 0)
|
||||
buck = iebuck(ix, b, ib, ies);
|
||||
else{
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ buildindex(Index *ix, Part *part, u64int off, u64int clumps, int zero)
|
|||
uint nbuck;
|
||||
u64int found = 0;
|
||||
|
||||
//ZZZ make buffer size configurable
|
||||
/*ZZZ make buffer size configurable */
|
||||
b = alloczblock(ix->blocksize, 0, ix->blocksize);
|
||||
z = alloczblock(ix->blocksize, 1, ix->blocksize);
|
||||
ies = initiestream(part, off, clumps, 64*1024);
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ checkindex(Index *ix, Part *part, u64int off, u64int clumps, int zero)
|
|||
int ok, bok;
|
||||
u64int found = 0;
|
||||
|
||||
//ZZZ make buffer size configurable
|
||||
/*ZZZ make buffer size configurable */
|
||||
b = alloczblock(ix->blocksize, 0, ix->blocksize);
|
||||
z = alloczblock(ix->blocksize, 1, ix->blocksize);
|
||||
ies = initiestream(part, off, clumps, 64*1024);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ static struct {
|
|||
ArenaHeadMagic, "ArenaHeadMagic",
|
||||
ArenaMagic, "ArenaMagic",
|
||||
ISectMagic, "ISectMagic",
|
||||
BloomMagic, "BloomMagic",
|
||||
BloomMagic, "BloomMagic"
|
||||
};
|
||||
|
||||
static char*
|
||||
|
|
|
|||
|
|
@ -75,17 +75,23 @@ enum
|
|||
/*
|
||||
* magic numbers on disk
|
||||
*/
|
||||
_ClumpMagic = 0xd15cb10cU, /* clump header, deprecated */
|
||||
/* _ClumpMagic = 0xd15cb10cU, / * clump header, deprecated */
|
||||
#define _ClumpMagic 0xd15cb10cU
|
||||
ClumpFreeMagic = 0, /* free clump; terminates active clump log */
|
||||
|
||||
ArenaPartMagic = 0xa9e4a5e7U, /* arena partition header */
|
||||
ArenaMagic = 0xf2a14eadU, /* arena trailer */
|
||||
ArenaHeadMagic = 0xd15c4eadU, /* arena header */
|
||||
|
||||
BloomMagic = 0xb1004eadU, /* bloom filter header */
|
||||
/* ArenaPartMagic = 0xa9e4a5e7U, / * arena partition header */
|
||||
/* ArenaMagic = 0xf2a14eadU, / * arena trailer */
|
||||
/* ArenaHeadMagic = 0xd15c4eadU, / * arena header */
|
||||
#define ArenaPartMagic 0xa9e4a5e7U
|
||||
#define ArenaMagic 0xf2a14eadU
|
||||
#define ArenaHeadMagic 0xd15c4eadU
|
||||
|
||||
/* BloomMagic = 0xb1004eadU, / * bloom filter header */
|
||||
#define BloomMagic 0xb1004eadU
|
||||
BloomMaxHash = 32,
|
||||
|
||||
ISectMagic = 0xd15c5ec7U, /* index header */
|
||||
/* ISectMagic = 0xd15c5ec7U, / * index header */
|
||||
#define ISectMagic 0xd15c5ec7U
|
||||
|
||||
ArenaPartVersion = 3,
|
||||
ArenaVersion4 = 4,
|
||||
|
|
@ -436,7 +442,7 @@ struct Index
|
|||
u32int buckets; /* last bucket used in disk hash table */
|
||||
u32int blocksize;
|
||||
u32int tabsize; /* max. bytes in index config */
|
||||
u32int bitblocks; //XXX remove these fields
|
||||
u32int bitblocks; /* XXX remove these fields */
|
||||
u32int maxdepth;
|
||||
u32int bitkeylog;
|
||||
u32int bitkeymask;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ enum
|
|||
{
|
||||
HashLog = 9,
|
||||
HashSize = 1<<HashLog,
|
||||
HashMask = HashSize - 1,
|
||||
HashMask = HashSize - 1
|
||||
};
|
||||
|
||||
struct DCache
|
||||
|
|
@ -213,7 +213,7 @@ return;
|
|||
lastmiss.addr = addr;
|
||||
}
|
||||
|
||||
// fprint(2, "%s %llx %s\n", part->name, addr, miss ? "miss" : "hit");
|
||||
/* fprint(2, "%s %llx %s\n", part->name, addr, miss ? "miss" : "hit"); */
|
||||
}
|
||||
|
||||
int
|
||||
|
|
@ -297,7 +297,7 @@ _getdblock(Part *part, u64int addr, int mode, int load)
|
|||
/*
|
||||
* look for the block in the cache
|
||||
*/
|
||||
//checkdcache();
|
||||
/*checkdcache(); */
|
||||
qlock(&dcache.lock);
|
||||
again:
|
||||
for(b = dcache.heads[h]; b != nil; b = b->next){
|
||||
|
|
@ -367,7 +367,7 @@ found:
|
|||
fixheap(b->heap, b);
|
||||
|
||||
qunlock(&dcache.lock);
|
||||
//checkdcache();
|
||||
/*checkdcache(); */
|
||||
|
||||
trace(TraceBlock, "getdblock lock");
|
||||
addstat(StatDblockStall, 1);
|
||||
|
|
@ -427,7 +427,7 @@ putdblock(DBlock *b)
|
|||
else
|
||||
wunlock(&b->lock);
|
||||
|
||||
//checkdcache();
|
||||
/*checkdcache(); */
|
||||
qlock(&dcache.lock);
|
||||
if(--b->ref == 0 && !b->dirty){
|
||||
if(b->heap == TWID32)
|
||||
|
|
@ -435,7 +435,7 @@ putdblock(DBlock *b)
|
|||
rwakeupall(&dcache.full);
|
||||
}
|
||||
qunlock(&dcache.lock);
|
||||
//checkdcache();
|
||||
/*checkdcache(); */
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ findscore(Arena *arena, uchar *score)
|
|||
u32int clump;
|
||||
int i, n, found;
|
||||
|
||||
//ZZZ remove fprint?
|
||||
/*ZZZ remove fprint? */
|
||||
if(arena->memstats.clumps)
|
||||
fprint(2, "reading directory for arena=%s with %d entries\n", arena->name, arena->memstats.clumps);
|
||||
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ listenproc(void *vaddress)
|
|||
char *address, ndir[NETPATHLEN], dir[NETPATHLEN];
|
||||
int ctl, nctl, data;
|
||||
|
||||
//sleep(1000); /* let strace find us */
|
||||
/*sleep(1000); // let strace find us */
|
||||
|
||||
address = vaddress;
|
||||
ctl = announce(address, dir);
|
||||
|
|
@ -148,7 +148,7 @@ httpproc(void *v)
|
|||
HConnect *c;
|
||||
int ok, i, n;
|
||||
|
||||
//sleep(1000); /* let strace find us */
|
||||
/*sleep(1000); // let strace find us */
|
||||
c = v;
|
||||
|
||||
for(;;){
|
||||
|
|
@ -722,7 +722,7 @@ static char* graphname[] =
|
|||
"isectwritebyte",
|
||||
|
||||
"sumread",
|
||||
"sumreadbyte",
|
||||
"sumreadbyte"
|
||||
};
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ icachewritesect(Index *ix, ISect *is, u8int *buf)
|
|||
|
||||
trace(TraceProc, "icachewritesect readpart 0x%llux+0x%ux", addr, nbuf);
|
||||
if(readpart(is->part, addr, buf, nbuf) < 0){
|
||||
// XXX
|
||||
/* XXX */
|
||||
fprint(2, "icachewriteproc readpart: %r\n");
|
||||
err = -1;
|
||||
continue;
|
||||
|
|
@ -154,7 +154,7 @@ icachewritesect(Index *ix, ISect *is, u8int *buf)
|
|||
|
||||
trace(TraceProc, "icachewritesect writepart", addr, nbuf);
|
||||
if(writepart(is->part, addr, buf, nbuf) < 0){
|
||||
// XXX
|
||||
/* XXX */
|
||||
fprint(2, "icachewriteproc writepart: %r\n");
|
||||
err = -1;
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -23,16 +23,16 @@
|
|||
#include "dat.h"
|
||||
#include "fns.h"
|
||||
|
||||
//static int bucklook(u8int *score, int type, u8int *data, int n);
|
||||
//static int writebucket(ISect *is, u32int buck, IBucket *ib, DBlock *b);
|
||||
//static int okibucket(IBucket *ib, ISect *is);
|
||||
/*static int bucklook(u8int *score, int type, u8int *data, int n); */
|
||||
/*static int writebucket(ISect *is, u32int buck, IBucket *ib, DBlock *b); */
|
||||
/*static int okibucket(IBucket *ib, ISect *is); */
|
||||
static int initindex1(Index*);
|
||||
static ISect *initisect1(ISect *is);
|
||||
//static int splitiblock(Index *ix, DBlock *b, ISect *is, u32int buck, IBucket *ib);
|
||||
/*static int splitiblock(Index *ix, DBlock *b, ISect *is, u32int buck, IBucket *ib); */
|
||||
|
||||
#define KEY(k,d) ((d) ? (k)>>(32-(d)) : 0)
|
||||
|
||||
//static QLock indexlock; //ZZZ
|
||||
/*static QLock indexlock; //ZZZ */
|
||||
|
||||
static char IndexMagic[] = "venti index configuration";
|
||||
|
||||
|
|
@ -457,9 +457,9 @@ initisect1(ISect *is)
|
|||
v = is->part->size & ~(u64int)(is->blocksize - 1);
|
||||
if(is->blockbase + (u64int)is->blocks * is->blocksize != v){
|
||||
seterr(ECorrupt, "invalid blocks in index section %s", is->name);
|
||||
//ZZZZZZZZZ
|
||||
// freeisect(is);
|
||||
// return nil;
|
||||
/*ZZZZZZZZZ */
|
||||
/* freeisect(is); */
|
||||
/* return nil; */
|
||||
}
|
||||
|
||||
if(is->stop - is->start > is->blocks){
|
||||
|
|
@ -483,7 +483,7 @@ wbisect(ISect *is)
|
|||
|
||||
b = alloczblock(HeadSize, 1, 0);
|
||||
if(b == nil)
|
||||
//ZZZ set error?
|
||||
/*ZZZ set error? */
|
||||
return -1;
|
||||
|
||||
if(packisect(is, b->data) < 0){
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ readlump(u8int *score, int type, u32int size, int *cached)
|
|||
*cached = 0;
|
||||
|
||||
if(lookupscore(score, type, &ia, &rac) < 0){
|
||||
//ZZZ place to check for someone trying to guess scores
|
||||
/*ZZZ place to check for someone trying to guess scores */
|
||||
seterr(EOk, "no block with score %V/%d exists", score, type);
|
||||
|
||||
putlump(u);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ enum
|
|||
{
|
||||
HashLog = 9,
|
||||
HashSize = 1<<HashLog,
|
||||
HashMask = HashSize - 1,
|
||||
HashMask = HashSize - 1
|
||||
};
|
||||
|
||||
struct LumpCache
|
||||
|
|
@ -175,7 +175,7 @@ again:
|
|||
* remove it from the heap, and fix up the heap.
|
||||
*/
|
||||
size = packetasize(p);
|
||||
//ZZZ
|
||||
/*ZZZ */
|
||||
while(lumpcache.avail < size){
|
||||
trace(TraceLump, "insertlump bump");
|
||||
CHECK(checklumpcache());
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ shoulddump(char *name, int argc, char **argv)
|
|||
|
||||
enum
|
||||
{
|
||||
ClumpChunks = 32*1024,
|
||||
ClumpChunks = 32*1024
|
||||
};
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ sortrawientries(Index *ix, Part *tmp, u64int *base, Bloom *bloom)
|
|||
u32int n;
|
||||
int i, ok;
|
||||
|
||||
//ZZZ should allow configuration of bits, bucket size
|
||||
/*ZZZ should allow configuration of bits, bucket size */
|
||||
ib = initiebucks(tmp, 8, 64*1024);
|
||||
if(ib == nil){
|
||||
seterr(EOk, "can't create sorting buckets: %r");
|
||||
|
|
@ -116,10 +116,10 @@ readarenainfo(IEBucks *ib, Arena *arena, u64int a, Bloom *b)
|
|||
ClumpInfo *ci, *cis;
|
||||
u32int clump;
|
||||
int i, n, ok, nskip;
|
||||
// static Biobuf bout;
|
||||
/* static Biobuf bout; */
|
||||
|
||||
//ZZZ remove fprint?
|
||||
//fprint(2, "ra %s %d %d\n", arena->name, arena->memstats.clumps, arena->diskstats.clumps);
|
||||
/*ZZZ remove fprint? */
|
||||
/*fprint(2, "ra %s %d %d\n", arena->name, arena->memstats.clumps, arena->diskstats.clumps); */
|
||||
if(arena->memstats.clumps)
|
||||
fprint(2, "\tarena %s: %d entries\n", arena->name, arena->memstats.clumps);
|
||||
else
|
||||
|
|
@ -129,7 +129,7 @@ readarenainfo(IEBucks *ib, Arena *arena, u64int a, Bloom *b)
|
|||
ok = 0;
|
||||
nskip = 0;
|
||||
memset(&ie, 0, sizeof(IEntry));
|
||||
// Binit(&bout, 1, OWRITE);
|
||||
/* Binit(&bout, 1, OWRITE); */
|
||||
for(clump = 0; clump < arena->memstats.clumps; clump += n){
|
||||
n = ClumpChunks;
|
||||
if(n > arena->memstats.clumps - clump)
|
||||
|
|
@ -148,18 +148,18 @@ readarenainfo(IEBucks *ib, Arena *arena, u64int a, Bloom *b)
|
|||
a += ci->size + ClumpSize;
|
||||
ie.ia.blocks = (ci->size + ClumpSize + (1 << ABlockLog) - 1) >> ABlockLog;
|
||||
scorecp(ie.score, ci->score);
|
||||
// Bprint(&bout, "%22lld %V %3d %5d\n",
|
||||
// ie.ia.addr, ie.score, ie.ia.type, ie.ia.size);
|
||||
/* Bprint(&bout, "%22lld %V %3d %5d\n", */
|
||||
/* ie.ia.addr, ie.score, ie.ia.type, ie.ia.size); */
|
||||
if(ci->type == VtCorruptType){
|
||||
// print("! %V %22lld %3d %5d %3d\n",
|
||||
// ie.score, ie.ia.addr, ie.ia.type, ie.ia.size, ie.ia.blocks);
|
||||
/* print("! %V %22lld %3d %5d %3d\n", */
|
||||
/* ie.score, ie.ia.addr, ie.ia.type, ie.ia.size, ie.ia.blocks); */
|
||||
nskip++;
|
||||
}else
|
||||
sprayientry(ib, &ie);
|
||||
markbloomfilter(b, ie.score);
|
||||
}
|
||||
}
|
||||
// Bterm(&bout);
|
||||
/* Bterm(&bout); */
|
||||
free(cis);
|
||||
if(ok < 0)
|
||||
return TWID32;
|
||||
|
|
@ -358,8 +358,8 @@ readiebuck(IEBucks *ib, int b)
|
|||
m = ib->bucks[b].used;
|
||||
if(m == 0)
|
||||
m = ib->usable;
|
||||
// if(ib->bucks[b].total)
|
||||
// fprint(2, "\tbucket %d: %d entries\n", b, ib->bucks[b].total/IEntrySize);
|
||||
/* if(ib->bucks[b].total) */
|
||||
/* fprint(2, "\tbucket %d: %d entries\n", b, ib->bucks[b].total/IEntrySize); */
|
||||
while(head != TWID32){
|
||||
if(readpart(ib->part, (u64int)head * ib->size, &ib->buf[n], m+U32Size) < 0){
|
||||
seterr(EOk, "can't read index sort bucket: %r");
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ Statdesc statdesc[NStat] =
|
|||
{ "isect block write bytes", },
|
||||
|
||||
{ "sum reads", },
|
||||
{ "sum read bytes", },
|
||||
{ "sum read bytes", }
|
||||
};
|
||||
|
||||
QLock statslock;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ syncarena(Arena *arena, u64int start, u32int n, int zok, int fix)
|
|||
ZBlock *lump;
|
||||
Clump cl;
|
||||
ClumpInfo ci;
|
||||
static ClumpInfo zci = { .type = -1 };
|
||||
static ClumpInfo zci = { -1 };
|
||||
u8int score[VtScoreSize];
|
||||
u64int uncsize, used, aa;
|
||||
u32int clump, clumps, cclumps, magic;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ static uchar lenval[1 << (DBigLenBits - 1)] =
|
|||
static uchar lenbits[] =
|
||||
{
|
||||
0, 0, 0,
|
||||
2, 3, 5, 5,
|
||||
2, 3, 5, 5
|
||||
};
|
||||
|
||||
static uchar offbits[16] =
|
||||
|
|
|
|||
|
|
@ -210,8 +210,8 @@ ventiserver(void *v)
|
|||
trace(TraceRpc, "<- %F", &r->tx);
|
||||
r->rx.msgtype = r->tx.msgtype+1;
|
||||
addstat(StatRpcTotal, 1);
|
||||
// print("req (arenas[0]=%p sects[0]=%p) %F\n",
|
||||
// mainindex->arenas[0], mainindex->sects[0], &r->tx);
|
||||
/* print("req (arenas[0]=%p sects[0]=%p) %F\n", */
|
||||
/* mainindex->arenas[0], mainindex->sects[0], &r->tx); */
|
||||
switch(r->tx.msgtype){
|
||||
default:
|
||||
vtrerror(r, "unknown request");
|
||||
|
|
|
|||
|
|
@ -83,8 +83,8 @@ rdarena(Arena *arena, u64int offset)
|
|||
if(magic == ClumpFreeMagic)
|
||||
break;
|
||||
if(magic != arena->clumpmagic) {
|
||||
// fprint(2, "illegal clump magic number %#8.8ux offset %llud\n",
|
||||
// magic, aa);
|
||||
/* fprint(2, "illegal clump magic number %#8.8ux offset %llud\n", */
|
||||
/* magic, aa); */
|
||||
break;
|
||||
}
|
||||
lump = loadclump(arena, aa, 0, &cl, score, 0);
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@ zeropart(Part *part, int blocksize)
|
|||
int w;
|
||||
|
||||
fprint(2, "clearing the partition\n");
|
||||
//fprint(2, "NOT!\n");
|
||||
//return;
|
||||
//b=alloczblock(MaxIoSize, 1, blocksize);
|
||||
//freezblock(b);
|
||||
/*fprint(2, "NOT!\n"); */
|
||||
/*return; */
|
||||
/*b=alloczblock(MaxIoSize, 1, blocksize); */
|
||||
/*freezblock(b); */
|
||||
b = alloczblock(MaxIoSize, 1, blocksize);
|
||||
|
||||
w = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue