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/dev/mse | |
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/dev/mse')
-rw-r--r-- | sys/dev/mse/mse.c | 76 |
1 files changed, 43 insertions, 33 deletions
diff --git a/sys/dev/mse/mse.c b/sys/dev/mse/mse.c index 8e9fa7b..96f62e5 100644 --- a/sys/dev/mse/mse.c +++ b/sys/dev/mse/mse.c @@ -11,7 +11,7 @@ * this software for any purpose. It is provided "as is" * without express or implied warranty. * - * $Id: mse.c,v 1.18 1995/11/29 14:39:47 julian Exp $ + * $Id: mse.c,v 1.19 1995/12/06 23:42:53 bde Exp $ */ /* * Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and @@ -55,20 +55,16 @@ #include <sys/ioctl.h> #include <sys/uio.h> #include <sys/devconf.h> +#include <sys/conf.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #include <machine/clock.h> #include <i386/isa/isa_device.h> #include <i386/isa/icu.h> -#ifdef JREMOD -#include <sys/conf.h> -#include <sys/kernel.h> -#ifdef DEVFS -#include <sys/devfsext.h> -#endif /*DEVFS*/ -#define CDEV_MAJOR 27 -#endif /*JREMOD*/ static int mseprobe(struct isa_device *); static int mseattach(struct isa_device *); @@ -77,6 +73,18 @@ struct isa_driver msedriver = { mseprobe, mseattach, "mse" }; +static d_open_t mseopen; +static d_close_t mseclose; +static d_read_t mseread; +static d_select_t mseselect; + +#define CDEV_MAJOR 27 +struct cdevsw mse_cdevsw = + { mseopen, mseclose, mseread, nowrite, /*27*/ + noioc, nostop, nullreset, nodevtotty,/* mse */ + mseselect, nommap, NULL, "mse", NULL, -1 }; + + /* * Software control structure for mouse. The sc_enablemouse(), * sc_disablemouse() and sc_getmouse() routines must be called spl'd(). @@ -96,6 +104,10 @@ struct mse_softc { int sc_buttons; int sc_bytesread; u_char sc_bytes[PROTOBYTES]; +#ifdef DEVFS + void *devfs_token; + void *n_devfs_token; +#endif } mse_sc[NMSE]; /* Flags */ @@ -238,17 +250,31 @@ int mseattach(idp) struct isa_device *idp; { - struct mse_softc *sc = &mse_sc[idp->id_unit]; + char name[32]; + int unit = idp->id_unit; + struct mse_softc *sc = &mse_sc[unit]; sc->sc_port = idp->id_iobase; - kdc_mse[idp->id_unit].kdc_state = DC_IDLE; + kdc_mse[unit].kdc_state = DC_IDLE; +#ifdef DEVFS + sprintf(name,"mse%d", unit); + /* path name devsw minor */ + sc->devfs_token = devfs_add_devsw( "/", name, &mse_cdevsw, unit << 1, + /*type uid gid perm*/ + DV_CHR, 0, 0, 0600); + sprintf(name,"nmse%d", unit); + /* path name devsw minor */ + sc->n_devfs_token = devfs_add_devsw("/", name, &mse_cdevsw, (unit<<1)+1, + /*type uid gid perm*/ + DV_CHR, 0, 0, 0600); +#endif return (1); } /* * Exclusive open the mouse, initialize it and enable interrupts. */ -int +static int mseopen(dev, flags, fmt, p) dev_t dev; int flags; @@ -281,7 +307,7 @@ mseopen(dev, flags, fmt, p) /* * mseclose: just turn off mouse innterrupts. */ -int +static int mseclose(dev, flags, fmt, p) dev_t dev; int flags; @@ -304,7 +330,7 @@ mseclose(dev, flags, fmt, p) * using bytes 4 and 5. * (Yes this is cheesy, but it makes the X386 server happy, so...) */ -int +static int mseread(dev, uio, ioflag) dev_t dev; struct uio *uio; @@ -366,7 +392,7 @@ mseread(dev, uio, ioflag) /* * mseselect: check for mouse input to be processed. */ -int +static int mseselect(dev, rw, p) dev_t dev; int rw; @@ -575,12 +601,6 @@ mse_getati(port, dx, dy, but) outb(port + MSE_PORTB, MSE_INPORT_INTREN); } -#ifdef JREMOD -struct cdevsw mse_cdevsw = - { mseopen, mseclose, mseread, nowrite, /*27*/ - noioc, nostop, nullreset, nodevtotty,/* mse */ - mseselect, nommap, NULL }; - static mse_devsw_installed = 0; static void mse_drvinit(void *unused) @@ -588,23 +608,13 @@ static void mse_drvinit(void *unused) dev_t dev; if( ! mse_devsw_installed ) { - dev = makedev(CDEV_MAJOR,0); - cdevsw_add(&dev,&mse_cdevsw,NULL); + dev = makedev(CDEV_MAJOR, 0); + cdevsw_add(&dev,&mse_cdevsw, NULL); mse_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*/ - "/", "mse", major(dev), 0, DV_CHR, 0, 0, 0600); - } -#endif } } SYSINIT(msedev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,mse_drvinit,NULL) -#endif /* JREMOD */ #endif /* NMSE */ |