Browse Source

Plan 9 from Bell Labs 2007-09-09

David du Colombier 13 years ago
parent
commit
7245efbf5f

+ 1 - 1
386/bin/venti/conf

@@ -1,6 +1,6 @@
 #!/bin/rc
 # THIS FILE IS AUTOMATICALLY GENERATED
-# FROM /sys/src/cmd/fossil/conf.rc.  DO NOT EDIT.
+# FROM /sys/src/cmd/venti/conf.rc.  DO NOT EDIT.
 
 
 # the venti configuration is stored at the 248kB offset in the first index

+ 31 - 18
dist/replica/_plan9.db

@@ -1,17 +1,17 @@
 386 - 20000000775 sys sys 1010957353 0
-386/9load - 775 sys sys 1181763625 313856
-386/9loaddebug - 775 sys sys 1188593351 435045
-386/9loadlite - 775 sys sys 1176519517 137148
-386/9loadlitedebug - 775 sys sys 1188593356 220555
-386/9pc - 775 sys sys 1186023393 1937795
-386/9pc.gz - 664 sys sys 1186023393 829787
-386/9pccpu - 775 sys sys 1186023409 1657423
-386/9pccpu.gz - 664 sys sys 1186023409 715891
-386/9pcdisk - 775 sys sys 1186023422 2139974
-386/9pcdisk.gz - 664 sys sys 1186023422 916575
-386/9pcf - 775 sys sys 1186023439 2484444
-386/9pcf.gz - 664 sys sys 1186023440 1072917
-386/9pxeload - 775 sys sys 1181763625 313856
+386/9load - 775 sys sys 1186619808 326380
+386/9loaddebug - 775 sys sys 1186619810 434889
+386/9loadlite - 775 sys sys 1186619809 149672
+386/9loadlitedebug - 775 sys sys 1186619811 220399
+386/9pc - 775 sys sys 1189053434 2038499
+386/9pc.gz - 664 sys sys 1189053435 865376
+386/9pccpu - 775 sys sys 1189053453 1705749
+386/9pccpu.gz - 664 sys sys 1189053454 736710
+386/9pcdisk - 775 sys sys 1189229899 2230547
+386/9pcdisk.gz - 664 sys sys 1189229899 948797
+386/9pcf - 775 sys sys 1189110563 2704676
+386/9pcf.gz - 664 sys sys 1189110563 1164340
+386/9pxeload - 775 sys sys 1186619809 326380
 386/bin - 20000000775 sys sys 1018897690 0
 386/bin/8a - 775 sys sys 1168402260 116604
 386/bin/8c - 775 sys sys 1188446807 367214
@@ -494,7 +494,7 @@
 386/bin/venti/checkarenas - 775 sys sys 1188447346 158167
 386/bin/venti/checkindex - 775 sys sys 1188447350 154830
 386/bin/venti/clumpstats - 775 sys sys 1188447354 144979
-386/bin/venti/conf - 775 sys sys 1056364399 1506
+386/bin/venti/conf - 775 sys sys 1189304039 1505
 386/bin/venti/copy - 775 sys sys 1189196488 107409
 386/bin/venti/findscore - 775 sys sys 1188447360 127392
 386/bin/venti/fixarenas - 775 sys sys 1189146379 212905
@@ -8142,7 +8142,7 @@ sys/src/9/pc/sd53c8xx.n - 664 sys sys 1131290556 12657
 sys/src/9/pc/sd63xxesb.c - 664 sys sys 1184467400 35975
 sys/src/9/pc/sdata.c - 664 sys sys 1186361525 52991
 sys/src/9/pc/sdmv50xx.c - 664 sys sys 1184467229 33837
-sys/src/9/pc/sdmylex.c - 664 sys sys 1171321627 28237
+sys/src/9/pc/sdmylex.c - 664 sys sys 1189229947 28395
 sys/src/9/pc/sdscsi.c - 664 sys sys 1186618532 7957
 sys/src/9/pc/trap.c - 664 sys sys 1186361997 21898
 sys/src/9/pc/uartaxp.c - 664 sys sys 1166247784 18879
@@ -8245,7 +8245,7 @@ sys/src/9/port/netif.h - 664 sys sys 1187735815 3059
 sys/src/9/port/page.c - 664 sys sys 1131636090 11128
 sys/src/9/port/parse.c - 664 sys sys 1014931177 2026
 sys/src/9/port/pgrp.c - 664 sys sys 1138458260 4760
-sys/src/9/port/portclock.c - 664 sys sys 1146746630 4276
+sys/src/9/port/portclock.c - 664 sys sys 1189292530 4276
 sys/src/9/port/portdat.h - 664 sys sys 1155995676 22703
 sys/src/9/port/portfns.h - 664 sys sys 1178831066 11059
 sys/src/9/port/portmkfile - 664 sys sys 1184737233 2082
@@ -14318,6 +14318,7 @@ sys/src/cmd/venti/srv/clump.c - 664 sys sys 1177189435 5329
 sys/src/cmd/venti/srv/clumpstats.c - 664 sys sys 1142736351 2234
 sys/src/cmd/venti/srv/cmparena.c - 664 sys sys 1142736351 5471
 sys/src/cmd/venti/srv/cmparenas.c - 664 sys sys 1177189435 7215
+sys/src/cmd/venti/srv/conf.rc - 775 sys sys 1189304120 1416
 sys/src/cmd/venti/srv/config.c - 664 sys sys 1178160303 5566
 sys/src/cmd/venti/srv/conv.c - 664 sys sys 1178160303 14052
 sys/src/cmd/venti/srv/dat.h - 664 sys sys 1178160303 19018
@@ -14337,14 +14338,14 @@ sys/src/cmd/venti/srv/hdisk.c - 664 sys sys 1177189437 16510
 sys/src/cmd/venti/srv/httpd.c - 664 sys sys 1177189437 22784
 sys/src/cmd/venti/srv/icache.c - 664 sys sys 1186114652 8778
 sys/src/cmd/venti/srv/icachewrite.c - 664 sys sys 1178160304 7655
-sys/src/cmd/venti/srv/ifile.c - 664 sys sys 1177535026 2327
+sys/src/cmd/venti/srv/ifile.c - 664 sys sys 1189307036 2592
 sys/src/cmd/venti/srv/index.c - 664 sys sys 1178160304 17239
 sys/src/cmd/venti/srv/index2.c - 664 sys sys 1142736354 21620
 sys/src/cmd/venti/srv/lump.c - 664 sys sys 1177189437 5799
 sys/src/cmd/venti/srv/lumpcache.c - 664 sys sys 1177189437 8811
 sys/src/cmd/venti/srv/lumpqueue.c - 664 sys sys 1142736354 2722
 sys/src/cmd/venti/srv/mirrorarenas.c - 664 sys sys 1178160304 10544
-sys/src/cmd/venti/srv/mkfile - 664 sys sys 1188622141 1032
+sys/src/cmd/venti/srv/mkfile - 664 sys sys 1189304068 1243
 sys/src/cmd/venti/srv/part.c - 664 sys sys 1180244694 5662
 sys/src/cmd/venti/srv/png.c - 664 sys sys 1142736354 3729
 sys/src/cmd/venti/srv/printarena.c - 664 sys sys 1177189438 2673
@@ -15741,3 +15742,15 @@ usr/glenda/lib/profile - 664 glenda glenda 1105128663 890
 usr/glenda/readme.acme - 664 glenda glenda 1019860628 4753
 usr/glenda/readme.rio - 664 glenda glenda 1019860628 6370
 usr/glenda/tmp - 20000000775 glenda glenda 1018802620 0
+386/bin/venti/buildindex - 775 sys sys 1189308351 256055
+386/bin/venti/checkarenas - 775 sys sys 1189308356 258524
+386/bin/venti/checkindex - 775 sys sys 1189308360 253893
+386/bin/venti/clumpstats - 775 sys sys 1189308364 242832
+386/bin/venti/findscore - 775 sys sys 1189308368 244853
+386/bin/venti/fmtarenas - 775 sys sys 1189308373 245101
+386/bin/venti/fmtindex - 775 sys sys 1189308378 243099
+386/bin/venti/fmtisect - 775 sys sys 1189308383 243451
+386/bin/venti/printarena - 775 sys sys 1189308388 255140
+386/bin/venti/rdarena - 775 sys sys 1189308392 244527
+386/bin/venti/syncindex - 775 sys sys 1189308396 273834
+386/bin/venti/wrarena - 775 sys sys 1189308401 281541

+ 31 - 30
dist/replica/plan9.db

@@ -1,17 +1,17 @@
 386 - 20000000775 sys sys 1010957353 0
-386/9load - 775 sys sys 1181763625 313856
-386/9loaddebug - 775 sys sys 1188593351 435045
-386/9loadlite - 775 sys sys 1176519517 137148
-386/9loadlitedebug - 775 sys sys 1188593356 220555
-386/9pc - 775 sys sys 1186023393 1937795
-386/9pc.gz - 664 sys sys 1186023393 829787
-386/9pccpu - 775 sys sys 1186023409 1657423
-386/9pccpu.gz - 664 sys sys 1186023409 715891
-386/9pcdisk - 775 sys sys 1186023422 2139974
-386/9pcdisk.gz - 664 sys sys 1186023422 916575
-386/9pcf - 775 sys sys 1186023439 2484444
-386/9pcf.gz - 664 sys sys 1186023440 1072917
-386/9pxeload - 775 sys sys 1181763625 313856
+386/9load - 775 sys sys 1186619808 326380
+386/9loaddebug - 775 sys sys 1186619810 434889
+386/9loadlite - 775 sys sys 1186619809 149672
+386/9loadlitedebug - 775 sys sys 1186619811 220399
+386/9pc - 775 sys sys 1189053434 2038499
+386/9pc.gz - 664 sys sys 1189053435 865376
+386/9pccpu - 775 sys sys 1189053453 1705749
+386/9pccpu.gz - 664 sys sys 1189053454 736710
+386/9pcdisk - 775 sys sys 1189229899 2230547
+386/9pcdisk.gz - 664 sys sys 1189229899 948797
+386/9pcf - 775 sys sys 1189110563 2704676
+386/9pcf.gz - 664 sys sys 1189110563 1164340
+386/9pxeload - 775 sys sys 1186619809 326380
 386/bin - 20000000775 sys sys 1018897690 0
 386/bin/8a - 775 sys sys 1168402260 116604
 386/bin/8c - 775 sys sys 1188446807 367214
@@ -490,27 +490,27 @@
 386/bin/vac - 775 sys sys 1189146367 170972
 386/bin/vacfs - 775 sys sys 1189146374 175780
 386/bin/venti - 20000000775 sys sys 947360466 0
-386/bin/venti/buildindex - 775 sys sys 1188447342 153947
-386/bin/venti/checkarenas - 775 sys sys 1188447346 158167
-386/bin/venti/checkindex - 775 sys sys 1188447350 154830
-386/bin/venti/clumpstats - 775 sys sys 1188447354 144979
-386/bin/venti/conf - 775 sys sys 1056364399 1506
+386/bin/venti/buildindex - 775 sys sys 1189308351 256055
+386/bin/venti/checkarenas - 775 sys sys 1189308356 258524
+386/bin/venti/checkindex - 775 sys sys 1189308360 253893
+386/bin/venti/clumpstats - 775 sys sys 1189308364 242832
+386/bin/venti/conf - 775 sys sys 1189304039 1505
 386/bin/venti/copy - 775 sys sys 1189196488 107409
-386/bin/venti/findscore - 775 sys sys 1188447360 127392
+386/bin/venti/findscore - 775 sys sys 1189308368 244853
 386/bin/venti/fixarenas - 775 sys sys 1189146379 212905
-386/bin/venti/fmtarenas - 775 sys sys 1188447363 129561
+386/bin/venti/fmtarenas - 775 sys sys 1189308373 245101
 386/bin/venti/fmtbloom - 775 sys sys 1189146383 168638
-386/bin/venti/fmtindex - 775 sys sys 1188447367 145233
-386/bin/venti/fmtisect - 775 sys sys 1188447370 146361
+386/bin/venti/fmtindex - 775 sys sys 1189308378 243099
+386/bin/venti/fmtisect - 775 sys sys 1189308383 243451
 386/bin/venti/mirrorarenas - 775 sys sys 1189146390 252345
-386/bin/venti/printarena - 775 sys sys 1188447374 156603
-386/bin/venti/rdarena - 775 sys sys 1188447376 126860
+386/bin/venti/printarena - 775 sys sys 1189308388 255140
+386/bin/venti/rdarena - 775 sys sys 1189308392 244527
 386/bin/venti/read - 775 sys sys 1188447379 103869
 386/bin/venti/sync - 775 sys sys 1188447382 103014
-386/bin/venti/syncindex - 775 sys sys 1188447385 169224
+386/bin/venti/syncindex - 775 sys sys 1189308396 273834
 386/bin/venti/venti - 775 sys sys 1189146402 458760
 386/bin/venti/verifyarena - 775 sys sys 1188447394 103740
-386/bin/venti/wrarena - 775 sys sys 1188447398 175841
+386/bin/venti/wrarena - 775 sys sys 1189308401 281541
 386/bin/venti/write - 775 sys sys 1188447400 103818
 386/bin/vncs - 775 sys sys 1188447411 471527
 386/bin/vncv - 775 sys sys 1188447423 518952
@@ -8142,7 +8142,7 @@ sys/src/9/pc/sd53c8xx.n - 664 sys sys 1131290556 12657
 sys/src/9/pc/sd63xxesb.c - 664 sys sys 1184467400 35975
 sys/src/9/pc/sdata.c - 664 sys sys 1186361525 52991
 sys/src/9/pc/sdmv50xx.c - 664 sys sys 1184467229 33837
-sys/src/9/pc/sdmylex.c - 664 sys sys 1171321627 28237
+sys/src/9/pc/sdmylex.c - 664 sys sys 1189229947 28395
 sys/src/9/pc/sdscsi.c - 664 sys sys 1186618532 7957
 sys/src/9/pc/trap.c - 664 sys sys 1186361997 21898
 sys/src/9/pc/uartaxp.c - 664 sys sys 1166247784 18879
@@ -8245,7 +8245,7 @@ sys/src/9/port/netif.h - 664 sys sys 1187735815 3059
 sys/src/9/port/page.c - 664 sys sys 1131636090 11128
 sys/src/9/port/parse.c - 664 sys sys 1014931177 2026
 sys/src/9/port/pgrp.c - 664 sys sys 1138458260 4760
-sys/src/9/port/portclock.c - 664 sys sys 1146746630 4276
+sys/src/9/port/portclock.c - 664 sys sys 1189292530 4276
 sys/src/9/port/portdat.h - 664 sys sys 1155995676 22703
 sys/src/9/port/portfns.h - 664 sys sys 1178831066 11059
 sys/src/9/port/portmkfile - 664 sys sys 1184737233 2082
@@ -14318,6 +14318,7 @@ sys/src/cmd/venti/srv/clump.c - 664 sys sys 1177189435 5329
 sys/src/cmd/venti/srv/clumpstats.c - 664 sys sys 1142736351 2234
 sys/src/cmd/venti/srv/cmparena.c - 664 sys sys 1142736351 5471
 sys/src/cmd/venti/srv/cmparenas.c - 664 sys sys 1177189435 7215
+sys/src/cmd/venti/srv/conf.rc - 775 sys sys 1189304120 1416
 sys/src/cmd/venti/srv/config.c - 664 sys sys 1178160303 5566
 sys/src/cmd/venti/srv/conv.c - 664 sys sys 1178160303 14052
 sys/src/cmd/venti/srv/dat.h - 664 sys sys 1178160303 19018
@@ -14337,14 +14338,14 @@ sys/src/cmd/venti/srv/hdisk.c - 664 sys sys 1177189437 16510
 sys/src/cmd/venti/srv/httpd.c - 664 sys sys 1177189437 22784
 sys/src/cmd/venti/srv/icache.c - 664 sys sys 1186114652 8778
 sys/src/cmd/venti/srv/icachewrite.c - 664 sys sys 1178160304 7655
-sys/src/cmd/venti/srv/ifile.c - 664 sys sys 1177535026 2327
+sys/src/cmd/venti/srv/ifile.c - 664 sys sys 1189307036 2592
 sys/src/cmd/venti/srv/index.c - 664 sys sys 1178160304 17239
 sys/src/cmd/venti/srv/index2.c - 664 sys sys 1142736354 21620
 sys/src/cmd/venti/srv/lump.c - 664 sys sys 1177189437 5799
 sys/src/cmd/venti/srv/lumpcache.c - 664 sys sys 1177189437 8811
 sys/src/cmd/venti/srv/lumpqueue.c - 664 sys sys 1142736354 2722
 sys/src/cmd/venti/srv/mirrorarenas.c - 664 sys sys 1178160304 10544
-sys/src/cmd/venti/srv/mkfile - 664 sys sys 1188622141 1032
+sys/src/cmd/venti/srv/mkfile - 664 sys sys 1189304068 1243
 sys/src/cmd/venti/srv/part.c - 664 sys sys 1180244694 5662
 sys/src/cmd/venti/srv/png.c - 664 sys sys 1142736354 3729
 sys/src/cmd/venti/srv/printarena.c - 664 sys sys 1177189438 2673

+ 33 - 0
dist/replica/plan9.log

@@ -52678,3 +52678,36 @@
 1189197003 0 c 386/bin/venti/copy - 775 sys sys 1189196488 107409
 1189197003 1 a 386/bin/oventi/copy - 775 sys sys 1189196486 107409
 1189197003 2 c 386/lib/ape/libap.a - 664 sys sys 1189196502 820240
+1189229404 0 c sys/src/9/pc/sdmylex.c - 664 sys sys 1189229311 28395
+1189231205 0 c sys/src/9/pc/sdmylex.c - 664 sys sys 1189229947 28395
+1189254605 0 c sys/src/9/port/portclock.c - 664 sys sys 1189254137 4259
+1189276204 0 c 386/9load - 775 sys sys 1186619808 326380
+1189276204 1 c 386/9loaddebug - 775 sys sys 1186619810 434889
+1189276204 2 c 386/9loadlite - 775 sys sys 1186619809 149672
+1189276204 3 c 386/9loadlitedebug - 775 sys sys 1186619811 220399
+1189276204 4 c 386/9pc - 775 sys sys 1189053434 2038499
+1189276204 5 c 386/9pc.gz - 664 sys sys 1189053435 865376
+1189276204 6 c 386/9pccpu - 775 sys sys 1189053453 1705749
+1189276204 7 c 386/9pccpu.gz - 664 sys sys 1189053454 736710
+1189276204 8 c 386/9pcdisk - 775 sys sys 1189229899 2230547
+1189276204 9 c 386/9pcdisk.gz - 664 sys sys 1189229899 948797
+1189276204 10 c 386/9pcf - 775 sys sys 1189110563 2704676
+1189276204 11 c 386/9pcf.gz - 664 sys sys 1189110563 1164340
+1189276204 12 c 386/9pxeload - 775 sys sys 1186619809 326380
+1189292405 0 c sys/src/9/port/portclock.c - 664 sys sys 1189292530 4276
+1189305004 0 c 386/bin/venti/conf - 775 sys sys 1189304039 1505
+1189305004 1 a sys/src/cmd/venti/srv/conf.rc - 775 sys sys 1189304120 1416
+1189305004 2 c sys/src/cmd/venti/srv/mkfile - 664 sys sys 1189304068 1243
+1189306804 0 c sys/src/cmd/venti/srv/ifile.c - 664 sys sys 1189307036 2592
+1189308603 0 c 386/bin/venti/buildindex - 775 sys sys 1189308351 256055
+1189308603 1 c 386/bin/venti/checkarenas - 775 sys sys 1189308356 258524
+1189308603 2 c 386/bin/venti/checkindex - 775 sys sys 1189308360 253893
+1189308603 3 c 386/bin/venti/clumpstats - 775 sys sys 1189308364 242832
+1189308603 4 c 386/bin/venti/findscore - 775 sys sys 1189308368 244853
+1189308603 5 c 386/bin/venti/fmtarenas - 775 sys sys 1189308373 245101
+1189308603 6 c 386/bin/venti/fmtindex - 775 sys sys 1189308378 243099
+1189308603 7 c 386/bin/venti/fmtisect - 775 sys sys 1189308383 243451
+1189308603 8 c 386/bin/venti/printarena - 775 sys sys 1189308388 255140
+1189308603 9 c 386/bin/venti/rdarena - 775 sys sys 1189308392 244527
+1189308603 10 c 386/bin/venti/syncindex - 775 sys sys 1189308396 273834
+1189308603 11 c 386/bin/venti/wrarena - 775 sys sys 1189308401 281541

+ 12 - 7
sys/src/9/pc/sdmylex.c

@@ -840,6 +840,7 @@ mylexprobe(int port, int irq)
 	Ctlr *ctlr;
 	uchar cmd[6], data[256];
 	int clen, dlen, timeo;
+	static int count;
 
 	if(ioalloc(port, 0x3, 0, "mylex") < 0)
 		return nil;
@@ -893,13 +894,18 @@ buggery:
 	if(issue(ctlr, cmd, clen, data, dlen)){
 		if(data[0] == 'E')
 			ctlr->bus = 32;
-		print("mylex ctlr @ port 0x%ux: 32-bit ", ctlr->port);
 		ctlr->wide = data[0x0D] & 0x01;
+		/*
+		 * devsd doesn't pass us the `spec' argument, so
+		 * we'll assume that sd0 goes to the first scsi host
+		 * adapter found, etc.
+		 */
+		print("#S/sd%d: mylex SCSI: port 0x%ux: %d-bit, ",
+			count++, ctlr->port, ctlr->bus);
 		if (ctlr->wide)
-			print("wide ");
+			print("wide\n");
 		else
-			print("narrow ");
-		print("SCSI host adapter\n");
+			print("narrow\n");
 	}
 	else{
 		/*
@@ -1181,9 +1187,8 @@ mylex32enable(Ctlr* ctlr)
 		cmd[1] = 1;
 		if(!issue(ctlr, cmd, 2, 0, 0)) {
 			ctlr->wide = 0;
-			print(
-"mylex32enable: ctlr @ port 0x%ux: scsi wide-mode setup failed on wide host adapter",
-				ctlr->port);
+			print("mylex32enable: port 0x%ux: scsi wide-mode setup "
+				"failed on wide host adapter", ctlr->port);
 		}
 	}
 

+ 67 - 0
sys/src/cmd/venti/srv/conf.rc

@@ -0,0 +1,67 @@
+#!/bin/rc
+
+# the venti configuration is stored at the 248kB offset in the first index
+# partition and extends for at most 8 kB.
+
+rfork e
+fn usage {
+	echo 'usage: venti/conf [-w] /dev/sdC0/v.arenas' >[1=2]
+	exit usage
+}
+
+wflag=no
+while(! ~ $#* 0 && ~ $1 -* && ! ~ $1 --){
+	switch($1){
+	case -w
+		wflag=yes
+	case *
+		usage
+	}
+	shift
+}
+if(~ $1 --)
+	shift
+
+if(~ $wflag no && ! ~ $#* 1)
+	usage
+if(~ $wflag yes && ! ~ $#* 1 2)
+	usage
+
+disk=$1
+if(! test -f $disk){
+	echo 'unknown disk' $1 >[1=2]
+	exit nodisk
+}
+
+fn sigexit {
+	#rm -f /tmp/venticonf.$pid
+}
+
+if(~ $wflag yes){
+	{echo venti config; cat $2} >/tmp/venticonf.$pid || exit oops
+	if(! test -s /tmp/venticonf.$pid){
+		echo 'config is empty; will not install' >[1=2]
+		exit emptyconfig
+	}
+	if(test `{ls -l /tmp/venticonf.$pid | awk '{print $6}'} -gt 8192){
+		echo 'config is too long; max is a little less than eight kilobytes' >[1=2]
+		exit toolong
+	}
+	dd -quiet 1 -bs 1024 -count 8 -if $disk -iseek 248 \
+		>/tmp/_venticonf.old || exit backup
+	dd -quiet 1 -count 2 </dev/zero >> /tmp/venticonf.$pid || exit dd
+	dd -quiet 1 -bs 1024 -count 8 -if /tmp/venticonf.$pid \
+		-of $disk -trunc 0 -oseek 248 || exit dd2
+	exit 0
+}
+
+dd -quiet 1 -bs 1024 -count 8 -if $disk -iseek 248 |
+	aux/zerotrunc >/tmp/venticonf.$pid
+
+if(! cmp <{sed 1q /tmp/venticonf.$pid} <{echo venti config}){
+	echo 'config has bad header' >[1=2]
+	exit badconfig
+}
+
+sed 1d /tmp/venticonf.$pid
+exit ''

+ 23 - 12
sys/src/cmd/venti/srv/ifile.c

@@ -2,46 +2,57 @@
 #include "dat.h"
 #include "fns.h"
 
+static char vcmagic[] = "venti config\n";
+
+enum {
+	Maxconfig = 8 * 1024,
+	Maglen = sizeof vcmagic - 1,
+};
+
 int
 readifile(IFile *f, char *name)
 {
-	int m;
 	Part *p;
 	ZBlock *b;
 	u8int *z;
-	
+
 	p = initpart(name, OREAD);
 	if(p == nil)
 		return -1;
-	b = alloczblock(8192, 1, 0);
+	b = alloczblock(Maxconfig+1, 1, 0);
 	if(b == nil){
 		seterr(EOk, "can't alloc for %s: %R", name);
 		return -1;
 	}
 	if(p->size > PartBlank){
 		/*
-		 * this is likely a real venti partition, in which case
-		 * we're looking for the config file stored as 8k at end of PartBlank.
+		 * this is likely a real venti partition, in which case we're
+		 * looking for the config file stored as 8k at end of PartBlank.
 		 */
-		if(readpart(p, PartBlank-8192, b->data, 8192) < 0){
+		if(readpart(p, PartBlank-Maxconfig, b->data, Maxconfig) < 0){
 			seterr(EOk, "can't read %s: %r", name);
 			freezblock(b);
 			freepart(p);
 			return -1;
 		}
-		m = 5+1+6+1;
-		if(memcmp(b->data, "venti config\n", m) != 0){
+		b->data[Maxconfig] = '\0';
+		if(memcmp(b->data, vcmagic, Maglen) != 0){
 			seterr(EOk, "bad venti config magic in %s", name);
 			freezblock(b);
 			freepart(p);
 			return -1;
 		}
-		b->data += m;
-		b->len -= m;
-		z = memchr(b->data, 0, b->len);
+		/*
+		 * if we change b->data+b->_size, freezblock
+		 * will blow an assertion, so don't.
+		 */
+		b->data  += Maglen;
+		b->_size -= Maglen;
+		b->len   -= Maglen;
+		z = memchr(b->data, '\0', b->len);
 		if(z)
 			b->len = z - b->data;
-	}else if(p->size > 8192){
+	}else if(p->size > Maxconfig){
 		seterr(EOk, "config file is too large");
 		freepart(p);
 		freezblock(b);

+ 9 - 0
sys/src/cmd/venti/srv/mkfile

@@ -52,6 +52,7 @@ TARG=\
 	checkarenas\
 	checkindex\
 	clumpstats\
+	conf\
 	findscore\
 	fixarenas\
 	fmtarenas\
@@ -86,3 +87,11 @@ $SLIB: $LIBOFILES
 acid:D: lumpcache.acid
 	cat $prereq >$target
 
+$O.conf:D: conf.rc
+	{
+		echo '#!/bin/rc'
+		echo '# THIS FILE IS AUTOMATICALLY GENERATED'
+		echo '# FROM /sys/src/cmd/venti/conf.rc.  DO NOT EDIT.'
+		echo 
+		sed 1d conf.rc
+	} >$target && chmod +x $target