~kris/9p

9hist

5a469151d46b457bcba62dfca5750e4be8d5f62a — David du Colombier 23 years ago a0f13cd
Plan 9 from Bell Labs 2003-04-06
M port/cache.c => port/cache.c +1 -1
@@ 539,7 539,7 @@ cupdate(Chan *c, uchar *buf, int len, vlong off)
			len -= o;
			offset += o;
			if(len <= 0) {
if (f && p->start + p->len > f->start) print("CACHE: p->start=%uld p->len=%d f->start=%uld\n", p->start, p->len, f->start);
if(f && p->start + p->len > f->start) print("CACHE: p->start=%uld p->len=%d f->start=%uld\n", p->start, p->len, f->start);
				qunlock(m);
				return;
			}

M port/cis.c => port/cis.c +4 -4
@@ 64,15 64,15 @@ xcistuple(int slotno, int tuple, int subtuple, void *v, int nv, int attr)
			break;

		n = link;
		if (link > 1 && subtuple != -1) {
			if (readc(&cis, &c) != 1)
		if(link > 1 && subtuple != -1){
			if(readc(&cis, &c) != 1)
				break;
			subtype = c;
			n--;
		} else
		}else
			subtype = -1;

		if(type == tuple && subtype == subtuple) {
		if(type == tuple && subtype == subtuple){
			p = v;
			for(l=0; l<nv && l<n; l++)
				if(readc(&cis, p++) != 1)

M port/devaudio.c => port/devaudio.c +1 -1
@@ 347,7 347,7 @@ contindma(void)
		goto shutdown;

	b = audio.current;
	if (b){
	if(b){
		audio.totcount += Bufsize;
		audio.tottime = todget(nil);
	}

M port/devbridge.c => port/devbridge.c +1 -1
@@ 1032,7 1032,7 @@ if(0)print("devbridge: etherread: blocklen = %d\n", blocklen(bp));
				port->inunknown++;
				bp2 = bp; bp = nil;
				ethermultiwrite(b, bp2, port);
			} else if (ce->port != port->id) {
			}else if(ce->port != port->id){
				b->hit++;
				bp2 = bp; bp = nil;
				etherwrite(b->port[ce->port], bp2);

M port/devpnp.c => port/devpnp.c +4 -4
@@ 127,21 127,21 @@ isolate(int rddata, ulong *id1, ulong *id2)
	outb(Address, 0x01);	/* point to serial isolation register */
	delay(1);
	csum = 0x6a;
	for (i = 0; i < 64; i++) {
	for(i = 0; i < 64; i++){
		bit = readbit(rddata);
		csum = (csum>>1) | (((csum&1) ^ ((csum>>1)&1) ^ bit)<<7);
		p = &id[i>>3];
		*p = (*p>>1) | (bit<<7);
	}
	for (; i < 72; i++) {
	for(; i < 72; i++){
		p = &id[i>>3];
		*p = (*p>>1) | (readbit(rddata)<<7);
	}
	*id1 = (id[3]<<24)|(id[2]<<16)|(id[1]<<8)|id[0];
	*id2 = (id[7]<<24)|(id[6]<<16)|(id[5]<<8)|id[4];
	if (*id1 == 0)
	if(*id1 == 0)
		return 0;
	if (id[8] != csum)
	if(id[8] != csum)
		DPRINT("pnp: bad checksum id1 %lux id2 %lux csum %x != %x\n", *id1, *id2, csum, id[8]); /**/
	return id[8] == csum;
}

M port/devsd.c => port/devsd.c +9 -9
@@ 229,7 229,7 @@ sdgetdev(int idno)

	qlock(&devslock);
	for(i = 0; i != ndevs; i++)
		if (devs[i].dt_dev->idno == idno)
		if(devs[i].dt_dev->idno == idno)
			break;
	
	if(i == ndevs)


@@ 471,7 471,7 @@ sdgen(Chan* c, char*, Dirtab*, int, int s, Dir* dp)

		qlock(&devslock);
		for(i = 0; i != ndevs; i++){
			if (s < devs[i].dt_nunits)
			if(s < devs[i].dt_nunits)
				break;
			s -= devs[i].dt_nunits;
		}


@@ 482,7 482,7 @@ sdgen(Chan* c, char*, Dirtab*, int, int s, Dir* dp)
			return -1;
		}

		if ((sdev = devs[i].dt_dev) == nil){
		if((sdev = devs[i].dt_dev) == nil){
			qunlock(&devslock);
			return 0;
		}


@@ 604,7 604,7 @@ sdattach(char* spec)

	qlock(&devslock);
	for (sdev = nil, i = 0; i != ndevs; i++)
		if ((sdev = devs[i].dt_dev) != nil && sdev->idno == idno)
		if((sdev = devs[i].dt_dev) != nil && sdev->idno == idno)
			break;

	if(i == ndevs || subno >= sdev->nunit || sdgetunit(sdev, subno) == nil){


@@ 695,7 695,7 @@ sdclose(Chan* c)
		break;
	case Qraw:
		sdev = sdgetdev(DEV(c->qid));
		if (sdev) {
		if(sdev) {
			unit = sdev->unit[UNIT(c->qid)];
			unit->rawinuse = 0;
			decref(&sdev->r);


@@ 905,7 905,7 @@ sdread(Chan *c, void *a, long n, vlong off)

	case Qctl:
		sdev = sdgetdev(DEV(c->qid));
		if (sdev == nil)
		if(sdev == nil)
			error(Enonexist);

		unit = sdev->unit[UNIT(c->qid)];


@@ 944,7 944,7 @@ sdread(Chan *c, void *a, long n, vlong off)

	case Qraw:
		sdev = sdgetdev(DEV(c->qid));
		if (sdev == nil)
		if(sdev == nil)
			error(Enonexist);

		unit = sdev->unit[UNIT(c->qid)];


@@ 1139,7 1139,7 @@ sdwrite(Chan* c, void* a, long n, vlong off)
	case Qctl:
		cb = parsecmd(a, n);
		sdev = sdgetdev(DEV(c->qid));
		if (sdev == nil)
		if(sdev == nil)
			error(Enonexist);
		unit = sdev->unit[UNIT(c->qid)];



@@ 1244,7 1244,7 @@ sdwstat(Chan* c, uchar* dp, int n)
		error(Eperm); 

	sdev = sdgetdev(DEV(c->qid));
	if (sdev == nil)
	if(sdev == nil)
		error(Enonexist);
	unit = sdev->unit[UNIT(c->qid)];
	qlock(&unit->ctl);

M port/devtls.c => port/devtls.c +1 -1
@@ 318,7 318,7 @@ tlsgen(Chan *c, char*, Dirtab *, int, int s, Dir *dp)
			nm = tr->user;
		else
			nm = eve;
		if ((name = trnames[s]) == nil) {
		if((name = trnames[s]) == nil) {
			name = trnames[s] = smalloc(16);
			sprint(name, "%d", s);
		}

M port/devuart.c => port/devuart.c +3 -3
@@ 534,7 534,7 @@ uartpower(int on)
	Uart *p;

	for(p = uartlist; p != nil; p = p->next) {
		if (p->phys->power)
		if(p->phys->power)
			(*p->phys->power)(p, on);
	}
}


@@ 622,7 622,7 @@ uartrecv(Uart *p,  char ch)
	if(p->xonoff){
		if(ch == CTLS){
			p->blocked = 1;
		}else if (ch == CTLQ){
		}else if(ch == CTLQ){
			p->blocked = 0;
			p->ctsbackoff = 2; /* clock gets output going again */
		}


@@ 631,7 631,7 @@ uartrecv(Uart *p,  char ch)
	/* receive the character */
	if(p->putc)
		p->putc(p->iq, ch);
	else {
	else{
		next = p->iw + 1;
		if(next == p->ie)
			next = p->istage;

M port/portclock.c => port/portclock.c +6 -6
@@ 31,7 31,7 @@ tadd(Timers *tt, Timer *nt)
			*last = t->next;
			break;
		}
		if (t->period == nt->period){
		if(t->period == nt->period){
			/* look for another timer at same frequency for combining */
			pt = t;
		}


@@ 52,7 52,7 @@ tadd(Timers *tt, Timer *nt)
	}
	nt->next = *last;
	*last = nt;
	if (last == &tt->head)
	if(last == &tt->head)
		return nt->when;
	else
		return 0;


@@ 68,7 68,7 @@ timeradd(Timer *nt)
	tt = &timers[m->machno];
	ilock(tt);
	when = tadd(tt, nt);
	if (when)
	if(when)
		timerset(when);
	iunlock(tt);
}


@@ 87,7 87,7 @@ timerdel(Timer *dt)
			break;
		}
	}
	if (last == &tt->head && tt->head)
	if(last == &tt->head && tt->head)
		timerset(tt->head->when);
	iunlock(tt);
}


@@ 163,7 163,7 @@ timerintr(Ureg *u, uvlong)
		tt->head = t->next;
		fcallcount[m->machno]++;
		iunlock(tt);
		if (t->f){
		if(t->f){
			(*t->f)(u, t);
			splhi();
		} else


@@ 201,7 201,7 @@ addclock0link(void (*f)(void), int ms)
	/* Synchronize this to hztimer: reduces # of interrupts */
	nt = malloc(sizeof(Timer));
	nt->when = 0;
	if (ms == 0)
	if(ms == 0)
		ms = 1000/HZ;
	nt->period = ms2fastticks(ms);
	nt->f = (void (*)(Ureg*, Timer*))f;

M port/proc.c => port/proc.c +7 -8
@@ 76,7 76,7 @@ schedinit(void)		/* never returns */
			break;
		case Moribund:
			up->state = Dead;
			if (edf->isedf(up))
			if(edf->isedf(up))
				edf->edfbury(up);

			/*


@@ 362,7 362,7 @@ runproc(void)

	start = perfticks();

	if ((p = edf->edfrunproc()) != nil)
	if((p = edf->edfrunproc()) != nil)
		return p;

	/* 10 is completely arbitrary - it interacts with the comparison in rebalance */


@@ 583,7 583,7 @@ sleep(Rendez *r, int (*f)(void*), void *arg)

	s = splhi();

	if (up->nlocks)
	if(up->nlocks)
		print("process %lud sleeps with %lud locks held, last lock 0x%p locked at pc 0x%lux\n",
			up->pid, up->nlocks, up->lastlock, up->lastlock->pc);
	lock(r);


@@ 633,9 633,8 @@ sleep(Rendez *r, int (*f)(void*), void *arg)
			 */
			unlock(&up->rlock);
			unlock(r);
			// Behind unlock, we may call wakeup on ourselves.

			if (edf->isedf(up))
			if(edf->isedf(up))
				edf->edfblock(up);

			gotolabel(&m->sched);


@@ 836,7 835,7 @@ addbroken(Proc *p)
	broken.p[broken.n++] = p;
	qunlock(&broken);

	if (edf->isedf(up))
	if(edf->isedf(up))
		edf->edfbury(up);
	p->state = Broken;
	p->psstate = 0;


@@ 1007,7 1006,7 @@ pexit(char *exitstr, int freemem)
	lock(&procalloc);
	lock(&palloc);

	if (edf->isedf(up))
	if(edf->isedf(up))
		edf->edfbury(up);
	up->state = Moribund;
	sched();


@@ 1260,7 1259,7 @@ procctl(Proc *p)
		qunlock(&p->debug);
		splhi();
		p->state = Stopped;
		if (edf->isedf(up))
		if(edf->isedf(up))
			edf->edfblock(up);
		sched();
		p->psstate = state;

M port/qlock.c => port/qlock.c +2 -2
@@ 109,7 109,7 @@ rlock(RWlock *q)
	up->qnext = 0;
	up->state = QueueingR;
	unlock(&q->use);
	if (edf->isedf(up))
	if(edf->isedf(up))
		edf->edfblock(up);
	sched();
}


@@ 166,7 166,7 @@ wlock(RWlock *q)
	up->qnext = 0;
	up->state = QueueingW;
	unlock(&q->use);
	if (edf->isedf(up))
	if(edf->isedf(up))
		edf->edfblock(up);
	sched();
}

M port/sysproc.c => port/sysproc.c +1 -1
@@ 838,7 838,7 @@ sysrendezvous(ulong *arg)
	*l = up;
	up->state = Rendezvous;
	unlock(up->rgrp);
	if (edf->isedf(up))
	if(edf->isedf(up))
		edf->edfblock(up);

	sched();