~kris/9p

9hist

5cd66a0912be2e1bb90b35f0b68eb9fddefb826c — David du Colombier 36 years ago be13def
Plan 9 from Bell Labs 1990-07-07
M gnot/boot.c => gnot/boot.c +1 -1
@@ 35,7 35,7 @@ main(int argc, char *argv[])
	if(cfd < 0)
		error("opening #i/ctl");
	sendmsg(cfd, "push dkmux");
	sendmsg(cfd, "config 1 16");
	sendmsg(cfd, "config 1 16 norestart");

	/*
	 *  fork a process to hold the incon channel open

M gnot/boot.h => gnot/boot.h +173 -171
@@ 1,7 1,7 @@
ulong bootcode[]={
	0x000000107,
	0x0000020fc,
	0x000000410,
	0x000000418,
	0x000000170,
	0x000000000,
	0x000002020,


@@ 29,7 29,7 @@ ulong bootcode[]={
	0x061002096,
	0x04a806d1e,
	0x048780040,
	0x0486e8542,
	0x0486e854a,
	0x02f002f40,
	0x0005c6100,
	0x020862f2f,


@@ 59,34 59,34 @@ ulong bootcode[]={
	0x000346100,
	0x01ff8588f,
	0x048780002,
	0x0486e81ff,
	0x0486e8209,
	0x06100200e,
	0x04a8042e7,
	0x02f40003a,
	0x044df6c0a,
	0x0486e8209,
	0x0486e8213,
	0x061000390,
	0x0588f4878,
	0x00002486e,
	0x0821b6100,
	0x082256100,
	0x01fec2f40,
	0x000444aaf,
	0x000446c0a,
	0x0486e8224,
	0x0486e822e,
	0x061000370,
	0x0588f486e,
	0x082352f2f,
	0x0823f2f2f,
	0x000486100,
	0x00332486e,
	0x0824a6100,
	0x082546100,
	0x0042a2f2f,
	0x000506100,
	0x01f98486e,
	0x082656100,
	0x0826f6100,
	0x0041a422e,
	0x084fa486f,
	0x08502486f,
	0x0002c486e,
	0x084fa6100,
	0x085026100,
	0x0104e2f00,
	0x02f40005c,
	0x0486f0038,


@@ 94,7 94,7 @@ ulong bootcode[]={
	0x061001fa4,
	0x0b0af0064,
	0x0670a486e,
	0x0826c6100,
	0x082766100,
	0x0031a588f,
	0x04878001c,
	0x0486f0044,


@@ 103,10 103,10 @@ ulong bootcode[]={
	0x02f400070,
	0x04aaf0070,
	0x06e0a486e,
	0x082766100,
	0x082806100,
	0x002f6588f,
	0x02f2f0070,
	0x0486e84fa,
	0x0486e8502,
	0x0486f0054,
	0x06100179e,
	0x04a806638,


@@ 119,23 119,23 @@ ulong bootcode[]={
	0x0102f0064,
	0x049c02f00,
	0x02f2f008c,
	0x0486e827f,
	0x0486e8289,
	0x061000384,
	0x0486e82a2,
	0x0486e82ac,
	0x0610002ac,
	0x04fef001c,
	0x00c2e0001,
	0x084fa670a,
	0x0486e82ad,
	0x08502670a,
	0x0486e82b7,
	0x061000298,
	0x0588f486e,
	0x082b66100,
	0x082c06100,
	0x0035e1d7c,
	0x0000284fa,
	0x000028502,
	0x01d7c0076,
	0x08504486f,
	0x0850c486f,
	0x0005c486e,
	0x084fa6100,
	0x085026100,
	0x00f8a2f00,
	0x02f40008c,
	0x0486f0068,


@@ 143,7 143,7 @@ ulong bootcode[]={
	0x061001ee0,
	0x0b0af0094,
	0x0670a486e,
	0x082c16100,
	0x082cb6100,
	0x00256588f,
	0x04878001c,
	0x0486f0074,


@@ 152,33 152,33 @@ ulong bootcode[]={
	0x02f4000a0,
	0x04aaf00a0,
	0x06e0a486e,
	0x082cf6100,
	0x082d96100,
	0x00232588f,
	0x02f2f00a0,
	0x0486e84fa,
	0x0486e8502,
	0x0486f0084,
	0x0610016da,
	0x04a80660a,
	0x0486e82dc,
	0x0486e82e6,
	0x061000214,
	0x0588f0c2e,
	0x0000384fa,
	0x000038502,
	0x0670a486e,
	0x082eb6100,
	0x082f56100,
	0x00202588f,
	0x04a6e84fe,
	0x04a6e8506,
	0x0671c302e,
	0x084fe48c0,
	0x0850648c0,
	0x02f00486e,
	0x082f86100,
	0x002ba486e,
	0x083026100,
	0x002ba486e,
	0x0830c6100,
	0x001e24fef,
	0x0000c486e,
	0x0830f6100,
	0x083196100,
	0x002a6486e,
	0x0831d486e,
	0x08317486f,
	0x08327486e,
	0x08321486f,
	0x000946100,
	0x003664878,
	0x001b64878,


@@ 188,10 188,10 @@ ulong bootcode[]={
	0x042e72f40,
	0x000c244df,
	0x06c0a486e,
	0x083246100,
	0x0832e6100,
	0x001a2588f,
	0x02f2f00cc,
	0x0486e832b,
	0x0486e8335,
	0x0486f00ac,
	0x061000330,
	0x0486f00b0,


@@ 205,26 205,26 @@ ulong bootcode[]={
	0x00e64588f,
	0x0221fb280,
	0x0670a486e,
	0x0832e6100,
	0x083386100,
	0x0015e588f,
	0x02f2f00d8,
	0x061001d9a,
	0x0486e833a,
	0x0486e8334,
	0x0486e8344,
	0x0486e833e,
	0x0486f00c8,
	0x0610002e4,
	0x0487801b6,
	0x048780001,
	0x0486e8341,
	0x0486e834b,
	0x061001d80,
	0x04a8042e7,
	0x02f4000f6,
	0x044df6c0a,
	0x0486e8349,
	0x0486e8353,
	0x061000120,
	0x0588f2f2f,
	0x00100486e,
	0x08350486f,
	0x0835a486f,
	0x000e06100,
	0x002ae486f,
	0x000e46100,


@@ 237,44 237,44 @@ ulong bootcode[]={
	0x061000de2,
	0x0588f221f,
	0x0b280670a,
	0x0486e8353,
	0x0486e835d,
	0x0610000dc,
	0x0588f2f2f,
	0x0010c6100,
	0x01d18486e,
	0x083596100,
	0x083636100,
	0x0019a42a7,
	0x0486e8364,
	0x0486e8362,
	0x0486e836e,
	0x0486e836c,
	0x061000dca,
	0x04a806c0a,
	0x0486e8366,
	0x0486e8370,
	0x0610000b0,
	0x0588f486e,
	0x0836d4878,
	0x083774878,
	0x00006486e,
	0x0836b2f2f,
	0x083752f2f,
	0x001386100,
	0x01cfe4a80,
	0x06c0a486e,
	0x0836e6100,
	0x083786100,
	0x0008e588f,
	0x0486e8374,
	0x0486e837e,
	0x061000154,
	0x048780020,
	0x0486e8542,
	0x0486e854a,
	0x061000d48,
	0x04a80671e,
	0x042a7486e,
	0x0838e486e,
	0x08389486e,
	0x0837d6100,
	0x08398486e,
	0x08393486e,
	0x083876100,
	0x00d1e486e,
	0x083a2615a,
	0x083ac615a,
	0x04fef0164,
	0x04e7542a7,
	0x0486e839d,
	0x0486e8391,
	0x0486e83a7,
	0x0486e839b,
	0x061000d04,
	0x0598f60e2,
	0x048790000,


@@ 299,7 299,7 @@ ulong bootcode[]={
	0x01c48486f,
	0x000082f2f,
	0x00050486e,
	0x083ae4878,
	0x083b84878,
	0x000026100,
	0x0011a42a7,
	0x061744fef,


@@ 307,10 307,10 @@ ulong bootcode[]={
	0x0598f4281,
	0x07021b081,
	0x06f1e4ab6,
	0x01d208412,
	0x01d20841a,
	0x0660e2daf,
	0x000081d20,
	0x084127001,
	0x0841a7001,
	0x0588f4e75,
	0x052817021,
	0x0b0816ee2,


@@ 320,25 320,25 @@ ulong bootcode[]={
	0x042827021,
	0x0b0826f18,
	0x020362d20,
	0x08412b088,
	0x0841ab088,
	0x0660642b6,
	0x02d208412,
	0x02d20841a,
	0x052827021,
	0x0b0826ee8,
	0x0588f4e75,
	0x04aaf0004,
	0x0660642a7,
	0x0610c588f,
	0x0486e83da,
	0x0486e83e2,
	0x06104588f,
	0x04e75518f,
	0x072204a81,
	0x06d222eb6,
	0x01d208412,
	0x01d20841a,
	0x04a976712,
	0x02f410004,
	0x042b61d20,
	0x084124eb7,
	0x0841a4eb7,
	0x00151222f,
	0x000045381,
	0x04a816cde,


@@ 560,7 560,7 @@ ulong bootcode[]={
	0x07209b081,
	0x06e0000ea,
	0x030360b20,
	0x083c44efb,
	0x083cc4efb,
	0x000007004,
	0x0c0846604,
	0x04a836d72,


@@ 686,7 686,7 @@ ulong bootcode[]={
	0x0800e60b6,
	0x04878ffff,
	0x042a7486e,
	0x083be6100,
	0x083c66100,
	0x0ff3c4280,
	0x04fef000c,
	0x04e75598f,


@@ 1518,7 1518,7 @@ ulong bootcode[]={
	0x06000fa26,
	0x0101149c0,
	0x02f00486e,
	0x083f26100,
	0x083fa6100,
	0x0edaa4280,
	0x04fef000c,
	0x04e753029,


@@ 1979,7 1979,7 @@ ulong bootcode[]={
	0x06000fa98,
	0x0101149c0,
	0x02f00486e,
	0x084006100,
	0x084086100,
	0x0e6764280,
	0x04fef000c,
	0x04e754280,


@@ 2245,118 2245,120 @@ ulong bootcode[]={
	0x000636f6e,
	0x066696720,
	0x031203136,
	0x000236b2f,
	0x0322f6461,
	0x07461006f,
	0x070656e69,
	0x06e672023,
	0x0206e6f72,
	0x065737461,
	0x072740023,
	0x06b2f322f,
	0x064617461,
	0x000236b2f,
	0x0322f6374,
	0x06c006f70,
	0x0656e696e,
	0x06720236b,
	0x02f322f63,
	0x0746c0063,
	0x06f6e6e65,
	0x063742068,
	0x0656c6978,
	0x02e626f6f,
	0x074667300,
	0x0636f6e6e,
	0x065637465,
	0x06420746f,
	0x0006f7065,
	0x06e696e67,
	0x020236b2f,
	0x0322f6461,
	0x074610023,
	0x06b2f322f,
	0x063746c00,
	0x06f70656e,
	0x0696e6720,
	0x0236b2f32,
	0x02f63746c,
	0x000636f6e,
	0x06e656374,
	0x02068656c,
	0x069782e62,
	0x06f6f7466,
	0x0730a006e,
	0x06f702e2e,
	0x02e007772,
	0x069746520,
	0x06e6f7000,
	0x072656164,
	0x0206e6f70,
	0x0006e203d,
	0x02025643b,
	0x020627566,
	0x07300636f,
	0x06e6e6563,
	0x074656420,
	0x0746f2068,
	0x0656c6978,
	0x02e626f6f,
	0x07466730a,
	0x0006e6f70,
	0x02e2e2e00,
	0x077726974,
	0x065206e6f,
	0x070007265,
	0x06164206e,
	0x06f70006e,
	0x0203d2025,
	0x02e327820,
	0x0252e3278,
	0x0643b2062,
	0x07566203d,
	0x020252e32,
	0x07820252e,
	0x032780a00,
	0x0666f726d,
	0x06174206e,
	0x06f70006e,
	0x06f742052,
	0x06e6f7000,
	0x073657373,
	0x0696f6e2e,
	0x02e2e0077,
	0x072697465,
	0x020736573,
	0x073696f6e,
	0x000726561,
	0x064207365,
	0x07373696f,
	0x06e00666f,
	0x032782025,
	0x02e327820,
	0x0252e3278,
	0x00a00666f,
	0x0726d6174,
	0x020736573,
	0x073696f6e,
	0x0206e6f70,
	0x0006e6f74,
	0x020527365,
	0x020526e6f,
	0x070007365,
	0x07373696f,
	0x06e006572,
	0x0726f7220,
	0x025643b00,
	0x072656d6f,
	0x074652065,
	0x072726f72,
	0x000706f73,
	0x0742e2e2e,
	0x00023732f,
	0x025730062,
	0x06f6f7465,
	0x073006372,
	0x065617465,
	0x000256400,
	0x077726974,
	0x065002373,
	0x02f257300,
	0x0626f6f74,
	0x065730023,
	0x0732f626f,
	0x06f740063,
	0x072656174,
	0x065002564,
	0x06e2e2e2e,
	0x000777269,
	0x07465006d,
	0x06f756e74,
	0x02e2e2e00,
	0x02f002f00,
	0x062696e64,
	0x0002f0000,
	0x06d6f756e,
	0x074007375,
	0x063636573,
	0x0730a002f,
	0x036383032,
	0x0302f696e,
	0x069740069,
	0x06e697400,
	0x02d6d002f,
	0x036383032,
	0x0302f696e,
	0x069740069,
	0x06e697400,
	0x02f363830,
	0x032302f69,
	0x06e697400,
	0x074652073,
	0x065737369,
	0x06f6e0072,
	0x065616420,
	0x073657373,
	0x0696f6e00,
	0x0666f726d,
	0x061742073,
	0x065737369,
	0x06f6e006e,
	0x06f742052,
	0x073657373,
	0x0696f6e00,
	0x06572726f,
	0x072202564,
	0x03b007265,
	0x06d6f7465,
	0x020657272,
	0x06f720070,
	0x06f73742e,
	0x02e2e0023,
	0x0732f2573,
	0x000626f6f,
	0x074657300,
	0x063726561,
	0x074650025,
	0x064007772,
	0x069746500,
	0x023732f25,
	0x07300626f,
	0x06f746573,
	0x00023732f,
	0x0626f6f74,
	0x03a202573,
	0x03a202573,
	0x00a000000,
	0x000637265,
	0x061746500,
	0x025640077,
	0x072697465,
	0x0006d6f75,
	0x06e742e2e,
	0x02e002f00,
	0x02f006269,
	0x06e64002f,
	0x000006d6f,
	0x0756e7400,
	0x073756363,
	0x06573730a,
	0x0002f3638,
	0x03032302f,
	0x0696e6974,
	0x000696e69,
	0x074002d6d,
	0x0002f3638,
	0x03032302f,
	0x0696e6974,
	0x000696e69,
	0x074002f36,
	0x038303230,
	0x02f696e69,
	0x07400626f,
	0x06f743a20,
	0x025733a20,
	0x025730a00,
	0x02a2a2a00,
	0x000000000,
	0x001280116,


@@ 2378,6 2380,6 @@ ulong bootcode[]={
	0x070653a20,
	0x025640a00,
	0x000000000,
	0x0000252c,
	0x00002534,
	0x0,
};

M gnot/chan.c => gnot/chan.c +1 -0
@@ 72,6 72,7 @@ loop:
	lock(&chanalloc);
	if(c = chanalloc.free){		/* assign = */
		chanalloc.free = c->next;
		c->type = 0;	/* if closed before changed, this calls rooterror, a nop */
		c->flag = 0;
		c->ref = 1;
		unlock(&chanalloc);

M gnot/devcons.c => gnot/devcons.c +113 -21
@@ 35,6 35,11 @@ IOQ	rs232iq;
IOQ	rs232oq;

struct{
	IOQ;
	Lock	put;
}klogq;

struct{
	IOQ;		/* qlock to getc; interrupt putc's */
	int	c;
	int	repeat;


@@ 56,6 61,8 @@ printinit(void)
	rs232iq.out = rs232iq.buf;
	rs232oq.in = rs232oq.buf;
	rs232oq.out = rs232oq.buf;
	klogq.in = klogq.buf;
	klogq.out = klogq.buf;
	lineq.in = lineq.buf;
	lineq.out = lineq.buf;
	qlock(&kbdq);		/* allocate qlock */


@@ 66,6 73,10 @@ printinit(void)
	unlock(&rs232iq);
	lock(&rs232oq);		/* allocate lock */
	unlock(&rs232oq);
	lock(&klogq);		/* allocate lock */
	unlock(&klogq);
	lock(&klogq.put);		/* allocate lock */
	unlock(&klogq.put);

	screeninit();
}


@@ 91,7 102,16 @@ putstrn(char *str, long n)
int
cangetc(IOQ *q)
{
	return q->in != q->out;
	int n = q->in - q->out;
	if (n < 0)
		n += sizeof(q->buf);
	return n;
}

int
canputc(IOQ *q)
{
	return sizeof(q->buf)-cangetc(q)-1;
}

int


@@ 124,12 144,36 @@ getc(IOQ *q)
	return c;
}

void
int
putc(IOQ *q, int c)
{
	*q->in++ = c;
	if(q->in == q->buf+sizeof(q->buf))
		q->in = q->buf;
	uchar *nextin;
	if(q->in >= &q->buf[sizeof(q->buf)-1])
		nextin = q->buf;
	else
		nextin = q->in+1;
	if(nextin == q->out)
		return -1;
	*q->in = c;
	q->in = nextin;
	return 0;
}

void
putstrk(char *str, long n)
{
	int s;

	s = splhi();
	lock(&klogq.put);
	while(--n >= 0){
		*klogq.in++ = *str++;
		if(klogq.in == klogq.buf+sizeof(klogq.buf))
			klogq.in = klogq.buf;
	}
	unlock(&klogq.put);
	splx(s);
	wakeup(&klogq.r);
}

int


@@ 149,6 193,17 @@ print(char *fmt, ...)
	return n;
}

int
kprint(char *fmt, ...)
{
	char buf[PRINTSIZE];
	int n;

	n = doprint(buf, buf+sizeof(buf), fmt, (&fmt+1)) - buf;
	putstrk(buf, n);
	return n;
}

void
panic(char *fmt, ...)
{


@@ 202,9 257,10 @@ echo(int c)
	 */
	if(c == 0x14)
		DEBUG();
	if(c == 0x16){
	if(c == 0x16)
		dumpqueues();
	}
	if(c == 0x18)
		mntdump();
	if(raw.ref)
		return;
	if(c == 0x15)


@@ 257,9 313,7 @@ kbdclock(void)
void
rs232ichar(int c)
{
	*rs232iq.in++ = c;
	if(rs232iq.in == rs232iq.buf+sizeof(rs232iq.buf))
		rs232iq.in = rs232iq.buf;
	putc(&rs232iq, c);
	wakeup(&rs232iq.r);
}



@@ 271,6 325,7 @@ getrs232o(void)
	c = getc(&rs232oq);
	if(c == -1)
		rs232oq.state = 0;
	wakeup(&rs232oq.r);
	return c;
}



@@ 295,6 350,7 @@ enum{
	Qrs232,
	Qtime,
	Quser,
	Qklog,
};

Dirtab consdir[]={


@@ 308,10 364,25 @@ Dirtab consdir[]={
	"rs232",	Qrs232,		0,	0600,
	"time",		Qtime,		12,	0600,
	"user",		Quser,		0,	0600,
	"klog",		Qklog,		0,	0400,
};

#define	NCONS	(sizeof consdir/sizeof(Dirtab))

static int
consgen(Chan *c, Dirtab *tab, int ntab, int i, Dir *dp)
{
	if(tab==0 || i>=ntab)
		return -1;
	tab += i;
	devdir(c, tab->qid, tab->name, tab->length, tab->perm, dp);
	switch(dp->qid){
	case Qrs232:
		dp->length = cangetc(&rs232iq); break;
	}
	return 1;
}

ulong	boottime;		/* seconds since epoch at boot */

long


@@ 375,13 446,13 @@ consclone(Chan *c, Chan *nc)
int
conswalk(Chan *c, char *name)
{
	return devwalk(c, name, consdir, NCONS, devgen);
	return devwalk(c, name, consdir, NCONS, consgen);
}

void
consstat(Chan *c, char *dp)
{
	devstat(c, dp, consdir, NCONS, devgen);
	devstat(c, dp, consdir, NCONS, consgen);
}

Chan*


@@ 406,7 477,7 @@ consopen(Chan *c, int omode)
			}
			unlock(&lineq);
		}
	return devopen(c, omode, consdir, NCONS, devgen);
	return devopen(c, omode, consdir, NCONS, consgen);
}

void


@@ 437,7 508,7 @@ consread(Chan *c, void *buf, long n)
		return n;
	switch(c->qid&~CHDIR){
	case Qdir:
		return devdirread(c, buf, n, consdir, NCONS, devgen);
		return devdirread(c, buf, n, consdir, NCONS, consgen);

	case Qrcons:
	case Qcons:


@@ 538,6 609,22 @@ consread(Chan *c, void *buf, long n)
	case Qnull:
		return 0;

	case Qklog:
		qlock(&klogq);
		if(waserror()){
			qunlock(&klogq);
			nexterror();
		}
		while(!cangetc(&klogq))
			sleep(&klogq.r, (int(*)(void*))cangetc, &klogq);
		for(i=0; i<n; i++){
			if((ch=getc(&klogq)) == -1)
				break;
			*cbuf++ = ch;
		}
		qunlock(&klogq);
		return i;

	default:
		panic("consread %lux\n", c->qid);
		return 0;


@@ 573,14 660,19 @@ conswrite(Chan *c, void *va, long n)
	case Qrs232:
		qlock(&rs232oq);
		l = n;
		while(--l >= 0)
			putc(&rs232oq, *a++);
		splhi();
		if(rs232oq.state == 0){
			rs232oq.state = 1;
			duartstartrs232o();
		while(--l >= 0) {
			while (putc(&rs232oq, *a) < 0)
				sleep(&rs232oq.r, (int(*)(void*))canputc, &rs232oq);
			a++;
			if(rs232oq.state == 0){
				splhi();
				if(rs232oq.state == 0){
					rs232oq.state = 1;
					duartstartrs232o();
				}
				spllo();
			}
		}
		spllo();
		qunlock(&rs232oq);
		break;


M gnot/devdk.c => gnot/devdk.c +22 -5
@@ 123,6 123,7 @@ struct Dk {
	int	ncsc;		/* csc line number */
	Chan	*csc;		/* common signalling line */
	Line	line[Nline];
	int	restart;
};
static Dk dk[Ndk];



@@ 427,10 428,11 @@ dkoput(Queue *q, Block *bp)
}

/*
 *  configure a datakit multiplexor.  this takes 3 arguments separated
 *  configure a datakit multiplexor.  this takes 4 arguments separated
 *  by spaces:
 *	the line number of the common signalling channel (must be > 0)
 *	the number of lines in the device (optional)
 *	the word `restart' or `norestart' (optional/default==restart)
 *	the name of the dk (optional)
 *
 *  we can configure only once


@@ 439,7 441,7 @@ static void
dkmuxconfig(Dk *dp, Block *bp)
{
	Chan *c;
	char *fields[3];
	char *fields[4];
	int n;
	char buf[64];
	static int dktimeron;


@@ 452,10 454,14 @@ dkmuxconfig(Dk *dp, Block *bp)
	/*
	 *  parse
	 */
	n = getfields((char *)bp->rptr, fields, 3, ' ');
	dp->restart = 1;
	n = getfields((char *)bp->rptr, fields, 4, ' ');
	switch(n){
	case 4:
		strncpy(dp->name, fields[3], sizeof(dp->name));
	case 3:
		strncpy(dp->name, fields[2], sizeof(dp->name));
		if(strcmp(fields[2], "restart")!=0)
			dp->restart = 0;
	case 2:
		dp->lines = strtoul(fields[1], 0, 0);
	case 1:


@@ 893,6 899,7 @@ dkcall(int type, Chan *c, char *addr, char *nuser, char *machine)
	Dk *dp;
	Line *lp;
	Chan *dc;
	char *bang, *dot;

	line = STREAMID(c->qid);
	dp = &dk[c->dev];


@@ 907,13 914,21 @@ dkcall(int type, Chan *c, char *addr, char *nuser, char *machine)
	DPRINT("dkcall(line=%d, type=%d, dest=%s)\n", line, type, addr);

	/*
	 *  build dial string (guard against new lines)
	 *  build dial string
	 *	- guard against new lines
	 *	- change ! into . to delimit service
	 */
	if(strchr(addr, '\n'))
		error(0, Ebadarg);
	if(strlen(addr)+strlen(u->p->pgrp->user)+2 >= sizeof(dialstr))
		error(0, Ebadarg);
	strcpy(dialstr, addr);
	bang = strchr(dialstr, '!');
	if(bang){
		dot = strchr(dialstr, '.');
		if(dot==0 || dot > bang)
			*bang = '.';
	}
	switch(type){
	case Dial:
		t_val = T_SRV;


@@ 1296,6 1311,8 @@ dkcsckproc(void *a)
	/*
	 *  tell datakit we've rebooted. It should close all channels.
	 */
	if(dp->restart)
		dkmesg(dp, T_ALIVE, D_RESTART, 0, 0);
	dkmesg(dp, T_CHG, D_CLOSEALL, 0, 0);

	/*

M gnot/devmnt.c => gnot/devmnt.c +19 -0
@@ 859,3 859,22 @@ mntxmit(Mnt *m, Mnthdr *mh)
	mbfree(mbw);
	poperror();
}

mntdump()
{
	int i;
	MntQ *q;
	Mnthdr *h;
	Proc *p;

	for(i=0; i<conf.nmntdev; i++){
		q = &mntqalloc.arena[i];
		if(!q->msg)
			continue;
		p = q->reader;
		print("q rdr %d wrtr ", p? p->pid : 0);
		for(h=q->writer; h; h=h->next)
			print("(%lux %lux %d)", h, &h->r, (p=h->p)? p->pid : 0);
		print("\n");
	}
}

M gnot/fns.h => gnot/fns.h +1 -0
@@ 67,6 67,7 @@ void	kbdrepeat(int);
void	kbdclock(void);
void	kmapinit(void);
KMap	*kmap(Page*);
int	kprint(char*, ...);
void	kproc(char*, void(*)(void*), void*);
void	kproftimer(ulong);
void	kunmap(KMap*);

M gnot/io.h => gnot/io.h +1 -0
@@ 3,3 3,4 @@ typedef struct	Duart	Duart;
#define	SYNCREG		((char*)0x40400000)
#define	DISPLAYRAM	0x02000000
#define	DUARTREG	((Duart*)0x40100000)
#define	PORT		((uchar *)0x40300000)

M gnot/screen.c => gnot/screen.c +1 -1
@@ 200,7 200,7 @@ duartinit(void)
	duart[1].ip_opcr = 0x00;
	duart[1].scc_ropbc = 0xFF;	/* make sure the port is reset first */
	duart[1].scc_sopbc = 0x04;	/* dtr = 1, pp = 01 */
	duart[0].is_imr = IM_IPC|IM_RRDYB|IM_XRDYB|IM_RRDYA;
	duart[0].is_imr = IM_IPC|IM_RRDYB|IM_XRDYB|IM_RRDYA|IM_XRDYA;
	duart[0].cmnd = ENB_TX|ENB_RX;	/* enable TX and RX last */
	duart[1].cmnd = ENB_TX|ENB_RX;


M port/chan.c => port/chan.c +1 -0
@@ 72,6 72,7 @@ loop:
	lock(&chanalloc);
	if(c = chanalloc.free){		/* assign = */
		chanalloc.free = c->next;
		c->type = 0;	/* if closed before changed, this calls rooterror, a nop */
		c->flag = 0;
		c->ref = 1;
		unlock(&chanalloc);

M port/devbit.c => port/devbit.c +1 -1
@@ 640,7 640,7 @@ bitwrite(Chan *c, void *va, long n)
			 *	height		1
			 *	ascent		1
			 *	bitmap id	2
			 *	fontchars	6*n
			 *	fontchars	6*(n+1)
			 * next read returns allocated font id
			 */
			if(m < 7)

M port/devcons.c => port/devcons.c +1 -1
@@ 240,7 240,7 @@ echo(int c)
	if(c == 0x15)
		putstrn("^U\n", 3);
	if(c == 0x16)
		urpdump();
		dumpqueues();
	else{
		ch = c;
		putstrn(&ch, 1);

M port/devdk.c => port/devdk.c +22 -6
@@ 123,6 123,7 @@ struct Dk {
	int	ncsc;		/* csc line number */
	Chan	*csc;		/* common signalling line */
	Line	line[Nline];
	int	restart;
};
static Dk dk[Ndk];



@@ 427,10 428,11 @@ dkoput(Queue *q, Block *bp)
}

/*
 *  configure a datakit multiplexor.  this takes 3 arguments separated
 *  configure a datakit multiplexor.  this takes 4 arguments separated
 *  by spaces:
 *	the line number of the common signalling channel (must be > 0)
 *	the number of lines in the device (optional)
 *	the word `restart' or `norestart' (optional/default==restart)
 *	the name of the dk (optional)
 *
 *  we can configure only once


@@ 439,7 441,7 @@ static void
dkmuxconfig(Dk *dp, Block *bp)
{
	Chan *c;
	char *fields[3];
	char *fields[4];
	int n;
	char buf[64];
	static int dktimeron;


@@ 452,10 454,14 @@ dkmuxconfig(Dk *dp, Block *bp)
	/*
	 *  parse
	 */
	n = getfields((char *)bp->rptr, fields, 3, ' ');
	dp->restart = 1;
	n = getfields((char *)bp->rptr, fields, 4, ' ');
	switch(n){
	case 4:
		strncpy(dp->name, fields[3], sizeof(dp->name));
	case 3:
		strncpy(dp->name, fields[2], sizeof(dp->name));
		if(strcmp(fields[2], "restart")!=0)
			dp->restart = 0;
	case 2:
		dp->lines = strtoul(fields[1], 0, 0);
	case 1:


@@ 893,6 899,7 @@ dkcall(int type, Chan *c, char *addr, char *nuser, char *machine)
	Dk *dp;
	Line *lp;
	Chan *dc;
	char *bang, *dot;

	line = STREAMID(c->qid);
	dp = &dk[c->dev];


@@ 907,13 914,21 @@ dkcall(int type, Chan *c, char *addr, char *nuser, char *machine)
	DPRINT("dkcall(line=%d, type=%d, dest=%s)\n", line, type, addr);

	/*
	 *  build dial string (guard against new lines)
	 *  build dial string
	 *	- guard against new lines
	 *	- change ! into . to delimit service
	 */
	if(strchr(addr, '\n'))
		error(0, Ebadarg);
	if(strlen(addr)+strlen(u->p->pgrp->user)+2 >= sizeof(dialstr))
		error(0, Ebadarg);
	strcpy(dialstr, addr);
	bang = strchr(dialstr, '!');
	if(bang){
		dot = strchr(dialstr, '.');
		if(dot==0 || dot > bang)
			*bang = '.';
	}
	switch(type){
	case Dial:
		t_val = T_SRV;


@@ 1296,7 1311,8 @@ dkcsckproc(void *a)
	/*
	 *  tell datakit we've rebooted. It should close all channels.
	 */
	dkmesg(dp, T_ALIVE, D_RESTART, 0, 0);	/* do this on mips but not 68020 */
	if(dp->restart)
		dkmesg(dp, T_ALIVE, D_RESTART, 0, 0);
	dkmesg(dp, T_CHG, D_CLOSEALL, 0, 0);

	/*

M port/devlance.c => port/devlance.c +2 -1
@@ 21,7 21,7 @@ enum {
#define RSUCC(x) (((x)+1)%Nrrb)
#define TSUCC(x) (((x)+1)%Ntrb)

#define NOW (MACHP(0)->ticks)
#define NOW (MACHP(0)->ticks*MS2HZ)

/*
 *  Communication with the lance is via a transmit and receive ring of


@@ 580,6 580,7 @@ lanceinit(void)
	lancedir[Ntypes].qid = Ltraceqid;
	lancedir[Ntypes].length = 0;
	lancedir[Ntypes].perm = 0600;

}

Chan*

M port/stream.c => port/stream.c +22 -7
@@ 65,6 65,22 @@ Bclass bclass[Nclass]={
 *  Dump all block information of how many blocks are in which queues
 */
void
dumpblocks(Queue *q, char c)
{
	Block *bp;
	uchar *cp;

	lock(q);
	for(bp = q->first; bp; bp = bp->next){
		print("%c%d%c", c, bp->wptr-bp->rptr, (bp->flags&S_DELIM)?'D':' ');
		for(cp = bp->rptr; cp<bp->wptr && cp<bp->rptr+10; cp++)
			print(" %uo", *cp);
		print("\n");
	}
	unlock(q);
}

void
dumpqueues(void)
{
	Queue *q;


@@ 76,13 92,12 @@ dumpqueues(void)
	for(q = qlist; q < qlist + conf.nqueue; q++, q++){
		if(!(q->flag & QINUSE))
			continue;
		for(count = 0, bp = q->first; bp; bp = bp->next)
			count++;
		print("%s %ux  R c %d l %d f %ux", q->info->name, q, count,
			q->len, q->flag);
		for(count = 0, bp = WR(q)->first; bp; bp = bp->next)
			count++;
		print("  W c %d l %d f %ux\n", count, WR(q)->len, WR(q)->flag);
		print("%s %ux  R n %d l %d f %ux r %ux", q->info->name, q, q->nb,
			q->len, q->flag, &(q->r));
		print("  W n %d l %d f %ux r %ux\n", WR(q)->nb, WR(q)->len, WR(q)->flag,
			&(WR(q)->r));
		dumpblocks(q, 'R');
		dumpblocks(WR(q), 'W');
	}
	print("\n");
	for(bcp=bclass; bcp<&bclass[Nclass]; bcp++){

M port/sturp.c => port/sturp.c +0 -12
@@ 950,9 950,6 @@ urpkproc(void *arg)
static void
urpvomit(char *msg, Urp* up)
{
	Block *bp;
	uchar *cp;

	print("urpvomit: %s %ux next %d unechoed %d unacked %d nxb %d\n",
		msg, up, up->next, up->unechoed, up->unacked, up->nxb);
	print("\txb: %ux %ux %ux %ux %ux %ux %ux %ux\n",


@@ 963,15 960,6 @@ urpvomit(char *msg, Urp* up)
		up->trbuf[2]);
	print("\tupq: %ux %d %d\n", &up->rq->next->r,  up->rq->next->nb,
		up->rq->next->len);
	lock(up->rq->next);
	for(bp = up->rq->next->first; bp; bp = bp->next){
		print("%d%c:\t", bp->wptr - bp->rptr, (bp->flags&S_DELIM)?'D':' ');
		
		for(cp = bp->rptr; cp<bp->wptr && cp<bp->rptr+10; cp++)
			print(" %uo", *cp);
		print("\n");
	}
	unlock(up->rq->next);
}

int