Browse Source

Plan 9 from Bell Labs 2008-04-20

David du Colombier 13 years ago
parent
commit
3d8a6b998d

+ 15 - 14
dist/replica/_plan9.db

@@ -16,7 +16,7 @@
 386/bin/8a - 775 sys sys 1168402260 116604
 386/bin/8c - 775 sys sys 1190520740 367214
 386/bin/8l - 775 sys sys 1148500567 115711
-386/bin/9660srv - 775 sys sys 1206732240 104949
+386/bin/9660srv - 775 sys sys 1208633111 105295
 386/bin/aan - 775 sys sys 1196742429 129831
 386/bin/acid - 775 sys sys 1200262712 405315
 386/bin/acme - 775 sys sys 1200262719 431779
@@ -176,7 +176,7 @@
 386/bin/calendar - 775 sys sys 1200262736 79060
 386/bin/cat - 775 sys sys 1148500611 37482
 386/bin/cb - 775 sys sys 1168402293 77628
-386/bin/cdfs - 775 sys sys 1208201049 173189
+386/bin/cdfs - 775 sys sys 1208576039 173203
 386/bin/cec - 775 sys sys 1193714267 75896
 386/bin/cfs - 775 sys sys 1190863294 130565
 386/bin/chgrp - 775 sys sys 1168402294 59522
@@ -208,7 +208,7 @@
 386/bin/dict - 775 sys sys 1200262746 187908
 386/bin/diff - 775 sys sys 1168402301 85316
 386/bin/disk - 20000000775 sys sys 984788664 0
-386/bin/disk/dump9660 - 775 sys sys 1196742464 152098
+386/bin/disk/dump9660 - 775 sys sys 1208633114 156436
 386/bin/disk/exsort - 775 sys sys 1168402301 60455
 386/bin/disk/fdisk - 775 sys sys 1197732699 104635
 386/bin/disk/format - 775 sys sys 1178568266 89440
@@ -10030,11 +10030,11 @@ sys/src/cmd/cc/sub.c - 664 sys sys 1143759345 34268
 sys/src/cmd/cc/y.tab.h - 664 sys sys 1098501521 1680
 sys/src/cmd/cdfs - 20000000775 sys sys 1039727558 0
 sys/src/cmd/cdfs/buf.c - 664 sys sys 1205271166 1923
-sys/src/cmd/cdfs/dat.h - 664 sys sys 1206046829 4619
+sys/src/cmd/cdfs/dat.h - 664 sys sys 1208632592 4636
 sys/src/cmd/cdfs/fns.h - 664 sys sys 969542122 297
 sys/src/cmd/cdfs/main.c - 664 sys sys 1208195235 12480
 sys/src/cmd/cdfs/mkfile - 664 sys sys 1204937991 153
-sys/src/cmd/cdfs/mmc.c - 664 sys sys 1208555777 31532
+sys/src/cmd/cdfs/mmc.c - 664 sys sys 1208649283 31548
 sys/src/cmd/cec - 20000000775 sys sys 1193683647 0
 sys/src/cmd/cec/LICENSE - 664 sys sys 1186248056 1554
 sys/src/cmd/cec/Protocol - 664 sys sys 1186248056 2881
@@ -10234,25 +10234,25 @@ sys/src/cmd/diff/main.c - 664 sys sys 1134659792 4338
 sys/src/cmd/diff/mkfile - 664 sys sys 944960882 141
 sys/src/cmd/disk - 20000000775 sys sys 1063855285 0
 sys/src/cmd/disk/9660 - 20000000775 sys sys 1039727556 0
-sys/src/cmd/disk/9660/boot.c - 664 sys sys 1017682289 5629
-sys/src/cmd/disk/9660/cdrdwr.c - 664 sys sys 1017679314 11158
-sys/src/cmd/disk/9660/conform.c - 664 sys sys 1015009157 2450
+sys/src/cmd/disk/9660/boot.c - 664 sys sys 1208580434 5631
+sys/src/cmd/disk/9660/cdrdwr.c - 664 sys sys 1208580451 11237
+sys/src/cmd/disk/9660/conform.c - 664 sys sys 1208580591 2470
 sys/src/cmd/disk/9660/direc.c - 664 sys sys 1015009157 4249
-sys/src/cmd/disk/9660/dump.c - 664 sys sys 1021579989 9572
-sys/src/cmd/disk/9660/dump9660.c - 664 sys sys 1077376395 9405
+sys/src/cmd/disk/9660/dump.c - 664 sys sys 1208580585 9610
+sys/src/cmd/disk/9660/dump9660.c - 664 sys sys 1208580570 9511
 sys/src/cmd/disk/9660/ichar.c - 664 sys sys 1021579989 4828
-sys/src/cmd/disk/9660/iso9660.h - 664 sys sys 1077376396 9165
+sys/src/cmd/disk/9660/iso9660.h - 664 sys sys 1208580532 9193
 sys/src/cmd/disk/9660/jchar.c - 664 sys sys 1036474102 3339
 sys/src/cmd/disk/9660/mk9660.rc - 775 sys sys 984788654 144
 sys/src/cmd/disk/9660/mkfile - 664 sys sys 1036474115 493
-sys/src/cmd/disk/9660/path.c - 664 sys sys 1021579989 3643
+sys/src/cmd/disk/9660/path.c - 664 sys sys 1208580490 3684
 sys/src/cmd/disk/9660/plan9.c - 664 sys sys 984788372 423
 sys/src/cmd/disk/9660/rune.c - 664 sys sys 984788372 430
-sys/src/cmd/disk/9660/sysuse.c - 664 sys sys 1195281485 13953
+sys/src/cmd/disk/9660/sysuse.c - 664 sys sys 1208580640 13974
 sys/src/cmd/disk/9660/uid.c - 664 sys sys 984788373 520
 sys/src/cmd/disk/9660/unix.c - 664 sys sys 984788373 1352
 sys/src/cmd/disk/9660/util.c - 664 sys sys 1017679315 1294
-sys/src/cmd/disk/9660/write.c - 664 sys sys 1077376396 8836
+sys/src/cmd/disk/9660/write.c - 664 sys sys 1208580605 8905
 sys/src/cmd/disk/exsort.c - 664 sys sys 944960885 1964
 sys/src/cmd/disk/format.c - 664 sys sys 1134305454 17649
 sys/src/cmd/disk/kfs - 20000000775 sys sys 1065916868 0
@@ -15884,3 +15884,4 @@ 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/cdfs - 775 sys sys 1208662151 173247

+ 14 - 15
dist/replica/plan9.db

@@ -16,7 +16,7 @@
 386/bin/8a - 775 sys sys 1168402260 116604
 386/bin/8c - 775 sys sys 1190520740 367214
 386/bin/8l - 775 sys sys 1148500567 115711
-386/bin/9660srv - 775 sys sys 1206732240 104949
+386/bin/9660srv - 775 sys sys 1208633111 105295
 386/bin/aan - 775 sys sys 1196742429 129831
 386/bin/acid - 775 sys sys 1200262712 405315
 386/bin/acme - 775 sys sys 1200262719 431779
@@ -176,7 +176,7 @@
 386/bin/calendar - 775 sys sys 1200262736 79060
 386/bin/cat - 775 sys sys 1148500611 37482
 386/bin/cb - 775 sys sys 1168402293 77628
-386/bin/cdfs - 775 sys sys 1208201049 173189
+386/bin/cdfs - 775 sys sys 1208662151 173247
 386/bin/cec - 775 sys sys 1193714267 75896
 386/bin/cfs - 775 sys sys 1190863294 130565
 386/bin/chgrp - 775 sys sys 1168402294 59522
@@ -208,7 +208,7 @@
 386/bin/dict - 775 sys sys 1200262746 187908
 386/bin/diff - 775 sys sys 1168402301 85316
 386/bin/disk - 20000000775 sys sys 984788664 0
-386/bin/disk/dump9660 - 775 sys sys 1196742464 152098
+386/bin/disk/dump9660 - 775 sys sys 1208633114 156436
 386/bin/disk/exsort - 775 sys sys 1168402301 60455
 386/bin/disk/fdisk - 775 sys sys 1197732699 104635
 386/bin/disk/format - 775 sys sys 1178568266 89440
@@ -10030,11 +10030,11 @@ sys/src/cmd/cc/sub.c - 664 sys sys 1143759345 34268
 sys/src/cmd/cc/y.tab.h - 664 sys sys 1098501521 1680
 sys/src/cmd/cdfs - 20000000775 sys sys 1039727558 0
 sys/src/cmd/cdfs/buf.c - 664 sys sys 1205271166 1923
-sys/src/cmd/cdfs/dat.h - 664 sys sys 1206046829 4619
+sys/src/cmd/cdfs/dat.h - 664 sys sys 1208632592 4636
 sys/src/cmd/cdfs/fns.h - 664 sys sys 969542122 297
 sys/src/cmd/cdfs/main.c - 664 sys sys 1208195235 12480
 sys/src/cmd/cdfs/mkfile - 664 sys sys 1204937991 153
-sys/src/cmd/cdfs/mmc.c - 664 sys sys 1208555777 31532
+sys/src/cmd/cdfs/mmc.c - 664 sys sys 1208649283 31548
 sys/src/cmd/cec - 20000000775 sys sys 1193683647 0
 sys/src/cmd/cec/LICENSE - 664 sys sys 1186248056 1554
 sys/src/cmd/cec/Protocol - 664 sys sys 1186248056 2881
@@ -10234,25 +10234,25 @@ sys/src/cmd/diff/main.c - 664 sys sys 1134659792 4338
 sys/src/cmd/diff/mkfile - 664 sys sys 944960882 141
 sys/src/cmd/disk - 20000000775 sys sys 1063855285 0
 sys/src/cmd/disk/9660 - 20000000775 sys sys 1039727556 0
-sys/src/cmd/disk/9660/boot.c - 664 sys sys 1017682289 5629
-sys/src/cmd/disk/9660/cdrdwr.c - 664 sys sys 1017679314 11158
-sys/src/cmd/disk/9660/conform.c - 664 sys sys 1015009157 2450
+sys/src/cmd/disk/9660/boot.c - 664 sys sys 1208580434 5631
+sys/src/cmd/disk/9660/cdrdwr.c - 664 sys sys 1208580451 11237
+sys/src/cmd/disk/9660/conform.c - 664 sys sys 1208580591 2470
 sys/src/cmd/disk/9660/direc.c - 664 sys sys 1015009157 4249
-sys/src/cmd/disk/9660/dump.c - 664 sys sys 1021579989 9572
-sys/src/cmd/disk/9660/dump9660.c - 664 sys sys 1077376395 9405
+sys/src/cmd/disk/9660/dump.c - 664 sys sys 1208580585 9610
+sys/src/cmd/disk/9660/dump9660.c - 664 sys sys 1208580570 9511
 sys/src/cmd/disk/9660/ichar.c - 664 sys sys 1021579989 4828
-sys/src/cmd/disk/9660/iso9660.h - 664 sys sys 1077376396 9165
+sys/src/cmd/disk/9660/iso9660.h - 664 sys sys 1208580532 9193
 sys/src/cmd/disk/9660/jchar.c - 664 sys sys 1036474102 3339
 sys/src/cmd/disk/9660/mk9660.rc - 775 sys sys 984788654 144
 sys/src/cmd/disk/9660/mkfile - 664 sys sys 1036474115 493
-sys/src/cmd/disk/9660/path.c - 664 sys sys 1021579989 3643
+sys/src/cmd/disk/9660/path.c - 664 sys sys 1208580490 3684
 sys/src/cmd/disk/9660/plan9.c - 664 sys sys 984788372 423
 sys/src/cmd/disk/9660/rune.c - 664 sys sys 984788372 430
-sys/src/cmd/disk/9660/sysuse.c - 664 sys sys 1195281485 13953
+sys/src/cmd/disk/9660/sysuse.c - 664 sys sys 1208580640 13974
 sys/src/cmd/disk/9660/uid.c - 664 sys sys 984788373 520
 sys/src/cmd/disk/9660/unix.c - 664 sys sys 984788373 1352
 sys/src/cmd/disk/9660/util.c - 664 sys sys 1017679315 1294
-sys/src/cmd/disk/9660/write.c - 664 sys sys 1077376396 8836
+sys/src/cmd/disk/9660/write.c - 664 sys sys 1208580605 8905
 sys/src/cmd/disk/exsort.c - 664 sys sys 944960885 1964
 sys/src/cmd/disk/format.c - 664 sys sys 1134305454 17649
 sys/src/cmd/disk/kfs - 20000000775 sys sys 1065916868 0
@@ -15884,4 +15884,3 @@ 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/cdfs - 775 sys sys 1208576039 173203

+ 15 - 0
dist/replica/plan9.log

@@ -19014,3 +19014,18 @@
 1208574005 1 c sys/src/cmd/9660srv/dat.h - 664 sys sys 1208573849 2131
 1208574005 2 c sys/src/cmd/9660srv/iobuf.c - 664 sys sys 1208573842 3224
 1208574005 3 c sys/src/cmd/9660srv/iso9660.h - 664 sys sys 1208573813 2713
+1208577604 0 c 386/bin/cdfs - 775 sys sys 1208576039 173203
+1208581205 0 c sys/src/cmd/disk/9660/boot.c - 664 sys sys 1208580434 5631
+1208581205 1 c sys/src/cmd/disk/9660/cdrdwr.c - 664 sys sys 1208580451 11237
+1208581205 2 c sys/src/cmd/disk/9660/conform.c - 664 sys sys 1208580591 2470
+1208581205 3 c sys/src/cmd/disk/9660/dump.c - 664 sys sys 1208580585 9610
+1208581205 4 c sys/src/cmd/disk/9660/dump9660.c - 664 sys sys 1208580570 9511
+1208581205 5 c sys/src/cmd/disk/9660/iso9660.h - 664 sys sys 1208580532 9193
+1208581205 6 c sys/src/cmd/disk/9660/path.c - 664 sys sys 1208580490 3684
+1208581205 7 c sys/src/cmd/disk/9660/sysuse.c - 664 sys sys 1208580640 13974
+1208581205 8 c sys/src/cmd/disk/9660/write.c - 664 sys sys 1208580605 8905
+1208633403 0 c 386/bin/9660srv - 775 sys sys 1208633111 105295
+1208633403 1 c 386/bin/disk/dump9660 - 775 sys sys 1208633114 156436
+1208633403 2 c sys/src/cmd/cdfs/dat.h - 664 sys sys 1208632592 4636
+1208649604 0 c sys/src/cmd/cdfs/mmc.c - 664 sys sys 1208649283 31548
+1208662204 0 c 386/bin/cdfs - 775 sys sys 1208662151 173247

+ 1 - 1
sys/src/cmd/cdfs/dat.h

@@ -124,7 +124,7 @@ struct Track
 	ulong	mtime;
 };
 
-struct DTrack
+struct DTrack			/* not used */
 {
 	uchar	name[32];
 	uchar	beg[4];		/* msf value; only used for audio */

+ 7 - 8
sys/src/cmd/cdfs/mmc.c

@@ -467,10 +467,10 @@ static char *tracktype[] = {
 static int
 mmctrackinfo(Drive *drive, int t, int i)
 {
-	uchar cmd[10], resp[255];
 	int n, type, bs;
-	uchar tmode;
 	ulong beg, size;
+	uchar tmode;
+	uchar cmd[10], resp[255];
 	Mmcaux *aux;
 
 	aux = drive->aux;
@@ -747,10 +747,8 @@ mmcinfertracks(Drive *drive, int first, int last)
 		t = &drive->track[i-first];
 		t->end = tot;
 		tot = t->beg;
-		if(t->end <= t->beg) {
-			t->beg = 0;
-			t->end = 0;
-		}
+		if(t->end <= t->beg)
+			t->beg = t->end = 0;
 		/* -2: skip lead out */
 		t->size = (t->end - t->beg - 2) * (vlong)t->bs;
 	}
@@ -956,13 +954,14 @@ mmcsetbs(Drive *drive, int bs)
 	return 0;
 }
 
+/* off is a block number */
 static long
 mmcread(Buf *buf, void *v, long nblock, long off)
 {
-	Drive *drive;
 	int bs;
-	uchar cmd[12];
 	long n, nn;
+	uchar cmd[12];
+	Drive *drive;
 	Otrack *o;
 
 	o = buf->otrack;

+ 2 - 2
sys/src/cmd/disk/9660/boot.c

@@ -114,7 +114,7 @@ Cputbootvol(Cdimg *cd)
 void
 Cupdatebootvol(Cdimg *cd)
 {
-	ulong o;
+	uvlong o;
 
 	o = Cwoffset(cd);
 	Cwseek(cd, cd->bootcatptr);
@@ -148,7 +148,7 @@ Cputbootcat(Cdimg *cd)
 void
 Cupdatebootcat(Cdimg *cd)
 {
-	ulong o;
+	uvlong o;
 
 	if(cd->bootdirec == nil)
 		return;

+ 15 - 11
sys/src/cmd/disk/9660/cdrdwr.c

@@ -184,10 +184,12 @@ Creadblock(Cdimg *cd, void *buf, ulong block, ulong len)
 	assert(block != 0);	/* nothing useful there */
 
 	Bflush(&cd->bwr);
-	if(Bseek(&cd->brd, block*Blocksize, 0) != block*Blocksize)
+	if(Bseek(&cd->brd, (vlong)block * Blocksize, 0) !=
+	    (vlong)block * Blocksize)
 		sysfatal("error seeking to block %lud", block);
 	if(Bread(&cd->brd, buf, len) != len)
-		sysfatal("error reading %lud bytes at block %lud: %r %lld", len, block, Bseek(&cd->brd, 0, 2));
+		sysfatal("error reading %lud bytes at block %lud: %r %lld",
+			len, block, Bseek(&cd->brd, 0, 2));
 }
 
 int
@@ -260,7 +262,8 @@ setroot(Cdimg *cd, ulong block, ulong dloc, ulong dlen)
 {
 	assert(block != 0);
 
-	Cwseek(cd, block*Blocksize+offsetof(Cvoldesc, rootdir[0])+offsetof(Cdir, dloc[0]));
+	Cwseek(cd, (vlong)block * Blocksize + offsetof(Cvoldesc, rootdir[0]) +
+		offsetof(Cdir, dloc[0]));
 	Cputn(cd, dloc, 4);
 	Cputn(cd, dlen, 4);
 }
@@ -270,7 +273,7 @@ setvolsize(Cdimg *cd, ulong block, ulong size)
 {
 	assert(block != 0);
 
-	Cwseek(cd, block*Blocksize+offsetof(Cvoldesc, volsize[0]));
+	Cwseek(cd, (vlong)block * Blocksize + offsetof(Cvoldesc, volsize[0]));
 	Cputn(cd, size, 4);
 }
 
@@ -279,13 +282,14 @@ setpathtable(Cdimg *cd, ulong block, ulong sz, ulong lloc, ulong bloc)
 {
 	assert(block != 0);
 
-	Cwseek(cd, block*Blocksize+offsetof(Cvoldesc, pathsize[0]));
+	Cwseek(cd, (vlong)block * Blocksize + offsetof(Cvoldesc, pathsize[0]));
 	Cputn(cd, sz, 4);
 	Cputnl(cd, lloc, 4);
 	Cputnl(cd, 0, 4);
 	Cputnm(cd, bloc, 4);
 	Cputnm(cd, 0, 4);
-	assert(Cwoffset(cd) == block*Blocksize+offsetof(Cvoldesc, rootdir[0]));
+	assert(Cwoffset(cd) == (vlong)block * Blocksize +
+		offsetof(Cvoldesc, rootdir[0]));
 }
 
 
@@ -566,12 +570,12 @@ Cputdate1(Cdimg *cd, ulong ust)
 }
 
 void
-Cwseek(Cdimg *cd, ulong offset)
+Cwseek(Cdimg *cd, vlong offset)
 {
 	Bseek(&cd->bwr, offset, 0);
 }
 
-ulong
+uvlong
 Cwoffset(Cdimg *cd)
 {
 	return Boffset(&cd->bwr);
@@ -583,14 +587,14 @@ Cwflush(Cdimg *cd)
 	Bflush(&cd->bwr);
 }
 
-ulong
+uvlong
 Croffset(Cdimg *cd)
 {
 	return Boffset(&cd->brd);
 }
 
 void
-Crseek(Cdimg *cd, ulong offset)
+Crseek(Cdimg *cd, vlong offset)
 {
 	Bseek(&cd->brd, offset, 0);
 }
@@ -602,7 +606,7 @@ Cgetc(Cdimg *cd)
 
 	Cwflush(cd);
 	if((c = Bgetc(&cd->brd)) == Beof) {
-		fprint(2, "getc at %lud\n", Croffset(cd));
+		fprint(2, "getc at %llud\n", Croffset(cd));
 		assert(0);
 		//sysfatal("Bgetc: %r");
 	}

+ 4 - 4
sys/src/cmd/disk/9660/conform.c

@@ -115,7 +115,7 @@ badatomcmp(const void *va, const void *vb)
 }
 
 void
-wrconform(Cdimg *cd, int n, ulong *pblock, ulong *plength)
+wrconform(Cdimg *cd, int n, ulong *pblock, uvlong *plength)
 {
 	char buf[1024];
 	int i;
@@ -128,14 +128,14 @@ wrconform(Cdimg *cd, int n, ulong *pblock, ulong *plength)
 		return;
 	}
 
-	Cwseek(cd, cd->nextblock*Blocksize);
+	Cwseek(cd, (vlong)cd->nextblock * Blocksize);
 	qsort(c->t, c->nt, sizeof(c->t[0]), goodcmp);
 	for(i=n; i<c->nt; i++) {
 		snprint(buf, sizeof buf, "%s %s\n", c->t[i].good, c->t[i].bad);
 		Cwrite(cd, buf, strlen(buf));
 	}
 	qsort(c->t, c->nt, sizeof(c->t[0]), badatomcmp);
-	*plength = Cwoffset(cd) - *pblock*Blocksize;
-	chat("write _conform.map at %lud+%lud\n", *pblock, *plength);
+	*plength = Cwoffset(cd) - (vlong)*pblock * Blocksize;
+	chat("write _conform.map at %lud+%llud\n", *pblock, *plength);
 	Cpadblock(cd);
 }

+ 6 - 5
sys/src/cmd/disk/9660/dump.c

@@ -384,9 +384,9 @@ static char magic[] = "plan 9 dump cd\n";
 ulong
 Cputdumpblock(Cdimg *cd)
 {
-	ulong x;
+	uvlong x;
 
-	Cwseek(cd, cd->nextblock*Blocksize);
+	Cwseek(cd, (vlong)cd->nextblock * Blocksize);
 	x = Cwoffset(cd);
 	Cwrite(cd, magic, sizeof(magic)-1);
 	Cpadblock(cd);
@@ -466,8 +466,9 @@ readdumpconform(Cdimg *cd)
 {
 	char buf[Blocksize];
 	char *p, *q, *f[10];
-	ulong cb, nc, m, db;
 	int nf;
+	ulong cb, nc, db;
+	uvlong m;
 
 	db = hasdump(cd);
 	assert(map==nil || map->nt == 0);
@@ -493,8 +494,8 @@ readdumpconform(Cdimg *cd)
 		cb = strtoul(f[3], 0, 0);
 		nc = strtoul(f[4], 0, 0);
 
-		Crseek(cd, cb*Blocksize);
-		m = cb*Blocksize+nc;
+		Crseek(cd, (vlong)cb * Blocksize);
+		m = (vlong)cb * Blocksize + nc;
 		while(Croffset(cd) < m && (p = Crdline(cd, '\n')) != nil){
 			p[Clinelen(cd)-1] = '\0';
 			if(tokenize(p, f, 2) != 2 || (f[0][0] != 'D' && f[0][0] != 'F')

+ 22 - 21
sys/src/cmd/disk/9660/dump9660.c

@@ -10,7 +10,7 @@ int chatty;
 int doabort;
 int docolon;
 int mk9660;
-int dataoffset;
+vlong dataoffset;
 int blocksize;
 Conform *map;
 
@@ -29,12 +29,14 @@ usage(void)
 	exits("usage");
 }
 
-int
+void
 main(int argc, char **argv)
 {
 	int fix;
+	ulong block, newnull, cblock;
+	vlong maxsize;
+	uvlong length, clength;
 	char buf[256], *dumpname, *proto, *s, *src, *status;
-	ulong block, length, newnull, cblock, clength, maxsize;
 	Cdimg *cd;
 	Cdinfo info;
 	XDir dir;
@@ -94,10 +96,10 @@ main(int argc, char **argv)
 		now = atoi(EARGF(usage()));
 		break;
 	case 'm':
-		maxsize = strtoul(EARGF(usage()), 0, 0);
+		maxsize = strtoull(EARGF(usage()), 0, 0);
 		break;
 	case 'o':
-		dataoffset = atoi(EARGF(usage()));
+		dataoffset = atoll(EARGF(usage()));
 		blocksize = atoi(EARGF(usage()));
 		if(blocksize%Blocksize)
 			sysfatal("bad block size %d -- must be multiple of 2048", blocksize);
@@ -174,7 +176,7 @@ main(int argc, char **argv)
 			dumpname = nil;
 			cd->nextblock = cd->nulldump+1;
 			cd->nulldump = 0;
-			Cwseek(cd, cd->nextblock*Blocksize);
+			Cwseek(cd, (vlong)cd->nextblock * Blocksize);
 			goto Dofix;
 		}
 	
@@ -194,9 +196,9 @@ main(int argc, char **argv)
  	 * Must be done before creation of the Joliet tree so that
  	 * blocks and lengths are correct.
 	 */
-	if(dataoffset > cd->nextblock*Blocksize)
+	if(dataoffset > (vlong)cd->nextblock * Blocksize)
 		cd->nextblock = (dataoffset+Blocksize-1)/Blocksize;
-	Cwseek(cd, cd->nextblock*Blocksize);
+	Cwseek(cd, (vlong)cd->nextblock * Blocksize);
 	writefiles(dump, cd, &iroot);
 
 	if(cd->bootimage){
@@ -302,10 +304,11 @@ Dofix:
 		 * Patch in root directories.
 		 */
 		setroot(cd, cd->iso9660pvd, iroot.block, iroot.length);
-		setvolsize(cd, cd->iso9660pvd, cd->nextblock*Blocksize);
+		setvolsize(cd, cd->iso9660pvd, (vlong)cd->nextblock * Blocksize);
 		if(cd->flags & CDjoliet){
 			setroot(cd, cd->jolietsvd, jroot.block, jroot.length);
-			setvolsize(cd, cd->jolietsvd, cd->nextblock*Blocksize);
+			setvolsize(cd, cd->jolietsvd,
+				(vlong)cd->nextblock * Blocksize);
 		}
 	}else{
 		/*
@@ -335,10 +338,11 @@ Dofix:
 		 * Patch in new root directory entry.
 		 */
 		setroot(cd, cd->iso9660pvd, idumproot.block, idumproot.length);
-		setvolsize(cd, cd->iso9660pvd, cd->nextblock*Blocksize);
+		setvolsize(cd, cd->iso9660pvd, (vlong)cd->nextblock * Blocksize);
 		if(cd->flags & CDjoliet){
 			setroot(cd, cd->jolietsvd, jdumproot.block, jdumproot.length);
-			setvolsize(cd, cd->jolietsvd, cd->nextblock*Blocksize);
+			setvolsize(cd, cd->jolietsvd,
+				(vlong)cd->nextblock * Blocksize);
 		}
 	}
 	writepathtables(cd);	
@@ -358,7 +362,7 @@ Dofix:
 	
 			cd->nextblock = cd->nulldump+1;
 			cd->nulldump = 0;
-			Cwseek(cd, cd->nextblock*Blocksize);
+			Cwseek(cd, (vlong)cd->nextblock * Blocksize);
 			goto Dofix;
 		}
 	
@@ -366,11 +370,11 @@ Dofix:
 		 * Write old null header block; this commits all our changes.
 		 */
 		if(cd->nulldump){
-			Cwseek(cd, cd->nulldump*Blocksize);
+			Cwseek(cd, (vlong)cd->nulldump * Blocksize);
 			sprint(buf, "plan 9 dump cd\n");
-			sprint(buf+strlen(buf), "%s %lud %lud %lud %lud %lud %lud",
-				dumpname, now, newnull, cblock, clength, iroot.block,
-				iroot.length);
+			sprint(buf+strlen(buf), "%s %lud %lud %lud %llud %lud %lud",
+				dumpname, now, newnull, cblock, clength,
+				iroot.block, iroot.length);
 			if(cd->flags & CDjoliet)
 				sprint(buf+strlen(buf), " %lud %lud",
 					jroot.block, jroot.length);
@@ -380,9 +384,8 @@ Dofix:
 			Cwflush(cd);
 		}
 	}
-	fdtruncate(cd->fd, cd->nextblock*Blocksize);
+	fdtruncate(cd->fd, (vlong)cd->nextblock * Blocksize);
 	exits(status);
-	return 0;
 }
 
 static void
@@ -408,6 +411,4 @@ addprotofile(char *new, char *old, Dir *d, void *a)
 	}
 	if(name)
 		free(name);
-
 }
-

+ 13 - 13
sys/src/cmd/disk/9660/iso9660.h

@@ -108,12 +108,12 @@ struct Cdimg {
 	ulong iso9660pvd;
 	ulong jolietsvd;
 	ulong pathblock;
-	ulong rrcontin; /* rock ridge continuation offset */
-	ulong nulldump;	/* next dump block */
-	ulong nconform;	/* number of conform entries written already */
-	ulong bootcatptr;
+	uvlong rrcontin;	/* rock ridge continuation offset */
+	ulong nulldump;		/* next dump block */
+	ulong nconform;		/* number of conform entries written already */
+	uvlong bootcatptr;
 	ulong bootcatblock;
-	ulong bootimageptr;
+	uvlong bootimageptr;
 	Direc *bootdirec;
 	char *bootimage;
 	
@@ -158,9 +158,9 @@ struct Cdinfo {
 	char *bootimage;
 };
 
-enum {
-	Blocklen = 2048,
-};
+//enum {
+//	Blocklen = 2048,		/* unused */
+//};
 
 /*
  * This is a doubly binary tree.
@@ -321,18 +321,18 @@ void Cputdate(Cdimg*, ulong);
 void Cputdate1(Cdimg*, ulong);
 void Cread(Cdimg*, void*, int);
 void Cwflush(Cdimg*);
-void Cwseek(Cdimg*, ulong);
-ulong Cwoffset(Cdimg*);
-ulong Croffset(Cdimg*);
+void Cwseek(Cdimg*, vlong);
+uvlong Cwoffset(Cdimg*);
+uvlong Croffset(Cdimg*);
 int Cgetc(Cdimg*);
-void Crseek(Cdimg*, ulong);
+void Crseek(Cdimg*, vlong);
 char *Crdline(Cdimg*, int);
 int Clinelen(Cdimg*);
 
 /* conform.c */
 void rdconform(Cdimg*);
 char *conform(char*, int);
-void wrconform(Cdimg*, int, ulong*, ulong*);
+void wrconform(Cdimg*, int, ulong*, uvlong*);
 
 /* direc.c */
 void mkdirec(Direc*, XDir*);

+ 11 - 7
sys/src/cmd/disk/9660/path.c

@@ -86,17 +86,18 @@ writepathtable(Cdimg *cd, ulong vdblock, int size)
 {
 	int rp, wp;
 	uchar buf[Blocksize];
-	ulong bk, end, i, *len, n, rdoff, start;
+	ulong bk, i, *len, n;
+	uvlong start, end, rdoff;
 	Cdir *c;
 	Cpath p;
 
 	Creadblock(cd, buf, vdblock, Blocksize);
-	c = (Cdir*)(buf+offsetof(Cvoldesc, rootdir[0]));
+	c = (Cdir*)(buf + offsetof(Cvoldesc, rootdir[0]));
 
 	rp = 0;
 	wp = 0;
 	len = nil;
-	start = cd->nextblock*Blocksize;
+	start = (vlong)cd->nextblock * Blocksize;
 	Cwseek(cd, start);
 	Crseek(cd, start);
 	writepath(cd, c, 1, size);
@@ -112,10 +113,13 @@ writepathtable(Cdimg *cd, ulong vdblock, int size)
 		for(i=0; i<n; i++) {
 			Creadblock(cd, buf, bk+i, Blocksize);
 			c = (Cdir*)buf;
-			if(i != 0 && c->namelen == 1 && c->name[0] == '\0')	/* hit another directory; stop */
-				break;
-			while(c->len && c->namelen && (uchar*)c+c->len < buf+Blocksize) {
-				if((c->flags & 0x02) && (c->namelen > 1 || c->name[0] > '\001')) {	/* directory */
+			if(i != 0 && c->namelen == 1 && c->name[0] == '\0')
+				break;	/* hit another directory; stop */
+			while(c->len && c->namelen &&
+			    (uchar*)c + c->len < buf + Blocksize) {
+				if(c->flags & 0x02 &&
+				    (c->namelen > 1 || c->name[0] > '\001')) {
+					/* directory */
 					writepath(cd, c, rp, size);
 					len = addlength(len, little(c->dlen, 4), wp);
 					wp++;

+ 14 - 12
sys/src/cmd/disk/9660/sysuse.c

@@ -15,7 +15,7 @@
 static long mode(Direc*, int);
 static long nlink(Direc*);
 static ulong suspdirflags(Direc*, int);
-static ulong CputsuspCE(Cdimg *cd, ulong offset);
+static ulong CputsuspCE(Cdimg *cd, vlong offset);
 static int CputsuspER(Cdimg*, int);
 static int CputsuspRR(Cdimg*, int, int);
 static int CputsuspSP(Cdimg*, int);
@@ -29,9 +29,9 @@ static int CputrripTF(Cdimg*, Direc*, int, int);
  * Patch the length field in a CE record.
  */
 static void
-setcelen(Cdimg *cd, ulong woffset, ulong len)
+setcelen(Cdimg *cd, vlong woffset, ulong len)
 {
-	ulong o;
+	vlong o;
 
 	o = Cwoffset(cd);
 	Cwseek(cd, woffset);
@@ -64,8 +64,8 @@ setcelen(Cdimg *cd, ulong woffset, ulong len)
  */
 typedef struct Cbuf Cbuf;
 struct Cbuf {
-	int len;	/* written so far, of 254-28 */
-	ulong ceoffset;
+	int	len;		/* written so far, of 254-28 */
+	uvlong	ceoffset;
 };
 
 static int
@@ -77,7 +77,7 @@ freespace(Cbuf *cp)
 static Cbuf*
 ensurespace(Cdimg *cd, int n, Cbuf *co, Cbuf *cn, int dowrite)
 {
-	ulong end;
+	uvlong end;
 
 	if(co->len+n <= 254-28) {
 		co->len += n;
@@ -120,7 +120,7 @@ ensurespace(Cdimg *cd, int n, Cbuf *co, Cbuf *cn, int dowrite)
 	 */
 	if(cd->rrcontin%Blocksize == 0
 	|| cd->rrcontin/Blocksize != (cd->rrcontin+256)/Blocksize) {
-		cd->rrcontin = cd->nextblock*Blocksize;
+		cd->rrcontin = (vlong)cd->nextblock * Blocksize;
 		cd->nextblock++;
 	}
 
@@ -174,7 +174,7 @@ Cputsysuse(Cdimg *cd, Direc *d, int dot, int dowrite, int initlen)
 {
 	char buf[256], buf0[256], *nextpath, *p, *path, *q;
 	int flags, free, m, what;
-	ulong o;
+	uvlong o;
 	Cbuf cn, co, *cp;
 
 	assert(cd != nil);
@@ -307,7 +307,8 @@ Cputsysuse(Cdimg *cd, Direc *d, int dot, int dowrite, int initlen)
 
 	if(dowrite) {
 		if(Cwoffset(cd) != o+co.len-initlen)
-			fprint(2, "offset %lud o+co.len-initlen %lud\n", Cwoffset(cd), o+co.len-initlen);
+			fprint(2, "offset %llud o+co.len-initlen %llud\n",
+				Cwoffset(cd), o+co.len-initlen);
 		assert(Cwoffset(cd) == o+co.len-initlen);
 	} else
 		assert(Cwoffset(cd) == o);
@@ -321,11 +322,12 @@ static char SUSPdesc[84] = "RRIP <more garbage here>";
 static char SUSPsrc[135] = "RRIP <more garbage here>";
 
 static ulong
-CputsuspCE(Cdimg *cd, ulong offset)
+CputsuspCE(Cdimg *cd, vlong offset)
 {
-	ulong o, x;
+	vlong o, x;
 
-	chat("writing SUSP CE record pointing to %ld, %ld\n", offset/Blocksize, offset%Blocksize);
+	chat("writing SUSP CE record pointing to %ld, %ld\n",
+		offset/Blocksize, offset%Blocksize);
 	o = Cwoffset(cd);
 	Cputc(cd, 'C');
 	Cputc(cd, 'E');

+ 9 - 9
sys/src/cmd/disk/9660/write.c

@@ -27,7 +27,7 @@ rewritedot(Cdimg *cd, Direc *d)
 	writelittlebig4(c->dloc, d->block);
 	writelittlebig4(c->dlen, d->length);
 
-	Cwseek(cd, d->block*Blocksize);
+	Cwseek(cd, (vlong)d->block * Blocksize);
 	Cwrite(cd, buf, Blocksize);
 }
 
@@ -49,7 +49,7 @@ rewritedotdot(Cdimg *cd, Direc *d, Direc *dparent)
 	writelittlebig4(c->dloc, dparent->block);
 	writelittlebig4(c->dlen, dparent->length);
 
-	Cwseek(cd, d->block*Blocksize);
+	Cwseek(cd, (vlong)d->block * Blocksize);
 	Cwrite(cd, buf, Blocksize);
 }
 
@@ -91,7 +91,7 @@ writefiles(Dump *d, Cdimg *cd, Direc *direc)
 	if(blocksize && start%blocksize)
 		start += blocksize-start%blocksize;
 
-	Cwseek(cd, start*Blocksize);
+	Cwseek(cd, (vlong)start * Blocksize);
 	
 	s = md5(nil, 0, nil, nil);
 	length = 0;
@@ -153,7 +153,7 @@ _writedirs(Cdimg *cd, Direc *d, int (*put)(Cdimg*, Direc*, int, int, int), int l
 	cd->nextblock += (l+Blocksize-1)/Blocksize;
 	next = cd->nextblock;
 
-	Cwseek(cd, start*Blocksize);
+	Cwseek(cd, (vlong)start * Blocksize);
 	ll = 0;
 	ll += put(cd, d, (level == 0) ? DTrootdot : DTdot, 1, ll);
 	ll += put(cd, nil, DTdotdot, 1, ll);
@@ -161,10 +161,10 @@ _writedirs(Cdimg *cd, Direc *d, int (*put)(Cdimg*, Direc*, int, int, int), int l
 		ll += put(cd, &d->child[i], DTiden, 1, ll);
 	assert(ll == l);
 	Cpadblock(cd);
-	assert(Cwoffset(cd) == next*Blocksize);
+	assert(Cwoffset(cd) == (vlong)next * Blocksize);
 
 	d->block = start;
-	d->length = (next - start) * Blocksize;
+	d->length = (vlong)(next - start) * Blocksize;
 	rewritedot(cd, d);
 	rewritedotdot(cd, d, d);
 
@@ -215,7 +215,7 @@ _writedumpdirs(Cdimg *cd, Direc *d, int (*put)(Cdimg*, Direc*, int, int, int), i
 
 	Writedir:
 		start = cd->nextblock;
-		Cwseek(cd, start*Blocksize);
+		Cwseek(cd, (vlong)start * Blocksize);
 
 		put(cd, d, (level == 0) ? DTrootdot : DTdot, 1, Cwoffset(cd));
 		put(cd, nil, DTdotdot, 1, Cwoffset(cd));
@@ -224,7 +224,7 @@ _writedumpdirs(Cdimg *cd, Direc *d, int (*put)(Cdimg*, Direc*, int, int, int), i
 		Cpadblock(cd);
 
 		d->block = start;
-		d->length = (cd->nextblock - start) * Blocksize;
+		d->length = (vlong)(cd->nextblock - start) * Blocksize;
 
 		rewritedot(cd, d);
 		rewritedotdot(cd, d, d);
@@ -303,7 +303,7 @@ static int
 genputdir(Cdimg *cd, Direc *d, int dot, int joliet, int dowrite, int offset)
 {
 	int f, n, l, lp;
-	long o;
+	vlong o;
 
 	f = 0;
 	if(dot != DTiden || (d->mode & DMDIR))