Przeglądaj źródła

Plan 9 from Bell Labs 2010-05-26

David du Colombier 14 lat temu
rodzic
commit
6b92de566d

+ 5 - 3
sys/lib/dist/mkfile

@@ -15,7 +15,7 @@ cd-dist:V: /n/other/dist/plan9.iso.bz2
 	mk $dist/web.protect/plan9.iso.bz2
 
 contrib-cd:V: /n/other/dist/contrib.iso.bz2
-#	mk $dist/web.protect/contrib.iso.bz2
+	mk $dist/web.protect/contrib.iso.bz2
 
 /n/other/dist/%.iso:D: /n/sources/plan9/dist/replica/plan9.log
 	@{cd pc; mk cddisk; cd ..}
@@ -141,10 +141,12 @@ reencode:V:
 		-p ./contrib.proto $target
 
 rebuild:V:
-	rebuild
+	chmod +l build.lock >>build.lock
+	rebuild <build.lock
 
 rebuild-mail:V:
-	rebuild
+	chmod +l build.lock >>build.lock
+	rebuild <build.lock
 	datemail 'nightly build errors' 9trouble <buildit.out
 	datemail 'nightly build differences' 9trouble <checkbuild.out
 	status=''

+ 5 - 0
sys/src/9/pc/screen.c

@@ -363,6 +363,11 @@ hwdraw(Memdrawparam *par)
 		return 0;
 
 	if(scr->cur == &swcursor){
+		/*
+		 * always calling swcursorhide here doesn't cure
+		 * leaving cursor tracks nor failing to refresh menus
+		 * with the latest libmemdraw/draw.c.
+		 */
 		if(dst->data->bdata == gscreendata.bdata)
 			swcursoravoid(par->r);
 		if(src->data->bdata == gscreendata.bdata)

+ 24 - 14
sys/src/9/pc/sdiahci.c

@@ -112,6 +112,7 @@ typedef struct {
 	uchar	smartrs;
 
 	uvlong	sectors;
+	ulong	secsize;
 	ulong	intick;		/* start tick of current transfer */
 	ulong	lastseen;
 	int	wait;
@@ -912,14 +913,17 @@ identify(Drive *d)
 	osectors = d->sectors;
 	memmove(oserial, d->serial, sizeof d->serial);
 
+	u = d->unit;
 	d->sectors = s;
+	d->secsize = u->secsize;
+	if(d->secsize == 0)
+		d->secsize = 512;		/* default */
 	d->smartrs = 0;
 
 	idmove(d->serial, id+10, 20);
 	idmove(d->firmware, id+23, 8);
 	idmove(d->model, id+27, 40);
 
-	u = d->unit;
 	memset(u->inquiry, 0, sizeof u->inquiry);
 	u->inquiry[2] = 2;
 	u->inquiry[3] = 2;
@@ -1109,7 +1113,7 @@ resetdisk(Drive *d)
 static int
 newdrive(Drive *d)
 {
-	char *name, *s;
+	char *name;
 	Aportc *c;
 	Aportm *m;
 
@@ -1143,12 +1147,9 @@ newdrive(Drive *d)
 
 	qunlock(c->m);
 
-	s = "";
-	if(m->feat & Dllba)
-		s = "L";
-	idprint("%s: %sLBA %,llud sectors\n", d->unit->name, s, d->sectors);
-	idprint("  %s %s %s %s\n", d->model, d->firmware, d->serial,
-		d->mediachange? "[mediachange]": "");
+	idprint("%s: %sLBA %,llud sectors: %s %s %s %s\n", d->unit->name,
+		(m->feat & Dllba? "L": ""), d->sectors, d->model, d->firmware,
+		d->serial, d->mediachange? "[mediachange]": "");
 	return 0;
 
 lose:
@@ -1436,7 +1437,7 @@ iaonline(SDunit *unit)
 		d->mediachange = 0;
 		/* devsd resets this after online is called; why? */
 		unit->sectors = d->sectors;
-		unit->secsize = 512;	/* TODO */
+		unit->secsize = 512;		/* default size */
 	} else if(d->state == Dready)
 		r = 1;
 	iunlock(d);
@@ -1445,14 +1446,16 @@ iaonline(SDunit *unit)
 
 /* returns locked list! */
 static Alist*
-ahcibuild(Aportm *m, uchar *cmd, void *data, int n, vlong lba)
+ahcibuild(Drive *d, uchar *cmd, void *data, int n, vlong lba)
 {
 	uchar *c, acmd, dir, llba;
 	Alist *l;
 	Actab *t;
+	Aportm *m;
 	Aprdt *p;
 	static uchar tab[2][2] = { 0xc8, 0x25, 0xca, 0x35, };
 
+	m = &d->portm;
 	dir = *cmd != 0x28;
 	llba = m->feat&Dllba? 1: 0;
 	acmd = tab[dir][llba];
@@ -1495,7 +1498,9 @@ ahcibuild(Aportm *m, uchar *cmd, void *data, int n, vlong lba)
 	p = &t->prdt;
 	p->dba = PCIWADDR(data);
 	p->dbahi = 0;
-	p->count = 1<<31 | (512*n - 2) | 1;
+	if(d->unit == nil)
+		panic("ahcibuild: nil d->unit");
+	p->count = 1<<31 | (d->unit->secsize*n - 2) | 1;
 
 	return l;
 }
@@ -1752,7 +1757,7 @@ retry:
 		n = count;
 		if(n > max)
 			n = max;
-		ahcibuild(&d->portm, cmd, data, n, lba);
+		ahcibuild(d, cmd, data, n, lba);
 		switch(waitready(d)){
 		case -1:
 			qunlock(&d->portm);
@@ -2003,8 +2008,11 @@ iarctl(SDunit *u, char *p, int l)
 	Ctlr *c;
 	Drive *d;
 
-	if((c = u->dev->ctlr) == nil)
+	c = u->dev->ctlr;
+	if(c == nil) {
+print("iarctl: nil u->dev->ctlr\n");
 		return 0;
+	}
 	d = c->drive[u->subno];
 	o = d->port;
 
@@ -2029,7 +2037,9 @@ iarctl(SDunit *u, char *p, int l)
 	p = seprint(p, e, "reg\ttask %lux cmd %lux serr %lux %s ci %lux is %lux; "
 		"sig %lux sstatus %04lux\n", o->task, o->cmd, o->serror, buf,
 		o->ci, o->isr, o->sig, o->sstatus);
-	p = seprint(p, e, "geometry %llud 512\n", d->sectors); /* TODO */
+	if(d->unit == nil)
+		panic("iarctl: nil d->unit");
+	p = seprint(p, e, "geometry %llud %lud\n", d->sectors, d->unit->secsize);
 	return p - op;
 }
 

+ 7 - 10
sys/src/boot/pc/sdiahci.c

@@ -891,7 +891,7 @@ resetdisk(Drive *d)
 static int
 newdrive(Drive *d)
 {
-	char *name, *s;
+	char *name;
 	Aportc *c;
 	Aportm *m;
 
@@ -929,13 +929,9 @@ newdrive(Drive *d)
 
 	qunlock(c->m);
 
-	s = "";
-	if(m->feat & Dllba)
-		s = "L";
-	idprint("%s: %sLBA %,llud sectors\n", d->unit->name, s, d->sectors);
-	idprint("  %s %s %s %s\n", d->model, d->firmware, d->serial,
-		d->mediachange? "[mediachange]": "");
-
+	idprint("%s: %sLBA %,llud sectors: %s %s %s %s\n", d->unit->name,
+		(m->feat & Dllba? "L": ""), d->sectors, d->model, d->firmware,
+		d->serial, d->mediachange? "[mediachange]": "");
 	return 0;
 
 lose:
@@ -1318,7 +1314,8 @@ waitready(Drive *d)
 {
 	ulong s, t, i;
 
-	for(i = 0; i < 120; i++){
+	/* don't wait long; we're only the bootstrap */
+	for(i = 0; i < 150; i++){
 		ilock(d);
 		s = d->port->sstatus;
 		t = d->port->task;
@@ -1330,7 +1327,7 @@ waitready(Drive *d)
 		if((i + 1) % 30 == 0)
 			print("%s: waitready: [%s] task=%lux sstat=%lux\n",
 				d->unit->name, diskstates[d->state], t, s);
-		esleep(1000);
+		esleep(100);
 	}
 	print("%s: not responding; offline\n", d->unit->name);
 	ilock(d);

+ 8 - 7
sys/src/libbio/bseek.c

@@ -28,15 +28,16 @@ Bseek(Biobufhdr *bp, vlong offset, int base)
 		 * try to seek within buffer
 		 */
 		if(base == 0) {
+			/*
+			 * if d is too large for an int, icount may wrap,
+			 * so we need to ensure that icount hasn't wrapped
+			 * and points within the buffer's valid data.
+			 */
 			d = n - Boffset(bp);
 			bp->icount += d;
-			if(d >= 0) {
-				if(bp->icount <= 0)
-					return n;
-			} else {
-				if(bp->ebuf - bp->gbuf >= -bp->icount)
-					return n;
-			}
+			if(d <= bp->bsize && bp->icount <= 0 &&
+			    bp->ebuf - bp->gbuf >= -bp->icount)
+				return n;
 		}
 
 		/*