From fb81b5651445471f792330e07b9796f91c3b8094 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Wed, 20 Feb 1991 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1991-02-20 --- gnot/fcall.h | 88 ----------------------------------------------- port/devmnt.c | 5 +-- power/devhotrod.c | 22 ++++++++---- power/fcall.h | 88 ----------------------------------------------- 4 files changed, 18 insertions(+), 185 deletions(-) delete mode 100644 gnot/fcall.h delete mode 100644 power/fcall.h diff --git a/gnot/fcall.h b/gnot/fcall.h deleted file mode 100644 index f81ca5ea8133853dfb67ff92a623e5df4a22eb1d..0000000000000000000000000000000000000000 --- a/gnot/fcall.h +++ /dev/null @@ -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); diff --git a/port/devmnt.c b/port/devmnt.c index f92f4d161d205652f40188606c888974b7f1103e..b6d0dfa6794617d1503230ccd70523295684d913 100644 --- a/port/devmnt.c +++ b/port/devmnt.c @@ -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 diff --git a/power/devhotrod.c b/power/devhotrod.c index 3b1228b8fa07016e650103b198d27c9acb5cd527..eb94a10f5556706dbe026b72c125d751ee6bfac0 100644 --- a/power/devhotrod.c +++ b/power/devhotrod.c @@ -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"); diff --git a/power/fcall.h b/power/fcall.h deleted file mode 100644 index f81ca5ea8133853dfb67ff92a623e5df4a22eb1d..0000000000000000000000000000000000000000 --- a/power/fcall.h +++ /dev/null @@ -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);