diff options
79 files changed, 2708 insertions, 743 deletions
diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c index 54db6cd..a0a4f07 100644 --- a/sys/amd64/amd64/mem.c +++ b/sys/amd64/amd64/mem.c @@ -38,7 +38,7 @@ * * from: Utah $Hdr: mem.c 1.13 89/10/08$ * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 - * $Id: mem.c,v 1.18 1995/11/04 13:52:30 bde Exp $ + * $Id: mem.c,v 1.19 1995/11/04 16:00:25 markm Exp $ */ /* @@ -63,26 +63,27 @@ #include <vm/vm_prot.h> #include <vm/pmap.h> +#ifdef JREMOD +#include <sys/kernel.h> +#define CDEV_MAJOR 2 +#endif /*JREMOD*/ + #ifdef DEVFS #include <sys/devfsext.h> -#include "sys/kernel.h" - -static void memdev_init __P((void *)); -SYSINIT(memdev,SI_SUB_DEVFS, SI_ORDER_ANY, memdev_init, NULL) static void -memdev_init(dummy) - void *dummy; +memdevfs_init(dev_t dev) { void * x; -/* path name devsw minor type uid gid perm*/ - x=dev_add("/misc", "mem", mmopen, 0, DV_CHR, 0, 2, 0640); - x=dev_add("/misc", "kmem", mmopen, 1, DV_CHR, 0, 2, 0640); - x=dev_add("/misc", "null", mmopen, 2, DV_CHR, 0, 0, 0666); - x=dev_add("/misc", "random", mmopen, 3, DV_CHR, 0, 0, 0666); - x=dev_add("/misc", "urandom", mmopen, 4, DV_CHR, 0, 0, 0666); - x=dev_add("/misc", "zero", mmopen, 12, DV_CHR, 0, 0, 0666); - x=dev_add("/misc", "io", mmopen, 14, DV_CHR, 0, 2, 0640); + int maj = major(dev); +/* path name major minor type uid gid perm*/ + x=devfs_add_devsw("/misc", "mem", maj, 0, DV_CHR, 0, 2, 0640); + x=devfs_add_devsw("/misc", "kmem", maj, 1, DV_CHR, 0, 2, 0640); + x=devfs_add_devsw("/misc", "null", maj, 2, DV_CHR, 0, 0, 0666); + x=devfs_add_devsw("/misc", "random", maj, 3, DV_CHR, 0, 0, 0666); + x=devfs_add_devsw("/misc", "urandom", maj, 4, DV_CHR, 0, 0, 0666); + x=devfs_add_devsw("/misc", "zero", maj, 12, DV_CHR, 0, 0, 0666); + x=devfs_add_devsw("/misc", "io", maj, 14, DV_CHR, 0, 2, 0640); } #endif /* DEVFS */ @@ -378,3 +379,31 @@ mmioctl(dev, cmd, cmdarg, flags, p) } return (0); } + + + +#ifdef JREMOD +struct cdevsw mem_cdevsw = + { mmopen, mmclose, mmrw, mmrw, /*2*/ + mmioctl, nullstop, nullreset, nodevtotty,/* memory */ + seltrue, memmmap, NULL }; + +static mem_devsw_installed = 0; + +static void mem_drvinit(void *unused) +{ + dev_t dev; + + if( ! mem_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&mem_cdevsw,NULL); + mem_devsw_installed = 1; +#ifdef DEVFS + memdevfs_init(dev); +#endif +} + +SYSINIT(memdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,mem_drvinit,NULL) + +#endif /* JREMOD */ + diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c index c2f3725..c4739ae 100644 --- a/sys/dev/cy/cy.c +++ b/sys/dev/cy/cy.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cy.c,v 1.19 1995/11/26 17:13:23 bde Exp $ + * $Id: cy.c,v 1.20 1995/11/28 09:40:56 julian Exp $ */ #include "cy.h" @@ -398,8 +398,10 @@ static int cy_nr_cd1400s[NCY]; static int volatile RxFifoThreshold = (CD1400_RX_FIFO_SIZE / 2); #ifdef JREMOD +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 48 -static void cy_devsw_install(); #endif /*JREMOD*/ static struct kern_devconf kdc_sio[NCY] = { { @@ -442,9 +444,6 @@ sioprobe(dev) return (0); cy_nr_cd1400s[unit] = 0; sioregisterdev(dev); -#ifdef JREMOD - cy_devsw_install(); -#endif /*JREMOD*/ /* Cyclom-16Y hardware reset (Cyclom-8Ys don't care) */ @@ -2521,6 +2520,7 @@ cystatus(unit) #endif /* CyDebug */ + #ifdef JREMOD struct cdevsw cy_cdevsw = { cyopen, cyclose, cyread, cywrite, /*48*/ @@ -2529,18 +2529,28 @@ struct cdevsw cy_cdevsw = static cy_devsw_installed = 0; -static void cy_devsw_install() +static void cy_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! cy_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&cy_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&cy_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&cy_cdevsw,NULL); cy_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*/ + "/", "cy", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(cydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cy_drvinit,NULL) + #endif /* JREMOD */ + #endif /* NCY > 0 */ diff --git a/sys/dev/cy/cy_isa.c b/sys/dev/cy/cy_isa.c index c2f3725..c4739ae 100644 --- a/sys/dev/cy/cy_isa.c +++ b/sys/dev/cy/cy_isa.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cy.c,v 1.19 1995/11/26 17:13:23 bde Exp $ + * $Id: cy.c,v 1.20 1995/11/28 09:40:56 julian Exp $ */ #include "cy.h" @@ -398,8 +398,10 @@ static int cy_nr_cd1400s[NCY]; static int volatile RxFifoThreshold = (CD1400_RX_FIFO_SIZE / 2); #ifdef JREMOD +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 48 -static void cy_devsw_install(); #endif /*JREMOD*/ static struct kern_devconf kdc_sio[NCY] = { { @@ -442,9 +444,6 @@ sioprobe(dev) return (0); cy_nr_cd1400s[unit] = 0; sioregisterdev(dev); -#ifdef JREMOD - cy_devsw_install(); -#endif /*JREMOD*/ /* Cyclom-16Y hardware reset (Cyclom-8Ys don't care) */ @@ -2521,6 +2520,7 @@ cystatus(unit) #endif /* CyDebug */ + #ifdef JREMOD struct cdevsw cy_cdevsw = { cyopen, cyclose, cyread, cywrite, /*48*/ @@ -2529,18 +2529,28 @@ struct cdevsw cy_cdevsw = static cy_devsw_installed = 0; -static void cy_devsw_install() +static void cy_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! cy_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&cy_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&cy_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&cy_cdevsw,NULL); cy_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*/ + "/", "cy", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(cydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cy_drvinit,NULL) + #endif /* JREMOD */ + #endif /* NCY > 0 */ diff --git a/sys/dev/dgb/dgb.c b/sys/dev/dgb/dgb.c index 1e61971..11a868a 100644 --- a/sys/dev/dgb/dgb.c +++ b/sys/dev/dgb/dgb.c @@ -1,5 +1,5 @@ /*- - * dgb.c $Id: dgb.c,v 1.4 1995/10/12 23:28:31 bde Exp $ + * dgb.c $Id: dgb.c,v 1.5 1995/11/04 13:22:59 bde Exp $ * * Digiboard driver. * @@ -51,6 +51,13 @@ #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 #define CONTROL_INIT_STATE 0x20 @@ -1979,4 +1986,36 @@ 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) +{ + dev_t dev; + + if( ! dgb_devsw_installed ) { + 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/dev/joy/joy.c b/sys/dev/joy/joy.c index 5870e62..e90e90f 100644 --- a/sys/dev/joy/joy.c +++ b/sys/dev/joy/joy.c @@ -43,8 +43,11 @@ #ifdef JREMOD #include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 51 -static void joy_devsw_install(); #endif /*JREMOD*/ /* The game port can manage 4 buttons and 4 variable resistors (usually 2 @@ -105,10 +108,6 @@ joyattach (struct isa_device *dev) joy[dev->id_unit].timeout[0] = joy[dev->id_unit].timeout[1] = 0; printf("joy%d: joystick\n", dev->id_unit); -#ifdef JREMOD - joy_devsw_install(); -#endif /*JREMOD*/ - return 1; } @@ -224,18 +223,28 @@ struct cdevsw joy_cdevsw = static joy_devsw_installed = 0; -static void joy_devsw_install() +static void joy_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! joy_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&joy_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&joy_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&joy_cdevsw,NULL); joy_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*/ + "/", "joy", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(joydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,joy_drvinit,NULL) + #endif /* JREMOD */ + #endif /* NJOY > 0 */ diff --git a/sys/dev/mcd/mcd.c b/sys/dev/mcd/mcd.c index 0571a93..4ab0b9c 100644 --- a/sys/dev/mcd/mcd.c +++ b/sys/dev/mcd/mcd.c @@ -40,7 +40,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: mcd.c,v 1.48 1995/11/04 13:23:35 bde Exp $ + * $Id: mcd.c,v 1.49 1995/11/28 09:41:22 julian Exp $ */ static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore"; @@ -71,9 +71,13 @@ static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore"; #include <i386/isa/mcdreg.h> #ifdef JREMOD +#include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 29 #define BDEV_MAJOR 7 -static void mcd_devsw_install(); #endif /*JREMOD */ #define MCD_TRACE(format, args...) \ @@ -262,10 +266,6 @@ int mcd_attach(struct isa_device *dev) kdc_mcd[dev->id_unit].kdc_state = DC_IDLE; /* name filled in probe */ kdc_mcd[dev->id_unit].kdc_description = mcd_data[dev->id_unit].name; -#ifdef JREMOD - mcd_devsw_install(); -#endif /*JREMOD*/ - return 1; } @@ -1682,18 +1682,33 @@ struct cdevsw mcd_cdevsw = static mcd_devsw_installed = 0; -static void mcd_devsw_install() +static void mcd_drvinit(void *unused) { - dev_t descript; + dev_t dev; + dev_t dev_chr; + if( ! mcd_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&mcd_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&mcd_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&mcd_cdevsw,NULL); + dev_chr = dev; + dev = makedev(BDEV_MAJOR,0); + bdevsw_add(&dev,&mcd_bdevsw,NULL); mcd_devsw_installed = 1; - } +#ifdef DEVFS + { + int x; +/* default for a simple device with no probe routine (usually delete this) */ +/* path name devsw minor type uid gid perm*/ + "/", "rmcd", major(dev_chr), 0, DV_CHR, 0, 0, 0600); + x=devfs_add_devsw( + "/", "mcd", major(dev), 0, DV_BLK, 0, 0, 0600); + } + } +#endif } + +SYSINIT(mcddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,mcd_drvinit,NULL) + #endif /* JREMOD */ + #endif /* NMCD > 0 */ diff --git a/sys/dev/mse/mse.c b/sys/dev/mse/mse.c index 5499a2a..52195fb 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.15 1995/11/04 17:07:37 bde Exp $ + * $Id: mse.c,v 1.16 1995/11/28 09:41:25 julian Exp $ */ /* * Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and @@ -63,8 +63,11 @@ #ifdef JREMOD #include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 27 -static void mse_devsw_install(); #endif /*JREMOD*/ static int mseprobe(struct isa_device *); @@ -239,9 +242,6 @@ mseattach(idp) sc->sc_port = idp->id_iobase; kdc_mse[idp->id_unit].kdc_state = DC_IDLE; -#ifdef JREMOD - mse_devsw_install(); -#endif /*JREMOD*/ return (1); } @@ -583,18 +583,28 @@ struct cdevsw mse_cdevsw = static mse_devsw_installed = 0; -static void mse_devsw_install() +static void mse_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! mse_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&mse_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&mse_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + 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 */ diff --git a/sys/dev/rc/rc.c b/sys/dev/rc/rc.c index 6203aff..e1d80cb 100644 --- a/sys/dev/rc/rc.c +++ b/sys/dev/rc/rc.c @@ -60,8 +60,11 @@ #ifdef JREMOD #include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 63 -static void rc_devsw_install(); #endif /*JREMOD*/ /* Prototypes */ @@ -283,10 +286,6 @@ int rcattach(dvp) rc_wakeup((void *)NULL); rc_wakeup_started = 0; } -#ifdef JREMOD - rc_devsw_install(); -#endif /*JREMOD*/ - return 1; } @@ -1511,18 +1510,28 @@ struct cdevsw rc_cdevsw = static rc_devsw_installed = 0; -static void rc_devsw_install() +static void rc_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! rc_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&rc_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&rc_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&rc_cdevsw,NULL); rc_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*/ + "/", "rc", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(rcdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,rc_drvinit,NULL) + #endif /* JREMOD */ + #endif /* NRC */ diff --git a/sys/dev/scd/scd.c b/sys/dev/scd/scd.c index 7d4fdec..0e2a130 100644 --- a/sys/dev/scd/scd.c +++ b/sys/dev/scd/scd.c @@ -41,7 +41,7 @@ */ -/* $Id: scd.c,v 1.9 1995/11/04 13:23:39 bde Exp $ */ +/* $Id: scd.c,v 1.10 1995/11/28 09:41:36 julian Exp $ */ /* Please send any comments to micke@dynas.se */ @@ -73,9 +73,12 @@ #include <i386/isa/scdreg.h> #ifdef JREMOD +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 45 #define BDEV_MAJOR 16 -static void scd_devsw_install(); #endif /*JREMOD */ #define scd_part(dev) ((minor(dev)) & 7) @@ -224,10 +227,6 @@ int scd_attach(struct isa_device *dev) cd->flags = SCDINIT; cd->audio_status = CD_AS_AUDIO_INVALID; -#ifdef JREMOD - scd_devsw_install(); -#endif /*JREMOD*/ - return 1; } @@ -1529,6 +1528,7 @@ scd_toc_entrys (int unit, struct ioc_read_toc_entry *te) return 0; } + #ifdef JREMOD struct bdevsw scd_bdevsw = { scdopen, scdclose, scdstrategy, scdioctl, /*16*/ @@ -1541,19 +1541,34 @@ struct cdevsw scd_cdevsw = static scd_devsw_installed = 0; -static void scd_devsw_install() +static void scd_drvinit(void *unused) { - dev_t descript; + dev_t dev; + dev_t dev_chr; + if( ! scd_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&scd_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&scd_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&scd_cdevsw,NULL); + dev_chr = dev; + dev = makedev(BDEV_MAJOR,0); + bdevsw_add(&dev,&scd_bdevsw,NULL); scd_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*/ + "/", "rscd", major(dev_chr), 0, DV_CHR, 0, 0, 0600); + x=devfs_add_devsw( + "/", "scd", major(dev), 0, DV_BLK, 0, 0, 0600); + } + } +#endif } + +SYSINIT(scddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,scd_drvinit,NULL) + #endif /* JREMOD */ #endif /* NSCD > 0 */ diff --git a/sys/dev/si/si.c b/sys/dev/si/si.c index 93accc2..7b58916 100644 --- a/sys/dev/si/si.c +++ b/sys/dev/si/si.c @@ -30,7 +30,7 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN * NO EVENT SHALL THE AUTHORS BE LIABLE. * - * $Id: si.c,v 1.16 1995/11/28 07:29:29 bde Exp $ + * $Id: si.c,v 1.17 1995/11/28 09:41:39 julian Exp $ */ #ifndef lint @@ -82,8 +82,10 @@ static char si_copyright1[] = "@(#) (C) Specialix International, 1990,1992", enum si_mctl { GET, SET, BIS, BIC }; #ifdef JREMOD +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 68 -static void si_devsw_install(); #endif /*JREMOD*/ @@ -657,9 +659,6 @@ mem_fail: } done_chartimes = 1; } -#ifdef JREMOD - si_devsw_install(); -#endif /*JREMOD*/ return (1); } @@ -2309,18 +2308,34 @@ struct cdevsw si_cdevsw = static si_devsw_installed = 0; -static void si_devsw_install() +static void si_drvinit(void *unused) { - dev_t descript; + dev_t dev; + dev_t dev_chr; + if( ! si_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&si_cdevsw,NULL); + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&si_cdevsw,NULL); + dev_chr = dev; #if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&si_bdevsw,NULL); + dev = makedev(BDEV_MAJOR,0); + bdevsw_add(&dev,&si_bdevsw,NULL); #endif /*BDEV_MAJOR*/ si_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*/ + "/", "si", major(dev_chr), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(sidev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,si_drvinit,NULL) + #endif /* JREMOD */ + #endif diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index b8aa9e2..7cabae4 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.119 1995/11/21 09:15:04 bde Exp $ + * $Id: sio.c,v 1.120 1995/11/28 09:41:47 julian Exp $ */ #include "sio.h" @@ -97,8 +97,10 @@ #define com_scr 7 /* scratch register for 16450-16550 (R/W) */ #ifdef JREMOD +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 28 -static void sio_devsw_install(); #endif /*JREMOD*/ @@ -883,9 +885,6 @@ determined_type: ; s = spltty(); com_addr(unit) = com; splx(s); -#ifdef JREMOD - sio_devsw_install(); -#endif /*JREMOD*/ return (1); } @@ -2574,18 +2573,28 @@ struct cdevsw sio_cdevsw = static sio_devsw_installed = 0; -static void sio_devsw_install() +static void sio_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! sio_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&sio_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&sio_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&sio_cdevsw,NULL); sio_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*/ + "/", "sio", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(siodev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,sio_drvinit,NULL) + #endif /* JREMOD */ + #endif /* NSIO > 0 */ diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c index 77c1596..c89c975 100644 --- a/sys/dev/snp/snp.c +++ b/sys/dev/snp/snp.c @@ -33,6 +33,13 @@ #include <sys/snoop.h> +#ifdef JREMOD +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ +#define CDEV_MAJOR 53 +#endif /*JREMOD*/ + #ifndef MIN #define MIN(a,b) (((a)<(b))?(a):(b)) #endif @@ -491,4 +498,36 @@ snpselect(dev, rw, p) return 0; } +#ifdef JREMOD +struct cdevsw snp_cdevsw = + { snpopen, snpclose, snpread, snpwrite, /*53*/ + snpioctl, nostop, nullreset, nodevtotty,/* snoop */ + snpselect, nommap, NULL }; + +static snp_devsw_installed = 0; + +static void snp_drvinit(void *unused) +{ + dev_t dev; + + if( ! snp_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&snp_cdevsw,NULL); + snp_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*/ + "/", "snp", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif +} + +SYSINIT(snpdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,snp_drvinit,NULL) + +#endif /* JREMOD */ + #endif diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c index 050ba18..620ec9f 100644 --- a/sys/dev/speaker/spkr.c +++ b/sys/dev/speaker/spkr.c @@ -4,7 +4,7 @@ * v1.4 by Eric S. Raymond (esr@snark.thyrsus.com) Aug 1993 * modified for FreeBSD by Andrew A. Chernov <ache@astral.msk.su> * - * $Id: spkr.c,v 1.17 1995/09/09 18:09:55 davidg Exp $ + * $Id: spkr.c,v 1.18 1995/11/28 09:41:55 julian Exp $ */ #include "speaker.h" @@ -26,31 +26,13 @@ #ifdef JREMOD #include <sys/conf.h> #define CDEV_MAJOR 26 -static void spkr_devsw_install(); #endif /*JREMOD*/ -#if defined(DEVFS) || defined(JREMOD) -#include "sys/kernel.h" #ifdef DEVFS #include <sys/devfsext.h> -int spkropen(); #endif -void spkrdev_init(void *data) /* data not used */ -{ - void * x; -#ifdef JREMOD - spkr_devsw_install(); -#endif /*JREMOD*/ -#ifdef DEVFS -/* path name devsw minor type uid gid perm*/ - x=dev_add("/misc", "speaker", spkropen, 0, DV_CHR, 0, 0, 0600); -#endif - -} -SYSINIT(spkrdev,SI_SUB_DEVFS, SI_ORDER_ANY, spkrdev_init, NULL) -#endif /*DEVFS*/ /* JREMOD */ /**************** MACHINE DEPENDENT PART STARTS HERE ************************* * @@ -595,19 +577,29 @@ struct cdevsw spkr_cdevsw = static spkr_devsw_installed = 0; -static void spkr_devsw_install() +static void spkr_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! spkr_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&spkr_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&spkr_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&spkr_cdevsw,NULL); spkr_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*/ + "/", "spkr", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(spkrdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,spkr_drvinit,NULL) + #endif /* JREMOD */ + #endif /* NSPEAKER > 0 */ /* spkr.c ends here */ diff --git a/sys/dev/vn/vn.c b/sys/dev/vn/vn.c index 50cce3b..1062d4c 100644 --- a/sys/dev/vn/vn.c +++ b/sys/dev/vn/vn.c @@ -88,6 +88,16 @@ #include <sys/vnioctl.h> +#ifdef JREMOD +#include <sys/conf.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ +#define CDEV_MAJOR 43 +#define BDEV_MAJOR 15 +#endif /*JREMOD */ + + #ifdef DEBUG int dovncluster = 1; int vndebug = 0x00; @@ -586,4 +596,46 @@ vndump(dev_t dev) { return (ENODEV); } +#ifdef JREMOD +struct bdevsw vn_bdevsw = + { vnopen, vnclose, vnstrategy, vnioctl, /*15*/ + vndump, vnsize, 0 }; + +struct cdevsw vn_cdevsw = + { vnopen, vnclose, rawread, rawwrite, /*43*/ + vnioctl, nostop, nullreset, nodevtotty,/* vn */ + seltrue, nommap, vnstrategy }; + +static vn_devsw_installed = 0; + +static void vn_drvinit(void *unused) +{ + dev_t dev; + dev_t dev_chr; + + if( ! vn_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&vn_cdevsw,NULL); + dev_chr = dev; + dev = makedev(BDEV_MAJOR,0); + bdevsw_add(&dev,&vn_bdevsw,NULL); + vn_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*/ + "/", "rvn", major(dev_chr), 0, DV_CHR, 0, 0, 0600); + x=devfs_add_devsw( + "/", "vn", major(dev), 0, DV_BLK, 0, 0, 0600); + } + } +#endif +} + +SYSINIT(vndev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,vn_drvinit,NULL) + +#endif /* JREMOD */ + #endif diff --git a/sys/gnu/i386/isa/dgb.c b/sys/gnu/i386/isa/dgb.c index 1e61971..11a868a 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.4 1995/10/12 23:28:31 bde Exp $ + * dgb.c $Id: dgb.c,v 1.5 1995/11/04 13:22:59 bde Exp $ * * Digiboard driver. * @@ -51,6 +51,13 @@ #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 #define CONTROL_INIT_STATE 0x20 @@ -1979,4 +1986,36 @@ 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) +{ + dev_t dev; + + if( ! dgb_devsw_installed ) { + 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 5a71444..0913003 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.8 1995/11/18 04:19:44 bde Exp $"; +static char nic38_id[] = "@(#)$Id: nic3008.c,v 1.9 1995/11/21 14:56:01 bde Exp $"; /******************************************************************************* - * II - Version 0.1 $Revision: 1.8 $ $State: Exp $ + * II - Version 0.1 $Revision: 1.9 $ $State: Exp $ * * Copyright 1994 Dietmar Friede ******************************************************************************* @@ -10,6 +10,10 @@ static char nic38_id[] = "@(#)$Id: nic3008.c,v 1.8 1995/11/18 04:19:44 bde E * ******************************************************************************* * $Log: nic3008.c,v $ + * Revision 1.9 1995/11/21 14:56:01 bde + * Completed function declarations, added prototypes and removed redundant + * declarations. + * * Revision 1.8 1995/11/18 04:19:44 bde * Fixed the type of nic_listen(). A trailing arg was missing. * @@ -63,7 +67,7 @@ static char nic38_id[] = "@(#)$Id: nic3008.c,v 1.8 1995/11/18 04:19:44 bde E #include "ioctl.h" #include "kernel.h" #include "systm.h" -#include "conf.h" +#include <sys/conf.h> #include <sys/proc.h> #include "i386/isa/isa_device.h" @@ -71,6 +75,14 @@ static char nic38_id[] = "@(#)$Id: nic3008.c,v 1.8 1995/11/18 04:19:44 bde E #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*/ + + #define OPEN 1 #define LOAD_HEAD 3 #define LOAD_DATA 5 @@ -1206,4 +1218,37 @@ 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) +{ + dev_t dev; + + if( ! nic_devsw_installed ) { + 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 9793ebe..083d50f 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.8 1995/09/19 18:54:42 bde Exp $"; +static char nic39_id[] = "@(#)$Id: nic3009.c,v 1.9 1995/11/21 14:56:02 bde Exp $"; /******************************************************************************* - * II - Version 0.1 $Revision: 1.8 $ $State: Exp $ + * II - Version 0.1 $Revision: 1.9 $ $State: Exp $ * * Copyright 1994 Dietmar Friede ******************************************************************************* @@ -10,6 +10,10 @@ static char nic39_id[] = "@(#)$Id: nic3009.c,v 1.8 1995/09/19 18:54:42 bde E * ******************************************************************************* * $Log: nic3009.c,v $ + * Revision 1.9 1995/11/21 14:56:02 bde + * Completed function declarations, added prototypes and removed redundant + * declarations. + * * Revision 1.8 1995/09/19 18:54:42 bde * Fix benign type mismatches in isa interrupt handlers. Many returned int * instead of void. @@ -58,18 +62,25 @@ static char nic39_id[] = "@(#)$Id: nic3009.c,v 1.8 1995/09/19 18:54:42 bde E #include "nnic.h" #if NNNIC > 0 -#include "param.h" -#include "ioctl.h" -#include "kernel.h" -#include "systm.h" -#include "conf.h" -#include "proc.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/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*/ + #define OPEN 1 #define LOAD_HEAD 3 #define LOAD_DATA 5 @@ -1270,4 +1281,37 @@ nnicintr(int unit) timeout(nnnicintr, (void *)unit,1); } + +#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) +{ + dev_t dev; + + if( ! nnic_devsw_installed ) { + 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 6acaf61..50a9a79 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.3 1995/03/28 07:54:40 bde Exp $"; +static char _ispyid[] = "@(#)$Id: iispy.c,v 1.4 1995/09/08 11:06:56 bde Exp $"; /******************************************************************************* - * II - Version 0.1 $Revision: 1.3 $ $State: Exp $ + * II - Version 0.1 $Revision: 1.4 $ $State: Exp $ * * Copyright 1994 Dietmar Friede ******************************************************************************* @@ -10,6 +10,10 @@ static char _ispyid[] = "@(#)$Id: iispy.c,v 1.3 1995/03/28 07:54:40 bde Exp * ******************************************************************************* * $Log: iispy.c,v $ + * Revision 1.4 1995/09/08 11:06:56 bde + * Fix benign type mismatches in devsw functions. 82 out of 299 devsw + * functions were wrong. + * * Revision 1.3 1995/03/28 07:54:40 bde * Add and move declarations to fix all of the warnings from `gcc -Wimplicit' * (except in netccitt, netiso and netns) that I didn't notice when I fixed @@ -41,11 +45,19 @@ static char _ispyid[] = "@(#)$Id: iispy.c,v 1.3 1995/03/28 07:54:40 bde Exp #include "proc.h" #include "user.h" #include "uio.h" -#include "kernel.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*/ + int nispy = NISPY; int ispy_applnr; static int next_if =0; @@ -180,4 +192,36 @@ 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) +{ + dev_t dev; + + if( ! ispy_devsw_installed ) { + 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 5cc1d59..a714f38 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.5 1995/09/08 11:06:57 bde Exp $"; +static char _itelid[] = "@(#)$Id: iitel.c,v 1.6 1995/11/16 10:22:29 bde Exp $"; /******************************************************************************* - * II - Version 0.1 $Revision: 1.5 $ $State: Exp $ + * II - Version 0.1 $Revision: 1.6 $ $State: Exp $ * * Copyright 1994 Dietmar Friede ******************************************************************************* @@ -10,6 +10,13 @@ static char _itelid[] = "@(#)$Id: iitel.c,v 1.5 1995/09/08 11:06:57 bde Exp * ******************************************************************************* * $Log: iitel.c,v $ + * Revision 1.6 1995/11/16 10:22:29 bde + * Fixed the type of itel_input(). A trailing arg was missing. + * + * Included "conf.h" to get some prototypes. + * + * Removed some useless includes. + * * Revision 1.5 1995/09/08 11:06:57 bde * Fix benign type mismatches in devsw functions. 82 out of 299 devsw * functions were wrong. @@ -41,18 +48,25 @@ static char _itelid[] = "@(#)$Id: iitel.c,v 1.5 1995/09/08 11:06:57 bde Exp #include "itel.h" #if NITEL > 0 -#include "param.h" -#include "buf.h" -#include "systm.h" -#include "conf.h" -#include "ioctl.h" -#include "proc.h" -#include "uio.h" -#include "kernel.h" -#include "malloc.h" +#include <sys/param.h> +#include <sys/buf.h> +#include <sys/systm.h> +#include <sys/conf.h> +#include <sys/ioctl.h> +#include <sys/proc.h> +#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*/ + int nitel = NITEL; static int applnr[NITEL]; static int next_if =0; @@ -250,4 +264,42 @@ 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*/ + 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 5ad2b08..bd39e83 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.11 1995/07/31 21:28:42 bde Exp $"; +static char _ittyid[] = "@(#)$Id: iitty.c,v 1.12 1995/11/16 10:35:29 bde Exp $"; /******************************************************************************* - * II - Version 0.1 $Revision: 1.11 $ $State: Exp $ + * II - Version 0.1 $Revision: 1.12 $ $State: Exp $ * * Copyright 1994 Dietmar Friede ******************************************************************************* @@ -10,6 +10,15 @@ static char _ittyid[] = "@(#)$Id: iitty.c,v 1.11 1995/07/31 21:28:42 bde Exp * ******************************************************************************* * $Log: iitty.c,v $ + * Revision 1.12 1995/11/16 10:35:29 bde + * Fixed the type of ity_input(). A trailing arg was missing. + * + * Completed function declarations. + * + * Added prototypes. + * + * Removed some useless includes. + * * Revision 1.11 1995/07/31 21:28:42 bde * Use tsleep() instead of ttysleep() to wait for carrier since a generation * change isn't an error. @@ -141,21 +150,28 @@ static char _ittyid[] = "@(#)$Id: iitty.c,v 1.11 1995/07/31 21:28:42 bde Exp #include "ity.h" #if NITY > 0 -#include "param.h" -#include "systm.h" -#include "conf.h" -#include "ioctl.h" -#include "select.h" -#include "tty.h" -#include "proc.h" -#include "file.h" -#include "uio.h" -#include "kernel.h" -#include "syslog.h" -#include "types.h" +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/conf.h> +#include <sys/ioctl.h> +#include <sys/select.h> +#include <sys/tty.h> +#include <sys/proc.h> +#include <sys/file.h> +#include <sys/uio.h> +#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*/ +#define CDEV_MAJOR 56 +#endif /*JREMOD*/ + extern int ityparam __P((struct tty *tp, struct termios *t)); extern void itystart __P((struct tty *tp)); @@ -442,4 +458,36 @@ itydevtotty(dev_t dev) return (&ity_tty[unit]); } +#ifdef JREMOD +struct cdevsw ity_cdevsw = + { ityopen, ityclose, ityread, itywrite, /*56*/ + ityioctl, nostop, nxreset, itydevtotty,/* ity */ + ttselect, nommap, NULL }; + +static ity_devsw_installed = 0; + +static void ity_drvinit(void *unused) +{ + dev_t dev; + + if( ! ity_devsw_installed ) { + 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 c653627..9338a5e 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.5 1995/09/08 11:06:58 bde Exp $"; +static char _isdnid[] = "@(#)$Id: isdn.c,v 1.6 1995/11/16 10:47:21 bde Exp $"; /******************************************************************************* - * II - Version 0.1 $Revision: 1.5 $ $State: Exp $ + * II - Version 0.1 $Revision: 1.6 $ $State: Exp $ * * Copyright 1994 Dietmar Friede ******************************************************************************* @@ -10,6 +10,19 @@ static char _isdnid[] = "@(#)$Id: isdn.c,v 1.5 1995/09/08 11:06:58 bde Exp $ * ******************************************************************************* * $Log: isdn.c,v $ + * Revision 1.6 1995/11/16 10:47:21 bde + * Fixed a call to the listen function. A trailing arg was missing. + * + * Fixed the type of isdn_check(). A trailing arg was missing. + * + * Included "conf.h" to get some prototypes. + * + * Completed function declarations. + * + * Added prototypes. + * + * Removed some useless includes. + * * Revision 1.5 1995/09/08 11:06:58 bde * Fix benign type mismatches in devsw functions. 82 out of 299 devsw * functions were wrong. @@ -55,15 +68,22 @@ static char _isdnid[] = "@(#)$Id: isdn.c,v 1.5 1995/09/08 11:06:58 bde Exp $ #define TYPNR 4 #define N_ISDN_APPL (NII + NITY + NITEL + NISPY) -#include "param.h" -#include "ioctl.h" -#include "kernel.h" -#include "systm.h" -#include "conf.h" -#include "proc.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 "gnu/isdn/isdn_ioctl.h" +#ifdef JREMOD +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ +#define CDEV_MAJOR 55 +#endif /*JREMOD*/ + isdn_appl_t isdn_appl[N_ISDN_APPL]; isdn_ctrl_t isdn_ctrl[N_ISDN_CTRL]; int Isdn_Appl, Isdn_Ctrl, Isdn_Typ; @@ -647,4 +667,36 @@ 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) +{ + dev_t dev; + + if( ! isdn_devsw_installed ) { + 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 */ diff --git a/sys/i386/apm/apm.c b/sys/i386/apm/apm.c index 8543a18..2b286b4 100644 --- a/sys/i386/apm/apm.c +++ b/sys/i386/apm/apm.c @@ -13,7 +13,7 @@ * * Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) * - * $Id: apm.c,v 1.15 1995/11/18 04:37:23 bde Exp $ + * $Id: apm.c,v 1.16 1995/11/28 09:44:42 julian Exp $ */ #include "apm.h" @@ -25,6 +25,10 @@ #include "conf.h" #ifdef JREMOD #include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #endif /*JREMOD*/ #include <sys/kernel.h> #include <sys/systm.h> @@ -104,7 +108,6 @@ extern void fix_desc(struct fake_descriptor *, int); static timeout_t apm_timeout; #ifdef JREMOD #define CDEV_MAJOR 39 -static void apm_devsw_install(); #endif /* JREMOD */ #endif /* __FreeBSD__ */ #ifdef MACH_KERNEL @@ -690,11 +693,6 @@ int printf("apm%d: 32-bit connection error.\n", unit); return 0; } -#ifdef __FreeBSD__ -#ifdef JREMOD - apm_devsw_install(); -#endif /*JREMOD*/ -#endif /* __FreeBSD__ */ return -1; } @@ -981,6 +979,8 @@ apmioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p) } return error; } + + #ifdef JREMOD struct cdevsw apm_cdevsw = { apmopen, apmclose, noread, nowrite, /*39*/ @@ -989,20 +989,31 @@ struct cdevsw apm_cdevsw = static apm_devsw_installed = 0; -static void apm_devsw_install() +static void apm_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! apm_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0) - cdevsw_add(&descript,&apm_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0) - bdevsw_add(&descript,&apm_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&apm_cdevsw,NULL); apm_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*/ + "/", "apm", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(apmdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,apm_drvinit,NULL) + #endif /* JREMOD */ + + #endif /* __FreeBSD__ */ #ifdef MACH_KERNEL diff --git a/sys/i386/bios/apm.c b/sys/i386/bios/apm.c index 8543a18..2b286b4 100644 --- a/sys/i386/bios/apm.c +++ b/sys/i386/bios/apm.c @@ -13,7 +13,7 @@ * * Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD) * - * $Id: apm.c,v 1.15 1995/11/18 04:37:23 bde Exp $ + * $Id: apm.c,v 1.16 1995/11/28 09:44:42 julian Exp $ */ #include "apm.h" @@ -25,6 +25,10 @@ #include "conf.h" #ifdef JREMOD #include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #endif /*JREMOD*/ #include <sys/kernel.h> #include <sys/systm.h> @@ -104,7 +108,6 @@ extern void fix_desc(struct fake_descriptor *, int); static timeout_t apm_timeout; #ifdef JREMOD #define CDEV_MAJOR 39 -static void apm_devsw_install(); #endif /* JREMOD */ #endif /* __FreeBSD__ */ #ifdef MACH_KERNEL @@ -690,11 +693,6 @@ int printf("apm%d: 32-bit connection error.\n", unit); return 0; } -#ifdef __FreeBSD__ -#ifdef JREMOD - apm_devsw_install(); -#endif /*JREMOD*/ -#endif /* __FreeBSD__ */ return -1; } @@ -981,6 +979,8 @@ apmioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p) } return error; } + + #ifdef JREMOD struct cdevsw apm_cdevsw = { apmopen, apmclose, noread, nowrite, /*39*/ @@ -989,20 +989,31 @@ struct cdevsw apm_cdevsw = static apm_devsw_installed = 0; -static void apm_devsw_install() +static void apm_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! apm_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0) - cdevsw_add(&descript,&apm_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0) - bdevsw_add(&descript,&apm_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&apm_cdevsw,NULL); apm_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*/ + "/", "apm", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(apmdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,apm_drvinit,NULL) + #endif /* JREMOD */ + + #endif /* __FreeBSD__ */ #ifdef MACH_KERNEL diff --git a/sys/i386/i386/cons.c b/sys/i386/i386/cons.c index 0b509594..9b8735d 100644 --- a/sys/i386/i386/cons.c +++ b/sys/i386/i386/cons.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)cons.c 7.2 (Berkeley) 5/9/91 - * $Id: cons.c,v 1.33 1995/09/10 18:57:25 bde Exp $ + * $Id: cons.c,v 1.34 1995/09/10 21:34:49 bde Exp $ */ #include <sys/param.h> @@ -48,6 +48,14 @@ #include <machine/cons.h> #include <machine/stdarg.h> +#ifdef JREMOD +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ +#define CDEV_MAJOR 0 +#endif /*JREMOD*/ + /* XXX this should be config(8)ed. */ #include "sc.h" #include "vt.h" @@ -79,23 +87,6 @@ static d_open_t *cn_phys_open; /* physical device open function */ static struct consdev *cn_tab; /* physical console device info */ static struct tty *cn_tp; /* physical console tty struct */ -#ifdef DEVFS -#include <sys/kernel.h> -#include <sys/devfsext.h> - -static void cndev_init __P((void *)); -SYSINIT(cndev, SI_SUB_DEVFS, SI_ORDER_ANY, cndev_init, NULL) - -static void -cndev_init(dummy) - void *dummy; -{ - void * x; -/* path name devsw minor type uid gid perm*/ - x=dev_add("/misc", "console", cnopen, 0, DV_CHR, 0, 0, 0640); -} -#endif /* DEVFS */ - void cninit() { @@ -322,3 +313,30 @@ pg(const char *p, ...) { } +#ifdef JREMOD +struct cdevsw cn_cdevsw = + { cnopen, cnclose, cnread, cnwrite, /*0*/ + cnioctl, nullstop, nullreset, nodevtotty,/* console */ + cnselect, nommap, NULL }; + +static cn_devsw_installed = 0; + +static void cn_drvinit(void *unused) +{ + void * x; + dev_t dev; + + if( ! cn_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&cn_cdevsw,NULL); + cn_devsw_installed = 1; +#ifdef DEVFS + /* path,name,major,minor,type,uid,gid,perm */ + x=devfs_add_devsw("/","console",major(dev),0,DV_CHR,0,0,0640); +#endif +} + +SYSINIT(cndev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cn_drvinit,NULL) + +#endif /* JREMOD */ + diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c index 54db6cd..a0a4f07 100644 --- a/sys/i386/i386/mem.c +++ b/sys/i386/i386/mem.c @@ -38,7 +38,7 @@ * * from: Utah $Hdr: mem.c 1.13 89/10/08$ * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 - * $Id: mem.c,v 1.18 1995/11/04 13:52:30 bde Exp $ + * $Id: mem.c,v 1.19 1995/11/04 16:00:25 markm Exp $ */ /* @@ -63,26 +63,27 @@ #include <vm/vm_prot.h> #include <vm/pmap.h> +#ifdef JREMOD +#include <sys/kernel.h> +#define CDEV_MAJOR 2 +#endif /*JREMOD*/ + #ifdef DEVFS #include <sys/devfsext.h> -#include "sys/kernel.h" - -static void memdev_init __P((void *)); -SYSINIT(memdev,SI_SUB_DEVFS, SI_ORDER_ANY, memdev_init, NULL) static void -memdev_init(dummy) - void *dummy; +memdevfs_init(dev_t dev) { void * x; -/* path name devsw minor type uid gid perm*/ - x=dev_add("/misc", "mem", mmopen, 0, DV_CHR, 0, 2, 0640); - x=dev_add("/misc", "kmem", mmopen, 1, DV_CHR, 0, 2, 0640); - x=dev_add("/misc", "null", mmopen, 2, DV_CHR, 0, 0, 0666); - x=dev_add("/misc", "random", mmopen, 3, DV_CHR, 0, 0, 0666); - x=dev_add("/misc", "urandom", mmopen, 4, DV_CHR, 0, 0, 0666); - x=dev_add("/misc", "zero", mmopen, 12, DV_CHR, 0, 0, 0666); - x=dev_add("/misc", "io", mmopen, 14, DV_CHR, 0, 2, 0640); + int maj = major(dev); +/* path name major minor type uid gid perm*/ + x=devfs_add_devsw("/misc", "mem", maj, 0, DV_CHR, 0, 2, 0640); + x=devfs_add_devsw("/misc", "kmem", maj, 1, DV_CHR, 0, 2, 0640); + x=devfs_add_devsw("/misc", "null", maj, 2, DV_CHR, 0, 0, 0666); + x=devfs_add_devsw("/misc", "random", maj, 3, DV_CHR, 0, 0, 0666); + x=devfs_add_devsw("/misc", "urandom", maj, 4, DV_CHR, 0, 0, 0666); + x=devfs_add_devsw("/misc", "zero", maj, 12, DV_CHR, 0, 0, 0666); + x=devfs_add_devsw("/misc", "io", maj, 14, DV_CHR, 0, 2, 0640); } #endif /* DEVFS */ @@ -378,3 +379,31 @@ mmioctl(dev, cmd, cmdarg, flags, p) } return (0); } + + + +#ifdef JREMOD +struct cdevsw mem_cdevsw = + { mmopen, mmclose, mmrw, mmrw, /*2*/ + mmioctl, nullstop, nullreset, nodevtotty,/* memory */ + seltrue, memmmap, NULL }; + +static mem_devsw_installed = 0; + +static void mem_drvinit(void *unused) +{ + dev_t dev; + + if( ! mem_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&mem_cdevsw,NULL); + mem_devsw_installed = 1; +#ifdef DEVFS + memdevfs_init(dev); +#endif +} + +SYSINIT(memdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,mem_drvinit,NULL) + +#endif /* JREMOD */ + diff --git a/sys/i386/isa/asc.c b/sys/i386/isa/asc.c index 18a02c2..cd28619 100644 --- a/sys/i386/isa/asc.c +++ b/sys/i386/isa/asc.c @@ -34,7 +34,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* - * $Id: asc.c,v 1.5 1995/09/08 19:01:28 julian Exp $ + * $Id: asc.c,v 1.6 1995/11/28 09:40:39 julian Exp $ */ #include "asc.h" @@ -76,16 +76,15 @@ #include <i386/isa/isa.h> #include <i386/isa/isa_device.h> #include <i386/isa/ascreg.h> -#ifdef DEVFS -#include <sys/devfsext.h> -extern d_open_t ascopen; #ifdef JREMOD #include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 71 -static void asc_devsw_install(); #endif /*JREMOD*/ -#endif #endif /* FREEBSD_1_X */ @@ -434,11 +433,6 @@ ascprobe (struct isa_device *isdp) scu->flags &= ~DEBUG; scu->icnt = 0; - -#ifdef JREMOD - asc_devsw_install(); -#endif /*JREMOD*/ - return PROBE_SUCCESS; } @@ -869,6 +863,7 @@ ascselect(dev_t dev, int rw, struct proc *p) return 0; } + #ifdef JREMOD struct cdevsw asc_cdevsw = { ascopen, ascclose, ascread, nowrite, /*71*/ @@ -877,18 +872,34 @@ struct cdevsw asc_cdevsw = static asc_devsw_installed = 0; -static void asc_devsw_install() +static void asc_drvinit(void *unused) { - dev_t descript; + dev_t dev; + dev_t dev_chr; + if( ! asc_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&asc_cdevsw,NULL); + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&asc_cdevsw,NULL); + dev_chr = dev; #if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&asc_bdevsw,NULL); + dev = makedev(BDEV_MAJOR,0); + bdevsw_add(&dev,&asc_bdevsw,NULL); #endif /*BDEV_MAJOR*/ asc_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*/ + "/", "asc", major(dev_chr), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(ascdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,asc_drvinit,NULL) + #endif /* JREMOD */ + #endif /* NASC > 0 */ diff --git a/sys/i386/isa/b004.c b/sys/i386/isa/b004.c index fd2910d..b59d9d7 100644 --- a/sys/i386/isa/b004.c +++ b/sys/i386/isa/b004.c @@ -62,8 +62,11 @@ #ifdef JREMOD #include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 8 -static void bqu_devsw_install(); #endif /*JREMOD*/ static u_char d_inb(u_int port); @@ -577,9 +580,6 @@ printf("bquprobe::\nIOBASE 0x%x\nIRQ %d\nDRQ %d\nMSIZE %d\nUNIT %d\nFLAGS x0%x\n #ifndef DEV_LKM bqu_registerdev(idp); #endif /* not DEV_LKM */ -#ifdef JREMOD - bqu_devsw_install(); -#endif /*JREMOD*/ for (test = 0; (test < B004_CHANCE); test++) { @@ -635,6 +635,7 @@ printf("bquprobe::\nIOBASE 0x%x\nIRQ %d\nDRQ %d\nMSIZE %d\nUNIT %d\nFLAGS x0%x\n return(20); } /* bquprobe() */ + #ifdef JREMOD struct cdevsw bqu_cdevsw = { bquopen, bquclose, bquread, bquwrite, /*8*/ @@ -643,18 +644,28 @@ struct cdevsw bqu_cdevsw = static bqu_devsw_installed = 0; -static void bqu_devsw_install() +static void bqu_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! bqu_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&bqu_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&bqu_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&bqu_cdevsw,NULL); bqu_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*/ + "/", "bqu", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(bqudev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,bqu_drvinit,NULL) + #endif /* JREMOD */ + #endif /* NBQU */ diff --git a/sys/i386/isa/ctx.c b/sys/i386/isa/ctx.c index c1edbf1..0684d3d 100644 --- a/sys/i386/isa/ctx.c +++ b/sys/i386/isa/ctx.c @@ -8,7 +8,7 @@ * of this software, nor does the author assume any responsibility * for damages incurred with its use. * - * $Id: ctx.c,v 1.7 1995/09/08 11:07:34 bde Exp $ + * $Id: ctx.c,v 1.8 1995/11/28 09:40:48 julian Exp $ */ /* @@ -128,9 +128,13 @@ #ifdef JREMOD #include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 40 -static void ctx_devsw_install(); #endif /*JREMOD*/ + int waitvb(short); /* state flags */ @@ -191,9 +195,6 @@ ctxprobe(struct isa_device * devp) status = 0; else { status = 1; /*XXX uses only one port? */ -#ifdef JREMOD - ctx_devsw_install(); -#endif /*JREMOD*/ } return (status); } @@ -448,6 +449,8 @@ waitvb(short port) return (0); } + + #ifdef JREMOD struct cdevsw ctx_cdevsw = { ctxopen, ctxclose, ctxread, ctxwrite, /*40*/ @@ -456,19 +459,28 @@ struct cdevsw ctx_cdevsw = static ctx_devsw_installed = 0; -static void ctx_devsw_install() +static void ctx_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! ctx_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&ctx_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&ctx_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&ctx_cdevsw,NULL); ctx_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*/ + "/", "ctx", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(ctxdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,ctx_drvinit,NULL) + #endif /* JREMOD */ #endif /* NCTX > 0 */ diff --git a/sys/i386/isa/cx.c b/sys/i386/isa/cx.c index a3f941e..3a606bc 100644 --- a/sys/i386/isa/cx.c +++ b/sys/i386/isa/cx.c @@ -41,7 +41,9 @@ # else /* BSD 4.4 Lite */ # ifdef JREMOD # define CDEV_MAJOR 42 - void cx_devsw_install(); /* can't be static, needed in if_cx.c */ +# if defined(DEVFS) +# include <sys/devfsext.h> +# endif /*DEVFS*/ # endif /*JREMOD*/ # include <sys/devconf.h> # endif @@ -974,18 +976,28 @@ struct cdevsw cx_cdevsw = static cx_devsw_installed = 0; -void cx_devsw_install() +static void cx_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! cx_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&cx_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&cx_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&cx_cdevsw,NULL); cx_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*/ + "/", "cx", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(cxdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cx_drvinit,NULL) + #endif /* JREMOD */ + #endif /* NCX */ diff --git a/sys/i386/isa/cy.c b/sys/i386/isa/cy.c index c2f3725..c4739ae 100644 --- a/sys/i386/isa/cy.c +++ b/sys/i386/isa/cy.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cy.c,v 1.19 1995/11/26 17:13:23 bde Exp $ + * $Id: cy.c,v 1.20 1995/11/28 09:40:56 julian Exp $ */ #include "cy.h" @@ -398,8 +398,10 @@ static int cy_nr_cd1400s[NCY]; static int volatile RxFifoThreshold = (CD1400_RX_FIFO_SIZE / 2); #ifdef JREMOD +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 48 -static void cy_devsw_install(); #endif /*JREMOD*/ static struct kern_devconf kdc_sio[NCY] = { { @@ -442,9 +444,6 @@ sioprobe(dev) return (0); cy_nr_cd1400s[unit] = 0; sioregisterdev(dev); -#ifdef JREMOD - cy_devsw_install(); -#endif /*JREMOD*/ /* Cyclom-16Y hardware reset (Cyclom-8Ys don't care) */ @@ -2521,6 +2520,7 @@ cystatus(unit) #endif /* CyDebug */ + #ifdef JREMOD struct cdevsw cy_cdevsw = { cyopen, cyclose, cyread, cywrite, /*48*/ @@ -2529,18 +2529,28 @@ struct cdevsw cy_cdevsw = static cy_devsw_installed = 0; -static void cy_devsw_install() +static void cy_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! cy_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&cy_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&cy_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&cy_cdevsw,NULL); cy_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*/ + "/", "cy", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(cydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cy_drvinit,NULL) + #endif /* JREMOD */ + #endif /* NCY > 0 */ diff --git a/sys/i386/isa/gpib.c b/sys/i386/isa/gpib.c index 8cbb0b7..2e511bf 100644 --- a/sys/i386/isa/gpib.c +++ b/sys/i386/isa/gpib.c @@ -49,10 +49,14 @@ #ifdef JREMOD #include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 44 -static void gp_devsw_install(); #endif /*JREMOD*/ + int initgpib(void); void closegpib(void); int sendgpibfifo(unsigned char device,char *data,int count); @@ -129,9 +133,6 @@ gpattach(isdp) if (sc->sc_type==1) printf ("gp%d: type AT-GPIB chip NAT4882A\n",sc->sc_unit); sc->sc_flags |=ATTACHED; -#ifdef JREMOD - gp_devsw_install(); -#endif /*JREMOD*/ return (1); } @@ -1271,19 +1272,28 @@ struct cdevsw gp_cdevsw = static gp_devsw_installed = 0; -static void gp_devsw_install() +static void gp_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! gp_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&gp_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&gp_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&gp_cdevsw,NULL); gp_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*/ + "/", "gp", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(gpdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,gp_drvinit,NULL) + #endif /* JREMOD */ #endif /* NGPIB > 0 */ diff --git a/sys/i386/isa/gsc.c b/sys/i386/isa/gsc.c index 7abe841..84a9aa0 100644 --- a/sys/i386/isa/gsc.c +++ b/sys/i386/isa/gsc.c @@ -59,9 +59,12 @@ ***********************************************************************/ #ifdef JREMOD #include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 47 -static void gsc_devsw_install(); -#endif /*JREMOD*/ /* clean up later */ +#endif /*JREMOD*/ #define PROBE_FAIL 0 #define PROBE_SUCCESS 1 @@ -504,9 +507,6 @@ gscattach(struct isa_device *isdp) scu->flags |= ATTACHED; lprintf("gsc%d.attach: ok\n", unit); scu->flags &= ~DEBUG; -#ifdef JREMOD - gsc_devsw_install(); -#endif /*JREMOD*/ return SUCCESS; /* attach must not fail */ } @@ -790,18 +790,28 @@ struct cdevsw gsc_cdevsw = static gsc_devsw_installed = 0; -static void gsc_devsw_install() +static void gsc_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! gsc_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&gsc_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&gsc_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&gsc_cdevsw,NULL); gsc_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*/ + "/", "gsc", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(gscdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,gsc_drvinit,NULL) + #endif /* JREMOD */ + #endif /* NGSC > 0 */ diff --git a/sys/i386/isa/if_cx.c b/sys/i386/isa/if_cx.c index aff2fce..59e25ed 100644 --- a/sys/i386/isa/if_cx.c +++ b/sys/i386/isa/if_cx.c @@ -44,6 +44,10 @@ # if __FreeBSD__ < 2 # include <machine/pio.h> # else +# ifdef DEVFS +# include <sys/devfsext.h> +# endif /*DEVFS*/ +# define CDEV_MAJOR 42 /*XXX*/ /* replace with variable ASAP*/ # include <sys/devconf.h> # endif # define init_func_t void(*)(int) @@ -220,7 +224,6 @@ static struct mbuf *makembuf (void *buf, unsigned len) * Test the presence of the adapter on the given i/o port. */ #ifdef __FreeBSD__ -extern void cx_devsw_install(); int cxprobe (struct isa_device *id) { int unit = id->id_unit; @@ -266,9 +269,6 @@ int cxprobe (struct device *parent, struct cfdata *cf, void *aux) } if (! cx_probe_board (iobase)) return (0); -#ifdef JREMOD - cx_devsw_install(); -#endif /*JREMOD*/ return (1); } @@ -373,6 +373,15 @@ void cxattach (struct device *parent, struct device *self, void *aux) #endif #ifdef __FreeBSD__ printf ("cx%d: <Cronyx-%s>\n", unit, b->name); +#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*/ + "/", "cx", major(CDEV_MAJOR), 0, DV_CHR, 0, 0, 0600); + } +#endif return (1); #endif #ifdef __bsdi__ @@ -981,3 +990,5 @@ void cxswitch (cx_chan_t *c, cx_soft_opt_t new) c->sopt = new; } #endif /* NCX */ + + diff --git a/sys/i386/isa/joy.c b/sys/i386/isa/joy.c index 5870e62..e90e90f 100644 --- a/sys/i386/isa/joy.c +++ b/sys/i386/isa/joy.c @@ -43,8 +43,11 @@ #ifdef JREMOD #include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 51 -static void joy_devsw_install(); #endif /*JREMOD*/ /* The game port can manage 4 buttons and 4 variable resistors (usually 2 @@ -105,10 +108,6 @@ joyattach (struct isa_device *dev) joy[dev->id_unit].timeout[0] = joy[dev->id_unit].timeout[1] = 0; printf("joy%d: joystick\n", dev->id_unit); -#ifdef JREMOD - joy_devsw_install(); -#endif /*JREMOD*/ - return 1; } @@ -224,18 +223,28 @@ struct cdevsw joy_cdevsw = static joy_devsw_installed = 0; -static void joy_devsw_install() +static void joy_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! joy_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&joy_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&joy_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&joy_cdevsw,NULL); joy_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*/ + "/", "joy", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(joydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,joy_drvinit,NULL) + #endif /* JREMOD */ + #endif /* NJOY > 0 */ diff --git a/sys/i386/isa/labpc.c b/sys/i386/isa/labpc.c index 9d0cf7f..38e6c62 100644 --- a/sys/i386/isa/labpc.c +++ b/sys/i386/isa/labpc.c @@ -61,8 +61,11 @@ #ifdef JREMOD #include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 66 -static void labpc_devsw_install(); #endif /*JREMOD*/ @@ -501,10 +504,6 @@ int labpcattach(struct isa_device *dev) ctlr->dcr_val = 0x80; ctlr->dcr_is = 0x80; loutb(DCR(ctlr), ctlr->dcr_val); -#ifdef JREMOD - labpc_devsw_install(); -#endif /*JREMOD*/ - return 1; } @@ -1116,17 +1115,27 @@ struct cdevsw labpc_cdevsw = static labpc_devsw_installed = 0; -static void labpc_devsw_install() +static void labpc_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! labpc_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&labpc_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&labpc_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&labpc_cdevsw,NULL); labpc_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*/ + "/", "labpc", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(labpcdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,labpc_drvinit,NULL) + #endif /* JREMOD */ + diff --git a/sys/i386/isa/lpt.c b/sys/i386/isa/lpt.c index 67cbddb..cea3df6 100644 --- a/sys/i386/isa/lpt.c +++ b/sys/i386/isa/lpt.c @@ -46,7 +46,7 @@ * SUCH DAMAGE. * * from: unknown origin, 386BSD 0.1 - * $Id: lpt.c,v 1.39 1995/11/28 09:41:18 julian Exp $ + * $Id: lpt.c,v 1.40 1995/11/29 10:17:03 phk Exp $ */ /* @@ -140,8 +140,11 @@ #ifdef JREMOD #include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 16 -static void lpt_devsw_install(); #endif /*JREMOD*/ #define LPINITRDY 4 /* wait up to 4 seconds for a ready */ @@ -442,9 +445,6 @@ lptattach(struct isa_device *isdp) lprintf("irq %x\n", sc->sc_irq); kdc_lpt[isdp->id_unit].kdc_state = DC_IDLE; -#ifdef JREMOD - lpt_devsw_install(); -#endif /*JREMOD*/ return (1); } @@ -1160,17 +1160,27 @@ struct cdevsw lpt_cdevsw = static lpt_devsw_installed = 0; -static void lpt_devsw_install() +static void lpt_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! lpt_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&lpt_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&lpt_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&lpt_cdevsw,NULL); lpt_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*/ + "/", "lpt", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(lptdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,lpt_drvinit,NULL) + #endif /* JREMOD */ + diff --git a/sys/i386/isa/matcd/matcd.c b/sys/i386/isa/matcd/matcd.c index 03ae212..477b9d5 100644 --- a/sys/i386/isa/matcd/matcd.c +++ b/sys/i386/isa/matcd/matcd.c @@ -493,9 +493,12 @@ static struct kern_devconf kdc_matcd[TOTALDRIVES] = { { /*<12>*/ #ifdef JREMOD #include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 46 #define BDEV_MAJOR 17 -static void matcd_devsw_install(); #endif /*JREMOD */ #endif /*FREE2*/ @@ -1472,9 +1475,6 @@ int matcd_attach(struct isa_device *dev) } nextcontroller++; /*Bump ctlr assign to next number*/ printf("\n"); /*End line of drive reports*/ -#ifdef JREMOD - matcd_devsw_install(); -#endif /*JREMOD*/ return(1); } @@ -2761,19 +2761,35 @@ struct cdevsw matcd_cdevsw = static matcd_devsw_installed = 0; -static void matcd_devsw_install() +static void matcd_drvinit(void *unused) { - dev_t descript; + dev_t dev; + dev_t dev_chr; + if( ! matcd_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&matcd_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&matcd_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&matcd_cdevsw,NULL); + dev_chr = dev; + dev = makedev(BDEV_MAJOR,0); + bdevsw_add(&dev,&matcd_bdevsw,NULL); matcd_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*/ + "/", "rmatcd", major(dev_chr), 0, DV_CHR, 0, 0, 0600); + x=devfs_add_devsw( + "/", "matcd", major(dev), 0, DV_BLK, 0, 0, 0600); + } + } +#endif } + +SYSINIT(matcddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,matcd_drvinit,NULL) + #endif /* JREMOD */ + /*End of matcd.c*/ diff --git a/sys/i386/isa/mcd.c b/sys/i386/isa/mcd.c index 0571a93..4ab0b9c 100644 --- a/sys/i386/isa/mcd.c +++ b/sys/i386/isa/mcd.c @@ -40,7 +40,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: mcd.c,v 1.48 1995/11/04 13:23:35 bde Exp $ + * $Id: mcd.c,v 1.49 1995/11/28 09:41:22 julian Exp $ */ static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore"; @@ -71,9 +71,13 @@ static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore"; #include <i386/isa/mcdreg.h> #ifdef JREMOD +#include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 29 #define BDEV_MAJOR 7 -static void mcd_devsw_install(); #endif /*JREMOD */ #define MCD_TRACE(format, args...) \ @@ -262,10 +266,6 @@ int mcd_attach(struct isa_device *dev) kdc_mcd[dev->id_unit].kdc_state = DC_IDLE; /* name filled in probe */ kdc_mcd[dev->id_unit].kdc_description = mcd_data[dev->id_unit].name; -#ifdef JREMOD - mcd_devsw_install(); -#endif /*JREMOD*/ - return 1; } @@ -1682,18 +1682,33 @@ struct cdevsw mcd_cdevsw = static mcd_devsw_installed = 0; -static void mcd_devsw_install() +static void mcd_drvinit(void *unused) { - dev_t descript; + dev_t dev; + dev_t dev_chr; + if( ! mcd_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&mcd_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&mcd_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&mcd_cdevsw,NULL); + dev_chr = dev; + dev = makedev(BDEV_MAJOR,0); + bdevsw_add(&dev,&mcd_bdevsw,NULL); mcd_devsw_installed = 1; - } +#ifdef DEVFS + { + int x; +/* default for a simple device with no probe routine (usually delete this) */ +/* path name devsw minor type uid gid perm*/ + "/", "rmcd", major(dev_chr), 0, DV_CHR, 0, 0, 0600); + x=devfs_add_devsw( + "/", "mcd", major(dev), 0, DV_BLK, 0, 0, 0600); + } + } +#endif } + +SYSINIT(mcddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,mcd_drvinit,NULL) + #endif /* JREMOD */ + #endif /* NMCD > 0 */ diff --git a/sys/i386/isa/mse.c b/sys/i386/isa/mse.c index 5499a2a..52195fb 100644 --- a/sys/i386/isa/mse.c +++ b/sys/i386/isa/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.15 1995/11/04 17:07:37 bde Exp $ + * $Id: mse.c,v 1.16 1995/11/28 09:41:25 julian Exp $ */ /* * Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and @@ -63,8 +63,11 @@ #ifdef JREMOD #include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 27 -static void mse_devsw_install(); #endif /*JREMOD*/ static int mseprobe(struct isa_device *); @@ -239,9 +242,6 @@ mseattach(idp) sc->sc_port = idp->id_iobase; kdc_mse[idp->id_unit].kdc_state = DC_IDLE; -#ifdef JREMOD - mse_devsw_install(); -#endif /*JREMOD*/ return (1); } @@ -583,18 +583,28 @@ struct cdevsw mse_cdevsw = static mse_devsw_installed = 0; -static void mse_devsw_install() +static void mse_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! mse_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&mse_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&mse_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + 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 */ diff --git a/sys/i386/isa/pcaudio.c b/sys/i386/isa/pcaudio.c index a6f006a..90fb125 100644 --- a/sys/i386/isa/pcaudio.c +++ b/sys/i386/isa/pcaudio.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pcaudio.c,v 1.17 1995/11/16 09:56:02 bde Exp $ + * $Id: pcaudio.c,v 1.18 1995/11/28 09:41:27 julian Exp $ */ #include "pca.h" @@ -50,8 +50,12 @@ #include <i386/isa/sound/ulaw.h> #ifdef JREMOD +#include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 24 -static void pca_devsw_install(); #endif /*JREMOD*/ #define BUF_SIZE 8192 @@ -247,14 +251,13 @@ pca_registerdev(struct isa_device *id) } #ifdef DEVFS -#include <sys/devfsext.h> -void pcadev_init(caddr_t data) /* data not used */ +void pcadevfs_init(caddr_t data) /* data not used */ { void * x; /* path name devsw minor type uid gid perm*/ - x=dev_add("/misc", "pcaudio", pcaopen, 0, DV_CHR, 0, 0, 0666); - x=dev_add("/misc", "pcaudioctl", pcaopen, 128, DV_CHR, 0, 0, 0666); + x=devfs_add_devsw("/", "pcaudio", CDEV_MAJOR, 0, DV_CHR, 0, 0, 0666); + x=devfs_add_devsw("/", "pcaudioctl", CDEV_MAJOR, 128, DV_CHR, 0, 0, 0666); } #endif /*DEVFS*/ @@ -265,11 +268,8 @@ pcaattach(struct isa_device *dvp) printf("pca%d: PC speaker audio driver\n", dvp->id_unit); pca_init(); pca_registerdev(dvp); -#ifdef JREMOD - pca_devsw_install(); -#endif /*JREMOD*/ #ifdef DEVFS - pcadev_init(NULL); + pcadevfs_init(NULL); #endif /*DEVFS*/ return 1; @@ -495,18 +495,19 @@ struct cdevsw pca_cdevsw = static pca_devsw_installed = 0; -static void pca_devsw_install() +static void pca_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! pca_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&pca_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&pca_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&pca_cdevsw,NULL); pca_devsw_installed = 1; - } + } } + +SYSINIT(pcadev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,pca_drvinit,NULL) + #endif /* JREMOD */ + #endif diff --git a/sys/i386/isa/psm.c b/sys/i386/isa/psm.c index 14b35e4..81d492e 100644 --- a/sys/i386/isa/psm.c +++ b/sys/i386/isa/psm.c @@ -68,8 +68,11 @@ #ifdef JREMOD #include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 21 -static void psm_devsw_install(); #endif /*JREMOD*/ #define DATA 0 /* Offset for data port, read-write */ @@ -204,10 +207,6 @@ int psmattach(struct isa_device *dvp) sc->state = 0; -#ifdef JREMOD - psm_devsw_install(); -#endif /*JREMOD*/ - /* Done */ return(0); /* XXX eh? usually 1 indicates success */ @@ -476,19 +475,28 @@ struct cdevsw psm_cdevsw = static psm_devsw_installed = 0; -static void psm_devsw_install() +static void psm_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! psm_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&psm_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&psm_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&psm_cdevsw,NULL); psm_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*/ + "/", "psm", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(psmdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,psm_drvinit,NULL) + #endif /* JREMOD */ #endif diff --git a/sys/i386/isa/rc.c b/sys/i386/isa/rc.c index 6203aff..e1d80cb 100644 --- a/sys/i386/isa/rc.c +++ b/sys/i386/isa/rc.c @@ -60,8 +60,11 @@ #ifdef JREMOD #include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 63 -static void rc_devsw_install(); #endif /*JREMOD*/ /* Prototypes */ @@ -283,10 +286,6 @@ int rcattach(dvp) rc_wakeup((void *)NULL); rc_wakeup_started = 0; } -#ifdef JREMOD - rc_devsw_install(); -#endif /*JREMOD*/ - return 1; } @@ -1511,18 +1510,28 @@ struct cdevsw rc_cdevsw = static rc_devsw_installed = 0; -static void rc_devsw_install() +static void rc_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! rc_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&rc_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&rc_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&rc_cdevsw,NULL); rc_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*/ + "/", "rc", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(rcdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,rc_drvinit,NULL) + #endif /* JREMOD */ + #endif /* NRC */ diff --git a/sys/i386/isa/scd.c b/sys/i386/isa/scd.c index 7d4fdec..0e2a130 100644 --- a/sys/i386/isa/scd.c +++ b/sys/i386/isa/scd.c @@ -41,7 +41,7 @@ */ -/* $Id: scd.c,v 1.9 1995/11/04 13:23:39 bde Exp $ */ +/* $Id: scd.c,v 1.10 1995/11/28 09:41:36 julian Exp $ */ /* Please send any comments to micke@dynas.se */ @@ -73,9 +73,12 @@ #include <i386/isa/scdreg.h> #ifdef JREMOD +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 45 #define BDEV_MAJOR 16 -static void scd_devsw_install(); #endif /*JREMOD */ #define scd_part(dev) ((minor(dev)) & 7) @@ -224,10 +227,6 @@ int scd_attach(struct isa_device *dev) cd->flags = SCDINIT; cd->audio_status = CD_AS_AUDIO_INVALID; -#ifdef JREMOD - scd_devsw_install(); -#endif /*JREMOD*/ - return 1; } @@ -1529,6 +1528,7 @@ scd_toc_entrys (int unit, struct ioc_read_toc_entry *te) return 0; } + #ifdef JREMOD struct bdevsw scd_bdevsw = { scdopen, scdclose, scdstrategy, scdioctl, /*16*/ @@ -1541,19 +1541,34 @@ struct cdevsw scd_cdevsw = static scd_devsw_installed = 0; -static void scd_devsw_install() +static void scd_drvinit(void *unused) { - dev_t descript; + dev_t dev; + dev_t dev_chr; + if( ! scd_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&scd_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&scd_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&scd_cdevsw,NULL); + dev_chr = dev; + dev = makedev(BDEV_MAJOR,0); + bdevsw_add(&dev,&scd_bdevsw,NULL); scd_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*/ + "/", "rscd", major(dev_chr), 0, DV_CHR, 0, 0, 0600); + x=devfs_add_devsw( + "/", "scd", major(dev), 0, DV_BLK, 0, 0, 0600); + } + } +#endif } + +SYSINIT(scddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,scd_drvinit,NULL) + #endif /* JREMOD */ #endif /* NSCD > 0 */ diff --git a/sys/i386/isa/si.c b/sys/i386/isa/si.c index 93accc2..7b58916 100644 --- a/sys/i386/isa/si.c +++ b/sys/i386/isa/si.c @@ -30,7 +30,7 @@ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN * NO EVENT SHALL THE AUTHORS BE LIABLE. * - * $Id: si.c,v 1.16 1995/11/28 07:29:29 bde Exp $ + * $Id: si.c,v 1.17 1995/11/28 09:41:39 julian Exp $ */ #ifndef lint @@ -82,8 +82,10 @@ static char si_copyright1[] = "@(#) (C) Specialix International, 1990,1992", enum si_mctl { GET, SET, BIS, BIC }; #ifdef JREMOD +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 68 -static void si_devsw_install(); #endif /*JREMOD*/ @@ -657,9 +659,6 @@ mem_fail: } done_chartimes = 1; } -#ifdef JREMOD - si_devsw_install(); -#endif /*JREMOD*/ return (1); } @@ -2309,18 +2308,34 @@ struct cdevsw si_cdevsw = static si_devsw_installed = 0; -static void si_devsw_install() +static void si_drvinit(void *unused) { - dev_t descript; + dev_t dev; + dev_t dev_chr; + if( ! si_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&si_cdevsw,NULL); + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&si_cdevsw,NULL); + dev_chr = dev; #if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&si_bdevsw,NULL); + dev = makedev(BDEV_MAJOR,0); + bdevsw_add(&dev,&si_bdevsw,NULL); #endif /*BDEV_MAJOR*/ si_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*/ + "/", "si", major(dev_chr), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(sidev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,si_drvinit,NULL) + #endif /* JREMOD */ + #endif diff --git a/sys/i386/isa/sio.c b/sys/i386/isa/sio.c index b8aa9e2..7cabae4 100644 --- a/sys/i386/isa/sio.c +++ b/sys/i386/isa/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.119 1995/11/21 09:15:04 bde Exp $ + * $Id: sio.c,v 1.120 1995/11/28 09:41:47 julian Exp $ */ #include "sio.h" @@ -97,8 +97,10 @@ #define com_scr 7 /* scratch register for 16450-16550 (R/W) */ #ifdef JREMOD +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 28 -static void sio_devsw_install(); #endif /*JREMOD*/ @@ -883,9 +885,6 @@ determined_type: ; s = spltty(); com_addr(unit) = com; splx(s); -#ifdef JREMOD - sio_devsw_install(); -#endif /*JREMOD*/ return (1); } @@ -2574,18 +2573,28 @@ struct cdevsw sio_cdevsw = static sio_devsw_installed = 0; -static void sio_devsw_install() +static void sio_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! sio_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&sio_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&sio_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&sio_cdevsw,NULL); sio_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*/ + "/", "sio", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(siodev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,sio_drvinit,NULL) + #endif /* JREMOD */ + #endif /* NSIO > 0 */ diff --git a/sys/i386/isa/sound/soundcard.c b/sys/i386/isa/sound/soundcard.c index d417c30..dd6fe32 100644 --- a/sys/i386/isa/sound/soundcard.c +++ b/sys/i386/isa/sound/soundcard.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: soundcard.c,v 1.31 1995/11/28 09:43:45 julian Exp $ + * $Id: soundcard.c,v 1.32 1995/11/29 01:07:52 jkh Exp $ */ #include "sound_config.h" @@ -38,8 +38,11 @@ #ifdef JREMOD #include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 30 -static void snd_devsw_install(); #endif /*JREMOD*/ @@ -352,10 +355,6 @@ sndattach (struct isa_device *dev) } #endif -#ifdef JREMOD - snd_devsw_install(); -#endif /*JREMOD*/ - return TRUE; } @@ -484,6 +483,7 @@ snd_release_irq(int vect) { } +#endif #ifdef JREMOD struct cdevsw snd_cdevsw = { sndopen, sndclose, sndread, sndwrite, /*30*/ @@ -492,18 +492,28 @@ struct cdevsw snd_cdevsw = static snd_devsw_installed = 0; -static void snd_devsw_install() +static void snd_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! snd_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&snd_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&snd_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&snd_cdevsw,NULL); + dev_chr = dev; snd_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*/ + "/", "snd", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(snddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,snd_drvinit,NULL) + #endif /* JREMOD */ -#endif + diff --git a/sys/i386/isa/spigot.c b/sys/i386/isa/spigot.c index 093c30e..610c220 100644 --- a/sys/i386/isa/spigot.c +++ b/sys/i386/isa/spigot.c @@ -72,8 +72,10 @@ error "Can only have 1 spigot configured." #ifdef JREMOD #include <sys/conf.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 11 -static void spigot_devsw_install(); #endif /*JREMOD*/ struct spigot_softc { @@ -158,10 +160,6 @@ struct spigot_softc *ss=(struct spigot_softc *)&spigot_softc[devp->id_unit]; ss->maddr = kvtop(devp->id_maddr); ss->irq = devp->id_irq; -#ifdef JREMOD - spigot_devsw_install(); -#endif /*JREMOD*/ - return 1; } @@ -285,6 +283,7 @@ struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[0]; return i386_btop(ss->maddr); } + #ifdef JREMOD struct cdevsw spigot_cdevsw = { spigot_open, spigot_close, spigot_read, spigot_write, /*11*/ @@ -293,19 +292,28 @@ struct cdevsw spigot_cdevsw = static spigot_devsw_installed = 0; -static void spigot_devsw_install() +static void spigot_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! spigot_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&spigot_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&spigot_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&spigot_cdevsw,NULL); spigot_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*/ + "/", "spigot", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(spigotdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,spigot_drvinit,NULL) + #endif /* JREMOD */ #endif /* NSPIGOT */ diff --git a/sys/i386/isa/spkr.c b/sys/i386/isa/spkr.c index 050ba18..620ec9f 100644 --- a/sys/i386/isa/spkr.c +++ b/sys/i386/isa/spkr.c @@ -4,7 +4,7 @@ * v1.4 by Eric S. Raymond (esr@snark.thyrsus.com) Aug 1993 * modified for FreeBSD by Andrew A. Chernov <ache@astral.msk.su> * - * $Id: spkr.c,v 1.17 1995/09/09 18:09:55 davidg Exp $ + * $Id: spkr.c,v 1.18 1995/11/28 09:41:55 julian Exp $ */ #include "speaker.h" @@ -26,31 +26,13 @@ #ifdef JREMOD #include <sys/conf.h> #define CDEV_MAJOR 26 -static void spkr_devsw_install(); #endif /*JREMOD*/ -#if defined(DEVFS) || defined(JREMOD) -#include "sys/kernel.h" #ifdef DEVFS #include <sys/devfsext.h> -int spkropen(); #endif -void spkrdev_init(void *data) /* data not used */ -{ - void * x; -#ifdef JREMOD - spkr_devsw_install(); -#endif /*JREMOD*/ -#ifdef DEVFS -/* path name devsw minor type uid gid perm*/ - x=dev_add("/misc", "speaker", spkropen, 0, DV_CHR, 0, 0, 0600); -#endif - -} -SYSINIT(spkrdev,SI_SUB_DEVFS, SI_ORDER_ANY, spkrdev_init, NULL) -#endif /*DEVFS*/ /* JREMOD */ /**************** MACHINE DEPENDENT PART STARTS HERE ************************* * @@ -595,19 +577,29 @@ struct cdevsw spkr_cdevsw = static spkr_devsw_installed = 0; -static void spkr_devsw_install() +static void spkr_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! spkr_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&spkr_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&spkr_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&spkr_cdevsw,NULL); spkr_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*/ + "/", "spkr", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(spkrdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,spkr_drvinit,NULL) + #endif /* JREMOD */ + #endif /* NSPEAKER > 0 */ /* spkr.c ends here */ diff --git a/sys/i386/isa/tw.c b/sys/i386/isa/tw.c index 7b5dbcc..c672047 100644 --- a/sys/i386/isa/tw.c +++ b/sys/i386/isa/tw.c @@ -149,10 +149,14 @@ #ifdef JREMOD #include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 19 -static void tw_devsw_install(); #endif /*JREMOD*/ + /* * Transmission is done by calling write() to send three byte packets of data. * The first byte contains a four bit house code (0=A to 15=P). @@ -348,9 +352,6 @@ int twattach(idp) sc = &tw_sc[idp->id_unit]; sc->sc_port = idp->id_iobase; sc->sc_state = 0; -#ifdef JREMOD - tw_devsw_install(); -#endif /*JREMOD*/ return (1); } @@ -999,19 +1000,28 @@ struct cdevsw tw_cdevsw = static tw_devsw_installed = 0; -static void tw_devsw_install() +static void tw_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! tw_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&tw_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&tw_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&tw_cdevsw,NULL); tw_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*/ + "/", "tw", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(twdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,tw_drvinit,NULL) + #endif /* JREMOD */ #endif NTW diff --git a/sys/i386/isa/wcd.c b/sys/i386/isa/wcd.c index 527d14a..bb7d4db 100644 --- a/sys/i386/isa/wcd.c +++ b/sys/i386/isa/wcd.c @@ -34,9 +34,11 @@ #ifdef JREMOD #include <sys/conf.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 69 #define BDEV_MAJOR 19 -static void wcd_devsw_install(); #endif /*JREMOD */ extern int wcdattach(struct atapi*, int, struct atapi_params*, int, struct kern_devconf*); @@ -322,9 +324,6 @@ wcdattach (struct atapi *ata, int unit, struct atapi_params *ap, int debug, strncpy (t->description + strlen(t->description), ap->model, sizeof(ap->model)); dev_attach (&t->cf); -#ifdef JREMOD - wcd_devsw_install(); -#endif /*JREMOD*/ return (1); } @@ -1182,19 +1181,35 @@ struct cdevsw wcd_cdevsw = static wcd_devsw_installed = 0; -static void wcd_devsw_install() +static void wcd_drvinit(void *unused) { - dev_t descript; + dev_t dev; + dev_t dev_chr; + if( ! wcd_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&wcd_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&wcd_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&wcd_cdevsw,NULL); + dev_chr = dev; + dev = makedev(BDEV_MAJOR,0); + bdevsw_add(&dev,&wcd_bdevsw,NULL); wcd_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*/ + "/", "rwcd", major(dev_chr), 0, DV_CHR, 0, 0, 0600); + x=devfs_add_devsw( +/* path name devsw minor type uid gid perm*/ + "/", "wcd", major(dev), 0, DV_BLK, 0, 0, 0600); + } + } +#endif } + +SYSINIT(wcddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,wcd_drvinit,NULL) + #endif /* JREMOD */ #endif /* NWCD && NWDC && ATAPI */ diff --git a/sys/i386/isa/wd.c b/sys/i386/isa/wd.c index 1b00118..f55eab6 100644 --- a/sys/i386/isa/wd.c +++ b/sys/i386/isa/wd.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)wd.c 7.2 (Berkeley) 5/9/91 - * $Id: wd.c,v 1.92 1995/11/23 07:24:41 dyson Exp $ + * $Id: wd.c,v 1.93 1995/11/28 09:42:03 julian Exp $ */ /* TODO: @@ -106,9 +106,11 @@ extern void wdstart(int ctrlr); #define WDOPT_MULTIMASK 0x00ff #ifdef JREMOD +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 3 #define BDEV_MAJOR 0 -static void wd_devsw_install(); #endif /*JREMOD */ static int wd_goaway(struct kern_devconf *, int); @@ -320,10 +322,6 @@ wdprobe(struct isa_device *dvp) du->dk_port = dvp->id_iobase; wdc_registerdev(dvp); -#ifdef JREMOD - wd_devsw_install(); -#endif /*JREMOD*/ - /* check if we have registers that work */ outb(du->dk_port + wd_sdh, WDSD_IBM); /* set unit 0 */ @@ -2138,18 +2136,34 @@ struct cdevsw wd_cdevsw = static wd_devsw_installed = 0; -static void wd_devsw_install() +static void wd_drvinit(void *unused) { - dev_t descript; + dev_t dev; + dev_t dev_chr; + if( ! wd_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&wd_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&wd_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&wd_cdevsw,NULL); + dev_chr = dev; + dev = makedev(BDEV_MAJOR,0); + bdevsw_add(&dev,&wd_bdevsw,NULL); wd_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*/ + "/", "rwd", major(dev_chr), 0, DV_CHR, 0, 0, 0600); + x=devfs_add_devsw( + "/", "wd", major(dev), 0, DV_BLK, 0, 0, 0600); + } + } +#endif } + +SYSINIT(wddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,wd_drvinit,NULL) + #endif /* JREMOD */ + #endif /* NWDC > 0 */ diff --git a/sys/i386/isa/wt.c b/sys/i386/isa/wt.c index 8a4e609d..6420f4c 100644 --- a/sys/i386/isa/wt.c +++ b/sys/i386/isa/wt.c @@ -19,7 +19,7 @@ * the original CMU copyright notice. * * Version 1.3, Thu Nov 11 12:09:13 MSK 1993 - * $Id: wt.c,v 1.20 1995/10/28 15:39:31 phk Exp $ + * $Id: wt.c,v 1.21 1995/11/28 09:42:06 julian Exp $ * */ @@ -78,9 +78,11 @@ #ifdef JREMOD #include <sys/conf.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 10 #define BDEV_MAJOR 3 -static void wt_devsw_install(); #endif /*JREMOD */ /* @@ -268,9 +270,6 @@ wtattach (struct isa_device *id) t->flags = TPSTART; /* tape is rewound */ t->dens = -1; /* unknown density */ kdc_wt[id->id_unit].kdc_state = DC_IDLE; -#ifdef JREMOD - wt_devsw_install(); -#endif /*JREMOD*/ return (1); } @@ -975,6 +974,7 @@ static int wtstatus (wtinfo_t *t) return (1); } + #ifdef JREMOD struct bdevsw wt_bdevsw = { wtopen, wtclose, wtstrategy, wtioctl, /*3*/ @@ -987,19 +987,34 @@ struct cdevsw wt_cdevsw = static wt_devsw_installed = 0; -static void wt_devsw_install() +static void wt_drvinit(void *unused) { - dev_t descript; + dev_t dev; + dev_t dev_chr; + if( ! wt_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&wt_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&wt_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&wt_cdevsw,NULL); + dev_chr = dev; + dev = makedev(BDEV_MAJOR,0); + bdevsw_add(&dev,&wt_bdevsw,NULL); wt_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*/ + "/", "rwt", major(dev_chr), 0, DV_CHR, 0, 0, 0600); + x=devfs_add_devsw( + "/", "wt", major(dev), 0, DV_BLK, 0, 0, 0600); + } + } +#endif } + +SYSINIT(wtdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,wt_drvinit,NULL) + #endif /* JREMOD */ #endif /* NWT */ diff --git a/sys/isa/joy.c b/sys/isa/joy.c index 5870e62..e90e90f 100644 --- a/sys/isa/joy.c +++ b/sys/isa/joy.c @@ -43,8 +43,11 @@ #ifdef JREMOD #include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 51 -static void joy_devsw_install(); #endif /*JREMOD*/ /* The game port can manage 4 buttons and 4 variable resistors (usually 2 @@ -105,10 +108,6 @@ joyattach (struct isa_device *dev) joy[dev->id_unit].timeout[0] = joy[dev->id_unit].timeout[1] = 0; printf("joy%d: joystick\n", dev->id_unit); -#ifdef JREMOD - joy_devsw_install(); -#endif /*JREMOD*/ - return 1; } @@ -224,18 +223,28 @@ struct cdevsw joy_cdevsw = static joy_devsw_installed = 0; -static void joy_devsw_install() +static void joy_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! joy_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&joy_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&joy_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&joy_cdevsw,NULL); joy_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*/ + "/", "joy", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(joydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,joy_drvinit,NULL) + #endif /* JREMOD */ + #endif /* NJOY > 0 */ diff --git a/sys/isa/sio.c b/sys/isa/sio.c index b8aa9e2..7cabae4 100644 --- a/sys/isa/sio.c +++ b/sys/isa/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.119 1995/11/21 09:15:04 bde Exp $ + * $Id: sio.c,v 1.120 1995/11/28 09:41:47 julian Exp $ */ #include "sio.h" @@ -97,8 +97,10 @@ #define com_scr 7 /* scratch register for 16450-16550 (R/W) */ #ifdef JREMOD +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ #define CDEV_MAJOR 28 -static void sio_devsw_install(); #endif /*JREMOD*/ @@ -883,9 +885,6 @@ determined_type: ; s = spltty(); com_addr(unit) = com; splx(s); -#ifdef JREMOD - sio_devsw_install(); -#endif /*JREMOD*/ return (1); } @@ -2574,18 +2573,28 @@ struct cdevsw sio_cdevsw = static sio_devsw_installed = 0; -static void sio_devsw_install() +static void sio_drvinit(void *unused) { - dev_t descript; + dev_t dev; + if( ! sio_devsw_installed ) { - descript = makedev(CDEV_MAJOR,0); - cdevsw_add(&descript,&sio_cdevsw,NULL); -#if defined(BDEV_MAJOR) - descript = makedev(BDEV_MAJOR,0); - bdevsw_add(&descript,&sio_bdevsw,NULL); -#endif /*BDEV_MAJOR*/ + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&sio_cdevsw,NULL); sio_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*/ + "/", "sio", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif } + +SYSINIT(siodev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,sio_drvinit,NULL) + #endif /* JREMOD */ + #endif /* NSIO > 0 */ diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 4912d73..f1f5557 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94 - * $Id: kern_descrip.c,v 1.13 1995/11/12 06:42:52 bde Exp $ + * $Id: kern_descrip.c,v 1.14 1995/11/14 08:58:35 phk Exp $ */ #include <sys/param.h> @@ -57,6 +57,14 @@ #include <sys/unistd.h> #include <sys/resourcevar.h> +#ifdef JREMOD +#include <sys/conf.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ +#define CDEV_MAJOR 22 +#endif /*JREMOD*/ + int finishdup(struct filedesc *fdp, int old, int new, int *retval); /* * Descriptor management. @@ -1013,6 +1021,43 @@ sysctl_kern_file SYSCTL_HANDLER_ARGS } return (0); } +#ifdef JREMOD +struct cdevsw fildesc_cdevsw = + { fdopen, noclose, noread, nowrite, /*22*/ + noioc, nostop, nullreset, nodevtotty,/*fd(!=Fd)*/ + noselect, nommap, nostrat }; + +static fildesc_devsw_installed = 0; + +static void fildesc_drvinit(void *unused) +{ + dev_t dev; + + if( ! fildesc_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&fildesc_cdevsw,NULL); + fildesc_devsw_installed = 1; +#ifdef DEVFS + { + int x; +/* default for a simple device with no probe routine (usually delete this) */ +/* path name devsw minor type uid gid perm*/ + x=devfs_add_devsw("/","stdin",major(dev),0,DV_CHR, + 0, 0, 0600); + x=devfs_add_devsw("/","stdout",major(dev),1,DV_CHR, + 0, 0, 0600); + x=devfs_add_devsw("/","stderr",major(dev),2,DV_CHR, + 0, 0, 0600); + } + } +#endif +} + +SYSINIT(fildescdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR, + fildesc_drvinit,NULL) + +#endif /* JREMOD */ + SYSCTL_PROC(_kern, KERN_FILE, file, CTLTYPE_OPAQUE|CTLFLAG_RD, 0, 0, sysctl_kern_file, ""); diff --git a/sys/kern/kern_lkm.c b/sys/kern/kern_lkm.c index ad78d28..902ed4c 100644 --- a/sys/kern/kern_lkm.c +++ b/sys/kern/kern_lkm.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: kern_lkm.c,v 1.18 1995/11/09 09:43:32 bde Exp $ + * $Id: kern_lkm.c,v 1.19 1995/11/20 12:06:21 phk Exp $ */ /* @@ -61,6 +61,13 @@ #include <vm/vm_param.h> #include <vm/vm_kern.h> +#ifdef JREMOD +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ +#define CDEV_MAJOR 32 +#endif /*JREMOD */ + #define PAGESIZE 1024 /* kmem_alloc() allocation quantum */ #define LKM_ALLOC 0x01 @@ -993,3 +1000,36 @@ lkm_nullcmd(lkmtp, cmd) return (0); } + +#ifdef JREMOD +struct cdevsw lkm_cdevsw = + { lkmcopen, lkmcclose, noread, nowrite, /*32*/ + lkmcioctl, nostop, nullreset, nodevtotty, + noselect, nommap, NULL }; + +static lkm_devsw_installed = 0; + +static void lkm_drvinit(void *unused) +{ + dev_t dev; + + if( ! lkm_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&lkm_cdevsw,NULL); + lkm_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*/ + "/", "lkm", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif +} + +SYSINIT(lkmdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,lkm_drvinit,NULL) + +#endif /* JREMOD */ + diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c index a2e2d47..0b9d5da 100644 --- a/sys/kern/subr_log.c +++ b/sys/kern/subr_log.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)subr_log.c 8.1 (Berkeley) 6/10/93 - * $Id: subr_log.c,v 1.9 1995/08/07 07:58:17 davidg Exp $ + * $Id: subr_log.c,v 1.10 1995/10/29 15:30:59 phk Exp $ */ /* @@ -47,6 +47,15 @@ #include <sys/file.h> #include <sys/signalvar.h> +#ifdef JREMOD +#include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ +#define CDEV_MAJOR 7 +#endif /*JREMOD*/ + #define LOG_RDPRI (PZERO + 1) #define LOG_ASYNC 0x04 @@ -223,3 +232,36 @@ logioctl(dev, com, data, flag, p) } return (0); } + +#ifdef JREMOD +struct cdevsw log_cdevsw = + { logopen, logclose, logread, nowrite, /*7*/ + logioctl, nostop, nullreset, nodevtotty,/* klog */ + logselect, nommap, NULL }; + +static log_devsw_installed = 0; + +static void log_drvinit(void *unused) +{ + dev_t dev; + + if( ! log_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&log_cdevsw,NULL); + log_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*/ + "/", "log", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif +} + +SYSINIT(logdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,log_drvinit,NULL) + +#endif /* JREMOD */ + diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c index 0b509594..9b8735d 100644 --- a/sys/kern/tty_cons.c +++ b/sys/kern/tty_cons.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)cons.c 7.2 (Berkeley) 5/9/91 - * $Id: cons.c,v 1.33 1995/09/10 18:57:25 bde Exp $ + * $Id: cons.c,v 1.34 1995/09/10 21:34:49 bde Exp $ */ #include <sys/param.h> @@ -48,6 +48,14 @@ #include <machine/cons.h> #include <machine/stdarg.h> +#ifdef JREMOD +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ +#define CDEV_MAJOR 0 +#endif /*JREMOD*/ + /* XXX this should be config(8)ed. */ #include "sc.h" #include "vt.h" @@ -79,23 +87,6 @@ static d_open_t *cn_phys_open; /* physical device open function */ static struct consdev *cn_tab; /* physical console device info */ static struct tty *cn_tp; /* physical console tty struct */ -#ifdef DEVFS -#include <sys/kernel.h> -#include <sys/devfsext.h> - -static void cndev_init __P((void *)); -SYSINIT(cndev, SI_SUB_DEVFS, SI_ORDER_ANY, cndev_init, NULL) - -static void -cndev_init(dummy) - void *dummy; -{ - void * x; -/* path name devsw minor type uid gid perm*/ - x=dev_add("/misc", "console", cnopen, 0, DV_CHR, 0, 0, 0640); -} -#endif /* DEVFS */ - void cninit() { @@ -322,3 +313,30 @@ pg(const char *p, ...) { } +#ifdef JREMOD +struct cdevsw cn_cdevsw = + { cnopen, cnclose, cnread, cnwrite, /*0*/ + cnioctl, nullstop, nullreset, nodevtotty,/* console */ + cnselect, nommap, NULL }; + +static cn_devsw_installed = 0; + +static void cn_drvinit(void *unused) +{ + void * x; + dev_t dev; + + if( ! cn_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&cn_cdevsw,NULL); + cn_devsw_installed = 1; +#ifdef DEVFS + /* path,name,major,minor,type,uid,gid,perm */ + x=devfs_add_devsw("/","console",major(dev),0,DV_CHR,0,0,0640); +#endif +} + +SYSINIT(cndev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cn_drvinit,NULL) + +#endif /* JREMOD */ + diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index 2baaea2..ad41417 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)tty_pty.c 8.2 (Berkeley) 9/23/93 - * $Id: tty_pty.c,v 1.23 1995/10/30 17:16:55 bde Exp $ + * $Id: tty_pty.c,v 1.24 1995/11/04 13:24:55 bde Exp $ */ /* @@ -52,6 +52,10 @@ #include <sys/vnode.h> #include <sys/signalvar.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ + void ptyattach __P((int n)); void ptsstart __P((struct tty *tp)); void ptcwakeup __P((struct tty *tp, int flag)); @@ -733,3 +737,61 @@ ptyioctl(dev, cmd, data, flag, p) } return (error); } + +#define CDEV_MAJOR_S 5 +#define CDEV_MAJOR_C 6 +#ifdef JREMOD +struct cdevsw pts_cdevsw = + { ptsopen, ptsclose, ptsread, ptswrite, /*5*/ + ptyioctl, ptsstop, nullreset, ptydevtotty,/* ttyp */ + ttselect, nommap, NULL }; + +struct cdevsw ptc_cdevsw = + { ptcopen, ptcclose, ptcread, ptcwrite, /*6*/ + ptyioctl, nullstop, nullreset, ptydevtotty,/* ptyp */ + ptcselect, nommap, NULL }; + +static ptc_devsw_installed = 0; + +static void ptc_drvinit(void *unused) +{ +#ifdef DEVFS + int i + char jnames[] = "pqrstu" + char knames[] = "0123456789abcdef" + char devname[16]; +#define MAXUNITS (6 * 16) +#endif + dev_t dev; + dev_t dev_c; + + if( ! ptc_devsw_installed ) { + dev = makedev(CDEV_MAJOR_S,0); + cdevsw_add(&dev,&pts_cdevsw,NULL); + pts_devsw_installed = 1; + dev_c = makedev(CDEV_MAJOR_C,0); + cdevsw_add(&dev_c,&ptc_cdevsw,NULL); + ptc_devsw_installed = 1; +#ifdef DEVFS +/*XXX*/ +#if NPTY > MAXUNITS +#undef NPTY +#define NPTY MAXUNITS +#endif + for ( i = 0 ; i<NPTY ; i++ ) { + int x; + + j = i / 16; + k = i % 16; + sprintf(devname,"pty%c%c",jnames[j],knames[k]); + x=devfs_add_devsw("/",devname,major(dev_c),0,DV_CHR,0,0,0600); + sprintf(devname,"tty%c%c",jnames[j],knames[k]); + x=devfs_add_devsw("/",devname,major(dev),0,DV_CHR,0,0,0600); + } +#endif +} + +SYSINIT(ptcdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR_C,ptc_drvinit,NULL) + +#endif /* JREMOD */ + diff --git a/sys/kern/tty_snoop.c b/sys/kern/tty_snoop.c index 77c1596..c89c975 100644 --- a/sys/kern/tty_snoop.c +++ b/sys/kern/tty_snoop.c @@ -33,6 +33,13 @@ #include <sys/snoop.h> +#ifdef JREMOD +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ +#define CDEV_MAJOR 53 +#endif /*JREMOD*/ + #ifndef MIN #define MIN(a,b) (((a)<(b))?(a):(b)) #endif @@ -491,4 +498,36 @@ snpselect(dev, rw, p) return 0; } +#ifdef JREMOD +struct cdevsw snp_cdevsw = + { snpopen, snpclose, snpread, snpwrite, /*53*/ + snpioctl, nostop, nullreset, nodevtotty,/* snoop */ + snpselect, nommap, NULL }; + +static snp_devsw_installed = 0; + +static void snp_drvinit(void *unused) +{ + dev_t dev; + + if( ! snp_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&snp_cdevsw,NULL); + snp_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*/ + "/", "snp", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif +} + +SYSINIT(snpdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,snp_drvinit,NULL) + +#endif /* JREMOD */ + #endif diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c index 9fe7f33..d0a0c8c 100644 --- a/sys/kern/tty_tty.c +++ b/sys/kern/tty_tty.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)tty_tty.c 8.2 (Berkeley) 9/23/93 - * $Id: tty_tty.c,v 1.4 1994/12/04 01:46:13 ache Exp $ + * $Id: tty_tty.c,v 1.5 1995/05/30 08:06:19 rgrimes Exp $ */ /* @@ -46,6 +46,14 @@ #include <sys/vnode.h> #include <sys/file.h> +#ifdef JREMOD +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ +#define CDEV_MAJOR 1 +#endif /*JREMOD*/ + #define cttyvp(p) ((p)->p_flag & P_CONTROLT ? (p)->p_session->s_ttyvp : NULL) /*ARGSUSED*/ @@ -153,3 +161,36 @@ cttyselect(dev, flag, p) return (1); /* try operation to get EOF/failure */ return (VOP_SELECT(ttyvp, flag, FREAD|FWRITE, NOCRED, p)); } + +#ifdef JREMOD +struct cdevsw ctty_cdevsw = + { cttyopen, nullclose, cttyread, cttywrite, /*1*/ + cttyioctl, nullstop, nullreset, nodevtotty,/* tty */ + cttyselect, nommap, NULL }; + +static ctty_devsw_installed = 0; + +static void ctty_drvinit(void *unused) +{ + dev_t dev; + + if( ! ctty_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&ctty_cdevsw,NULL); + ctty_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*/ + "/", "tty", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif +} + +SYSINIT(cttydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,ctty_drvinit,NULL) + +#endif /* JREMOD */ + diff --git a/sys/miscfs/devfs/devfs_tree.c b/sys/miscfs/devfs/devfs_tree.c index bf50492..0110f8b 100644 --- a/sys/miscfs/devfs/devfs_tree.c +++ b/sys/miscfs/devfs/devfs_tree.c @@ -2,7 +2,7 @@ /* * Written by Julian Elischer (julian@DIALix.oz.au) * - * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_tree.c,v 1.7 1995/09/09 18:10:18 davidg Exp $ + * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_tree.c,v 1.8 1995/10/10 07:12:25 julian Exp $ */ #include "param.h" @@ -906,6 +906,50 @@ int dev_add_entry(char *name, dn_p parent, int type, union typeinfo *by, devnm_p * Add the named device entry into the given directory, and make it * * The appropriate type... (called (sometimes indirectly) by drivers..) * \***********************************************************************/ +void *devfs_add_devsw(char *path, + char *name, + int major, + int minor, + int chrblk, + uid_t uid, + gid_t gid, + int perms) +{ + devnm_p new_dev; + dn_p dnp; /* devnode for parent directory */ + int retval; + union typeinfo by; + + DBPRINT(("dev_add\n")); + retval = dev_finddir(path,NULL,1,&dnp); + if (retval) return 0; + switch(chrblk) + { + case DV_CHR: + by.Cdev.cdevsw = cdevsw + major; + by.Cdev.dev = makedev(major, minor); + if( dev_add_entry(name, dnp, DEV_CDEV, &by,&new_dev)) + return NULL; + break; + case DV_BLK: + by.Bdev.bdevsw = bdevsw + major; + by.Bdev.dev = makedev(major, minor); + if( dev_add_entry(name, dnp, DEV_BDEV, &by, &new_dev)) + return NULL; + break; + default: + return NULL; + } + new_dev->dnp->gid = gid; + new_dev->dnp->uid = uid; + new_dev->dnp->mode |= perms; + return new_dev; +} + +/***********************************************************************\ +* Add the named device entry into the given directory, and make it * +* The appropriate type... (called (sometimes indirectly) by drivers..) * +\***********************************************************************/ void *dev_add(char *path, char *name, void *funct, diff --git a/sys/net/bpf.c b/sys/net/bpf.c index ce31e3e..d6393aa 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -37,7 +37,7 @@ * * @(#)bpf.c 8.2 (Berkeley) 3/28/94 * - * $Id: bpf.c,v 1.13 1995/09/22 17:57:45 wollman Exp $ + * $Id: bpf.c,v 1.14 1995/11/20 12:29:05 phk Exp $ */ #include "bpfilter.h" @@ -80,6 +80,14 @@ #include <netinet/if_ether.h> #include <sys/kernel.h> +#ifdef JREMOD +#include <sys/conf.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ +#define CDEV_MAJOR 23 +#endif /*JREMOD*/ + /* * Older BSDs don't have kernel malloc. */ @@ -1310,4 +1318,38 @@ bpfattach(driverp, ifp, dlt, hdrlen) if (bootverbose) printf("bpf: %s%d attached\n", ifp->if_name, ifp->if_unit); } + + +#ifdef JREMOD +struct cdevsw bpf_cdevsw = + { bpfopen, bpfclose, bpfread, bpfwrite, /*23*/ + bpfioctl, nostop, nullreset, nodevtotty,/* bpf */ + bpfselect, nommap, NULL }; + +static bpf_devsw_installed = 0; + +static void bpf_drvinit(void *unused) +{ + dev_t dev; + + if( ! bpf_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&bpf_cdevsw,NULL); + bpf_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*/ + "/", "bpf", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif +} + +SYSINIT(bpfdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,bpf_drvinit,NULL) + +#endif /* JREMOD */ + #endif diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 91ffbe2..ded3d95 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -67,6 +67,13 @@ static void tunattach __P((void *)); PSEUDO_SET(tunattach, if_tun); #endif +#ifdef JREMOD +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ +#define CDEV_MAJOR 52 +#endif /*JREMOD*/ + #define TUNDEBUG if (tundebug) printf int tundebug = 0; @@ -598,4 +605,36 @@ tunselect(dev_t dev, int rw, struct proc *p) return 0; } +#ifdef JREMOD +struct cdevsw tun_cdevsw = + { tunopen, tunclose, tunread, tunwrite, /*52*/ + tunioctl, nostop, nullreset, nodevtotty,/* tunnel */ + tunselect, nommap, NULL }; + +static tun_devsw_installed = 0; + +static void tun_drvinit(void *unused) +{ + dev_t dev; + + if( ! tun_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&tun_cdevsw,NULL); + tun_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*/ + "/", "tun", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif +} + +SYSINIT(tundev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,tun_drvinit,NULL) + +#endif /* JREMOD */ + #endif /* NTUN */ diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c index 9dd7da7..6dae40b 100644 --- a/sys/pccard/pccard.c +++ b/sys/pccard/pccard.c @@ -50,6 +50,14 @@ #include <pccard/card.h> #include <pccard/slot.h> +#ifdef JREMOD +#include <sys/conf.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ +#define CDEV_MAJOR 50 +#endif /*JREMOD*/ + extern struct kern_devconf kdc_cpu0; @@ -896,3 +904,36 @@ find_driver(char *name) return(dp); return(0); } + +#ifdef JREMOD +struct cdevsw crd_cdevsw = + { crdopen, crdclose, crdread, crdwrite, /*50*/ + crdioctl, nostop, nullreset, nodevtotty,/* pcmcia */ + crdselect, nommap, NULL }; + +static crd_devsw_installed = 0; + +static void crd_drvinit(void *unused) +{ + dev_t dev; + + if( ! crd_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&crd_cdevsw,NULL); + crd_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*/ + "/", "crd", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif +} + +SYSINIT(crddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,crd_drvinit,NULL) + +#endif /* JREMOD */ + diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index f4f31d9..2418658 100644 --- a/sys/scsi/cd.c +++ b/sys/scsi/cd.c @@ -14,7 +14,7 @@ * * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 * - * $Id: cd.c,v 1.44 1995/11/19 22:22:18 dyson Exp $ + * $Id: cd.c,v 1.45 1995/11/20 12:42:25 phk Exp $ */ #define SPLCD splbio @@ -41,6 +41,15 @@ #include <sys/devconf.h> #include <sys/dkstat.h> +#ifdef JREMOD +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ +#define CDEV_MAJOR 15 +#define BDEV_MAJOR 6 +#endif /*JREMOD */ + /* static function prototypes */ static errval cd_get_parms __P((int, int)); static errval cd_get_mode __P((u_int32, struct cd_mode_data *, u_int32)); @@ -1296,3 +1305,48 @@ cdsize(dev_t dev) { return (-1); } + +#ifdef JREMOD +struct bdevsw cd_bdevsw = + { cdopen, cdclose, cdstrategy, cdioctl, /*6*/ + nxdump, cdsize, 0 }; +#endif /*JREMOD*/ + +#ifdef JREMOD +struct cdevsw cd_cdevsw = + { cdopen, cdclose, rawread, nowrite, /*15*/ + cdioctl, nostop, nullreset, nodevtotty,/* cd */ + seltrue, nommap, cdstrategy }; + +static cd_devsw_installed = 0; + +static void cd_drvinit(void *unused) +{ + dev_t dev; + dev_t dev_chr; + + if( ! cd_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&cd_cdevsw,NULL); + dev_chr = dev; +#if defined(BDEV_MAJOR) + dev = makedev(BDEV_MAJOR,0); + bdevsw_add(&dev,&cd_bdevsw,NULL); +#endif /*BDEV_MAJOR*/ + cd_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*/ + "/", "cd", major(dev_chr), 0, DV_CHR, 0, 0, 0600); + } + } +#endif +} + +SYSINIT(cddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cd_drvinit,NULL) + +#endif /* JREMOD */ + diff --git a/sys/scsi/ch.c b/sys/scsi/ch.c index 12045d9..b8edea3 100644 --- a/sys/scsi/ch.c +++ b/sys/scsi/ch.c @@ -1,8 +1,8 @@ /* - * Written by grefen@????? + * Written by grefen@convex.com (probably moved by now) * Based on scsi drivers by Julian Elischer (julian@tfs.com) * - * $Id: ch.c,v 1.21 1995/05/30 08:13:22 rgrimes Exp $ + * $Id: ch.c,v 1.22 1995/11/20 12:42:27 phk Exp $ */ #include <sys/types.h> @@ -24,6 +24,16 @@ #include <scsi/scsiconf.h> #include <sys/devconf.h> +#ifdef JREMOD +#include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ +#define CDEV_MAJOR 17 +#endif /*JREMOD*/ + + errval ch_getelem __P((u_int32 unit, short *stat, int type, u_int32 from, void *data, u_int32 flags)); errval ch_move __P((u_int32 unit, short *stat, u_int32 chm, u_int32 from, @@ -501,3 +511,36 @@ ch_mode_sense(unit, flags) cd->rot ? "can" : "can't")); return (0); } + +#ifdef JREMOD +struct cdevsw ch_cdevsw = + { chopen, chclose, noread, nowrite, /*17*/ + chioctl, nostop, nullreset, nodevtotty,/* ch */ + noselect, nommap, nostrat }; + +static ch_devsw_installed = 0; + +static void ch_drvinit(void *unused) +{ + dev_t dev; + + if( ! ch_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&ch_cdevsw,NULL); + ch_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*/ + "/", "ch", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif +} + +SYSINIT(chdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,ch_drvinit,NULL) + +#endif /* JREMOD */ + diff --git a/sys/scsi/od.c b/sys/scsi/od.c index 60a8836..dca9c67 100644 --- a/sys/scsi/od.c +++ b/sys/scsi/od.c @@ -28,7 +28,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: od.c,v 1.2 1995/11/19 22:22:21 dyson Exp $ + * $Id: od.c,v 1.3 1995/11/20 12:42:28 phk Exp $ */ /* @@ -62,6 +62,14 @@ #include <machine/md_var.h> #include <i386/i386/cons.h> /* XXX */ +#ifdef JREMOD +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ +#define CDEV_MAJOR 70 +#define BDEV_MAJOR 20 +#endif /*JREMOD */ + u_int32 odstrats, odqueues; #define SECSIZE 512 @@ -797,3 +805,46 @@ od_sense_handler(struct scsi_xfer *xs) return SCSIRET_DO_RETRY; } + +#ifdef JREMOD +struct bdevsw od_bdevsw = + { odopen, odclose, odstrategy, odioctl, /*20*/ + nxdump, odsize, 0 }; + +struct cdevsw od_cdevsw = + { odopen, odclose, rawread, rawwrite, /*70*/ + odioctl, nostop, nullreset, nodevtotty,/* od */ + seltrue, nommap, odstrategy }; + +static od_devsw_installed = 0; + +static void od_drvinit(void *unused) +{ + dev_t dev; + dev_t dev_chr; + + if( ! od_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&od_cdevsw,NULL); + dev_chr = dev; + dev = makedev(BDEV_MAJOR,0); + bdevsw_add(&dev,&od_bdevsw,NULL); + od_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*/ + "/", "rod", major(dev_chr), 0, DV_CHR, 0, 0, 0600); + x=devfs_add_devsw( + "/", "od", major(dev), 0, DV_BLK, 0, 0, 0600); + } + } +#endif +} + +SYSINIT(oddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,od_drvinit,NULL) + +#endif /* JREMOD */ + diff --git a/sys/scsi/pt.c b/sys/scsi/pt.c index 6ecc795..6d34963 100644 --- a/sys/scsi/pt.c +++ b/sys/scsi/pt.c @@ -37,7 +37,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: pt.c,v 1.5 1995/05/30 08:13:23 rgrimes Exp $ + * $Id: pt.c,v 1.6 1995/11/19 22:22:23 dyson Exp $ */ /* @@ -53,6 +53,15 @@ #include <scsi/scsi_all.h> #include <scsi/scsiconf.h> +#ifdef JREMOD +#include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ +#define CDEV_MAJOR 61 +#endif /*JREMOD*/ + struct scsi_data { struct buf_queue_head buf_queue; }; @@ -249,3 +258,36 @@ int pt_sense(struct scsi_xfer *xs) return SCSIRET_CONTINUE; } } + +#ifdef JREMOD +struct cdevsw pt_cdevsw = + { ptopen, ptclose, rawread, rawwrite, /*61*/ + ptioctl, nostop, nullreset, nodevtotty,/* pt */ + seltrue, nommap, ptstrategy }; + +static pt_devsw_installed = 0; + +static void pt_drvinit(void *unused) +{ + dev_t dev; + + if( ! pt_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&pt_cdevsw,NULL); + pt_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*/ + "/", "pt", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif +} + +SYSINIT(ptdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,pt_drvinit,NULL) + +#endif /* JREMOD */ + diff --git a/sys/scsi/sctarg.c b/sys/scsi/sctarg.c index b7498f5..65cc2f2 100644 --- a/sys/scsi/sctarg.c +++ b/sys/scsi/sctarg.c @@ -37,7 +37,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sctarg.c,v 1.5 1995/11/19 22:22:25 dyson Exp $ + * $Id: sctarg.c,v 1.6 1995/11/21 08:35:49 bde Exp $ */ /* @@ -53,6 +53,15 @@ #include <scsi/scsi_all.h> #include <scsi/scsiconf.h> +#ifdef JREMOD +#include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ +#define CDEV_MAJOR 65 +#endif /*JREMOD*/ + #define OPEN 0x01 struct scsi_data { @@ -266,3 +275,36 @@ sctarg_strategy(struct buf *bp, struct scsi_link *sc_link) splx(opri); return; } + +#ifdef JREMOD +struct cdevsw sctarg_cdevsw = + { sctargopen, sctargclose, rawread, rawwrite, /*65*/ + sctargioctl, nostop, nullreset, nodevtotty,/* sctarg */ + seltrue, nommap, sctargstrategy }; + +static sctarg_devsw_installed = 0; + +static void sctarg_drvinit(void *unused) +{ + dev_t dev; + + if( ! sctarg_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&sctarg_cdevsw,NULL); + sctarg_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*/ + "/", "sctarg", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif +} + +SYSINIT(sctargdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,sctarg_drvinit,NULL) + +#endif /* JREMOD */ + diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index 501aff5..586812d 100644 --- a/sys/scsi/sd.c +++ b/sys/scsi/sd.c @@ -14,7 +14,7 @@ * * Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992 * - * $Id: sd.c,v 1.71 1995/11/20 02:12:34 davidg Exp $ + * $Id: sd.c,v 1.72 1995/11/20 12:42:32 phk Exp $ */ #define SPLSD splbio @@ -39,6 +39,16 @@ #include <machine/md_var.h> #include <i386/i386/cons.h> /* XXX */ +#ifdef JREMOD +#include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ +#define CDEV_MAJOR 13 +#define BDEV_MAJOR 4 +#endif /*JREMOD */ + u_int32 sdstrats, sdqueues; #define SECSIZE 512 @@ -236,7 +246,7 @@ sd_open(dev, mode, fmt, p, sc_link) * "unit attention" errors should occur here if the * drive has been restarted or the pack changed. * just ingnore the result, it's a decoy instruction - * The error code will act on the error though + * The error handlers will act on the error though * and invalidate any media information we had. */ scsi_test_unit_ready(sc_link, 0); @@ -950,3 +960,46 @@ sddump(dev_t dev) } return (0); } + +#ifdef JREMOD +struct bdevsw sd_bdevsw = + { sdopen, sdclose, sdstrategy, sdioctl, /*4*/ + sddump, sdsize, 0 }; + +struct cdevsw sd_cdevsw = + { sdopen, sdclose, rawread, rawwrite, /*13*/ + sdioctl, nostop, nullreset, nodevtotty,/* sd */ + seltrue, nommap, sdstrategy }; + +static sd_devsw_installed = 0; + +static void sd_drvinit(void *unused) +{ + dev_t dev; + dev_t dev_chr; + + if( ! sd_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&sd_cdevsw,NULL); + dev_chr = dev; + dev = makedev(BDEV_MAJOR,0); + bdevsw_add(&dev,&sd_bdevsw,NULL); + sd_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*/ + "/", "rsd", major(dev_chr), 0, DV_CHR, 0, 0, 0600); + x=devfs_add_devsw( + "/", "sd", major(dev), 0, DV_BLK, 0, 0, 0600); + } + } +#endif +} + +SYSINIT(sddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,sd_drvinit,NULL) + +#endif /* JREMOD */ + diff --git a/sys/scsi/ssc.c b/sys/scsi/ssc.c index 442e12b..43a7adb 100644 --- a/sys/scsi/ssc.c +++ b/sys/scsi/ssc.c @@ -49,7 +49,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. *End copyright - * $Id: ssc.c,v 1.3 1995/05/03 18:09:18 dufault Exp $ + * $Id: ssc.c,v 1.4 1995/11/04 11:12:41 bde Exp $ */ #include <sys/types.h> @@ -63,6 +63,14 @@ #include <sys/buf.h> #include <sys/systm.h> +#ifdef JREMOD +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ +#define CDEV_MAJOR 49 +#endif /*JREMOD*/ + static dev_t sscdev = NODEV; int sscopen(dev_t dev, int flag, int type, struct proc *p) @@ -116,3 +124,43 @@ void sscstrategy(struct buf *bp) { } int sscread(dev_t dev, struct uio *uio, int ioflag) { return ENXIO; } int sscwrite(dev_t dev, struct uio *uio, int ioflag) { return ENXIO; } int sscselect(dev_t dev, int which, struct proc *p) { return ENXIO; } + + +#ifdef JREMOD +struct cdevsw ssc_cdevsw = + { sscopen, sscclose, sscread, sscwrite, /*49*/ + sscioctl, nostop, nullreset, nodevtotty,/* scsi super */ + sscselect, nxmmap, sscstrategy }; + +static ssc_devsw_installed = 0; + +static void ssc_drvinit(void *unused) +{ + dev_t dev; + dev_t dev_chr; + + if( ! ssc_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&ssc_cdevsw,NULL); + dev_chr = dev; +#if defined(BDEV_MAJOR) + dev = makedev(BDEV_MAJOR,0); + bdevsw_add(&dev,&ssc_bdevsw,NULL); +#endif /*BDEV_MAJOR*/ + ssc_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*/ + "/", "ssc", major(dev_chr), 0, DV_CHR, 0, 0, 0600); + } + } +#endif +} + +SYSINIT(sscdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,ssc_drvinit,NULL) + +#endif /* JREMOD */ + diff --git a/sys/scsi/st.c b/sys/scsi/st.c index c872545..6c7db23 100644 --- a/sys/scsi/st.c +++ b/sys/scsi/st.c @@ -12,7 +12,7 @@ * on the understanding that TFS is not responsible for the correct * functioning of this software in any circumstances. * - * $Id: st.c,v 1.43 1995/11/19 22:22:32 dyson Exp $ + * $Id: st.c,v 1.44 1995/11/20 12:42:34 phk Exp $ */ /* @@ -46,7 +46,16 @@ #include <scsi/scsiconf.h> #include <sys/devconf.h> -u_int32 ststrats, stqueues; +#ifdef JREMOD +#include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ +#define CDEV_MAJOR 14 +#define BDEV_MAJOR 5 +#endif /*JREMOD */ + /* Defines for device specific stuff */ #define PAGE_0_SENSE_DATA_SIZE 12 @@ -595,7 +604,7 @@ errval st_close(dev_t dev, int flag, int fmt, struct proc *p, struct scsi_link *sc_link) { - unsigned char unit, mode; + u_int32 unit, mode; struct scsi_data *st; unit = STUNIT(dev); @@ -897,12 +906,11 @@ done: void st_strategy(struct buf *bp, struct scsi_link *sc_link) { - unsigned char unit; /* XXX Everywhere else unit is "u_int32". Please int? */ + u_int32 unit; u_int32 opri; struct scsi_data *st; int len; - ststrats++; unit = STUNIT((bp->b_dev)); st = sc_link->sd; /* @@ -1110,7 +1118,6 @@ ststart(unit, flags) 100000, bp, flags) == SUCCESSFULLY_QUEUED) { - stqueues++; } else { badnews: printf("st%ld: oops not queued\n", unit); @@ -1130,7 +1137,7 @@ st_ioctl(dev_t dev, int cmd, caddr_t arg, int flag, struct proc *p, struct scsi_link *sc_link) { errval errcode = 0; - unsigned char unit; + u_int32 unit; u_int32 number, flags, dsty; struct scsi_data *st; u_int32 hold_blksiz; @@ -2070,3 +2077,44 @@ bad: free(buf, M_TEMP); free(buf, M_TEMP); return 0; } + +#ifdef JREMOD +struct bdevsw st_bdevsw = + { stopen, stclose, ststrategy, stioctl, /*5*/ + nxdump, zerosize, 0 }; + +struct cdevsw st_cdevsw = + { stopen, stclose, rawread, rawwrite, /*14*/ + stioctl, nostop, nullreset, nodevtotty,/* st */ + seltrue, nommap, ststrategy }; + +static st_devsw_installed = 0; + +static void st_drvinit(void *unused) +{ + dev_t dev; + dev_t dev_chr; + + if( ! st_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&st_cdevsw,NULL); + dev_chr = dev; + dev = makedev(BDEV_MAJOR,0); + bdevsw_add(&dev,&st_bdevsw,NULL); + st_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*/ + "/", "rst", major(dev_chr), 0, DV_CHR, 0, 0, 0600); + } + } +#endif +} + +SYSINIT(stdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,st_drvinit,NULL) + +#endif /* JREMOD */ + diff --git a/sys/scsi/su.c b/sys/scsi/su.c index 71f21bb..8b9d9c6 100644 --- a/sys/scsi/su.c +++ b/sys/scsi/su.c @@ -44,7 +44,7 @@ * SUCH DAMAGE. *End copyright * - * $Id: su.c,v 1.5 1995/05/03 18:09:20 dufault Exp $ + * $Id: su.c,v 1.6 1995/11/06 00:36:08 bde Exp $ * * Tabstops 4 */ @@ -58,6 +58,14 @@ #include <sys/buf.h> #include <sys/systm.h> +#ifdef JREMOD +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ +#define CDEV_MAJOR 18 +#endif /*JREMOD*/ + /* Build an old style device number (unit encoded in the minor number) * from a base old one (no flag bits) and a full new one * (BUS, LUN, TARG in the minor number, and flag bits). @@ -278,3 +286,36 @@ int suselect(dev_t dev, int which, struct proc *p) return (*cdev->d_select)(base, which, p); } + +#ifdef JREMOD +struct cdevsw su_cdevsw = + { suopen, suclose, suread, suwrite, /*18*/ + suioctl, nostop, nullreset, nodevtotty,/* scsi */ + suselect, nxmmap, sustrategy }; /* 'generic' */ + +static su_devsw_installed = 0; + +static void su_drvinit(void *unused) +{ + dev_t dev; + + if( ! su_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&su_cdevsw,NULL); + su_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*/ + "/", "su", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif +} + +SYSINIT(sudev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,su_drvinit,NULL) + +#endif /* JREMOD */ + diff --git a/sys/scsi/uk.c b/sys/scsi/uk.c index 0518612..ab1e6e1 100644 --- a/sys/scsi/uk.c +++ b/sys/scsi/uk.c @@ -2,7 +2,7 @@ * Driver for a device we can't identify. * by Julian Elischer (julian@tfs.com) * - * $Id: uk.c,v 1.8 1995/03/04 20:51:08 dufault Exp $ + * $Id: uk.c,v 1.9 1995/05/30 08:13:56 rgrimes Exp $ * * If you find that you are adding any code to this file look closely * at putting it in "scsi_driver.c" instead. @@ -11,6 +11,15 @@ #include <sys/param.h> #include <scsi/scsi_all.h> #include <scsi/scsiconf.h> +#ifdef JREMOD +#include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ +#define CDEV_MAJOR 31 +#endif /*JREMOD*/ + SCSI_DEVICE_ENTRIES(uk) @@ -36,3 +45,36 @@ struct scsi_device uk_switch = 0, 0, }; + +#ifdef JREMOD +struct cdevsw uk_cdevsw = + { ukopen, ukclose, noread, nowrite, /*31*/ + ukioctl, nostop, nullreset, nodevtotty,/* unknown */ + seltrue, nommap, NULL }; /* scsi */ + +static uk_devsw_installed = 0; + +static void uk_drvinit(void *unused) +{ + dev_t dev; + + if( ! uk_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&uk_cdevsw,NULL); + uk_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*/ + "/", "uk", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif +} + +SYSINIT(ukdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,uk_drvinit,NULL) + +#endif /* JREMOD */ + diff --git a/sys/scsi/worm.c b/sys/scsi/worm.c index ef8c983..c0c0afb 100644 --- a/sys/scsi/worm.c +++ b/sys/scsi/worm.c @@ -37,7 +37,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: worm.c,v 1.9 1995/10/21 23:13:11 phk Exp $ + * $Id: worm.c,v 1.10 1995/11/19 22:22:35 dyson Exp $ */ /* XXX This is PRELIMINARY. @@ -59,6 +59,16 @@ #include <scsi/scsiconf.h> #include <scsi/scsi_disk.h> +#ifdef JREMOD +#include <sys/conf.h> +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ +#define CDEV_MAJOR 62 +#endif /*JREMOD*/ + + struct scsi_data { struct buf_queue_head buf_queue; u_int32 n_blks; /* Number of blocks (0 for bogus) */ @@ -359,3 +369,36 @@ worm_close(dev_t dev, int flag, int fmt, struct proc *p, return 0; } + +#ifdef JREMOD +struct cdevsw worm_cdevsw = + { wormopen, wormclose, rawread, rawwrite, /*62*/ + wormioctl, nostop, nullreset, nodevtotty,/* worm */ + seltrue, nommap, wormstrategy }; + +static worm_devsw_installed = 0; + +static void worm_drvinit(void *unused) +{ + dev_t dev; + + if( ! worm_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&worm_cdevsw,NULL); + worm_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*/ + "/", "rworm", major(dev), 0, DV_CHR, 0, 0, 0600); + } + } +#endif +} + +SYSINIT(wormdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,worm_drvinit,NULL) + +#endif /* JREMOD */ + diff --git a/sys/sys/devfsext.h b/sys/sys/devfsext.h index 468c9f6..3e33f76 100644 --- a/sys/sys/devfsext.h +++ b/sys/sys/devfsext.h @@ -1,11 +1,21 @@ /* usual BSD style copyright here */ /* Written by Julian Elischer (julian@dialix.oz.au)*/ /* - * $Id:$ + * $Id: devfsext.h,v 1.2 1995/09/08 04:46:04 julian Exp $ */ #ifndef _SYS_DEVFSECT_H_ #define _SYS_DEVFSECT_H_ 1 +void *devfs_add_devsw(char *path, + char *name, + int major, + int minor, + int chrblk, + uid_t uid, + gid_t gid, + int perms) ; + +/* deprecated.. don't use.. */ void *dev_add(char *path, char *name, void *funct, diff --git a/sys/sys/kernel.h b/sys/sys/kernel.h index 05e7548..71b78cb 100644 --- a/sys/sys/kernel.h +++ b/sys/sys/kernel.h @@ -39,7 +39,7 @@ * SUCH DAMAGE. * * @(#)kernel.h 8.3 (Berkeley) 1/21/94 - * $Id: kernel.h,v 1.15 1995/11/14 07:35:56 bde Exp $ + * $Id: kernel.h,v 1.16 1995/11/20 12:08:08 phk Exp $ */ #ifndef _SYS_KERNEL_H_ @@ -121,6 +121,7 @@ enum sysinit_sub_id { SI_SUB_KMEM = 0x18000000, /* kernel memory*/ SI_SUB_CPU = 0x20000000, /* CPU resource(s)*/ SI_SUB_DEVFS = 0x22000000, /* get DEVFS ready */ + SI_SUB_DRIVERS = 0x23000000, /* Let Drivers initialise */ SI_SUB_CONFIGURE = 0x24000000, /* Configure devices */ SI_SUB_INTRINSIC = 0x28000000, /* proc 0*/ SI_SUB_RUN_QUEUE = 0x30000000, /* the run queue*/ @@ -158,6 +159,7 @@ enum sysinit_elem_order { SI_ORDER_FIRST = 0x00000000, /* first*/ SI_ORDER_SECOND = 0x00000001, /* second*/ SI_ORDER_THIRD = 0x00000002, /* third*/ + SI_ORDER_MIDDLE = 0x10000000, /* somewhere in the middle */ SI_ORDER_ANY = 0xffffffff /* last*/ }; diff --git a/sys/vm/vm_swap.c b/sys/vm/vm_swap.c index ea3bc9d..91c12da 100644 --- a/sys/vm/vm_swap.c +++ b/sys/vm/vm_swap.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)vm_swap.c 8.5 (Berkeley) 2/17/94 - * $Id: vm_swap.c,v 1.24 1995/11/12 06:43:26 bde Exp $ + * $Id: vm_swap.c,v 1.25 1995/11/20 12:19:14 phk Exp $ */ #include <sys/param.h> @@ -50,6 +50,15 @@ #include <miscfs/specfs/specdev.h> +#ifdef JREMOD +#include <sys/kernel.h> +#ifdef DEVFS +#include <sys/devfsext.h> +#endif /*DEVFS*/ +#define CDEV_MAJOR 4 +#define BDEV_MAJOR 1 +#endif /*JREMOD */ + /* * Indirect driver for multi-controller paging. */ @@ -252,3 +261,46 @@ swaponvp(p, vp, dev, nblks) return (0); } + +#ifdef JREMOD +struct bdevsw sw_bdevsw = + { noopen, noclose, swstrategy, noioc, /*1*/ + nodump, zerosize, 0 }; + +struct cdevsw sw_cdevsw = + { nullopen, nullclose, rawread, rawwrite, /*4*/ + noioc, nostop, noreset, nodevtotty,/* swap */ + noselect, nommap, swstrategy }; + +static sw_devsw_installed = 0; + +static void sw_drvinit(void *unused) +{ + dev_t dev; + dev_t dev_chr; + + if( ! sw_devsw_installed ) { + dev = makedev(CDEV_MAJOR,0); + cdevsw_add(&dev,&sw_cdevsw,NULL); + dev_chr = dev; + dev = makedev(BDEV_MAJOR,0); + bdevsw_add(&dev,&sw_bdevsw,NULL); + sw_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*/ + "/", "rsw", major(dev_chr), 0, DV_CHR, 0, 0, 0600); + x=devfs_add_devsw( + "/", "sw", major(dev), 0, DV_BLK, 0, 0, 0600); + } + } +#endif +} + +SYSINIT(swdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,sw_drvinit,NULL) + +#endif /* JREMOD */ + |