~kris/9p

9hist

95978c0451f06a83f4a6802cbbac7d005da06e3a — David du Colombier 36 years ago 5cc42e3
Plan 9 from Bell Labs 1990-07-17
M gnot/dat.h => gnot/dat.h +1 -0
@@ 138,6 138,7 @@ struct Conf
	int	nbitmap;	/* bitmap structs (devbit.c) */
	int	nbitbyte;	/* bytes of bitmap data (devbit.c) */
	int	nfont;		/* font structs (devbit.c) */
	int	nurp;		/* max urp conversations */
};

struct Dev

M gnot/devdk.c => gnot/devdk.c +1 -1
@@ 551,7 551,7 @@ void
dkreset(void)
{
	newqinfo(&dkmuxinfo);
	newqinfo(&urpinfo);
	urpreset();
}

/*

M gnot/devmnt.c => gnot/devmnt.c +10 -1
@@ 54,6 54,7 @@ struct Mnthdr
	Rendez	r;
	Proc	*p;
	Mntbuf	*mbr;
	int	readreply;	/* true if we are reader or our reply has come */
};

struct


@@ 670,6 671,11 @@ mnterrdequeue(MntQ *q, Mnthdr *mh)		/* queue is unlocked */
	qunlock(q);

}
int
mntreadreply(void *a)
{
	return ((Mnthdr *)a)->readreply;
}
void
mntxmit(Mnt *m, Mnthdr *mh)
{


@@ 760,6 766,7 @@ mntxmit(Mnt *m, Mnthdr *mh)
		mqfree(q);
		nexterror();
	}
	mh->readreply = 0;
	if((*devtab[q->msg->type].write)(q->msg, mbw->buf, n) != n){
		print("short write in mntxmit\n");
		error(0, Eshortmsg);


@@ 790,6 797,7 @@ mntxmit(Mnt *m, Mnthdr *mh)
			if(w = q->writer){	/* advance a writer to reader */
				q->reader = w->p;
				q->writer = w->next;
				w->readreply = 1;
				wakeup(&w->r);
			}
			qunlock(q);


@@ 812,6 820,7 @@ mntxmit(Mnt *m, Mnthdr *mh)
					q->writer = w->next;
				else
					ow->next = w->next;
				w->readreply = 1;
				wakeup(&w->r);
				goto Read;
			}


@@ 827,7 836,7 @@ mntxmit(Mnt *m, Mnthdr *mh)
			mnterrdequeue(q, mh);
			nexterror();
		}
		sleep(&mh->r, return0, 0);
		sleep(&mh->r, mntreadreply, mh);
		poperror();
		qlock(q);
		qlocked = 1;

M gnot/fns.h => gnot/fns.h +1 -0
@@ 155,6 155,7 @@ void	touser(void);
void	tsleep(Rendez*, int (*)(void*), void*, int);
void	twakeme(Alarm*);
void	unlock(Lock*);
void	urpreset(void);
void	usepage(Page*, int);
void	userinit(void);
void	validaddr(ulong, ulong, int);

M gnot/main.c => gnot/main.c +1 -0
@@ 313,4 313,5 @@ confinit(void)
	if(*(uchar*)MOUSE & (1<<4))
		conf.nbitbyte *= 2;	/* ldepth 1 */
	conf.nfont = 10*mul;
	conf.nurp = 32;
}

M gnot/sturp.c => gnot/sturp.c +16 -5
@@ 7,7 7,6 @@
#include	"errno.h"

enum {
	Nurp=		32,
	MSrexmit=	1000,
	Nmask=		0x7,
};


@@ 97,7 96,7 @@ struct Urp {
#define	OPEN		0x8
#define CLOSING		0x10

Urp	urp[Nurp];
Urp	*urp;

/*
 *  predeclared


@@ 121,6 120,13 @@ static void	urpvomit(char*, Urp*);

Qinfo urpinfo = { urpciput, urpoput, urpopen, urpclose, "urp" };

void
urpreset(void)
{
	newqinfo(&urpinfo);
	urp = (Urp *)ialloc(conf.nurp*sizeof(Urp), 0);
}

static void
urpopen(Queue *q, Stream *s)
{


@@ 131,14 137,17 @@ urpopen(Queue *q, Stream *s)
	/*
	 *  find a free urp structure
	 */
	for(up = urp; up < &urp[Nurp]; up++){
	for(up = urp; up < &urp[conf.nurp]; up++){
		qlock(up);
		if(up->state == 0)
			break;
		qunlock(up);
	}
	if(up == &urp[Nurp])
	if(up == &urp[conf.nurp]){
		q->ptr = 0;
		WR(q)->ptr = 0;
		error(0, Egreg);
	}

	q->ptr = q->other->ptr = up;
	up->rq = q;


@@ 177,6 186,8 @@ urpclose(Queue *q)
	int i;

	up = (Urp *)q->ptr;
	if(up == 0)
		return;

	/*
	 *  wait for all outstanding messages to drain, tell kernel


@@ 967,7 978,7 @@ urpdump(void)
{
	Urp *up;

	for(up = urp; up < &urp[Nurp]; up++)
	for(up = urp; up < &urp[conf.nurp]; up++)
		if(up->rq)
			urpvomit("", up);
}

M port/devdk.c => port/devdk.c +1 -1
@@ 551,7 551,7 @@ void
dkreset(void)
{
	newqinfo(&dkmuxinfo);
	newqinfo(&urpinfo);
	urpreset();
}

/*

M port/devmnt.c => port/devmnt.c +29 -1
@@ 54,6 54,7 @@ struct Mnthdr
	Rendez	r;
	Proc	*p;
	Mntbuf	*mbr;
	int	readreply;	/* true if we are reader or our reply has come */
};

struct


@@ 670,6 671,11 @@ mnterrdequeue(MntQ *q, Mnthdr *mh)		/* queue is unlocked */
	qunlock(q);

}
int
mntreadreply(void *a)
{
	return ((Mnthdr *)a)->readreply;
}
void
mntxmit(Mnt *m, Mnthdr *mh)
{


@@ 760,6 766,7 @@ mntxmit(Mnt *m, Mnthdr *mh)
		mqfree(q);
		nexterror();
	}
	mh->readreply = 0;
	if((*devtab[q->msg->type].write)(q->msg, mbw->buf, n) != n){
		print("short write in mntxmit\n");
		error(0, Eshortmsg);


@@ 790,6 797,7 @@ mntxmit(Mnt *m, Mnthdr *mh)
			if(w = q->writer){	/* advance a writer to reader */
				q->reader = w->p;
				q->writer = w->next;
				w->readreply = 1;
				wakeup(&w->r);
			}
			qunlock(q);


@@ 812,6 820,7 @@ mntxmit(Mnt *m, Mnthdr *mh)
					q->writer = w->next;
				else
					ow->next = w->next;
				w->readreply = 1;
				wakeup(&w->r);
				goto Read;
			}


@@ 827,7 836,7 @@ mntxmit(Mnt *m, Mnthdr *mh)
			mnterrdequeue(q, mh);
			nexterror();
		}
		sleep(&mh->r, return0, 0);
		sleep(&mh->r, mntreadreply, mh);
		poperror();
		qlock(q);
		qlocked = 1;


@@ 859,3 868,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 port/sturp.c => port/sturp.c +16 -5
@@ 7,7 7,6 @@
#include	"errno.h"

enum {
	Nurp=		32,
	MSrexmit=	1000,
	Nmask=		0x7,
};


@@ 97,7 96,7 @@ struct Urp {
#define	OPEN		0x8
#define CLOSING		0x10

Urp	urp[Nurp];
Urp	*urp;

/*
 *  predeclared


@@ 121,6 120,13 @@ static void	urpvomit(char*, Urp*);

Qinfo urpinfo = { urpciput, urpoput, urpopen, urpclose, "urp" };

void
urpreset(void)
{
	newqinfo(&urpinfo);
	urp = (Urp *)ialloc(conf.nurp*sizeof(Urp), 0);
}

static void
urpopen(Queue *q, Stream *s)
{


@@ 131,14 137,17 @@ urpopen(Queue *q, Stream *s)
	/*
	 *  find a free urp structure
	 */
	for(up = urp; up < &urp[Nurp]; up++){
	for(up = urp; up < &urp[conf.nurp]; up++){
		qlock(up);
		if(up->state == 0)
			break;
		qunlock(up);
	}
	if(up == &urp[Nurp])
	if(up == &urp[conf.nurp]){
		q->ptr = 0;
		WR(q)->ptr = 0;
		error(0, Egreg);
	}

	q->ptr = q->other->ptr = up;
	up->rq = q;


@@ 177,6 186,8 @@ urpclose(Queue *q)
	int i;

	up = (Urp *)q->ptr;
	if(up == 0)
		return;

	/*
	 *  wait for all outstanding messages to drain, tell kernel


@@ 967,7 978,7 @@ urpdump(void)
{
	Urp *up;

	for(up = urp; up < &urp[Nurp]; up++)
	for(up = urp; up < &urp[conf.nurp]; up++)
		if(up->rq)
			urpvomit("", up);
}

M power/conf.h => power/conf.h +1 -0
@@ 23,6 23,7 @@ Conftab conftab[] = {
	{"nsrv", &conf.nsrv },
	{"nnoifc", &conf.nnoifc },
	{"nnoconv", &conf.nnoconv },
	{"nurp", &conf.nurp },
	{ 0, 0 },
};


M power/dat.h => power/dat.h +1 -0
@@ 144,6 144,7 @@ struct Conf
	ulong	nsrv;		/* public servers (devsrv.c) */
	ulong	nnoifc;		/* number of nonet interfaces */
	ulong	nnoconv;	/* number of nonet conversations/ifc */
	ulong	nurp;		/* max urp conversations */
};

struct Dev

M power/fns.h => power/fns.h +1 -0
@@ 179,6 179,7 @@ void	twakeme(Alarm*);
void	unlock(Lock*);
void	usepage(Page*, int);
void	userinit(void);
void	urpreset(void);
void	validaddr(ulong, ulong, int);
void	vecinit(void);
void	vector80(void);