~kris/9p

9hist

fb81b5651445471f792330e07b9796f91c3b8094 — David du Colombier 35 years ago 26da891
Plan 9 from Bell Labs 1991-02-20
4 files changed, 18 insertions(+), 185 deletions(-)

D gnot/fcall.h
M port/devmnt.c
M power/devhotrod.c
D power/fcall.h
D gnot/fcall.h => gnot/fcall.h +0 -88
@@ 1,88 0,0 @@
typedef	struct	Fcall	Fcall;

struct	Fcall
{
	char	type;
	short	fid;
	short	tag;
	union
	{
		struct
		{
			short	newfid;		/* T-Clone */
			short	oldtag;		/* T-Flush */
			Qid	qid;		/* R-Attach, R-Walk, R-Open, R-Create */
		};
		struct
		{
			char	uname[NAMELEN];	/* T-Attach */
			char	aname[NAMELEN];	/* T-Attach */
			char	auth[NAMELEN];	/* T-Attach */
		};
		struct
		{
			char	ename[ERRLEN];	/* R-Error */
		};
		struct
		{
			long	perm;		/* T-Create */ 
			char	name[NAMELEN];	/* T-Walk, T-Create */
			char	mode;		/* T-Create, T-Open */
		};
		struct
		{
			long	offset;		/* T-Read, T-Write */
			long	count;		/* T-Read, T-Write, R-Read */
			char	*data;		/* T-Write, R-Read */
		};
		struct
		{
			char	stat[DIRLEN];	/* T-Wstat, R-Stat */
		};
	};
};

#define	MAXFDATA	8192

enum
{
	Tnop =		50,
	Rnop,
	Tsession =	52,
	Rsession,
/*	Terror =	54,	illegal */
	Rerror =	55,
	Tflush =	56,
	Rflush,
	Tattach =	58,
	Rattach,
	Tclone =	60,
	Rclone,
	Twalk =		62,
	Rwalk,
	Topen =		64,
	Ropen,
	Tcreate =	66,
	Rcreate,
	Tread =		68,
	Rread,
	Twrite =	70,
	Rwrite,
	Tclunk =	72,
	Rclunk,
	Tremove =	74,
	Rremove,
	Tstat =		76,
	Rstat,
	Twstat =	78,
	Rwstat,
};

int	convM2S(char*, Fcall*, int);
int	convS2M(Fcall*, char*);

int	convM2D(char*, Dir*);
int	convD2M(Dir*, char*);

int	fcallconv(void *, int, int, int, int);
int	dirconv(void *, int, int, int, int);

M port/devmnt.c => port/devmnt.c +3 -2
@@ 31,12 31,13 @@ struct MntQ
	Mnthdr	*writer;	/* queue of headers of written messages */
};

#define	BUFSIZE	(MAXFDATA+500) 	/* BUG */
#define	BITROUND 256
#define	BUFSIZE	(MAXFDATA+MAXMSG)
typedef struct Mntbuf Mntbuf;
struct Mntbuf
{
	Mntbuf	*next;
	char	buf[BUFSIZE];
	char	buf[BUFSIZE+BITROUND]; 	/* BUG */
};

struct

M power/devhotrod.c => power/devhotrod.c +15 -7
@@ 40,7 40,7 @@ struct Hotrod{
	HotQ		rq;		/* read this queue to receive replies */
	int		ri;		/* where to read next response */
	Rendez		r;
	uchar		buf[MAXFDATA+100];
	uchar		buf[MAXFDATA+MAXMSG];
};

Hotrod hotrod[Nhotrod];


@@ 63,12 63,12 @@ enum{
void
hotsend(Hotrod *h, Hotmsg *m)
{
print("hotsend send %d %lux %lux\n", m->cmd, m, m->param[0]);
/* print("hotsend send %d %d %lux %lux\n", h->wi, m->cmd, m, m->param[0]); /**/
	h->wq->msg[h->wi] = (Hotmsg*)MP2VME(m);
	do
		delay(1);
	while(h->wq->msg[h->wi]);
print("hotsend done\n");
/* print("hotsend done\n"); /**/
	h->wi++;
	if(h->wi >= NhotQ)
		h->wi = 0;


@@ 179,6 179,7 @@ hotrodopen(Chan *c, int omode)
		delay(100);
		print("reset\n");

#ifdef asdf
		/*
		 * Issue test
		 */


@@ 187,6 188,7 @@ hotrodopen(Chan *c, int omode)
		hotsend(hp, &((User*)(u->p->upage->pa|KZERO))->khot);
		delay(100);
		print("tested\n");
#endif
	}
	c->mode = openmode(omode);
	c->flag |= COPEN;


@@ 229,8 231,10 @@ hotrodread(Chan *c, void *buf, long n)
	hp = &hotrod[c->dev];
	switch(c->qid.path){
	case Qhotrod:
		if(n > sizeof hp->buf)
		if(n > sizeof hp->buf){
			print("hotrod bufsize\n");
			error(Egreg);
		}
		if((((ulong)buf)&(KSEGM|3)) == KSEG0){
			/*
			 *  use supplied buffer, no need to lock for reply


@@ 243,7 247,7 @@ hotrodread(Chan *c, void *buf, long n)
			mp->param[1] = n;
			hotsend(hp, &((User*)(u->p->upage->pa|KZERO))->khot);
			qunlock(hp);
			l = 100*1000*000;
			l = 100*1000*1000;
			do
				n = mp->param[2];
			while(n==0 && --l>0);


@@ 277,6 281,7 @@ hotrodread(Chan *c, void *buf, long n)
		}
		return n;
	}
	print("hotrod read unk\n");
	error(Egreg);
	return 0;
}


@@ 293,8 298,10 @@ hotrodwrite(Chan *c, void *buf, long n)
	hp = &hotrod[c->dev];
	switch(c->qid.path){
	case 1:
		if(n > sizeof hp->buf)
		if(n > sizeof hp->buf){
			print("hotrod write bufsize\n");
			error(Egreg);
		}
		if((((ulong)buf)&(KSEGM|3)) == KSEG0){
			/*
			 *  use supplied buffer, no need to lock for reply


@@ 323,6 330,7 @@ hotrodwrite(Chan *c, void *buf, long n)
		}
		return n;
	}
	print("hotrod write unk\n");
	error(Egreg);
	return 0;
}


@@ 344,7 352,7 @@ hotrodintr(int vec)
{
	Hotrod *hp;

	print("hotrod%d interrupt\n", vec - Vmevec);
/*	print("hotrod%d interrupt\n", vec - Vmevec); /**/
	hp = &hotrod[vec - Vmevec];
	if(hp < hotrod || hp > &hotrod[Nhotrod]){
		print("bad hotrod vec\n");

D power/fcall.h => power/fcall.h +0 -88
@@ 1,88 0,0 @@
typedef	struct	Fcall	Fcall;

struct	Fcall
{
	char	type;
	short	fid;
	short	tag;
	union
	{
		struct
		{
			short	newfid;		/* T-Clone */
			short	oldtag;		/* T-Flush */
			Qid	qid;		/* R-Attach, R-Walk, R-Open, R-Create */
		};
		struct
		{
			char	uname[NAMELEN];	/* T-Attach */
			char	aname[NAMELEN];	/* T-Attach */
			char	auth[NAMELEN];	/* T-Attach */
		};
		struct
		{
			char	ename[ERRLEN];	/* R-Error */
		};
		struct
		{
			long	perm;		/* T-Create */ 
			char	name[NAMELEN];	/* T-Walk, T-Create */
			char	mode;		/* T-Create, T-Open */
		};
		struct
		{
			long	offset;		/* T-Read, T-Write */
			long	count;		/* T-Read, T-Write, R-Read */
			char	*data;		/* T-Write, R-Read */
		};
		struct
		{
			char	stat[DIRLEN];	/* T-Wstat, R-Stat */
		};
	};
};

#define	MAXFDATA	8192

enum
{
	Tnop =		50,
	Rnop,
	Tsession =	52,
	Rsession,
/*	Terror =	54,	illegal */
	Rerror =	55,
	Tflush =	56,
	Rflush,
	Tattach =	58,
	Rattach,
	Tclone =	60,
	Rclone,
	Twalk =		62,
	Rwalk,
	Topen =		64,
	Ropen,
	Tcreate =	66,
	Rcreate,
	Tread =		68,
	Rread,
	Twrite =	70,
	Rwrite,
	Tclunk =	72,
	Rclunk,
	Tremove =	74,
	Rremove,
	Tstat =		76,
	Rstat,
	Twstat =	78,
	Rwstat,
};

int	convM2S(char*, Fcall*, int);
int	convS2M(Fcall*, char*);

int	convM2D(char*, Dir*);
int	convD2M(Dir*, char*);

int	fcallconv(void *, int, int, int, int);
int	dirconv(void *, int, int, int, int);