Browse Source

Plan 9 from Bell Labs 2008-06-15

David du Colombier 13 years ago
parent
commit
7baefb6bb5

+ 1 - 1
dist/replica/_plan9.db

@@ -7515,7 +7515,7 @@ sys/man/1/tweak - 664 sys sys 1196638936 4762
 sys/man/1/uniq - 664 sys sys 1196638933 995
 sys/man/1/units - 664 sys sys 1196638933 2046
 sys/man/1/uptime - 664 sys sys 1196638936 380
-sys/man/1/vac - 664 sys sys 1196638936 3244
+sys/man/1/vac - 664 sys sys 1161727008 3244
 sys/man/1/venti - 664 sys sys 1203807503 2321
 sys/man/1/vi - 664 sys sys 1196638936 2904
 sys/man/1/vnc - 664 sys sys 1196638933 4313

+ 1 - 1
dist/replica/plan9.db

@@ -7515,7 +7515,7 @@ sys/man/1/tweak - 664 sys sys 1196638936 4762
 sys/man/1/uniq - 664 sys sys 1196638933 995
 sys/man/1/units - 664 sys sys 1196638933 2046
 sys/man/1/uptime - 664 sys sys 1196638936 380
-sys/man/1/vac - 664 sys sys 1196638936 3244
+sys/man/1/vac - 664 sys sys 1161727008 3244
 sys/man/1/venti - 664 sys sys 1203807503 2321
 sys/man/1/vi - 664 sys sys 1196638936 2904
 sys/man/1/vnc - 664 sys sys 1196638933 4313

+ 2 - 0
dist/replica/plan9.log

@@ -19845,3 +19845,5 @@
 1213288207 0 c sys/man/2/arg - 664 sys sys 1213288210 2170
 1213290005 0 c sys/man/4/rio - 664 sys sys 1213288888 8658
 1213362005 0 c sys/games/lib/fortunes - 664 sys sys 1213360784 269499
+1213470005 0 c sys/man/1/vac - 664 sys sys 1213469074 4017
+1213475409 0 c sys/man/1/vac - 664 sys sys 1161727008 3244

+ 12 - 1
sys/src/libventi/file.c

@@ -607,7 +607,7 @@ shrinkdepth(VtFile *r, VtBlock *p, VtEntry *e, int depth)
 
 	rb = vtcacheglobal(r->c, e->score, e->type);
 	if(rb == nil)
-		return 0;
+		return -1;
 
 	/*
 	 * Walk down to the new root block.
@@ -748,6 +748,12 @@ vtfileblockscore(VtFile *r, u32int bn, uchar score[VtScoreSize])
 	if(b == nil)
 		return -1;
 
+	if(DEPTH(e.type) == 0){
+		memmove(score, e.score, VtScoreSize);
+		vtblockput(b);
+		return 0;
+	}
+
 	i = mkindices(&e, bn, index);
 	if(i < 0){
 		vtblockput(b);
@@ -1058,6 +1064,8 @@ filewrite1(VtFile *f, void *data, long count, vlong offset)
 		return -1;
 
 	memmove(b->data+frag, data, count);
+	if(m == VtOWRITE && frag+count < e.dsize)
+		memset(b->data+frag+count, 0, e.dsize-frag-count);
 
 	if(offset+count > e.size){
 		vtfilegetentry(f, &e);
@@ -1118,9 +1126,12 @@ flushblock(VtCache *c, VtBlock *bb, uchar score[VtScoreSize], int ppb, int epb,
 		for(i=0; i<epb; i++){
 			if(vtentryunpack(&e, b->data, i) < 0)
 				goto Err;
+			if(!(e.flags&VtEntryActive))
+				continue;
 			if(flushblock(c, nil, e.score, e.psize/VtScoreSize, e.dsize/VtEntrySize,
 				e.type) < 0)
 				goto Err;
+			vtentrypack(&e, b->data, i);
 		}
 		break;
 	

+ 4 - 11
sys/src/libventi/log.c

@@ -169,18 +169,11 @@ timefmt(Fmt *fmt)
 {
 	static uvlong t0;
 	uvlong t;
-	Tm tm;
 
-	if(fmt->flags&FmtSharp){
-		if(t0 == 0)
-			t0 = nsec();
-		t = nsec()-t0;
-		return fmtprint(fmt, "T+%d.%04d", (uint)(t/1000000000), (uint)(t%1000000000)/100000);
-	}else{
-		tm = *localtime(time(0));
-		return fmtprint(fmt, "%04d/%02d%02d %02d:%02d:%02d",
-			1900+tm.year, tm.mon+1, tm.mday, tm.hour, tm.min, tm.sec);
-	}
+	if(t0 == 0)
+		t0 = nsec();
+	t = nsec()-t0;
+	return fmtprint(fmt, "T+%d.%04d", (uint)(t/1000000000), (uint)(t%1000000000)/100000);
 }
 
 void

+ 1 - 1
sys/src/libventi/packet.c

@@ -888,7 +888,7 @@ memalloc(int n, int pos)
 
 	if(n < 0 || n > MaxFragSize) {
 		werrstr(EPacketSize);
-		return 0;
+		return nil;
 	}
 	if(n <= SmallMemSize) {
 		lock(&freelist.lk);

+ 1 - 1
sys/src/libventi/send.c

@@ -39,7 +39,7 @@ _vtsend(VtConn *z, Packet *p)
 		if(write(z->outfd, ioc.addr, ioc.len) < ioc.len){
 			vtlog(VtServerLog, "<font size=-1>%T %s:</font> sending packet %p: %r<br>\n", z->addr, p);
 			packetfree(p);
-			return 0;
+			return -1;
 		}
 		packetconsume(p, nil, ioc.len);
 		tot += ioc.len;