diff options
author | julian <julian@FreeBSD.org> | 1995-12-08 11:19:42 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 1995-12-08 11:19:42 +0000 |
commit | 1900eea896e2aaeae8a9fa8affa5fded2068c9b4 (patch) | |
tree | 5150d199464d64c1021f91b2c2f112d48546a8bf /sys/gnu | |
parent | aaf9d7f10ecc63adae1dc4f55cfd31a2926c605a (diff) | |
download | FreeBSD-src-1900eea896e2aaeae8a9fa8affa5fded2068c9b4.zip FreeBSD-src-1900eea896e2aaeae8a9fa8affa5fded2068c9b4.tar.gz |
Pass 3 of the great devsw changes
most devsw referenced functions are now static, as they are
in the same file as their devsw structure. I've also added DEVFS
support for nearly every device in the system, however
many of the devices have 'incorrect' names under DEVFS
because I couldn't quickly work out the correct naming conventions.
(but devfs won't be coming on line for a month or so anyhow so that doesn't
matter)
If you "OWN" a device which would normally have an entry in /dev
then search for the devfs_add_devsw() entries and munge to make them right..
check out similar devices to see what I might have done in them in you
can't see what's going on..
for a laugh compare conf.c conf.h defore and after... :)
I have not doen DEVFS entries for any DISKSLICE devices yet as that will be
a much more complicated job.. (pass 5 :)
pass 4 will be to make the devsw tables of type (cdevsw * )
rather than (cdevsw)
seems to work here..
complaints to the usual places.. :)
Diffstat (limited to 'sys/gnu')
-rw-r--r-- | sys/gnu/i386/isa/dgb.c | 89 | ||||
-rw-r--r-- | sys/gnu/i386/isa/nic3008.c | 76 | ||||
-rw-r--r-- | sys/gnu/i386/isa/nic3009.c | 70 | ||||
-rw-r--r-- | sys/gnu/isdn/iispy.c | 91 | ||||
-rw-r--r-- | sys/gnu/isdn/iitel.c | 66 | ||||
-rw-r--r-- | sys/gnu/isdn/iitty.c | 89 | ||||
-rw-r--r-- | sys/gnu/isdn/isdn.c | 62 |
7 files changed, 304 insertions, 239 deletions
diff --git a/sys/gnu/i386/isa/dgb.c b/sys/gnu/i386/isa/dgb.c index 68499f8..8187b44 100644 --- a/sys/gnu/i386/isa/dgb.c +++ b/sys/gnu/i386/isa/dgb.c @@ -1,5 +1,5 @@ /*- - * dgb.c $Id: dgb.c,v 1.8 1995/12/06 23:52:08 bde Exp $ + * dgb.c $Id: dgb.c,v 1.9 1995/12/07 12:45:18 davidg Exp $ * * Digiboard driver. * @@ -40,6 +40,9 @@ #include <sys/malloc.h> #include <sys/syslog.h> #include <sys/devconf.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #include <machine/clock.h> @@ -54,12 +57,6 @@ #include <gnu/i386/isa/dgfep.h> #include <gnu/i386/isa/dgreg.h> -#ifdef JREMOD -#ifdef DEVFS -#include <sys/devfsext.h> -#endif /*DEVFS*/ -#define CDEV_MAJOR 58 -#endif /*JREMOD*/ #define CALLOUT_MASK 0x80 #define CONTROL_MASK 0x60 @@ -132,6 +129,14 @@ struct dgb_p { u_char draining; /* port is being drained now */ u_char used; /* port is being used now */ u_char mustdrain; /* data must be waited to drain in dgbparam() */ +#ifdef DEVFS + struct { + void *tty; + void *init; + void *lock; + void *cua; + } devfs_token; +#endif }; /* Digiboard per-board structure */ @@ -190,6 +195,20 @@ struct isa_driver dgbdriver = { dgbprobe, dgbattach, "dgb",0 }; +static d_open_t dgbopen; +static d_close_t dgbclose; +static d_read_t dgbread; +static d_write_t dgbwrite; +static d_ioctl_t dgbioctl; +static d_stop_t dgbstop; +static d_ttycv_t dgbdevtotty; + +#define CDEV_MAJOR 58 +struct cdevsw dgb_cdevsw = + { dgbopen, dgbclose, dgbread, dgbwrite, /*58*/ + dgbioctl, dgbstop, nxreset, dgbdevtotty, /* dgb */ + ttselect, nommap, NULL, "dgb", NULL, -1 }; + static speed_t dgbdefaultrate = TTYDEF_SPEED; static u_int dgb_events; /* input chars + weighted output completions */ static int dgbmajor; @@ -437,6 +456,7 @@ dgbattach(dev) ushort *pstat; int lowwater; int nports=0; + char name[32]; if(sc->status!=ENABLED) { DPRINT2("dbg%d: try to attach a disabled card\n",unit); @@ -832,6 +852,28 @@ load_fep: termioschars(&port->it_in); port->it_in.c_ispeed = port->it_in.c_ospeed = dgbdefaultrate; port->it_out = port->it_in; +#ifdef DEVFS +/*XXX*/ /* fix the minor numbers */ + sprintf(name,"dgb%d.%d",unit,i); + port->devfs_token.tty = devfs_add_devsw("/",name, + &dgb_cdevsw,(unit*32)+i, /*mytical number */ + DV_CHR, 0, 0, 0600); + + sprintf(name,"idgb%d.%d",unit,i); + port->devfs_token.tty = devfs_add_devsw("/",name, + &dgb_cdevsw,(unit*32)+i + 64, /*mytical number */ + DV_CHR, 0, 0, 0600); + + sprintf(name,"ldgb%d.%d",unit,i); + port->devfs_token.tty = devfs_add_devsw("/",name, + &dgb_cdevsw,(unit*32)+i + 128, /*mytical number */ + DV_CHR, 0, 0, 0600); + + sprintf(name,"dgbcua%d.%d",unit,i); + port->devfs_token.tty = devfs_add_devsw("/",name, + &dgb_cdevsw,(unit*32)+i + 192, /*mytical number */ + DV_CHR, 0, 0, 0600); +#endif } hidewin(sc); @@ -843,7 +885,7 @@ load_fep: } /* ARGSUSED */ -int +static int dgbopen(dev, flag, mode, p) dev_t dev; int flag; @@ -1011,7 +1053,7 @@ out: } /*ARGSUSED*/ -int +static int dgbclose(dev, flag, mode, p) dev_t dev; int flag; @@ -1087,7 +1129,7 @@ wakeup((caddr_t)chan); } -int +static int dgbread(dev, uio, flag) dev_t dev; struct uio *uio; @@ -1111,7 +1153,7 @@ dgbread(dev, uio, flag) return error; } -int +static int dgbwrite(dev, uio, flag) dev_t dev; struct uio *uio; @@ -1363,7 +1405,7 @@ dgbintr(unit) { } -int +static int dgbioctl(dev, cmd, data, flag, p) dev_t dev; int cmd; @@ -1989,36 +2031,21 @@ fepcmd(port, cmd, op1, op2, ncmds, bytecmd) port->unit, port->pnum); } -#ifdef JREMOD -struct cdevsw dgb_cdevsw = - { dgbopen, dgbclose, dgbread, dgbwrite, /*58*/ - dgbioctl, dgbstop, nxreset, dgbdevtotty, /* dgb */ - ttselect, nommap, NULL }; static dgb_devsw_installed = 0; -static void dgb_drvinit(void *unused) +static void +dgb_drvinit(void *unused) { dev_t dev; if( ! dgb_devsw_installed ) { - dev = makedev(CDEV_MAJOR,0); - cdevsw_add(&dev,&dgb_cdevsw,NULL); + dev = makedev(CDEV_MAJOR, 0); + cdevsw_add(&dev,&dgb_cdevsw, NULL); dgb_devsw_installed = 1; -#ifdef DEVFS - { - int x; -/* default for a simple device with no probe routine (usually delete this) */ - x=devfs_add_devsw( -/* path name major minor type uid gid perm*/ - "/", "dgb", major(dev), 0, DV_CHR, 0, 0, 0600); - } -#endif } } SYSINIT(dgbdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,dgb_drvinit,NULL) -#endif /* JREMOD */ - #endif /* NDGB > 0 */ diff --git a/sys/gnu/i386/isa/nic3008.c b/sys/gnu/i386/isa/nic3008.c index a685131..85a4081 100644 --- a/sys/gnu/i386/isa/nic3008.c +++ b/sys/gnu/i386/isa/nic3008.c @@ -1,6 +1,6 @@ -static char nic38_id[] = "@(#)$Id: nic3008.c,v 1.10 1995/11/29 10:47:04 julian Exp $"; +static char nic38_id[] = "@(#)$Id: nic3008.c,v 1.11 1995/11/29 14:39:07 julian Exp $"; /******************************************************************************* - * II - Version 0.1 $Revision: 1.10 $ $State: Exp $ + * II - Version 0.1 $Revision: 1.11 $ $State: Exp $ * * Copyright 1994 Dietmar Friede ******************************************************************************* @@ -10,6 +10,10 @@ static char nic38_id[] = "@(#)$Id: nic3008.c,v 1.10 1995/11/29 10:47:04 juli * ******************************************************************************* * $Log: nic3008.c,v $ + * Revision 1.11 1995/11/29 14:39:07 julian + * If you're going to mechanically replicate something in 50 files + * it's best to not have a (compiles cleanly) typo in it! (sigh) + * * Revision 1.10 1995/11/29 10:47:04 julian * OK, that's it.. * That's EVERY SINGLE driver that has an entry in conf.c.. @@ -69,24 +73,20 @@ static char nic38_id[] = "@(#)$Id: nic3008.c,v 1.10 1995/11/29 10:47:04 juli #include "nic.h" #if NNIC > 0 -#include "param.h" -#include "ioctl.h" -#include "kernel.h" -#include "systm.h" +#include <sys/param.h> +#include <sys/ioctl.h> +#include <sys/kernel.h> +#include <sys/systm.h> #include <sys/conf.h> #include <sys/proc.h> - -#include "i386/isa/isa_device.h" -#include "gnu/i386/isa/nic3008.h" -#include "gnu/i386/isa/niccyreg.h" -#include "gnu/isdn/isdn_ioctl.h" - -#ifdef JREMOD #ifdef DEVFS #include <sys/devfsext.h> #endif /*DEVFS*/ -#define CDEV_MAJOR 54 -#endif /*JREMOD*/ + +#include <i386/isa/isa_device.h> +#include <gnu/i386/isa/nic3008.h> +#include <gnu/i386/isa/niccyreg.h> +#include <gnu/isdn/isdn_ioctl.h> #define OPEN 1 @@ -131,6 +131,16 @@ static short bsintr; struct isa_driver nicdriver = {nicprobe, nicattach, "nic"}; +static d_open_t nicopen; +static d_close_t nicclose; +static d_ioctl_t nicioctl; + +#define CDEV_MAJOR 54 +struct cdevsw nic_cdevsw = + { nicopen, nicclose, noread, nowrite, /*54*/ + nicioctl, nostop, nullreset, nodevtotty,/* nic */ + seltrue, nommap, NULL, "nic", NULL, -1 }; + typedef enum { DISCON, ISDISCON, DIAL, CALLED, CONNECT, IDLE, ACTIVE @@ -160,6 +170,9 @@ struct nic_softc u_char sc_ctrl; short sc_stat; chan_t sc_chan[2]; +#ifdef DEVFS + void *devfs_token; +#endif } nic_sc[NNIC]; static void badstate __P((mbx_type *mbx, int n, int mb, dpr_type *dpr)); @@ -226,6 +239,7 @@ nicattach(struct isa_device * is) dpr_type *dpr; int cn; isdn_ctrl_t *ctrl0, *ctrl1; + char name[32]; sc = &nic_sc[is->id_unit]; dpr = sc->sc_dpr; @@ -257,6 +271,11 @@ nicattach(struct isa_device * is) dpr->card_number = is->id_unit; dpr->int_flg_pc = 0xff; reset_req(sc, MBX_MU, 4); +#ifdef DEVFS + sprintf(name,"nic%d",is->id_unit); + sc->devfs_token = devfs_add_devsw( "/isdn", name, + &nic_cdevsw,is->id_unit, DV_CHR, 0, 0, 0600 ); +#endif return (1); } @@ -605,7 +624,7 @@ reset_card(struct nic_softc * sc) * * We forbid all but first open */ -int +static int nicopen(dev_t dev, int flags, int fmt, struct proc *p) { struct nic_softc *sc; @@ -636,7 +655,7 @@ nicopen(dev_t dev, int flags, int fmt, struct proc *p) /* * nicclose() Close device */ -int +static int nicclose(dev_t dev, int flags, int fmt, struct proc *p) { struct nic_softc *sc = &nic_sc[minor(dev)]; @@ -645,7 +664,7 @@ nicclose(dev_t dev, int flags, int fmt, struct proc *p) return (0); } -int +static int nicioctl(dev_t dev, int cmd, caddr_t data, int flags, struct proc *p) { int error; @@ -1225,12 +1244,6 @@ nicintr(int unit) } -#ifdef JREMOD -struct cdevsw nic_cdevsw = - { nicopen, nicclose, noread, nowrite, /*54*/ - nicioctl, nostop, nullreset, nodevtotty,/* nic */ - seltrue, nommap, NULL }; - static nic_devsw_installed = 0; static void nic_drvinit(void *unused) @@ -1238,23 +1251,12 @@ static void nic_drvinit(void *unused) dev_t dev; if( ! nic_devsw_installed ) { - dev = makedev(CDEV_MAJOR,0); - cdevsw_add(&dev,&nic_cdevsw,NULL); + dev = makedev(CDEV_MAJOR ,0); + cdevsw_add(&dev,&nic_cdevsw, NULL); nic_devsw_installed = 1; -#ifdef DEVFS - { - int x; -/* default for a simple device with no probe routine (usually delete this) */ - x=devfs_add_devsw( -/* path name devsw minor type uid gid perm*/ - "/", "nic", major(dev), 0, DV_CHR, 0, 0, 0600); - } -#endif } } SYSINIT(nicdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,nic_drvinit,NULL) -#endif /* JREMOD */ - #endif /* NNIC > 0 */ diff --git a/sys/gnu/i386/isa/nic3009.c b/sys/gnu/i386/isa/nic3009.c index 0a6fe04..8359c9d 100644 --- a/sys/gnu/i386/isa/nic3009.c +++ b/sys/gnu/i386/isa/nic3009.c @@ -1,6 +1,6 @@ -static char nic39_id[] = "@(#)$Id: nic3009.c,v 1.10 1995/11/29 10:47:05 julian Exp $"; +static char nic39_id[] = "@(#)$Id: nic3009.c,v 1.11 1995/11/29 14:39:08 julian Exp $"; /******************************************************************************* - * II - Version 0.1 $Revision: 1.10 $ $State: Exp $ + * II - Version 0.1 $Revision: 1.11 $ $State: Exp $ * * Copyright 1994 Dietmar Friede ******************************************************************************* @@ -10,6 +10,10 @@ static char nic39_id[] = "@(#)$Id: nic3009.c,v 1.10 1995/11/29 10:47:05 juli * ******************************************************************************* * $Log: nic3009.c,v $ + * Revision 1.11 1995/11/29 14:39:08 julian + * If you're going to mechanically replicate something in 50 files + * it's best to not have a (compiles cleanly) typo in it! (sigh) + * * Revision 1.10 1995/11/29 10:47:05 julian * OK, that's it.. * That's EVERY SINGLE driver that has an entry in conf.c.. @@ -74,18 +78,15 @@ static char nic39_id[] = "@(#)$Id: nic3009.c,v 1.10 1995/11/29 10:47:05 juli #include <sys/systm.h> #include <sys/conf.h> #include <sys/proc.h> - -#include "i386/isa/isa_device.h" -#include "gnu/i386/isa/nic3009.h" -#include "gnu/i386/isa/niccyreg.h" -#include "gnu/isdn/isdn_ioctl.h" - -#ifdef JREMOD #ifdef DEVFS #include <sys/devfsext.h> #endif /*DEVFS*/ -#define CDEV_MAJOR 60 -#endif /*JREMOD*/ + +#include <i386/isa/isa_device.h> +#include <gnu/i386/isa/nic3009.h> +#include <gnu/i386/isa/niccyreg.h> +#include <gnu/isdn/isdn_ioctl.h> + #define OPEN 1 #define LOAD_HEAD 3 @@ -122,6 +123,17 @@ extern int nnic_listen __P((int cn, int ap, int inf_mask, extern int nnic_output __P((int cn)); extern int nnic_state __P((int cn)); +static d_open_t nnicopen; +static d_close_t nnicclose; +static d_ioctl_t nnicioctl; + +#define CDEV_MAJOR 60 +struct cdevsw nnic_cdevsw = + { nnicopen, nnicclose, noread, nowrite, /*60*/ + nnicioctl, nostop, nullreset, nodevtotty,/* nnic */ + seltrue, nommap, NULL, "nnic", NULL, -1 }; + + static short bsintr; struct isa_driver nnicdriver = {nnicprobe, nnicattach, "nnic"}; @@ -157,6 +169,9 @@ struct nnic_softc u_char sc_type; short sc_stat; chan_t sc_chan[2]; +#ifdef DEVFS + void *devfs_token; +#endif } nnic_sc[NNNIC]; static void badstate __P((mbx_type *mbx, int n, int mb, dpr_type *dpr)); @@ -230,6 +245,7 @@ nnicattach(struct isa_device * is) struct nnic_softc *sc; int cn; isdn_ctrl_t *ctrl0, *ctrl1; + char name[32]; sc = &nnic_sc[is->id_unit]; sc->sc_ctrl = -1; @@ -256,6 +272,11 @@ nnicattach(struct isa_device * is) ctrl0->appl = ctrl1->appl = -1; ctrl0->o_len = ctrl1->o_len = -1; sc->sc_flags= LOAD_ENTITY; +#ifdef DEVFS + sprintf(name,"nnic%d",is->id_unit); + sc->devfs_token = devfs_add_devsw("/isdn",name, + &nnic_cdevsw, is->id_unit, DV_CHR, 0, 0, 0600 ); +#endif return (1); } @@ -548,7 +569,7 @@ nnic_accept(int cn, int an, int rea) return(sel_b2_prot_req(ctrl->unit, C_CHAN(cn), chan->plci, &appl->dlpd)); } -int +static int nnicopen(dev_t dev, int flags, int fmt, struct proc *p) { struct nnic_softc *sc; @@ -578,7 +599,7 @@ nnicopen(dev_t dev, int flags, int fmt, struct proc *p) return (0); } -int +static int nnicclose(dev_t dev, int flags, int fmt, struct proc *p) { struct nnic_softc *sc = &nnic_sc[minor(dev)]; @@ -587,7 +608,7 @@ nnicclose(dev_t dev, int flags, int fmt, struct proc *p) return (0); } -int +static int nnicioctl(dev_t dev, int cmd, caddr_t data, int flags, struct proc *pr) { int error; @@ -1288,12 +1309,6 @@ nnicintr(int unit) } -#ifdef JREMOD -struct cdevsw nnic_cdevsw = - { nnicopen, nnicclose, noread, nowrite, /*60*/ - nnicioctl, nostop, nullreset, nodevtotty,/* nnic */ - seltrue, nommap, NULL }; - static nnic_devsw_installed = 0; static void nnic_drvinit(void *unused) @@ -1301,23 +1316,12 @@ static void nnic_drvinit(void *unused) dev_t dev; if( ! nnic_devsw_installed ) { - dev = makedev(CDEV_MAJOR,0); - cdevsw_add(&dev,&nnic_cdevsw,NULL); + dev = makedev(CDEV_MAJOR, 0); + cdevsw_add(&dev,&nnic_cdevsw, NULL); nnic_devsw_installed = 1; -#ifdef DEVFS - { - int x; -/* default for a simple device with no probe routine (usually delete this) */ - x=devfs_add_devsw( -/* path name devsw minor type uid gid perm*/ - "/", "nnic", major(dev), 0, DV_CHR, 0, 0, 0600); - } -#endif } } SYSINIT(nnicdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,nnic_drvinit,NULL) -#endif /* JREMOD */ - #endif /* NNNIC > 0 */ diff --git a/sys/gnu/isdn/iispy.c b/sys/gnu/isdn/iispy.c index e708d4d..470bea1 100644 --- a/sys/gnu/isdn/iispy.c +++ b/sys/gnu/isdn/iispy.c @@ -1,6 +1,6 @@ -static char _ispyid[] = "@(#)$Id: iispy.c,v 1.6 1995/11/29 14:39:10 julian Exp $"; +static char _ispyid[] = "@(#)$Id: iispy.c,v 1.7 1995/12/06 23:43:37 bde Exp $"; /******************************************************************************* - * II - Version 0.1 $Revision: 1.6 $ $State: Exp $ + * II - Version 0.1 $Revision: 1.7 $ $State: Exp $ * * Copyright 1994 Dietmar Friede ******************************************************************************* @@ -10,6 +10,13 @@ static char _ispyid[] = "@(#)$Id: iispy.c,v 1.6 1995/11/29 14:39:10 julian E * ******************************************************************************* * $Log: iispy.c,v $ + * Revision 1.7 1995/12/06 23:43:37 bde + * Removed unnecessary #includes of <sys/user.h>. Some of these were just + * to get the definitions of TRUE and FALSE which happen to be defined in + * a deeply nested include. + * + * Added nearby #includes of <sys/conf.h> where appropriate. + * * Revision 1.6 1995/11/29 14:39:10 julian * If you're going to mechanically replicate something in 50 files * it's best to not have a (compiles cleanly) typo in it! (sigh) @@ -47,26 +54,22 @@ static char _ispyid[] = "@(#)$Id: iispy.c,v 1.6 1995/11/29 14:39:10 julian E #include "ispy.h" #if NISPY > 0 -#include "param.h" -#include "buf.h" -#include "systm.h" -#include "conf.h" -#include "ioctl.h" -#include "tty.h" -#include "proc.h" -#include "uio.h" +#include <sys/param.h> +#include <sys/buf.h> +#include <sys/systm.h> +#include <sys/ioctl.h> +#include <sys/tty.h> +#include <sys/proc.h> +#include <sys/uio.h> #include <sys/kernel.h> -/*#include "malloc.h"*/ - -#include "gnu/isdn/isdn_ioctl.h" - -#ifdef JREMOD #include <sys/conf.h> #ifdef DEVFS #include <sys/devfsext.h> #endif /*DEVFS*/ -#define CDEV_MAJOR 59 -#endif /*JREMOD*/ +/*#include "malloc.h"*/ + +#include <gnu/isdn/isdn_ioctl.h> + int nispy = NISPY; int ispy_applnr; @@ -92,17 +95,39 @@ struct ispy_data int ilen; } b[ISPYBUF]; int state; +#ifdef DEVFS + void *devfs_token; +#endif } ispy_data[NISPY]; +static d_open_t ispyopen; +static d_close_t ispyclose; +static d_read_t ispyread; +static d_ioctl_t ispyioctl; + +#define CDEV_MAJOR 59 +struct cdevsw ispy_cdevsw = + { ispyopen, ispyclose, ispyread, nowrite, /*59*/ + ispyioctl, nostop, nullreset, nodevtotty,/* ispy */ + seltrue, nommap, NULL, "ispy", NULL, -1 }; + + int ispyattach(int ap) { + char name[32]; struct ispy_data *ispy; + if(next_if >= NISPY) return(-1); ispy= &ispy_data[next_if]; ispy->state= 0; ispy_applnr= ap; +#ifdef DEVFS + sprintf(name,"ispy%d",next_if); + ispy->devfs_token =devfs_add_devsw("/isdn",name,&ispy_cdevsw,next_if, + DV_CHR, 0, 0, 0600); +#endif return(next_if++); } @@ -130,7 +155,7 @@ ispy_input(int no, int len, char *buf, int out) return(len); } -int +static int ispyopen(dev_t dev, int flags, int fmt, struct proc *p) { int err; @@ -147,7 +172,7 @@ ispyopen(dev_t dev, int flags, int fmt, struct proc *p) return (0); } -int +static int ispyclose(dev_t dev, int flags, int fmt, struct proc *p) { struct ispy_data *ispy= &ispy_data[minor(dev)]; @@ -158,7 +183,7 @@ ispyclose(dev_t dev, int flags, int fmt, struct proc *p) return (0); } -int +static int ispyioctl (dev_t dev, int cmd, caddr_t data, int flags, struct proc *p) { int unit = minor(dev); @@ -170,7 +195,7 @@ ispyioctl (dev_t dev, int cmd, caddr_t data, int flags, struct proc *p) return (0); } -int +static int ispyread(dev_t dev, struct uio * uio, int ioflag) { int x; @@ -202,36 +227,20 @@ ispyread(dev_t dev, struct uio * uio, int ioflag) return error; } -#ifdef JREMOD -struct cdevsw ispy_cdevsw = - { ispyopen, ispyclose, ispyread, nowrite, /*59*/ - ispyioctl, nostop, nullreset, nodevtotty,/* ispy */ - seltrue, nommap, NULL }; - static ispy_devsw_installed = 0; -static void ispy_drvinit(void *unused) +static void +ispy_drvinit(void *unused) { dev_t dev; if( ! ispy_devsw_installed ) { - dev = makedev(CDEV_MAJOR,0); - cdevsw_add(&dev,&ispy_cdevsw,NULL); + dev = makedev(CDEV_MAJOR, 0); + cdevsw_add(&dev,&ispy_cdevsw, NULL); ispy_devsw_installed = 1; -#ifdef DEVFS - { - int x; -/* default for a simple device with no probe routine (usually delete this) */ - x=devfs_add_devsw( -/* path name devsw minor type uid gid perm*/ - "/", "ispy", major(dev), 0, DV_CHR, 0, 0, 0600); - } -#endif } } SYSINIT(ispydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,ispy_drvinit,NULL) -#endif /* JREMOD */ - #endif diff --git a/sys/gnu/isdn/iitel.c b/sys/gnu/isdn/iitel.c index 1da86ba..21c87e8 100644 --- a/sys/gnu/isdn/iitel.c +++ b/sys/gnu/isdn/iitel.c @@ -1,6 +1,6 @@ -static char _itelid[] = "@(#)$Id: iitel.c,v 1.7 1995/11/29 10:47:08 julian Exp $"; +static char _itelid[] = "@(#)$Id: iitel.c,v 1.8 1995/11/29 14:39:11 julian Exp $"; /******************************************************************************* - * II - Version 0.1 $Revision: 1.7 $ $State: Exp $ + * II - Version 0.1 $Revision: 1.8 $ $State: Exp $ * * Copyright 1994 Dietmar Friede ******************************************************************************* @@ -10,6 +10,10 @@ static char _itelid[] = "@(#)$Id: iitel.c,v 1.7 1995/11/29 10:47:08 julian E * ******************************************************************************* * $Log: iitel.c,v $ + * Revision 1.8 1995/11/29 14:39:11 julian + * If you're going to mechanically replicate something in 50 files + * it's best to not have a (compiles cleanly) typo in it! (sigh) + * * Revision 1.7 1995/11/29 10:47:08 julian * OK, that's it.. * That's EVERY SINGLE driver that has an entry in conf.c.. @@ -63,15 +67,12 @@ static char _itelid[] = "@(#)$Id: iitel.c,v 1.7 1995/11/29 10:47:08 julian E #include <sys/uio.h> #include <sys/kernel.h> #include <sys/malloc.h> - -#include "gnu/isdn/isdn_ioctl.h" - -#ifdef JREMOD #ifdef DEVFS #include <sys/devfsext.h> #endif /*DEVFS*/ -#define CDEV_MAJOR 57 -#endif /*JREMOD*/ + +#include "gnu/isdn/isdn_ioctl.h" + int nitel = NITEL; static int applnr[NITEL]; @@ -83,6 +84,18 @@ static int next_if =0; #define WRITE_WAIT 8 #define min(a,b) ((a)<(b)?(a):(b)) +static d_open_t itelopen; +static d_close_t itelclose; +static d_read_t itelread; +static d_write_t itelwrite; +static d_ioctl_t itelioctl; + +#define CDEV_MAJOR 57 +struct cdevsw itel_cdevsw = + { itelopen, itelclose, itelread, itelwrite, /*57*/ + itelioctl, nostop, nullreset, nodevtotty,/* itel */ + seltrue, nommap, NULL, "itel", NULL, -1 }; + static struct itel_data { @@ -90,18 +103,28 @@ struct itel_data char obuf[ITEL_SIZE]; int state; int ilen, olen; +#ifdef DEVFS + void *devfs_token; +#endif } itel_data[NITEL]; int itelattach(int ap) { struct itel_data *itel; + char name[32]; + if(next_if >= NITEL) return(-1); itel= &itel_data[next_if]; itel->ilen= itel->olen= 0; itel->state= 0; applnr[next_if]= ap; +#ifdef DEVFS + sprintf(name,"itel%d",next_if); + itel->devfs_token = devfs_add_devsw("/isdn",name,&itel_cdevsw,next_if, + DV_CHR, 0, 0, 0600); +#endif return(next_if++); } @@ -270,42 +293,19 @@ itelwrite(dev_t dev, struct uio * uio, int ioflag) return error; } -#ifdef JREMOD -struct cdevsw itel_cdevsw = - { itelopen, itelclose, itelread, itelwrite, /*57*/ - itelioctl, nostop, nullreset, nodevtotty,/* itel */ - seltrue, nommap, NULL }; - static itel_devsw_installed = 0; static void itel_drvinit(void *unused) { dev_t dev; - dev_t dev_chr; if( ! itel_devsw_installed ) { - dev = makedev(CDEV_MAJOR,0); - cdevsw_add(&dev,&itel_cdevsw,NULL); - dev_chr = dev; -#if defined(BDEV_MAJOR) - dev = makedev(BDEV_MAJOR,0); - bdevsw_add(&dev,&itel_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR, 0); + cdevsw_add(&dev,&itel_cdevsw, NULL); itel_devsw_installed = 1; -#ifdef DEVFS - { - int x; -/* default for a simple device with no probe routine (usually delete this) */ - x=devfs_add_devsw( -/* path name devsw minor type uid gid perm*/ - "/", "itel", major(dev_chr), 0, DV_CHR, 0, 0, 0600); - } -#endif } } SYSINIT(iteldev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,itel_drvinit,NULL) -#endif /* JREMOD */ - #endif diff --git a/sys/gnu/isdn/iitty.c b/sys/gnu/isdn/iitty.c index 140cc91..3c4bf87 100644 --- a/sys/gnu/isdn/iitty.c +++ b/sys/gnu/isdn/iitty.c @@ -1,6 +1,6 @@ -static char _ittyid[] = "@(#)$Id: iitty.c,v 1.14 1995/11/29 14:39:12 julian Exp $"; +static char _ittyid[] = "@(#)$Id: iitty.c,v 1.15 1995/12/05 20:33:47 bde Exp $"; /******************************************************************************* - * II - Version 0.1 $Revision: 1.14 $ $State: Exp $ + * II - Version 0.1 $Revision: 1.15 $ $State: Exp $ * * Copyright 1994 Dietmar Friede ******************************************************************************* @@ -10,6 +10,19 @@ static char _ittyid[] = "@(#)$Id: iitty.c,v 1.14 1995/11/29 14:39:12 julian * ******************************************************************************* * $Log: iitty.c,v $ + * Revision 1.15 1995/12/05 20:33:47 bde + * Fixed ity's d_stop entry. itystop() wasn't used. itystop() is inadequate + * but probably harmless. It's hard to tell because apparently no one runs + * ity. + * + * Fixed ity's d_reset entry. `nx' entries should never be used for existing + * devices. + * + * conf.c: + * Moved a prototype to a better place. + * + * Removed a stale #define. + * * Revision 1.14 1995/11/29 14:39:12 julian * If you're going to mechanically replicate something in 50 files * it's best to not have a (compiles cleanly) typo in it! (sigh) @@ -172,15 +185,26 @@ static char _ittyid[] = "@(#)$Id: iitty.c,v 1.14 1995/11/29 14:39:12 julian #include <sys/kernel.h> #include <sys/syslog.h> #include <sys/types.h> - -#include "gnu/isdn/isdn_ioctl.h" - -#ifdef JREMOD #ifdef DEVFS #include <sys/devfsext.h> #endif /*DEVFS*/ + +#include "gnu/isdn/isdn_ioctl.h" + +static d_open_t ityopen; +static d_close_t ityclose; +static d_read_t ityread; +static d_write_t itywrite; +static d_ioctl_t ityioctl; +static d_stop_t itystop; +static d_ttycv_t itydevtotty; + #define CDEV_MAJOR 56 -#endif /*JREMOD*/ +struct cdevsw ity_cdevsw = + { ityopen, ityclose, ityread, itywrite, /*56*/ + ityioctl, itystop, noreset, itydevtotty,/* ity */ + ttselect, nommap, NULL, "ity", NULL, -1 }; + extern int ityparam __P((struct tty *tp, struct termios *t)); extern void itystart __P((struct tty *tp)); @@ -191,6 +215,10 @@ short ity_addr[NITY]; struct tty ity_tty[NITY]; static int applnr[NITY]; static int next_if= 0; +#ifdef DEVFS +void *devfs_token[NITY]; +void *devfs_token_out[NITY]; +#endif #define UNIT(x) (minor(x)&0x3f) #define OUTBOUND(x) ((minor(x)&0x80)==0x80) @@ -198,15 +226,24 @@ static int next_if= 0; int ityattach(int ap) { + char name[32]; if(next_if >= NITY) return(-1); applnr[next_if]= ap; +#ifdef DEVFS + sprintf(name,"ity%d",next_if); + devfs_token[next_if] = devfs_add_devsw("/isdn",name, + &ity_cdevsw,next_if, DV_CHR, 0, 0, 0600); + sprintf(name,"Oity%d",next_if); /* XXX find out real name */ + devfs_token[next_if] = devfs_add_devsw("/isdn",name, + &ity_cdevsw,(next_if | 0x80), DV_CHR, 0, 0, 0600); +#endif return(next_if++); } /* ARGSUSED */ -int +static int ityopen(dev_t dev, int flag, int mode, struct proc * p) { register struct tty *tp; @@ -261,7 +298,7 @@ ityopen(dev_t dev, int flag, int mode, struct proc * p) } /* ARGSUSED */ -int +static int ityclose(dev, flag, mode, p) dev_t dev; int flag, mode; @@ -280,7 +317,7 @@ ityclose(dev, flag, mode, p) return (0); } -int +static int ityread(dev, uio, flag) dev_t dev; struct uio *uio; @@ -291,7 +328,7 @@ ityread(dev, uio, flag) return ((*linesw[tp->t_line].l_read) (tp, uio, flag)); } -int +static int itywrite(dev, uio, flag) dev_t dev; struct uio *uio; @@ -386,7 +423,7 @@ ity_disconnect(int no) if(tp) (*linesw[tp->t_line].l_modem) (tp, 0); } -int +static int ityioctl(dev, cmd, data, flag,p) dev_t dev; int cmd; @@ -444,7 +481,7 @@ ityparam(tp, t) * Stop output on a line. */ /* ARGSUSED */ -void +static void itystop(struct tty *tp, int flag) { register int s; @@ -458,7 +495,7 @@ itystop(struct tty *tp, int flag) splx(s); } -struct tty * +static struct tty * itydevtotty(dev_t dev) { register int unit = UNIT(dev); @@ -468,36 +505,20 @@ itydevtotty(dev_t dev) return (&ity_tty[unit]); } -#ifdef JREMOD -struct cdevsw ity_cdevsw = - { ityopen, ityclose, ityread, itywrite, /*56*/ - ityioctl, itystop, noreset, itydevtotty,/* ity */ - ttselect, nommap, NULL }; - static ity_devsw_installed = 0; -static void ity_drvinit(void *unused) +static void +ity_drvinit(void *unused) { dev_t dev; if( ! ity_devsw_installed ) { - dev = makedev(CDEV_MAJOR,0); - cdevsw_add(&dev,&ity_cdevsw,NULL); + dev = makedev(CDEV_MAJOR, 0); + cdevsw_add(&dev,&ity_cdevsw, NULL); ity_devsw_installed = 1; -#ifdef DEVFS - { - int x; -/* default for a simple device with no probe routine (usually delete this) */ - x=devfs_add_devsw( -/* path name devsw minor type uid gid perm*/ - "/", "ity", major(dev), 0, DV_CHR, 0, 0, 0600); - } -#endif } } SYSINIT(itydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,ity_drvinit,NULL) -#endif /* JREMOD */ - #endif diff --git a/sys/gnu/isdn/isdn.c b/sys/gnu/isdn/isdn.c index 8686dea..71755e3 100644 --- a/sys/gnu/isdn/isdn.c +++ b/sys/gnu/isdn/isdn.c @@ -1,6 +1,6 @@ -static char _isdnid[] = "@(#)$Id: isdn.c,v 1.7 1995/11/29 10:47:10 julian Exp $"; +static char _isdnid[] = "@(#)$Id: isdn.c,v 1.8 1995/11/29 14:39:12 julian Exp $"; /******************************************************************************* - * II - Version 0.1 $Revision: 1.7 $ $State: Exp $ + * II - Version 0.1 $Revision: 1.8 $ $State: Exp $ * * Copyright 1994 Dietmar Friede ******************************************************************************* @@ -10,6 +10,10 @@ static char _isdnid[] = "@(#)$Id: isdn.c,v 1.7 1995/11/29 10:47:10 julian Ex * ******************************************************************************* * $Log: isdn.c,v $ + * Revision 1.8 1995/11/29 14:39:12 julian + * If you're going to mechanically replicate something in 50 files + * it's best to not have a (compiles cleanly) typo in it! (sigh) + * * Revision 1.7 1995/11/29 10:47:10 julian * OK, that's it.. * That's EVERY SINGLE driver that has an entry in conf.c.. @@ -80,15 +84,12 @@ static char _isdnid[] = "@(#)$Id: isdn.c,v 1.7 1995/11/29 10:47:10 julian Ex #include <sys/systm.h> #include <sys/conf.h> #include <sys/proc.h> - -#include "gnu/isdn/isdn_ioctl.h" - -#ifdef JREMOD #ifdef DEVFS #include <sys/devfsext.h> #endif /*DEVFS*/ -#define CDEV_MAJOR 55 -#endif /*JREMOD*/ + +#include "gnu/isdn/isdn_ioctl.h" + isdn_appl_t isdn_appl[N_ISDN_APPL]; isdn_ctrl_t isdn_ctrl[N_ISDN_CTRL]; @@ -102,6 +103,20 @@ extern int isdn_set_prot __P((int ap, int dir, char *p)); extern int isdn_stat __P((int cn)); static void passout __P((int unit, int l, char *buf)); +static d_open_t isdnopen; +static d_close_t isdnclose; +static d_rdwr_t isdnrw; +static d_read_t isdnread; +static d_write_t isdnwrite; +static d_ioctl_t isdnioctl; + +#define CDEV_MAJOR 55 +struct cdevsw isdn_cdevsw = + { isdnopen, isdnclose, isdnread, nowrite, /*55*/ + isdnioctl, nostop, nullreset, nodevtotty,/* isdn */ + seltrue, nommap, NULL, "isdn", NULL, -1 }; + + static int o_flags, r_flags, bufind[TYPNR]; static char buffer[TYPNR][257]; static u_char appl_list[TYPNR]; @@ -222,6 +237,9 @@ isdn_ctrl_attach(int n) if ((Isdn_Ctrl += n) <= N_ISDN_CTRL) return (c); Isdn_Ctrl = c; +#ifdef DEVFS +/*SOMETHING GOES IN HERE I THINK*/ +#endif return (-1); } @@ -231,7 +249,7 @@ isdn_ctrl_attach(int n) * I forbid all but one open per application. The only programs opening the * isdn device are the ISDN-daemon */ -int +static int isdnopen(dev_t dev, int flags, int fmt, struct proc *p) { int err; @@ -248,14 +266,14 @@ isdnopen(dev_t dev, int flags, int fmt, struct proc *p) return (0); } -int +static int isdnclose(dev_t dev, int flags, int fmt, struct proc *p) { o_flags &= ~(1 << minor(dev)); return (0); } -int +static int isdnread(dev_t dev, struct uio * uio, int ioflag) { int x; @@ -280,7 +298,7 @@ isdnread(dev_t dev, struct uio * uio, int ioflag) return error; } -int +static int isdnioctl(dev_t dev, int cmd, caddr_t data, int flags, struct proc *p) { int err, x, i; @@ -673,15 +691,10 @@ passout(int unit, int l, char *buf) splx(x); } -#ifdef JREMOD -struct cdevsw isdn_cdevsw = - { isdnopen, isdnclose, isdnread, nowrite, /*55*/ - isdnioctl, nostop, nullreset, nodevtotty,/* isdn */ - seltrue, nommap, NULL }; - static isdn_devsw_installed = 0; -static void isdn_drvinit(void *unused) +static void +isdn_drvinit(void *unused) { dev_t dev; @@ -689,20 +702,9 @@ static void isdn_drvinit(void *unused) dev = makedev(CDEV_MAJOR,0); cdevsw_add(&dev,&isdn_cdevsw,NULL); isdn_devsw_installed = 1; -#ifdef DEVFS - { - int x; -/* default for a simple device with no probe routine (usually delete this) */ - x=devfs_add_devsw( -/* path name devsw minor type uid gid perm*/ - "/", "isdn", major(dev), 0, DV_CHR, 0, 0, 0600); - } -#endif } } SYSINIT(isdndev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,isdn_drvinit,NULL) -#endif /* JREMOD */ - #endif /* NISDN > 0 */ |