From b104f81c40a2eb77cab7b0850bafcf216b1b80b9 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Sat, 8 May 1993 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1993-05-08 --- port/net.c | 12 +++--------- port/portdat.h | 30 +++++------------------------- 2 files changed, 8 insertions(+), 34 deletions(-) diff --git a/port/net.c b/port/net.c index fe4aed27985978d97580ca0c4cc301aae48b8a93..2387820ba8c62eb6ced91fb7e98d090894ce8b4f 100644 --- a/port/net.c +++ b/port/net.c @@ -180,16 +180,15 @@ netopen(Chan *c, int omode, Network *np) case Sdataqid: case Sctlqid: id = STREAMID(c->qid.path); + id = (*np->open)(c, id); break; case Qlisten: - streamopen(c, np->devp); id = (*np->listen)(c); - streamclose(c); c->qid.path = STREAMQID(id, Sctlqid); ptclone(c, 1, id); break; case Qclone: - id = (*np->clone)(c); + id = (*np->open)(c, -1); c->qid.path = STREAMQID(id, Sctlqid); ptclone(c, 0, id); break; @@ -200,9 +199,6 @@ netopen(Chan *c, int omode, Network *np) switch(STREAMTYPE(c->qid.path)){ case Sdataqid: case Sctlqid: - streamopen(c, np->devp); - if(np->protop && c->stream->devq->next->info != np->protop) - pushq(c->stream, np->protop); p = findprot(np, id); if(netown(p, up->user, omode&7) < 0) error(Eperm); @@ -221,9 +217,6 @@ netread(Chan *c, void *a, long n, ulong offset, Network *np) int t; char buf[256]; - if(c->stream) - return streamread(c, a, n); - if(c->qid.path&CHDIR) return devdirread(c, a, n, (Dirtab*)np, 0, netgen); @@ -242,6 +235,7 @@ netadd(Network *np, Netprot *p, int id) memset(p, 0, sizeof(Netprot)); p->id = id; + p->net = np; l = &np->prot; for(pp = np->prot; pp; pp = pp->next){ diff --git a/port/portdat.h b/port/portdat.h index 7b04c7256ff766191c5e55b94c9d2b116f83b8a7..1f43b540c96c5b78340faf3fcefced09f5085e92 100644 --- a/port/portdat.h +++ b/port/portdat.h @@ -7,7 +7,6 @@ typedef struct Dev Dev; typedef struct Dirtab Dirtab; typedef struct Egrp Egrp; typedef struct Evalue Evalue; -typedef struct Etherpkt Etherpkt; typedef struct Fgrp Fgrp; typedef struct Image Image; typedef struct IOQ IOQ; @@ -214,25 +213,6 @@ struct Dirtab long perm; }; -/* - * Ethernet packet buffers. - */ -struct Etherpkt -{ - uchar d[6]; - uchar s[6]; - uchar type[2]; - uchar data[1500]; - uchar crc[4]; -}; - -enum -{ - ETHERMINTU = 60, /* minimum transmit size */ - ETHERMAXTU = 1514, /* maximum transmit size */ - ETHERHDRSIZE = 14, /* size of an ethernet header */ -}; - /* SCSI devices. */ enum { @@ -788,12 +768,13 @@ struct Netprot Netprot *next; /* linked list of protections */ ulong mode; char owner[NAMELEN]; + Network *net; }; struct Netinf { char *name; - void (*fill)(Chan*, char*, int); + void (*fill)(Netprot*, char*, int); }; struct Network @@ -801,13 +782,12 @@ struct Network Lock; char *name; int nconv; /* max # of conversations */ - Qinfo *devp; /* device end line disc */ - Qinfo *protop; /* protocol line disc */ - int (*listen)(Chan*); - int (*clone)(Chan*); + int (*listen)(Netprot*); + int (*open)(Netprot*, int); int ninfo; Netinf info[5]; Netprot *prot; /* linked list of protections */ + void *ptr; }; enum