~kris/9p

9hist

6d8ed33ba708ad51ff14db3927657b1a7b33210f — David du Colombier 23 years ago 39d1bb4
Plan 9 from Bell Labs 2002-12-13
3 files changed, 33 insertions(+), 14 deletions(-)

M pc/kbd.c
M port/devdraw.c
M port/devmnt.c
M pc/kbd.c => pc/kbd.c +1 -1
@@ 383,7 383,7 @@ i8042intr(Ureg*, void*)
			 * come back into focus, Plan 9 thinks you want to type
			 * a compose sequence (you just typed alt). 
			 *
			 * As a clusmy hack around this, we look for ctl-alt
			 * As a clumsy hack around this, we look for ctl-alt
			 * and don't treat it as the start of a compose sequence.
			 */
			if(!ctl){

M port/devdraw.c => port/devdraw.c +5 -0
@@ 385,6 385,11 @@ dstflush(int dstid, Memimage *dst, Rectangle r)
		combinerect(&flushrect, r);
		return;
	}
	/* how can this happen? -rsc, dec 12 2002 */
	if(dst == 0){
		print("nil dstflush\n");
		return;
	}
	l = dst->layer;
	if(l == nil)
		return;

M port/devmnt.c => port/devmnt.c +27 -13
@@ 829,6 829,24 @@ mountio(Mnt *m, Mntrpc *r)
	mntflushfree(m, r);
}

static int
doread(Mnt *m, int len)
{
	Block *b;

	while(qlen(m->q) < len){
		b = devtab[m->c->type]->bread(m->c, m->msize, 0);
		if(b == nil)
			return -1;
		if(BLEN(b) == 0){
			freeblist(b);
			return -1;
		}
		qaddlist(m->q, b);
	}
	return 0;
}

int
mntrpcread(Mnt *m, Mntrpc *r)
{


@@ 839,22 857,18 @@ mntrpcread(Mnt *m, Mntrpc *r)
	r->reply.tag = 0;

	/* read at least length, type, and tag and pullup to a single block */
	while(qlen(m->q) < BIT32SZ+BIT8SZ+BIT16SZ){
		b = devtab[m->c->type]->bread(m->c, m->msize, 0);
		if(b == nil)
			return -1;
		qaddlist(m->q, b);
	}
	if(doread(m, BIT32SZ+BIT8SZ+BIT16SZ) < 0)
		return -1;
	nb = pullupqueue(m->q, BIT32SZ+BIT8SZ+BIT16SZ);
	len = GBIT32(nb->rp);

	/* read in the rest of the message */
	while(qlen(m->q) < len){
		b = devtab[m->c->type]->bread(m->c, m->msize, 0);
		if(b == nil)
			return -1;
		qaddlist(m->q, b);
	/* read in the rest of the message, avoid rediculous (for now) message sizes */
	len = GBIT32(nb->rp);
	if(len > m->msize){
		qdiscard(m->q, qlen(m->q));
		return -1;
	}
	if(doread(m, len) < 0)
		return -1;

	/* pullup the header (i.e. everything except data) */
	t = nb->rp[BIT32SZ];