summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/alpha/alpha/cons.c15
-rw-r--r--sys/alpha/alpha/mem.c15
-rw-r--r--sys/amd64/amd64/autoconf.c12
-rw-r--r--sys/amd64/amd64/mem.c7
-rw-r--r--sys/cam/cam_xpt.c7
-rw-r--r--sys/cam/scsi/scsi_cd.c4
-rw-r--r--sys/cam/scsi/scsi_ch.c7
-rw-r--r--sys/cam/scsi/scsi_da.c4
-rw-r--r--sys/cam/scsi/scsi_pass.c7
-rw-r--r--sys/cam/scsi/scsi_pt.c7
-rw-r--r--sys/cam/scsi/scsi_sa.c4
-rw-r--r--sys/cam/scsi/scsi_target.c6
-rw-r--r--sys/coda/coda_fbsd.c8
-rw-r--r--sys/coda/coda_vfsops.c9
-rw-r--r--sys/dev/ata/ata-disk.c10
-rw-r--r--sys/dev/ata/atapi-cd.c4
-rw-r--r--sys/dev/ata/atapi-fd.c4
-rw-r--r--sys/dev/ata/atapi-tape.c6
-rw-r--r--sys/dev/bktr/bktr_core.c29
-rw-r--r--sys/dev/cy/cy.c6
-rw-r--r--sys/dev/cy/cy_isa.c6
-rw-r--r--sys/dev/dgb/dgb.c22
-rw-r--r--sys/dev/dgb/dgm.c23
-rw-r--r--sys/dev/dpt/dpt_control.c9
-rw-r--r--sys/dev/fb/fb.c6
-rw-r--r--sys/dev/iicbus/iic.c22
-rw-r--r--sys/dev/joy/joy.c20
-rw-r--r--sys/dev/kbd/kbd.c6
-rw-r--r--sys/dev/mcd/mcd.c21
-rw-r--r--sys/dev/mse/mse.c21
-rw-r--r--sys/dev/pccard/if_xe.c8
-rw-r--r--sys/dev/pci/pci.c7
-rw-r--r--sys/dev/ppbus/lpt.c22
-rw-r--r--sys/dev/ppbus/ppi.c21
-rw-r--r--sys/dev/ppbus/pps.c9
-rw-r--r--sys/dev/rc/rc.c20
-rw-r--r--sys/dev/rp/rp.c10
-rw-r--r--sys/dev/scd/scd.c21
-rw-r--r--sys/dev/si/si.c9
-rw-r--r--sys/dev/smbus/smb.c22
-rw-r--r--sys/dev/snp/snp.c8
-rw-r--r--sys/dev/speaker/spkr.c18
-rw-r--r--sys/dev/streams/streams.c13
-rw-r--r--sys/dev/syscons/syscons.c5
-rw-r--r--sys/dev/usb/usbdi.c6
-rw-r--r--sys/dev/xe/if_xe.c8
-rw-r--r--sys/fs/cd9660/cd9660_vfsops.c5
-rw-r--r--sys/fs/coda/coda_fbsd.c8
-rw-r--r--sys/fs/coda/coda_vfsops.c9
-rw-r--r--sys/fs/fdescfs/fdesc_vnops.c4
-rw-r--r--sys/fs/msdosfs/msdosfs_vfsops.c5
-rw-r--r--sys/fs/ntfs/ntfs_vfsops.c4
-rw-r--r--sys/fs/specfs/spec_vnops.c6
-rw-r--r--sys/gnu/ext2fs/ext2_vfsops.c3
-rw-r--r--sys/gnu/fs/ext2fs/ext2_vfsops.c3
-rw-r--r--sys/gnu/i386/isa/dgb.c22
-rw-r--r--sys/gnu/i386/isa/dgm.c23
-rw-r--r--sys/i386/i386/autoconf.c12
-rw-r--r--sys/i386/i386/cons.c6
-rw-r--r--sys/i386/i386/mem.c7
-rw-r--r--sys/i386/isa/asc.c24
-rw-r--r--sys/i386/isa/atapi-cd.c9
-rw-r--r--sys/i386/isa/ctx.c24
-rw-r--r--sys/i386/isa/cx.c7
-rw-r--r--sys/i386/isa/cy.c6
-rw-r--r--sys/i386/isa/gpib.c21
-rw-r--r--sys/i386/isa/gsc.c22
-rw-r--r--sys/i386/isa/ida.c4
-rw-r--r--sys/i386/isa/istallion.c21
-rw-r--r--sys/i386/isa/joy.c20
-rw-r--r--sys/i386/isa/labpc.c19
-rw-r--r--sys/i386/isa/loran.c24
-rw-r--r--sys/i386/isa/matcd/matcd.c21
-rw-r--r--sys/i386/isa/mcd.c21
-rw-r--r--sys/i386/isa/mse.c21
-rw-r--r--sys/i386/isa/pcaudio.c18
-rw-r--r--sys/i386/isa/pcvt/pcvt_drv.c6
-rw-r--r--sys/i386/isa/rc.c20
-rw-r--r--sys/i386/isa/rp.c10
-rw-r--r--sys/i386/isa/scd.c21
-rw-r--r--sys/i386/isa/si.c9
-rw-r--r--sys/i386/isa/snd/sound.c4
-rw-r--r--sys/i386/isa/sound/soundcard.c7
-rw-r--r--sys/i386/isa/spigot.c21
-rw-r--r--sys/i386/isa/spkr.c18
-rw-r--r--sys/i386/isa/stallion.c9
-rw-r--r--sys/i386/isa/tw.c20
-rw-r--r--sys/i386/isa/wd.c13
-rw-r--r--sys/i386/isa/wd_cd.c9
-rw-r--r--sys/i386/isa/wfd.c10
-rw-r--r--sys/i386/isa/wst.c12
-rw-r--r--sys/i386/isa/wt.c25
-rw-r--r--sys/isa/joy.c20
-rw-r--r--sys/isofs/cd9660/cd9660_vfsops.c5
-rw-r--r--sys/kern/kern_conf.c98
-rw-r--r--sys/kern/kern_descrip.c6
-rw-r--r--sys/kern/subr_log.c6
-rw-r--r--sys/kern/tty_cons.c6
-rw-r--r--sys/kern/tty_pty.c9
-rw-r--r--sys/kern/tty_snoop.c8
-rw-r--r--sys/kern/tty_tty.c6
-rw-r--r--sys/kern/vfs_export.c16
-rw-r--r--sys/kern/vfs_subr.c16
-rw-r--r--sys/miscfs/fdesc/fdesc_vnops.c4
-rw-r--r--sys/miscfs/kernfs/kernfs_vfsops.c17
-rw-r--r--sys/miscfs/specfs/spec_vnops.c6
-rw-r--r--sys/msdosfs/msdosfs_vfsops.c5
-rw-r--r--sys/net/bpf.c6
-rw-r--r--sys/net/if_tun.c4
-rw-r--r--sys/netinet/mlf_ipl.c4
-rw-r--r--sys/ntfs/ntfs_vfsops.c4
-rw-r--r--sys/pc98/pc98/lpt.c6
-rw-r--r--sys/pc98/pc98/mse.c6
-rw-r--r--sys/pc98/pc98/pcaudio.c6
-rw-r--r--sys/pc98/pc98/spkr.c6
-rw-r--r--sys/pc98/pc98/syscons.c4
-rw-r--r--sys/pc98/pc98/wd.c4
-rw-r--r--sys/pc98/pc98/wd_cd.c9
-rw-r--r--sys/pc98/pc98/wfd.c10
-rw-r--r--sys/pc98/pc98/wst.c12
-rw-r--r--sys/pccard/pccard.c18
-rw-r--r--sys/pci/brooktree848.c29
-rw-r--r--sys/pci/meteor.c22
-rw-r--r--sys/pci/pci.c7
-rw-r--r--sys/pci/xrpu.c9
-rw-r--r--sys/sys/conf.h43
-rw-r--r--sys/sys/linedisc.h43
-rw-r--r--sys/sys/param.h4
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c5
-rw-r--r--sys/vm/vm_swap.c6
130 files changed, 442 insertions, 1200 deletions
diff --git a/sys/alpha/alpha/cons.c b/sys/alpha/alpha/cons.c
index 1cb7ac2..16f6933 100644
--- a/sys/alpha/alpha/cons.c
+++ b/sys/alpha/alpha/cons.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
- * $Id: cons.c,v 1.7 1999/05/15 18:14:03 dfr Exp $
+ * $Id: cons.c,v 1.8 1999/05/30 16:50:40 phk Exp $
*/
#include "opt_devfs.h"
@@ -444,23 +444,16 @@ cnputc(c)
}
}
-static int cn_devsw_installed = 0;
-
static void
cn_drvinit(void *unused)
{
dev_t dev;
- if( ! cn_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&cn_cdevsw,NULL);
- cn_devsw_installed = 1;
+ cdevsw_add(&dev);
#ifdef DEVFS
- cn_devfs_token = devfs_add_devswf(&cn_cdevsw, 0, DV_CHR,
- UID_ROOT, GID_WHEEL, 0600,
- "console");
+ cn_devfs_token = devfs_add_devswf(&cn_cdevsw, 0, DV_CHR,
+ UID_ROOT, GID_WHEEL, 0600, "console");
#endif
- }
}
SYSINIT(cndev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cn_drvinit,NULL)
diff --git a/sys/alpha/alpha/mem.c b/sys/alpha/alpha/mem.c
index c266810..22f9d11 100644
--- a/sys/alpha/alpha/mem.c
+++ b/sys/alpha/alpha/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.8 1999/05/29 19:47:51 gallatin Exp $
+ * $Id: mem.c,v 1.9 1999/05/30 16:50:43 phk Exp $
*/
/*
@@ -445,23 +445,14 @@ iszerodev(dev)
&& (minor(dev) == 0x02600000)));
}
-
-
-static int mem_devsw_installed;
-
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;
+ cdevsw_add(&mem_cdevsw);
#ifdef DEVFS
- memdevfs_init();
+ memdevfs_init();
#endif
- }
}
SYSINIT(memdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,mem_drvinit,NULL)
diff --git a/sys/amd64/amd64/autoconf.c b/sys/amd64/amd64/autoconf.c
index 0dcad73..9175d60 100644
--- a/sys/amd64/amd64/autoconf.c
+++ b/sys/amd64/amd64/autoconf.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
- * $Id: autoconf.c,v 1.122 1999/05/12 07:40:50 phk Exp $
+ * $Id: autoconf.c,v 1.123 1999/05/24 00:30:49 jb Exp $
*/
/*
@@ -156,7 +156,7 @@ find_cdrom_root()
orootdev = rootdev;
for (i = 0 ; i < 2; i++)
for (j = 0 ; try_cdrom[j].name ; j++) {
- if (try_cdrom[j].major >= nblkdev)
+ if (try_cdrom[j].major >= NUMCDEVSW)
continue;
rootdev = makedev(try_cdrom[j].major, i * 8);
bd = bdevsw(rootdev);
@@ -382,7 +382,7 @@ setdumpdev(dev)
return (0);
}
maj = major(dev);
- if (maj >= nblkdev || bdevsw(dev) == NULL)
+ if (bdevsw(dev) == NULL)
return (ENXIO); /* XXX is this right? */
if (bdevsw(dev)->d_psize == NULL)
return (ENXIO); /* XXX should be ENODEV ? */
@@ -435,7 +435,7 @@ setroot()
return;
majdev = B_TYPE(bootdev);
dev = makedev(majdev, 0);
- if (majdev >= nblkdev || bdevsw(dev) == NULL)
+ if (bdevsw(dev) == NULL)
return;
unit = B_UNIT(bootdev);
slice = B_SLICE(bootdev);
@@ -523,7 +523,7 @@ setrootbyname(char *name)
}
unit = *cp - '0';
*cp++ = '\0';
- for (bd = 0; bd < nblkdev; bd++) {
+ for (bd = 0; bd < NUMCDEVSW; bd++) {
dev = makedev(bd, 0);
if (bdevsw(dev) != NULL &&
strcmp(bdevsw(dev)->d_name, name) == 0)
@@ -566,7 +566,7 @@ setconf()
return;
printf("use one of:\n");
- for (i = 0; i < nblkdev; i++) {
+ for (i = 0; i < NUMCDEVSW; i++) {
dev = makedev(i, 0);
if (bdevsw(dev) != NULL)
printf(" %s", bdevsw(dev)->d_name);
diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c
index 20a7820..02827d0 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.61 1999/05/11 19:54:06 phk Exp $
+ * $Id: mem.c,v 1.62 1999/05/30 16:52:04 phk Exp $
*/
/*
@@ -668,7 +668,6 @@ static int mem_devsw_installed;
static void
mem_drvinit(void *unused)
{
- dev_t dev;
/* Initialise memory range handling */
if (mem_range_softc.mr_op != NULL)
@@ -676,9 +675,7 @@ mem_drvinit(void *unused)
/* device registration */
if( ! mem_devsw_installed ) {
-
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&mem_cdevsw, NULL);
+ cdevsw_add(&mem_cdevsw);
mem_devsw_installed = 1;
#ifdef DEVFS
memdevfs_init();
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index 2ae2b3f..be9d717 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: cam_xpt.c,v 1.61 1999/05/25 20:17:29 gibbs Exp $
+ * $Id: cam_xpt.c,v 1.62 1999/05/30 16:50:57 phk Exp $
*/
#include <sys/param.h>
#include <sys/systm.h>
@@ -825,10 +825,7 @@ dev_allocq_is_runnable(struct cam_devq *devq)
static void
xpt_periph_init()
{
- dev_t dev;
-
- dev = makedev(XPT_CDEV_MAJOR, 0);
- cdevsw_add(&dev, &xpt_cdevsw, NULL);
+ cdevsw_add(&xpt_cdevsw);
}
static void
diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c
index 730d97f..fe353e4 100644
--- a/sys/cam/scsi/scsi_cd.c
+++ b/sys/cam/scsi/scsi_cd.c
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: scsi_cd.c,v 1.21 1999/05/22 22:00:18 gibbs Exp $
+ * $Id: scsi_cd.c,v 1.22 1999/05/30 16:51:00 phk Exp $
*/
/*
* Portions of this driver taken from the original FreeBSD cd driver.
@@ -346,7 +346,7 @@ cdinit(void)
"due to status 0x%x!\n", status);
} else {
/* If we were successfull, register our devsw */
- cdevsw_add_generic(CD_BDEV_MAJOR, CD_CDEV_MAJOR, &cd_cdevsw);
+ cdevsw_add(&cd_cdevsw);
}
}
diff --git a/sys/cam/scsi/scsi_ch.c b/sys/cam/scsi/scsi_ch.c
index 6fd7aee..146002f 100644
--- a/sys/cam/scsi/scsi_ch.c
+++ b/sys/cam/scsi/scsi_ch.c
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: scsi_ch.c,v 1.12 1999/05/22 22:00:19 gibbs Exp $
+ * $Id: scsi_ch.c,v 1.13 1999/05/30 16:51:01 phk Exp $
*/
/*
* Derived from the NetBSD SCSI changer driver.
@@ -277,11 +277,8 @@ chinit(void)
printf("ch: Failed to attach master async callback "
"due to status 0x%x!\n", status);
} else {
- dev_t dev;
-
/* If we were successfull, register our devsw */
- dev = makedev(CH_CDEV_MAJOR, 0);
- cdevsw_add(&dev, &ch_cdevsw, NULL);
+ cdevsw_add(&ch_cdevsw);
}
}
diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c
index 598a054..a8b8541 100644
--- a/sys/cam/scsi/scsi_da.c
+++ b/sys/cam/scsi/scsi_da.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: scsi_da.c,v 1.25 1999/05/22 22:00:20 gibbs Exp $
+ * $Id: scsi_da.c,v 1.26 1999/05/30 16:51:02 phk Exp $
*/
#include "opt_hw_wdog.h"
@@ -821,7 +821,7 @@ dainit(void)
int err;
/* If we were successfull, register our devsw */
- cdevsw_add_generic(DA_BDEV_MAJOR, DA_CDEV_MAJOR, &da_cdevsw);
+ cdevsw_add(&da_cdevsw);
/*
* Schedule a periodic event to occasioanly send an
diff --git a/sys/cam/scsi/scsi_pass.c b/sys/cam/scsi/scsi_pass.c
index a350c8e..c68fb98 100644
--- a/sys/cam/scsi/scsi_pass.c
+++ b/sys/cam/scsi/scsi_pass.c
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: scsi_pass.c,v 1.10 1999/05/22 22:00:21 gibbs Exp $
+ * $Id: scsi_pass.c,v 1.11 1999/05/30 16:51:03 phk Exp $
*/
#include <sys/param.h>
@@ -184,11 +184,8 @@ passinit(void)
printf("pass: Failed to attach master async callback "
"due to status 0x%x!\n", status);
} else {
- dev_t dev;
-
/* If we were successfull, register our devsw */
- dev = makedev(PASS_CDEV_MAJOR, 0);
- cdevsw_add(&dev, &pass_cdevsw, NULL);
+ cdevsw_add(&pass_cdevsw);
}
}
diff --git a/sys/cam/scsi/scsi_pt.c b/sys/cam/scsi/scsi_pt.c
index 3041591..e015c36 100644
--- a/sys/cam/scsi/scsi_pt.c
+++ b/sys/cam/scsi/scsi_pt.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: scsi_pt.c,v 1.8 1999/05/22 22:00:22 gibbs Exp $
+ * $Id: scsi_pt.c,v 1.9 1999/05/30 16:51:05 phk Exp $
*/
#include <sys/param.h>
@@ -304,10 +304,7 @@ ptinit(void)
"due to status 0x%x!\n", status);
} else {
/* If we were successfull, register our devsw */
- dev_t dev;
-
- dev = makedev(PT_CDEV_MAJOR, 0);
- cdevsw_add(&dev,&pt_cdevsw, NULL);
+ cdevsw_add(&pt_cdevsw);
}
}
diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c
index 1761055..5e70261 100644
--- a/sys/cam/scsi/scsi_sa.c
+++ b/sys/cam/scsi/scsi_sa.c
@@ -1,5 +1,5 @@
/*
- * $Id: scsi_sa.c,v 1.26 1999/05/25 23:10:54 mjacob Exp $
+ * $Id: scsi_sa.c,v 1.27 1999/05/30 16:51:07 phk Exp $
*
* Implementation of SCSI Sequential Access Peripheral driver for CAM.
*
@@ -1148,7 +1148,7 @@ sainit(void)
"due to status 0x%x!\n", status);
} else {
/* If we were successfull, register our devsw */
- cdevsw_add_generic(SA_BDEV_MAJOR, SA_CDEV_MAJOR, &sa_cdevsw);
+ cdevsw_add(&sa_cdevsw);
}
}
diff --git a/sys/cam/scsi/scsi_target.c b/sys/cam/scsi/scsi_target.c
index 302e23f..63d9519 100644
--- a/sys/cam/scsi/scsi_target.c
+++ b/sys/cam/scsi/scsi_target.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: scsi_target.c,v 1.12 1999/05/22 22:00:24 gibbs Exp $
+ * $Id: scsi_target.c,v 1.13 1999/05/30 16:51:07 phk Exp $
*/
#include <stddef.h> /* For offsetof */
@@ -196,7 +196,6 @@ static struct extend_array *targperiphs;
static void
targinit(void)
{
- dev_t dev;
/*
* Create our extend array for storing the devices we attach to.
@@ -208,8 +207,7 @@ targinit(void)
}
/* If we were successfull, register our devsw */
- dev = makedev(TARG_CDEV_MAJOR, 0);
- cdevsw_add(&dev,&targ_cdevsw, NULL);
+ cdevsw_add(&targ_cdevsw);
}
static void
diff --git a/sys/coda/coda_fbsd.c b/sys/coda/coda_fbsd.c
index 49bba22..9c349f8 100644
--- a/sys/coda/coda_fbsd.c
+++ b/sys/coda/coda_fbsd.c
@@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance.
*
* @(#) src/sys/coda/coda_fbsd.cr,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- * $Id: coda_fbsd.c,v 1.13 1999/01/28 00:57:46 dillon Exp $
+ * $Id: coda_fbsd.c,v 1.14 1999/05/30 16:51:10 phk Exp $
*
*/
@@ -101,7 +101,6 @@ int vcdebug = 1;
static int
codadev_modevent(module_t mod, int type, void *data)
{
- dev_t dev;
#ifdef DEVFS
int i;
#endif
@@ -109,8 +108,7 @@ codadev_modevent(module_t mod, int type, void *data)
switch (type) {
case MOD_LOAD:
- dev = makedev(VC_DEV_NO, 0);
- cdevsw_add(&dev,&codadevsw, &oldcdevsw);
+ cdevsw_add(&codadevsw);
#ifdef DEVFS
/* tmp */
#undef NVCODA
@@ -134,7 +132,7 @@ codadev_modevent(module_t mod, int type, void *data)
devfs_remove_dev(coda_devfs_token[i]);
}
#endif
- cdevsw_add(&dev, oldcdevsw, NULL);
+ cdevsw_add(oldcdevsw);
break;
default:
break;
diff --git a/sys/coda/coda_vfsops.c b/sys/coda/coda_vfsops.c
index dfb4e0e..50245d0 100644
--- a/sys/coda/coda_vfsops.c
+++ b/sys/coda/coda_vfsops.c
@@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance.
*
* @(#) src/sys/cfs/coda_vfsops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- * $Id: coda_vfsops.c,v 1.12 1999/05/08 06:39:04 phk Exp $
+ * $Id: coda_vfsops.c,v 1.13 1999/05/09 13:11:37 phk Exp $
*
*/
@@ -47,6 +47,9 @@
/*
* HISTORY
* $Log: coda_vfsops.c,v $
+ * Revision 1.13 1999/05/09 13:11:37 phk
+ * remove cast from dev_t to dev_t.
+ *
* Revision 1.12 1999/05/08 06:39:04 phk
* I got tired of seeing all the cdevsw[major(foo)] all over the place.
*
@@ -341,10 +344,6 @@ coda_mount(vfsp, path, data, ndp, p)
}
dev = dvp->v_specinfo->si_rdev;
vrele(dvp);
- if (major(dev) >= nchrdev || major(dev) < 0) {
- MARK_INT_FAIL(CODA_MOUNT_STATS);
- return(ENXIO);
- }
/*
* See if the device table matches our expectations.
diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c
index b46f770..bc5eeee 100644
--- a/sys/dev/ata/ata-disk.c
+++ b/sys/dev/ata/ata-disk.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: ata-disk.c,v 1.11 1999/05/17 15:58:45 sos Exp $
+ * $Id: ata-disk.c,v 1.12 1999/05/30 16:51:12 phk Exp $
*/
#include "ata.h"
@@ -88,6 +88,7 @@ static struct cdevsw ad_cdevsw = {
/* maxio */ 0,
/* bmaj */ BDEV_MAJOR,
};
+static struct cdevsw fakewd_cdevsw;
/* misc defines */
#define UNIT(dev) (minor(dev)>>3 & 0x1f) /* assume 8 minor # per unit */
@@ -663,8 +664,11 @@ ad_drvinit(void)
static int32_t ad_devsw_installed = 0;
if (!ad_devsw_installed) {
- cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &ad_cdevsw);
- cdevsw_add_generic(0, 3, &ad_cdevsw); /* grap wd entries too */
+ cdevsw_add(&ad_cdevsw);
+ fakewd_cdevsw = ad_cdevsw;
+ fakewd_cdevsw.d_maj = 3;
+ fakewd_cdevsw.d_bmaj = 0;
+ cdevsw_add(&fakewd_cdevsw); /* grap wd entries too */
ad_devsw_installed = 1;
}
/* register callback for when interrupts are enabled */
diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c
index aaec644..200b648 100644
--- a/sys/dev/ata/atapi-cd.c
+++ b/sys/dev/ata/atapi-cd.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: atapi-cd.c,v 1.8 1999/05/17 15:58:46 sos Exp $
+ * $Id: atapi-cd.c,v 1.9 1999/05/30 16:51:14 phk Exp $
*/
#include "ata.h"
@@ -1426,7 +1426,7 @@ acd_drvinit(void *unused)
static int32_t acd_devsw_installed = 0;
if (!acd_devsw_installed) {
- cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &acd_cdevsw);
+ cdevsw_add(&acd_cdevsw);
acd_devsw_installed = 1;
}
}
diff --git a/sys/dev/ata/atapi-fd.c b/sys/dev/ata/atapi-fd.c
index d63a039..e89d636 100644
--- a/sys/dev/ata/atapi-fd.c
+++ b/sys/dev/ata/atapi-fd.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: atapi-fd.c,v 1.8 1999/05/20 09:12:05 sos Exp $
+ * $Id: atapi-fd.c,v 1.9 1999/05/30 16:51:15 phk Exp $
*/
#include "ata.h"
@@ -482,7 +482,7 @@ afd_drvinit(void *unused)
static int32_t afd_devsw_installed = 0;
if (!afd_devsw_installed) {
- cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &afd_cdevsw);
+ cdevsw_add(&afd_cdevsw);
afd_devsw_installed = 1;
}
}
diff --git a/sys/dev/ata/atapi-tape.c b/sys/dev/ata/atapi-tape.c
index 7699d89..a471232 100644
--- a/sys/dev/ata/atapi-tape.c
+++ b/sys/dev/ata/atapi-tape.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: atapi-tape.c,v 1.8 1999/05/17 15:58:47 sos Exp $
+ * $Id: atapi-tape.c,v 1.9 1999/05/30 16:51:16 phk Exp $
*/
#include "ata.h"
@@ -554,9 +554,7 @@ ast_drvinit(void *unused)
static int32_t ast_devsw_installed = 0;
if (!ast_devsw_installed) {
- dev_t dev = makedev(CDEV_MAJOR, 0);
-
- cdevsw_add(&dev, &ast_cdevsw, NULL);
+ cdevsw_add(&ast_cdevsw);
ast_devsw_installed = 1;
}
}
diff --git a/sys/dev/bktr/bktr_core.c b/sys/dev/bktr/bktr_core.c
index 70d3367..558400b 100644
--- a/sys/dev/bktr/bktr_core.c
+++ b/sys/dev/bktr/bktr_core.c
@@ -1,4 +1,4 @@
-/* $Id: brooktree848.c,v 1.81 1999/05/25 12:43:40 roger Exp $ */
+/* $Id: brooktree848.c,v 1.82 1999/05/30 16:53:32 phk Exp $ */
/* BT848 Driver for Brooktree's Bt848, Bt848A, Bt849A, Bt878, Bt879 based cards.
The Brooktree BT848 Driver driver is based upon Mark Tinguely and
Jim Lowe's driver for the Matrox Meteor PCI card . The
@@ -668,6 +668,10 @@ bktr_probe(struct device *parent, struct cfdata *cf, void *aux)
pci_devaddr_t *pa;
pci_devres_t res;
struct isa_attach_args *ia = aux;
+ static int once;
+
+ if (!once++)
+ cdevsw_add(&bktr_cdevsw);
if (ia->ia_bustype != BUS_PCI)
return (0);
@@ -7017,29 +7021,6 @@ static void msp_autodetect( bktr_ptr_t bktr ) {
/* msp_write(bktr, 0x12, 0x0014, 0x7f40); */
}
-/******************************************************************************
- * magic:
- */
-
-
-#ifdef __FreeBSD__
-static int bktr_devsw_installed;
-
-static void
-bktr_drvinit( void *unused )
-{
- dev_t dev;
-
- if ( ! bktr_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&bktr_cdevsw, NULL);
- bktr_devsw_installed = 1;
- }
-}
-
-SYSINIT(bktrdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,bktr_drvinit,NULL)
-
-#endif /* __FreeBSD__ */
#endif /* !defined(__FreeBSD__) || (NBKTR > 0 && NPCI > 0) */
/* Local Variables: */
diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c
index 70d0466..dd98d7a 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.88 1999/05/28 13:23:21 bde Exp $
+ * $Id: cy.c,v 1.89 1999/05/30 16:52:11 phk Exp $
*/
#include "opt_compat.h"
@@ -541,7 +541,6 @@ cyattach_common(cy_iobase, cy_align)
{
int adapter;
int cyu;
- dev_t dev;
u_char firmware_version;
cy_addr iobase;
int ncyu;
@@ -633,8 +632,7 @@ cyattach_common(cy_iobase, cy_align)
splx(s);
if (!sio_registered) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev, &sio_cdevsw, NULL);
+ cdevsw_add(&sio_cdevsw);
register_swi(SWI_TTY, siopoll);
sio_registered = TRUE;
}
diff --git a/sys/dev/cy/cy_isa.c b/sys/dev/cy/cy_isa.c
index 70d0466..dd98d7a 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.88 1999/05/28 13:23:21 bde Exp $
+ * $Id: cy.c,v 1.89 1999/05/30 16:52:11 phk Exp $
*/
#include "opt_compat.h"
@@ -541,7 +541,6 @@ cyattach_common(cy_iobase, cy_align)
{
int adapter;
int cyu;
- dev_t dev;
u_char firmware_version;
cy_addr iobase;
int ncyu;
@@ -633,8 +632,7 @@ cyattach_common(cy_iobase, cy_align)
splx(s);
if (!sio_registered) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev, &sio_cdevsw, NULL);
+ cdevsw_add(&sio_cdevsw);
register_swi(SWI_TTY, siopoll);
sio_registered = TRUE;
}
diff --git a/sys/dev/dgb/dgb.c b/sys/dev/dgb/dgb.c
index b39c89d..e16c979 100644
--- a/sys/dev/dgb/dgb.c
+++ b/sys/dev/dgb/dgb.c
@@ -1,5 +1,5 @@
/*-
- * dgb.c $Id: dgb.c,v 1.48 1999/05/08 07:02:24 phk Exp $
+ * dgb.c $Id: dgb.c,v 1.49 1999/05/30 16:51:56 phk Exp $
*
* Digiboard driver.
*
@@ -425,7 +425,10 @@ dgbprobe(dev)
int i, v;
u_long win_size; /* size of vizible memory window */
int unit=dev->id_unit;
+ static int once;
+ if (!once++)
+ cdevsw_add(&dgb_cdevsw);
sc->unit=dev->id_unit;
sc->port=dev->id_iobase;
@@ -2301,21 +2304,4 @@ disc_optim(tp, t)
tp->t_state &= ~TS_CAN_BYPASS_L_RINT;
}
-
-static int dgb_devsw_installed;
-
-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;
- }
-}
-
-SYSINIT(dgbdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,dgb_drvinit,NULL)
-
#endif /* NDGB > 0 */
diff --git a/sys/dev/dgb/dgm.c b/sys/dev/dgb/dgm.c
index 5f3ff63..6fa36ba 100644
--- a/sys/dev/dgb/dgm.c
+++ b/sys/dev/dgb/dgm.c
@@ -1,5 +1,5 @@
/*-
- * $Id: dgm.c,v 1.13 1999/05/08 07:02:25 phk Exp $
+ * $Id: dgm.c,v 1.14 1999/05/30 16:51:58 phk Exp $
*
* This driver and the associated header files support the ISA PC/Xem
* Digiboards. Its evolutionary roots are described below.
@@ -397,6 +397,10 @@ dgmprobe(dev)
struct dgm_softc *sc= &dgm_softc[dev->id_unit];
int i, v;
int unit=dev->id_unit;
+ static int once;
+
+ if (!once++)
+ cdevsw_add(&dgm_cdevsw);
sc->unit=dev->id_unit;
sc->port=dev->id_iobase;
@@ -2105,21 +2109,4 @@ disc_optim(tp, t)
tp->t_state &= ~TS_CAN_BYPASS_L_RINT;
}
-
-static int dgm_devsw_installed;
-
-static void
-dgm_drvinit(void *unused)
-{
- dev_t dev;
-
- if( ! dgm_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&dgm_cdevsw, NULL);
- dgm_devsw_installed = 1;
- }
-}
-
-SYSINIT(dgmdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,dgm_drvinit,NULL)
-
#endif /* NDGM > 0 */
diff --git a/sys/dev/dpt/dpt_control.c b/sys/dev/dpt/dpt_control.c
index 0f9eff8..93a4b39 100644
--- a/sys/dev/dpt/dpt_control.c
+++ b/sys/dev/dpt/dpt_control.c
@@ -36,7 +36,7 @@
* future.
*/
-#ident "$Id: dpt_control.c,v 1.12 1999/05/13 05:24:53 jkh Exp $"
+#ident "$Id: dpt_control.c,v 1.13 1999/05/30 16:51:20 phk Exp $"
#include "opt_dpt.h"
@@ -848,7 +848,6 @@ static dpt_devsw_installed = 0;
static void
dpt_drvinit(void *unused)
{
- dev_t dev;
if (!dpt_devsw_installed) {
if (bootverbose)
@@ -856,11 +855,7 @@ dpt_drvinit(void *unused)
DPT_CTL_RELEASE, DPT_CTL_VERSION, DPT_CTL_PATCH);
/* Add the I/O (data) channel */
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev, &dpt_cdevsw, NULL);
- /* Add the Control (IOCTL) channel */
- dev = makedev(CDEV_MAJOR, SCSI_CONTROL_MASK);
- cdevsw_add(&dev, &dpt_cdevsw, NULL);
+ cdevsw_add(&dpt_cdevsw);
dpt_devsw_installed = 1;
}
diff --git a/sys/dev/fb/fb.c b/sys/dev/fb/fb.c
index 0b694b8..a1d5f11 100644
--- a/sys/dev/fb/fb.c
+++ b/sys/dev/fb/fb.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: fb.c,v 1.3 1999/01/19 11:31:10 yokota Exp $
+ * $Id: fb.c,v 1.4 1999/05/30 16:51:23 phk Exp $
*/
#include "fb.h"
@@ -311,11 +311,9 @@ static void
vfbattach(void *arg)
{
static int fb_devsw_installed = FALSE;
- dev_t dev;
if (!fb_devsw_installed) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev, &fb_cdevsw, NULL);
+ cdevsw_add(&fb_cdevsw);
fb_devsw_installed = TRUE;
}
}
diff --git a/sys/dev/iicbus/iic.c b/sys/dev/iicbus/iic.c
index fbdcbcc..4c27180 100644
--- a/sys/dev/iicbus/iic.c
+++ b/sys/dev/iicbus/iic.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: iic.c,v 1.10 1999/05/09 13:00:35 phk Exp $
+ * $Id: iic.c,v 1.11 1999/05/30 16:51:28 phk Exp $
*
*/
#include <sys/param.h>
@@ -121,6 +121,10 @@ static int
iic_probe(device_t dev)
{
struct iic_softc *sc = (struct iic_softc *)device_get_softc(dev);
+ static int once;
+
+ if (!once++)
+ cdevsw_add(&iic_cdevsw);
sc->sc_addr = iicbus_get_addr(dev);
@@ -279,21 +283,5 @@ iicioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
return (error);
}
-static int iic_devsw_installed = 0;
-
-static void
-iic_drvinit(void *unused)
-{
- dev_t dev;
-
- if( ! iic_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&iic_cdevsw,NULL);
- iic_devsw_installed = 1;
- }
-}
-
DEV_DRIVER_MODULE(iic, iicbus, iic_driver, iic_devclass, CDEV_MAJOR,
NOMAJ, iic_cdevsw, 0, 0);
-
-SYSINIT(iicdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,iic_drvinit,NULL)
diff --git a/sys/dev/joy/joy.c b/sys/dev/joy/joy.c
index 6847f43..a2edbd5 100644
--- a/sys/dev/joy/joy.c
+++ b/sys/dev/joy/joy.c
@@ -120,6 +120,10 @@ static int get_tick __P((void));
static int
joyprobe (struct isa_device *dev)
{
+ static int once;
+
+ if (!once++)
+ cdevsw_add(&joy_cdevsw);
#ifdef WANT_JOYSTICK_CONNECTED
outb (dev->id_iobase, 0xff);
DELAY (10000); /* 10 ms delay */
@@ -251,22 +255,6 @@ get_tick ()
return (high << 8) | low;
}
-
-static int joy_devsw_installed;
-
-static void joy_drvinit(void *unused)
-{
- dev_t dev;
-
- if( ! joy_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&joy_cdevsw,NULL);
- joy_devsw_installed = 1;
- }
-}
-
-SYSINIT(joydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,joy_drvinit,NULL)
-
#ifdef JOY_MODULE
#include <sys/exec.h>
diff --git a/sys/dev/kbd/kbd.c b/sys/dev/kbd/kbd.c
index 47d9d5e..e858975 100644
--- a/sys/dev/kbd/kbd.c
+++ b/sys/dev/kbd/kbd.c
@@ -23,7 +23,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: kbd.c,v 1.7 1999/05/30 14:55:24 phk Exp $
+ * $Id: kbd.c,v 1.8 1999/05/30 16:51:31 phk Exp $
*/
#include "kbd.h"
@@ -431,11 +431,9 @@ static void
vkbdattach(void *arg)
{
static int kbd_devsw_installed = FALSE;
- dev_t dev;
if (!kbd_devsw_installed) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev, &kbd_cdevsw, NULL);
+ cdevsw_add(&kbd_cdevsw);
kbd_devsw_installed = TRUE;
}
}
diff --git a/sys/dev/mcd/mcd.c b/sys/dev/mcd/mcd.c
index c57a675..17e9b0c 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.106 1999/05/08 07:02:30 phk Exp $
+ * $Id: mcd.c,v 1.107 1999/05/30 16:52:19 phk Exp $
*/
static const char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
@@ -756,6 +756,10 @@ mcd_probe(struct isa_device *dev)
int unit = dev->id_unit;
int i, j;
unsigned char stbytes[3];
+ static int once;
+
+ if (!once++)
+ cdevsw_add(&mcd_cdevsw);
mcd_data[unit].flags = MCDPROBING;
@@ -1856,19 +1860,4 @@ mcd_resume(int unit)
return mcd_play(unit, &cd->lastpb);
}
-
-static int mcd_devsw_installed;
-
-static void mcd_drvinit(void *unused)
-{
-
- if( ! mcd_devsw_installed ) {
- cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &mcd_cdevsw);
- mcd_devsw_installed = 1;
- }
-}
-
-SYSINIT(mcddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,mcd_drvinit,NULL)
-
-
#endif /* NMCD > 0 */
diff --git a/sys/dev/mse/mse.c b/sys/dev/mse/mse.c
index b70cf15..a8676bc 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.42 1999/05/06 18:44:02 peter Exp $
+ * $Id: mse.c,v 1.43 1999/05/30 16:52:20 phk Exp $
*/
/*
* Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and
@@ -248,7 +248,10 @@ mseprobe(idp)
{
register struct mse_softc *sc = &mse_sc[idp->id_unit];
register int i;
+ static int once;
+ if (!once++)
+ cdevsw_add(&mse_cdevsw);
/*
* Check for each mouse type in the table.
*/
@@ -788,20 +791,4 @@ mse_getati(port, dx, dy, but)
outb(port + MSE_PORTB, MSE_INPORT_INTREN);
}
-static int mse_devsw_installed;
-
-static void mse_drvinit(void *unused)
-{
- dev_t dev;
-
- if( ! mse_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&mse_cdevsw, NULL);
- mse_devsw_installed = 1;
- }
-}
-
-SYSINIT(msedev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,mse_drvinit,NULL)
-
-
#endif /* NMSE */
diff --git a/sys/dev/pccard/if_xe.c b/sys/dev/pccard/if_xe.c
index 1836f89..88af576 100644
--- a/sys/dev/pccard/if_xe.c
+++ b/sys/dev/pccard/if_xe.c
@@ -352,7 +352,11 @@ xe_memwrite(struct pccard_devinfo *devi, off_t offset, u_char byte)
uios.uio_rw = UIO_WRITE;
uios.uio_procp = 0;
+#if 0 /* THIS IS BOGUS */
return cdevsw[CARD_MAJOR]->d_write(makedev(CARD_MAJOR, devi->slt->slotnum), &uios, 0);
+#else
+ return (-1);
+#endif
}
@@ -373,7 +377,11 @@ xe_memread(struct pccard_devinfo *devi, off_t offset, u_char *buf, int size)
uios.uio_rw = UIO_READ;
uios.uio_procp = 0;
+#if 0 /* THIS IS BOGUS */
return cdevsw[CARD_MAJOR]->d_read(makedev(CARD_MAJOR, devi->slt->slotnum), &uios, 0);
+#else
+ return (-1);
+#endif
}
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index bf5e657..8bc9c1d 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -23,7 +23,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: pci.c,v 1.105 1999/05/30 10:54:31 dfr Exp $
+ * $Id: pci.c,v 1.106 1999/05/30 16:53:36 phk Exp $
*
*/
@@ -875,10 +875,7 @@ static void *pci_devfs_token;
static void
pci_cdevinit(void *dummy)
{
- dev_t dev;
-
- dev = makedev(PCI_CDEV, 0);
- cdevsw_add(&dev, &pcicdev, NULL);
+ cdevsw_add(&pcicdev);
#ifdef DEVFS
pci_devfs_token = devfs_add_devswf(&pcicdev, 0, DV_CHR,
UID_ROOT, GID_WHEEL, 0644, "pci");
diff --git a/sys/dev/ppbus/lpt.c b/sys/dev/ppbus/lpt.c
index ab61978..67f4468 100644
--- a/sys/dev/ppbus/lpt.c
+++ b/sys/dev/ppbus/lpt.c
@@ -48,7 +48,7 @@
* from: unknown origin, 386BSD 0.1
* From Id: lpt.c,v 1.55.2.1 1996/11/12 09:08:38 phk Exp
* From Id: nlpt.c,v 1.14 1999/02/08 13:55:43 des Exp
- * $Id: lpt.c,v 1.3 1999/04/28 10:51:35 dt Exp $
+ * $Id: lpt.c,v 1.4 1999/05/30 16:51:34 phk Exp $
*/
/*
@@ -363,6 +363,10 @@ static struct ppb_device *
lptprobe(struct ppb_data *ppb)
{
struct lpt_data *sc;
+ static int once;
+
+ if (!once++)
+ cdevsw_add(&lpt_cdevsw);
sc = (struct lpt_data *) malloc(sizeof(struct lpt_data),
M_TEMP, M_NOWAIT);
@@ -954,19 +958,3 @@ lptioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
return(error);
}
-
-static int lpt_devsw_installed;
-
-static void
-lpt_drvinit(void *unused)
-{
- dev_t dev;
-
- if( ! lpt_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&lpt_cdevsw, NULL);
- lpt_devsw_installed = 1;
- }
-}
-
-SYSINIT(lptdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,lpt_drvinit,NULL)
diff --git a/sys/dev/ppbus/ppi.c b/sys/dev/ppbus/ppi.c
index 315ea29..e19be8c 100644
--- a/sys/dev/ppbus/ppi.c
+++ b/sys/dev/ppbus/ppi.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ppi.c,v 1.13 1999/04/28 10:51:39 dt Exp $
+ * $Id: ppi.c,v 1.14 1999/05/30 16:51:35 phk Exp $
*
*/
#include "ppi.h"
@@ -146,6 +146,10 @@ static struct ppb_device *
ppiprobe(struct ppb_data *ppb)
{
struct ppi_data *ppi;
+ static int once;
+
+ if (!once++)
+ cdevsw_add(&ppi_cdevsw);
ppi = (struct ppi_data *) malloc(sizeof(struct ppi_data),
M_TEMP, M_NOWAIT);
@@ -547,19 +551,4 @@ ppiioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
return (error);
}
-static int ppi_devsw_installed;
-
-static void ppi_drvinit(void *unused)
-{
- dev_t dev;
-
- if (!ppi_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev, &ppi_cdevsw, NULL);
- ppi_devsw_installed = 1;
- }
-}
-
-SYSINIT(ppidev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,ppi_drvinit,NULL)
-
#endif /* NPPI */
diff --git a/sys/dev/ppbus/pps.c b/sys/dev/ppbus/pps.c
index 8fc5528..0bad854 100644
--- a/sys/dev/ppbus/pps.c
+++ b/sys/dev/ppbus/pps.c
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id: pps.c,v 1.17 1999/05/06 22:03:14 peter Exp $
+ * $Id: pps.c,v 1.18 1999/05/30 16:51:36 phk Exp $
*
* This driver implements a draft-mogul-pps-api-02.txt PPS source.
*
@@ -87,6 +87,10 @@ static struct ppb_device *
ppsprobe(struct ppb_data *ppb)
{
struct pps_data *sc;
+ static int once;
+
+ if (!once++)
+ cdevsw_add(&pps_cdevsw);
sc = (struct pps_data *) malloc(sizeof(struct pps_data),
M_TEMP, M_NOWAIT);
@@ -113,7 +117,6 @@ ppsprobe(struct ppb_data *ppb)
static int
ppsattach(struct ppb_device *dev)
{
- dev_t devt;
/*
* Report ourselves
@@ -126,8 +129,6 @@ ppsattach(struct ppb_device *dev)
dev->id_unit, DV_CHR,
UID_ROOT, GID_WHEEL, 0600, PPS_NAME "%d", dev->id_unit);
#endif
- devt = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&devt, &pps_cdevsw, NULL);
return (1);
}
diff --git a/sys/dev/rc/rc.c b/sys/dev/rc/rc.c
index fdcbcf6..8e0fdc5 100644
--- a/sys/dev/rc/rc.c
+++ b/sys/dev/rc/rc.c
@@ -213,6 +213,10 @@ rcprobe(dvp)
{
int irq = ffs(dvp->id_irq) - 1;
register int nec = dvp->id_iobase;
+ static int once;
+
+ if (!once++)
+ cdevsw_add(&rc_cdevsw);
if (dvp->id_unit > NRC)
return 0;
@@ -1510,20 +1514,4 @@ rc_wait0(nec, unit, chan, line)
unit, chan, line);
}
-static int rc_devsw_installed;
-
-static void rc_drvinit(void *unused)
-{
- dev_t dev;
-
- if( ! rc_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&rc_cdevsw, NULL);
- rc_devsw_installed = 1;
- }
-}
-
-SYSINIT(rcdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,rc_drvinit,NULL)
-
-
#endif /* NRC */
diff --git a/sys/dev/rp/rp.c b/sys/dev/rp/rp.c
index a3c2382..c1913a0 100644
--- a/sys/dev/rp/rp.c
+++ b/sys/dev/rp/rp.c
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: rp.c,v 1.26 1999/05/09 17:07:20 peter Exp $
+ * $Id: rp.c,v 1.27 1999/05/30 16:52:22 phk Exp $
*/
/*
@@ -1085,7 +1085,6 @@ struct isa_device *dev;
static void
rp_pciattach(pcici_t tag, int unit)
{
- dev_t rp_dev;
int success, oldspl;
u_short iobase;
int num_ports, num_chan, num_aiops;
@@ -1140,8 +1139,7 @@ rp_pciattach(pcici_t tag, int unit)
rp_addr(unit) = rp;
splx(oldspl);
- rp_dev = makedev(CDEV_MAJOR, unit);
- cdevsw_add(&rp_dev, &rp_cdevsw, NULL);
+ cdevsw_add(&rp_cdevsw);
port = 0;
for(aiop=0; aiop < num_aiops; aiop++) {
@@ -1196,7 +1194,6 @@ int
rpattach(dev)
struct isa_device *dev;
{
- dev_t rp_dev;
int iobase, unit, /*rpmajor,*/ oldspl;
int num_ports, num_chan, num_aiops;
int aiop, chan, port;
@@ -1252,8 +1249,7 @@ struct isa_device *dev;
rp_addr(unit) = rp;
splx(oldspl);
- rp_dev = makedev(CDEV_MAJOR, unit);
- cdevsw_add(&rp_dev, &rp_cdevsw, NULL);
+ cdevsw_add(&rp_cdevsw);
port = 0;
for(aiop=0; aiop < num_aiops; aiop++) {
diff --git a/sys/dev/scd/scd.c b/sys/dev/scd/scd.c
index 24af2e1..ff4832d 100644
--- a/sys/dev/scd/scd.c
+++ b/sys/dev/scd/scd.c
@@ -41,7 +41,7 @@
*/
-/* $Id: scd.c,v 1.45 1999/05/09 20:29:04 phk Exp $ */
+/* $Id: scd.c,v 1.46 1999/05/30 16:52:24 phk Exp $ */
/* Please send any comments to micke@dynas.se */
@@ -718,6 +718,10 @@ scd_probe(struct isa_device *dev)
static char namebuf[8+16+8+3];
char *s = namebuf;
int loop_count = 0;
+ static int once;
+
+ if (!once++)
+ cdevsw_add(&scd_cdevsw);
scd_data[unit].flags = SCDPROBING;
scd_data[unit].iobase = dev->id_iobase;
@@ -1574,19 +1578,4 @@ scd_toc_entry (int unit, struct ioc_read_toc_single_entry *te)
return 0;
}
-
-static int scd_devsw_installed;
-
-static void scd_drvinit(void *unused)
-{
-
- if( ! scd_devsw_installed ) {
- cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &scd_cdevsw);
- scd_devsw_installed = 1;
- }
-}
-
-SYSINIT(scddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,scd_drvinit,NULL)
-
-
#endif /* NSCD > 0 */
diff --git a/sys/dev/si/si.c b/sys/dev/si/si.c
index 0565390..18d8377 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.85 1999/05/09 17:07:21 peter Exp $
+ * $Id: si.c,v 1.86 1999/05/30 16:52:25 phk Exp $
*/
#ifndef lint
@@ -2832,13 +2832,8 @@ static int si_devsw_installed;
static void
si_drvinit(void *unused)
{
- dev_t dev;
- if (!si_devsw_installed) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&si_cdevsw, NULL);
- si_devsw_installed = 1;
- }
+ cdevsw_add(&si_cdevsw);
}
SYSINIT(sidev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,si_drvinit,NULL)
diff --git a/sys/dev/smbus/smb.c b/sys/dev/smbus/smb.c
index f411f8a..5eed57e 100644
--- a/sys/dev/smbus/smb.c
+++ b/sys/dev/smbus/smb.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: smb.c,v 1.11 1999/05/09 13:00:37 phk Exp $
+ * $Id: smb.c,v 1.12 1999/05/30 16:51:37 phk Exp $
*
*/
#include <sys/param.h>
@@ -122,6 +122,10 @@ static int
smb_probe(device_t dev)
{
struct smb_softc *sc = (struct smb_softc *)device_get_softc(dev);
+ static int once;
+
+ if (!once++)
+ cdevsw_add(&smb_cdevsw);
sc->sc_addr = smbus_get_addr(dev);
@@ -272,21 +276,5 @@ smbioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
return (error);
}
-static int smb_devsw_installed = 0;
-
-static void
-smb_drvinit(void *unused)
-{
- dev_t dev;
-
- if( ! smb_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&smb_cdevsw,NULL);
- smb_devsw_installed = 1;
- }
-}
-
DEV_DRIVER_MODULE(smb, smbus, smb_driver, smb_devclass, CDEV_MAJOR, NOMAJ,
smb_cdevsw, 0, 0);
-
-SYSINIT(smbdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,smb_drvinit,NULL)
diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c
index 8b45c8a..d9f9897 100644
--- a/sys/dev/snp/snp.c
+++ b/sys/dev/snp/snp.c
@@ -83,11 +83,7 @@ snpdevtotty (dev)
dev_t dev;
{
struct cdevsw *cdp;
- int maj;
- maj = major(dev);
- if ((u_int)maj >= nchrdev)
- return (NULL);
cdp = devsw(dev);
if (cdp == NULL)
return (NULL);
@@ -533,14 +529,12 @@ static void
snp_drvinit(unused)
void *unused;
{
- dev_t dev;
#ifdef DEVFS
int i;
#endif
if( ! snp_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&snp_cdevsw, NULL);
+ cdevsw_add(&snp_cdevsw);
snp_devsw_installed = 1;
#ifdef DEVFS
for ( i = 0 ; i < NSNP ; i++) {
diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c
index 759a9fc..f594b8b 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.35 1998/08/24 02:28:16 bde Exp $
+ * $Id: spkr.c,v 1.36 1999/05/30 16:52:27 phk Exp $
*/
#include "speaker.h"
@@ -601,24 +601,14 @@ spkrioctl(dev, cmd, cmdarg, flags, p)
return(EINVAL);
}
-
-static int spkr_devsw_installed;
-
static void
spkr_drvinit(void *unused)
{
- dev_t dev;
-
- if( ! spkr_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&spkr_cdevsw, NULL);
- spkr_devsw_installed = 1;
+ cdevsw_add(&spkr_cdevsw);
#ifdef DEVFS
- devfs_token = devfs_add_devswf(&spkr_cdevsw, 0, DV_CHR,
- UID_ROOT, GID_WHEEL, 0600,
- "speaker");
+ devfs_token = devfs_add_devswf(&spkr_cdevsw, 0, DV_CHR,
+ UID_ROOT, GID_WHEEL, 0600, "speaker");
#endif
- }
}
SYSINIT(spkrdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,spkr_drvinit,NULL)
diff --git a/sys/dev/streams/streams.c b/sys/dev/streams/streams.c
index e3790e8..e82ed9e 100644
--- a/sys/dev/streams/streams.c
+++ b/sys/dev/streams/streams.c
@@ -152,21 +152,14 @@ typedef struct streams_softc *sc_p;
static sc_p sca[NSTREAMS];
-static void
-streamsattach(void *dummy)
-{
- cdevsw_add_generic(CDEV_MAJOR, CDEV_MAJOR, &streams_cdevsw);
-}
-
static int
streams_modevent(module_t mod, int type, void *unused)
{
switch (type) {
case MOD_LOAD:
- streamsattach(NULL);
+ cdevsw_add(&streams_cdevsw);
return 0;
case MOD_UNLOAD:
- cdevsw[CDEV_MAJOR] = NULL; /* clean up cdev */
return 0;
default:
break;
@@ -394,12 +387,10 @@ svr4_soo_close(struct file *fp, struct proc *p)
static void
streams_drvinit(void *unused)
{
- dev_t dev;
int unit;
sc_p scp = sca[unit];
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev, &streams_cdevsw, NULL);
+ cdevsw_add(&streams_cdevsw);
for (unit = 0; unit < NSTREAMS; unit++) {
/*
* Allocate storage for this instance .
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
index 41ee89a..61b6830 100644
--- a/sys/dev/syscons/syscons.c
+++ b/sys/dev/syscons/syscons.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: syscons.c,v 1.303 1999/05/12 04:45:56 bde Exp $
+ * $Id: syscons.c,v 1.304 1999/05/30 16:51:42 phk Exp $
*/
#include "sc.h"
@@ -574,7 +574,6 @@ sc_attach_unit(int unit, int flags)
#if defined(VESA) && defined(VM86)
video_info_t info;
#endif
- dev_t cdev = makedev(CDEV_MAJOR, 0);
#ifdef DEVFS
int vc;
#endif
@@ -661,7 +660,7 @@ sc_attach_unit(int unit, int flags)
at_shutdown(scshutdown, NULL, SHUTDOWN_PRE_SYNC);
- cdevsw_add(&cdev, &sc_cdevsw, NULL);
+ cdevsw_add(&sc_cdevsw);
#ifdef DEVFS
for (vc = 0; vc < MAXCONS; vc++)
diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c
index ee2f041..fa827ce 100644
--- a/sys/dev/usb/usbdi.c
+++ b/sys/dev/usb/usbdi.c
@@ -965,17 +965,13 @@ static int usbd_global_init_done = 0;
void
usbd_init()
{
-#if defined(__FreeBSD__)
- dev_t dev;
-#endif
if (!usbd_global_init_done) {
usbd_global_init_done = 1;
SIMPLEQ_INIT(&usbd_free_requests);
#if defined(__FreeBSD__)
- dev = makedev(USB_CDEV_MAJOR, 0);
- cdevsw_add(&dev, &usb_cdevsw, NULL);
+ cdevsw_add(&usb_cdevsw);
#endif
}
}
diff --git a/sys/dev/xe/if_xe.c b/sys/dev/xe/if_xe.c
index 1836f89..88af576 100644
--- a/sys/dev/xe/if_xe.c
+++ b/sys/dev/xe/if_xe.c
@@ -352,7 +352,11 @@ xe_memwrite(struct pccard_devinfo *devi, off_t offset, u_char byte)
uios.uio_rw = UIO_WRITE;
uios.uio_procp = 0;
+#if 0 /* THIS IS BOGUS */
return cdevsw[CARD_MAJOR]->d_write(makedev(CARD_MAJOR, devi->slt->slotnum), &uios, 0);
+#else
+ return (-1);
+#endif
}
@@ -373,7 +377,11 @@ xe_memread(struct pccard_devinfo *devi, off_t offset, u_char *buf, int size)
uios.uio_rw = UIO_READ;
uios.uio_procp = 0;
+#if 0 /* THIS IS BOGUS */
return cdevsw[CARD_MAJOR]->d_read(makedev(CARD_MAJOR, devi->slt->slotnum), &uios, 0);
+#else
+ return (-1);
+#endif
}
diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c
index 1de8b40..907c138 100644
--- a/sys/fs/cd9660/cd9660_vfsops.c
+++ b/sys/fs/cd9660/cd9660_vfsops.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95
- * $Id: cd9660_vfsops.c,v 1.54 1999/05/07 10:10:46 phk Exp $
+ * $Id: cd9660_vfsops.c,v 1.55 1999/05/08 06:39:32 phk Exp $
*/
#include <sys/param.h>
@@ -225,8 +225,7 @@ cd9660_mount(mp, path, data, ndp, p)
vrele(devvp);
return ENOTBLK;
}
- if (major(devvp->v_rdev) >= nblkdev ||
- bdevsw(devvp->v_rdev) == NULL) {
+ if (bdevsw(devvp->v_rdev) == NULL) {
vrele(devvp);
return ENXIO;
}
diff --git a/sys/fs/coda/coda_fbsd.c b/sys/fs/coda/coda_fbsd.c
index 49bba22..9c349f8 100644
--- a/sys/fs/coda/coda_fbsd.c
+++ b/sys/fs/coda/coda_fbsd.c
@@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance.
*
* @(#) src/sys/coda/coda_fbsd.cr,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- * $Id: coda_fbsd.c,v 1.13 1999/01/28 00:57:46 dillon Exp $
+ * $Id: coda_fbsd.c,v 1.14 1999/05/30 16:51:10 phk Exp $
*
*/
@@ -101,7 +101,6 @@ int vcdebug = 1;
static int
codadev_modevent(module_t mod, int type, void *data)
{
- dev_t dev;
#ifdef DEVFS
int i;
#endif
@@ -109,8 +108,7 @@ codadev_modevent(module_t mod, int type, void *data)
switch (type) {
case MOD_LOAD:
- dev = makedev(VC_DEV_NO, 0);
- cdevsw_add(&dev,&codadevsw, &oldcdevsw);
+ cdevsw_add(&codadevsw);
#ifdef DEVFS
/* tmp */
#undef NVCODA
@@ -134,7 +132,7 @@ codadev_modevent(module_t mod, int type, void *data)
devfs_remove_dev(coda_devfs_token[i]);
}
#endif
- cdevsw_add(&dev, oldcdevsw, NULL);
+ cdevsw_add(oldcdevsw);
break;
default:
break;
diff --git a/sys/fs/coda/coda_vfsops.c b/sys/fs/coda/coda_vfsops.c
index dfb4e0e..50245d0 100644
--- a/sys/fs/coda/coda_vfsops.c
+++ b/sys/fs/coda/coda_vfsops.c
@@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance.
*
* @(#) src/sys/cfs/coda_vfsops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- * $Id: coda_vfsops.c,v 1.12 1999/05/08 06:39:04 phk Exp $
+ * $Id: coda_vfsops.c,v 1.13 1999/05/09 13:11:37 phk Exp $
*
*/
@@ -47,6 +47,9 @@
/*
* HISTORY
* $Log: coda_vfsops.c,v $
+ * Revision 1.13 1999/05/09 13:11:37 phk
+ * remove cast from dev_t to dev_t.
+ *
* Revision 1.12 1999/05/08 06:39:04 phk
* I got tired of seeing all the cdevsw[major(foo)] all over the place.
*
@@ -341,10 +344,6 @@ coda_mount(vfsp, path, data, ndp, p)
}
dev = dvp->v_specinfo->si_rdev;
vrele(dvp);
- if (major(dev) >= nchrdev || major(dev) < 0) {
- MARK_INT_FAIL(CODA_MOUNT_STATS);
- return(ENXIO);
- }
/*
* See if the device table matches our expectations.
diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c
index 6bdea5f..2d7dc39 100644
--- a/sys/fs/fdescfs/fdesc_vnops.c
+++ b/sys/fs/fdescfs/fdesc_vnops.c
@@ -35,7 +35,7 @@
*
* @(#)fdesc_vnops.c 8.9 (Berkeley) 1/21/94
*
- * $Id: fdesc_vnops.c,v 1.40 1998/12/14 05:00:57 dillon Exp $
+ * $Id: fdesc_vnops.c,v 1.41 1999/01/27 22:42:06 dillon Exp $
*/
/*
@@ -105,7 +105,7 @@ fdesc_init(vfsp)
struct vfsconf *vfsp;
{
- devctty = makedev(nchrdev, 0);
+ devctty = NODEV;
fdhashtbl = hashinit(NFDCACHE, M_CACHE, &fdhash);
return (0);
}
diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c
index 35c4cb2..9312e30 100644
--- a/sys/fs/msdosfs/msdosfs_vfsops.c
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $Id: msdosfs_vfsops.c,v 1.43 1999/05/07 10:11:10 phk Exp $ */
+/* $Id: msdosfs_vfsops.c,v 1.44 1999/05/08 06:40:00 phk Exp $ */
/* $NetBSD: msdosfs_vfsops.c,v 1.51 1997/11/17 15:36:58 ws Exp $ */
/*-
@@ -298,8 +298,7 @@ msdosfs_mount(mp, path, data, ndp, p)
vrele(devvp);
return (ENOTBLK);
}
- if (major(devvp->v_rdev) >= nblkdev ||
- bdevsw(devvp->v_rdev) == NULL) {
+ if (bdevsw(devvp->v_rdev) == NULL) {
vrele(devvp);
return (ENXIO);
}
diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c
index 134ca03..b224001 100644
--- a/sys/fs/ntfs/ntfs_vfsops.c
+++ b/sys/fs/ntfs/ntfs_vfsops.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ntfs_vfsops.c,v 1.5 1999/05/11 19:54:52 phk Exp $
+ * $Id: ntfs_vfsops.c,v 1.6 1999/05/12 09:43:04 semenu Exp $
*/
@@ -296,7 +296,7 @@ ntfs_mount (
err = ENOTBLK;
goto error_2;
}
- if (major(devvp->v_rdev) >= nblkdev) {
+ if (bdevsw(devvp->v_rdev) == NULL) {
err = ENXIO;
goto error_2;
}
diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c
index 636bc44..ae8bc0f 100644
--- a/sys/fs/specfs/spec_vnops.c
+++ b/sys/fs/specfs/spec_vnops.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95
- * $Id: spec_vnops.c,v 1.85 1999/05/08 06:39:55 phk Exp $
+ * $Id: spec_vnops.c,v 1.86 1999/05/11 19:54:38 phk Exp $
*/
#include <sys/param.h>
@@ -176,8 +176,6 @@ spec_open(ap)
switch (vp->v_type) {
case VCHR:
- if ((u_int)maj >= nchrdev)
- return (ENXIO);
dsw = devsw(dev);
if ( (dsw == NULL) || (dsw->d_open == NULL))
return ENXIO;
@@ -214,8 +212,6 @@ spec_open(ap)
return (error);
/* NOT REACHED */
case VBLK:
- if ((u_int)maj >= nblkdev)
- return (ENXIO);
dsw = bdevsw(dev);
if ( (dsw == NULL) || (dsw->d_open == NULL))
return ENXIO;
diff --git a/sys/gnu/ext2fs/ext2_vfsops.c b/sys/gnu/ext2fs/ext2_vfsops.c
index 43f8ead..db93539 100644
--- a/sys/gnu/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/ext2fs/ext2_vfsops.c
@@ -276,8 +276,7 @@ ext2_mount(mp, path, data, ndp, p)
vrele(devvp);
return (ENOTBLK);
}
- if (major(devvp->v_rdev) >= nblkdev ||
- bdevsw(devvp->v_rdev) == NULL) {
+ if (bdevsw(devvp->v_rdev) == NULL) {
vrele(devvp);
return (ENXIO);
}
diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c
index 43f8ead..db93539 100644
--- a/sys/gnu/fs/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c
@@ -276,8 +276,7 @@ ext2_mount(mp, path, data, ndp, p)
vrele(devvp);
return (ENOTBLK);
}
- if (major(devvp->v_rdev) >= nblkdev ||
- bdevsw(devvp->v_rdev) == NULL) {
+ if (bdevsw(devvp->v_rdev) == NULL) {
vrele(devvp);
return (ENXIO);
}
diff --git a/sys/gnu/i386/isa/dgb.c b/sys/gnu/i386/isa/dgb.c
index b39c89d..e16c979 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.48 1999/05/08 07:02:24 phk Exp $
+ * dgb.c $Id: dgb.c,v 1.49 1999/05/30 16:51:56 phk Exp $
*
* Digiboard driver.
*
@@ -425,7 +425,10 @@ dgbprobe(dev)
int i, v;
u_long win_size; /* size of vizible memory window */
int unit=dev->id_unit;
+ static int once;
+ if (!once++)
+ cdevsw_add(&dgb_cdevsw);
sc->unit=dev->id_unit;
sc->port=dev->id_iobase;
@@ -2301,21 +2304,4 @@ disc_optim(tp, t)
tp->t_state &= ~TS_CAN_BYPASS_L_RINT;
}
-
-static int dgb_devsw_installed;
-
-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;
- }
-}
-
-SYSINIT(dgbdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,dgb_drvinit,NULL)
-
#endif /* NDGB > 0 */
diff --git a/sys/gnu/i386/isa/dgm.c b/sys/gnu/i386/isa/dgm.c
index 5f3ff63..6fa36ba 100644
--- a/sys/gnu/i386/isa/dgm.c
+++ b/sys/gnu/i386/isa/dgm.c
@@ -1,5 +1,5 @@
/*-
- * $Id: dgm.c,v 1.13 1999/05/08 07:02:25 phk Exp $
+ * $Id: dgm.c,v 1.14 1999/05/30 16:51:58 phk Exp $
*
* This driver and the associated header files support the ISA PC/Xem
* Digiboards. Its evolutionary roots are described below.
@@ -397,6 +397,10 @@ dgmprobe(dev)
struct dgm_softc *sc= &dgm_softc[dev->id_unit];
int i, v;
int unit=dev->id_unit;
+ static int once;
+
+ if (!once++)
+ cdevsw_add(&dgm_cdevsw);
sc->unit=dev->id_unit;
sc->port=dev->id_iobase;
@@ -2105,21 +2109,4 @@ disc_optim(tp, t)
tp->t_state &= ~TS_CAN_BYPASS_L_RINT;
}
-
-static int dgm_devsw_installed;
-
-static void
-dgm_drvinit(void *unused)
-{
- dev_t dev;
-
- if( ! dgm_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&dgm_cdevsw, NULL);
- dgm_devsw_installed = 1;
- }
-}
-
-SYSINIT(dgmdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,dgm_drvinit,NULL)
-
#endif /* NDGM > 0 */
diff --git a/sys/i386/i386/autoconf.c b/sys/i386/i386/autoconf.c
index 0dcad73..9175d60 100644
--- a/sys/i386/i386/autoconf.c
+++ b/sys/i386/i386/autoconf.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
- * $Id: autoconf.c,v 1.122 1999/05/12 07:40:50 phk Exp $
+ * $Id: autoconf.c,v 1.123 1999/05/24 00:30:49 jb Exp $
*/
/*
@@ -156,7 +156,7 @@ find_cdrom_root()
orootdev = rootdev;
for (i = 0 ; i < 2; i++)
for (j = 0 ; try_cdrom[j].name ; j++) {
- if (try_cdrom[j].major >= nblkdev)
+ if (try_cdrom[j].major >= NUMCDEVSW)
continue;
rootdev = makedev(try_cdrom[j].major, i * 8);
bd = bdevsw(rootdev);
@@ -382,7 +382,7 @@ setdumpdev(dev)
return (0);
}
maj = major(dev);
- if (maj >= nblkdev || bdevsw(dev) == NULL)
+ if (bdevsw(dev) == NULL)
return (ENXIO); /* XXX is this right? */
if (bdevsw(dev)->d_psize == NULL)
return (ENXIO); /* XXX should be ENODEV ? */
@@ -435,7 +435,7 @@ setroot()
return;
majdev = B_TYPE(bootdev);
dev = makedev(majdev, 0);
- if (majdev >= nblkdev || bdevsw(dev) == NULL)
+ if (bdevsw(dev) == NULL)
return;
unit = B_UNIT(bootdev);
slice = B_SLICE(bootdev);
@@ -523,7 +523,7 @@ setrootbyname(char *name)
}
unit = *cp - '0';
*cp++ = '\0';
- for (bd = 0; bd < nblkdev; bd++) {
+ for (bd = 0; bd < NUMCDEVSW; bd++) {
dev = makedev(bd, 0);
if (bdevsw(dev) != NULL &&
strcmp(bdevsw(dev)->d_name, name) == 0)
@@ -566,7 +566,7 @@ setconf()
return;
printf("use one of:\n");
- for (i = 0; i < nblkdev; i++) {
+ for (i = 0; i < NUMCDEVSW; i++) {
dev = makedev(i, 0);
if (bdevsw(dev) != NULL)
printf(" %s", bdevsw(dev)->d_name);
diff --git a/sys/i386/i386/cons.c b/sys/i386/i386/cons.c
index 6b7efb4..acc8503 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.65 1999/05/08 06:39:20 phk Exp $
+ * $Id: cons.c,v 1.66 1999/05/30 16:52:03 phk Exp $
*/
#include "opt_devfs.h"
@@ -433,11 +433,9 @@ static int cn_devsw_installed;
static void
cn_drvinit(void *unused)
{
- dev_t dev;
if( ! cn_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&cn_cdevsw,NULL);
+ cdevsw_add(&cn_cdevsw);
cn_devsw_installed = 1;
#ifdef DEVFS
cn_devfs_token = devfs_add_devswf(&cn_cdevsw, 0, DV_CHR,
diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c
index 20a7820..02827d0 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.61 1999/05/11 19:54:06 phk Exp $
+ * $Id: mem.c,v 1.62 1999/05/30 16:52:04 phk Exp $
*/
/*
@@ -668,7 +668,6 @@ static int mem_devsw_installed;
static void
mem_drvinit(void *unused)
{
- dev_t dev;
/* Initialise memory range handling */
if (mem_range_softc.mr_op != NULL)
@@ -676,9 +675,7 @@ mem_drvinit(void *unused)
/* device registration */
if( ! mem_devsw_installed ) {
-
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&mem_cdevsw, NULL);
+ cdevsw_add(&mem_cdevsw);
mem_devsw_installed = 1;
#ifdef DEVFS
memdevfs_init();
diff --git a/sys/i386/isa/asc.c b/sys/i386/isa/asc.c
index 4a6a071..700271a 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.36 1999/05/06 18:12:24 peter Exp $
+ * $Id: asc.c,v 1.37 1999/05/30 16:52:07 phk Exp $
*/
#include "asc.h"
@@ -379,6 +379,10 @@ ascprobe (struct isa_device *isdp)
int unit = isdp->id_unit;
struct asc_unit *scu = unittab + unit;
int stb;
+ static int once;
+
+ if (!once++)
+ cdevsw_add(&asc_cdevsw);
scu->base = isdp->id_iobase; /*** needed by the following macros ***/
scu->flags = FLAG_DEBUG;
@@ -899,22 +903,4 @@ ascpoll(dev_t dev, int events, struct proc *p)
return 0;
}
-
-static int asc_devsw_installed;
-
-static void
-asc_drvinit(void *unused)
-{
- dev_t dev;
-
- if( ! asc_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&asc_cdevsw,NULL);
- asc_devsw_installed = 1;
- }
-}
-
-SYSINIT(ascdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,asc_drvinit,NULL)
-
-
#endif /* NASC > 0 */
diff --git a/sys/i386/isa/atapi-cd.c b/sys/i386/isa/atapi-cd.c
index 644fb3f..0613e7e 100644
--- a/sys/i386/isa/atapi-cd.c
+++ b/sys/i386/isa/atapi-cd.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: atapi-cd.c,v 1.18 1999/05/11 10:39:27 sos Exp $
+ * $Id: atapi-cd.c,v 1.19 1999/05/30 16:52:08 phk Exp $
*/
#include "wdc.h"
@@ -1496,15 +1496,10 @@ atapi_dump(int ctrlr, int lun, char *label, void *data, int len)
printf ("\n");
}
-static int acd_devsw_installed;
-
static void
acd_drvinit(void *unused)
{
- if (!acd_devsw_installed) {
- cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &acd_cdevsw);
- acd_devsw_installed = 1;
- }
+ cdevsw_add(&acd_cdevsw);
}
SYSINIT(acddev, SI_SUB_DRIVERS, SI_ORDER_MIDDLE + CDEV_MAJOR, acd_drvinit, NULL)
diff --git a/sys/i386/isa/ctx.c b/sys/i386/isa/ctx.c
index f1b5953..0fc5f1e 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.30 1999/04/28 10:52:19 dt Exp $
+ * $Id: ctx.c,v 1.31 1999/05/30 16:52:09 phk Exp $
*/
/*
@@ -192,7 +192,10 @@ static int
ctxprobe(struct isa_device * devp)
{
int status;
+ static int once;
+ if (!once++)
+ cdevsw_add(&ctx_cdevsw);
if (inb(devp->id_iobase) == 0xff) /* 0xff only if board absent */
status = 0;
else {
@@ -463,23 +466,4 @@ waitvb(int port)
return (0);
}
-
-
-static int ctx_devsw_installed;
-
-static void
-ctx_drvinit(void *unused)
-{
- dev_t dev;
-
- if( ! ctx_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&ctx_cdevsw,NULL);
- ctx_devsw_installed = 1;
- }
-}
-
-SYSINIT(ctxdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,ctx_drvinit,NULL)
-
-
#endif /* NCTX > 0 */
diff --git a/sys/i386/isa/cx.c b/sys/i386/isa/cx.c
index 7f5624e..2b02732 100644
--- a/sys/i386/isa/cx.c
+++ b/sys/i386/isa/cx.c
@@ -981,13 +981,8 @@ void cxtimeout (void *a)
static int cx_devsw_installed;
static void cx_drvinit(void *unused)
{
- dev_t dev;
- if( ! cx_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&cx_cdevsw,NULL);
- cx_devsw_installed = 1;
- }
+ cdevsw_add(&cx_cdevsw);
}
SYSINIT(cxdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cx_drvinit,NULL)
diff --git a/sys/i386/isa/cy.c b/sys/i386/isa/cy.c
index 70d0466..dd98d7a 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.88 1999/05/28 13:23:21 bde Exp $
+ * $Id: cy.c,v 1.89 1999/05/30 16:52:11 phk Exp $
*/
#include "opt_compat.h"
@@ -541,7 +541,6 @@ cyattach_common(cy_iobase, cy_align)
{
int adapter;
int cyu;
- dev_t dev;
u_char firmware_version;
cy_addr iobase;
int ncyu;
@@ -633,8 +632,7 @@ cyattach_common(cy_iobase, cy_align)
splx(s);
if (!sio_registered) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev, &sio_cdevsw, NULL);
+ cdevsw_add(&sio_cdevsw);
register_swi(SWI_TTY, siopoll);
sio_registered = TRUE;
}
diff --git a/sys/i386/isa/gpib.c b/sys/i386/isa/gpib.c
index cf67cdc..1aff398 100644
--- a/sys/i386/isa/gpib.c
+++ b/sys/i386/isa/gpib.c
@@ -123,7 +123,10 @@ gpprobe(struct isa_device *dvp)
{
int status;
struct gpib_softc *sc = &gpib_sc;
+ static int once;
+ if (!once++)
+ cdevsw_add(&gp_cdevsw);
gpib_port = dvp->id_iobase;
status=1;
@@ -1175,22 +1178,4 @@ outb(CDOR,95); /*untalk*/
}
-
-static int gp_devsw_installed;
-
-static void
-gp_drvinit(void *unused)
-{
- dev_t dev;
-
- if( ! gp_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&gp_cdevsw, NULL);
- gp_devsw_installed = 1;
- }
-}
-
-SYSINIT(gpdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,gp_drvinit,NULL)
-
-
#endif /* NGPIB > 0 */
diff --git a/sys/i386/isa/gsc.c b/sys/i386/isa/gsc.c
index 9ac7b43..48bd5f2 100644
--- a/sys/i386/isa/gsc.c
+++ b/sys/i386/isa/gsc.c
@@ -402,6 +402,10 @@ gscprobe (struct isa_device *isdp)
struct gsc_unit *scu = unittab + unit;
int stb;
struct gsc_geom geom = NEW_GEOM;
+ static int once;
+
+ if (!once++)
+ cdevsw_add(&gsc_cdevsw);
scu->flags = FLAG_DEBUG;
@@ -849,22 +853,4 @@ gscioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
}
}
-
-static int gsc_devsw_installed;
-
-static void
-gsc_drvinit(void *unused)
-{
- dev_t dev;
-
- if( ! gsc_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&gsc_cdevsw, NULL);
- gsc_devsw_installed = 1;
- }
-}
-
-SYSINIT(gscdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,gsc_drvinit,NULL)
-
-
#endif /* NGSC > 0 */
diff --git a/sys/i386/isa/ida.c b/sys/i386/isa/ida.c
index 5e78ec8..919d365 100644
--- a/sys/i386/isa/ida.c
+++ b/sys/i386/isa/ida.c
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: ida.c,v 1.1 1999/05/25 19:45:17 julian Exp $
*
*/
@@ -1733,7 +1733,7 @@ static void
id_drvinit(void *unused)
{
if( ! id_devsw_installed ) {
- cdevsw_add_generic(ID_BDMAJ,ID_CDMAJ, &id_cdevsw);
+ cdevsw_add(&id_cdevsw);
id_devsw_installed = 1;
}
}
diff --git a/sys/i386/isa/istallion.c b/sys/i386/isa/istallion.c
index 0ade414..b93e3ca 100644
--- a/sys/i386/isa/istallion.c
+++ b/sys/i386/isa/istallion.c
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: istallion.c,v 1.27 1999/05/08 07:02:29 phk Exp $
+ * $Id: istallion.c,v 1.28 1999/05/30 16:52:16 phk Exp $
*/
/*****************************************************************************/
@@ -662,21 +662,6 @@ static struct cdevsw stli_cdevsw = {
/* bmaj */ -1
};
-static int stli_devsw_installed;
-
-static void stli_drvinit(void *unused)
-{
- dev_t dev;
-
- if (! stli_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev, &stli_cdevsw, NULL);
- stli_devsw_installed = 1;
- }
-}
-
-SYSINIT(sidev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,stli_drvinit,NULL)
-
#endif
/*****************************************************************************/
@@ -835,6 +820,10 @@ static int stliprobe(struct isa_device *idp)
{
stlibrd_t *brdp;
int btype, bclass;
+ static int once;
+
+ if (!once++)
+ cdevsw_add(&stli_cdevsw);
#if DEBUG
printf("stliprobe(idp=%x): unit=%d iobase=%x flags=%x\n", (int) idp,
diff --git a/sys/i386/isa/joy.c b/sys/i386/isa/joy.c
index 6847f43..a2edbd5 100644
--- a/sys/i386/isa/joy.c
+++ b/sys/i386/isa/joy.c
@@ -120,6 +120,10 @@ static int get_tick __P((void));
static int
joyprobe (struct isa_device *dev)
{
+ static int once;
+
+ if (!once++)
+ cdevsw_add(&joy_cdevsw);
#ifdef WANT_JOYSTICK_CONNECTED
outb (dev->id_iobase, 0xff);
DELAY (10000); /* 10 ms delay */
@@ -251,22 +255,6 @@ get_tick ()
return (high << 8) | low;
}
-
-static int joy_devsw_installed;
-
-static void joy_drvinit(void *unused)
-{
- dev_t dev;
-
- if( ! joy_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&joy_cdevsw,NULL);
- joy_devsw_installed = 1;
- }
-}
-
-SYSINIT(joydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,joy_drvinit,NULL)
-
#ifdef JOY_MODULE
#include <sys/exec.h>
diff --git a/sys/i386/isa/labpc.c b/sys/i386/isa/labpc.c
index 180252b..d1b9798 100644
--- a/sys/i386/isa/labpc.c
+++ b/sys/i386/isa/labpc.c
@@ -417,6 +417,7 @@ labpcinit(void)
bzero(labpcs, NLABPC * sizeof(struct ctlr *));
return 1;
}
+ cdevsw_add(&labpc_cdevsw);
return 0;
}
@@ -1099,21 +1100,3 @@ labpcioctl(dev_t dev, u_long cmd, caddr_t arg, int mode, struct proc *p)
return ENOTTY;
}
}
-
-
-static int labpc_devsw_installed = 0;
-
-static void labpc_drvinit(void *unused)
-{
- dev_t dev;
-
- if( ! labpc_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&labpc_cdevsw,NULL);
- labpc_devsw_installed = 1;
- }
-}
-
-SYSINIT(labpcdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,labpc_drvinit,NULL)
-
-
diff --git a/sys/i386/isa/loran.c b/sys/i386/isa/loran.c
index 2769d41..09e8639 100644
--- a/sys/i386/isa/loran.c
+++ b/sys/i386/isa/loran.c
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id: loran.c,v 1.18 1999/05/08 14:36:48 phk Exp $
+ * $Id: loran.c,v 1.19 1999/05/30 16:52:19 phk Exp $
*
* This device-driver helps the userland controlprogram for a LORAN-C
* receiver avoid monopolizing the CPU.
@@ -196,6 +196,8 @@ struct datapoint {
/**********************************************************************/
+extern struct cdevsw loran_cdevsw;
+
static dphead_t minors[NLORAN], working, holding;
static struct datapoint dummy[NDUMMY];
@@ -233,6 +235,10 @@ extern struct timecounter loran_timecounter;
int
loranprobe(struct isa_device *dvp)
{
+ static int once;
+
+ if (!once++)
+ cdevsw_add(&loran_cdevsw);
/* We need to be a "fast-intr" */
dvp->id_ri_flags |= RI_FAST;
@@ -657,20 +663,4 @@ static struct cdevsw loran_cdevsw = {
/* bmaj */ -1
};
-
-static int loran_devsw_installed;
-
-static void loran_drvinit(void *unused)
-{
- dev_t dev;
-
- if(!loran_devsw_installed) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&loran_cdevsw, NULL);
- loran_devsw_installed = 1;
- }
-}
-
-SYSINIT(lorandev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,loran_drvinit,NULL)
-
#endif /* KERNEL */
diff --git a/sys/i386/isa/matcd/matcd.c b/sys/i386/isa/matcd/matcd.c
index fb4a261..102aff8 100644
--- a/sys/i386/isa/matcd/matcd.c
+++ b/sys/i386/isa/matcd/matcd.c
@@ -337,7 +337,7 @@ static char MATCDVERSION[]="Version 1(26) 18-Oct-95";
static char MATCDCOPYRIGHT[] = "Matsushita CD-ROM driver, Copr. 1994,1995 Frank Durda IV";
/* The proceeding strings may not be changed*/
-/* $Id: matcd.c,v 1.39 1999/05/07 07:03:36 phk Exp $ */
+/* $Id: matcd.c,v 1.40 1999/05/30 16:52:35 phk Exp $ */
/*---------------------------------------------------------------------------
Include declarations
@@ -1214,7 +1214,10 @@ matcd_probe(struct isa_device *dev)
int i,cdrive;
unsigned char y;
int port = dev->id_iobase; /*Take port hint from config file*/
+ static int once;
+ if (!once++)
+ cdevsw_add(&matcd_cdevsw);
cdrive=nextcontroller; /*Controller defined by pass for now*/
if (nextcontroller==NUMCTRLRS) {
printf("matcdc%d: - Too many interfaces specified in config\n",
@@ -2737,21 +2740,5 @@ static int matcd_igot(struct ioc_capability * sqp)
audio are here*/
#endif /*FULLDRIVER*/
-
-static int matcd_devsw_installed;
-
-static void
-matcd_drvinit(void *unused)
-{
-
- if( ! matcd_devsw_installed ) {
- cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &matcd_cdevsw);
- matcd_devsw_installed = 1;
- }
-}
-
-SYSINIT(matcddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,matcd_drvinit,NULL)
-
-
/*End of matcd.c*/
diff --git a/sys/i386/isa/mcd.c b/sys/i386/isa/mcd.c
index c57a675..17e9b0c 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.106 1999/05/08 07:02:30 phk Exp $
+ * $Id: mcd.c,v 1.107 1999/05/30 16:52:19 phk Exp $
*/
static const char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
@@ -756,6 +756,10 @@ mcd_probe(struct isa_device *dev)
int unit = dev->id_unit;
int i, j;
unsigned char stbytes[3];
+ static int once;
+
+ if (!once++)
+ cdevsw_add(&mcd_cdevsw);
mcd_data[unit].flags = MCDPROBING;
@@ -1856,19 +1860,4 @@ mcd_resume(int unit)
return mcd_play(unit, &cd->lastpb);
}
-
-static int mcd_devsw_installed;
-
-static void mcd_drvinit(void *unused)
-{
-
- if( ! mcd_devsw_installed ) {
- cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &mcd_cdevsw);
- mcd_devsw_installed = 1;
- }
-}
-
-SYSINIT(mcddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,mcd_drvinit,NULL)
-
-
#endif /* NMCD > 0 */
diff --git a/sys/i386/isa/mse.c b/sys/i386/isa/mse.c
index b70cf15..a8676bc 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.42 1999/05/06 18:44:02 peter Exp $
+ * $Id: mse.c,v 1.43 1999/05/30 16:52:20 phk Exp $
*/
/*
* Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and
@@ -248,7 +248,10 @@ mseprobe(idp)
{
register struct mse_softc *sc = &mse_sc[idp->id_unit];
register int i;
+ static int once;
+ if (!once++)
+ cdevsw_add(&mse_cdevsw);
/*
* Check for each mouse type in the table.
*/
@@ -788,20 +791,4 @@ mse_getati(port, dx, dy, but)
outb(port + MSE_PORTB, MSE_INPORT_INTREN);
}
-static int mse_devsw_installed;
-
-static void mse_drvinit(void *unused)
-{
- dev_t dev;
-
- if( ! mse_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&mse_cdevsw, NULL);
- mse_devsw_installed = 1;
- }
-}
-
-SYSINIT(msedev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,mse_drvinit,NULL)
-
-
#endif /* NMSE */
diff --git a/sys/i386/isa/pcaudio.c b/sys/i386/isa/pcaudio.c
index c44bc55..8ed04da 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.48 1999/05/06 18:58:05 peter Exp $
+ * $Id: pcaudio.c,v 1.49 1999/05/30 16:52:21 phk Exp $
*/
#include "pca.h"
@@ -204,6 +204,7 @@ pca_volume(int volume)
static void
pca_init(void)
{
+ cdevsw_add(&pca_cdevsw);
pca_status.open = 0;
pca_status.queries = 0;
pca_status.timer_on = 0;
@@ -565,19 +566,4 @@ pcapoll(dev_t dev, int events, struct proc *p)
return (revents);
}
-static int pca_devsw_installed;
-
-static void pca_drvinit(void *unused)
-{
- dev_t dev;
-
- if( ! pca_devsw_installed ) {
- 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
diff --git a/sys/i386/isa/pcvt/pcvt_drv.c b/sys/i386/isa/pcvt/pcvt_drv.c
index aad4fed..a0dd214 100644
--- a/sys/i386/isa/pcvt/pcvt_drv.c
+++ b/sys/i386/isa/pcvt/pcvt_drv.c
@@ -386,11 +386,7 @@ pcattach(struct isa_device *dev)
async_update(UPDATE_START); /* start asynchronous updates */
#if PCVT_FREEBSD > 205
- {
- dev_t dev = makedev(CDEV_MAJOR, 0);
-
- cdevsw_add(&dev, &pc_cdevsw, NULL);
- }
+ cdevsw_add(&pc_cdevsw);
#ifdef DEVFS
for(vt = 0; vt < MAXCONS; vt++) {
diff --git a/sys/i386/isa/rc.c b/sys/i386/isa/rc.c
index fdcbcf6..8e0fdc5 100644
--- a/sys/i386/isa/rc.c
+++ b/sys/i386/isa/rc.c
@@ -213,6 +213,10 @@ rcprobe(dvp)
{
int irq = ffs(dvp->id_irq) - 1;
register int nec = dvp->id_iobase;
+ static int once;
+
+ if (!once++)
+ cdevsw_add(&rc_cdevsw);
if (dvp->id_unit > NRC)
return 0;
@@ -1510,20 +1514,4 @@ rc_wait0(nec, unit, chan, line)
unit, chan, line);
}
-static int rc_devsw_installed;
-
-static void rc_drvinit(void *unused)
-{
- dev_t dev;
-
- if( ! rc_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&rc_cdevsw, NULL);
- rc_devsw_installed = 1;
- }
-}
-
-SYSINIT(rcdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,rc_drvinit,NULL)
-
-
#endif /* NRC */
diff --git a/sys/i386/isa/rp.c b/sys/i386/isa/rp.c
index a3c2382..c1913a0 100644
--- a/sys/i386/isa/rp.c
+++ b/sys/i386/isa/rp.c
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: rp.c,v 1.26 1999/05/09 17:07:20 peter Exp $
+ * $Id: rp.c,v 1.27 1999/05/30 16:52:22 phk Exp $
*/
/*
@@ -1085,7 +1085,6 @@ struct isa_device *dev;
static void
rp_pciattach(pcici_t tag, int unit)
{
- dev_t rp_dev;
int success, oldspl;
u_short iobase;
int num_ports, num_chan, num_aiops;
@@ -1140,8 +1139,7 @@ rp_pciattach(pcici_t tag, int unit)
rp_addr(unit) = rp;
splx(oldspl);
- rp_dev = makedev(CDEV_MAJOR, unit);
- cdevsw_add(&rp_dev, &rp_cdevsw, NULL);
+ cdevsw_add(&rp_cdevsw);
port = 0;
for(aiop=0; aiop < num_aiops; aiop++) {
@@ -1196,7 +1194,6 @@ int
rpattach(dev)
struct isa_device *dev;
{
- dev_t rp_dev;
int iobase, unit, /*rpmajor,*/ oldspl;
int num_ports, num_chan, num_aiops;
int aiop, chan, port;
@@ -1252,8 +1249,7 @@ struct isa_device *dev;
rp_addr(unit) = rp;
splx(oldspl);
- rp_dev = makedev(CDEV_MAJOR, unit);
- cdevsw_add(&rp_dev, &rp_cdevsw, NULL);
+ cdevsw_add(&rp_cdevsw);
port = 0;
for(aiop=0; aiop < num_aiops; aiop++) {
diff --git a/sys/i386/isa/scd.c b/sys/i386/isa/scd.c
index 24af2e1..ff4832d 100644
--- a/sys/i386/isa/scd.c
+++ b/sys/i386/isa/scd.c
@@ -41,7 +41,7 @@
*/
-/* $Id: scd.c,v 1.45 1999/05/09 20:29:04 phk Exp $ */
+/* $Id: scd.c,v 1.46 1999/05/30 16:52:24 phk Exp $ */
/* Please send any comments to micke@dynas.se */
@@ -718,6 +718,10 @@ scd_probe(struct isa_device *dev)
static char namebuf[8+16+8+3];
char *s = namebuf;
int loop_count = 0;
+ static int once;
+
+ if (!once++)
+ cdevsw_add(&scd_cdevsw);
scd_data[unit].flags = SCDPROBING;
scd_data[unit].iobase = dev->id_iobase;
@@ -1574,19 +1578,4 @@ scd_toc_entry (int unit, struct ioc_read_toc_single_entry *te)
return 0;
}
-
-static int scd_devsw_installed;
-
-static void scd_drvinit(void *unused)
-{
-
- if( ! scd_devsw_installed ) {
- cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &scd_cdevsw);
- scd_devsw_installed = 1;
- }
-}
-
-SYSINIT(scddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,scd_drvinit,NULL)
-
-
#endif /* NSCD > 0 */
diff --git a/sys/i386/isa/si.c b/sys/i386/isa/si.c
index 0565390..18d8377 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.85 1999/05/09 17:07:21 peter Exp $
+ * $Id: si.c,v 1.86 1999/05/30 16:52:25 phk Exp $
*/
#ifndef lint
@@ -2832,13 +2832,8 @@ static int si_devsw_installed;
static void
si_drvinit(void *unused)
{
- dev_t dev;
- if (!si_devsw_installed) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&si_cdevsw, NULL);
- si_devsw_installed = 1;
- }
+ cdevsw_add(&si_cdevsw);
}
SYSINIT(sidev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,si_drvinit,NULL)
diff --git a/sys/i386/isa/snd/sound.c b/sys/i386/isa/snd/sound.c
index f4be1a6..6737ee5 100644
--- a/sys/i386/isa/snd/sound.c
+++ b/sys/i386/isa/snd/sound.c
@@ -340,10 +340,8 @@ pcminit(snddev_info *d, int unit)
#ifdef DEVFS
void *cookie;
#endif
- dev_t isadev;
- isadev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&isadev, &snd_cdevsw, NULL);
+ cdevsw_add(&snd_cdevsw);
/*
* initialize standard parameters for the device. This can be
diff --git a/sys/i386/isa/sound/soundcard.c b/sys/i386/isa/sound/soundcard.c
index 0d122ae..0c97f90 100644
--- a/sys/i386/isa/sound/soundcard.c
+++ b/sys/i386/isa/sound/soundcard.c
@@ -507,12 +507,7 @@ sndattach(struct isa_device * dev)
sequencer_init();
}
- {
- dev_t dev;
-
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev, &snd_cdevsw, NULL);
- }
+ cdevsw_add(&snd_cdevsw);
#ifdef DEVFS
#define GID_SND GID_GAMES
#define UID_SND UID_ROOT
diff --git a/sys/i386/isa/spigot.c b/sys/i386/isa/spigot.c
index 4c8f15d..b2ce86d 100644
--- a/sys/i386/isa/spigot.c
+++ b/sys/i386/isa/spigot.c
@@ -131,6 +131,10 @@ spigot_probe(struct isa_device *devp)
{
int status;
struct spigot_softc *ss=(struct spigot_softc *)&spigot_softc[devp->id_unit];
+static int once;
+
+ if (!once++)
+ cdevsw_add(&spigot_cdevsw);
ss->flags = 0;
ss->maddr = 0;
@@ -291,21 +295,4 @@ struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[0];
return i386_btop(ss->maddr);
}
-
-static int spigot_devsw_installed;
-
-static void spigot_drvinit(void *unused)
-{
- dev_t dev;
-
- if( ! spigot_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&spigot_cdevsw, NULL);
- spigot_devsw_installed = 1;
- }
-}
-
-SYSINIT(spigotdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,spigot_drvinit,NULL)
-
-
#endif /* NSPIGOT */
diff --git a/sys/i386/isa/spkr.c b/sys/i386/isa/spkr.c
index 759a9fc..f594b8b 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.35 1998/08/24 02:28:16 bde Exp $
+ * $Id: spkr.c,v 1.36 1999/05/30 16:52:27 phk Exp $
*/
#include "speaker.h"
@@ -601,24 +601,14 @@ spkrioctl(dev, cmd, cmdarg, flags, p)
return(EINVAL);
}
-
-static int spkr_devsw_installed;
-
static void
spkr_drvinit(void *unused)
{
- dev_t dev;
-
- if( ! spkr_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&spkr_cdevsw, NULL);
- spkr_devsw_installed = 1;
+ cdevsw_add(&spkr_cdevsw);
#ifdef DEVFS
- devfs_token = devfs_add_devswf(&spkr_cdevsw, 0, DV_CHR,
- UID_ROOT, GID_WHEEL, 0600,
- "speaker");
+ devfs_token = devfs_add_devswf(&spkr_cdevsw, 0, DV_CHR,
+ UID_ROOT, GID_WHEEL, 0600, "speaker");
#endif
- }
}
SYSINIT(spkrdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,spkr_drvinit,NULL)
diff --git a/sys/i386/isa/stallion.c b/sys/i386/isa/stallion.c
index 91cec5d..d817409 100644
--- a/sys/i386/isa/stallion.c
+++ b/sys/i386/isa/stallion.c
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: stallion.c,v 1.31 1999/05/09 17:07:22 peter Exp $
+ * $Id: stallion.c,v 1.32 1999/05/30 16:52:27 phk Exp $
*/
/*****************************************************************************/
@@ -561,13 +561,8 @@ static int stl_devsw_installed;
static void stl_drvinit(void *unused)
{
- dev_t dev;
- if (! stl_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev, &stl_cdevsw, NULL);
- stl_devsw_installed = 1;
- }
+ cdevsw_add(&stl_cdevsw);
}
SYSINIT(sidev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,stl_drvinit,NULL)
diff --git a/sys/i386/isa/tw.c b/sys/i386/isa/tw.c
index 3385a85..c7de9d3 100644
--- a/sys/i386/isa/tw.c
+++ b/sys/i386/isa/tw.c
@@ -359,7 +359,10 @@ static int twprobe(idp)
struct tw_sc sc;
int d;
int tries;
+ static int once;
+ if (!once++)
+ cdevsw_add(&tw_cdevsw);
sc.sc_port = idp->id_iobase;
/* Search for the zero crossing signal at ports, bit combinations. */
tw_zcport = tw_control;
@@ -1168,21 +1171,4 @@ static int twchecktime(int target, int tol)
}
#endif /* HIRESTIME */
-
-static int tw_devsw_installed;
-
-static void tw_drvinit(void *unused)
-{
- dev_t dev;
-
- if( ! tw_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&tw_cdevsw, NULL);
- tw_devsw_installed = 1;
- }
-}
-
-SYSINIT(twdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,tw_drvinit,NULL)
-
-
#endif /* NTW */
diff --git a/sys/i386/isa/wd.c b/sys/i386/isa/wd.c
index 78ad4e6..6a5100a 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.197 1999/05/08 18:13:15 peter Exp $
+ * $Id: wd.c,v 1.198 1999/05/30 16:52:29 phk Exp $
*/
/* TODO:
@@ -2386,17 +2386,12 @@ wdwait(struct disk *du, u_char bits_wanted, int timeout)
return (-1);
}
-static int wd_devsw_installed;
-
static void wd_drvinit(void *unused)
{
- if( ! wd_devsw_installed ) {
- if (wd_cdevsw.d_maxio == 0)
- wd_cdevsw.d_maxio = 248 * 512;
- cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &wd_cdevsw);
- wd_devsw_installed = 1;
- }
+ if (wd_cdevsw.d_maxio == 0)
+ wd_cdevsw.d_maxio = 248 * 512;
+ cdevsw_add(&wd_cdevsw);
}
SYSINIT(wddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,wd_drvinit,NULL)
diff --git a/sys/i386/isa/wd_cd.c b/sys/i386/isa/wd_cd.c
index 644fb3f..0613e7e 100644
--- a/sys/i386/isa/wd_cd.c
+++ b/sys/i386/isa/wd_cd.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: atapi-cd.c,v 1.18 1999/05/11 10:39:27 sos Exp $
+ * $Id: atapi-cd.c,v 1.19 1999/05/30 16:52:08 phk Exp $
*/
#include "wdc.h"
@@ -1496,15 +1496,10 @@ atapi_dump(int ctrlr, int lun, char *label, void *data, int len)
printf ("\n");
}
-static int acd_devsw_installed;
-
static void
acd_drvinit(void *unused)
{
- if (!acd_devsw_installed) {
- cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &acd_cdevsw);
- acd_devsw_installed = 1;
- }
+ cdevsw_add(&acd_cdevsw);
}
SYSINIT(acddev, SI_SUB_DRIVERS, SI_ORDER_MIDDLE + CDEV_MAJOR, acd_drvinit, NULL)
diff --git a/sys/i386/isa/wfd.c b/sys/i386/isa/wfd.c
index d03a201..d053cb8 100644
--- a/sys/i386/isa/wfd.c
+++ b/sys/i386/isa/wfd.c
@@ -23,7 +23,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: wfd.c,v 1.23 1999/05/07 07:03:31 phk Exp $
+ * $Id: wfd.c,v 1.24 1999/05/30 16:52:30 phk Exp $
*/
/*
@@ -765,17 +765,11 @@ static int wfd_eject (struct wfd *t, int closeit)
0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0);
}
-static int wfd_devsw_installed;
-
static void wfd_drvinit(void *unused)
{
- if( ! wfd_devsw_installed ) {
- cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &wfd_cdevsw);
- wfd_devsw_installed = 1;
- }
+ cdevsw_add(&wfd_cdevsw);
}
SYSINIT(wfddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,wfd_drvinit,NULL)
-
#endif /* NWFD && NWDC */
diff --git a/sys/i386/isa/wst.c b/sys/i386/isa/wst.c
index 82832d4..94d4146 100644
--- a/sys/i386/isa/wst.c
+++ b/sys/i386/isa/wst.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: wst.c,v 1.21 1999/05/07 07:03:32 phk Exp $
+ * $Id: wst.c,v 1.22 1999/05/30 16:52:30 phk Exp $
*/
#include "wdc.h"
@@ -787,18 +787,10 @@ wst_reset(struct wst *t)
DELAY(30);
}
-static int wst_devsw_installed;
-
static void
wst_drvinit(void *unused)
{
- if (!wst_devsw_installed) {
- dev_t dev;
-
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev, &wst_cdevsw, NULL);
- wst_devsw_installed = 1;
- }
+ cdevsw_add(&wst_cdevsw);
}
SYSINIT(wstdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,wst_drvinit,NULL)
diff --git a/sys/i386/isa/wt.c b/sys/i386/isa/wt.c
index 650cc0b..73ccab3 100644
--- a/sys/i386/isa/wt.c
+++ b/sys/i386/isa/wt.c
@@ -20,7 +20,7 @@
* the original CMU copyright notice.
*
* Version 1.3, Thu Nov 11 12:09:13 MSK 1993
- * $Id: wt.c,v 1.50 1999/05/07 07:03:33 phk Exp $
+ * $Id: wt.c,v 1.51 1999/05/30 16:52:31 phk Exp $
*
*/
@@ -223,6 +223,10 @@ static int
wtprobe (struct isa_device *id)
{
wtinfo_t *t = wttab + id->id_unit;
+ static int once;
+
+ if (!once++)
+ cdevsw_add(&wt_cdevsw);
t->unit = id->id_unit;
t->chan = id->id_drq;
@@ -993,23 +997,4 @@ wtstatus (wtinfo_t *t)
return (1);
}
-
-static int wt_devsw_installed;
-
-static void
-wt_drvinit(void *unused)
-{
-
- if( ! wt_devsw_installed ) {
- dev_t dev;
-
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev, &wt_cdevsw, NULL);
- wt_devsw_installed = 1;
- }
-}
-
-SYSINIT(wtdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,wt_drvinit,NULL)
-
-
#endif /* NWT */
diff --git a/sys/isa/joy.c b/sys/isa/joy.c
index 6847f43..a2edbd5 100644
--- a/sys/isa/joy.c
+++ b/sys/isa/joy.c
@@ -120,6 +120,10 @@ static int get_tick __P((void));
static int
joyprobe (struct isa_device *dev)
{
+ static int once;
+
+ if (!once++)
+ cdevsw_add(&joy_cdevsw);
#ifdef WANT_JOYSTICK_CONNECTED
outb (dev->id_iobase, 0xff);
DELAY (10000); /* 10 ms delay */
@@ -251,22 +255,6 @@ get_tick ()
return (high << 8) | low;
}
-
-static int joy_devsw_installed;
-
-static void joy_drvinit(void *unused)
-{
- dev_t dev;
-
- if( ! joy_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&joy_cdevsw,NULL);
- joy_devsw_installed = 1;
- }
-}
-
-SYSINIT(joydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,joy_drvinit,NULL)
-
#ifdef JOY_MODULE
#include <sys/exec.h>
diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c
index 1de8b40..907c138 100644
--- a/sys/isofs/cd9660/cd9660_vfsops.c
+++ b/sys/isofs/cd9660/cd9660_vfsops.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95
- * $Id: cd9660_vfsops.c,v 1.54 1999/05/07 10:10:46 phk Exp $
+ * $Id: cd9660_vfsops.c,v 1.55 1999/05/08 06:39:32 phk Exp $
*/
#include <sys/param.h>
@@ -225,8 +225,7 @@ cd9660_mount(mp, path, data, ndp, p)
vrele(devvp);
return ENOTBLK;
}
- if (major(devvp->v_rdev) >= nblkdev ||
- bdevsw(devvp->v_rdev) == NULL) {
+ if (bdevsw(devvp->v_rdev) == NULL) {
vrele(devvp);
return ENXIO;
}
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c
index ecf5ffd..b09b04c 100644
--- a/sys/kern/kern_conf.c
+++ b/sys/kern/kern_conf.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: kern_conf.c,v 1.39 1999/05/12 13:06:34 phk Exp $
+ * $Id: kern_conf.c,v 1.40 1999/05/18 13:14:43 luoqi Exp $
*/
#include <sys/param.h>
@@ -39,14 +39,11 @@
#include <sys/conf.h>
#include <sys/vnode.h>
-#define NUMCDEV 256
-#define cdevsw_ALLOCSTART (NUMCDEV/2)
+#define cdevsw_ALLOCSTART (NUMCDEVSW/2)
-struct cdevsw *cdevsw[NUMCDEV];
-int nchrdev = NUMCDEV;
+struct cdevsw *cdevsw[NUMCDEVSW];
-int bmaj2cmaj[NUMCDEV];
-int nblkdev = NUMCDEV;
+int bmaj2cmaj[NUMCDEVSW];
/*
* Routine to convert from character to block device number.
@@ -65,66 +62,64 @@ chrtoblk(dev_t dev)
return(NODEV);
}
+struct cdevsw *
+devsw(dev_t dev)
+{
+ return(cdevsw[major(dev)]);
+}
+
+struct cdevsw *
+bdevsw(dev_t dev)
+{
+ struct cdevsw *c;
+ int i = major(dev);
+
+ if (bmaj2cmaj[i] == 254)
+ return 0;
+
+ c = cdevsw[bmaj2cmaj[major(dev)]];
+ if (!c) {
+ printf("bogus bdev dev_t %p, no cdev\n", (void *)dev);
+ Debugger("Bummer");
+ return 0;
+ }
+ /* CMAJ zero is the console, which has no strategy so this works */
+ if (c->d_strategy)
+ return (c);
+ return (0);
+}
+
+/*
+ * Add a cdevsw entry
+ */
+
int
-cdevsw_add(dev_t *descrip,
- struct cdevsw *newentry,
- struct cdevsw **oldentry)
+cdevsw_add(struct cdevsw *newentry)
{
int i;
static int setup;
if (!setup) {
- for (i = 0; i < NUMCDEV; i++)
+ for (i = 0; i < NUMCDEVSW; i++)
if (!bmaj2cmaj[i])
bmaj2cmaj[i] = 254;
setup++;
}
- if ( *descrip == NODEV) { /* auto (0 is valid) */
- /*
- * Search the table looking for a slot...
- */
- for (i = cdevsw_ALLOCSTART; i < nchrdev; i++)
- if (cdevsw[i] == NULL)
- break; /* found one! */
- /* out of allocable slots? */
- if (i >= nchrdev) {
- return ENFILE;
- }
- } else { /* assign */
- i = major(*descrip);
- if (i < 0 || i >= nchrdev) {
- return EINVAL;
- }
+ if (newentry->d_maj < 0 || newentry->d_maj >= NUMCDEVSW) {
+ printf("%s: ERROR: driver has bogus cdevsw->d_maj = %d\n",
+ newentry->d_name, newentry->d_maj);
+ return EINVAL;
}
- /* maybe save old */
- if (oldentry) {
- *oldentry = cdevsw[i];
- }
- if (newentry) {
- newentry->d_bmaj = -1;
- newentry->d_maj = i;
- }
- /* replace with new */
- cdevsw[i] = newentry;
+ cdevsw[newentry->d_maj] = newentry;
+
+ if (newentry->d_bmaj >= 0 || newentry->d_bmaj < NUMCDEVSW)
+ bmaj2cmaj[newentry->d_bmaj] = newentry->d_maj;
- /* done! let them know where we put it */
- *descrip = makedev(i,0);
return 0;
}
-void
-cdevsw_add_generic(int bmaj, int cmaj, struct cdevsw *devsw)
-{
- dev_t dev;
-
- dev = makedev(cmaj, 0);
- cdevsw_add(&dev, devsw, NULL);
- cdevsw[cmaj]->d_bmaj = bmaj;
- bmaj2cmaj[bmaj] = cmaj;
-}
-
int
devsw_module_handler(module_t mod, int what, void* arg)
{
@@ -137,7 +132,7 @@ devsw_module_handler(module_t mod, int what, void* arg)
data->cdev = makedev(data->cmaj, 0);
switch (what) {
case MOD_LOAD:
- error = cdevsw_add(&data->cdev, data->cdevsw, NULL);
+ error = cdevsw_add(data->cdevsw);
if (!error && data->cdevsw->d_strategy != nostrategy) {
if (data->bmaj == NOMAJ) {
data->bdev = data->cdev;
@@ -160,7 +155,6 @@ devsw_module_handler(module_t mod, int what, void* arg)
}
if (data->cdevsw->d_strategy != nostrategy)
bmaj2cmaj[major(data->bdev)] = 0;
- error = cdevsw_add(&data->cdev, NULL, NULL);
return error;
}
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 11d5305..cc96d70 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.61 1999/05/11 19:54:28 phk Exp $
+ * $Id: kern_descrip.c,v 1.62 1999/05/30 16:52:54 phk Exp $
*/
#include "opt_compat.h"
@@ -1294,14 +1294,12 @@ static void *devfs_token_fildesc[NUMFDESC];
static void fildesc_drvinit(void *unused)
{
- dev_t dev;
#ifdef DEVFS
int fd;
#endif
if( ! fildesc_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&fildesc_cdevsw,NULL);
+ cdevsw_add(&fildesc_cdevsw);
fildesc_devsw_installed = 1;
#ifdef DEVFS
for (fd = 0; fd < NUMFDESC; fd++)
diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c
index 67a7d65..9f6b84f 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.34 1999/05/06 18:12:46 peter Exp $
+ * $Id: subr_log.c,v 1.35 1999/05/30 16:52:56 phk Exp $
*/
/*
@@ -274,11 +274,9 @@ static void
log_drvinit(unused)
void *unused;
{
- dev_t dev;
if( ! log_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&log_cdevsw,NULL);
+ cdevsw_add(&log_cdevsw);
log_devsw_installed = 1;
#ifdef DEVFS
log_devfs_token = devfs_add_devswf(&log_cdevsw, 0, DV_CHR,
diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c
index 6b7efb4..acc8503 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.65 1999/05/08 06:39:20 phk Exp $
+ * $Id: cons.c,v 1.66 1999/05/30 16:52:03 phk Exp $
*/
#include "opt_devfs.h"
@@ -433,11 +433,9 @@ static int cn_devsw_installed;
static void
cn_drvinit(void *unused)
{
- dev_t dev;
if( ! cn_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&cn_cdevsw,NULL);
+ cdevsw_add(&cn_cdevsw);
cn_devsw_installed = 1;
#ifdef DEVFS
cn_devfs_token = devfs_add_devswf(&cn_cdevsw, 0, DV_CHR,
diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c
index 535df84..5a999c3 100644
--- a/sys/kern/tty_pty.c
+++ b/sys/kern/tty_pty.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tty_pty.c 8.4 (Berkeley) 2/20/95
- * $Id: tty_pty.c,v 1.59 1999/05/18 14:53:52 luoqi Exp $
+ * $Id: tty_pty.c,v 1.60 1999/05/30 16:52:57 phk Exp $
*/
/*
@@ -843,13 +843,10 @@ ptc_drvinit(unused)
#ifdef DEVFS
int i,j,k;
#endif
- dev_t dev;
if( ! ptc_devsw_installed ) {
- dev = makedev(CDEV_MAJOR_S, 0);
- cdevsw_add(&dev, &pts_cdevsw, NULL);
- dev = makedev(CDEV_MAJOR_C, 0);
- cdevsw_add(&dev, &ptc_cdevsw, NULL);
+ cdevsw_add(&pts_cdevsw);
+ cdevsw_add(&ptc_cdevsw);
ptc_devsw_installed = 1;
#ifdef DEVFS
for ( i = 0 ; i<NPTY ; i++ ) {
diff --git a/sys/kern/tty_snoop.c b/sys/kern/tty_snoop.c
index 8b45c8a..d9f9897 100644
--- a/sys/kern/tty_snoop.c
+++ b/sys/kern/tty_snoop.c
@@ -83,11 +83,7 @@ snpdevtotty (dev)
dev_t dev;
{
struct cdevsw *cdp;
- int maj;
- maj = major(dev);
- if ((u_int)maj >= nchrdev)
- return (NULL);
cdp = devsw(dev);
if (cdp == NULL)
return (NULL);
@@ -533,14 +529,12 @@ static void
snp_drvinit(unused)
void *unused;
{
- dev_t dev;
#ifdef DEVFS
int i;
#endif
if( ! snp_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&snp_cdevsw, NULL);
+ cdevsw_add(&snp_cdevsw);
snp_devsw_installed = 1;
#ifdef DEVFS
for ( i = 0 ; i < NSNP ; i++) {
diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c
index 693387d..fd88fcd 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.25 1998/08/23 08:26:42 bde Exp $
+ * $Id: tty_tty.c,v 1.26 1999/05/30 16:53:00 phk Exp $
*/
/*
@@ -203,11 +203,9 @@ static void
ctty_drvinit(unused)
void *unused;
{
- dev_t dev;
if( ! ctty_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&ctty_cdevsw,NULL);
+ cdevsw_add(&ctty_cdevsw);
ctty_devsw_installed = 1;
#ifdef DEVFS
ctty_devfs_token =
diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c
index f32aaf0..b154300 100644
--- a/sys/kern/vfs_export.c
+++ b/sys/kern/vfs_export.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
- * $Id: vfs_subr.c,v 1.198 1999/05/14 20:40:15 luoqi Exp $
+ * $Id: vfs_subr.c,v 1.199 1999/05/24 00:34:10 jb Exp $
*/
/*
@@ -324,11 +324,11 @@ vfs_getnewfsid(mp)
simple_lock(&mntid_slock);
mtype = mp->mnt_vfc->vfc_typenum;
- mp->mnt_stat.f_fsid.val[0] = (nblkdev + mtype) * 256;
+ mp->mnt_stat.f_fsid.val[0] = (256 + mtype) * 256;
mp->mnt_stat.f_fsid.val[1] = mtype;
if (xxxfs_mntid == 0)
++xxxfs_mntid;
- tfsid.val[0] = (nblkdev + mtype) * 256 | xxxfs_mntid;
+ tfsid.val[0] = (256 + mtype) * 256 | xxxfs_mntid;
tfsid.val[1] = mtype;
if (mountlist.cqh_first != (void *)&mountlist) {
while (vfs_getvfs(&tfsid)) {
@@ -1175,7 +1175,7 @@ bdevvp(dev, vpp)
struct vnode *nvp;
int error;
- if (dev == NODEV || major(dev) >= nblkdev) {
+ if (dev == NODEV) {
*vpp = NULLVP;
return (ENXIO);
}
@@ -1211,7 +1211,6 @@ checkalias(nvp, nvp_rdev, mp)
struct proc *p = curproc; /* XXX */
struct vnode *vp;
struct vnode **vpp;
- int rmaj = umajor(nvp_rdev);
dev_t dev;
if (nvp->v_type != VBLK && nvp->v_type != VCHR)
@@ -1275,10 +1274,10 @@ loop:
* si_bsize_* parameters may need fixing up.
*/
- if (nvp->v_type == VBLK && rmaj < nblkdev) {
+ if (nvp->v_type == VBLK) {
if (bdevsw(dev) && bdevsw(dev)->d_parms)
(*bdevsw(dev)->d_parms)(dev, sinfo, DPARM_GET);
- } else if (nvp->v_type == VCHR && rmaj < nchrdev) {
+ } else if (nvp->v_type == VCHR) {
if (devsw(dev) && devsw(dev)->d_parms)
(*devsw(dev)->d_parms)(dev, sinfo, DPARM_GET);
}
@@ -2584,8 +2583,7 @@ retry:
if ((error = VOP_GETATTR(vp, &vat, cred, p)) != 0)
goto retn;
object = vnode_pager_alloc(vp, vat.va_size, 0, 0);
- } else if (major(vp->v_rdev) < nblkdev &&
- bdevsw(vp->v_rdev) != NULL) {
+ } else if (bdevsw(vp->v_rdev) != NULL) {
/*
* This simply allocates the biggest object possible
* for a VBLK vnode. This should be fixed, but doesn't
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index f32aaf0..b154300 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
- * $Id: vfs_subr.c,v 1.198 1999/05/14 20:40:15 luoqi Exp $
+ * $Id: vfs_subr.c,v 1.199 1999/05/24 00:34:10 jb Exp $
*/
/*
@@ -324,11 +324,11 @@ vfs_getnewfsid(mp)
simple_lock(&mntid_slock);
mtype = mp->mnt_vfc->vfc_typenum;
- mp->mnt_stat.f_fsid.val[0] = (nblkdev + mtype) * 256;
+ mp->mnt_stat.f_fsid.val[0] = (256 + mtype) * 256;
mp->mnt_stat.f_fsid.val[1] = mtype;
if (xxxfs_mntid == 0)
++xxxfs_mntid;
- tfsid.val[0] = (nblkdev + mtype) * 256 | xxxfs_mntid;
+ tfsid.val[0] = (256 + mtype) * 256 | xxxfs_mntid;
tfsid.val[1] = mtype;
if (mountlist.cqh_first != (void *)&mountlist) {
while (vfs_getvfs(&tfsid)) {
@@ -1175,7 +1175,7 @@ bdevvp(dev, vpp)
struct vnode *nvp;
int error;
- if (dev == NODEV || major(dev) >= nblkdev) {
+ if (dev == NODEV) {
*vpp = NULLVP;
return (ENXIO);
}
@@ -1211,7 +1211,6 @@ checkalias(nvp, nvp_rdev, mp)
struct proc *p = curproc; /* XXX */
struct vnode *vp;
struct vnode **vpp;
- int rmaj = umajor(nvp_rdev);
dev_t dev;
if (nvp->v_type != VBLK && nvp->v_type != VCHR)
@@ -1275,10 +1274,10 @@ loop:
* si_bsize_* parameters may need fixing up.
*/
- if (nvp->v_type == VBLK && rmaj < nblkdev) {
+ if (nvp->v_type == VBLK) {
if (bdevsw(dev) && bdevsw(dev)->d_parms)
(*bdevsw(dev)->d_parms)(dev, sinfo, DPARM_GET);
- } else if (nvp->v_type == VCHR && rmaj < nchrdev) {
+ } else if (nvp->v_type == VCHR) {
if (devsw(dev) && devsw(dev)->d_parms)
(*devsw(dev)->d_parms)(dev, sinfo, DPARM_GET);
}
@@ -2584,8 +2583,7 @@ retry:
if ((error = VOP_GETATTR(vp, &vat, cred, p)) != 0)
goto retn;
object = vnode_pager_alloc(vp, vat.va_size, 0, 0);
- } else if (major(vp->v_rdev) < nblkdev &&
- bdevsw(vp->v_rdev) != NULL) {
+ } else if (bdevsw(vp->v_rdev) != NULL) {
/*
* This simply allocates the biggest object possible
* for a VBLK vnode. This should be fixed, but doesn't
diff --git a/sys/miscfs/fdesc/fdesc_vnops.c b/sys/miscfs/fdesc/fdesc_vnops.c
index 6bdea5f..2d7dc39 100644
--- a/sys/miscfs/fdesc/fdesc_vnops.c
+++ b/sys/miscfs/fdesc/fdesc_vnops.c
@@ -35,7 +35,7 @@
*
* @(#)fdesc_vnops.c 8.9 (Berkeley) 1/21/94
*
- * $Id: fdesc_vnops.c,v 1.40 1998/12/14 05:00:57 dillon Exp $
+ * $Id: fdesc_vnops.c,v 1.41 1999/01/27 22:42:06 dillon Exp $
*/
/*
@@ -105,7 +105,7 @@ fdesc_init(vfsp)
struct vfsconf *vfsp;
{
- devctty = makedev(nchrdev, 0);
+ devctty = NODEV;
fdhashtbl = hashinit(NFDCACHE, M_CACHE, &fdhash);
return (0);
}
diff --git a/sys/miscfs/kernfs/kernfs_vfsops.c b/sys/miscfs/kernfs/kernfs_vfsops.c
index 7ae0a35..a945fae 100644
--- a/sys/miscfs/kernfs/kernfs_vfsops.c
+++ b/sys/miscfs/kernfs/kernfs_vfsops.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)kernfs_vfsops.c 8.10 (Berkeley) 5/14/95
- * $Id: kernfs_vfsops.c,v 1.26 1999/05/08 06:39:52 phk Exp $
+ * $Id: kernfs_vfsops.c,v 1.27 1999/05/11 19:54:36 phk Exp $
*/
/*
@@ -80,6 +80,7 @@ kernfs_get_rrootdev()
{
static int tried = 0;
int cmaj;
+ struct cdevsw *sw;
if (tried) {
/* Already did it once. */
@@ -87,18 +88,12 @@ kernfs_get_rrootdev()
}
tried = 1;
- if (!bdevsw(rootdev)) {
- panic("root dev has no bdevsw");
- }
+ sw = bdevsw(rootdev);
+ if (!sw)
+ return;
if (rootdev == NODEV)
return;
- for (cmaj = 0; cmaj < nchrdev; cmaj++) {
- rrootdev = makedev(cmaj, minor(rootdev));
- if (chrtoblk(rrootdev) == rootdev)
- return;
- }
- rrootdev = NODEV;
- printf("kernfs_get_rrootdev: no raw root device\n");
+ rrootdev = makedev(sw->d_maj, minor(rootdev));
}
/*
diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c
index 636bc44..ae8bc0f 100644
--- a/sys/miscfs/specfs/spec_vnops.c
+++ b/sys/miscfs/specfs/spec_vnops.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95
- * $Id: spec_vnops.c,v 1.85 1999/05/08 06:39:55 phk Exp $
+ * $Id: spec_vnops.c,v 1.86 1999/05/11 19:54:38 phk Exp $
*/
#include <sys/param.h>
@@ -176,8 +176,6 @@ spec_open(ap)
switch (vp->v_type) {
case VCHR:
- if ((u_int)maj >= nchrdev)
- return (ENXIO);
dsw = devsw(dev);
if ( (dsw == NULL) || (dsw->d_open == NULL))
return ENXIO;
@@ -214,8 +212,6 @@ spec_open(ap)
return (error);
/* NOT REACHED */
case VBLK:
- if ((u_int)maj >= nblkdev)
- return (ENXIO);
dsw = bdevsw(dev);
if ( (dsw == NULL) || (dsw->d_open == NULL))
return ENXIO;
diff --git a/sys/msdosfs/msdosfs_vfsops.c b/sys/msdosfs/msdosfs_vfsops.c
index 35c4cb2..9312e30 100644
--- a/sys/msdosfs/msdosfs_vfsops.c
+++ b/sys/msdosfs/msdosfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $Id: msdosfs_vfsops.c,v 1.43 1999/05/07 10:11:10 phk Exp $ */
+/* $Id: msdosfs_vfsops.c,v 1.44 1999/05/08 06:40:00 phk Exp $ */
/* $NetBSD: msdosfs_vfsops.c,v 1.51 1997/11/17 15:36:58 ws Exp $ */
/*-
@@ -298,8 +298,7 @@ msdosfs_mount(mp, path, data, ndp, p)
vrele(devvp);
return (ENOTBLK);
}
- if (major(devvp->v_rdev) >= nblkdev ||
- bdevsw(devvp->v_rdev) == NULL) {
+ if (bdevsw(devvp->v_rdev) == NULL) {
vrele(devvp);
return (ENXIO);
}
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 40d3609..a564935 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.49 1999/04/28 11:37:30 phk Exp $
+ * $Id: bpf.c,v 1.50 1999/05/30 16:53:04 phk Exp $
*/
#include "bpfilter.h"
@@ -1306,14 +1306,12 @@ static void
bpf_drvinit(unused)
void *unused;
{
- dev_t dev;
#ifdef DEVFS
int i;
#endif
if( ! bpf_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&bpf_cdevsw, NULL);
+ cdevsw_add(&bpf_cdevsw);
bpf_devsw_installed = 1;
#ifdef DEVFS
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index 071e628..caff2d4 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -121,12 +121,10 @@ tunattach(dummy)
{
register int i;
struct ifnet *ifp;
- dev_t dev;
if ( tun_devsw_installed )
return;
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev, &tun_cdevsw, NULL);
+ cdevsw_add(&tun_cdevsw);
tun_devsw_installed = 1;
for ( i = 0; i < NTUN; i++ ) {
#ifdef DEVFS
diff --git a/sys/netinet/mlf_ipl.c b/sys/netinet/mlf_ipl.c
index 0142209..3e0e240 100644
--- a/sys/netinet/mlf_ipl.c
+++ b/sys/netinet/mlf_ipl.c
@@ -382,14 +382,12 @@ static int ipl_devsw_installed;
static void ipl_drvinit __P((void *unused))
{
- dev_t dev;
# ifdef DEVFS
void **tp = ipf_devfs;
# endif
if (!ipl_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev, &ipl_cdevsw, NULL);
+ cdevsw_add(&ipl_cdevsw);
ipl_devsw_installed = 1;
# ifdef DEVFS
diff --git a/sys/ntfs/ntfs_vfsops.c b/sys/ntfs/ntfs_vfsops.c
index 134ca03..b224001 100644
--- a/sys/ntfs/ntfs_vfsops.c
+++ b/sys/ntfs/ntfs_vfsops.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: ntfs_vfsops.c,v 1.5 1999/05/11 19:54:52 phk Exp $
+ * $Id: ntfs_vfsops.c,v 1.6 1999/05/12 09:43:04 semenu Exp $
*/
@@ -296,7 +296,7 @@ ntfs_mount (
err = ENOTBLK;
goto error_2;
}
- if (major(devvp->v_rdev) >= nblkdev) {
+ if (bdevsw(devvp->v_rdev) == NULL) {
err = ENXIO;
goto error_2;
}
diff --git a/sys/pc98/pc98/lpt.c b/sys/pc98/pc98/lpt.c
index 51999ab..b6d71b9 100644
--- a/sys/pc98/pc98/lpt.c
+++ b/sys/pc98/pc98/lpt.c
@@ -46,7 +46,7 @@
* SUCH DAMAGE.
*
* from: unknown origin, 386BSD 0.1
- * $Id: lpt.c,v 1.26 1999/04/28 10:53:53 dt Exp $
+ * $Id: lpt.c,v 1.27 1999/05/30 16:53:17 phk Exp $
*/
/*
@@ -1443,11 +1443,9 @@ static int lpt_devsw_installed;
static void lpt_drvinit(void *unused)
{
- dev_t dev;
if( ! lpt_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&lpt_cdevsw, NULL);
+ cdevsw_add(&lpt_cdevsw);
lpt_devsw_installed = 1;
}
}
diff --git a/sys/pc98/pc98/mse.c b/sys/pc98/pc98/mse.c
index 596b10c..47c9d59 100644
--- a/sys/pc98/pc98/mse.c
+++ b/sys/pc98/pc98/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.20 1999/05/09 04:37:17 kato Exp $
+ * $Id: mse.c,v 1.21 1999/05/30 16:53:19 phk Exp $
*/
/*
* Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and
@@ -946,11 +946,9 @@ static int mse_devsw_installed;
static void mse_drvinit(void *unused)
{
- dev_t dev;
if( ! mse_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&mse_cdevsw, NULL);
+ cdevsw_add(&mse_cdevsw);
mse_devsw_installed = 1;
}
}
diff --git a/sys/pc98/pc98/pcaudio.c b/sys/pc98/pc98/pcaudio.c
index ee06ce2..76d6e27 100644
--- a/sys/pc98/pc98/pcaudio.c
+++ b/sys/pc98/pc98/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.22 1999/05/09 04:39:36 kato Exp $
+ * $Id: pcaudio.c,v 1.23 1999/05/30 16:53:21 phk Exp $
*/
#include "pca.h"
@@ -608,11 +608,9 @@ static int pca_devsw_installed;
static void pca_drvinit(void *unused)
{
- dev_t dev;
if( ! pca_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&pca_cdevsw, NULL);
+ cdevsw_add(&pca_cdevsw);
pca_devsw_installed = 1;
}
}
diff --git a/sys/pc98/pc98/spkr.c b/sys/pc98/pc98/spkr.c
index f106113..cb6381d 100644
--- a/sys/pc98/pc98/spkr.c
+++ b/sys/pc98/pc98/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.14 1998/08/28 12:47:45 kato Exp $
+ * $Id: spkr.c,v 1.15 1999/05/30 16:53:23 phk Exp $
*/
/*
@@ -640,11 +640,9 @@ static int spkr_devsw_installed;
static void
spkr_drvinit(void *unused)
{
- dev_t dev;
if( ! spkr_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&spkr_cdevsw, NULL);
+ cdevsw_add(&spkr_cdevsw);
spkr_devsw_installed = 1;
#ifdef DEVFS
devfs_token = devfs_add_devswf(&spkr_cdevsw, 0, DV_CHR,
diff --git a/sys/pc98/pc98/syscons.c b/sys/pc98/pc98/syscons.c
index fa8119a..63c3978 100644
--- a/sys/pc98/pc98/syscons.c
+++ b/sys/pc98/pc98/syscons.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: syscons.c,v 1.118 1999/05/09 05:02:26 kato Exp $
+ * $Id: syscons.c,v 1.119 1999/05/30 16:53:24 phk Exp $
*/
#include "sc.h"
@@ -721,7 +721,7 @@ scattach(device_t dev)
at_shutdown(scshutdown, NULL, SHUTDOWN_PRE_SYNC);
- cdevsw_add(&cdev, &sc_cdevsw, NULL);
+ cdevsw_add(&sc_cdevsw);
#ifdef DEVFS
for (vc = 0; vc < MAXCONS; vc++)
diff --git a/sys/pc98/pc98/wd.c b/sys/pc98/pc98/wd.c
index ebecceb..8a7c163 100644
--- a/sys/pc98/pc98/wd.c
+++ b/sys/pc98/pc98/wd.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)wd.c 7.2 (Berkeley) 5/9/91
- * $Id: wd.c,v 1.82 1999/05/25 10:41:14 kato Exp $
+ * $Id: wd.c,v 1.83 1999/05/30 16:53:26 phk Exp $
*/
/* TODO:
@@ -2666,7 +2666,7 @@ static void wd_drvinit(void *unused)
if( ! wd_devsw_installed ) {
if (wd_cdevsw.d_maxio == 0)
wd_cdevsw.d_maxio = 248 * 512;
- cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &wd_cdevsw);
+ cdevsw_add(&wd_cdevsw);
wd_devsw_installed = 1;
}
}
diff --git a/sys/pc98/pc98/wd_cd.c b/sys/pc98/pc98/wd_cd.c
index 644fb3f..0613e7e 100644
--- a/sys/pc98/pc98/wd_cd.c
+++ b/sys/pc98/pc98/wd_cd.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: atapi-cd.c,v 1.18 1999/05/11 10:39:27 sos Exp $
+ * $Id: atapi-cd.c,v 1.19 1999/05/30 16:52:08 phk Exp $
*/
#include "wdc.h"
@@ -1496,15 +1496,10 @@ atapi_dump(int ctrlr, int lun, char *label, void *data, int len)
printf ("\n");
}
-static int acd_devsw_installed;
-
static void
acd_drvinit(void *unused)
{
- if (!acd_devsw_installed) {
- cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &acd_cdevsw);
- acd_devsw_installed = 1;
- }
+ cdevsw_add(&acd_cdevsw);
}
SYSINIT(acddev, SI_SUB_DRIVERS, SI_ORDER_MIDDLE + CDEV_MAJOR, acd_drvinit, NULL)
diff --git a/sys/pc98/pc98/wfd.c b/sys/pc98/pc98/wfd.c
index d03a201..d053cb8 100644
--- a/sys/pc98/pc98/wfd.c
+++ b/sys/pc98/pc98/wfd.c
@@ -23,7 +23,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: wfd.c,v 1.23 1999/05/07 07:03:31 phk Exp $
+ * $Id: wfd.c,v 1.24 1999/05/30 16:52:30 phk Exp $
*/
/*
@@ -765,17 +765,11 @@ static int wfd_eject (struct wfd *t, int closeit)
0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0);
}
-static int wfd_devsw_installed;
-
static void wfd_drvinit(void *unused)
{
- if( ! wfd_devsw_installed ) {
- cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &wfd_cdevsw);
- wfd_devsw_installed = 1;
- }
+ cdevsw_add(&wfd_cdevsw);
}
SYSINIT(wfddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,wfd_drvinit,NULL)
-
#endif /* NWFD && NWDC */
diff --git a/sys/pc98/pc98/wst.c b/sys/pc98/pc98/wst.c
index 82832d4..94d4146 100644
--- a/sys/pc98/pc98/wst.c
+++ b/sys/pc98/pc98/wst.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: wst.c,v 1.21 1999/05/07 07:03:32 phk Exp $
+ * $Id: wst.c,v 1.22 1999/05/30 16:52:30 phk Exp $
*/
#include "wdc.h"
@@ -787,18 +787,10 @@ wst_reset(struct wst *t)
DELAY(30);
}
-static int wst_devsw_installed;
-
static void
wst_drvinit(void *unused)
{
- if (!wst_devsw_installed) {
- dev_t dev;
-
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev, &wst_cdevsw, NULL);
- wst_devsw_installed = 1;
- }
+ cdevsw_add(&wst_cdevsw);
}
SYSINIT(wstdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,wst_drvinit,NULL)
diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c
index 100f7f5..9ec75d7 100644
--- a/sys/pccard/pccard.c
+++ b/sys/pccard/pccard.c
@@ -28,7 +28,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: pccard.c,v 1.78 1999/05/04 15:43:02 wpaul Exp $
+ * $Id: pccard.c,v 1.79 1999/05/30 16:53:28 phk Exp $
*/
#include "opt_devfs.h"
@@ -185,6 +185,7 @@ pccard_configure(dummy)
printf("Initializing PC-card drivers:");
for (drv = drivers; drv != NULL; drv = drv->next)
printf(" %s", drv->name);
+ cdevsw_add(&crd_cdevsw);
printf("\n");
}
@@ -1111,18 +1112,3 @@ find_driver(char *name)
return(drv);
return(0);
}
-
-static void
-crd_drvinit(void *unused)
-{
- static int crd_devsw_installed;
- dev_t dev;
-
- if (!crd_devsw_installed) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev, &crd_cdevsw, NULL);
- crd_devsw_installed = 1;
- }
-}
-
-SYSINIT(crddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,crd_drvinit,NULL)
diff --git a/sys/pci/brooktree848.c b/sys/pci/brooktree848.c
index 70d3367..558400b 100644
--- a/sys/pci/brooktree848.c
+++ b/sys/pci/brooktree848.c
@@ -1,4 +1,4 @@
-/* $Id: brooktree848.c,v 1.81 1999/05/25 12:43:40 roger Exp $ */
+/* $Id: brooktree848.c,v 1.82 1999/05/30 16:53:32 phk Exp $ */
/* BT848 Driver for Brooktree's Bt848, Bt848A, Bt849A, Bt878, Bt879 based cards.
The Brooktree BT848 Driver driver is based upon Mark Tinguely and
Jim Lowe's driver for the Matrox Meteor PCI card . The
@@ -668,6 +668,10 @@ bktr_probe(struct device *parent, struct cfdata *cf, void *aux)
pci_devaddr_t *pa;
pci_devres_t res;
struct isa_attach_args *ia = aux;
+ static int once;
+
+ if (!once++)
+ cdevsw_add(&bktr_cdevsw);
if (ia->ia_bustype != BUS_PCI)
return (0);
@@ -7017,29 +7021,6 @@ static void msp_autodetect( bktr_ptr_t bktr ) {
/* msp_write(bktr, 0x12, 0x0014, 0x7f40); */
}
-/******************************************************************************
- * magic:
- */
-
-
-#ifdef __FreeBSD__
-static int bktr_devsw_installed;
-
-static void
-bktr_drvinit( void *unused )
-{
- dev_t dev;
-
- if ( ! bktr_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&bktr_cdevsw, NULL);
- bktr_devsw_installed = 1;
- }
-}
-
-SYSINIT(bktrdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,bktr_drvinit,NULL)
-
-#endif /* __FreeBSD__ */
#endif /* !defined(__FreeBSD__) || (NBKTR > 0 && NPCI > 0) */
/* Local Variables: */
diff --git a/sys/pci/meteor.c b/sys/pci/meteor.c
index ca50c9a..71f708f 100644
--- a/sys/pci/meteor.c
+++ b/sys/pci/meteor.c
@@ -539,6 +539,10 @@ register int err = 0;
static const char *
met_probe (pcici_t tag, pcidi_t type)
{
+ static int once;
+
+ if (!once++)
+ cdevsw_add(&meteor_cdevsw);
switch (type) {
case SAA7116_PHILIPS_ID: /* meteor */
@@ -2095,22 +2099,4 @@ meteor_mmap(dev_t dev, vm_offset_t offset, int nprot)
return i386_btop(vtophys(mtr->bigbuf) + offset);
}
-
-#if !defined(METEOR_FreeBSD_210) /* XXX */
-static int meteor_devsw_installed;
-
-static void meteor_drvinit(void *unused)
-{
- dev_t dev;
-
- if( ! meteor_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&meteor_cdevsw, NULL);
- meteor_devsw_installed = 1;
- }
-}
-
-SYSINIT(meteordev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,meteor_drvinit,NULL)
-#endif
-
#endif /* NMETEOR > 0 */
diff --git a/sys/pci/pci.c b/sys/pci/pci.c
index bf5e657..8bc9c1d 100644
--- a/sys/pci/pci.c
+++ b/sys/pci/pci.c
@@ -23,7 +23,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: pci.c,v 1.105 1999/05/30 10:54:31 dfr Exp $
+ * $Id: pci.c,v 1.106 1999/05/30 16:53:36 phk Exp $
*
*/
@@ -875,10 +875,7 @@ static void *pci_devfs_token;
static void
pci_cdevinit(void *dummy)
{
- dev_t dev;
-
- dev = makedev(PCI_CDEV, 0);
- cdevsw_add(&dev, &pcicdev, NULL);
+ cdevsw_add(&pcicdev);
#ifdef DEVFS
pci_devfs_token = devfs_add_devswf(&pcicdev, 0, DV_CHR,
UID_ROOT, GID_WHEEL, 0644, "pci");
diff --git a/sys/pci/xrpu.c b/sys/pci/xrpu.c
index 309deb0..b8511b3 100644
--- a/sys/pci/xrpu.c
+++ b/sys/pci/xrpu.c
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id: xrpu.c,v 1.10 1999/05/09 17:07:12 peter Exp $
+ * $Id: xrpu.c,v 1.11 1999/05/30 16:53:37 phk Exp $
*
* A very simple device driver for PCI cards based on Xilinx 6200 series
* FPGA/RPU devices. Current Functionality is to allow you to open and
@@ -220,6 +220,10 @@ xrpu_probe (pcici_t tag, pcidi_t typea)
{
u_int id;
const char *vendor, *chip, *type;
+ static int once;
+
+ if (!once++)
+ cdevsw_add(&xrpu_cdevsw);
(void)pci_conf_read(tag, PCI_CLASS_REG);
id = pci_conf_read(tag, PCI_ID_REG);
@@ -236,7 +240,6 @@ static void
xrpu_attach (pcici_t tag, int unit)
{
struct softc *sc;
- dev_t cdev = makedev(CDEV_MAJOR, unit);
sc = (struct softc *)malloc(sizeof *sc, M_XRPU, M_WAITOK);
softc[unit] = sc;
@@ -253,8 +256,6 @@ xrpu_attach (pcici_t tag, int unit)
printf("Mapped physbase %#lx to virbase %#lx\n",
(u_long)sc->physbase, (u_long)sc->virbase);
- if (!unit)
- cdevsw_add(&cdev, &xrpu_cdevsw, NULL);
#ifdef DEVFS
devfs_add_devswf(&xrpu_cdevsw, 0, DV_CHR, UID_ROOT, GID_WHEEL, 0600,
diff --git a/sys/sys/conf.h b/sys/sys/conf.h
index a5d037b..5790303 100644
--- a/sys/sys/conf.h
+++ b/sys/sys/conf.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)conf.h 8.5 (Berkeley) 1/9/95
- * $Id: conf.h,v 1.56 1999/05/12 22:33:08 peter Exp $
+ * $Id: conf.h,v 1.57 1999/05/30 16:53:40 phk Exp $
*/
#ifndef _SYS_CONF_H_
@@ -127,40 +127,6 @@ struct cdevsw {
int d_bmaj;
};
-#ifdef KERNEL
-extern struct cdevsw *cdevsw[];
-extern int bmaj2cmaj[];
-
-static __inline
-struct cdevsw *
-devsw(dev_t dev)
-{
- return(cdevsw[major(dev)]);
-}
-
-static __inline
-struct cdevsw *
-bdevsw(dev_t dev)
-{
- struct cdevsw *c;
- int i = major(dev);
-
- if (bmaj2cmaj[i] == 254)
- return 0;
-
- c = cdevsw[bmaj2cmaj[major(dev)]];
- if (!c) {
- printf("bogus bdev dev_t %p, no cdev\n", (void *)dev);
- Debugger("Bummer");
- return 0;
- }
- /* CMAJ zero is the console, which has no strategy so this works */
- if (c->d_strategy)
- return (c);
- return (0);
-}
-#endif
-
/*
* Line discipline switch table
*/
@@ -214,6 +180,8 @@ d_mmap_t nommap;
d_dump_t nodump;
+#define NUMCDEVSW 256
+
/*
* nopsize is little used, so not worth having dummy functions for.
*/
@@ -252,12 +220,13 @@ DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+cmaj*256+bmaj)
int devsw_module_handler __P((struct module *mod, int what, void *arg));
-int cdevsw_add __P((dev_t *descrip,struct cdevsw *new,struct cdevsw **old));
-void cdevsw_add_generic __P((int bdev, int cdev, struct cdevsw *cdevsw));
+int cdevsw_add __P((struct cdevsw *new));
dev_t chrtoblk __P((dev_t dev));
int iskmemdev __P((dev_t dev));
int iszerodev __P((dev_t dev));
void setconf __P((void));
+struct cdevsw *bdevsw __P((dev_t dev));
+struct cdevsw *devsw __P((dev_t dev));
#endif /* KERNEL */
#endif /* !_SYS_CONF_H_ */
diff --git a/sys/sys/linedisc.h b/sys/sys/linedisc.h
index a5d037b..5790303 100644
--- a/sys/sys/linedisc.h
+++ b/sys/sys/linedisc.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)conf.h 8.5 (Berkeley) 1/9/95
- * $Id: conf.h,v 1.56 1999/05/12 22:33:08 peter Exp $
+ * $Id: conf.h,v 1.57 1999/05/30 16:53:40 phk Exp $
*/
#ifndef _SYS_CONF_H_
@@ -127,40 +127,6 @@ struct cdevsw {
int d_bmaj;
};
-#ifdef KERNEL
-extern struct cdevsw *cdevsw[];
-extern int bmaj2cmaj[];
-
-static __inline
-struct cdevsw *
-devsw(dev_t dev)
-{
- return(cdevsw[major(dev)]);
-}
-
-static __inline
-struct cdevsw *
-bdevsw(dev_t dev)
-{
- struct cdevsw *c;
- int i = major(dev);
-
- if (bmaj2cmaj[i] == 254)
- return 0;
-
- c = cdevsw[bmaj2cmaj[major(dev)]];
- if (!c) {
- printf("bogus bdev dev_t %p, no cdev\n", (void *)dev);
- Debugger("Bummer");
- return 0;
- }
- /* CMAJ zero is the console, which has no strategy so this works */
- if (c->d_strategy)
- return (c);
- return (0);
-}
-#endif
-
/*
* Line discipline switch table
*/
@@ -214,6 +180,8 @@ d_mmap_t nommap;
d_dump_t nodump;
+#define NUMCDEVSW 256
+
/*
* nopsize is little used, so not worth having dummy functions for.
*/
@@ -252,12 +220,13 @@ DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+cmaj*256+bmaj)
int devsw_module_handler __P((struct module *mod, int what, void *arg));
-int cdevsw_add __P((dev_t *descrip,struct cdevsw *new,struct cdevsw **old));
-void cdevsw_add_generic __P((int bdev, int cdev, struct cdevsw *cdevsw));
+int cdevsw_add __P((struct cdevsw *new));
dev_t chrtoblk __P((dev_t dev));
int iskmemdev __P((dev_t dev));
int iszerodev __P((dev_t dev));
void setconf __P((void));
+struct cdevsw *bdevsw __P((dev_t dev));
+struct cdevsw *devsw __P((dev_t dev));
#endif /* KERNEL */
#endif /* !_SYS_CONF_H_ */
diff --git a/sys/sys/param.h b/sys/sys/param.h
index 7259e76..44409c2 100644
--- a/sys/sys/param.h
+++ b/sys/sys/param.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)param.h 8.3 (Berkeley) 4/4/95
- * $Id: param.h,v 1.46 1999/05/09 08:58:45 phk Exp $
+ * $Id: param.h,v 1.47 1999/05/11 19:54:57 phk Exp $
*/
#ifndef _SYS_PARAM_H_
@@ -46,7 +46,7 @@
#define BSD4_3 1
#define BSD4_4 1
#undef __FreeBSD_version
-#define __FreeBSD_version 400005 /* Master, propagated to newvers */
+#define __FreeBSD_version 400006 /* Master, propagated to newvers */
#ifndef NULL
#define NULL 0
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index db60d49..d8d5e7f 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ffs_vfsops.c 8.31 (Berkeley) 5/20/95
- * $Id: ffs_vfsops.c,v 1.97 1999/05/07 10:11:33 phk Exp $
+ * $Id: ffs_vfsops.c,v 1.98 1999/05/08 06:40:22 phk Exp $
*/
#include "opt_quota.h"
@@ -290,8 +290,7 @@ ffs_mount( mp, path, data, ndp, p)
err = ENOTBLK;
goto error_2;
}
- if (major(devvp->v_rdev) >= nblkdev ||
- bdevsw(devvp->v_rdev) == NULL) {
+ if (bdevsw(devvp->v_rdev) == NULL) {
err = ENXIO;
goto error_2;
}
diff --git a/sys/vm/vm_swap.c b/sys/vm/vm_swap.c
index 662f3bf..d8d7540 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.68 1999/05/12 11:05:23 phk Exp $
+ * $Id: vm_swap.c,v 1.69 1999/05/30 16:53:49 phk Exp $
*/
#include "opt_devfs.h"
@@ -223,7 +223,7 @@ swapon(p, uap)
switch (vp->v_type) {
case VBLK:
dev = vp->v_rdev;
- if (major(dev) >= nblkdev || bdevsw(dev) == NULL) {
+ if (bdevsw(dev) == NULL) {
error = ENXIO;
break;
}
@@ -368,7 +368,7 @@ static void sw_drvinit(void *unused)
{
if( ! sw_devsw_installed ) {
- cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &sw_cdevsw);
+ cdevsw_add(&sw_cdevsw);
/*
* XXX: This is pretty gross, but it will disappear with
* the blockdevices RSN.
OpenPOWER on IntegriCloud