summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/amd64/amd64/mem.c88
-rw-r--r--sys/conf/files1
-rw-r--r--sys/dev/cy/cy.c68
-rw-r--r--sys/dev/cy/cy_isa.c68
-rw-r--r--sys/dev/dgb/dgb.c89
-rw-r--r--sys/dev/fdc/fdc.c75
-rw-r--r--sys/dev/joy/joy.c72
-rw-r--r--sys/dev/mcd/mcd.c97
-rw-r--r--sys/dev/mse/mse.c76
-rw-r--r--sys/dev/rc/rc.c76
-rw-r--r--sys/dev/scd/scd.c111
-rw-r--r--sys/dev/si/si.c113
-rw-r--r--sys/dev/sio/sio.c106
-rw-r--r--sys/dev/snp/snp.c60
-rw-r--r--sys/dev/speaker/spkr.c38
-rw-r--r--sys/dev/syscons/syscons.c21
-rw-r--r--sys/dev/vn/vn.c62
-rw-r--r--sys/fs/fdescfs/fdesc_vnops.c17
-rw-r--r--sys/fs/specfs/spec_vnops.c6
-rw-r--r--sys/gnu/i386/isa/dgb.c89
-rw-r--r--sys/gnu/i386/isa/nic3008.c76
-rw-r--r--sys/gnu/i386/isa/nic3009.c70
-rw-r--r--sys/gnu/isdn/iispy.c91
-rw-r--r--sys/gnu/isdn/iitel.c66
-rw-r--r--sys/gnu/isdn/iitty.c89
-rw-r--r--sys/gnu/isdn/isdn.c62
-rw-r--r--sys/i386/apm/apm.c62
-rw-r--r--sys/i386/bios/apm.c62
-rw-r--r--sys/i386/i386/conf.c992
-rw-r--r--sys/i386/i386/cons.c65
-rw-r--r--sys/i386/i386/cons.h10
-rw-r--r--sys/i386/i386/mem.c88
-rw-r--r--sys/i386/include/conf.h373
-rw-r--r--sys/i386/isa/asc.c105
-rw-r--r--sys/i386/isa/b004.c112
-rw-r--r--sys/i386/isa/b004.h1
-rw-r--r--sys/i386/isa/ctx.c64
-rw-r--r--sys/i386/isa/cx.c41
-rw-r--r--sys/i386/isa/cy.c68
-rw-r--r--sys/i386/isa/fd.c75
-rw-r--r--sys/i386/isa/gpib.c64
-rw-r--r--sys/i386/isa/gsc.c95
-rw-r--r--sys/i386/isa/if_cx.c7
-rw-r--r--sys/i386/isa/joy.c72
-rw-r--r--sys/i386/isa/labpc.c60
-rw-r--r--sys/i386/isa/lpt.c77
-rw-r--r--sys/i386/isa/matcd/matcd.c115
-rw-r--r--sys/i386/isa/mcd.c97
-rw-r--r--sys/i386/isa/mse.c76
-rw-r--r--sys/i386/isa/pcaudio.c58
-rw-r--r--sys/i386/isa/pcvt/pcvt_drv.c2
-rw-r--r--sys/i386/isa/psm.c76
-rw-r--r--sys/i386/isa/rc.c76
-rw-r--r--sys/i386/isa/scd.c111
-rw-r--r--sys/i386/isa/si.c113
-rw-r--r--sys/i386/isa/sio.c106
-rw-r--r--sys/i386/isa/sound/soundcard.c115
-rw-r--r--sys/i386/isa/spigot.c76
-rw-r--r--sys/i386/isa/spkr.c38
-rw-r--r--sys/i386/isa/syscons.c21
-rw-r--r--sys/i386/isa/tw.c57
-rw-r--r--sys/i386/isa/wcd.c108
-rw-r--r--sys/i386/isa/wd.c57
-rw-r--r--sys/i386/isa/wt.c83
-rw-r--r--sys/isa/fd.c75
-rw-r--r--sys/isa/joy.c72
-rw-r--r--sys/isa/sio.c106
-rw-r--r--sys/isa/syscons.c21
-rw-r--r--sys/kern/kern_conf.c3
-rw-r--r--sys/kern/kern_descrip.c50
-rw-r--r--sys/kern/kern_lkm.c130
-rw-r--r--sys/kern/subr_log.c49
-rw-r--r--sys/kern/tty_cons.c65
-rw-r--r--sys/kern/tty_pty.c105
-rw-r--r--sys/kern/tty_snoop.c60
-rw-r--r--sys/kern/tty_tty.c47
-rw-r--r--sys/miscfs/devfs/devfs_tree.c17
-rw-r--r--sys/miscfs/fdesc/fdesc_vnops.c17
-rw-r--r--sys/miscfs/specfs/spec_vnops.c6
-rw-r--r--sys/net/bpf.c59
-rw-r--r--sys/net/if_tun.c91
-rw-r--r--sys/pccard/pccard.c62
-rw-r--r--sys/pci/meteor.c53
-rw-r--r--sys/scsi/cd.c118
-rw-r--r--sys/scsi/ch.c56
-rw-r--r--sys/scsi/od.c81
-rw-r--r--sys/scsi/pt.c38
-rw-r--r--sys/scsi/sctarg.c46
-rw-r--r--sys/scsi/sd.c86
-rw-r--r--sys/scsi/ssc.c67
-rw-r--r--sys/scsi/st.c209
-rw-r--r--sys/scsi/su.c81
-rw-r--r--sys/scsi/uk.c52
-rw-r--r--sys/scsi/worm.c68
-rw-r--r--sys/sys/conf.h13
-rw-r--r--sys/sys/cons.h10
-rw-r--r--sys/sys/devfsext.h4
-rw-r--r--sys/sys/linedisc.h13
-rw-r--r--sys/sys/tty.h14
-rw-r--r--sys/vm/vm_swap.c46
100 files changed, 3750 insertions, 4005 deletions
diff --git a/sys/amd64/amd64/mem.c b/sys/amd64/amd64/mem.c
index 5fb364e..6d8a94c 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.21 1995/11/29 14:39:26 julian Exp $
+ * $Id: mem.c,v 1.22 1995/12/07 12:45:34 davidg Exp $
*/
/*
@@ -48,6 +48,10 @@
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/buf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /* DEVFS */
+#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/uio.h>
#include <sys/malloc.h>
@@ -64,33 +68,53 @@
#include <vm/pmap.h>
#include <vm/vm_extern.h>
-#ifdef JREMOD
-#include <sys/kernel.h>
+
+
+static d_open_t mmopen;
+static d_close_t mmclose;
+static d_rdwr_t mmrw;
+static d_ioctl_t mmioctl;
+static d_mmap_t memmmap;
+
#define CDEV_MAJOR 2
-#endif /*JREMOD*/
+struct cdevsw mem_cdevsw =
+ { mmopen, mmclose, mmrw, mmrw, /*2*/
+ mmioctl, nullstop, nullreset, nodevtotty,/* memory */
+ seltrue, memmmap, NULL, "mem", NULL, -1 };
#ifdef DEVFS
-#include <sys/devfsext.h>
-
-static void
-memdevfs_init(dev_t dev)
+static void *mem_devfs_token;
+static void *kmem_devfs_token;
+static void *null_devfs_token;
+static void *random_devfs_token;
+static void *urandom_devfs_token;
+static void *zero_devfs_token;
+static void *io_devfs_token;
+
+static void
+memdevfs_init()
{
- void * x;
- int maj = major(dev);
-/* path name major minor type uid gid perm*/
- x=devfs_add_devsw("/misc", "mem", maj, 0, DV_CHR, 0, 2, 0640);
- x=devfs_add_devsw("/misc", "kmem", maj, 1, DV_CHR, 0, 2, 0640);
- x=devfs_add_devsw("/misc", "null", maj, 2, DV_CHR, 0, 0, 0666);
- x=devfs_add_devsw("/misc", "random", maj, 3, DV_CHR, 0, 0, 0666);
- x=devfs_add_devsw("/misc", "urandom", maj, 4, DV_CHR, 0, 0, 0666);
- x=devfs_add_devsw("/misc", "zero", maj, 12, DV_CHR, 0, 0, 0666);
- x=devfs_add_devsw("/misc", "io", maj, 14, DV_CHR, 0, 2, 0640);
+/* path name cdevsw minor type uid gid perm*/
+ mem_devfs_token = devfs_add_devsw(
+ "/", "mem", &mem_cdevsw, 0, DV_CHR, 0, 2, 0640);
+ kmem_devfs_token = devfs_add_devsw(
+ "/", "kmem", &mem_cdevsw, 1, DV_CHR, 0, 2, 0640);
+ null_devfs_token = devfs_add_devsw(
+ "/", "null", &mem_cdevsw, 2, DV_CHR, 0, 0, 0666);
+ random_devfs_token = devfs_add_devsw(
+ "/", "random", &mem_cdevsw, 3, DV_CHR, 0, 0, 0666);
+ urandom_devfs_token = devfs_add_devsw(
+ "/", "urandom", &mem_cdevsw, 4, DV_CHR, 0, 0, 0666);
+ zero_devfs_token = devfs_add_devsw(
+ "/", "zero", &mem_cdevsw, 12, DV_CHR, 0, 0, 0666);
+ io_devfs_token = devfs_add_devsw(
+ "/", "io", &mem_cdevsw, 14, DV_CHR, 0, 2, 0640);
}
#endif /* DEVFS */
extern char *ptvmmap; /* poor name! */
-int
+static int
mmclose(dev, flags, fmt, p)
dev_t dev;
int flags;
@@ -110,7 +134,7 @@ mmclose(dev, flags, fmt, p)
return(0);
}
-int
+static int
mmopen(dev, flags, fmt, p)
dev_t dev;
int flags;
@@ -130,7 +154,7 @@ mmopen(dev, flags, fmt, p)
return(0);
}
-int
+static int
mmrw(dev, uio, flags)
dev_t dev;
struct uio *uio;
@@ -317,7 +341,8 @@ mmrw(dev, uio, flags)
* allow user processes to MMAP some memory sections *
* instead of going through read/write *
\*******************************************************/
-int memmmap(dev_t dev, int offset, int nprot)
+static int
+memmmap(dev_t dev, int offset, int nprot)
{
switch (minor(dev))
{
@@ -339,7 +364,7 @@ int memmmap(dev_t dev, int offset, int nprot)
* Allow userland to select which interrupts will be used in the muck
* gathering business.
*/
-int
+static int
mmioctl(dev, cmd, cmdarg, flags, p)
dev_t dev;
int cmd;
@@ -383,29 +408,22 @@ mmioctl(dev, cmd, cmdarg, flags, p)
-#ifdef JREMOD
-struct cdevsw mem_cdevsw =
- { mmopen, mmclose, mmrw, mmrw, /*2*/
- mmioctl, nullstop, nullreset, nodevtotty,/* memory */
- seltrue, memmmap, NULL };
-
static mem_devsw_installed = 0;
-static void mem_drvinit(void *unused)
+static void
+mem_drvinit(void *unused)
{
dev_t dev;
if( ! mem_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&mem_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&mem_cdevsw, NULL);
mem_devsw_installed = 1;
#ifdef DEVFS
- memdevfs_init(dev);
+ memdevfs_init();
#endif
}
}
SYSINIT(memdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,mem_drvinit,NULL)
-#endif /* JREMOD */
-
diff --git a/sys/conf/files b/sys/conf/files
index 4291d2c..9611114 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -49,6 +49,7 @@ kern/init_main.c standard
kern/init_sysent.c standard
kern/kern_acct.c standard
kern/kern_clock.c standard
+kern/kern_conf.c standard
kern/kern_descrip.c standard
kern/kern_devconf.c standard
kern/kern_exec.c standard
diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c
index ae025c0..acd4db6 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.22 1995/11/29 14:39:37 julian Exp $
+ * $Id: cy.c,v 1.23 1995/12/06 23:42:34 bde Exp $
*/
#include "cy.h"
@@ -315,6 +315,10 @@ struct com_s {
u_char obuf1[256];
u_char obuf2[256];
+#ifdef DEVFS
+ void *devfs_token; /* one for now */
+#endif
+
struct kern_devconf kdc;
};
@@ -358,6 +362,21 @@ static struct com_s *p_com_addr[NSIO];
static struct timeval intr_timestamp;
+static d_open_t cyopen;
+static d_close_t cyclose;
+static d_read_t cyread;
+static d_write_t cywrite;
+static d_ioctl_t cyioctl;
+static d_stop_t cystop;
+static d_ttycv_t cydevtotty;
+
+#define CDEV_MAJOR 48
+struct cdevsw cy_cdevsw =
+ { cyopen, cyclose, cyread, cywrite, /*48*/
+ cyioctl, cystop, nxreset, cydevtotty,/*cyclades*/
+ ttselect, nxmmap, NULL, "cy", NULL, -1 };
+
+
struct isa_driver siodriver = {
sioprobe, sioattach, "cy"
};
@@ -396,12 +415,9 @@ static int cy_nr_cd1400s[NCY];
#undef RxFifoThreshold
static int volatile RxFifoThreshold = (CD1400_RX_FIFO_SIZE / 2);
-#ifdef JREMOD
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
-#define CDEV_MAJOR 48
-#endif /*JREMOD*/
static struct kern_devconf kdc_sio[NCY] = { {
0, 0, 0, /* filled in by dev_attach */
@@ -502,6 +518,7 @@ sioattach(isdp)
cy_addr iobase;
int ncyu;
int unit;
+ char name [32];
unit = isdp->id_unit;
if ((u_int)unit >= NCY)
@@ -575,6 +592,13 @@ sioattach(isdp)
s = spltty();
com_addr(unit) = com;
splx(s);
+#ifdef DEVFS
+/* XXX */ /* Fix this when you work out what the f*ck it looks like */
+ sprintf(name, "cy%d", unit);
+ com->devfs_token =
+ devfs_add_devsw( "/", name, &cy_cdevsw, unit,
+ DV_CHR, 0, 0, 0600);
+#endif
}
}
kdc_sio[isdp->id_unit].kdc_state = DC_BUSY; /* XXX */
@@ -585,7 +609,7 @@ sioattach(isdp)
return (1);
}
-int
+static int
sioopen(dev, flag, mode, p)
dev_t dev;
int flag;
@@ -786,7 +810,7 @@ out:
return (error);
}
-int
+static int
sioclose(dev, flag, mode, p)
dev_t dev;
int flag;
@@ -887,7 +911,7 @@ comhardclose(com)
splx(s);
}
-int
+static int
sioread(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -903,7 +927,7 @@ sioread(dev, uio, flag)
return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
}
-int
+static int
siowrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -1320,7 +1344,7 @@ siointr1(com)
{
}
-int
+static int
sioioctl(dev, cmd, data, flag, p)
dev_t dev;
int cmd;
@@ -2105,7 +2129,7 @@ comstart(tp)
splx(s);
}
-void
+static void
siostop(tp, rw)
struct tty *tp;
int rw;
@@ -2520,36 +2544,20 @@ cystatus(unit)
-#ifdef JREMOD
-struct cdevsw cy_cdevsw =
- { cyopen, cyclose, cyread, cywrite, /*48*/
- cyioctl, cystop, nxreset, cydevtotty,/*cyclades*/
- ttselect, nxmmap, NULL };
-
static cy_devsw_installed = 0;
-static void cy_drvinit(void *unused)
+static void
+cy_drvinit(void *unused)
{
dev_t dev;
if( ! cy_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&cy_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&cy_cdevsw, NULL);
cy_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "cy", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(cydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cy_drvinit,NULL)
-#endif /* JREMOD */
-
#endif /* NCY > 0 */
diff --git a/sys/dev/cy/cy_isa.c b/sys/dev/cy/cy_isa.c
index ae025c0..acd4db6 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.22 1995/11/29 14:39:37 julian Exp $
+ * $Id: cy.c,v 1.23 1995/12/06 23:42:34 bde Exp $
*/
#include "cy.h"
@@ -315,6 +315,10 @@ struct com_s {
u_char obuf1[256];
u_char obuf2[256];
+#ifdef DEVFS
+ void *devfs_token; /* one for now */
+#endif
+
struct kern_devconf kdc;
};
@@ -358,6 +362,21 @@ static struct com_s *p_com_addr[NSIO];
static struct timeval intr_timestamp;
+static d_open_t cyopen;
+static d_close_t cyclose;
+static d_read_t cyread;
+static d_write_t cywrite;
+static d_ioctl_t cyioctl;
+static d_stop_t cystop;
+static d_ttycv_t cydevtotty;
+
+#define CDEV_MAJOR 48
+struct cdevsw cy_cdevsw =
+ { cyopen, cyclose, cyread, cywrite, /*48*/
+ cyioctl, cystop, nxreset, cydevtotty,/*cyclades*/
+ ttselect, nxmmap, NULL, "cy", NULL, -1 };
+
+
struct isa_driver siodriver = {
sioprobe, sioattach, "cy"
};
@@ -396,12 +415,9 @@ static int cy_nr_cd1400s[NCY];
#undef RxFifoThreshold
static int volatile RxFifoThreshold = (CD1400_RX_FIFO_SIZE / 2);
-#ifdef JREMOD
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
-#define CDEV_MAJOR 48
-#endif /*JREMOD*/
static struct kern_devconf kdc_sio[NCY] = { {
0, 0, 0, /* filled in by dev_attach */
@@ -502,6 +518,7 @@ sioattach(isdp)
cy_addr iobase;
int ncyu;
int unit;
+ char name [32];
unit = isdp->id_unit;
if ((u_int)unit >= NCY)
@@ -575,6 +592,13 @@ sioattach(isdp)
s = spltty();
com_addr(unit) = com;
splx(s);
+#ifdef DEVFS
+/* XXX */ /* Fix this when you work out what the f*ck it looks like */
+ sprintf(name, "cy%d", unit);
+ com->devfs_token =
+ devfs_add_devsw( "/", name, &cy_cdevsw, unit,
+ DV_CHR, 0, 0, 0600);
+#endif
}
}
kdc_sio[isdp->id_unit].kdc_state = DC_BUSY; /* XXX */
@@ -585,7 +609,7 @@ sioattach(isdp)
return (1);
}
-int
+static int
sioopen(dev, flag, mode, p)
dev_t dev;
int flag;
@@ -786,7 +810,7 @@ out:
return (error);
}
-int
+static int
sioclose(dev, flag, mode, p)
dev_t dev;
int flag;
@@ -887,7 +911,7 @@ comhardclose(com)
splx(s);
}
-int
+static int
sioread(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -903,7 +927,7 @@ sioread(dev, uio, flag)
return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
}
-int
+static int
siowrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -1320,7 +1344,7 @@ siointr1(com)
{
}
-int
+static int
sioioctl(dev, cmd, data, flag, p)
dev_t dev;
int cmd;
@@ -2105,7 +2129,7 @@ comstart(tp)
splx(s);
}
-void
+static void
siostop(tp, rw)
struct tty *tp;
int rw;
@@ -2520,36 +2544,20 @@ cystatus(unit)
-#ifdef JREMOD
-struct cdevsw cy_cdevsw =
- { cyopen, cyclose, cyread, cywrite, /*48*/
- cyioctl, cystop, nxreset, cydevtotty,/*cyclades*/
- ttselect, nxmmap, NULL };
-
static cy_devsw_installed = 0;
-static void cy_drvinit(void *unused)
+static void
+cy_drvinit(void *unused)
{
dev_t dev;
if( ! cy_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&cy_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&cy_cdevsw, NULL);
cy_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "cy", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(cydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cy_drvinit,NULL)
-#endif /* JREMOD */
-
#endif /* NCY > 0 */
diff --git a/sys/dev/dgb/dgb.c b/sys/dev/dgb/dgb.c
index 68499f8..8187b44 100644
--- a/sys/dev/dgb/dgb.c
+++ b/sys/dev/dgb/dgb.c
@@ -1,5 +1,5 @@
/*-
- * dgb.c $Id: dgb.c,v 1.8 1995/12/06 23:52:08 bde Exp $
+ * dgb.c $Id: dgb.c,v 1.9 1995/12/07 12:45:18 davidg Exp $
*
* Digiboard driver.
*
@@ -40,6 +40,9 @@
#include <sys/malloc.h>
#include <sys/syslog.h>
#include <sys/devconf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/clock.h>
@@ -54,12 +57,6 @@
#include <gnu/i386/isa/dgfep.h>
#include <gnu/i386/isa/dgreg.h>
-#ifdef JREMOD
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 58
-#endif /*JREMOD*/
#define CALLOUT_MASK 0x80
#define CONTROL_MASK 0x60
@@ -132,6 +129,14 @@ struct dgb_p {
u_char draining; /* port is being drained now */
u_char used; /* port is being used now */
u_char mustdrain; /* data must be waited to drain in dgbparam() */
+#ifdef DEVFS
+ struct {
+ void *tty;
+ void *init;
+ void *lock;
+ void *cua;
+ } devfs_token;
+#endif
};
/* Digiboard per-board structure */
@@ -190,6 +195,20 @@ struct isa_driver dgbdriver = {
dgbprobe, dgbattach, "dgb",0
};
+static d_open_t dgbopen;
+static d_close_t dgbclose;
+static d_read_t dgbread;
+static d_write_t dgbwrite;
+static d_ioctl_t dgbioctl;
+static d_stop_t dgbstop;
+static d_ttycv_t dgbdevtotty;
+
+#define CDEV_MAJOR 58
+struct cdevsw dgb_cdevsw =
+ { dgbopen, dgbclose, dgbread, dgbwrite, /*58*/
+ dgbioctl, dgbstop, nxreset, dgbdevtotty, /* dgb */
+ ttselect, nommap, NULL, "dgb", NULL, -1 };
+
static speed_t dgbdefaultrate = TTYDEF_SPEED;
static u_int dgb_events; /* input chars + weighted output completions */
static int dgbmajor;
@@ -437,6 +456,7 @@ dgbattach(dev)
ushort *pstat;
int lowwater;
int nports=0;
+ char name[32];
if(sc->status!=ENABLED) {
DPRINT2("dbg%d: try to attach a disabled card\n",unit);
@@ -832,6 +852,28 @@ load_fep:
termioschars(&port->it_in);
port->it_in.c_ispeed = port->it_in.c_ospeed = dgbdefaultrate;
port->it_out = port->it_in;
+#ifdef DEVFS
+/*XXX*/ /* fix the minor numbers */
+ sprintf(name,"dgb%d.%d",unit,i);
+ port->devfs_token.tty = devfs_add_devsw("/",name,
+ &dgb_cdevsw,(unit*32)+i, /*mytical number */
+ DV_CHR, 0, 0, 0600);
+
+ sprintf(name,"idgb%d.%d",unit,i);
+ port->devfs_token.tty = devfs_add_devsw("/",name,
+ &dgb_cdevsw,(unit*32)+i + 64, /*mytical number */
+ DV_CHR, 0, 0, 0600);
+
+ sprintf(name,"ldgb%d.%d",unit,i);
+ port->devfs_token.tty = devfs_add_devsw("/",name,
+ &dgb_cdevsw,(unit*32)+i + 128, /*mytical number */
+ DV_CHR, 0, 0, 0600);
+
+ sprintf(name,"dgbcua%d.%d",unit,i);
+ port->devfs_token.tty = devfs_add_devsw("/",name,
+ &dgb_cdevsw,(unit*32)+i + 192, /*mytical number */
+ DV_CHR, 0, 0, 0600);
+#endif
}
hidewin(sc);
@@ -843,7 +885,7 @@ load_fep:
}
/* ARGSUSED */
-int
+static int
dgbopen(dev, flag, mode, p)
dev_t dev;
int flag;
@@ -1011,7 +1053,7 @@ out:
}
/*ARGSUSED*/
-int
+static int
dgbclose(dev, flag, mode, p)
dev_t dev;
int flag;
@@ -1087,7 +1129,7 @@ wakeup((caddr_t)chan);
}
-int
+static int
dgbread(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -1111,7 +1153,7 @@ dgbread(dev, uio, flag)
return error;
}
-int
+static int
dgbwrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -1363,7 +1405,7 @@ dgbintr(unit)
{
}
-int
+static int
dgbioctl(dev, cmd, data, flag, p)
dev_t dev;
int cmd;
@@ -1989,36 +2031,21 @@ fepcmd(port, cmd, op1, op2, ncmds, bytecmd)
port->unit, port->pnum);
}
-#ifdef JREMOD
-struct cdevsw dgb_cdevsw =
- { dgbopen, dgbclose, dgbread, dgbwrite, /*58*/
- dgbioctl, dgbstop, nxreset, dgbdevtotty, /* dgb */
- ttselect, nommap, NULL };
static dgb_devsw_installed = 0;
-static void dgb_drvinit(void *unused)
+static void
+dgb_drvinit(void *unused)
{
dev_t dev;
if( ! dgb_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&dgb_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&dgb_cdevsw, NULL);
dgb_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name major minor type uid gid perm*/
- "/", "dgb", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(dgbdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,dgb_drvinit,NULL)
-#endif /* JREMOD */
-
#endif /* NDGB > 0 */
diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c
index 1af2cbf..e1b3436 100644
--- a/sys/dev/fdc/fdc.c
+++ b/sys/dev/fdc/fdc.c
@@ -1,4 +1,4 @@
-/*-
+/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
@@ -43,7 +43,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
- * $Id: fd.c,v 1.71 1995/11/20 12:41:38 phk Exp $
+ * $Id: fd.c,v 1.72 1995/11/28 09:41:00 julian Exp $
*
*/
@@ -87,11 +87,7 @@
#include <sys/devfsext.h>
#endif
-#ifdef JREMOD
-#define CDEV_MAJOR 9
-#define BDEV_MAJOR 2
-static void fd_devsw_install();
-#endif /*JREMOD */
+
static int fd_goaway(struct kern_devconf *, int);
static int fdc_goaway(struct kern_devconf *, int);
static int fd_externalize(struct kern_devconf *, struct sysctl_req *);
@@ -250,6 +246,10 @@ struct fd_data {
int track; /* where we think the head is */
int options; /* user configurable options, see ioctl_fd.h */
int dkunit; /* disk stats unit number */
+#ifdef DEVFS
+ void *rfd_devfs_token;
+ void *fd_devfs_token;
+#endif
} fd_data[NFD];
/***********************************************************************\
@@ -342,6 +342,24 @@ struct isa_driver fdcdriver = {
fdprobe, fdattach, "fdc",
};
+static d_open_t Fdopen; /* NOTE, not fdopen */
+static d_close_t fdclose;
+static d_ioctl_t fdioctl;
+static d_strategy_t fdstrategy;
+
+#define CDEV_MAJOR 9
+#define BDEV_MAJOR 2
+extern struct cdevsw fd_cdevsw;
+struct bdevsw fd_bdevsw =
+ { Fdopen, fdclose, fdstrategy, fdioctl, /*2*/
+ nxdump, zerosize, 0, "fd", &fd_cdevsw, -1 };
+
+struct cdevsw fd_cdevsw =
+ { Fdopen, fdclose, rawread, rawwrite, /*9*/
+ fdioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, fdstrategy, "fd",
+ &fd_bdevsw, -1 };
+
struct isa_device *fdcdevs[NFDC];
/*
@@ -518,9 +536,6 @@ fdprobe(struct isa_device *dev)
#ifndef DEV_LKM
fdc_registerdev(dev);
#endif
-#ifdef JREMOD
- fd_devsw_install();
-#endif /*JREMOD*/
/* First - lets reset the floppy controller */
outb(dev->id_iobase+FDOUT, 0);
@@ -554,7 +569,6 @@ fdattach(struct isa_device *dev)
int ic_type = 0;
#ifdef DEVFS
char name[64];
- void *key;
#endif /* DEVFS */
fdc->fdcu = fdcu;
@@ -750,10 +764,12 @@ fdattach(struct isa_device *dev)
}
kdc_fd[fdu].kdc_state = DC_IDLE;
#ifdef DEVFS
- key = dev_add("/disks/rfloppy",name,(caddr_t)Fdopen,fdu * 8,
- DV_CHR,0,0,0644);
- key = dev_add("/disks/floppy",name,(caddr_t)Fdopen,fdu * 8,
- DV_BLK,0,0,0644);
+ fd->rfd_devfs_token = devfs_add_devsw(
+ "/",name,&fd_cdevsw, fdu * 8,
+ DV_CHR,0,0,0644);
+ fd->fd_devfs_token = devfs_add_devsw(
+ "/",name, &fd_bdevsw, fdu * 8,
+ DV_BLK,0,0,0644);
#endif /* DEVFS */
if (dk_ndrive < DK_NDRIVE) {
sprintf(dk_names[dk_ndrive], "fd%d", fdu);
@@ -1893,32 +1909,23 @@ fdioctl(dev, cmd, addr, flag, p)
}
-#ifdef JREMOD
-struct bdevsw fd_bdevsw =
- { Fdopen, fdclose, fdstrategy, fdioctl, /*2*/
- nxdump, zerosize, 0 };
-
-struct cdevsw fd_cdevsw =
- { Fdopen, fdclose, rawread, rawwrite, /*9*/
- fdioctl, nostop, nullreset, nodevtotty,/* Fd (!=fd) */
- seltrue, nommap, fdstrategy };
-
static fd_devsw_installed = 0;
-static void fd_devsw_install()
+static void fd_drvinit(void *notused )
{
- dev_t descript;
+ dev_t dev;
+
if( ! fd_devsw_installed ) {
- descript = makedev(CDEV_MAJOR,0);
- cdevsw_add(&descript,&fd_cdevsw,NULL);
-#if defined(BDEV_MAJOR)
- descript = makedev(BDEV_MAJOR,0);
- bdevsw_add(&descript,&fd_bdevsw,NULL);
-#endif /*BDEV_MAJOR*/
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&fd_cdevsw, NULL);
+ dev = makedev(BDEV_MAJOR, 0);
+ bdevsw_add(&dev,&fd_bdevsw, NULL);
fd_devsw_installed = 1;
}
}
-#endif /* JREMOD */
+
+SYSINIT(fddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,fd_drvinit,NULL)
+
#endif
/*
* Hello emacs, these are the
diff --git a/sys/dev/joy/joy.c b/sys/dev/joy/joy.c
index 25d2311..2955d1c 100644
--- a/sys/dev/joy/joy.c
+++ b/sys/dev/joy/joy.c
@@ -34,6 +34,11 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/kernel.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/joystick.h>
@@ -41,15 +46,6 @@
#include <i386/isa/isa_device.h>
#include <i386/isa/timerreg.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 51
-#endif /*JREMOD*/
-
/* The game port can manage 4 buttons and 4 variable resistors (usually 2
* joysticks, each with 2 buttons and 2 pots.) via the port at address 0x201.
* Getting the state of the buttons is done by reading the game port:
@@ -77,6 +73,9 @@ static struct {
int port;
int x_off[2], y_off[2];
int timeout[2];
+#ifdef DEVFS
+ void *devfs_token;
+#endif
} joy[NJOY];
@@ -86,6 +85,17 @@ int joyprobe (struct isa_device *), joyattach (struct isa_device *);
struct isa_driver joydriver = {joyprobe, joyattach, "joy"};
+#define CDEV_MAJOR 51
+static d_open_t joyopen;
+static d_close_t joyclose;
+static d_read_t joyread;
+static d_ioctl_t joyioctl;
+
+struct cdevsw joy_cdevsw =
+ { joyopen, joyclose, joyread, nowrite, /*51*/
+ joyioctl, nostop, nullreset, nodevtotty,/*joystick */
+ seltrue, nommap, NULL, "joy", NULL, -1 };
+
static int get_tick ();
@@ -104,14 +114,22 @@ joyprobe (struct isa_device *dev)
int
joyattach (struct isa_device *dev)
{
- joy[dev->id_unit].port = dev->id_iobase;
- joy[dev->id_unit].timeout[0] = joy[dev->id_unit].timeout[1] = 0;
- printf("joy%d: joystick\n", dev->id_unit);
-
+ int unit = dev->id_unit;
+ char name[32];
+
+ joy[unit].port = dev->id_iobase;
+ joy[unit].timeout[0] = joy[unit].timeout[1] = 0;
+ printf("joy%d: joystick\n", unit);
+#ifdef DEVFS
+ sprintf(name, "joy%d", unit);
+ joy[dev->id_unit].devfs_token = devfs_add_devsw( "/", "joy",
+ &joy_cdevsw, 0,
+ DV_CHR, 0, 0, 0600);
+#endif
return 1;
}
-int
+static int
joyopen (dev_t dev, int flags, int fmt, struct proc *p)
{
int unit = UNIT (dev);
@@ -123,7 +141,7 @@ joyopen (dev_t dev, int flags, int fmt, struct proc *p)
joy[unit].timeout[i] = JOY_TIMEOUT;
return 0;
}
-int
+static int
joyclose (dev_t dev, int flags, int fmt, struct proc *p)
{
int unit = UNIT (dev);
@@ -133,7 +151,7 @@ joyclose (dev_t dev, int flags, int fmt, struct proc *p)
return 0;
}
-int
+static int
joyread (dev_t dev, struct uio *uio, int flag)
{
int unit = UNIT(dev);
@@ -169,7 +187,9 @@ joyread (dev_t dev, struct uio *uio, int flag)
c.b2 = ~(state >> 1) & 1;
return uiomove ((caddr_t)&c, sizeof(struct joystick), uio);
}
-int joyioctl (dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
+
+static int
+joyioctl (dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
{
int unit = UNIT (dev);
int i = joypart (dev);
@@ -202,6 +222,7 @@ int joyioctl (dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
}
return 0;
}
+
static int
get_tick ()
{
@@ -215,12 +236,6 @@ get_tick ()
}
-#ifdef JREMOD
-struct cdevsw joy_cdevsw =
- { joyopen, joyclose, joyread, nowrite, /*51*/
- joyioctl, nostop, nullreset, nodevtotty,/*joystick */
- seltrue, nommap, NULL};
-
static joy_devsw_installed = 0;
static void joy_drvinit(void *unused)
@@ -231,20 +246,9 @@ static void joy_drvinit(void *unused)
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&joy_cdevsw,NULL);
joy_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "joy", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(joydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,joy_drvinit,NULL)
-#endif /* JREMOD */
-
#endif /* NJOY > 0 */
diff --git a/sys/dev/mcd/mcd.c b/sys/dev/mcd/mcd.c
index 5f7f68b..ee2e03a 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.50 1995/11/29 10:47:44 julian Exp $
+ * $Id: mcd.c,v 1.51 1995/11/29 14:39:46 julian Exp $
*/
static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
@@ -61,6 +61,10 @@ static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
#include <sys/dkbad.h>
#include <sys/disklabel.h>
#include <sys/devconf.h>
+#include <sys/kernel.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/clock.h>
@@ -70,15 +74,6 @@ static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
#include <i386/isa/isa_device.h>
#include <i386/isa/mcdreg.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 29
-#define BDEV_MAJOR 7
-#endif /*JREMOD */
#define MCD_TRACE(format, args...) \
{ \
@@ -164,6 +159,12 @@ struct mcd_data {
short debug;
struct buf head; /* head of buf queue */
struct mcd_mbx mbx;
+#ifdef DEVFS
+ void *ra_devfs_token; /* store the devfs handle here */
+ void *rc_devfs_token; /* store the devfs handle here */
+ void *a_devfs_token; /* store the devfs handle here */
+ void *c_devfs_token; /* store the devfs handle here */
+#endif
} mcd_data[NMCD];
/* reader state machine */
@@ -208,11 +209,29 @@ static int mcd_resume(int unit);
static int mcd_lock_door(int unit, int lock);
static int mcd_close_tray(int unit);
-extern int hz;
static int mcd_probe(struct isa_device *dev);
static int mcd_attach(struct isa_device *dev);
struct isa_driver mcddriver = { mcd_probe, mcd_attach, "mcd" };
+static d_open_t mcdopen;
+static d_close_t mcdclose;
+static d_ioctl_t mcdioctl;
+static d_psize_t mcdsize;
+static d_strategy_t mcdstrategy;
+
+#define CDEV_MAJOR 29
+#define BDEV_MAJOR 7
+extern struct cdevsw mcd_cdevsw;
+struct bdevsw mcd_bdevsw =
+ { mcdopen, mcdclose, mcdstrategy, mcdioctl, /*7*/
+ nxdump, mcdsize, 0, "mcd", &mcd_cdevsw, -1 };
+
+struct cdevsw mcd_cdevsw =
+ { mcdopen, mcdclose, rawread, nowrite, /*29*/
+ mcdioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, mcdstrategy, "mcd",
+ &mcd_bdevsw, -1 };
+
#define mcd_put(port,byte) outb(port,byte)
#define MCD_RETRYS 5
@@ -253,20 +272,44 @@ mcd_registerdev(struct isa_device *id)
int mcd_attach(struct isa_device *dev)
{
- struct mcd_data *cd = mcd_data + dev->id_unit;
+ int unit = dev->id_unit;
+ struct mcd_data *cd = mcd_data + unit;
+ char name[32];
cd->iobase = dev->id_iobase;
cd->flags |= MCDINIT;
- mcd_soft_reset(dev->id_unit);
+ mcd_soft_reset(unit);
#ifdef NOTYET
/* wire controller for interrupts and dma */
mcd_configure(cd);
#endif
- kdc_mcd[dev->id_unit].kdc_state = DC_IDLE;
+ kdc_mcd[unit].kdc_state = DC_IDLE;
/* name filled in probe */
- kdc_mcd[dev->id_unit].kdc_description = mcd_data[dev->id_unit].name;
-
+ kdc_mcd[unit].kdc_description = mcd_data[unit].name;
+#ifdef DEVFS
+#define MCD_UID 0
+#define MCD_GID 13
+ sprintf(name, "rmcd%da",unit);
+ cd->ra_devfs_token = devfs_add_devsw(
+ "/", name, &mcd_cdevsw, (unit * 8 ) + 0,
+ DV_CHR, MCD_UID, MCD_GID, 0600);
+
+ sprintf(name, "rmcd%dc",unit);
+ cd->rc_devfs_token = devfs_add_devsw(
+ "/", name, &mcd_cdevsw, (unit * 8 ) + RAW_PART,
+ DV_CHR, MCD_UID, MCD_GID, 0600);
+
+ sprintf(name, "mcd%da",unit);
+ cd->a_devfs_token = devfs_add_devsw(
+ "/", name, &mcd_bdevsw, (unit * 8 ) + 0,
+ DV_BLK, MCD_UID, MCD_GID, 0600);
+
+ sprintf(name, "mcd%dc",unit);
+ cd->c_devfs_token = devfs_add_devsw(
+ "/", name, &mcd_bdevsw, (unit * 8 ) + RAW_PART,
+ DV_BLK, MCD_UID, MCD_GID, 0600);
+#endif
return 1;
}
@@ -1670,45 +1713,23 @@ mcd_resume(int unit)
return mcd_play(unit, &cd->lastpb);
}
-#ifdef JREMOD
-struct bdevsw mcd_bdevsw =
- { mcdopen, mcdclose, mcdstrategy, mcdioctl, /*7*/
- nxdump, mcdsize, 0 };
-
-struct cdevsw mcd_cdevsw =
- { mcdopen, mcdclose, rawread, nowrite, /*29*/
- mcdioctl, nostop, nullreset, nodevtotty,/* mitsumi cd */
- seltrue, nommap, mcdstrategy };
static mcd_devsw_installed = 0;
static void mcd_drvinit(void *unused)
{
dev_t dev;
- dev_t dev_chr;
if( ! mcd_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&mcd_cdevsw,NULL);
- dev_chr = dev;
dev = makedev(BDEV_MAJOR,0);
bdevsw_add(&dev,&mcd_bdevsw,NULL);
mcd_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
-/* path name devsw minor type uid gid perm*/
- "/", "rmcd", major(dev_chr), 0, DV_CHR, 0, 0, 0600);
- x=devfs_add_devsw(
- "/", "mcd", major(dev), 0, DV_BLK, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(mcddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,mcd_drvinit,NULL)
-#endif /* JREMOD */
#endif /* NMCD > 0 */
diff --git a/sys/dev/mse/mse.c b/sys/dev/mse/mse.c
index 8e9fa7b..96f62e5 100644
--- a/sys/dev/mse/mse.c
+++ b/sys/dev/mse/mse.c
@@ -11,7 +11,7 @@
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
- * $Id: mse.c,v 1.18 1995/11/29 14:39:47 julian Exp $
+ * $Id: mse.c,v 1.19 1995/12/06 23:42:53 bde Exp $
*/
/*
* Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and
@@ -55,20 +55,16 @@
#include <sys/ioctl.h>
#include <sys/uio.h>
#include <sys/devconf.h>
+#include <sys/conf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/clock.h>
#include <i386/isa/isa_device.h>
#include <i386/isa/icu.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 27
-#endif /*JREMOD*/
static int mseprobe(struct isa_device *);
static int mseattach(struct isa_device *);
@@ -77,6 +73,18 @@ struct isa_driver msedriver = {
mseprobe, mseattach, "mse"
};
+static d_open_t mseopen;
+static d_close_t mseclose;
+static d_read_t mseread;
+static d_select_t mseselect;
+
+#define CDEV_MAJOR 27
+struct cdevsw mse_cdevsw =
+ { mseopen, mseclose, mseread, nowrite, /*27*/
+ noioc, nostop, nullreset, nodevtotty,/* mse */
+ mseselect, nommap, NULL, "mse", NULL, -1 };
+
+
/*
* Software control structure for mouse. The sc_enablemouse(),
* sc_disablemouse() and sc_getmouse() routines must be called spl'd().
@@ -96,6 +104,10 @@ struct mse_softc {
int sc_buttons;
int sc_bytesread;
u_char sc_bytes[PROTOBYTES];
+#ifdef DEVFS
+ void *devfs_token;
+ void *n_devfs_token;
+#endif
} mse_sc[NMSE];
/* Flags */
@@ -238,17 +250,31 @@ int
mseattach(idp)
struct isa_device *idp;
{
- struct mse_softc *sc = &mse_sc[idp->id_unit];
+ char name[32];
+ int unit = idp->id_unit;
+ struct mse_softc *sc = &mse_sc[unit];
sc->sc_port = idp->id_iobase;
- kdc_mse[idp->id_unit].kdc_state = DC_IDLE;
+ kdc_mse[unit].kdc_state = DC_IDLE;
+#ifdef DEVFS
+ sprintf(name,"mse%d", unit);
+ /* path name devsw minor */
+ sc->devfs_token = devfs_add_devsw( "/", name, &mse_cdevsw, unit << 1,
+ /*type uid gid perm*/
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"nmse%d", unit);
+ /* path name devsw minor */
+ sc->n_devfs_token = devfs_add_devsw("/", name, &mse_cdevsw, (unit<<1)+1,
+ /*type uid gid perm*/
+ DV_CHR, 0, 0, 0600);
+#endif
return (1);
}
/*
* Exclusive open the mouse, initialize it and enable interrupts.
*/
-int
+static int
mseopen(dev, flags, fmt, p)
dev_t dev;
int flags;
@@ -281,7 +307,7 @@ mseopen(dev, flags, fmt, p)
/*
* mseclose: just turn off mouse innterrupts.
*/
-int
+static int
mseclose(dev, flags, fmt, p)
dev_t dev;
int flags;
@@ -304,7 +330,7 @@ mseclose(dev, flags, fmt, p)
* using bytes 4 and 5.
* (Yes this is cheesy, but it makes the X386 server happy, so...)
*/
-int
+static int
mseread(dev, uio, ioflag)
dev_t dev;
struct uio *uio;
@@ -366,7 +392,7 @@ mseread(dev, uio, ioflag)
/*
* mseselect: check for mouse input to be processed.
*/
-int
+static int
mseselect(dev, rw, p)
dev_t dev;
int rw;
@@ -575,12 +601,6 @@ mse_getati(port, dx, dy, but)
outb(port + MSE_PORTB, MSE_INPORT_INTREN);
}
-#ifdef JREMOD
-struct cdevsw mse_cdevsw =
- { mseopen, mseclose, mseread, nowrite, /*27*/
- noioc, nostop, nullreset, nodevtotty,/* mse */
- mseselect, nommap, NULL };
-
static mse_devsw_installed = 0;
static void mse_drvinit(void *unused)
@@ -588,23 +608,13 @@ static void mse_drvinit(void *unused)
dev_t dev;
if( ! mse_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&mse_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&mse_cdevsw, NULL);
mse_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "mse", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(msedev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,mse_drvinit,NULL)
-#endif /* JREMOD */
#endif /* NMSE */
diff --git a/sys/dev/rc/rc.c b/sys/dev/rc/rc.c
index e4e3325..83db4c6 100644
--- a/sys/dev/rc/rc.c
+++ b/sys/dev/rc/rc.c
@@ -47,6 +47,9 @@
#include <sys/kernel.h>
#include <sys/syslog.h>
#include <sys/devconf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/clock.h>
@@ -57,14 +60,6 @@
#include <i386/isa/ic/cd180.h>
#include <i386/isa/rcreg.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 63
-#endif /*JREMOD*/
/* Prototypes */
int rcprobe __P((struct isa_device *));
@@ -105,6 +100,20 @@ struct isa_driver rcdriver = {
rcprobe, rcattach, "rc"
};
+static d_open_t rcopen;
+static d_close_t rcclose;
+static d_read_t rcread;
+static d_write_t rcwrite;
+static d_ioctl_t rcioctl;
+static d_stop_t rcstop;
+static d_ttycv_t rcdevtotty;
+
+#define CDEV_MAJOR 63
+struct cdevsw rc_cdevsw =
+ { rcopen, rcclose, rcread, rcwrite, /*63*/
+ rcioctl, rcstop, nxreset, rcdevtotty,/* rc */
+ ttselect, nommap, NULL, "rc", NULL, -1 };
+
/* Per-board structure */
static struct rc_softc {
u_int rcb_probed; /* 1 - probed, 2 - attached */
@@ -134,6 +143,9 @@ static struct rc_chans {
u_char *rc_obufend; /* end of output buf */
u_char rc_ibuf[4 * RC_IBUFSIZE]; /* input buffer */
u_char rc_obuf[RC_OBUFSIZE]; /* output buffer */
+#ifdef DEVFS
+ void *devfs_token;
+#endif
} rc_chans[NRC * CD180_NCHAN];
static int rc_scheduled_event = 0;
@@ -249,6 +261,7 @@ int rcattach(dvp)
struct rc_chans *rc = &rc_chans[dvp->id_unit * CD180_NCHAN];
static int rc_wakeup_started = 0;
struct tty *tp;
+ char name[32];
/* Thorooughly test the device */
if (rcb->rcb_probed != RC_PROBED)
@@ -279,6 +292,13 @@ int rcattach(dvp)
tp->t_lflag = tp->t_iflag = tp->t_oflag = 0;
tp->t_cflag = TTYDEF_CFLAG;
tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
+#ifdef DEVFS
+/* FIX THIS to reflect real devices */
+ sprintf(name,"rc%d.%d",dvp->id_unit,chan);
+ rc->devfs_token = devfs_add_devsw( "/", name,
+ &rc_cdevsw,(dvp->id_unit * CD180_NCHAN) + chan ,
+ DV_CHR, 0, 0, 0600);
+#endif
}
rcb->rcb_probed = RC_ATTACHED;
if (!rc_wakeup_started) {
@@ -693,7 +713,8 @@ done1:
goto repeat;
}
-void rcstop(tp, rw)
+static void
+rcstop(tp, rw)
register struct tty *tp;
int rw;
{
@@ -726,7 +747,8 @@ void rcstop(tp, rw)
enable_intr();
}
-int rcopen(dev, flag, mode, p)
+static int
+rcopen(dev, flag, mode, p)
dev_t dev;
int flag, mode;
struct proc *p;
@@ -817,7 +839,8 @@ out:
return error;
}
-int rcclose(dev, flag, mode, p)
+static int
+rcclose(dev, flag, mode, p)
dev_t dev;
int flag, mode;
struct proc *p;
@@ -874,7 +897,8 @@ register struct rc_chans *rc;
}
/* Read from line */
-int rcread(dev, uio, flag)
+static int
+rcread(dev, uio, flag)
dev_t dev;
struct uio *uio;
int flag;
@@ -885,7 +909,8 @@ int rcread(dev, uio, flag)
}
/* Write to line */
-int rcwrite(dev, uio, flag)
+static int
+rcwrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
int flag;
@@ -1091,7 +1116,8 @@ struct rc_softc *rcb;
(void) rc_param(rc->rc_tp, &rc->rc_tp->t_termios);
}
-int rcioctl(dev, cmd, data, flag, p)
+static int
+rcioctl(dev, cmd, data, flag, p)
dev_t dev;
int cmd, flag;
caddr_t data;
@@ -1409,7 +1435,7 @@ char *comment;
}
#endif /* RCDEBUG */
-struct tty *
+static struct tty *
rcdevtotty(dev)
dev_t dev;
{
@@ -1501,12 +1527,6 @@ rc_wait0(nec, unit, chan, line)
unit, chan, line);
}
-#ifdef JREMOD
-struct cdevsw rc_cdevsw =
- { rcopen, rcclose, rcread, rcwrite, /*63*/
- rcioctl, rcstop, nxreset, rcdevtotty,/* rc */
- ttselect, nommap, NULL };
-
static rc_devsw_installed = 0;
static void rc_drvinit(void *unused)
@@ -1514,23 +1534,13 @@ static void rc_drvinit(void *unused)
dev_t dev;
if( ! rc_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&rc_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&rc_cdevsw, NULL);
rc_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "rc", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(rcdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,rc_drvinit,NULL)
-#endif /* JREMOD */
#endif /* NRC */
diff --git a/sys/dev/scd/scd.c b/sys/dev/scd/scd.c
index edffabf..a111bba 100644
--- a/sys/dev/scd/scd.c
+++ b/sys/dev/scd/scd.c
@@ -41,7 +41,7 @@
*/
-/* $Id: scd.c,v 1.11 1995/11/29 10:47:50 julian Exp $ */
+/* $Id: scd.c,v 1.12 1995/11/29 14:39:53 julian Exp $ */
/* Please send any comments to micke@dynas.se */
@@ -64,6 +64,10 @@
#include <sys/dkbad.h>
#include <sys/disklabel.h>
#include <sys/devconf.h>
+#include <sys/kernel.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/clock.h>
#include <machine/stdarg.h>
@@ -72,14 +76,6 @@
#include <i386/isa/isa_device.h>
#include <i386/isa/scdreg.h>
-#ifdef JREMOD
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 45
-#define BDEV_MAJOR 16
-#endif /*JREMOD */
#define scd_part(dev) ((minor(dev)) & 7)
#define scd_unit(dev) (((minor(dev)) & 0x38) >> 3)
@@ -148,6 +144,12 @@ static struct scd_data {
short audio_status;
struct buf head; /* head of buf queue */
struct scd_mbx mbx;
+#ifdef DEVFS
+ void *ra_devfs_token;
+ void *rc_devfs_token;
+ void *a_devfs_token;
+ void *c_devfs_token;
+#endif
} scd_data[NSCD];
/* prototypes */
@@ -184,12 +186,30 @@ static int scd_toc_header(int unit, struct ioc_toc_header *th);
static int scd_toc_entrys(int unit, struct ioc_read_toc_entry *te);
#define SCD_LASTPLUS1 170 /* don't ask, xcdplayer passes this in */
-extern int hz;
-
static int scd_probe(struct isa_device *dev);
static int scd_attach(struct isa_device *dev);
struct isa_driver scddriver = { scd_probe, scd_attach, "scd" };
+static d_open_t scdopen;
+static d_close_t scdclose;
+static d_ioctl_t scdioctl;
+static d_psize_t scdsize;
+static d_strategy_t scdstrategy;
+
+#define CDEV_MAJOR 45
+#define BDEV_MAJOR 16
+extern struct cdevsw scd_cdevsw;
+struct bdevsw scd_bdevsw =
+ { scdopen, scdclose, scdstrategy, scdioctl, /*16*/
+ nxdump, scdsize, 0, "scd", &scd_cdevsw, -1 };
+
+struct cdevsw scd_cdevsw =
+ { scdopen, scdclose, rawread, nowrite, /*45*/
+ scdioctl, nostop, nullreset, nodevtotty,/* sony cd */
+ seltrue, nommap, scdstrategy, "scd",
+ &scd_bdevsw, -1 };
+
+
static struct kern_devconf kdc_scd[NSCD] = { {
0, 0, 0, /* filled in by dev_attach */
"scd", 0, { MDDT_ISA, 0, "bio" },
@@ -213,7 +233,9 @@ scd_registerdev(struct isa_device *id)
int scd_attach(struct isa_device *dev)
{
- struct scd_data *cd = scd_data + dev->id_unit;
+ int unit = dev->id_unit;
+ struct scd_data *cd = scd_data + unit;
+ char name[32];
cd->iobase = dev->id_iobase; /* Already set by probe, but ... */
@@ -227,10 +249,33 @@ int scd_attach(struct isa_device *dev)
cd->flags = SCDINIT;
cd->audio_status = CD_AS_AUDIO_INVALID;
+#ifdef DEVFS
+#define SCD_UID 0
+#define SCD_GID 13
+ sprintf(name, "rscd%da",unit);
+ cd->ra_devfs_token = devfs_add_devsw(
+ "/", name, &scd_cdevsw, (unit * 8 ) + 0,
+ DV_CHR, SCD_UID, SCD_GID, 0600);
+
+ sprintf(name, "rscd%dc",unit);
+ cd->rc_devfs_token = devfs_add_devsw(
+ "/", name, &scd_cdevsw, (unit * 8 ) + RAW_PART,
+ DV_CHR, SCD_UID, SCD_GID, 0600);
+
+ sprintf(name, "scd%da",unit);
+ cd->a_devfs_token = devfs_add_devsw(
+ "/", name, &scd_bdevsw, (unit * 8 ) + 0,
+ DV_BLK, SCD_UID, SCD_GID, 0600);
+
+ sprintf(name, "scd%dc",unit);
+ cd->c_devfs_token = devfs_add_devsw(
+ "/", name, &scd_bdevsw, (unit * 8 ) + RAW_PART,
+ DV_BLK, SCD_UID, SCD_GID, 0600);
+#endif
return 1;
}
-int
+static int
scdopen(dev_t dev, int flags, int fmt, struct proc *p)
{
int unit,part,phys;
@@ -283,7 +328,7 @@ scdopen(dev_t dev, int flags, int fmt, struct proc *p)
return 0;
}
-int
+static int
scdclose(dev_t dev, int flags, int fmt, struct proc *p)
{
int unit,part,phys;
@@ -313,7 +358,7 @@ scdclose(dev_t dev, int flags, int fmt, struct proc *p)
return 0;
}
-void
+static void
scdstrategy(struct buf *bp)
{
struct scd_data *cd;
@@ -416,7 +461,7 @@ scd_start(int unit)
return;
}
-int
+static int
scdioctl(dev_t dev, int cmd, caddr_t addr, int flags, struct proc *p)
{
struct scd_data *cd;
@@ -492,7 +537,7 @@ scdioctl(dev_t dev, int cmd, caddr_t addr, int flags, struct proc *p)
}
}
-int
+static int
scdsize(dev_t dev)
{
return -1;
@@ -1529,46 +1574,22 @@ scd_toc_entrys (int unit, struct ioc_read_toc_entry *te)
}
-#ifdef JREMOD
-struct bdevsw scd_bdevsw =
- { scdopen, scdclose, scdstrategy, scdioctl, /*16*/
- nxdump, scdsize, 0 };
-
-struct cdevsw scd_cdevsw =
- { scdopen, scdclose, rawread, nowrite, /*45*/
- scdioctl, nostop, nullreset, nodevtotty,/* sony cd */
- seltrue, nommap, scdstrategy };
-
static scd_devsw_installed = 0;
static void scd_drvinit(void *unused)
{
dev_t dev;
- dev_t dev_chr;
if( ! scd_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&scd_cdevsw,NULL);
- dev_chr = dev;
- dev = makedev(BDEV_MAJOR,0);
- bdevsw_add(&dev,&scd_bdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&scd_cdevsw, NULL);
+ dev = makedev(BDEV_MAJOR, 0);
+ bdevsw_add(&dev,&scd_bdevsw, NULL);
scd_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "rscd", major(dev_chr), 0, DV_CHR, 0, 0, 0600);
- x=devfs_add_devsw(
- "/", "scd", major(dev), 0, DV_BLK, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(scddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,scd_drvinit,NULL)
-#endif /* JREMOD */
#endif /* NSCD > 0 */
diff --git a/sys/dev/si/si.c b/sys/dev/si/si.c
index 1b732d9..cc1d6a7 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.21 1995/12/06 23:50:27 bde Exp $
+ * $Id: si.c,v 1.22 1995/12/07 12:46:06 davidg Exp $
*/
#ifndef lint
@@ -53,6 +53,9 @@ static char si_copyright1[] = "@(#) (C) Specialix International, 1990,1992",
#include <sys/syslog.h>
#include <sys/malloc.h>
#include <sys/devconf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/clock.h>
@@ -84,12 +87,8 @@ static char si_copyright1[] = "@(#) (C) Specialix International, 1990,1992",
enum si_mctl { GET, SET, BIS, BIC };
-#ifdef JREMOD
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 68
-#endif /*JREMOD*/
+static const char devchar[] = "ABCDEFGHIJK";
+static const char portchar[] = "0123456789abcdefghijklmnopqrstuvwxyz";
static void si_command __P((struct si_port *, int, int));
@@ -110,6 +109,25 @@ extern int siprobe __P((struct isa_device *id));
extern int siattach __P((struct isa_device *id));
static void si_modem_state __P((struct si_port *pp, struct tty *tp, int hi_ip));
+struct isa_driver sidriver =
+ { siprobe, siattach, "si" };
+
+
+static d_open_t siopen;
+static d_close_t siclose;
+static d_read_t siread;
+static d_write_t siwrite;
+static d_ioctl_t siioctl;
+static d_stop_t sistop;
+static d_ttycv_t sidevtotty;
+
+#define CDEV_MAJOR 68
+struct cdevsw si_cdevsw =
+ { siopen, siclose, siread, siwrite, /*68*/
+ siioctl, sistop, nxreset, sidevtotty,/* si */
+ ttselect, nxmmap, NULL, "si", NULL, -1 };
+
+
#ifdef SI_DEBUG /* use: ``options "SI_DEBUG"'' in your config file */
/* XXX: should be varargs, I know.. but where's vprintf()? */
static void si_dprintf __P((/* struct si_port *pp, int flags, char *str, int a1, int a2, int a3, int a4, int a5, int a6 */));
@@ -142,6 +160,16 @@ struct si_softc {
int sc_eisa_iobase; /* EISA io port address */
int sc_eisa_irqbits;
struct kern_devconf sc_kdc;
+#ifdef DEVFS
+ struct {
+ void *ttyd;
+ void *ttyl;
+ void *ttyi;
+ void *cuaa;
+ void *cual;
+ void *cuai;
+ } devfs_token[32]; /* what is the max per card? */
+#endif
};
struct si_softc si_softc[NSI]; /* up to 4 elements */
@@ -460,6 +488,7 @@ siattach(id)
struct speedtab *spt;
int nmodule, nport, x, y;
int uart_type;
+ char name[32];
DPRINT((0, DBG_AUTOBOOT, "si%d: siattach\n", id->id_unit));
@@ -663,14 +692,39 @@ mem_fail:
done_chartimes = 1;
}
+#ifdef DEVFS
+/* path name devsw minor type uid gid perm*/
+ for ( x = 0; x < nport; x++ ) {
+ sprintf(name,"tty%c%c",devchar[unit],portchar[x + 1]);
+ sc->devfs_token[x].ttyd = devfs_add_devsw(
+ "/", name, &si_cdevsw, unit,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"ttyi%c%c",devchar[unit],portchar[x + 1]);
+ sc->devfs_token[x].ttyi = devfs_add_devsw(
+ "/", name, &si_cdevsw, unit + 32,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"ttyl%c%c",devchar[unit],portchar[x + 1]);
+ sc->devfs_token[x].ttyl = devfs_add_devsw(
+ "/", name, &si_cdevsw, unit + 64,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"cua%c%c",devchar[unit],portchar[x + 1]);
+ sc->devfs_token[x].cuaa = devfs_add_devsw(
+ "/", name, &si_cdevsw, unit + 128,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"cuai%c%c",devchar[unit],portchar[x + 1]);
+ sc->devfs_token[x].cuai = devfs_add_devsw(
+ "/", name, &si_cdevsw, unit + 160,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"cual%c%c",devchar[unit],portchar[x + 1]);
+ sc->devfs_token[x].cual = devfs_add_devsw(
+ "/", name, &si_cdevsw, unit + 192,
+ DV_CHR, 0, 0, 0600);
+ }
+#endif
return (1);
}
-struct isa_driver sidriver =
- { siprobe, siattach, "si" };
-
-
-int
+static int
siopen(dev, flag, mode, p)
dev_t dev;
int flag, mode;
@@ -841,7 +895,7 @@ out:
return(error);
}
-int
+static int
siclose(dev, flag, mode, p)
dev_t dev;
int flag, mode;
@@ -961,7 +1015,7 @@ sidtrwakeup(chan)
/*
* User level stuff - read and write
*/
-int
+static int
siread(dev, uio, flag)
register dev_t dev;
struct uio *uio;
@@ -981,7 +1035,7 @@ siread(dev, uio, flag)
}
-int
+static int
siwrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -1020,7 +1074,7 @@ out:
}
-struct tty *
+static struct tty *
sidevtotty(dev_t dev)
{
struct si_port *pp;
@@ -1035,7 +1089,7 @@ sidevtotty(dev_t dev)
return (pp->sp_tty);
}
-int
+static int
siioctl(dev, cmd, data, flag, p)
dev_t dev;
int cmd;
@@ -2305,40 +2359,19 @@ si_mctl2str(cmd)
#endif /* DEBUG */
-#ifdef JREMOD
-struct cdevsw si_cdevsw =
- { siopen, siclose, siread, siwrite, /*68*/
- siioctl, sistop, nxreset, sidevtotty,/* si */
- ttselect, nxmmap, NULL };
static si_devsw_installed = 0;
static void si_drvinit(void *unused)
{
dev_t dev;
- dev_t dev_chr;
if( ! si_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&si_cdevsw,NULL);
- dev_chr = dev;
-#if defined(BDEV_MAJOR)
- dev = makedev(BDEV_MAJOR,0);
- bdevsw_add(&dev,&si_bdevsw,NULL);
-#endif /*BDEV_MAJOR*/
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&si_cdevsw, NULL);
si_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "si", major(dev_chr), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(sidev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,si_drvinit,NULL)
-#endif /* JREMOD */
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c
index b6b090f..d44d7bc 100644
--- a/sys/dev/sio/sio.c
+++ b/sys/dev/sio/sio.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
- * $Id: sio.c,v 1.123 1995/11/29 15:00:07 bde Exp $
+ * $Id: sio.c,v 1.124 1995/12/06 23:43:07 bde Exp $
*/
#include "sio.h"
@@ -59,6 +59,9 @@
#include <sys/malloc.h>
#include <sys/syslog.h>
#include <sys/devconf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/clock.h>
@@ -95,12 +98,6 @@
#define com_scr 7 /* scratch register for 16450-16550 (R/W) */
-#ifdef JREMOD
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 28
-#endif /*JREMOD*/
#include "crd.h"
@@ -251,6 +248,14 @@ struct com_s {
*/
u_char obuf1[256];
u_char obuf2[256];
+#ifdef DEVFS
+ void *devfs_token_ttyd;
+ void *devfs_token_ttyl;
+ void *devfs_token_ttyi;
+ void *devfs_token_cuaa;
+ void *devfs_token_cual;
+ void *devfs_token_cuai;
+#endif
};
/*
@@ -285,6 +290,8 @@ static void disc_optim __P((struct tty *tp, struct termios *t,
static int LoadSoftModem __P((int unit,int base_io, u_long size, u_char *ptr));
#endif /* DSI_SOFT_MODEM */
+static char driver_name[] = "sio";
+
/* table and macro for fast conversion from a unit number to its com struct */
static struct com_s *p_com_addr[NSIO];
#define com_addr(unit) (p_com_addr[unit])
@@ -292,9 +299,24 @@ static struct com_s *p_com_addr[NSIO];
static struct timeval intr_timestamp;
struct isa_driver siodriver = {
- sioprobe, sioattach, "sio"
+ sioprobe, sioattach, driver_name
};
+static d_open_t sioopen;
+static d_close_t sioclose;
+static d_read_t sioread;
+static d_write_t siowrite;
+static d_ioctl_t sioioctl;
+static d_stop_t siostop;
+static d_ttycv_t siodevtotty;
+
+#define CDEV_MAJOR 28
+struct cdevsw sio_cdevsw =
+ { sioopen, sioclose, sioread, siowrite, /*28*/
+ sioioctl, siostop, nxreset, siodevtotty,/* sio */
+ ttselect, nommap, NULL, driver_name, NULL, -1 };
+
+
static int comconsole = -1;
static speed_t comdefaultrate = TTYDEF_SPEED;
static u_int com_events; /* input chars + weighted output completions */
@@ -338,9 +360,10 @@ static struct speedtab comspeedtab[] = {
{ -1, -1 }
};
+static char chardev[] = "0123456789abcdefghijklmnopqrstuvwxyz";
static struct kern_devconf kdc_sio[NSIO] = { {
0, 0, 0, /* filled in by dev_attach */
- "sio", 0, { MDDT_ISA, 0, "tty" },
+ driver_name, 0, { MDDT_ISA, 0, "tty" },
isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
&kdc_isa0, /* parent */
0, /* parentdata */
@@ -359,7 +382,7 @@ static int sioinit(struct pccard_dev *, int); /* init device */
static struct pccard_drv sio_info =
{
- "sio",
+ driver_name,
card_intr,
siounload,
siosuspend,
@@ -696,6 +719,7 @@ sioattach(isdp)
Port_t iobase;
int s;
int unit;
+ char name[32];
isdp->id_ri_flags |= RI_FAST;
iobase = isdp->id_iobase;
@@ -880,10 +904,37 @@ determined_type: ;
com_addr(unit) = com;
splx(s);
+#ifdef DEVFS
+/* path name devsw minor type uid gid perm*/
+ sprintf(name,"ttyd%c",chardev[unit]);
+ com->devfs_token_ttyd = devfs_add_devsw(
+ "/", name, &sio_cdevsw, unit,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"ttyid%c",chardev[unit]);
+ com->devfs_token_ttyi = devfs_add_devsw(
+ "/", name, &sio_cdevsw, unit+32,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"ttyld%c",chardev[unit]);
+ com->devfs_token_ttyl = devfs_add_devsw(
+ "/", name, &sio_cdevsw, unit+64,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"cuaa%c",chardev[unit]);
+ com->devfs_token_cuaa = devfs_add_devsw(
+ "/", name, &sio_cdevsw, unit+128,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"cuaia%c",chardev[unit]);
+ com->devfs_token_cuai = devfs_add_devsw(
+ "/", name, &sio_cdevsw, unit+160,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"cuala%c",chardev[unit]);
+ com->devfs_token_cual = devfs_add_devsw(
+ "/", name, &sio_cdevsw, unit+192,
+ DV_CHR, 0, 0, 0600);
+#endif
return (1);
}
-int
+static int
sioopen(dev, flag, mode, p)
dev_t dev;
int flag;
@@ -1055,7 +1106,7 @@ out:
return (error);
}
-int
+static int
sioclose(dev, flag, mode, p)
dev_t dev;
int flag;
@@ -1150,7 +1201,7 @@ comhardclose(com)
splx(s);
}
-int
+static int
sioread(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -1170,7 +1221,7 @@ sioread(dev, uio, flag)
return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
}
-int
+static int
siowrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -1429,7 +1480,7 @@ cont:
}
}
-int
+static int
sioioctl(dev, cmd, data, flag, p)
dev_t dev;
int cmd;
@@ -2012,7 +2063,7 @@ comstart(tp)
splx(s);
}
-void
+static void
siostop(tp, rw)
struct tty *tp;
int rw;
@@ -2041,7 +2092,7 @@ siostop(tp, rw)
/* XXX should clear h/w fifos too. */
}
-struct tty *
+static struct tty *
siodevtotty(dev)
dev_t dev;
{
@@ -2559,12 +2610,6 @@ error:
}
#endif /* DSI_SOFT_MODEM */
-#ifdef JREMOD
-struct cdevsw sio_cdevsw =
- { sioopen, sioclose, sioread, siowrite, /*28*/
- sioioctl, siostop, nxreset, siodevtotty,/* sio */
- ttselect, nommap, NULL };
-
static sio_devsw_installed = 0;
static void sio_drvinit(void *unused)
@@ -2572,23 +2617,12 @@ static void sio_drvinit(void *unused)
dev_t dev;
if( ! sio_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&sio_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&sio_cdevsw, NULL);
sio_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "sio", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(siodev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,sio_drvinit,NULL)
-#endif /* JREMOD */
-
#endif /* NSIO > 0 */
diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c
index 8e16b2f..27ffe9f 100644
--- a/sys/dev/snp/snp.c
+++ b/sys/dev/snp/snp.c
@@ -30,15 +30,25 @@
#include <sys/uio.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
-
-#include <sys/snoop.h>
-
-#ifdef JREMOD
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
+
+#include <sys/snoop.h>
+
+static d_open_t snpopen;
+static d_close_t snpclose;
+static d_read_t snpread;
+static d_write_t snpwrite;
+static d_ioctl_t snpioctl;
+static d_select_t snpselect;
+
#define CDEV_MAJOR 53
-#endif /*JREMOD*/
+struct cdevsw snp_cdevsw =
+ { snpopen, snpclose, snpread, snpwrite, /*53*/
+ snpioctl, nostop, nullreset, nodevtotty,/* snoop */
+ snpselect, nommap, NULL, "snp", NULL, -1 };
+
#ifndef MIN
#define MIN(a,b) (((a)<(b))?(a):(b))
@@ -63,7 +73,7 @@ devtotty (dev)
* length for function keys...
*/
-int
+static int
snpwrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -104,7 +114,7 @@ tty_input:
}
-int
+static int
snpread(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -270,7 +280,7 @@ snpin(snp, buf, n)
return n;
}
-int
+static int
snpopen(dev, flag, mode, p)
dev_t dev;
int flag, mode;
@@ -346,7 +356,7 @@ detach_notty:
return (0);
}
-int
+static int
snpclose(dev, flags, fmt, p)
dev_t dev;
int flags;
@@ -376,7 +386,7 @@ snpdown(snp)
}
-int
+static int
snpioctl(dev, cmd, data, flags, p)
dev_t dev;
int cmd;
@@ -473,7 +483,7 @@ snpioctl(dev, cmd, data, flags, p)
}
-int
+static int
snpselect(dev, rw, p)
dev_t dev;
int rw;
@@ -500,29 +510,26 @@ snpselect(dev, rw, p)
return 0;
}
-#ifdef JREMOD
-struct cdevsw snp_cdevsw =
- { snpopen, snpclose, snpread, snpwrite, /*53*/
- snpioctl, nostop, nullreset, nodevtotty,/* snoop */
- snpselect, nommap, NULL };
-
+static void *snp_devfs_token[NSNP];
static snp_devsw_installed = 0;
-static void snp_drvinit(void *unused)
+static void
+snp_drvinit(void *unused)
{
dev_t dev;
+ char name[32];
+ int i;
if( ! snp_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&snp_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&snp_cdevsw, NULL);
snp_devsw_installed = 1;
#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "snp", major(dev), 0, DV_CHR, 0, 0, 0600);
+ for ( i = 0 ; i < NSNP ; i++) {
+ sprintf(name,"snp%d",i);
+ snp_devfs_token[i] =
+ devfs_add_devsw( "/", name, &snp_cdevsw, i,
+ DV_CHR, 0, 0, 0600);
}
#endif
}
@@ -530,6 +537,5 @@ static void snp_drvinit(void *unused)
SYSINIT(snpdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,snp_drvinit,NULL)
-#endif /* JREMOD */
#endif
diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c
index 9d45e33..160c18b 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.19 1995/11/29 10:47:57 julian Exp $
+ * $Id: spkr.c,v 1.20 1995/11/29 14:39:59 julian Exp $
*/
#include "speaker.h"
@@ -18,21 +18,29 @@
#include <sys/buf.h>
#include <sys/proc.h>
#include <sys/uio.h>
+#include <sys/conf.h>
#include <i386/isa/isa.h>
#include <i386/isa/timerreg.h>
#include <machine/clock.h>
#include <machine/speaker.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#define CDEV_MAJOR 26
-#endif /*JREMOD*/
#ifdef DEVFS
#include <sys/devfsext.h>
+void *devfs_token;
#endif
+static d_open_t spkropen;
+static d_close_t spkrclose;
+static d_write_t spkrwrite;
+static d_ioctl_t spkrioctl;
+
+#define CDEV_MAJOR 26
+struct cdevsw spkr_cdevsw =
+ { spkropen, spkrclose, noread, spkrwrite, /*26*/
+ spkrioctl, nostop, nullreset, nodevtotty,/* spkr */
+ seltrue, nommap, NULL, "spkr", NULL, -1 };
/**************** MACHINE DEPENDENT PART STARTS HERE *************************
*
@@ -569,11 +577,6 @@ struct proc *p;
return(EINVAL);
}
-#ifdef JREMOD
-struct cdevsw spkr_cdevsw =
- { spkropen, spkrclose, noread, spkrwrite, /*26*/
- spkrioctl, nostop, nullreset, nodevtotty,/* spkr */
- seltrue, nommap, NULL };
static spkr_devsw_installed = 0;
@@ -582,24 +585,19 @@ static void spkr_drvinit(void *unused)
dev_t dev;
if( ! spkr_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&spkr_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&spkr_cdevsw, NULL);
spkr_devsw_installed = 1;
#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "spkr", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
+ devfs_token = devfs_add_devsw("/", "spkr",
+ &spkr_cdevsw, 0,
+ DV_CHR, 0, 0, 0600);
#endif
}
}
SYSINIT(spkrdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,spkr_drvinit,NULL)
-#endif /* JREMOD */
#endif /* NSPEAKER > 0 */
/* spkr.c ends here */
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
index 6c736ca..db7c92d 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.133 1995/12/06 23:50:36 bde Exp $
+ * $Id: syscons.c,v 1.134 1995/12/07 12:46:08 davidg Exp $
*/
#include "sc.h"
@@ -45,6 +45,9 @@
#include <sys/errno.h>
#include <sys/malloc.h>
#include <sys/devconf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif
#include <machine/clock.h>
#include <machine/cons.h>
@@ -69,6 +72,7 @@
#define MAXCONS 16
#endif
+
/* this may break on older VGA's but is usefull on real 32 bit systems */
#define bcopyw bcopy
@@ -84,6 +88,7 @@ static default_attr kernel_default = {
static scr_stat main_console;
static scr_stat *console[MAXCONS];
+static void *sc_devfs_token[MAXCONS];
scr_stat *cur_console;
static scr_stat *new_scp, *old_scp;
static term_stat kernel_console;
@@ -159,8 +164,7 @@ static d_mmap_t scmmap;
static struct cdevsw scdevsw = {
scopen, scclose, scread, scwrite,
scioctl, nullstop, noreset, scdevtotty,
- ttselect, scmmap, nostrategy,
-};
+ ttselect, scmmap, nostrategy, "sc", NULL, -1 };
/*
* Calculate hardware attributes word using logical attributes mask and
@@ -283,7 +287,9 @@ scresume(void *dummy)
int
scattach(struct isa_device *dev)
{
- scr_stat *scp;
+ scr_stat *scp;
+ int vc;
+ char name[32];
scinit();
configuration = dev->id_flags;
@@ -345,6 +351,13 @@ scattach(struct isa_device *dev)
apm_hook_establish(APM_HOOK_RESUME , &scp->r_hook);
#endif
+#ifdef DEVFS
+ for ( vc = 0 ; vc < MAXCONS; vc++) {
+ sprintf(name,"ttyv%x", vc);
+ sc_devfs_token[vc] = devfs_add_devsw("/" ,name, &scdevsw, vc,
+ DV_CHR, 0, 0, 0600 );
+ }
+#endif
register_cdev("sc", &scdevsw);
return 0;
diff --git a/sys/dev/vn/vn.c b/sys/dev/vn/vn.c
index 1a16364..68ba760 100644
--- a/sys/dev/vn/vn.c
+++ b/sys/dev/vn/vn.c
@@ -83,19 +83,35 @@
#include <sys/disklabel.h>
#include <sys/diskslice.h>
#include <sys/stat.h>
+#include <sys/conf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <miscfs/specfs/specdev.h>
#include <sys/vnioctl.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
+static d_open_t vnopen;
+static d_close_t vnclose;
+static d_ioctl_t vnioctl;
+static d_dump_t vndump;
+static d_psize_t vnsize;
+static d_strategy_t vnstrategy;
+
#define CDEV_MAJOR 43
#define BDEV_MAJOR 15
-#endif /*JREMOD */
+extern struct cdevsw vn_cdevsw;
+struct bdevsw vn_bdevsw =
+ { vnopen, vnclose, vnstrategy, vnioctl, /*15*/
+ vndump, vnsize, 0, "vn", &vn_cdevsw, -1 };
+
+struct cdevsw vn_cdevsw =
+ { vnopen, vnclose, rawread, rawwrite, /*43*/
+ vnioctl, nostop, nullreset, nodevtotty,/* vn */
+ seltrue, nommap, vnstrategy, "vn",
+ &vn_bdevsw, -1 };
+
#ifdef DEBUG
@@ -141,7 +157,7 @@ int vnsetcred __P((struct vn_softc *vn, struct ucred *cred));
void vnshutdown __P((void));
void vnclear __P((struct vn_softc *vn));
-int
+static int
vnclose(dev_t dev, int flags, int mode, struct proc *p)
{
struct vn_softc *vn = vn_softc[vnunit(dev)];
@@ -152,7 +168,7 @@ vnclose(dev_t dev, int flags, int mode, struct proc *p)
return (0);
}
-int
+static int
vnopen(dev_t dev, int flags, int mode, struct proc *p)
{
int unit = vnunit(dev);
@@ -212,7 +228,7 @@ vnopen(dev_t dev, int flags, int mode, struct proc *p)
* and the pageout daemon gets really unhappy (and so does the rest of the
* system) when it runs out of memory.
*/
-void
+static void
vnstrategy(struct buf *bp)
{
int unit = vnunit(bp->b_dev);
@@ -379,7 +395,7 @@ vniodone( struct buf *bp) {
}
/* ARGSUSED */
-int
+static int
vnioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
{
struct vn_softc *vn = vn_softc[vnunit(dev)];
@@ -580,7 +596,7 @@ vnclear(struct vn_softc *vn)
dsgone(&vn->sc_slices);
}
-int
+static int
vnsize(dev_t dev)
{
int unit = vnunit(dev);
@@ -591,44 +607,33 @@ vnsize(dev_t dev)
return(vn_softc[unit]->sc_size);
}
-int
+static int
vndump(dev_t dev)
{
return (ENODEV);
}
-#ifdef JREMOD
-struct bdevsw vn_bdevsw =
- { vnopen, vnclose, vnstrategy, vnioctl, /*15*/
- vndump, vnsize, 0 };
-
-struct cdevsw vn_cdevsw =
- { vnopen, vnclose, rawread, rawwrite, /*43*/
- vnioctl, nostop, nullreset, nodevtotty,/* vn */
- seltrue, nommap, vnstrategy };
-
static vn_devsw_installed = 0;
-static void vn_drvinit(void *unused)
+static void
+vn_drvinit(void *unused)
{
dev_t dev;
- dev_t dev_chr;
if( ! vn_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&vn_cdevsw,NULL);
- dev_chr = dev;
dev = makedev(BDEV_MAJOR,0);
bdevsw_add(&dev,&vn_bdevsw,NULL);
vn_devsw_installed = 1;
#ifdef DEVFS
{
- int x;
+ void *x;
/* default for a simple device with no probe routine (usually delete this) */
x=devfs_add_devsw(
/* path name major minor type uid gid perm*/
- "/", "rvn", major(dev_chr), 0, DV_CHR, 0, 0, 0600);
+ "/", "rvn", &vn_cdevsw, 0, DV_CHR, 0, 0, 0600);
x=devfs_add_devsw(
- "/", "vn", major(dev), 0, DV_BLK, 0, 0, 0600);
+ "/", "vn", &vn_bdevsw, 0, DV_BLK, 0, 0, 0600);
}
#endif
}
@@ -636,6 +641,5 @@ static void vn_drvinit(void *unused)
SYSINIT(vndev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,vn_drvinit,NULL)
-#endif /* JREMOD */
#endif
diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c
index e4eaafc..bec6bc7 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.13 1995/12/03 14:54:10 bde Exp $
+ * $Id: fdesc_vnops.c,v 1.14 1995/12/05 19:12:05 bde Exp $
*/
/*
@@ -58,8 +58,11 @@
#include <sys/dirent.h>
#include <sys/socketvar.h>
#include <sys/tty.h>
+#include <sys/conf.h>
#include <miscfs/fdesc/fdesc.h>
+extern struct cdevsw ctty_cdevsw;
+
#define cttyvp(p) ((p)->p_flag & P_CONTROLT ? (p)->p_session->s_ttyvp : NULL)
#define FDL_WANT 0x01
@@ -363,7 +366,7 @@ fdesc_open(ap)
break;
case Fctty:
- error = cttyopen(devctty, ap->a_mode, 0, ap->a_p);
+ error = (*ctty_cdevsw.d_open)(devctty, ap->a_mode, 0, ap->a_p);
break;
}
@@ -710,7 +713,7 @@ fdesc_read(ap)
switch (VTOFDESC(ap->a_vp)->fd_type) {
case Fctty:
- error = cttyread(devctty, ap->a_uio, ap->a_ioflag);
+ error = (*ctty_cdevsw.d_read)(devctty, ap->a_uio, ap->a_ioflag);
break;
default:
@@ -734,7 +737,7 @@ fdesc_write(ap)
switch (VTOFDESC(ap->a_vp)->fd_type) {
case Fctty:
- error = cttywrite(devctty, ap->a_uio, ap->a_ioflag);
+ error = (*ctty_cdevsw.d_write)(devctty, ap->a_uio, ap->a_ioflag);
break;
default:
@@ -760,8 +763,8 @@ fdesc_ioctl(ap)
switch (VTOFDESC(ap->a_vp)->fd_type) {
case Fctty:
- error = cttyioctl(devctty, ap->a_command, ap->a_data,
- ap->a_fflag, ap->a_p);
+ error = (*ctty_cdevsw.d_ioctl)(devctty, ap->a_command,
+ ap->a_data, ap->a_fflag, ap->a_p);
break;
default:
@@ -786,7 +789,7 @@ fdesc_select(ap)
switch (VTOFDESC(ap->a_vp)->fd_type) {
case Fctty:
- error = cttyselect(devctty, ap->a_fflags, ap->a_p);
+ error = (*ctty_cdevsw.d_select)(devctty, ap->a_fflags, ap->a_p);
break;
default:
diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c
index 38e694e..3a04353 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.6 (Berkeley) 4/9/94
- * $Id: spec_vnops.c,v 1.20 1995/12/05 21:51:45 bde Exp $
+ * $Id: spec_vnops.c,v 1.21 1995/12/07 12:47:17 davidg Exp $
*/
#include <sys/param.h>
@@ -159,10 +159,8 @@ spec_open(ap)
case VCHR:
if ((u_int)maj >= nchrdev)
return (ENXIO);
-#ifdef JREMOD
if ( cdevsw[maj].d_open == NULL)
return ENXIO;
-#endif /*JREMOD*/
if (ap->a_cred != FSCRED && (ap->a_mode & FWRITE)) {
/*
* When running in very secure mode, do not allow
@@ -194,10 +192,8 @@ spec_open(ap)
case VBLK:
if ((u_int)maj >= nblkdev)
return (ENXIO);
-#ifdef JREMOD
if ( bdevsw[maj].d_open == NULL)
return ENXIO;
-#endif /*JREMOD*/
/*
* When running in very secure mode, do not allow
* opens for writing of any disk block devices.
diff --git a/sys/gnu/i386/isa/dgb.c b/sys/gnu/i386/isa/dgb.c
index 68499f8..8187b44 100644
--- a/sys/gnu/i386/isa/dgb.c
+++ b/sys/gnu/i386/isa/dgb.c
@@ -1,5 +1,5 @@
/*-
- * dgb.c $Id: dgb.c,v 1.8 1995/12/06 23:52:08 bde Exp $
+ * dgb.c $Id: dgb.c,v 1.9 1995/12/07 12:45:18 davidg Exp $
*
* Digiboard driver.
*
@@ -40,6 +40,9 @@
#include <sys/malloc.h>
#include <sys/syslog.h>
#include <sys/devconf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/clock.h>
@@ -54,12 +57,6 @@
#include <gnu/i386/isa/dgfep.h>
#include <gnu/i386/isa/dgreg.h>
-#ifdef JREMOD
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 58
-#endif /*JREMOD*/
#define CALLOUT_MASK 0x80
#define CONTROL_MASK 0x60
@@ -132,6 +129,14 @@ struct dgb_p {
u_char draining; /* port is being drained now */
u_char used; /* port is being used now */
u_char mustdrain; /* data must be waited to drain in dgbparam() */
+#ifdef DEVFS
+ struct {
+ void *tty;
+ void *init;
+ void *lock;
+ void *cua;
+ } devfs_token;
+#endif
};
/* Digiboard per-board structure */
@@ -190,6 +195,20 @@ struct isa_driver dgbdriver = {
dgbprobe, dgbattach, "dgb",0
};
+static d_open_t dgbopen;
+static d_close_t dgbclose;
+static d_read_t dgbread;
+static d_write_t dgbwrite;
+static d_ioctl_t dgbioctl;
+static d_stop_t dgbstop;
+static d_ttycv_t dgbdevtotty;
+
+#define CDEV_MAJOR 58
+struct cdevsw dgb_cdevsw =
+ { dgbopen, dgbclose, dgbread, dgbwrite, /*58*/
+ dgbioctl, dgbstop, nxreset, dgbdevtotty, /* dgb */
+ ttselect, nommap, NULL, "dgb", NULL, -1 };
+
static speed_t dgbdefaultrate = TTYDEF_SPEED;
static u_int dgb_events; /* input chars + weighted output completions */
static int dgbmajor;
@@ -437,6 +456,7 @@ dgbattach(dev)
ushort *pstat;
int lowwater;
int nports=0;
+ char name[32];
if(sc->status!=ENABLED) {
DPRINT2("dbg%d: try to attach a disabled card\n",unit);
@@ -832,6 +852,28 @@ load_fep:
termioschars(&port->it_in);
port->it_in.c_ispeed = port->it_in.c_ospeed = dgbdefaultrate;
port->it_out = port->it_in;
+#ifdef DEVFS
+/*XXX*/ /* fix the minor numbers */
+ sprintf(name,"dgb%d.%d",unit,i);
+ port->devfs_token.tty = devfs_add_devsw("/",name,
+ &dgb_cdevsw,(unit*32)+i, /*mytical number */
+ DV_CHR, 0, 0, 0600);
+
+ sprintf(name,"idgb%d.%d",unit,i);
+ port->devfs_token.tty = devfs_add_devsw("/",name,
+ &dgb_cdevsw,(unit*32)+i + 64, /*mytical number */
+ DV_CHR, 0, 0, 0600);
+
+ sprintf(name,"ldgb%d.%d",unit,i);
+ port->devfs_token.tty = devfs_add_devsw("/",name,
+ &dgb_cdevsw,(unit*32)+i + 128, /*mytical number */
+ DV_CHR, 0, 0, 0600);
+
+ sprintf(name,"dgbcua%d.%d",unit,i);
+ port->devfs_token.tty = devfs_add_devsw("/",name,
+ &dgb_cdevsw,(unit*32)+i + 192, /*mytical number */
+ DV_CHR, 0, 0, 0600);
+#endif
}
hidewin(sc);
@@ -843,7 +885,7 @@ load_fep:
}
/* ARGSUSED */
-int
+static int
dgbopen(dev, flag, mode, p)
dev_t dev;
int flag;
@@ -1011,7 +1053,7 @@ out:
}
/*ARGSUSED*/
-int
+static int
dgbclose(dev, flag, mode, p)
dev_t dev;
int flag;
@@ -1087,7 +1129,7 @@ wakeup((caddr_t)chan);
}
-int
+static int
dgbread(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -1111,7 +1153,7 @@ dgbread(dev, uio, flag)
return error;
}
-int
+static int
dgbwrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -1363,7 +1405,7 @@ dgbintr(unit)
{
}
-int
+static int
dgbioctl(dev, cmd, data, flag, p)
dev_t dev;
int cmd;
@@ -1989,36 +2031,21 @@ fepcmd(port, cmd, op1, op2, ncmds, bytecmd)
port->unit, port->pnum);
}
-#ifdef JREMOD
-struct cdevsw dgb_cdevsw =
- { dgbopen, dgbclose, dgbread, dgbwrite, /*58*/
- dgbioctl, dgbstop, nxreset, dgbdevtotty, /* dgb */
- ttselect, nommap, NULL };
static dgb_devsw_installed = 0;
-static void dgb_drvinit(void *unused)
+static void
+dgb_drvinit(void *unused)
{
dev_t dev;
if( ! dgb_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&dgb_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&dgb_cdevsw, NULL);
dgb_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name major minor type uid gid perm*/
- "/", "dgb", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(dgbdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,dgb_drvinit,NULL)
-#endif /* JREMOD */
-
#endif /* NDGB > 0 */
diff --git a/sys/gnu/i386/isa/nic3008.c b/sys/gnu/i386/isa/nic3008.c
index a685131..85a4081 100644
--- a/sys/gnu/i386/isa/nic3008.c
+++ b/sys/gnu/i386/isa/nic3008.c
@@ -1,6 +1,6 @@
-static char nic38_id[] = "@(#)$Id: nic3008.c,v 1.10 1995/11/29 10:47:04 julian Exp $";
+static char nic38_id[] = "@(#)$Id: nic3008.c,v 1.11 1995/11/29 14:39:07 julian Exp $";
/*******************************************************************************
- * II - Version 0.1 $Revision: 1.10 $ $State: Exp $
+ * II - Version 0.1 $Revision: 1.11 $ $State: Exp $
*
* Copyright 1994 Dietmar Friede
*******************************************************************************
@@ -10,6 +10,10 @@ static char nic38_id[] = "@(#)$Id: nic3008.c,v 1.10 1995/11/29 10:47:04 juli
*
*******************************************************************************
* $Log: nic3008.c,v $
+ * Revision 1.11 1995/11/29 14:39:07 julian
+ * If you're going to mechanically replicate something in 50 files
+ * it's best to not have a (compiles cleanly) typo in it! (sigh)
+ *
* Revision 1.10 1995/11/29 10:47:04 julian
* OK, that's it..
* That's EVERY SINGLE driver that has an entry in conf.c..
@@ -69,24 +73,20 @@ static char nic38_id[] = "@(#)$Id: nic3008.c,v 1.10 1995/11/29 10:47:04 juli
#include "nic.h"
#if NNIC > 0
-#include "param.h"
-#include "ioctl.h"
-#include "kernel.h"
-#include "systm.h"
+#include <sys/param.h>
+#include <sys/ioctl.h>
+#include <sys/kernel.h>
+#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/proc.h>
-
-#include "i386/isa/isa_device.h"
-#include "gnu/i386/isa/nic3008.h"
-#include "gnu/i386/isa/niccyreg.h"
-#include "gnu/isdn/isdn_ioctl.h"
-
-#ifdef JREMOD
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
-#define CDEV_MAJOR 54
-#endif /*JREMOD*/
+
+#include <i386/isa/isa_device.h>
+#include <gnu/i386/isa/nic3008.h>
+#include <gnu/i386/isa/niccyreg.h>
+#include <gnu/isdn/isdn_ioctl.h>
#define OPEN 1
@@ -131,6 +131,16 @@ static short bsintr;
struct isa_driver nicdriver = {nicprobe, nicattach, "nic"};
+static d_open_t nicopen;
+static d_close_t nicclose;
+static d_ioctl_t nicioctl;
+
+#define CDEV_MAJOR 54
+struct cdevsw nic_cdevsw =
+ { nicopen, nicclose, noread, nowrite, /*54*/
+ nicioctl, nostop, nullreset, nodevtotty,/* nic */
+ seltrue, nommap, NULL, "nic", NULL, -1 };
+
typedef enum
{
DISCON, ISDISCON, DIAL, CALLED, CONNECT, IDLE, ACTIVE
@@ -160,6 +170,9 @@ struct nic_softc
u_char sc_ctrl;
short sc_stat;
chan_t sc_chan[2];
+#ifdef DEVFS
+ void *devfs_token;
+#endif
} nic_sc[NNIC];
static void badstate __P((mbx_type *mbx, int n, int mb, dpr_type *dpr));
@@ -226,6 +239,7 @@ nicattach(struct isa_device * is)
dpr_type *dpr;
int cn;
isdn_ctrl_t *ctrl0, *ctrl1;
+ char name[32];
sc = &nic_sc[is->id_unit];
dpr = sc->sc_dpr;
@@ -257,6 +271,11 @@ nicattach(struct isa_device * is)
dpr->card_number = is->id_unit;
dpr->int_flg_pc = 0xff;
reset_req(sc, MBX_MU, 4);
+#ifdef DEVFS
+ sprintf(name,"nic%d",is->id_unit);
+ sc->devfs_token = devfs_add_devsw( "/isdn", name,
+ &nic_cdevsw,is->id_unit, DV_CHR, 0, 0, 0600 );
+#endif
return (1);
}
@@ -605,7 +624,7 @@ reset_card(struct nic_softc * sc)
*
* We forbid all but first open
*/
-int
+static int
nicopen(dev_t dev, int flags, int fmt, struct proc *p)
{
struct nic_softc *sc;
@@ -636,7 +655,7 @@ nicopen(dev_t dev, int flags, int fmt, struct proc *p)
/*
* nicclose() Close device
*/
-int
+static int
nicclose(dev_t dev, int flags, int fmt, struct proc *p)
{
struct nic_softc *sc = &nic_sc[minor(dev)];
@@ -645,7 +664,7 @@ nicclose(dev_t dev, int flags, int fmt, struct proc *p)
return (0);
}
-int
+static int
nicioctl(dev_t dev, int cmd, caddr_t data, int flags, struct proc *p)
{
int error;
@@ -1225,12 +1244,6 @@ nicintr(int unit)
}
-#ifdef JREMOD
-struct cdevsw nic_cdevsw =
- { nicopen, nicclose, noread, nowrite, /*54*/
- nicioctl, nostop, nullreset, nodevtotty,/* nic */
- seltrue, nommap, NULL };
-
static nic_devsw_installed = 0;
static void nic_drvinit(void *unused)
@@ -1238,23 +1251,12 @@ static void nic_drvinit(void *unused)
dev_t dev;
if( ! nic_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&nic_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR ,0);
+ cdevsw_add(&dev,&nic_cdevsw, NULL);
nic_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "nic", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(nicdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,nic_drvinit,NULL)
-#endif /* JREMOD */
-
#endif /* NNIC > 0 */
diff --git a/sys/gnu/i386/isa/nic3009.c b/sys/gnu/i386/isa/nic3009.c
index 0a6fe04..8359c9d 100644
--- a/sys/gnu/i386/isa/nic3009.c
+++ b/sys/gnu/i386/isa/nic3009.c
@@ -1,6 +1,6 @@
-static char nic39_id[] = "@(#)$Id: nic3009.c,v 1.10 1995/11/29 10:47:05 julian Exp $";
+static char nic39_id[] = "@(#)$Id: nic3009.c,v 1.11 1995/11/29 14:39:08 julian Exp $";
/*******************************************************************************
- * II - Version 0.1 $Revision: 1.10 $ $State: Exp $
+ * II - Version 0.1 $Revision: 1.11 $ $State: Exp $
*
* Copyright 1994 Dietmar Friede
*******************************************************************************
@@ -10,6 +10,10 @@ static char nic39_id[] = "@(#)$Id: nic3009.c,v 1.10 1995/11/29 10:47:05 juli
*
*******************************************************************************
* $Log: nic3009.c,v $
+ * Revision 1.11 1995/11/29 14:39:08 julian
+ * If you're going to mechanically replicate something in 50 files
+ * it's best to not have a (compiles cleanly) typo in it! (sigh)
+ *
* Revision 1.10 1995/11/29 10:47:05 julian
* OK, that's it..
* That's EVERY SINGLE driver that has an entry in conf.c..
@@ -74,18 +78,15 @@ static char nic39_id[] = "@(#)$Id: nic3009.c,v 1.10 1995/11/29 10:47:05 juli
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/proc.h>
-
-#include "i386/isa/isa_device.h"
-#include "gnu/i386/isa/nic3009.h"
-#include "gnu/i386/isa/niccyreg.h"
-#include "gnu/isdn/isdn_ioctl.h"
-
-#ifdef JREMOD
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
-#define CDEV_MAJOR 60
-#endif /*JREMOD*/
+
+#include <i386/isa/isa_device.h>
+#include <gnu/i386/isa/nic3009.h>
+#include <gnu/i386/isa/niccyreg.h>
+#include <gnu/isdn/isdn_ioctl.h>
+
#define OPEN 1
#define LOAD_HEAD 3
@@ -122,6 +123,17 @@ extern int nnic_listen __P((int cn, int ap, int inf_mask,
extern int nnic_output __P((int cn));
extern int nnic_state __P((int cn));
+static d_open_t nnicopen;
+static d_close_t nnicclose;
+static d_ioctl_t nnicioctl;
+
+#define CDEV_MAJOR 60
+struct cdevsw nnic_cdevsw =
+ { nnicopen, nnicclose, noread, nowrite, /*60*/
+ nnicioctl, nostop, nullreset, nodevtotty,/* nnic */
+ seltrue, nommap, NULL, "nnic", NULL, -1 };
+
+
static short bsintr;
struct isa_driver nnicdriver = {nnicprobe, nnicattach, "nnic"};
@@ -157,6 +169,9 @@ struct nnic_softc
u_char sc_type;
short sc_stat;
chan_t sc_chan[2];
+#ifdef DEVFS
+ void *devfs_token;
+#endif
} nnic_sc[NNNIC];
static void badstate __P((mbx_type *mbx, int n, int mb, dpr_type *dpr));
@@ -230,6 +245,7 @@ nnicattach(struct isa_device * is)
struct nnic_softc *sc;
int cn;
isdn_ctrl_t *ctrl0, *ctrl1;
+ char name[32];
sc = &nnic_sc[is->id_unit];
sc->sc_ctrl = -1;
@@ -256,6 +272,11 @@ nnicattach(struct isa_device * is)
ctrl0->appl = ctrl1->appl = -1;
ctrl0->o_len = ctrl1->o_len = -1;
sc->sc_flags= LOAD_ENTITY;
+#ifdef DEVFS
+ sprintf(name,"nnic%d",is->id_unit);
+ sc->devfs_token = devfs_add_devsw("/isdn",name,
+ &nnic_cdevsw, is->id_unit, DV_CHR, 0, 0, 0600 );
+#endif
return (1);
}
@@ -548,7 +569,7 @@ nnic_accept(int cn, int an, int rea)
return(sel_b2_prot_req(ctrl->unit, C_CHAN(cn), chan->plci, &appl->dlpd));
}
-int
+static int
nnicopen(dev_t dev, int flags, int fmt, struct proc *p)
{
struct nnic_softc *sc;
@@ -578,7 +599,7 @@ nnicopen(dev_t dev, int flags, int fmt, struct proc *p)
return (0);
}
-int
+static int
nnicclose(dev_t dev, int flags, int fmt, struct proc *p)
{
struct nnic_softc *sc = &nnic_sc[minor(dev)];
@@ -587,7 +608,7 @@ nnicclose(dev_t dev, int flags, int fmt, struct proc *p)
return (0);
}
-int
+static int
nnicioctl(dev_t dev, int cmd, caddr_t data, int flags, struct proc *pr)
{
int error;
@@ -1288,12 +1309,6 @@ nnicintr(int unit)
}
-#ifdef JREMOD
-struct cdevsw nnic_cdevsw =
- { nnicopen, nnicclose, noread, nowrite, /*60*/
- nnicioctl, nostop, nullreset, nodevtotty,/* nnic */
- seltrue, nommap, NULL };
-
static nnic_devsw_installed = 0;
static void nnic_drvinit(void *unused)
@@ -1301,23 +1316,12 @@ static void nnic_drvinit(void *unused)
dev_t dev;
if( ! nnic_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&nnic_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&nnic_cdevsw, NULL);
nnic_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "nnic", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(nnicdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,nnic_drvinit,NULL)
-#endif /* JREMOD */
-
#endif /* NNNIC > 0 */
diff --git a/sys/gnu/isdn/iispy.c b/sys/gnu/isdn/iispy.c
index e708d4d..470bea1 100644
--- a/sys/gnu/isdn/iispy.c
+++ b/sys/gnu/isdn/iispy.c
@@ -1,6 +1,6 @@
-static char _ispyid[] = "@(#)$Id: iispy.c,v 1.6 1995/11/29 14:39:10 julian Exp $";
+static char _ispyid[] = "@(#)$Id: iispy.c,v 1.7 1995/12/06 23:43:37 bde Exp $";
/*******************************************************************************
- * II - Version 0.1 $Revision: 1.6 $ $State: Exp $
+ * II - Version 0.1 $Revision: 1.7 $ $State: Exp $
*
* Copyright 1994 Dietmar Friede
*******************************************************************************
@@ -10,6 +10,13 @@ static char _ispyid[] = "@(#)$Id: iispy.c,v 1.6 1995/11/29 14:39:10 julian E
*
*******************************************************************************
* $Log: iispy.c,v $
+ * Revision 1.7 1995/12/06 23:43:37 bde
+ * Removed unnecessary #includes of <sys/user.h>. Some of these were just
+ * to get the definitions of TRUE and FALSE which happen to be defined in
+ * a deeply nested include.
+ *
+ * Added nearby #includes of <sys/conf.h> where appropriate.
+ *
* Revision 1.6 1995/11/29 14:39:10 julian
* If you're going to mechanically replicate something in 50 files
* it's best to not have a (compiles cleanly) typo in it! (sigh)
@@ -47,26 +54,22 @@ static char _ispyid[] = "@(#)$Id: iispy.c,v 1.6 1995/11/29 14:39:10 julian E
#include "ispy.h"
#if NISPY > 0
-#include "param.h"
-#include "buf.h"
-#include "systm.h"
-#include "conf.h"
-#include "ioctl.h"
-#include "tty.h"
-#include "proc.h"
-#include "uio.h"
+#include <sys/param.h>
+#include <sys/buf.h>
+#include <sys/systm.h>
+#include <sys/ioctl.h>
+#include <sys/tty.h>
+#include <sys/proc.h>
+#include <sys/uio.h>
#include <sys/kernel.h>
-/*#include "malloc.h"*/
-
-#include "gnu/isdn/isdn_ioctl.h"
-
-#ifdef JREMOD
#include <sys/conf.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
-#define CDEV_MAJOR 59
-#endif /*JREMOD*/
+/*#include "malloc.h"*/
+
+#include <gnu/isdn/isdn_ioctl.h>
+
int nispy = NISPY;
int ispy_applnr;
@@ -92,17 +95,39 @@ struct ispy_data
int ilen;
} b[ISPYBUF];
int state;
+#ifdef DEVFS
+ void *devfs_token;
+#endif
} ispy_data[NISPY];
+static d_open_t ispyopen;
+static d_close_t ispyclose;
+static d_read_t ispyread;
+static d_ioctl_t ispyioctl;
+
+#define CDEV_MAJOR 59
+struct cdevsw ispy_cdevsw =
+ { ispyopen, ispyclose, ispyread, nowrite, /*59*/
+ ispyioctl, nostop, nullreset, nodevtotty,/* ispy */
+ seltrue, nommap, NULL, "ispy", NULL, -1 };
+
+
int
ispyattach(int ap)
{
+ char name[32];
struct ispy_data *ispy;
+
if(next_if >= NISPY)
return(-1);
ispy= &ispy_data[next_if];
ispy->state= 0;
ispy_applnr= ap;
+#ifdef DEVFS
+ sprintf(name,"ispy%d",next_if);
+ ispy->devfs_token =devfs_add_devsw("/isdn",name,&ispy_cdevsw,next_if,
+ DV_CHR, 0, 0, 0600);
+#endif
return(next_if++);
}
@@ -130,7 +155,7 @@ ispy_input(int no, int len, char *buf, int out)
return(len);
}
-int
+static int
ispyopen(dev_t dev, int flags, int fmt, struct proc *p)
{
int err;
@@ -147,7 +172,7 @@ ispyopen(dev_t dev, int flags, int fmt, struct proc *p)
return (0);
}
-int
+static int
ispyclose(dev_t dev, int flags, int fmt, struct proc *p)
{
struct ispy_data *ispy= &ispy_data[minor(dev)];
@@ -158,7 +183,7 @@ ispyclose(dev_t dev, int flags, int fmt, struct proc *p)
return (0);
}
-int
+static int
ispyioctl (dev_t dev, int cmd, caddr_t data, int flags, struct proc *p)
{
int unit = minor(dev);
@@ -170,7 +195,7 @@ ispyioctl (dev_t dev, int cmd, caddr_t data, int flags, struct proc *p)
return (0);
}
-int
+static int
ispyread(dev_t dev, struct uio * uio, int ioflag)
{
int x;
@@ -202,36 +227,20 @@ ispyread(dev_t dev, struct uio * uio, int ioflag)
return error;
}
-#ifdef JREMOD
-struct cdevsw ispy_cdevsw =
- { ispyopen, ispyclose, ispyread, nowrite, /*59*/
- ispyioctl, nostop, nullreset, nodevtotty,/* ispy */
- seltrue, nommap, NULL };
-
static ispy_devsw_installed = 0;
-static void ispy_drvinit(void *unused)
+static void
+ispy_drvinit(void *unused)
{
dev_t dev;
if( ! ispy_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&ispy_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&ispy_cdevsw, NULL);
ispy_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "ispy", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(ispydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,ispy_drvinit,NULL)
-#endif /* JREMOD */
-
#endif
diff --git a/sys/gnu/isdn/iitel.c b/sys/gnu/isdn/iitel.c
index 1da86ba..21c87e8 100644
--- a/sys/gnu/isdn/iitel.c
+++ b/sys/gnu/isdn/iitel.c
@@ -1,6 +1,6 @@
-static char _itelid[] = "@(#)$Id: iitel.c,v 1.7 1995/11/29 10:47:08 julian Exp $";
+static char _itelid[] = "@(#)$Id: iitel.c,v 1.8 1995/11/29 14:39:11 julian Exp $";
/*******************************************************************************
- * II - Version 0.1 $Revision: 1.7 $ $State: Exp $
+ * II - Version 0.1 $Revision: 1.8 $ $State: Exp $
*
* Copyright 1994 Dietmar Friede
*******************************************************************************
@@ -10,6 +10,10 @@ static char _itelid[] = "@(#)$Id: iitel.c,v 1.7 1995/11/29 10:47:08 julian E
*
*******************************************************************************
* $Log: iitel.c,v $
+ * Revision 1.8 1995/11/29 14:39:11 julian
+ * If you're going to mechanically replicate something in 50 files
+ * it's best to not have a (compiles cleanly) typo in it! (sigh)
+ *
* Revision 1.7 1995/11/29 10:47:08 julian
* OK, that's it..
* That's EVERY SINGLE driver that has an entry in conf.c..
@@ -63,15 +67,12 @@ static char _itelid[] = "@(#)$Id: iitel.c,v 1.7 1995/11/29 10:47:08 julian E
#include <sys/uio.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
-
-#include "gnu/isdn/isdn_ioctl.h"
-
-#ifdef JREMOD
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
-#define CDEV_MAJOR 57
-#endif /*JREMOD*/
+
+#include "gnu/isdn/isdn_ioctl.h"
+
int nitel = NITEL;
static int applnr[NITEL];
@@ -83,6 +84,18 @@ static int next_if =0;
#define WRITE_WAIT 8
#define min(a,b) ((a)<(b)?(a):(b))
+static d_open_t itelopen;
+static d_close_t itelclose;
+static d_read_t itelread;
+static d_write_t itelwrite;
+static d_ioctl_t itelioctl;
+
+#define CDEV_MAJOR 57
+struct cdevsw itel_cdevsw =
+ { itelopen, itelclose, itelread, itelwrite, /*57*/
+ itelioctl, nostop, nullreset, nodevtotty,/* itel */
+ seltrue, nommap, NULL, "itel", NULL, -1 };
+
static
struct itel_data
{
@@ -90,18 +103,28 @@ struct itel_data
char obuf[ITEL_SIZE];
int state;
int ilen, olen;
+#ifdef DEVFS
+ void *devfs_token;
+#endif
} itel_data[NITEL];
int
itelattach(int ap)
{
struct itel_data *itel;
+ char name[32];
+
if(next_if >= NITEL)
return(-1);
itel= &itel_data[next_if];
itel->ilen= itel->olen= 0;
itel->state= 0;
applnr[next_if]= ap;
+#ifdef DEVFS
+ sprintf(name,"itel%d",next_if);
+ itel->devfs_token = devfs_add_devsw("/isdn",name,&itel_cdevsw,next_if,
+ DV_CHR, 0, 0, 0600);
+#endif
return(next_if++);
}
@@ -270,42 +293,19 @@ itelwrite(dev_t dev, struct uio * uio, int ioflag)
return error;
}
-#ifdef JREMOD
-struct cdevsw itel_cdevsw =
- { itelopen, itelclose, itelread, itelwrite, /*57*/
- itelioctl, nostop, nullreset, nodevtotty,/* itel */
- seltrue, nommap, NULL };
-
static itel_devsw_installed = 0;
static void itel_drvinit(void *unused)
{
dev_t dev;
- dev_t dev_chr;
if( ! itel_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&itel_cdevsw,NULL);
- dev_chr = dev;
-#if defined(BDEV_MAJOR)
- dev = makedev(BDEV_MAJOR,0);
- bdevsw_add(&dev,&itel_bdevsw,NULL);
-#endif /*BDEV_MAJOR*/
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&itel_cdevsw, NULL);
itel_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "itel", major(dev_chr), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(iteldev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,itel_drvinit,NULL)
-#endif /* JREMOD */
-
#endif
diff --git a/sys/gnu/isdn/iitty.c b/sys/gnu/isdn/iitty.c
index 140cc91..3c4bf87 100644
--- a/sys/gnu/isdn/iitty.c
+++ b/sys/gnu/isdn/iitty.c
@@ -1,6 +1,6 @@
-static char _ittyid[] = "@(#)$Id: iitty.c,v 1.14 1995/11/29 14:39:12 julian Exp $";
+static char _ittyid[] = "@(#)$Id: iitty.c,v 1.15 1995/12/05 20:33:47 bde Exp $";
/*******************************************************************************
- * II - Version 0.1 $Revision: 1.14 $ $State: Exp $
+ * II - Version 0.1 $Revision: 1.15 $ $State: Exp $
*
* Copyright 1994 Dietmar Friede
*******************************************************************************
@@ -10,6 +10,19 @@ static char _ittyid[] = "@(#)$Id: iitty.c,v 1.14 1995/11/29 14:39:12 julian
*
*******************************************************************************
* $Log: iitty.c,v $
+ * Revision 1.15 1995/12/05 20:33:47 bde
+ * Fixed ity's d_stop entry. itystop() wasn't used. itystop() is inadequate
+ * but probably harmless. It's hard to tell because apparently no one runs
+ * ity.
+ *
+ * Fixed ity's d_reset entry. `nx' entries should never be used for existing
+ * devices.
+ *
+ * conf.c:
+ * Moved a prototype to a better place.
+ *
+ * Removed a stale #define.
+ *
* Revision 1.14 1995/11/29 14:39:12 julian
* If you're going to mechanically replicate something in 50 files
* it's best to not have a (compiles cleanly) typo in it! (sigh)
@@ -172,15 +185,26 @@ static char _ittyid[] = "@(#)$Id: iitty.c,v 1.14 1995/11/29 14:39:12 julian
#include <sys/kernel.h>
#include <sys/syslog.h>
#include <sys/types.h>
-
-#include "gnu/isdn/isdn_ioctl.h"
-
-#ifdef JREMOD
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
+
+#include "gnu/isdn/isdn_ioctl.h"
+
+static d_open_t ityopen;
+static d_close_t ityclose;
+static d_read_t ityread;
+static d_write_t itywrite;
+static d_ioctl_t ityioctl;
+static d_stop_t itystop;
+static d_ttycv_t itydevtotty;
+
#define CDEV_MAJOR 56
-#endif /*JREMOD*/
+struct cdevsw ity_cdevsw =
+ { ityopen, ityclose, ityread, itywrite, /*56*/
+ ityioctl, itystop, noreset, itydevtotty,/* ity */
+ ttselect, nommap, NULL, "ity", NULL, -1 };
+
extern int ityparam __P((struct tty *tp, struct termios *t));
extern void itystart __P((struct tty *tp));
@@ -191,6 +215,10 @@ short ity_addr[NITY];
struct tty ity_tty[NITY];
static int applnr[NITY];
static int next_if= 0;
+#ifdef DEVFS
+void *devfs_token[NITY];
+void *devfs_token_out[NITY];
+#endif
#define UNIT(x) (minor(x)&0x3f)
#define OUTBOUND(x) ((minor(x)&0x80)==0x80)
@@ -198,15 +226,24 @@ static int next_if= 0;
int
ityattach(int ap)
{
+ char name[32];
if(next_if >= NITY)
return(-1);
applnr[next_if]= ap;
+#ifdef DEVFS
+ sprintf(name,"ity%d",next_if);
+ devfs_token[next_if] = devfs_add_devsw("/isdn",name,
+ &ity_cdevsw,next_if, DV_CHR, 0, 0, 0600);
+ sprintf(name,"Oity%d",next_if); /* XXX find out real name */
+ devfs_token[next_if] = devfs_add_devsw("/isdn",name,
+ &ity_cdevsw,(next_if | 0x80), DV_CHR, 0, 0, 0600);
+#endif
return(next_if++);
}
/* ARGSUSED */
-int
+static int
ityopen(dev_t dev, int flag, int mode, struct proc * p)
{
register struct tty *tp;
@@ -261,7 +298,7 @@ ityopen(dev_t dev, int flag, int mode, struct proc * p)
}
/* ARGSUSED */
-int
+static int
ityclose(dev, flag, mode, p)
dev_t dev;
int flag, mode;
@@ -280,7 +317,7 @@ ityclose(dev, flag, mode, p)
return (0);
}
-int
+static int
ityread(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -291,7 +328,7 @@ ityread(dev, uio, flag)
return ((*linesw[tp->t_line].l_read) (tp, uio, flag));
}
-int
+static int
itywrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -386,7 +423,7 @@ ity_disconnect(int no)
if(tp) (*linesw[tp->t_line].l_modem) (tp, 0);
}
-int
+static int
ityioctl(dev, cmd, data, flag,p)
dev_t dev;
int cmd;
@@ -444,7 +481,7 @@ ityparam(tp, t)
* Stop output on a line.
*/
/* ARGSUSED */
-void
+static void
itystop(struct tty *tp, int flag)
{
register int s;
@@ -458,7 +495,7 @@ itystop(struct tty *tp, int flag)
splx(s);
}
-struct tty *
+static struct tty *
itydevtotty(dev_t dev)
{
register int unit = UNIT(dev);
@@ -468,36 +505,20 @@ itydevtotty(dev_t dev)
return (&ity_tty[unit]);
}
-#ifdef JREMOD
-struct cdevsw ity_cdevsw =
- { ityopen, ityclose, ityread, itywrite, /*56*/
- ityioctl, itystop, noreset, itydevtotty,/* ity */
- ttselect, nommap, NULL };
-
static ity_devsw_installed = 0;
-static void ity_drvinit(void *unused)
+static void
+ity_drvinit(void *unused)
{
dev_t dev;
if( ! ity_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&ity_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&ity_cdevsw, NULL);
ity_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "ity", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(itydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,ity_drvinit,NULL)
-#endif /* JREMOD */
-
#endif
diff --git a/sys/gnu/isdn/isdn.c b/sys/gnu/isdn/isdn.c
index 8686dea..71755e3 100644
--- a/sys/gnu/isdn/isdn.c
+++ b/sys/gnu/isdn/isdn.c
@@ -1,6 +1,6 @@
-static char _isdnid[] = "@(#)$Id: isdn.c,v 1.7 1995/11/29 10:47:10 julian Exp $";
+static char _isdnid[] = "@(#)$Id: isdn.c,v 1.8 1995/11/29 14:39:12 julian Exp $";
/*******************************************************************************
- * II - Version 0.1 $Revision: 1.7 $ $State: Exp $
+ * II - Version 0.1 $Revision: 1.8 $ $State: Exp $
*
* Copyright 1994 Dietmar Friede
*******************************************************************************
@@ -10,6 +10,10 @@ static char _isdnid[] = "@(#)$Id: isdn.c,v 1.7 1995/11/29 10:47:10 julian Ex
*
*******************************************************************************
* $Log: isdn.c,v $
+ * Revision 1.8 1995/11/29 14:39:12 julian
+ * If you're going to mechanically replicate something in 50 files
+ * it's best to not have a (compiles cleanly) typo in it! (sigh)
+ *
* Revision 1.7 1995/11/29 10:47:10 julian
* OK, that's it..
* That's EVERY SINGLE driver that has an entry in conf.c..
@@ -80,15 +84,12 @@ static char _isdnid[] = "@(#)$Id: isdn.c,v 1.7 1995/11/29 10:47:10 julian Ex
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/proc.h>
-
-#include "gnu/isdn/isdn_ioctl.h"
-
-#ifdef JREMOD
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
-#define CDEV_MAJOR 55
-#endif /*JREMOD*/
+
+#include "gnu/isdn/isdn_ioctl.h"
+
isdn_appl_t isdn_appl[N_ISDN_APPL];
isdn_ctrl_t isdn_ctrl[N_ISDN_CTRL];
@@ -102,6 +103,20 @@ extern int isdn_set_prot __P((int ap, int dir, char *p));
extern int isdn_stat __P((int cn));
static void passout __P((int unit, int l, char *buf));
+static d_open_t isdnopen;
+static d_close_t isdnclose;
+static d_rdwr_t isdnrw;
+static d_read_t isdnread;
+static d_write_t isdnwrite;
+static d_ioctl_t isdnioctl;
+
+#define CDEV_MAJOR 55
+struct cdevsw isdn_cdevsw =
+ { isdnopen, isdnclose, isdnread, nowrite, /*55*/
+ isdnioctl, nostop, nullreset, nodevtotty,/* isdn */
+ seltrue, nommap, NULL, "isdn", NULL, -1 };
+
+
static int o_flags, r_flags, bufind[TYPNR];
static char buffer[TYPNR][257];
static u_char appl_list[TYPNR];
@@ -222,6 +237,9 @@ isdn_ctrl_attach(int n)
if ((Isdn_Ctrl += n) <= N_ISDN_CTRL)
return (c);
Isdn_Ctrl = c;
+#ifdef DEVFS
+/*SOMETHING GOES IN HERE I THINK*/
+#endif
return (-1);
}
@@ -231,7 +249,7 @@ isdn_ctrl_attach(int n)
* I forbid all but one open per application. The only programs opening the
* isdn device are the ISDN-daemon
*/
-int
+static int
isdnopen(dev_t dev, int flags, int fmt, struct proc *p)
{
int err;
@@ -248,14 +266,14 @@ isdnopen(dev_t dev, int flags, int fmt, struct proc *p)
return (0);
}
-int
+static int
isdnclose(dev_t dev, int flags, int fmt, struct proc *p)
{
o_flags &= ~(1 << minor(dev));
return (0);
}
-int
+static int
isdnread(dev_t dev, struct uio * uio, int ioflag)
{
int x;
@@ -280,7 +298,7 @@ isdnread(dev_t dev, struct uio * uio, int ioflag)
return error;
}
-int
+static int
isdnioctl(dev_t dev, int cmd, caddr_t data, int flags, struct proc *p)
{
int err, x, i;
@@ -673,15 +691,10 @@ passout(int unit, int l, char *buf)
splx(x);
}
-#ifdef JREMOD
-struct cdevsw isdn_cdevsw =
- { isdnopen, isdnclose, isdnread, nowrite, /*55*/
- isdnioctl, nostop, nullreset, nodevtotty,/* isdn */
- seltrue, nommap, NULL };
-
static isdn_devsw_installed = 0;
-static void isdn_drvinit(void *unused)
+static void
+isdn_drvinit(void *unused)
{
dev_t dev;
@@ -689,20 +702,9 @@ static void isdn_drvinit(void *unused)
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&isdn_cdevsw,NULL);
isdn_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "isdn", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(isdndev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,isdn_drvinit,NULL)
-#endif /* JREMOD */
-
#endif /* NISDN > 0 */
diff --git a/sys/i386/apm/apm.c b/sys/i386/apm/apm.c
index eee873d..8b9b862 100644
--- a/sys/i386/apm/apm.c
+++ b/sys/i386/apm/apm.c
@@ -13,7 +13,7 @@
*
* Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
*
- * $Id: apm.c,v 1.18 1995/11/29 14:39:17 julian Exp $
+ * $Id: apm.c,v 1.19 1995/12/07 12:45:21 davidg Exp $
*/
#include "apm.h"
@@ -22,14 +22,12 @@
#ifdef __FreeBSD__
#include <sys/param.h>
-#include "conf.h"
-#ifdef JREMOD
+#include <conf.h>
#include <sys/conf.h>
#include <sys/kernel.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
-#endif /*JREMOD*/
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/malloc.h>
@@ -84,6 +82,7 @@ struct apm_softc {
int idle_cpu, disabled, disengaged;
struct apmhook sc_suspend;
struct apmhook sc_resume;
+ void *sc_devfs_token;
};
static struct apm_softc apm_softc[NAPM];
@@ -108,9 +107,16 @@ extern void fix_desc(struct fake_descriptor *, int);
#ifdef __FreeBSD__
static timeout_t apm_timeout;
-#ifdef JREMOD
+static d_open_t apmopen;
+static d_close_t apmclose;
+static d_ioctl_t apmioctl;
+
#define CDEV_MAJOR 39
-#endif /* JREMOD */
+static struct cdevsw apm_cdevsw =
+ { apmopen, apmclose, noread, nowrite, /*39*/
+ apmioctl, nostop, nullreset, nodevtotty,/* APM */
+ seltrue, nommap, NULL , "apm" ,NULL, -1};
+
#endif /* __FreeBSD__ */
#ifdef MACH_KERNEL
static void apm_timeout(void *);
@@ -644,8 +650,8 @@ apm_not_halt_cpu(struct apm_softc *sc)
/* device driver definitions */
#ifdef __FreeBSD__
-int apmprobe (struct isa_device *);
-int apmattach(struct isa_device *);
+static int apmprobe (struct isa_device *);
+static int apmattach(struct isa_device *);
struct isa_driver apmdriver = {
apmprobe, apmattach, "apm" };
#endif /* __FreeBSD__ */
@@ -669,12 +675,13 @@ struct bus_driver apmdriver = {
* to use V86 mode in APM initialization.
*/
-int
#ifdef __FreeBSD__
- apmprobe(struct isa_device *dvp)
+static int
+apmprobe(struct isa_device *dvp)
#endif /* __FreeBSD__ */
#ifdef MACH_KERNEL
- apmprobe(vm_offset_t port, struct bus_ctlr *devc)
+int
+apmprobe(vm_offset_t port, struct bus_ctlr *devc)
#endif /* MACH_KERNEL */
{
#ifdef __FreeBSD__
@@ -785,7 +792,7 @@ apm_processevent(struct apm_softc *sc)
*/
#ifdef __FreeBSD__
-int
+static int
apmattach(struct isa_device *dvp)
#endif /* __FreeBSD__ */
#ifdef MACH_KERNEL
@@ -795,6 +802,7 @@ apmattach(struct bus_device *dvp)
{
#ifdef __FreeBSD__
int unit = dvp->id_unit;
+ char name[32];
#define APM_KERNBASE KERNBASE
#endif /* __FreeBSD__ */
#ifdef MACH_KERNEL
@@ -908,12 +916,17 @@ apmattach(struct bus_device *dvp)
sc->initialized = 1;
#ifdef __FreeBSD__
+#ifdef DEVFS
+ sprintf(name,"apm%d",unit);
+ sc->sc_devfs_token = devfs_add_devsw(
+ "/", name, &apm_cdevsw, unit, DV_CHR, 0, 0, 0600);
+#endif
return 0;
#endif /* __FreeBSD__ */
}
#ifdef __FreeBSD__
-int
+static int
apmopen(dev_t dev, int flag, int fmt, struct proc *p)
{
struct apm_softc *sc = &apm_softc[minor(dev)];
@@ -927,13 +940,13 @@ apmopen(dev_t dev, int flag, int fmt, struct proc *p)
return 0;
}
-int
+static int
apmclose(dev_t dev, int flag, int fmt, struct proc *p)
{
return 0;
}
-int
+static int
apmioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p)
{
struct apm_softc *sc = &apm_softc[minor(dev)];
@@ -983,15 +996,10 @@ apmioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p)
}
-#ifdef JREMOD
-struct cdevsw apm_cdevsw =
- { apmopen, apmclose, noread, nowrite, /*39*/
- apmioctl, nostop, nullreset, nodevtotty,/* APM */
- seltrue, nommap, NULL };
-
static apm_devsw_installed = 0;
-static void apm_drvinit(void *unused)
+static void
+apm_drvinit(void *unused)
{
dev_t dev;
@@ -999,21 +1007,11 @@ static void apm_drvinit(void *unused)
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&apm_cdevsw,NULL);
apm_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "apm", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(apmdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,apm_drvinit,NULL)
-#endif /* JREMOD */
#endif /* __FreeBSD__ */
diff --git a/sys/i386/bios/apm.c b/sys/i386/bios/apm.c
index eee873d..8b9b862 100644
--- a/sys/i386/bios/apm.c
+++ b/sys/i386/bios/apm.c
@@ -13,7 +13,7 @@
*
* Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
*
- * $Id: apm.c,v 1.18 1995/11/29 14:39:17 julian Exp $
+ * $Id: apm.c,v 1.19 1995/12/07 12:45:21 davidg Exp $
*/
#include "apm.h"
@@ -22,14 +22,12 @@
#ifdef __FreeBSD__
#include <sys/param.h>
-#include "conf.h"
-#ifdef JREMOD
+#include <conf.h>
#include <sys/conf.h>
#include <sys/kernel.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
-#endif /*JREMOD*/
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/malloc.h>
@@ -84,6 +82,7 @@ struct apm_softc {
int idle_cpu, disabled, disengaged;
struct apmhook sc_suspend;
struct apmhook sc_resume;
+ void *sc_devfs_token;
};
static struct apm_softc apm_softc[NAPM];
@@ -108,9 +107,16 @@ extern void fix_desc(struct fake_descriptor *, int);
#ifdef __FreeBSD__
static timeout_t apm_timeout;
-#ifdef JREMOD
+static d_open_t apmopen;
+static d_close_t apmclose;
+static d_ioctl_t apmioctl;
+
#define CDEV_MAJOR 39
-#endif /* JREMOD */
+static struct cdevsw apm_cdevsw =
+ { apmopen, apmclose, noread, nowrite, /*39*/
+ apmioctl, nostop, nullreset, nodevtotty,/* APM */
+ seltrue, nommap, NULL , "apm" ,NULL, -1};
+
#endif /* __FreeBSD__ */
#ifdef MACH_KERNEL
static void apm_timeout(void *);
@@ -644,8 +650,8 @@ apm_not_halt_cpu(struct apm_softc *sc)
/* device driver definitions */
#ifdef __FreeBSD__
-int apmprobe (struct isa_device *);
-int apmattach(struct isa_device *);
+static int apmprobe (struct isa_device *);
+static int apmattach(struct isa_device *);
struct isa_driver apmdriver = {
apmprobe, apmattach, "apm" };
#endif /* __FreeBSD__ */
@@ -669,12 +675,13 @@ struct bus_driver apmdriver = {
* to use V86 mode in APM initialization.
*/
-int
#ifdef __FreeBSD__
- apmprobe(struct isa_device *dvp)
+static int
+apmprobe(struct isa_device *dvp)
#endif /* __FreeBSD__ */
#ifdef MACH_KERNEL
- apmprobe(vm_offset_t port, struct bus_ctlr *devc)
+int
+apmprobe(vm_offset_t port, struct bus_ctlr *devc)
#endif /* MACH_KERNEL */
{
#ifdef __FreeBSD__
@@ -785,7 +792,7 @@ apm_processevent(struct apm_softc *sc)
*/
#ifdef __FreeBSD__
-int
+static int
apmattach(struct isa_device *dvp)
#endif /* __FreeBSD__ */
#ifdef MACH_KERNEL
@@ -795,6 +802,7 @@ apmattach(struct bus_device *dvp)
{
#ifdef __FreeBSD__
int unit = dvp->id_unit;
+ char name[32];
#define APM_KERNBASE KERNBASE
#endif /* __FreeBSD__ */
#ifdef MACH_KERNEL
@@ -908,12 +916,17 @@ apmattach(struct bus_device *dvp)
sc->initialized = 1;
#ifdef __FreeBSD__
+#ifdef DEVFS
+ sprintf(name,"apm%d",unit);
+ sc->sc_devfs_token = devfs_add_devsw(
+ "/", name, &apm_cdevsw, unit, DV_CHR, 0, 0, 0600);
+#endif
return 0;
#endif /* __FreeBSD__ */
}
#ifdef __FreeBSD__
-int
+static int
apmopen(dev_t dev, int flag, int fmt, struct proc *p)
{
struct apm_softc *sc = &apm_softc[minor(dev)];
@@ -927,13 +940,13 @@ apmopen(dev_t dev, int flag, int fmt, struct proc *p)
return 0;
}
-int
+static int
apmclose(dev_t dev, int flag, int fmt, struct proc *p)
{
return 0;
}
-int
+static int
apmioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p)
{
struct apm_softc *sc = &apm_softc[minor(dev)];
@@ -983,15 +996,10 @@ apmioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p)
}
-#ifdef JREMOD
-struct cdevsw apm_cdevsw =
- { apmopen, apmclose, noread, nowrite, /*39*/
- apmioctl, nostop, nullreset, nodevtotty,/* APM */
- seltrue, nommap, NULL };
-
static apm_devsw_installed = 0;
-static void apm_drvinit(void *unused)
+static void
+apm_drvinit(void *unused)
{
dev_t dev;
@@ -999,21 +1007,11 @@ static void apm_drvinit(void *unused)
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&apm_cdevsw,NULL);
apm_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "apm", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(apmdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,apm_drvinit,NULL)
-#endif /* JREMOD */
#endif /* __FreeBSD__ */
diff --git a/sys/i386/i386/conf.c b/sys/i386/i386/conf.c
index e65ce87..faaa9c3 100644
--- a/sys/i386/i386/conf.c
+++ b/sys/i386/i386/conf.c
@@ -42,7 +42,7 @@
* SUCH DAMAGE.
*
* from: @(#)conf.c 5.8 (Berkeley) 5/12/91
- * $Id: conf.c,v 1.111 1995/12/06 22:31:54 bde Exp $
+ * $Id: conf.c,v 1.112 1995/12/07 12:45:27 davidg Exp $
*/
#include <sys/param.h>
@@ -58,7 +58,6 @@
#include <vm/vm_param.h>
#include <vm/vm_extern.h>
-#ifdef JREMOD
#define NUMCDEV 96
#define NUMBDEV 32
@@ -68,827 +67,11 @@ int nblkdev = NUMBDEV;
struct cdevsw cdevsw[NUMCDEV];
int nchrdev = NUMCDEV;
-#else /*JREMOD*/
-/* Bogus defines for compatibility. */
-#define noioc noioctl
-#define nostrat nostrategy
-#define zerosize nopsize
-
-/* Lots of bogus defines for shorthand purposes */
-#define lkmopen (d_open_t *)lkmenodev
-#define lkmclose (d_close_t *)lkmenodev
-#define lkmread (d_rdwr_t *)lkmenodev
-#define lkmwrite (d_rdwr_t *)lkmenodev
-#define lkmstrategy (d_strategy_t *)lkmenodev
-#define lkmioctl (d_ioctl_t *)lkmenodev
-#define lkmdump (d_dump_t *)lkmenodev
-#define lkmsize zerosize
-#define lkmstop (d_stop_t *)lkmenodev
-#define lkmreset (d_reset_t *)lkmenodev
-#define lkmmmap (d_mmap_t *)lkmenodev
-#define lkmselect (d_select_t *)lkmenodev
-
-#include "wd.h"
-#if NWD == 0
-#define wdopen nxopen
-#define wdclose nxclose
-#define wdstrategy nxstrategy
-#define wdioctl nxioctl
-#define wddump nxdump
-#define wdsize zerosize
-#endif
-
-#include "worm.h"
-#if NWORM == 0
-#define wormopen nxopen
-#define wormclose nxclose
-#define wormstrategy nxstrategy
-#define wormioctl nxioctl
-#define wormdump nxdump
-#define wormsize zerosize
-#endif
-
-#include "sctarg.h"
-#if NSCTARG == 0
-#define sctargopen nxopen
-#define sctargclose nxclose
-#define sctargstrategy nxstrategy
-#define sctargioctl nxioctl
-#define sctargdump nxdump
-#define sctargsize zerosize
-#endif
-
-#include "pt.h"
-#if NPT == 0
-#define ptopen nxopen
-#define ptclose nxclose
-#define ptstrategy nxstrategy
-#define ptioctl nxioctl
-#define ptdump nxdump
-#define ptsize zerosize
-#endif
-
-#include "sd.h"
-#if NSD == 0
-#define sdopen nxopen
-#define sdclose nxclose
-#define sdstrategy nxstrategy
-#define sdioctl nxioctl
-#define sddump nxdump
-#define sdsize zerosize
-#endif
-
-#include "st.h"
-#if NST == 0
-#define stopen nxopen
-#define stclose nxclose
-#define ststrategy nxstrategy
-#define stioctl nxioctl
-#endif
-
-#include "od.h"
-#if NOD == 0
-#define odopen nxopen
-#define odclose nxclose
-#define odstrategy nxstrategy
-#define odioctl nxioctl
-#define odsize zerosize
-#endif
-
-#include "cd.h"
-#if NCD == 0
-#define cdopen nxopen
-#define cdclose nxclose
-#define cdstrategy nxstrategy
-#define cdioctl nxioctl
-#define cdsize zerosize
-#endif
-
-#include "mcd.h"
-#if NMCD == 0
-#define mcdopen nxopen
-#define mcdclose nxclose
-#define mcdstrategy nxstrategy
-#define mcdioctl nxioctl
-#define mcdsize zerosize
-#endif
-
-#include "scd.h"
-#if NSCD == 0
-#define scdopen nxopen
-#define scdclose nxclose
-#define scdstrategy nxstrategy
-#define scdioctl nxioctl
-#define scdsize zerosize
-#endif
-
-#include "matcd.h"
-#if NMATCD == 0
-#define matcdopen nxopen
-#define matcdclose nxclose
-#define matcdstrategy nxstrategy
-#define matcdioctl nxioctl
-#define matcdsize zerosize
-#endif
-
-#include "ata.h"
-#if NATA == 0
-#define ataopen nxopen
-#define ataclose nxclose
-#define atastrategy nxstrategy
-#define ataioctl nxioctl
-#define atasize zerosize
-#endif
-
-#include "wcd.h"
-#if NWCD == 0
-#define wcdbopen nxopen
-#define wcdropen nxopen
-#define wcdbclose nxclose
-#define wcdrclose nxclose
-#define wcdstrategy nxstrategy
-#define wcdioctl nxioctl
-#endif
-
-#include "ch.h"
-#if NCH == 0
-#define chopen nxopen
-#define chclose nxclose
-#define chioctl nxioctl
-#endif
-
-#include "wt.h"
-#if NWT == 0
-#define wtopen nxopen
-#define wtclose nxclose
-#define wtstrategy nxstrategy
-#define wtioctl nxioctl
-#define wtdump nxdump
-#define wtsize zerosize
-#endif
-
-#include "fd.h"
-#if NFD == 0
-#define Fdopen nxopen
-#define fdclose nxclose
-#define fdstrategy nxstrategy
-#define fdioctl nxioctl
-#endif
-
-#include "vn.h"
-#if NVN == 0
-#define vnopen nxopen
-#define vnclose nxclose
-#define vnstrategy nxstrategy
-#define vnioctl nxioctl
-#define vndump nxdump
-#define vnsize zerosize
-#endif
-
-#include "meteor.h"
-#if NMETEOR == 0
-#define meteor_open nxopen
-#define meteor_close nxclose
-#define meteor_read nxread
-#define meteor_write nxwrite
-#define meteor_ioctl nxioctl
-#define meteor_mmap nxmmap
-#endif
-
-struct bdevsw bdevsw[] =
-{
- { wdopen, wdclose, wdstrategy, wdioctl, /*0*/
- wddump, wdsize, 0 },
- { noopen, noclose, swstrategy, noioc, /*1*/
- nodump, zerosize, 0 },
- { Fdopen, fdclose, fdstrategy, fdioctl, /*2*/
- nxdump, zerosize, 0 },
- { wtopen, wtclose, wtstrategy, wtioctl, /*3*/
- wtdump, wtsize, B_TAPE },
- { sdopen, sdclose, sdstrategy, sdioctl, /*4*/
- sddump, sdsize, 0 },
- { stopen, stclose, ststrategy, stioctl, /*5*/
- nxdump, zerosize, 0 },
- { cdopen, cdclose, cdstrategy, cdioctl, /*6*/
- nxdump, cdsize, 0 },
- { mcdopen, mcdclose, mcdstrategy, mcdioctl, /*7*/
- nxdump, mcdsize, 0 },
- { lkmopen, lkmclose, lkmstrategy, lkmioctl, /*8*/
- lkmdump, lkmsize, NULL },
- { lkmopen, lkmclose, lkmstrategy, lkmioctl, /*9*/
- lkmdump, lkmsize, NULL },
- { lkmopen, lkmclose, lkmstrategy, lkmioctl, /*10*/
- lkmdump, lkmsize, NULL },
- { lkmopen, lkmclose, lkmstrategy, lkmioctl, /*11*/
- lkmdump, lkmsize, NULL },
- { lkmopen, lkmclose, lkmstrategy, lkmioctl, /*12*/
- lkmdump, lkmsize, NULL },
- { lkmopen, lkmclose, lkmstrategy, lkmioctl, /*13*/
- lkmdump, lkmsize, NULL },
- /* block device 14 is reserved for local use */
- { nxopen, nxclose, nxstrategy, nxioctl, /*14*/
- nxdump, zerosize, NULL },
- { vnopen, vnclose, vnstrategy, vnioctl, /*15*/
- vndump, vnsize, 0 },
- { scdopen, scdclose, scdstrategy, scdioctl, /*16*/
- nxdump, scdsize, 0 },
- { matcdopen, matcdclose, matcdstrategy, matcdioctl, /*17*/
- nxdump, matcdsize, 0 },
- { ataopen, ataclose, atastrategy, ataioctl, /*18*/
- nxdump, atasize, 0 },
- { wcdbopen, wcdbclose, wcdstrategy, wcdioctl, /*19*/
- nxdump, zerosize, 0 },
- { odopen, odclose, odstrategy, odioctl, /*20*/
- nxdump, odsize, 0 },
-
-/*
- * If you need a bdev major number for a driver that you intend to donate
- * back to the group or release publically, please contact the FreeBSD team
- * by sending mail to "FreeBSD-hackers@freefall.cdrom.com".
- * If you assign one yourself it may conflict with someone else.
- * Otherwise, simply use the one reserved for local use.
- */
-};
-int nblkdev = sizeof (bdevsw) / sizeof (bdevsw[0]);
-
-/* console */
-#include "machine/cons.h"
-
-#include "pty.h"
-#if NPTY == 0
-#define ptsopen nxopen
-#define ptsclose nxclose
-#define ptsread nxread
-#define ptswrite nxwrite
-#define ptcopen nxopen
-#define ptcclose nxclose
-#define ptcread nxread
-#define ptcwrite nxwrite
-#define ptyioctl nxioctl
-#define ptcselect nxselect
-#define ptsstop nullstop
-#define ptydevtotty nxdevtotty
-#endif
-
-
-#include "snp.h"
-#if NSNP == 0
-#define snpopen nxopen
-#define snpclose nxclose
-#define snpread nxread
-#define snpwrite nxwrite
-#define snpioctl nxioctl
-#define snpselect nxselect
-#endif
-
-#include "bqu.h"
-#if NBQU == 0
-#define bquopen nxopen
-#define bquclose nxclose
-#define bquread nxread
-#define bquwrite nxwrite
-#define bquselect nxselect
-#define bquioctl nxioctl
-#endif
-
-#include "lpt.h"
-#if NLPT == 0
-#define lptopen nxopen
-#define lptclose nxclose
-#define lptwrite nxwrite
-#define lptioctl nxioctl
-#endif
-
-#include "tw.h"
-#if NTW == 0
-#define twopen nxopen
-#define twclose nxclose
-#define twread nxread
-#define twwrite nxwrite
-#define twselect nxselect
-#endif
-
-#include "psm.h"
-#if NPSM == 0
-#define psmopen nxopen
-#define psmclose nxclose
-#define psmread nxread
-#define psmselect nxselect
-#define psmioctl nxioctl
-#endif
-
-#include "snd.h"
-#if NSND == 0
-#define sndopen nxopen
-#define sndclose nxclose
-#define sndioctl nxioctl
-#define sndread nxread
-#define sndwrite nxwrite
-#define sndselect seltrue
-#endif
-
-#include "bpfilter.h"
-#if NBPFILTER == 0
-#define bpfopen nxopen
-#define bpfclose nxclose
-#define bpfread nxread
-#define bpfwrite nxwrite
-#define bpfselect nxselect
-#define bpfioctl nxioctl
-#endif
-
-#include "speaker.h"
-#if NSPEAKER == 0
-#define spkropen nxopen
-#define spkrclose nxclose
-#define spkrwrite nxwrite
-#define spkrioctl nxioctl
-#endif
-
-#include "pca.h"
-#if NPCA == 0
-#define pcaopen nxopen
-#define pcaclose nxclose
-#define pcawrite nxwrite
-#define pcaioctl nxioctl
-#define pcaselect nxselect
-#endif
-
-#include "mse.h"
-#if NMSE == 0
-#define mseopen nxopen
-#define mseclose nxclose
-#define mseread nxread
-#define mseselect nxselect
-#endif
-
-#include "sio.h"
-#if NSIO == 0
-#define sioopen nxopen
-#define sioclose nxclose
-#define sioread nxread
-#define siowrite nxwrite
-#define sioioctl nxioctl
-#define siostop nxstop
-#define siodevtotty nxdevtotty
-#endif
-
-#include "su.h"
-#if NSU == 0
-#define suopen nxopen
-#define suclose nxclose
-#define suioctl nxioctl
-#define suread nxread
-#define suwrite nxwrite
-#define suselect nxselect
-#define sustrategy nxstrategy
-#endif
-
-#include "scbus.h"
-#if NSCBUS == 0
-#define ukopen nxopen
-#define ukclose nxclose
-#define ukioctl nxioctl
-#endif
-
-#include "apm.h"
-#if NAPM == 0
-#define apmopen nxopen
-#define apmclose nxclose
-#define apmioctl nxioctl
-#endif
-
-#include "ctx.h"
-#if NCTX == 0
-#define ctxopen nxopen
-#define ctxclose nxclose
-#define ctxread nxread
-#define ctxwrite nxwrite
-#define ctxioctl nxioctl
-#endif
-
-#include "ssc.h"
-#if NSSC == 0
-#define sscopen nxopen
-#define sscclose nxclose
-#define sscioctl nxioctl
-#endif
-
-#include "cx.h"
-#if NCX == 0
-#define cxopen nxopen
-#define cxclose nxclose
-#define cxread nxread
-#define cxwrite nxwrite
-#define cxioctl nxioctl
-#define cxstop nxstop
-#define cxselect nxselect
-#define cxdevtotty nxdevtotty
-#endif
-
-#include "gp.h"
-#if NGP == 0
-#define gpopen nxopen
-#define gpclose nxclose
-#define gpwrite nxwrite
-#define gpioctl nxioctl
-#endif
-
-#include "gsc.h"
-#if NGSC == 0
-#define gscopen nxopen
-#define gscclose nxclose
-#define gscread nxread
-#define gscioctl nxioctl
-#endif
-
-#include "crd.h"
-#if NCRD == 0
-#define crdopen nxopen
-#define crdclose nxclose
-#define crdread nxread
-#define crdwrite nxwrite
-#define crdioctl nxioctl
-#define crdselect nxselect
-
-#endif
-
-#include "joy.h"
-#if NJOY == 0
-#define joyopen nxopen
-#define joyclose nxclose
-#define joyread nxread
-#define joyioctl nxioctl
-#endif
-
-#include "asc.h"
-#if NASC == 0
-#define ascopen nxopen
-#define ascclose nxclose
-#define ascread nxread
-#define ascioctl nxioctl
-#define ascselect nxselect
-#endif
-
-#include "tun.h"
-#if NTUN == 0
-#define tunopen nxopen
-#define tunclose nxclose
-#define tunread nxread
-#define tunwrite nxwrite
-#define tunioctl nxioctl
-#define tunselect nxselect
-#endif
-
-#include "spigot.h"
-#if NSPIGOT == 0
-#define spigot_open nxopen
-#define spigot_close nxclose
-#define spigot_ioctl nxioctl
-#define spigot_read nxread
-#define spigot_write nxwrite
-#define spigot_select seltrue
-#define spigot_mmap nommap
-#endif
-
-#include "cy.h"
-#if NCY == 0
-#define cyopen nxopen
-#define cyclose nxclose
-#define cyread nxread
-#define cywrite nxwrite
-#define cyioctl nxioctl
-#define cystop nxstop
-#define cydevtotty nxdevtotty
-#endif
-
-#include "dgb.h"
-#if NDGB == 0
-#define dgbopen nxopen
-#define dgbclose nxclose
-#define dgbread nxread
-#define dgbwrite nxwrite
-#define dgbioctl nxioctl
-#define dgbstop nxstop
-#define dgbdevtotty nxdevtotty
-#endif
-
-#include "si.h"
-#if NSI == 0
-#define siopen nxopen
-#define siclose nxclose
-#define siread nxread
-#define siwrite nxwrite
-#define siioctl nxioctl
-#define sistop nxstop
-#define sidevtotty nxdevtotty
-#endif
-
-#include "ity.h"
-#if NITY == 0
-#define ityopen nxopen
-#define ityclose nxclose
-#define ityread nxread
-#define itywrite nxwrite
-#define ityioctl nxioctl
-#define itystop nxstop
-#define itydevtotty nxdevtotty
-#endif
-
-#include "nic.h"
-#if NNIC == 0
-#define nicopen nxopen
-#define nicclose nxclose
-#define nicioctl nxioctl
-#endif
-
-#include "nnic.h"
-#if NNNIC == 0
-#define nnicopen nxopen
-#define nnicclose nxclose
-#define nnicioctl nxioctl
-#endif
-
-#include "isdn.h"
-#if NISDN == 0
-#define isdnopen nxopen
-#define isdnclose nxclose
-#define isdnread nxread
-#define isdnioctl nxioctl
-#endif
-
-#include "itel.h"
-#if NITEL == 0
-#define itelopen nxopen
-#define itelclose nxclose
-#define itelread nxread
-#define itelwrite nxwrite
-#define itelioctl nxioctl
-#endif
-
-#include "ispy.h"
-#if NISPY == 0
-#define ispyopen nxopen
-#define ispyclose nxclose
-#define ispyread nxread
-#define ispywrite nxwrite
-#define ispyioctl nxioctl
-#endif
-
-#include "rc.h"
-#if NRC == 0
-#define rcopen nxopen
-#define rcclose nxclose
-#define rcread nxread
-#define rcwrite nxwrite
-#define rcioctl nxioctl
-#define rcstop nxstop
-#define rcdevtotty nxdevtotty
-#endif
-
-#include "labpc.h"
-#if NLABPC == 0
-#define labpcopen nxopen
-#define labpcclose nxclose
-#define labpcstrategy nxstrategy
-#define labpcioctl nxioctl
-#endif
-
-/* open, close, read, write, ioctl, stop, reset, ttys, select, mmap, strat */
-struct cdevsw cdevsw[] =
-{
- { cnopen, cnclose, cnread, cnwrite, /*0*/
- cnioctl, nullstop, nullreset, nodevtotty,/* console */
- cnselect, nommap, NULL },
- { cttyopen, nullclose, cttyread, cttywrite, /*1*/
- cttyioctl, nullstop, nullreset, nodevtotty,/* tty */
- cttyselect, nommap, NULL },
- { mmopen, mmclose, mmrw, mmrw, /*2*/
- mmioctl, nullstop, nullreset, nodevtotty,/* memory */
- seltrue, memmmap, NULL },
- { wdopen, wdclose, rawread, rawwrite, /*3*/
- wdioctl, nostop, nullreset, nodevtotty,/* wd */
- seltrue, nommap, wdstrategy },
- { nullopen, nullclose, rawread, rawwrite, /*4*/
- noioc, nostop, noreset, nodevtotty,/* swap */
- noselect, nommap, swstrategy },
- { ptsopen, ptsclose, ptsread, ptswrite, /*5*/
- ptyioctl, ptsstop, nullreset, ptydevtotty,/* ttyp */
- ttselect, nommap, NULL },
- { ptcopen, ptcclose, ptcread, ptcwrite, /*6*/
- ptyioctl, nullstop, nullreset, ptydevtotty,/* ptyp */
- ptcselect, nommap, NULL },
- { logopen, logclose, logread, nowrite, /*7*/
- logioctl, nostop, nullreset, nodevtotty,/* klog */
- logselect, nommap, NULL },
- { bquopen, bquclose, bquread, bquwrite, /*8*/
- bquioctl, nostop, nullreset, nodevtotty,/* tputer */
- bquselect, nommap, NULL },
- { Fdopen, fdclose, rawread, rawwrite, /*9*/
- fdioctl, nostop, nullreset, nodevtotty,/* Fd (!=fd) */
- seltrue, nommap, fdstrategy },
- { wtopen, wtclose, rawread, rawwrite, /*10*/
- wtioctl, nostop, nullreset, nodevtotty,/* wt */
- seltrue, nommap, wtstrategy },
- { spigot_open, spigot_close, spigot_read, spigot_write, /*11*/
- spigot_ioctl, nostop, nullreset, nodevtotty,/* Spigot */
- spigot_select, spigot_mmap, NULL },
- { nxopen, nxclose, nxread, nxwrite, /*12*/
- nxioctl, nxstop, nxreset, nxdevtotty,/* sc, ... */
- nxselect, nxmmap, NULL },
- { sdopen, sdclose, rawread, rawwrite, /*13*/
- sdioctl, nostop, nullreset, nodevtotty,/* sd */
- seltrue, nommap, sdstrategy },
- { stopen, stclose, rawread, rawwrite, /*14*/
- stioctl, nostop, nullreset, nodevtotty,/* st */
- seltrue, nommap, ststrategy },
- { cdopen, cdclose, rawread, nowrite, /*15*/
- cdioctl, nostop, nullreset, nodevtotty,/* cd */
- seltrue, nommap, cdstrategy },
- { lptopen, lptclose, noread, lptwrite, /*16*/
- lptioctl, nullstop, nullreset, nodevtotty,/* lpt */
- seltrue, nommap, nostrat},
- { chopen, chclose, noread, nowrite, /*17*/
- chioctl, nostop, nullreset, nodevtotty,/* ch */
- noselect, nommap, nostrat },
- { suopen, suclose, suread, suwrite, /*18*/
- suioctl, nostop, nullreset, nodevtotty,/* scsi */
- suselect, nxmmap, sustrategy }, /* 'generic' */
- { twopen, twclose, twread, twwrite, /*19*/
- noioc, nullstop, nullreset, nodevtotty,/* tw */
- twselect, nommap, nostrat },
-/*
- * If you need a cdev major number for a driver that you intend to donate
- * back to the group or release publically, please contact the FreeBSD team
- * by sending mail to "hackers@freebsd.org".
- * If you assign one yourself it may conflict with someone else.
- * Otherwise, simply use the one reserved for local use.
- */
- /* character device 20 is reserved for local use */
- { nxopen, nxclose, nxread, nxwrite, /*20*/
- nxioctl, nxstop, nxreset, nxdevtotty,/* reserved */
- nxselect, nxmmap, NULL },
- { psmopen, psmclose, psmread, nowrite, /*21*/
- psmioctl, nostop, nullreset, nodevtotty,/* psm mice */
- psmselect, nommap, NULL },
- { fdopen, noclose, noread, nowrite, /*22*/
- noioc, nostop, nullreset, nodevtotty,/* fd (!=Fd) */
- noselect, nommap, nostrat },
- { bpfopen, bpfclose, bpfread, bpfwrite, /*23*/
- bpfioctl, nostop, nullreset, nodevtotty,/* bpf */
- bpfselect, nommap, NULL },
- { pcaopen, pcaclose, noread, pcawrite, /*24*/
- pcaioctl, nostop, nullreset, nodevtotty,/* pcaudio */
- pcaselect, nommap, NULL },
- { nxopen, nxclose, nxread, nxwrite, /*25*/
- nxioctl, nxstop, nxreset, nxdevtotty,/* was vat */
- nxselect, nxmmap, NULL },
- { spkropen, spkrclose, noread, spkrwrite, /*26*/
- spkrioctl, nostop, nullreset, nodevtotty,/* spkr */
- seltrue, nommap, NULL },
- { mseopen, mseclose, mseread, nowrite, /*27*/
- noioc, nostop, nullreset, nodevtotty,/* mse */
- mseselect, nommap, NULL },
- { sioopen, sioclose, sioread, siowrite, /*28*/
- sioioctl, siostop, nxreset, siodevtotty,/* sio */
- ttselect, nommap, NULL },
- { mcdopen, mcdclose, rawread, nowrite, /*29*/
- mcdioctl, nostop, nullreset, nodevtotty,/* mitsumi cd */
- seltrue, nommap, mcdstrategy },
- { sndopen, sndclose, sndread, sndwrite, /*30*/
- sndioctl, nostop, nullreset, nodevtotty,/* sound */
- sndselect, nommap, NULL },
- { ukopen, ukclose, noread, nowrite, /*31*/
- ukioctl, nostop, nullreset, nodevtotty,/* unknown */
- seltrue, nommap, NULL }, /* scsi */
- { lkmcopen, lkmcclose, noread, nowrite, /*32*/
- lkmcioctl, nostop, nullreset, nodevtotty,
- noselect, nommap, NULL },
- { lkmopen, lkmclose, lkmread, lkmwrite, /*33*/
- lkmioctl, lkmstop, lkmreset, nodevtotty,
- lkmselect, lkmmmap, NULL },
- { lkmopen, lkmclose, lkmread, lkmwrite, /*34*/
- lkmioctl, lkmstop, lkmreset, nodevtotty,
- lkmselect, lkmmmap, NULL },
- { lkmopen, lkmclose, lkmread, lkmwrite, /*35*/
- lkmioctl, lkmstop, lkmreset, nodevtotty,
- lkmselect, lkmmmap, NULL },
- { lkmopen, lkmclose, lkmread, lkmwrite, /*36*/
- lkmioctl, lkmstop, lkmreset, nodevtotty,
- lkmselect, lkmmmap, NULL },
- { lkmopen, lkmclose, lkmread, lkmwrite, /*37*/
- lkmioctl, lkmstop, lkmreset, nodevtotty,
- lkmselect, lkmmmap, NULL },
- { lkmopen, lkmclose, lkmread, lkmwrite, /*38*/
- lkmioctl, lkmstop, lkmreset, nodevtotty,
- lkmselect, lkmmmap, NULL },
- { apmopen, apmclose, noread, nowrite, /*39*/
- apmioctl, nostop, nullreset, nodevtotty,/* APM */
- seltrue, nommap, NULL },
- { ctxopen, ctxclose, ctxread, ctxwrite, /*40*/
- ctxioctl, nostop, nullreset, nodevtotty,/* cortex */
- seltrue, nommap, NULL },
- { nxopen, nxclose, nxread, nxwrite, /*41*/
- nxioctl, nxstop, nullreset, nxdevtotty,/* was socksys */
- seltrue, nommap, NULL },
- { cxopen, cxclose, cxread, cxwrite, /*42*/
- cxioctl, cxstop, nullreset, cxdevtotty,/* cronyx */
- cxselect, nommap, NULL },
- { vnopen, vnclose, rawread, rawwrite, /*43*/
- vnioctl, nostop, nullreset, nodevtotty,/* vn */
- seltrue, nommap, vnstrategy },
- { gpopen, gpclose, noread, gpwrite, /*44*/
- gpioctl, nostop, nullreset, nodevtotty,/* GPIB */
- seltrue, nommap, NULL },
- { scdopen, scdclose, rawread, nowrite, /*45*/
- scdioctl, nostop, nullreset, nodevtotty,/* sony cd */
- seltrue, nommap, scdstrategy },
- { matcdopen, matcdclose, rawread, nowrite, /*46*/
- matcdioctl, nostop, nullreset, nodevtotty,/* SB cd */
- seltrue, nommap, matcdstrategy },
- { gscopen, gscclose, gscread, nowrite, /*47*/
- gscioctl, nostop, nullreset, nodevtotty,/* gsc */
- seltrue, nommap, NULL },
- { cyopen, cyclose, cyread, cywrite, /*48*/
- cyioctl, cystop, nxreset, cydevtotty,/*cyclades*/
- ttselect, nxmmap, NULL },
- { sscopen, sscclose, noread, nowrite, /*49*/
- sscioctl, nostop, nullreset, nodevtotty,/* scsi super */
- noselect, nommap, nostrategy },
- { crdopen, crdclose, crdread, crdwrite, /*50*/
- crdioctl, nostop, nullreset, nodevtotty,/* pcmcia */
- crdselect, nommap, NULL },
- { joyopen, joyclose, joyread, nowrite, /*51*/
- joyioctl, nostop, nullreset, nodevtotty,/*joystick */
- seltrue, nommap, NULL},
- { tunopen, tunclose, tunread, tunwrite, /*52*/
- tunioctl, nostop, nullreset, nodevtotty,/* tunnel */
- tunselect, nommap, NULL },
- { snpopen, snpclose, snpread, snpwrite, /*53*/
- snpioctl, nostop, nullreset, nodevtotty,/* snoop */
- snpselect, nommap, NULL },
- { nicopen, nicclose, noread, nowrite, /*54*/
- nicioctl, nostop, nullreset, nodevtotty,/* nic */
- seltrue, nommap, NULL },
- { isdnopen, isdnclose, isdnread, nowrite, /*55*/
- isdnioctl, nostop, nullreset, nodevtotty,/* isdn */
- seltrue, nommap, NULL },
- { ityopen, ityclose, ityread, itywrite, /*56*/
- ityioctl, itystop, noreset, itydevtotty,/* ity */
- ttselect, nommap, NULL },
- { itelopen, itelclose, itelread, itelwrite, /*57*/
- itelioctl, nostop, nullreset, nodevtotty,/* itel */
- seltrue, nommap, NULL },
- { dgbopen, dgbclose, dgbread, dgbwrite, /*58*/
- dgbioctl, dgbstop, nxreset, dgbdevtotty, /* dgb */
- ttselect, nommap, NULL },
- { ispyopen, ispyclose, ispyread, nowrite, /*59*/
- ispyioctl, nostop, nullreset, nodevtotty,/* ispy */
- seltrue, nommap, NULL },
- { nnicopen, nnicclose, noread, nowrite, /*60*/
- nnicioctl, nostop, nullreset, nodevtotty,/* nnic */
- seltrue, nommap, NULL },
- { ptopen, ptclose, rawread, rawwrite, /*61*/
- ptioctl, nostop, nullreset, nodevtotty,/* pt */
- seltrue, nommap, ptstrategy },
- { wormopen, wormclose, rawread, rawwrite, /*62*/
- wormioctl, nostop, nullreset, nodevtotty,/* worm */
- seltrue, nommap, wormstrategy },
- { rcopen, rcclose, rcread, rcwrite, /*63*/
- rcioctl, rcstop, nxreset, rcdevtotty,/* rc */
- ttselect, nommap, NULL },
- { nxopen, nxclose, nxread, nxwrite, /*64*/
- nxioctl, nxstop, nxreset, nxdevtotty,/* Talisman */
- nxselect, nxmmap, NULL },
- { sctargopen, sctargclose, rawread, rawwrite, /*65*/
- sctargioctl, nostop, nullreset, nodevtotty,/* sctarg */
- seltrue, nommap, sctargstrategy },
- { labpcopen, labpcclose, rawread, rawwrite, /*66*/
- labpcioctl, nostop, nullreset, nodevtotty,/* labpc */
- seltrue, nommap, labpcstrategy },
- { meteor_open, meteor_close, meteor_read, meteor_write, /*67*/
- meteor_ioctl, nostop, nullreset, nodevtotty,/* Meteor */
- seltrue, meteor_mmap, NULL },
- { siopen, siclose, siread, siwrite, /*68*/
- siioctl, sistop, nxreset, sidevtotty,/* slxos */
- ttselect, nxmmap, NULL },
- { wcdropen, wcdrclose, rawread, nowrite, /*69*/
- wcdioctl, nostop, nullreset, nodevtotty,/* atapi */
- seltrue, nommap, wcdstrategy },
- { odopen, odclose, rawread, rawwrite, /*70*/
- odioctl, nostop, nullreset, nodevtotty,/* od */
- seltrue, nommap, odstrategy },
- { ascopen, ascclose, ascread, nowrite, /*71*/
- ascioctl, nostop, nullreset, nodevtotty, /* asc */
- ascselect, nommap, NULL }
-
-};
-int nchrdev = sizeof (cdevsw) / sizeof (cdevsw[0]);
-#endif /*JREMOD*/
/*
* The routines below are total "BULLSHIT" and will be trashed
* When I have 'proved' the JREMOD changes above..
*/
+#ifndef NEW_STUFF_JRE
/*
* Swapdev is a fake device implemented
@@ -1036,11 +219,7 @@ register_cdev(name, cdp)
dst_cdp = getcdevbyname(name);
if (dst_cdp == NULL)
return (ENXIO);
-#ifdef JREMOD
if ((dst_cdp->d_open != nxopen) && (dst_cdp->d_open != NULL))
-#else /*JREMOD*/
- if (dst_cdp->d_open != nxopen)
-#endif /*JREMOD*/
return (EBUSY);
*dst_cdp = *cdp;
return (0);
@@ -1067,3 +246,170 @@ unregister_cdev(name, cdp)
*dst_cdp = nxcdevsw;
return (0);
}
+#else /* NEW_STUFF_JRE *//*===============================================*/
+
+dev_t swapdev = makedev(1, 0);
+
+/*
+ * Routine that identifies /dev/mem and /dev/kmem.
+ *
+ * A minimal stub routine can always return 0.
+ */
+int
+iskmemdev(dev)
+ dev_t dev;
+{
+
+ return (major(dev) == 2 && (minor(dev) == 0 || minor(dev) == 1));
+}
+
+int
+iszerodev(dev)
+ dev_t dev;
+{
+ return (major(dev) == 2 && minor(dev) == 12);
+}
+
+/*
+ * Routine to determine if a device is a disk.
+ *
+ * A minimal stub routine can always return 0.
+ * XXX will look in the FLAGS (eventually)
+ */
+int
+isdisk(dev, type)
+ dev_t dev;
+ int type;
+{
+
+ switch (major(dev)) {
+ case 15: /* VBLK: vn, VCHR: cd */
+ return (1);
+ case 0: /* wd */
+ case 2: /* fd */
+ case 4: /* sd */
+ case 6: /* cd */
+ case 7: /* mcd */
+ case 16: /* scd */
+ case 17: /* matcd */
+ case 18: /* ata */
+ case 19: /* wcd */
+ case 20: /* od */
+ if (type == VBLK)
+ return (1);
+ return (0);
+ case 3: /* wd */
+ case 9: /* fd */
+ case 13: /* sd */
+ case 29: /* mcd */
+ case 43: /* vn */
+ case 45: /* scd */
+ case 46: /* matcd */
+ case 69: /* wcd */
+ case 70: /* od */
+ if (type == VCHR)
+ return (1);
+ /* fall through */
+ default:
+ return (0);
+ }
+ /* NOTREACHED */
+}
+
+/*
+ * Routine to convert from character to block device number.
+ *
+ * A minimal stub routine can always return NODEV.
+ */
+dev_t
+chrtoblk(dev)
+ dev_t dev;
+{
+ int blkmaj;
+ struct bdevsw *bd;
+
+ bd = cdevsw[major(dev)].d_bdev;
+ if ( bd )
+ return(makedev(bd->d_maj,minor(dev)));
+ else
+ return(NODEV);
+}
+
+/* Only checks cdevs */
+int
+getmajorbyname(name)
+ const char *name;
+{
+ struct cdevsw *cd;
+ int maj;
+ char *dname;
+
+ for( maj = 0; maj <nchrdev ; maj++) {
+ if ( dname = cdevsw[maj].d_name) {
+ if ( strcmp(name, dname) == 0 ) {
+ return maj;
+ }
+ }
+ }
+ return -1; /* XXX */ /* Was 0 */
+}
+
+
+/* utterly pointless with devfs */
+static struct cdevsw *
+getcdevbyname(name)
+ const char *name;
+{
+ struct cdevsw *cd;
+ int maj;
+ char *dname;
+
+ for( maj = 0; maj <nchrdev ; maj++) {
+ if ( dname = cdevsw[maj].d_name) {
+ if ( strcmp(name, dname) == 0 ) {
+ return &(cdevsw[maj]);
+ }
+ }
+ }
+ return NULL;
+}
+
+/* Zap these as soon as we find out who calls them */
+int
+register_cdev(name, cdp)
+ const char *name;
+ const struct cdevsw *cdp;
+{
+ struct cdevsw *dst_cdp;
+
+ dst_cdp = getcdevbyname(name);
+ if (dst_cdp == NULL)
+ return (ENXIO);
+ if ((dst_cdp->d_open != nxopen) && (dst_cdp->d_open != NULL))
+ return (EBUSY);
+ *dst_cdp = *cdp;
+ return (0);
+}
+
+static struct cdevsw nxcdevsw = {
+ nxopen, nxclose, nxread, nxwrite,
+ nxioctl, nxstop, nxreset, nxdevtotty,
+ nxselect, nxmmap, NULL,
+};
+
+int
+unregister_cdev(name, cdp)
+ const char *name;
+ const struct cdevsw *cdp;
+{
+ struct cdevsw *dst_cdp;
+
+ dst_cdp = getcdevbyname(name);
+ if (dst_cdp == NULL)
+ return (ENXIO);
+ if (dst_cdp->d_open != cdp->d_open)
+ return (EBUSY);
+ *dst_cdp = nxcdevsw;
+ return (0);
+}
+#endif /* NEW_STIFF_JRE */
diff --git a/sys/i386/i386/cons.c b/sys/i386/i386/cons.c
index 7f2e4d7..4624a28 100644
--- a/sys/i386/i386/cons.c
+++ b/sys/i386/i386/cons.c
@@ -36,26 +36,22 @@
* SUCH DAMAGE.
*
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
- * $Id: cons.c,v 1.35 1995/11/29 10:47:17 julian Exp $
+ * $Id: cons.c,v 1.36 1995/11/29 14:39:24 julian Exp $
*/
#include <sys/param.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <sys/systm.h>
#include <sys/conf.h>
+#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/tty.h>
#include <machine/cons.h>
#include <machine/stdarg.h>
-#ifdef JREMOD
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 0
-#endif /*JREMOD*/
-
/* XXX this should be config(8)ed. */
#include "sc.h"
#include "vt.h"
@@ -73,6 +69,19 @@ static struct consdev constab[] = {
{ 0 },
};
+static d_open_t cnopen;
+static d_close_t cnclose;
+static d_read_t cnread;
+static d_write_t cnwrite;
+static d_ioctl_t cnioctl;
+static d_select_t cnselect;
+
+#define CDEV_MAJOR 0
+struct cdevsw cn_cdevsw =
+ { cnopen, cnclose, cnread, cnwrite, /*0*/
+ cnioctl, nullstop, nullreset, nodevtotty,/* console */
+ cnselect, nommap, NULL, "console", NULL, -1 };
+
struct tty *constty = 0; /* virtual console output device */
struct tty *cn_tty; /* XXX: console tty struct for tprintf */
int cons_unavail = 0; /* XXX:
@@ -86,6 +95,9 @@ static d_close_t *cn_phys_close; /* physical device close function */
static d_open_t *cn_phys_open; /* physical device open function */
static struct consdev *cn_tab; /* physical console device info */
static struct tty *cn_tp; /* physical console tty struct */
+#ifdef DEVFS
+void *cn_devfs_token; /* represents the devfs entry */
+#endif /* DEVFS */
void
cninit()
@@ -148,7 +160,7 @@ cninit_finish()
cn_tty = cn_tp;
}
-int
+static int
cnopen(dev, flag, mode, p)
dev_t dev;
int flag, mode;
@@ -171,7 +183,7 @@ cnopen(dev, flag, mode, p)
return (retval);
}
-int
+static int
cnclose(dev, flag, mode, p)
dev_t dev;
int flag, mode;
@@ -204,7 +216,7 @@ cnclose(dev, flag, mode, p)
return ((*cn_phys_close)(dev, flag, mode, p));
}
-int
+static int
cnread(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -216,7 +228,7 @@ cnread(dev, uio, flag)
return ((*cdevsw[major(dev)].d_read)(dev, uio, flag));
}
-int
+static int
cnwrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -231,7 +243,7 @@ cnwrite(dev, uio, flag)
return ((*cdevsw[major(dev)].d_write)(dev, uio, flag));
}
-int
+static int
cnioctl(dev, cmd, data, flag, p)
dev_t dev;
int cmd;
@@ -258,7 +270,7 @@ cnioctl(dev, cmd, data, flag, p)
return ((*cdevsw[major(dev)].d_ioctl)(dev, cmd, data, flag, p));
}
-int
+static int
cnselect(dev, rw, p)
dev_t dev;
int rw;
@@ -312,18 +324,11 @@ pg(const char *p, ...) {
return(cngetc());
}
-
-#ifdef JREMOD
-struct cdevsw cn_cdevsw =
- { cnopen, cnclose, cnread, cnwrite, /*0*/
- cnioctl, nullstop, nullreset, nodevtotty,/* console */
- cnselect, nommap, NULL };
-
static cn_devsw_installed = 0;
-static void cn_drvinit(void *unused)
+static void
+cn_drvinit(void *unused)
{
- void * x;
dev_t dev;
if( ! cn_devsw_installed ) {
@@ -331,13 +336,19 @@ static void cn_drvinit(void *unused)
cdevsw_add(&dev,&cn_cdevsw,NULL);
cn_devsw_installed = 1;
#ifdef DEVFS
- /* path,name,major,minor,type,uid,gid,perm */
- x=devfs_add_devsw("/","console",major(dev),0,DV_CHR,0,0,0640);
+ cn_devfs_token = devfs_add_devsw(
+ "/",
+ "console",
+ &cn_cdevsw,
+ 0,
+ DV_CHR,
+ 0,
+ 0,
+ 0640);
#endif
}
}
SYSINIT(cndev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cn_drvinit,NULL)
-#endif /* JREMOD */
diff --git a/sys/i386/i386/cons.h b/sys/i386/i386/cons.h
index 8fbd43f..8fa2d90 100644
--- a/sys/i386/i386/cons.h
+++ b/sys/i386/i386/cons.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)cons.h 7.2 (Berkeley) 5/9/91
- * $Id: cons.h,v 1.10 1995/09/10 18:57:26 bde Exp $
+ * $Id: cons.h,v 1.11 1995/09/10 21:34:50 bde Exp $
*/
#ifndef _MACHINE_CONS_H_
@@ -106,14 +106,6 @@ extern int cons_unavail;
struct proc; struct uio;
-/* cdevsw[] entries */
-extern int cnopen(dev_t, int, int, struct proc *);
-extern int cnclose(dev_t, int, int, struct proc *);
-extern int cnread(dev_t, struct uio *, int);
-extern int cnwrite(dev_t, struct uio *, int);
-extern int cnioctl(dev_t, int, caddr_t, int, struct proc *);
-extern int cnselect(dev_t, int, struct proc *);
-
/* other kernel entry points */
extern void cninit(void);
extern void cninit_finish(void);
diff --git a/sys/i386/i386/mem.c b/sys/i386/i386/mem.c
index 5fb364e..6d8a94c 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.21 1995/11/29 14:39:26 julian Exp $
+ * $Id: mem.c,v 1.22 1995/12/07 12:45:34 davidg Exp $
*/
/*
@@ -48,6 +48,10 @@
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/buf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /* DEVFS */
+#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/uio.h>
#include <sys/malloc.h>
@@ -64,33 +68,53 @@
#include <vm/pmap.h>
#include <vm/vm_extern.h>
-#ifdef JREMOD
-#include <sys/kernel.h>
+
+
+static d_open_t mmopen;
+static d_close_t mmclose;
+static d_rdwr_t mmrw;
+static d_ioctl_t mmioctl;
+static d_mmap_t memmmap;
+
#define CDEV_MAJOR 2
-#endif /*JREMOD*/
+struct cdevsw mem_cdevsw =
+ { mmopen, mmclose, mmrw, mmrw, /*2*/
+ mmioctl, nullstop, nullreset, nodevtotty,/* memory */
+ seltrue, memmmap, NULL, "mem", NULL, -1 };
#ifdef DEVFS
-#include <sys/devfsext.h>
-
-static void
-memdevfs_init(dev_t dev)
+static void *mem_devfs_token;
+static void *kmem_devfs_token;
+static void *null_devfs_token;
+static void *random_devfs_token;
+static void *urandom_devfs_token;
+static void *zero_devfs_token;
+static void *io_devfs_token;
+
+static void
+memdevfs_init()
{
- void * x;
- int maj = major(dev);
-/* path name major minor type uid gid perm*/
- x=devfs_add_devsw("/misc", "mem", maj, 0, DV_CHR, 0, 2, 0640);
- x=devfs_add_devsw("/misc", "kmem", maj, 1, DV_CHR, 0, 2, 0640);
- x=devfs_add_devsw("/misc", "null", maj, 2, DV_CHR, 0, 0, 0666);
- x=devfs_add_devsw("/misc", "random", maj, 3, DV_CHR, 0, 0, 0666);
- x=devfs_add_devsw("/misc", "urandom", maj, 4, DV_CHR, 0, 0, 0666);
- x=devfs_add_devsw("/misc", "zero", maj, 12, DV_CHR, 0, 0, 0666);
- x=devfs_add_devsw("/misc", "io", maj, 14, DV_CHR, 0, 2, 0640);
+/* path name cdevsw minor type uid gid perm*/
+ mem_devfs_token = devfs_add_devsw(
+ "/", "mem", &mem_cdevsw, 0, DV_CHR, 0, 2, 0640);
+ kmem_devfs_token = devfs_add_devsw(
+ "/", "kmem", &mem_cdevsw, 1, DV_CHR, 0, 2, 0640);
+ null_devfs_token = devfs_add_devsw(
+ "/", "null", &mem_cdevsw, 2, DV_CHR, 0, 0, 0666);
+ random_devfs_token = devfs_add_devsw(
+ "/", "random", &mem_cdevsw, 3, DV_CHR, 0, 0, 0666);
+ urandom_devfs_token = devfs_add_devsw(
+ "/", "urandom", &mem_cdevsw, 4, DV_CHR, 0, 0, 0666);
+ zero_devfs_token = devfs_add_devsw(
+ "/", "zero", &mem_cdevsw, 12, DV_CHR, 0, 0, 0666);
+ io_devfs_token = devfs_add_devsw(
+ "/", "io", &mem_cdevsw, 14, DV_CHR, 0, 2, 0640);
}
#endif /* DEVFS */
extern char *ptvmmap; /* poor name! */
-int
+static int
mmclose(dev, flags, fmt, p)
dev_t dev;
int flags;
@@ -110,7 +134,7 @@ mmclose(dev, flags, fmt, p)
return(0);
}
-int
+static int
mmopen(dev, flags, fmt, p)
dev_t dev;
int flags;
@@ -130,7 +154,7 @@ mmopen(dev, flags, fmt, p)
return(0);
}
-int
+static int
mmrw(dev, uio, flags)
dev_t dev;
struct uio *uio;
@@ -317,7 +341,8 @@ mmrw(dev, uio, flags)
* allow user processes to MMAP some memory sections *
* instead of going through read/write *
\*******************************************************/
-int memmmap(dev_t dev, int offset, int nprot)
+static int
+memmmap(dev_t dev, int offset, int nprot)
{
switch (minor(dev))
{
@@ -339,7 +364,7 @@ int memmmap(dev_t dev, int offset, int nprot)
* Allow userland to select which interrupts will be used in the muck
* gathering business.
*/
-int
+static int
mmioctl(dev, cmd, cmdarg, flags, p)
dev_t dev;
int cmd;
@@ -383,29 +408,22 @@ mmioctl(dev, cmd, cmdarg, flags, p)
-#ifdef JREMOD
-struct cdevsw mem_cdevsw =
- { mmopen, mmclose, mmrw, mmrw, /*2*/
- mmioctl, nullstop, nullreset, nodevtotty,/* memory */
- seltrue, memmmap, NULL };
-
static mem_devsw_installed = 0;
-static void mem_drvinit(void *unused)
+static void
+mem_drvinit(void *unused)
{
dev_t dev;
if( ! mem_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&mem_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&mem_cdevsw, NULL);
mem_devsw_installed = 1;
#ifdef DEVFS
- memdevfs_init(dev);
+ memdevfs_init();
#endif
}
}
SYSINIT(memdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,mem_drvinit,NULL)
-#endif /* JREMOD */
-
diff --git a/sys/i386/include/conf.h b/sys/i386/include/conf.h
index f109737..ee6b603 100644
--- a/sys/i386/include/conf.h
+++ b/sys/i386/include/conf.h
@@ -2,383 +2,10 @@
#define _MACHINE_CONF_H_
#ifdef KERNEL
-
#ifndef ACTUALLY_LKM_NOT_KERNEL
-/*
- * XXX instead of this, the per-driver declarations should probably be
- * put in the "driver.h" headers. Then ioconf.h could include all the
- * "driver.h" headers and drivers would automatically include their
- * own "driver.h" header, so we wouldn't need to include ioconf.h here.
- * Interrupt handlers should probably be static.
- */
#include "ioconf.h"
#endif
-/*
- * The following was copied from the bogusly non-machine-generated
- * file <i386/i386/conf.c>. Eventually the routines should be static.
- */
-
-/* bdevs. */
-
-d_open_t wdopen;
-d_close_t wdclose;
-d_strategy_t wdstrategy;
-d_ioctl_t wdioctl;
-d_dump_t wddump;
-d_psize_t wdsize;
-
-d_open_t wormopen;
-d_close_t wormclose;
-d_strategy_t wormstrategy;
-d_ioctl_t wormioctl;
-d_dump_t wormdump;
-d_psize_t wormsize;
-
-d_open_t sctargopen;
-d_close_t sctargclose;
-d_strategy_t sctargstrategy;
-d_ioctl_t sctargioctl;
-d_dump_t sctargdump;
-d_psize_t sctargsize;
-
-d_open_t ptopen;
-d_close_t ptclose;
-d_strategy_t ptstrategy;
-d_ioctl_t ptioctl;
-d_dump_t ptdump;
-d_psize_t ptsize;
-
-d_open_t sdopen;
-d_close_t sdclose;
-d_strategy_t sdstrategy;
-d_ioctl_t sdioctl;
-d_dump_t sddump;
-d_psize_t sdsize;
-
-d_open_t stopen;
-d_close_t stclose;
-d_strategy_t ststrategy;
-d_ioctl_t stioctl;
-
-d_open_t odopen;
-d_close_t odclose;
-d_strategy_t odstrategy;
-d_ioctl_t odioctl;
-d_psize_t odsize;
-
-d_open_t cdopen;
-d_close_t cdclose;
-d_strategy_t cdstrategy;
-d_ioctl_t cdioctl;
-d_psize_t cdsize;
-
-d_open_t mcdopen;
-d_close_t mcdclose;
-d_strategy_t mcdstrategy;
-d_ioctl_t mcdioctl;
-d_psize_t mcdsize;
-
-d_open_t scdopen;
-d_close_t scdclose;
-d_strategy_t scdstrategy;
-d_ioctl_t scdioctl;
-d_psize_t scdsize;
-
-d_open_t matcdopen;
-d_close_t matcdclose;
-d_strategy_t matcdstrategy;
-d_ioctl_t matcdioctl;
-d_dump_t matcddump;
-d_psize_t matcdsize;
-
-d_open_t ataopen;
-d_close_t ataclose;
-d_strategy_t atastrategy;
-d_ioctl_t ataioctl;
-d_psize_t atasize;
-
-d_open_t wcdbopen;
-d_open_t wcdropen;
-d_close_t wcdbclose;
-d_close_t wcdrclose;
-d_strategy_t wcdstrategy;
-d_ioctl_t wcdioctl;
-
-d_open_t chopen;
-d_close_t chclose;
-d_strategy_t chstrategy; /* XXX not used */
-d_ioctl_t chioctl;
-
-d_open_t wtopen;
-d_close_t wtclose;
-d_strategy_t wtstrategy;
-d_ioctl_t wtioctl;
-d_dump_t wtdump;
-d_psize_t wtsize;
-
-d_open_t Fdopen;
-d_close_t fdclose;
-d_strategy_t fdstrategy;
-d_ioctl_t fdioctl;
-
-d_open_t vnopen;
-d_close_t vnclose;
-d_strategy_t vnstrategy;
-d_ioctl_t vnioctl;
-d_dump_t vndump;
-d_psize_t vnsize;
-
-d_open_t meteor_open;
-d_close_t meteor_close;
-d_read_t meteor_read;
-d_write_t meteor_write;
-d_ioctl_t meteor_ioctl;
-d_mmap_t meteor_mmap;
-
-d_rdwr_t swread, swwrite;
-
-/* cdevs. */
-
-d_open_t mmopen;
-d_close_t mmclose;
-d_rdwr_t mmrw;
-d_mmap_t memmmap;
-d_ioctl_t mmioctl;
-
-d_open_t ptsopen;
-d_close_t ptsclose;
-d_rdwr_t ptsread;
-d_rdwr_t ptswrite;
-d_stop_t ptsstop;
-d_open_t ptcopen;
-d_close_t ptcclose;
-d_rdwr_t ptcread;
-d_rdwr_t ptcwrite;
-d_select_t ptcselect;
-d_ttycv_t ptydevtotty;
-d_ioctl_t ptyioctl;
-
-d_open_t snpopen;
-d_close_t snpclose;
-d_rdwr_t snpread;
-d_rdwr_t snpwrite;
-d_select_t snpselect;
-d_ioctl_t snpioctl;
-
-d_open_t logopen;
-d_close_t logclose;
-d_rdwr_t logread;
-d_ioctl_t logioctl;
-d_select_t logselect;
-
-d_open_t bquopen;
-d_close_t bquclose;
-d_rdwr_t bquread, bquwrite;
-d_select_t bquselect;
-d_ioctl_t bquioctl;
-
-d_open_t lptopen;
-d_close_t lptclose;
-d_rdwr_t lptwrite;
-d_ioctl_t lptioctl;
-
-d_open_t twopen;
-d_close_t twclose;
-d_rdwr_t twread, twwrite;
-d_select_t twselect;
-
-d_open_t psmopen;
-d_close_t psmclose;
-d_rdwr_t psmread;
-d_select_t psmselect;
-d_ioctl_t psmioctl;
-
-d_open_t sndopen;
-d_close_t sndclose;
-d_ioctl_t sndioctl;
-d_rdwr_t sndread, sndwrite;
-d_select_t sndselect;
-
-d_open_t fdopen;
-
-d_open_t bpfopen;
-d_close_t bpfclose;
-d_rdwr_t bpfread, bpfwrite;
-d_select_t bpfselect;
-d_ioctl_t bpfioctl;
-
-d_open_t spkropen;
-d_close_t spkrclose;
-d_rdwr_t spkrwrite;
-d_ioctl_t spkrioctl;
-
-d_open_t pcaopen;
-d_close_t pcaclose;
-d_rdwr_t pcawrite;
-d_ioctl_t pcaioctl;
-d_select_t pcaselect;
-
-d_open_t mseopen;
-d_close_t mseclose;
-d_rdwr_t mseread;
-d_select_t mseselect;
-
-d_open_t sioopen;
-d_close_t sioclose;
-d_rdwr_t sioread, siowrite;
-d_ioctl_t sioioctl;
-d_stop_t siostop;
-d_ttycv_t siodevtotty;
-
-d_open_t suopen;
-d_close_t suclose;
-d_ioctl_t suioctl;
-d_rdwr_t suread, suwrite;
-d_select_t suselect;
-d_strategy_t sustrategy;
-
-d_open_t ukopen;
-d_close_t ukclose;
-d_strategy_t ukstrategy; /* XXX not used */
-d_ioctl_t ukioctl;
-
-d_open_t lkmcopen;
-d_close_t lkmcclose;
-d_ioctl_t lkmcioctl;
-d_open_t lkmenodev; /* XXX bogus; used for non-opens */
-
-d_open_t apmopen;
-d_close_t apmclose;
-d_ioctl_t apmioctl;
-
-d_open_t ctxopen;
-d_close_t ctxclose;
-d_rdwr_t ctxread;
-d_rdwr_t ctxwrite;
-d_ioctl_t ctxioctl;
-
-d_open_t sscopen;
-d_close_t sscclose;
-d_ioctl_t sscioctl;
-
-d_open_t cxopen;
-d_close_t cxclose;
-d_rdwr_t cxread, cxwrite;
-d_ioctl_t cxioctl;
-d_select_t cxselect;
-d_stop_t cxstop;
-d_ttycv_t cxdevtotty;
-
-d_open_t gpopen;
-d_close_t gpclose;
-d_rdwr_t gpwrite;
-d_ioctl_t gpioctl;
-
-d_open_t gscopen;
-d_close_t gscclose;
-d_rdwr_t gscread;
-d_ioctl_t gscioctl;
-
-d_open_t crdopen;
-d_close_t crdclose;
-d_rdwr_t crdread, crdwrite;
-d_ioctl_t crdioctl;
-d_select_t crdselect;
-
-d_open_t joyopen;
-d_close_t joyclose;
-d_rdwr_t joyread;
-d_ioctl_t joyioctl;
-
-d_open_t ascopen;
-d_close_t ascclose;
-d_rdwr_t ascread;
-d_ioctl_t ascioctl;
-d_select_t ascselect;
-
-d_open_t tunopen;
-d_close_t tunclose;
-d_rdwr_t tunread, tunwrite;
-d_ioctl_t tunioctl;
-d_select_t tunselect;
-
-d_open_t spigot_open;
-d_close_t spigot_close;
-d_ioctl_t spigot_ioctl;
-d_rdwr_t spigot_read, spigot_write;
-d_select_t spigot_select;
-d_mmap_t spigot_mmap;
-
-d_open_t cyopen;
-d_close_t cyclose;
-d_read_t cyread;
-d_write_t cywrite;
-d_ioctl_t cyioctl;
-d_stop_t cystop;
-d_ttycv_t cydevtotty;
-
-d_open_t dgbopen;
-d_close_t dgbclose;
-d_rdwr_t dgbread;
-d_rdwr_t dgbwrite;
-d_ioctl_t dgbioctl;
-d_stop_t dgbstop;
-d_ttycv_t dgbdevtotty;
-
-d_open_t siopen;
-d_close_t siclose;
-d_read_t siread;
-d_write_t siwrite;
-d_ioctl_t siioctl;
-d_stop_t sistop;
-d_ttycv_t sidevtotty;
-
-d_open_t ityopen;
-d_close_t ityclose;
-d_read_t ityread;
-d_write_t itywrite;
-d_ioctl_t ityioctl;
-d_stop_t itystop;
-d_ttycv_t itydevtotty;
-
-d_open_t nicopen;
-d_close_t nicclose;
-d_ioctl_t nicioctl;
-
-d_open_t nnicopen;
-d_close_t nnicclose;
-d_ioctl_t nnicioctl;
-
-d_open_t isdnopen;
-d_close_t isdnclose;
-d_read_t isdnread;
-d_ioctl_t isdnioctl;
-
-d_open_t itelopen;
-d_close_t itelclose;
-d_read_t itelread;
-d_write_t itelwrite;
-d_ioctl_t itelioctl;
-
-d_open_t ispyopen;
-d_close_t ispyclose;
-d_read_t ispyread;
-d_write_t ispywrite;
-d_ioctl_t ispyioctl;
-
-d_open_t rcopen;
-d_close_t rcclose;
-d_rdwr_t rcread, rcwrite;
-d_ioctl_t rcioctl;
-d_stop_t rcstop;
-d_ttycv_t rcdevtotty;
-
-d_open_t labpcopen;
-d_close_t labpcclose;
-d_strategy_t labpcstrategy;
-d_ioctl_t labpcioctl;
-
#endif /* KERNEL */
#endif /* !_MACHINE_CONF_H_ */
diff --git a/sys/i386/isa/asc.c b/sys/i386/isa/asc.c
index 2050c76..b072c5f 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.8 1995/11/29 14:39:31 julian Exp $
+ * $Id: asc.c,v 1.9 1995/12/06 23:42:22 bde Exp $
*/
#include "asc.h"
@@ -68,6 +68,11 @@
#include <sys/tty.h>
#include <sys/uio.h>
#include <sys/syslog.h>
+#include <sys/conf.h>
+#include <sys/kernel.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/asc_ioctl.h>
@@ -76,15 +81,6 @@
#include <i386/isa/isa_device.h>
#include <i386/isa/ascreg.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 71
-#endif /*JREMOD*/
-
#endif /* FREEBSD_1_X */
/***
@@ -184,6 +180,12 @@ struct asc_unit {
#endif
int height; /* height, for pnm modes */
size_t bcount; /* bytes to read, for pnm modes */
+#ifdef DEVFS
+ void *devfs_asc; /* storage for devfs tokens (handles) */
+ void *devfs_ascp;
+ void *devfs_ascd;
+ void *devfs_ascpd;
+#endif
} unittab[NASC];
/*** I could not find a reasonable buffer size limit other than by
@@ -202,6 +204,20 @@ int ascattach(struct isa_device *isdp);
struct isa_driver ascdriver = { ascprobe, ascattach, "asc" };
#ifndef FREEBSD_1_X
+
+static d_open_t ascopen;
+static d_close_t ascclose;
+static d_read_t ascread;
+static d_ioctl_t ascioctl;
+static d_select_t ascselect;
+
+#define CDEV_MAJOR 71
+
+static struct cdevsw asc_cdevsw =
+ { ascopen, ascclose, ascread, nowrite, /*71*/
+ ascioctl, nostop, nullreset, nodevtotty, /* asc */
+ ascselect, nommap, NULL, "asc", NULL, -1 };
+
struct asc_softc {
struct isa_device *dev;
} asc_softc[NASC];
@@ -226,6 +242,9 @@ asc_registerdev(struct isa_device *id)
kdc_asc[id->id_unit].kdc_isa = id;
dev_attach(&kdc_asc[id->id_unit]);
}
+#define STATIC static
+#else
+#define STATIC
#endif /* ! FREEBSD_1_X */
/***
@@ -447,8 +466,7 @@ ascattach(struct isa_device *isdp)
int unit = isdp->id_unit;
struct asc_unit *scu = unittab + unit;
#ifdef DEVFS
- char buf[32];
- void *x;
+ char name[32];
#endif
scu->flags |= DEBUG;
@@ -472,18 +490,24 @@ ascattach(struct isa_device *isdp)
asc_registerdev(isdp);
#endif
#ifdef DEVFS
- sprintf(buf,"asc%d",unit);
+#define ASC_UID 0
+#define ASC_GID 13
+ sprintf(name,"asc%d",unit);
/* path name devsw minor type uid gid perm*/
- x=dev_add("/misc", buf, ascopen, unit<<6, DV_CHR, 0, 0, 0666);
- sprintf(buf,"asc%dp",unit);
- x=dev_add("/misc", buf, ascopen, ((unit<<6) + FRMT_PBM),
- DV_CHR, 0, 0, 0666);
- sprintf(buf,"asc%dd",unit);
- x=dev_add("/misc", buf, ascopen, ((unit<<6) + DBUG_MASK),
- DV_CHR, 0, 0, 0666);
- sprintf(buf,"asc%dpd",unit);
- x=dev_add("/misc", buf, ascopen, ((unit<<6) + DBUG_MASK + FRMT_PBM),
- DV_CHR, 0, 0, 0666);
+ scu->devfs_asc = devfs_add_devsw("/", name, &asc_cdevsw, unit<<6,
+ DV_CHR, ASC_UID, ASC_GID, 0666);
+ sprintf(name,"asc%dp",unit);
+ scu->devfs_ascp = devfs_add_devsw("/", name, &asc_cdevsw,
+ ((unit<<6) + FRMT_PBM),
+ DV_CHR, ASC_UID, ASC_GID, 0666);
+ sprintf(name,"asc%dd",unit);
+ scu->devfs_ascd = devfs_add_devsw("/", name, &asc_cdevsw,
+ ((unit<<6) + DBUG_MASK),
+ DV_CHR, ASC_UID, ASC_GID, 0666);
+ sprintf(name,"asc%dpd",unit);
+ scu->devfs_ascpd = devfs_add_devsw("/", name, &asc_cdevsw,
+ ((unit<<6) + DBUG_MASK + FRMT_PBM),
+ DV_CHR, ASC_UID, ASC_GID, 0666);
#endif /*DEVFS*/
return 1; /* attach must not fail */
}
@@ -546,7 +570,7 @@ ascintr(int unit)
*** don't switch scanner on, wait until first read or ioctls go before
***/
-int
+STATIC int
ascopen(dev_t dev, int flags, int fmt, struct proc *p)
{
int unit = UNIT(minor(dev)) & UNIT_MASK;
@@ -620,7 +644,7 @@ asc_startread(struct asc_unit *scu)
*** should probably terminate dma ops, release int and dma. lr 12mar95
***/
-int
+STATIC int
ascclose(dev_t dev, int flags, int fmt, struct proc *p)
{
int unit = UNIT(minor(dev));
@@ -678,7 +702,7 @@ pbm_init(struct asc_unit *scu)
*** ascread
***/
-int
+STATIC int
ascread(dev_t dev, struct uio *uio, int ioflag)
{
int unit = UNIT(minor(dev));
@@ -766,7 +790,7 @@ ascread(dev_t dev, struct uio *uio, int ioflag)
*** ascioctl
***/
-int
+STATIC int
ascioctl(dev_t dev, int cmd, caddr_t data, int flags, struct proc *p)
{
int unit = UNIT(minor(dev));
@@ -831,7 +855,7 @@ ascioctl(dev_t dev, int cmd, caddr_t data, int flags, struct proc *p)
return SUCCESS;
}
-int
+STATIC int
ascselect(dev_t dev, int rw, struct proc *p)
{
int unit = UNIT(minor(dev));
@@ -863,42 +887,21 @@ ascselect(dev_t dev, int rw, struct proc *p)
}
-#ifdef JREMOD
-struct cdevsw asc_cdevsw =
- { ascopen, ascclose, ascread, nowrite, /*71*/
- ascioctl, nostop, nullreset, nodevtotty, /* asc */
- ascselect, nommap, NULL };
-
static asc_devsw_installed = 0;
-static void asc_drvinit(void *unused)
+static void
+asc_drvinit(void *unused)
{
dev_t dev;
- dev_t dev_chr;
if( ! asc_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&asc_cdevsw,NULL);
- dev_chr = dev;
-#if defined(BDEV_MAJOR)
- dev = makedev(BDEV_MAJOR,0);
- bdevsw_add(&dev,&asc_bdevsw,NULL);
-#endif /*BDEV_MAJOR*/
asc_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "asc", major(dev_chr), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(ascdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,asc_drvinit,NULL)
-#endif /* JREMOD */
#endif /* NASC > 0 */
diff --git a/sys/i386/isa/b004.c b/sys/i386/isa/b004.c
index 59a25dd..d39231a 100644
--- a/sys/i386/isa/b004.c
+++ b/sys/i386/isa/b004.c
@@ -53,6 +53,11 @@
#include <sys/proc.h>
#include <sys/uio.h>
#include <sys/devconf.h>
+#include <sys/conf.h>
+#include <sys/kernel.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/clock.h>
@@ -60,14 +65,6 @@
#include <i386/isa/isa.h>
#include <i386/isa/isa_device.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 8
-#endif /*JREMOD*/
static u_char d_inb(u_int port);
static void d_outb(u_int port, u_char data);
@@ -125,6 +122,19 @@ struct isa_driver bqudriver = {
bquprobe, bquattach, "bqu"
};
+static d_open_t bquopen;
+static d_close_t bquclose;
+static d_read_t bquread;
+static d_write_t bquwrite;
+static d_ioctl_t bquioctl;
+static d_select_t bquselect;
+
+#define CDEV_MAJOR 8
+struct cdevsw bqu_cdevsw =
+ { bquopen, bquclose, bquread, bquwrite, /*8*/
+ bquioctl, nostop, nullreset, nodevtotty,/* tputer */
+ bquselect, nommap, NULL, "bqu", NULL, -1 };
+
static int b004_sleep; /* wait address */
static struct b004_struct b004_table[NBQU];
@@ -239,7 +249,7 @@ bquanalyse( const int dev_min )
*
*****************************************************************************/
-int
+static int
bquread(dev_t dev, struct uio *uio, int flag)
{
unsigned int dev_min = minor(dev) & 7;
@@ -330,7 +340,7 @@ bquread(dev_t dev, struct uio *uio, int flag)
* int bquwrite() - write to the link interface.
*/
-int
+static int
bquwrite(dev_t dev, struct uio *uio, int flag)
{
unsigned int dev_min = minor(dev) & 7;
@@ -427,7 +437,7 @@ bquwrite(dev_t dev, struct uio *uio, int flag)
*
*/
-int
+static int
bquopen(dev_t dev, int flags, int fmt, struct proc *p)
{
unsigned int dev_min = minor(dev) & 7;
@@ -456,7 +466,7 @@ bquopen(dev_t dev, int flags, int fmt, struct proc *p)
* int b004close() -- close the link device.
*/
-int
+static int
bquclose(dev_t dev, int flags, int fmt, struct proc *p)
{
unsigned int dev_min = minor(dev) & 7;
@@ -471,7 +481,7 @@ bquclose(dev_t dev, int flags, int fmt, struct proc *p)
return 0;
}
-int
+static int
bquselect(dev_t dev, int rw, struct proc *p)
{
/* still unimplemented */
@@ -488,7 +498,7 @@ bquselect(dev_t dev, int rw, struct proc *p)
* - set timeout
*/
-int
+static int
bquioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p)
{
unsigned int dev_min = minor(dev) & 7;
@@ -535,17 +545,51 @@ bquioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p)
static inline void
bqu_registerdev(struct isa_device *id)
{
- if(id->id_unit)
- kdc_bqu[id->id_unit] = kdc_bqu[0];
- kdc_bqu[id->id_unit].kdc_unit = id->id_unit;
- kdc_bqu[id->id_unit].kdc_parentdata = id;
- dev_attach(&kdc_bqu[id->id_unit]);
+ int unit = id->id_unit;
+
+ kdc_bqu[unit] = kdc_bqu[0]; /* XXX */ /* ??Eh?? */
+ kdc_bqu[unit].kdc_unit = unit;
+ kdc_bqu[unit].kdc_parentdata = id;
+ dev_attach(&kdc_bqu[unit]);
}
static int
bquattach(struct isa_device *idp)
{
- kdc_bqu[idp->id_unit].kdc_state = DC_IDLE;
+ int unit = idp->id_unit;
+ struct b004_struct *bp;
+ char name[32];
+ int i;
+
+ kdc_bqu[unit].kdc_state = DC_IDLE;
+
+#ifdef DEVFS
+#define BQU_UID 66
+#define BQU_GID 66
+#define BQU_PERM 0600
+ bp = &b004_table[unit];
+ for ( i = 0; i < 8; i++) {
+#ifdef NOTYET
+ /* if (we've done all the ports found) break; */
+#endif
+ sprintf(name,"ttyba%d" ,i);
+ bp->devfs_token[i][0]=devfs_add_devsw(
+ "/", name, &bqu_cdevsw, i, DV_CHR,
+ BQU_UID, BQU_GID, BQU_PERM);
+ sprintf(name,"ttybd%d" ,i);
+ bp->devfs_token[i][0]=devfs_add_devsw(
+ "/", name, &bqu_cdevsw, i+64, DV_CHR,
+ BQU_UID, BQU_GID, BQU_PERM);
+ sprintf(name,"ttybc%d" ,i);
+ bp->devfs_token[i][0]=devfs_add_devsw(
+ "/", name, &bqu_cdevsw, i+128, DV_CHR,
+ BQU_UID, BQU_GID, BQU_PERM);
+ sprintf(name,"ttybd%d" ,i);
+ bp->devfs_token[i][0]=devfs_add_devsw(
+ "/", name, &bqu_cdevsw, i+192, DV_CHR,
+ BQU_UID, BQU_GID, BQU_PERM);
+ }
+#endif
return 1;
}
@@ -567,7 +611,10 @@ bquprobe(struct isa_device *idp)
register
*/
#ifdef undef
-printf("bquprobe::\nIOBASE 0x%x\nIRQ %d\nDRQ %d\nMSIZE %d\nUNIT %d\nFLAGS x0%x\nALIVE %d\n",idp->id_iobase,idp->id_irq,idp->id_drq,idp->id_msize,idp->id_unit,idp->id_flags,idp->id_alive);
+ printf(
+ "bquprobe::\nIOBASE 0x%x\nIRQ %d\nDRQ %d\nMSIZE %d\nUNIT %d\nFLAGS"
+ "x0%x\nALIVE %d\n",idp->id_iobase,idp->id_irq,
+ idp->id_drq,idp->id_msize,idp->id_unit,idp->id_flags,idp->id_alive);
#endif
if(first_time){
for(i=0;i<NBQU;i++) B004_F(i) &= ~B004_EXIST;
@@ -636,36 +683,21 @@ printf("bquprobe::\nIOBASE 0x%x\nIRQ %d\nDRQ %d\nMSIZE %d\nUNIT %d\nFLAGS x0%x\n
} /* bquprobe() */
-#ifdef JREMOD
-struct cdevsw bqu_cdevsw =
- { bquopen, bquclose, bquread, bquwrite, /*8*/
- bquioctl, nostop, nullreset, nodevtotty,/* tputer */
- bquselect, nommap, NULL };
-
static bqu_devsw_installed = 0;
-static void bqu_drvinit(void *unused)
+static void
+bqu_drvinit(void *unused)
{
dev_t dev;
if( ! bqu_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&bqu_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&bqu_cdevsw, NULL);
bqu_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "bqu", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(bqudev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,bqu_drvinit,NULL)
-#endif /* JREMOD */
#endif /* NBQU */
diff --git a/sys/i386/isa/b004.h b/sys/i386/isa/b004.h
index ee80d46..9c5576c 100644
--- a/sys/i386/isa/b004.h
+++ b/sys/i386/isa/b004.h
@@ -93,6 +93,7 @@ struct b004_struct {
int osr; /* address of the output status register */
unsigned int timeout; /* timeout for writing/reading the link */
int boardtype; /* what kind of board is installed */
+ void *devfs_token[8][4]; /* tokens for 4 types for 8 ports */
};
/*
diff --git a/sys/i386/isa/ctx.c b/sys/i386/isa/ctx.c
index 19b9671..817d539 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.10 1995/11/29 14:39:33 julian Exp $
+ * $Id: ctx.c,v 1.11 1995/12/06 23:42:26 bde Exp $
*/
/*
@@ -120,20 +120,17 @@
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/devconf.h>
+#include <sys/conf.h>
+#include <sys/kernel.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <i386/isa/isa.h>
#include <i386/isa/isa_device.h>
#include <i386/isa/ctxreg.h>
#include <machine/ioctl_ctx.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 40
-#endif /*JREMOD*/
int waitvb(short);
@@ -145,6 +142,19 @@ int waitvb(short);
int ctxprobe(), ctxattach();
struct isa_driver ctxdriver = {ctxprobe, ctxattach, "ctx"};
+static d_open_t ctxopen;
+static d_close_t ctxclose;
+static d_read_t ctxread;
+static d_write_t ctxwrite;
+static d_ioctl_t ctxioctl;
+#define CDEV_MAJOR 40
+
+struct cdevsw ctx_cdevsw =
+ { ctxopen, ctxclose, ctxread, ctxwrite, /*40*/
+ ctxioctl, nostop, nullreset, nodevtotty,/* cortex */
+ seltrue, nommap, NULL, "ctx", NULL, -1 };
+
+
#define LUTSIZE 256 /* buffer size for Look Up Table (LUT) */
#define PAGESIZE 65536 /* size of one video page, 1/4 of the screen */
@@ -160,6 +170,7 @@ struct ctx_soft_registers {
short iobase;
caddr_t maddr;
int msize;
+ void *devfs_token;
} ctx_sr[NCTX];
@@ -203,6 +214,7 @@ int
ctxattach(struct isa_device * devp)
{
struct ctx_soft_registers *sr;
+ char name[32];
sr = &(ctx_sr[devp->id_unit]);
sr->cp0 = 0; /* zero out the shadow registers */
@@ -213,9 +225,14 @@ ctxattach(struct isa_device * devp)
sr->msize = devp->id_msize;
kdc_ctx[devp->id_unit].kdc_state = DC_IDLE;
return (1);
+#ifdef DEVFS
+ sprintf(name,"ctx%d",devp->id_unit);
+ sr->devfs_token = devfs_add_devsw( "/", name, &ctx_cdevsw, 0,
+ DV_CHR, 0, 0, 0600);
+#endif /* DEVFS */
}
-int
+static int
ctxopen(dev_t dev, int flags, int fmt, struct proc *p)
{
struct ctx_soft_registers *sr;
@@ -271,7 +288,7 @@ ctxopen(dev_t dev, int flags, int fmt, struct proc *p)
return (0); /* successful open. All ready to go. */
}
-int
+static int
ctxclose(dev_t dev, int flags, int fmt, struct proc *p)
{
int unit;
@@ -284,7 +301,7 @@ ctxclose(dev_t dev, int flags, int fmt, struct proc *p)
return (0);
}
-int
+static int
ctxwrite(dev_t dev, struct uio * uio, int ioflag)
{
int unit, status = 0;
@@ -329,7 +346,7 @@ ctxwrite(dev_t dev, struct uio * uio, int ioflag)
return (status);
}
-int
+static int
ctxread(dev_t dev, struct uio * uio, int ioflag)
{
int unit, status = 0;
@@ -372,7 +389,7 @@ ctxread(dev_t dev, struct uio * uio, int ioflag)
return (status);
}
-int
+static int
ctxioctl(dev_t dev, int cmd, caddr_t data, int flags, struct proc *p)
{
int error;
@@ -451,15 +468,10 @@ waitvb(short port)
-#ifdef JREMOD
-struct cdevsw ctx_cdevsw =
- { ctxopen, ctxclose, ctxread, ctxwrite, /*40*/
- ctxioctl, nostop, nullreset, nodevtotty,/* cortex */
- seltrue, nommap, NULL };
-
static ctx_devsw_installed = 0;
-static void ctx_drvinit(void *unused)
+static void
+ctx_drvinit(void *unused)
{
dev_t dev;
@@ -467,20 +479,10 @@ static void ctx_drvinit(void *unused)
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&ctx_cdevsw,NULL);
ctx_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "ctx", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(ctxdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,ctx_drvinit,NULL)
-#endif /* JREMOD */
#endif /* NCTX > 0 */
diff --git a/sys/i386/isa/cx.c b/sys/i386/isa/cx.c
index 73ad274..b634db0 100644
--- a/sys/i386/isa/cx.c
+++ b/sys/i386/isa/cx.c
@@ -39,12 +39,6 @@
# include <machine/pio.h>
# define RB_GETC(q) getc(q)
# else /* BSD 4.4 Lite */
-# ifdef JREMOD
-# define CDEV_MAJOR 42
-# if defined(DEVFS)
-# include <sys/devfsext.h>
-# endif /*DEVFS*/
-# endif /*JREMOD*/
# include <sys/devconf.h>
# endif
#endif
@@ -83,6 +77,23 @@ extern cx_chan_t *cxchan [NCX*NCHAN]; /* unit to channel struct pointer */
#if __FreeBSD__ >= 2
extern struct kern_devconf kdc_cx [NCX];
struct tty cx_tty [NCX*NCHAN]; /* tty data */
+
+static d_open_t cxopen;
+static d_close_t cxclose;
+static d_read_t cxread;
+static d_write_t cxwrite;
+static d_ioctl_t cxioctl;
+static d_stop_t cxstop;
+static d_select_t cxselect;
+static d_ttycv_t cxdevtotty;
+
+# define CDEV_MAJOR 42
+
+struct cdevsw cx_cdevsw =
+ { cxopen, cxclose, cxread, cxwrite, /*42*/
+ cxioctl, cxstop, nullreset, cxdevtotty,/* cronyx */
+ cxselect, nommap, NULL, "cx", NULL, -1 };
+
#else
struct tty *cx_tty [NCX*NCHAN]; /* tty data */
#endif
@@ -968,14 +979,9 @@ void cxtimeout (void *a)
timeout (cxtimeout, 0, hz*5);
}
-#ifdef JREMOD
-struct cdevsw cx_cdevsw =
- { cxopen, cxclose, cxread, cxwrite, /*42*/
- cxioctl, cxstop, nullreset, cxdevtotty,/* cronyx */
- cxselect, nommap, NULL };
+#if defined(__FreeBSD__) && (__FreeBSD__ > 1 )
static cx_devsw_installed = 0;
-
static void cx_drvinit(void *unused)
{
dev_t dev;
@@ -984,20 +990,11 @@ static void cx_drvinit(void *unused)
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&cx_cdevsw,NULL);
cx_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "cx", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(cxdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cx_drvinit,NULL)
-#endif /* JREMOD */
+#endif
#endif /* NCX */
diff --git a/sys/i386/isa/cy.c b/sys/i386/isa/cy.c
index ae025c0..acd4db6 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.22 1995/11/29 14:39:37 julian Exp $
+ * $Id: cy.c,v 1.23 1995/12/06 23:42:34 bde Exp $
*/
#include "cy.h"
@@ -315,6 +315,10 @@ struct com_s {
u_char obuf1[256];
u_char obuf2[256];
+#ifdef DEVFS
+ void *devfs_token; /* one for now */
+#endif
+
struct kern_devconf kdc;
};
@@ -358,6 +362,21 @@ static struct com_s *p_com_addr[NSIO];
static struct timeval intr_timestamp;
+static d_open_t cyopen;
+static d_close_t cyclose;
+static d_read_t cyread;
+static d_write_t cywrite;
+static d_ioctl_t cyioctl;
+static d_stop_t cystop;
+static d_ttycv_t cydevtotty;
+
+#define CDEV_MAJOR 48
+struct cdevsw cy_cdevsw =
+ { cyopen, cyclose, cyread, cywrite, /*48*/
+ cyioctl, cystop, nxreset, cydevtotty,/*cyclades*/
+ ttselect, nxmmap, NULL, "cy", NULL, -1 };
+
+
struct isa_driver siodriver = {
sioprobe, sioattach, "cy"
};
@@ -396,12 +415,9 @@ static int cy_nr_cd1400s[NCY];
#undef RxFifoThreshold
static int volatile RxFifoThreshold = (CD1400_RX_FIFO_SIZE / 2);
-#ifdef JREMOD
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
-#define CDEV_MAJOR 48
-#endif /*JREMOD*/
static struct kern_devconf kdc_sio[NCY] = { {
0, 0, 0, /* filled in by dev_attach */
@@ -502,6 +518,7 @@ sioattach(isdp)
cy_addr iobase;
int ncyu;
int unit;
+ char name [32];
unit = isdp->id_unit;
if ((u_int)unit >= NCY)
@@ -575,6 +592,13 @@ sioattach(isdp)
s = spltty();
com_addr(unit) = com;
splx(s);
+#ifdef DEVFS
+/* XXX */ /* Fix this when you work out what the f*ck it looks like */
+ sprintf(name, "cy%d", unit);
+ com->devfs_token =
+ devfs_add_devsw( "/", name, &cy_cdevsw, unit,
+ DV_CHR, 0, 0, 0600);
+#endif
}
}
kdc_sio[isdp->id_unit].kdc_state = DC_BUSY; /* XXX */
@@ -585,7 +609,7 @@ sioattach(isdp)
return (1);
}
-int
+static int
sioopen(dev, flag, mode, p)
dev_t dev;
int flag;
@@ -786,7 +810,7 @@ out:
return (error);
}
-int
+static int
sioclose(dev, flag, mode, p)
dev_t dev;
int flag;
@@ -887,7 +911,7 @@ comhardclose(com)
splx(s);
}
-int
+static int
sioread(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -903,7 +927,7 @@ sioread(dev, uio, flag)
return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
}
-int
+static int
siowrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -1320,7 +1344,7 @@ siointr1(com)
{
}
-int
+static int
sioioctl(dev, cmd, data, flag, p)
dev_t dev;
int cmd;
@@ -2105,7 +2129,7 @@ comstart(tp)
splx(s);
}
-void
+static void
siostop(tp, rw)
struct tty *tp;
int rw;
@@ -2520,36 +2544,20 @@ cystatus(unit)
-#ifdef JREMOD
-struct cdevsw cy_cdevsw =
- { cyopen, cyclose, cyread, cywrite, /*48*/
- cyioctl, cystop, nxreset, cydevtotty,/*cyclades*/
- ttselect, nxmmap, NULL };
-
static cy_devsw_installed = 0;
-static void cy_drvinit(void *unused)
+static void
+cy_drvinit(void *unused)
{
dev_t dev;
if( ! cy_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&cy_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&cy_cdevsw, NULL);
cy_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "cy", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(cydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cy_drvinit,NULL)
-#endif /* JREMOD */
-
#endif /* NCY > 0 */
diff --git a/sys/i386/isa/fd.c b/sys/i386/isa/fd.c
index 1af2cbf..e1b3436 100644
--- a/sys/i386/isa/fd.c
+++ b/sys/i386/isa/fd.c
@@ -1,4 +1,4 @@
-/*-
+/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
@@ -43,7 +43,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
- * $Id: fd.c,v 1.71 1995/11/20 12:41:38 phk Exp $
+ * $Id: fd.c,v 1.72 1995/11/28 09:41:00 julian Exp $
*
*/
@@ -87,11 +87,7 @@
#include <sys/devfsext.h>
#endif
-#ifdef JREMOD
-#define CDEV_MAJOR 9
-#define BDEV_MAJOR 2
-static void fd_devsw_install();
-#endif /*JREMOD */
+
static int fd_goaway(struct kern_devconf *, int);
static int fdc_goaway(struct kern_devconf *, int);
static int fd_externalize(struct kern_devconf *, struct sysctl_req *);
@@ -250,6 +246,10 @@ struct fd_data {
int track; /* where we think the head is */
int options; /* user configurable options, see ioctl_fd.h */
int dkunit; /* disk stats unit number */
+#ifdef DEVFS
+ void *rfd_devfs_token;
+ void *fd_devfs_token;
+#endif
} fd_data[NFD];
/***********************************************************************\
@@ -342,6 +342,24 @@ struct isa_driver fdcdriver = {
fdprobe, fdattach, "fdc",
};
+static d_open_t Fdopen; /* NOTE, not fdopen */
+static d_close_t fdclose;
+static d_ioctl_t fdioctl;
+static d_strategy_t fdstrategy;
+
+#define CDEV_MAJOR 9
+#define BDEV_MAJOR 2
+extern struct cdevsw fd_cdevsw;
+struct bdevsw fd_bdevsw =
+ { Fdopen, fdclose, fdstrategy, fdioctl, /*2*/
+ nxdump, zerosize, 0, "fd", &fd_cdevsw, -1 };
+
+struct cdevsw fd_cdevsw =
+ { Fdopen, fdclose, rawread, rawwrite, /*9*/
+ fdioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, fdstrategy, "fd",
+ &fd_bdevsw, -1 };
+
struct isa_device *fdcdevs[NFDC];
/*
@@ -518,9 +536,6 @@ fdprobe(struct isa_device *dev)
#ifndef DEV_LKM
fdc_registerdev(dev);
#endif
-#ifdef JREMOD
- fd_devsw_install();
-#endif /*JREMOD*/
/* First - lets reset the floppy controller */
outb(dev->id_iobase+FDOUT, 0);
@@ -554,7 +569,6 @@ fdattach(struct isa_device *dev)
int ic_type = 0;
#ifdef DEVFS
char name[64];
- void *key;
#endif /* DEVFS */
fdc->fdcu = fdcu;
@@ -750,10 +764,12 @@ fdattach(struct isa_device *dev)
}
kdc_fd[fdu].kdc_state = DC_IDLE;
#ifdef DEVFS
- key = dev_add("/disks/rfloppy",name,(caddr_t)Fdopen,fdu * 8,
- DV_CHR,0,0,0644);
- key = dev_add("/disks/floppy",name,(caddr_t)Fdopen,fdu * 8,
- DV_BLK,0,0,0644);
+ fd->rfd_devfs_token = devfs_add_devsw(
+ "/",name,&fd_cdevsw, fdu * 8,
+ DV_CHR,0,0,0644);
+ fd->fd_devfs_token = devfs_add_devsw(
+ "/",name, &fd_bdevsw, fdu * 8,
+ DV_BLK,0,0,0644);
#endif /* DEVFS */
if (dk_ndrive < DK_NDRIVE) {
sprintf(dk_names[dk_ndrive], "fd%d", fdu);
@@ -1893,32 +1909,23 @@ fdioctl(dev, cmd, addr, flag, p)
}
-#ifdef JREMOD
-struct bdevsw fd_bdevsw =
- { Fdopen, fdclose, fdstrategy, fdioctl, /*2*/
- nxdump, zerosize, 0 };
-
-struct cdevsw fd_cdevsw =
- { Fdopen, fdclose, rawread, rawwrite, /*9*/
- fdioctl, nostop, nullreset, nodevtotty,/* Fd (!=fd) */
- seltrue, nommap, fdstrategy };
-
static fd_devsw_installed = 0;
-static void fd_devsw_install()
+static void fd_drvinit(void *notused )
{
- dev_t descript;
+ dev_t dev;
+
if( ! fd_devsw_installed ) {
- descript = makedev(CDEV_MAJOR,0);
- cdevsw_add(&descript,&fd_cdevsw,NULL);
-#if defined(BDEV_MAJOR)
- descript = makedev(BDEV_MAJOR,0);
- bdevsw_add(&descript,&fd_bdevsw,NULL);
-#endif /*BDEV_MAJOR*/
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&fd_cdevsw, NULL);
+ dev = makedev(BDEV_MAJOR, 0);
+ bdevsw_add(&dev,&fd_bdevsw, NULL);
fd_devsw_installed = 1;
}
}
-#endif /* JREMOD */
+
+SYSINIT(fddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,fd_drvinit,NULL)
+
#endif
/*
* Hello emacs, these are the
diff --git a/sys/i386/isa/gpib.c b/sys/i386/isa/gpib.c
index 1d0b1ac..76e11d9 100644
--- a/sys/i386/isa/gpib.c
+++ b/sys/i386/isa/gpib.c
@@ -33,6 +33,11 @@
#include "uio.h"
#include "kernel.h"
#include "malloc.h"
+#include <sys/conf.h>
+#include <sys/kernel.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/clock.h>
@@ -47,14 +52,6 @@
#define SLEEP_MAX 1000
#define SLEEP_MIN 4
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 44
-#endif /*JREMOD*/
int initgpib(void);
@@ -79,6 +76,17 @@ int gpattach();
struct isa_driver gpdriver = {gpprobe, gpattach, "gp"};
+static d_open_t gpopen;
+static d_close_t gpclose;
+static d_write_t gpwrite;
+static d_ioctl_t gpioctl;
+
+#define CDEV_MAJOR 44
+struct cdevsw gp_cdevsw =
+ { gpopen, gpclose, noread, gpwrite, /*44*/
+ gpioctl, nostop, nullreset, nodevtotty,/* GPIB */
+ seltrue, nommap, NULL, "gp", NULL, -1 };
+
#define BUFSIZE 1024
#define ATTACHED 0x08
#define OPEN 0x04
@@ -92,7 +100,10 @@ static struct gpib_softc {
u_char sc_flags; /* flags (open and internal) */
char sc_unit; /* gpib device number */
char *sc_inbuf; /* buffer for data */
-} gpib_sc;
+#ifdef DEVFS
+ void *devfs_token; /* handle for devfs entry */
+#endif
+} gpib_sc; /* only support one of these? */
static int oldcount;
static char oldbytes[2];
/*Probe routine*/
@@ -134,6 +145,10 @@ gpattach(isdp)
printf ("gp%d: type AT-GPIB chip NAT4882A\n",sc->sc_unit);
sc->sc_flags |=ATTACHED;
+#ifdef DEVFS
+ sc->devfs_token = devfs_add_devsw( "/", "gp", &gp_cdevsw, 0,
+ DV_CHR, 0, 0, 0600);
+#endif
return (1);
}
@@ -144,7 +159,7 @@ gpattach(isdp)
* More than 1 open is not allowed on the entire device.
* i.e. even if gpib5 is open, we can't open another minor device
*/
-int
+static int
gpopen(dev, flags, fmt, p)
dev_t dev;
int flags;
@@ -222,7 +237,7 @@ enableremote(unit);
* gpclose()
* Close gpib device.
*/
-int
+static int
gpclose(dev, flags, fmt, p)
dev_t dev;
int flags;
@@ -325,7 +340,7 @@ while (!(inb(ISR1)&2)&&(status==EWOULDBLOCK));
* Copy from user's buffer, then write to GPIB device referenced
* by minor(dev).
*/
-int
+static int
gpwrite(dev, uio, ioflag)
dev_t dev;
struct uio *uio;
@@ -378,7 +393,7 @@ gpwrite(dev, uio, ioflag)
An exception would be a plotter or printer that you can just
write to using a minor device = its GPIB address */
-int
+static int
gpioctl(dev_t dev, int cmd, caddr_t data, int flags, struct proc *p)
{
struct gpibdata *gd = (struct gpibdata *)data;
@@ -1264,36 +1279,21 @@ outb(CDOR,95); /*untalk*/
}
-#ifdef JREMOD
-struct cdevsw gp_cdevsw =
- { gpopen, gpclose, noread, gpwrite, /*44*/
- gpioctl, nostop, nullreset, nodevtotty,/* GPIB */
- seltrue, nommap, NULL };
-
static gp_devsw_installed = 0;
-static void gp_drvinit(void *unused)
+static void
+gp_drvinit(void *unused)
{
dev_t dev;
if( ! gp_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&gp_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&gp_cdevsw, NULL);
gp_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "gp", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(gpdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,gp_drvinit,NULL)
-#endif /* JREMOD */
#endif /* NGPIB > 0 */
diff --git a/sys/i386/isa/gsc.c b/sys/i386/isa/gsc.c
index e8dfade..f8369e5 100644
--- a/sys/i386/isa/gsc.c
+++ b/sys/i386/isa/gsc.c
@@ -45,6 +45,11 @@
#include <sys/ioctl.h>
#include <sys/uio.h>
#include <sys/syslog.h>
+#include <sys/conf.h>
+#include <sys/kernel.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/gsc.h>
@@ -57,14 +62,6 @@
* CONSTANTS & DEFINES
*
***********************************************************************/
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 47
-#endif /*JREMOD*/
#define PROBE_FAIL 0
#define PROBE_SUCCESS 1
@@ -159,6 +156,12 @@ struct gsc_unit {
int height; /* height, for pnm modes */
size_t bcount; /* bytes to read, for pnm modes */
struct _sbuf hbuf; /* buffer for pnm header data */
+#ifdef DEVFS
+ void *devfs_gsc; /* storage for devfs tokens (handles) */
+ void *devfs_gscp;
+ void *devfs_gscd;
+ void *devfs_gscpd;
+#endif
} unittab[NGSC];
/* I could not find a reasonable buffer size limit other than by
@@ -175,11 +178,23 @@ struct gsc_unit {
*
***********************************************************************/
-int gscprobe (struct isa_device *isdp);
-int gscattach(struct isa_device *isdp);
+static int gscprobe (struct isa_device *isdp);
+static int gscattach(struct isa_device *isdp);
struct isa_driver gscdriver = { gscprobe, gscattach, "gsc" };
+static d_open_t gscopen;
+static d_close_t gscclose;
+static d_read_t gscread;
+static d_ioctl_t gscioctl;
+
+#define CDEV_MAJOR 47
+struct cdevsw gsc_cdevsw =
+ { gscopen, gscclose, gscread, nowrite, /*47*/
+ gscioctl, nostop, nullreset, nodevtotty,/* gsc */
+ seltrue, nommap, NULL, "gsc", NULL, -1 };
+
+
/***********************************************************************
*
* LOCALLY USED SUBROUTINES
@@ -379,7 +394,7 @@ buffer_read(struct gsc_unit *scu)
* - if DMA channel matches (status byte has correct value)
*/
-int
+static int
gscprobe (struct isa_device *isdp)
{
int unit = isdp->id_unit;
@@ -476,11 +491,12 @@ gscprobe (struct isa_device *isdp)
* get geometry value
*/
-int
+static int
gscattach(struct isa_device *isdp)
{
int unit = isdp->id_unit;
struct gsc_unit *scu = unittab + unit;
+ char name[32];
scu->flags |= DEBUG;
@@ -507,6 +523,26 @@ gscattach(struct isa_device *isdp)
scu->flags |= ATTACHED;
lprintf("gsc%d.attach: ok\n", unit);
scu->flags &= ~DEBUG;
+#ifdef DEVFS
+#define GSC_UID 0
+#define GSC_GID 13
+ sprintf(name,"gsc%d",unit);
+/* path name devsw minor type uid gid perm*/
+ scu->devfs_gsc = devfs_add_devsw("/", name, &gsc_cdevsw, unit<<6,
+ DV_CHR, GSC_UID, GSC_GID, 0666);
+ sprintf(name,"gsc%dp",unit);
+ scu->devfs_gscp = devfs_add_devsw("/", name, &gsc_cdevsw,
+ ((unit<<6) + FRMT_PBM),
+ DV_CHR, GSC_UID, GSC_GID, 0666);
+ sprintf(name,"gsc%dd",unit);
+ scu->devfs_gscd = devfs_add_devsw("/", name, &gsc_cdevsw,
+ ((unit<<6) + DBUG_MASK),
+ DV_CHR, GSC_UID, GSC_GID, 0666);
+ sprintf(name,"gsc%dpd",unit);
+ scu->devfs_gscpd = devfs_add_devsw("/", name, &gsc_cdevsw,
+ ((unit<<6) + DBUG_MASK + FRMT_PBM),
+ DV_CHR, GSC_UID, GSC_GID, 0666);
+#endif /*DEVFS*/
return SUCCESS; /* attach must not fail */
}
@@ -520,7 +556,8 @@ gscattach(struct isa_device *isdp)
* don't switch scanner on, wait until first read ioctls go before
*/
-int gscopen (dev_t dev, int flags, int fmt, struct proc *p)
+static int
+gscopen (dev_t dev, int flags, int fmt, struct proc *p)
{
int unit = UNIT(minor(dev)) & UNIT_MASK;
struct gsc_unit *scu = unittab + unit;
@@ -573,7 +610,8 @@ int gscopen (dev_t dev, int flags, int fmt, struct proc *p)
* release the buffer
*/
-int gscclose (dev_t dev, int flags, int fmt, struct proc *p)
+static int
+gscclose (dev_t dev, int flags, int fmt, struct proc *p)
{
int unit = UNIT(minor(dev));
struct gsc_unit *scu = unittab + unit;
@@ -606,7 +644,8 @@ int gscclose (dev_t dev, int flags, int fmt, struct proc *p)
* gscread
*/
-int gscread (dev_t dev, struct uio *uio, int ioflag)
+static int
+gscread (dev_t dev, struct uio *uio, int ioflag)
{
int unit = UNIT(minor(dev));
struct gsc_unit *scu = unittab + unit;
@@ -695,7 +734,8 @@ int gscread (dev_t dev, struct uio *uio, int ioflag)
*
*/
-int gscioctl (dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
+static int
+gscioctl (dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
{
int unit = UNIT(minor(dev));
struct gsc_unit *scu = unittab + unit;
@@ -782,36 +822,21 @@ int gscioctl (dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
}
-#ifdef JREMOD
-struct cdevsw gsc_cdevsw =
- { gscopen, gscclose, gscread, nowrite, /*47*/
- gscioctl, nostop, nullreset, nodevtotty,/* gsc */
- seltrue, nommap, NULL };
-
static gsc_devsw_installed = 0;
-static void gsc_drvinit(void *unused)
+static void
+gsc_drvinit(void *unused)
{
dev_t dev;
if( ! gsc_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&gsc_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&gsc_cdevsw, NULL);
gsc_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "gsc", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(gscdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,gsc_drvinit,NULL)
-#endif /* JREMOD */
#endif /* NGSC > 0 */
diff --git a/sys/i386/isa/if_cx.c b/sys/i386/isa/if_cx.c
index 1520f95..8ea6810 100644
--- a/sys/i386/isa/if_cx.c
+++ b/sys/i386/isa/if_cx.c
@@ -45,9 +45,9 @@
# include <machine/pio.h>
# else
# ifdef DEVFS
+extern struct cdevsw cx_cdevsw;
# include <sys/devfsext.h>
# endif /*DEVFS*/
-# define CDEV_MAJOR 42 /*XXX*/ /* replace with variable ASAP*/
# include <sys/devconf.h>
# endif
# define watchdog_func_t void(*)(struct ifnet *)
@@ -372,11 +372,10 @@ void cxattach (struct device *parent, struct device *self, void *aux)
printf ("cx%d: <Cronyx-%s>\n", unit, b->name);
#ifdef DEVFS
{
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
+ void *x;
x=devfs_add_devsw(
/* path name devsw minor type uid gid perm*/
- "/", "cx", major(CDEV_MAJOR), 0, DV_CHR, 0, 0, 0600);
+ "/", "cx", &cx_cdevsw, 0, DV_CHR, 0, 0, 0600);
}
#endif
return (1);
diff --git a/sys/i386/isa/joy.c b/sys/i386/isa/joy.c
index 25d2311..2955d1c 100644
--- a/sys/i386/isa/joy.c
+++ b/sys/i386/isa/joy.c
@@ -34,6 +34,11 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/kernel.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/joystick.h>
@@ -41,15 +46,6 @@
#include <i386/isa/isa_device.h>
#include <i386/isa/timerreg.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 51
-#endif /*JREMOD*/
-
/* The game port can manage 4 buttons and 4 variable resistors (usually 2
* joysticks, each with 2 buttons and 2 pots.) via the port at address 0x201.
* Getting the state of the buttons is done by reading the game port:
@@ -77,6 +73,9 @@ static struct {
int port;
int x_off[2], y_off[2];
int timeout[2];
+#ifdef DEVFS
+ void *devfs_token;
+#endif
} joy[NJOY];
@@ -86,6 +85,17 @@ int joyprobe (struct isa_device *), joyattach (struct isa_device *);
struct isa_driver joydriver = {joyprobe, joyattach, "joy"};
+#define CDEV_MAJOR 51
+static d_open_t joyopen;
+static d_close_t joyclose;
+static d_read_t joyread;
+static d_ioctl_t joyioctl;
+
+struct cdevsw joy_cdevsw =
+ { joyopen, joyclose, joyread, nowrite, /*51*/
+ joyioctl, nostop, nullreset, nodevtotty,/*joystick */
+ seltrue, nommap, NULL, "joy", NULL, -1 };
+
static int get_tick ();
@@ -104,14 +114,22 @@ joyprobe (struct isa_device *dev)
int
joyattach (struct isa_device *dev)
{
- joy[dev->id_unit].port = dev->id_iobase;
- joy[dev->id_unit].timeout[0] = joy[dev->id_unit].timeout[1] = 0;
- printf("joy%d: joystick\n", dev->id_unit);
-
+ int unit = dev->id_unit;
+ char name[32];
+
+ joy[unit].port = dev->id_iobase;
+ joy[unit].timeout[0] = joy[unit].timeout[1] = 0;
+ printf("joy%d: joystick\n", unit);
+#ifdef DEVFS
+ sprintf(name, "joy%d", unit);
+ joy[dev->id_unit].devfs_token = devfs_add_devsw( "/", "joy",
+ &joy_cdevsw, 0,
+ DV_CHR, 0, 0, 0600);
+#endif
return 1;
}
-int
+static int
joyopen (dev_t dev, int flags, int fmt, struct proc *p)
{
int unit = UNIT (dev);
@@ -123,7 +141,7 @@ joyopen (dev_t dev, int flags, int fmt, struct proc *p)
joy[unit].timeout[i] = JOY_TIMEOUT;
return 0;
}
-int
+static int
joyclose (dev_t dev, int flags, int fmt, struct proc *p)
{
int unit = UNIT (dev);
@@ -133,7 +151,7 @@ joyclose (dev_t dev, int flags, int fmt, struct proc *p)
return 0;
}
-int
+static int
joyread (dev_t dev, struct uio *uio, int flag)
{
int unit = UNIT(dev);
@@ -169,7 +187,9 @@ joyread (dev_t dev, struct uio *uio, int flag)
c.b2 = ~(state >> 1) & 1;
return uiomove ((caddr_t)&c, sizeof(struct joystick), uio);
}
-int joyioctl (dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
+
+static int
+joyioctl (dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
{
int unit = UNIT (dev);
int i = joypart (dev);
@@ -202,6 +222,7 @@ int joyioctl (dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
}
return 0;
}
+
static int
get_tick ()
{
@@ -215,12 +236,6 @@ get_tick ()
}
-#ifdef JREMOD
-struct cdevsw joy_cdevsw =
- { joyopen, joyclose, joyread, nowrite, /*51*/
- joyioctl, nostop, nullreset, nodevtotty,/*joystick */
- seltrue, nommap, NULL};
-
static joy_devsw_installed = 0;
static void joy_drvinit(void *unused)
@@ -231,20 +246,9 @@ static void joy_drvinit(void *unused)
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&joy_cdevsw,NULL);
joy_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "joy", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(joydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,joy_drvinit,NULL)
-#endif /* JREMOD */
-
#endif /* NJOY > 0 */
diff --git a/sys/i386/isa/labpc.c b/sys/i386/isa/labpc.c
index 430be96..97984ee 100644
--- a/sys/i386/isa/labpc.c
+++ b/sys/i386/isa/labpc.c
@@ -53,20 +53,17 @@
#include <sys/errno.h>
#include <sys/buf.h>
#include <sys/dataacq.h>
+#include <sys/conf.h>
+#include <sys/kernel.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/devconf.h>
#include <machine/clock.h>
#include <i386/isa/isa_device.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 66
-#endif /*JREMOD*/
/* Miniumum timeout:
@@ -151,6 +148,9 @@ struct ctlr
/* Device configuration structure:
*/
struct kern_devconf kdc;
+#ifdef DEVFS
+ void *devfs_token;
+#endif
};
#ifdef LOUTB
@@ -283,6 +283,17 @@ extern int labpcprobe(struct isa_device *dev);
struct isa_driver labpcdriver =
{ labpcprobe, labpcattach, "labpc", 0 /* , labpcdetach */ };
+static d_open_t labpcopen;
+static d_close_t labpcclose;
+static d_ioctl_t labpcioctl;
+static d_strategy_t labpcstrategy;
+
+#define CDEV_MAJOR 66
+struct cdevsw labpc_cdevsw =
+ { labpcopen, labpcclose, rawread, rawwrite, /*66*/
+ labpcioctl, nostop, nullreset, nodevtotty,/* labpc */
+ seltrue, nommap, labpcstrategy, "labpc", NULL, -1 };
+
static void start(struct ctlr *ctlr);
static void
@@ -495,6 +506,8 @@ int labpcprobe(struct isa_device *dev)
int labpcattach(struct isa_device *dev)
{
struct ctlr *ctlr = labpcs[dev->id_unit];
+ char name[32];
+
ctlr->sample_us = (1000000.0 / (double)LABPC_DEFAULT_HERZ) + .50;
reset(ctlr);
labpc_registerdev(dev);
@@ -505,6 +518,13 @@ int labpcattach(struct isa_device *dev)
ctlr->dcr_is = 0x80;
loutb(DCR(ctlr), ctlr->dcr_val);
+#ifdef DEVFS
+ sprintf(name, "labpc%d",dev->id_unit);
+ /* path name devsw minor */
+ ctlr->devfs_token = devfs_add_devsw( "/", name, &labpc_cdevsw, 0,
+ /* what UID GID PERM */
+ DV_CHR, 0, 0, 0600);
+#endif
return 1;
}
@@ -734,7 +754,7 @@ lockout_multiple_open(dev_t current, dev_t next)
return ! (DIGITAL(current) && DIGITAL(next));
}
-int
+static int
labpcopen(dev_t dev, int flags, int fmt, struct proc *p)
{
u_short unit = UNIT(dev);
@@ -772,7 +792,7 @@ labpcopen(dev_t dev, int flags, int fmt, struct proc *p)
return 0;
}
-int
+static int
labpcclose(dev_t dev, int flags, int fmt, struct proc *p)
{
struct ctlr *ctlr = labpcs[UNIT(dev)];
@@ -1007,7 +1027,7 @@ digital_in_strategy(struct buf *bp, struct ctlr *ctlr)
}
-void
+static void
labpcstrategy(struct buf *bp)
{
struct ctlr *ctlr = labpcs[UNIT(bp->b_dev)];
@@ -1045,7 +1065,7 @@ labpcstrategy(struct buf *bp)
}
}
-int
+static int
labpcioctl(dev_t dev, int cmd, caddr_t arg, int mode, struct proc *p)
{
struct ctlr *ctlr = labpcs[UNIT(dev)];
@@ -1107,12 +1127,6 @@ labpcioctl(dev_t dev, int cmd, caddr_t arg, int mode, struct proc *p)
}
-#ifdef JREMOD
-struct cdevsw labpc_cdevsw =
- { labpcopen, labpcclose, rawread, rawwrite, /*66*/
- labpcioctl, nostop, nullreset, nodevtotty,/* labpc */
- seltrue, nommap, labpcstrategy };
-
static labpc_devsw_installed = 0;
static void labpc_drvinit(void *unused)
@@ -1123,19 +1137,9 @@ static void labpc_drvinit(void *unused)
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&labpc_cdevsw,NULL);
labpc_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "labpc", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(labpcdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,labpc_drvinit,NULL)
-#endif /* JREMOD */
diff --git a/sys/i386/isa/lpt.c b/sys/i386/isa/lpt.c
index 3c0b4b4..81d503b 100644
--- a/sys/i386/isa/lpt.c
+++ b/sys/i386/isa/lpt.c
@@ -46,7 +46,7 @@
* SUCH DAMAGE.
*
* from: unknown origin, 386BSD 0.1
- * $Id: lpt.c,v 1.44 1995/12/06 23:50:14 bde Exp $
+ * $Id: lpt.c,v 1.45 1995/12/07 12:46:03 davidg Exp $
*/
/*
@@ -113,6 +113,9 @@
#include <sys/uio.h>
#include <sys/syslog.h>
#include <sys/devconf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/clock.h>
#include <machine/lpt.h>
@@ -144,14 +147,6 @@
#endif
#endif /* INET */
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 16
-#endif /*JREMOD*/
#define LPINITRDY 4 /* wait up to 4 seconds for a ready */
#define LPTOUTTIME 4 /* wait up to 4 seconds for a ready */
@@ -232,7 +227,9 @@ struct lpt_softc {
u_char *sc_ifbuf;
int sc_iferrs;
#endif /* ENDIF */
-
+#ifdef DEVFS
+ void *devfs_token;
+#endif
} lpt_sc[NLPT] ;
/* bits for state */
@@ -289,6 +286,18 @@ struct isa_driver lptdriver = {
lptprobe, lptattach, "lpt"
};
+static d_open_t lptopen;
+static d_close_t lptclose;
+static d_write_t lptwrite;
+static d_ioctl_t lptioctl;
+
+#define CDEV_MAJOR 16
+struct cdevsw lpt_cdevsw =
+ { lptopen, lptclose, noread, lptwrite, /*16*/
+ lptioctl, nullstop, nullreset, nodevtotty,/* lpt */
+ seltrue, nommap, nostrat, "lpt", NULL, -1 };
+
+
static struct kern_devconf kdc_lpt[NLPT] = { {
0, 0, 0, /* filled in by dev_attach */
"lpt", 0, { MDDT_ISA, 0, "tty" },
@@ -443,8 +452,11 @@ int
lptattach(struct isa_device *isdp)
{
struct lpt_softc *sc;
+ int unit;
+ char name[32];
- sc = lpt_sc + isdp->id_unit;
+ unit = isdp->id_unit;
+ sc = lpt_sc + unit;
sc->sc_port = isdp->id_iobase;
sc->sc_primed = 0; /* not primed yet */
outb(sc->sc_port+lpt_control, LPC_NINIT);
@@ -453,18 +465,25 @@ lptattach(struct isa_device *isdp)
lprintf("oldirq %x\n", sc->sc_irq);
if (isdp->id_irq) {
sc->sc_irq = LP_HAS_IRQ | LP_USE_IRQ | LP_ENABLE_IRQ;
- printf("lpt%d: Interrupt-driven port\n", isdp->id_unit);
+ printf("lpt%d: Interrupt-driven port\n", unit);
#ifdef INET
- lpattach(sc, isdp->id_unit);
+ lpattach(sc, unit);
#endif
} else {
sc->sc_irq = 0;
- lprintf("lpt%d: Polled port\n", isdp->id_unit);
+ lprintf("lpt%d: Polled port\n", unit);
}
lprintf("irq %x\n", sc->sc_irq);
- kdc_lpt[isdp->id_unit].kdc_state = DC_IDLE;
+ kdc_lpt[unit].kdc_state = DC_IDLE;
+#ifdef DEVFS
+/* XXX */ /* what to do about the flags in the minor number? */
+ sprintf(name,"lpt%d",unit);
+ /* path name devsw minor type uid gid perm*/
+ sc->devfs_token = devfs_add_devsw( "/", name, &lpt_cdevsw, unit,
+ DV_CHR, 0, 0, 0600);
+#endif
return (1);
}
@@ -474,7 +493,7 @@ lptattach(struct isa_device *isdp)
* printer -- this is just used for passing ioctls.
*/
-int
+static int
lptopen (dev_t dev, int flags, int fmt, struct proc *p)
{
struct lpt_softc *sc;
@@ -608,7 +627,7 @@ lptout (struct lpt_softc * sc)
* Check for interrupted write call added.
*/
-int
+static int
lptclose(dev_t dev, int flags, int fmt, struct proc *p)
{
struct lpt_softc *sc = lpt_sc + LPTUNIT(minor(dev));
@@ -707,7 +726,7 @@ pushbytes(struct lpt_softc * sc)
* Flagging of interrupted write added.
*/
-int
+static int
lptwrite(dev_t dev, struct uio * uio, int ioflag)
{
register unsigned n;
@@ -805,7 +824,7 @@ lptintr(int unit)
lprintf("sts %x ", sts);
}
-int
+static int
lptioctl(dev_t dev, int cmd, caddr_t data, int flags, struct proc *p)
{
int error = 0;
@@ -1355,12 +1374,6 @@ lpoutput (struct ifnet *ifp, struct mbuf *m,
#endif /* INET */
-#ifdef JREMOD
-struct cdevsw lpt_cdevsw =
- { lptopen, lptclose, noread, lptwrite, /*16*/
- lptioctl, nullstop, nullreset, nodevtotty,/* lpt */
- seltrue, nommap, nostrat};
-
static lpt_devsw_installed = 0;
static void lpt_drvinit(void *unused)
@@ -1368,21 +1381,11 @@ static void lpt_drvinit(void *unused)
dev_t dev;
if( ! lpt_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&lpt_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&lpt_cdevsw, NULL);
lpt_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "lpt", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(lptdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,lpt_drvinit,NULL)
-#endif /* JREMOD */
diff --git a/sys/i386/isa/matcd/matcd.c b/sys/i386/isa/matcd/matcd.c
index f4e29fa..20f5116 100644
--- a/sys/i386/isa/matcd/matcd.c
+++ b/sys/i386/isa/matcd/matcd.c
@@ -323,6 +323,11 @@ Edit number code marking begins here - earlier edits were during development.
Also, disable the audio-related ioctls based on the BOOTMFS
conditional to help make the boot floppy kernel smaller.
18-Oct-95 Frank Durda IV bsdmail@nemesis.lonestar.org
+
+<27> Incorporated changes needed to move the cdevsw and bdevsw
+ entries into the drivers (including this one). Also
+ include a quick first pass cut at DEVFS suppport.
+
---------------------------------------------------------------------------*/
/*Match this format: Version_dc(d)__dd-mmm-yy */
@@ -332,6 +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:$ */
/*---------------------------------------------------------------------------
Include declarations
@@ -356,9 +362,14 @@ static char MATCDCOPYRIGHT[] = "Matsushita CD-ROM driver, Copr. 1994,1995 Frank
#ifdef FREE2
#include <sys/devconf.h> /*<16>*/
+#include <sys/conf.h>
+#include <sys/kernel.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#else /*FREE2*/
-#include "i386/isa/isa.h" /*<16>*/
-#include "i386/isa/isa_device.h" /*<16>*/
+#include <i386/isa/isa.h> /*<16>*/
+#include <i386/isa/isa_device.h> /*<16>*/
#endif /*FREE2*/
/*---------------------------------------------------------------------------
@@ -433,6 +444,12 @@ static struct matcd_data { /*<18>*/
struct matcd_mbx mbx;
u_char patch[2]; /*<12>Last known audio routing*/
u_char volume[2]; /*<12>Last known volume setting*/
+#ifdef DEVFS
+ void *ra_devfs_token; /* handle for devfs entry */
+ void *rc_devfs_token;
+ void *a_devfs_token;
+ void *c_devfs_token;
+#endif DEVFS
} matcd_data[TOTALDRIVES];
@@ -491,15 +508,6 @@ static struct kern_devconf kdc_matcd[TOTALDRIVES] = { { /*<12>*/
"Matsushita CD-ROM Controller" /*<12>This is the description*/
} }; /*<12>*/
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 46
-#define BDEV_MAJOR 17
-#endif /*JREMOD */
#endif /*FREE2*/
@@ -535,19 +543,48 @@ static struct kern_devconf kdc_matcd[TOTALDRIVES] = { { /*<12>*/
/*---------------------------------------------------------------------------
Entry points and other connections to/from kernel - see also conf.h
+ --- not any more :)
---------------------------------------------------------------------------*/
-extern int hz;
extern int matcd_probe(struct isa_device *dev);
extern int matcd_attach(struct isa_device *dev);
struct isa_driver matcddriver={matcd_probe, matcd_attach, /*<16>*/
"matcdc"}; /*<20>*/
+#ifdef FREE2
+
+static d_open_t matcdopen;
+static d_close_t matcdclose;
+static d_ioctl_t matcdioctl;
+static d_dump_t matcddump;
+static d_psize_t matcdsize;
+static d_strategy_t matcdstrategy;
+
+#define CDEV_MAJOR 46
+#define BDEV_MAJOR 17
+
+extern struct cdevsw matcd_cdevsw;
+static struct bdevsw matcd_bdevsw =
+ { matcdopen, matcdclose, matcdstrategy, matcdioctl, /*17*/
+ nxdump, matcdsize, 0, "matcd",
+ &matcd_cdevsw, -1 };
+
+static struct cdevsw matcd_cdevsw =
+ { matcdopen, matcdclose, rawread, nowrite, /*46*/
+ matcdioctl, nostop, nullreset, nodevtotty,/* SB cd */
+ seltrue, nommap, matcdstrategy, "matcd",
+ &matcd_bdevsw, -1};
+
+#else
+extern int hz;
+#endif /* FREE2 */
+
/*---------------------------------------------------------------------------
Internal function declarations
---------------------------------------------------------------------------*/
+static void matcd_drvinit(void *unused);
static void matcd_start(struct buf *dp);
static void zero_cmd(char *);
static void matcd_pread(int port, int count, unsigned char * data);
@@ -1421,6 +1458,9 @@ int matcd_attach(struct isa_device *dev)
unsigned char data[12];
struct matcd_data *cd;
int port = dev->id_iobase; /*Take port ID selected in probe()*/
+#ifdef DEVFS
+ char name[32];
+#endif
#ifdef DIAGPORT
DIAGOUT(DIAGPORT,0x70); /*Show where we are*/
@@ -1471,6 +1511,29 @@ int matcd_attach(struct isa_device *dev)
for (i=0; i<MAXPARTITIONS; i++) {
cd->partflags[i]=0;
}
+#ifdef DEVFS
+#define MATCD_UID 0
+#define MATCD_GID 13
+ sprintf(name, "rmatcd%da",i);
+ cd->ra_devfs_token = devfs_add_devsw(
+ "/", name, &matcd_cdevsw, 0,
+ DV_CHR, MATCD_UID, MATCD_GID, 0600);
+
+ sprintf(name, "rmatcd%dc",i);
+ cd->rc_devfs_token = devfs_add_devsw(
+ "/", name, &matcd_cdevsw, RAW_PART,
+ DV_CHR, MATCD_UID, MATCD_GID, 0600);
+
+ sprintf(name, "matcd%da",i);
+ cd->a_devfs_token = devfs_add_devsw(
+ "/", name, &matcd_bdevsw, 0,
+ DV_BLK, MATCD_UID, MATCD_GID, 0600);
+
+ sprintf(name, "matcd%dc",i);
+ cd->c_devfs_token = devfs_add_devsw(
+ "/", name, &matcd_bdevsw, RAW_PART,
+ DV_BLK, MATCD_UID, MATCD_GID, 0600);
+#endif
}
}
nextcontroller++; /*Bump ctlr assign to next number*/
@@ -2749,47 +2812,27 @@ static int matcd_igot(struct ioc_capability * sqp)
audio are here*/
#endif /*FULLDRIVER*/
-#ifdef JREMOD
-struct bdevsw matcd_bdevsw =
- { matcdopen, matcdclose, matcdstrategy, matcdioctl, /*17*/
- nxdump, matcdsize, 0 };
-
-struct cdevsw matcd_cdevsw =
- { matcdopen, matcdclose, rawread, nowrite, /*46*/
- matcdioctl, nostop, nullreset, nodevtotty,/* SB cd */
- seltrue, nommap, matcdstrategy };
+#ifdef FREE2
static matcd_devsw_installed = 0;
-static void matcd_drvinit(void *unused)
+static void
+matcd_drvinit(void *unused)
{
dev_t dev;
- dev_t dev_chr;
if( ! matcd_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&matcd_cdevsw,NULL);
- dev_chr = dev;
dev = makedev(BDEV_MAJOR,0);
bdevsw_add(&dev,&matcd_bdevsw,NULL);
matcd_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "rmatcd", major(dev_chr), 0, DV_CHR, 0, 0, 0600);
- x=devfs_add_devsw(
- "/", "matcd", major(dev), 0, DV_BLK, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(matcddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,matcd_drvinit,NULL)
-#endif /* JREMOD */
+#endif /* FREE2 */
/*End of matcd.c*/
diff --git a/sys/i386/isa/mcd.c b/sys/i386/isa/mcd.c
index 5f7f68b..ee2e03a 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.50 1995/11/29 10:47:44 julian Exp $
+ * $Id: mcd.c,v 1.51 1995/11/29 14:39:46 julian Exp $
*/
static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
@@ -61,6 +61,10 @@ static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
#include <sys/dkbad.h>
#include <sys/disklabel.h>
#include <sys/devconf.h>
+#include <sys/kernel.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/clock.h>
@@ -70,15 +74,6 @@ static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
#include <i386/isa/isa_device.h>
#include <i386/isa/mcdreg.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 29
-#define BDEV_MAJOR 7
-#endif /*JREMOD */
#define MCD_TRACE(format, args...) \
{ \
@@ -164,6 +159,12 @@ struct mcd_data {
short debug;
struct buf head; /* head of buf queue */
struct mcd_mbx mbx;
+#ifdef DEVFS
+ void *ra_devfs_token; /* store the devfs handle here */
+ void *rc_devfs_token; /* store the devfs handle here */
+ void *a_devfs_token; /* store the devfs handle here */
+ void *c_devfs_token; /* store the devfs handle here */
+#endif
} mcd_data[NMCD];
/* reader state machine */
@@ -208,11 +209,29 @@ static int mcd_resume(int unit);
static int mcd_lock_door(int unit, int lock);
static int mcd_close_tray(int unit);
-extern int hz;
static int mcd_probe(struct isa_device *dev);
static int mcd_attach(struct isa_device *dev);
struct isa_driver mcddriver = { mcd_probe, mcd_attach, "mcd" };
+static d_open_t mcdopen;
+static d_close_t mcdclose;
+static d_ioctl_t mcdioctl;
+static d_psize_t mcdsize;
+static d_strategy_t mcdstrategy;
+
+#define CDEV_MAJOR 29
+#define BDEV_MAJOR 7
+extern struct cdevsw mcd_cdevsw;
+struct bdevsw mcd_bdevsw =
+ { mcdopen, mcdclose, mcdstrategy, mcdioctl, /*7*/
+ nxdump, mcdsize, 0, "mcd", &mcd_cdevsw, -1 };
+
+struct cdevsw mcd_cdevsw =
+ { mcdopen, mcdclose, rawread, nowrite, /*29*/
+ mcdioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, mcdstrategy, "mcd",
+ &mcd_bdevsw, -1 };
+
#define mcd_put(port,byte) outb(port,byte)
#define MCD_RETRYS 5
@@ -253,20 +272,44 @@ mcd_registerdev(struct isa_device *id)
int mcd_attach(struct isa_device *dev)
{
- struct mcd_data *cd = mcd_data + dev->id_unit;
+ int unit = dev->id_unit;
+ struct mcd_data *cd = mcd_data + unit;
+ char name[32];
cd->iobase = dev->id_iobase;
cd->flags |= MCDINIT;
- mcd_soft_reset(dev->id_unit);
+ mcd_soft_reset(unit);
#ifdef NOTYET
/* wire controller for interrupts and dma */
mcd_configure(cd);
#endif
- kdc_mcd[dev->id_unit].kdc_state = DC_IDLE;
+ kdc_mcd[unit].kdc_state = DC_IDLE;
/* name filled in probe */
- kdc_mcd[dev->id_unit].kdc_description = mcd_data[dev->id_unit].name;
-
+ kdc_mcd[unit].kdc_description = mcd_data[unit].name;
+#ifdef DEVFS
+#define MCD_UID 0
+#define MCD_GID 13
+ sprintf(name, "rmcd%da",unit);
+ cd->ra_devfs_token = devfs_add_devsw(
+ "/", name, &mcd_cdevsw, (unit * 8 ) + 0,
+ DV_CHR, MCD_UID, MCD_GID, 0600);
+
+ sprintf(name, "rmcd%dc",unit);
+ cd->rc_devfs_token = devfs_add_devsw(
+ "/", name, &mcd_cdevsw, (unit * 8 ) + RAW_PART,
+ DV_CHR, MCD_UID, MCD_GID, 0600);
+
+ sprintf(name, "mcd%da",unit);
+ cd->a_devfs_token = devfs_add_devsw(
+ "/", name, &mcd_bdevsw, (unit * 8 ) + 0,
+ DV_BLK, MCD_UID, MCD_GID, 0600);
+
+ sprintf(name, "mcd%dc",unit);
+ cd->c_devfs_token = devfs_add_devsw(
+ "/", name, &mcd_bdevsw, (unit * 8 ) + RAW_PART,
+ DV_BLK, MCD_UID, MCD_GID, 0600);
+#endif
return 1;
}
@@ -1670,45 +1713,23 @@ mcd_resume(int unit)
return mcd_play(unit, &cd->lastpb);
}
-#ifdef JREMOD
-struct bdevsw mcd_bdevsw =
- { mcdopen, mcdclose, mcdstrategy, mcdioctl, /*7*/
- nxdump, mcdsize, 0 };
-
-struct cdevsw mcd_cdevsw =
- { mcdopen, mcdclose, rawread, nowrite, /*29*/
- mcdioctl, nostop, nullreset, nodevtotty,/* mitsumi cd */
- seltrue, nommap, mcdstrategy };
static mcd_devsw_installed = 0;
static void mcd_drvinit(void *unused)
{
dev_t dev;
- dev_t dev_chr;
if( ! mcd_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&mcd_cdevsw,NULL);
- dev_chr = dev;
dev = makedev(BDEV_MAJOR,0);
bdevsw_add(&dev,&mcd_bdevsw,NULL);
mcd_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
-/* path name devsw minor type uid gid perm*/
- "/", "rmcd", major(dev_chr), 0, DV_CHR, 0, 0, 0600);
- x=devfs_add_devsw(
- "/", "mcd", major(dev), 0, DV_BLK, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(mcddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,mcd_drvinit,NULL)
-#endif /* JREMOD */
#endif /* NMCD > 0 */
diff --git a/sys/i386/isa/mse.c b/sys/i386/isa/mse.c
index 8e9fa7b..96f62e5 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.18 1995/11/29 14:39:47 julian Exp $
+ * $Id: mse.c,v 1.19 1995/12/06 23:42:53 bde Exp $
*/
/*
* Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and
@@ -55,20 +55,16 @@
#include <sys/ioctl.h>
#include <sys/uio.h>
#include <sys/devconf.h>
+#include <sys/conf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/clock.h>
#include <i386/isa/isa_device.h>
#include <i386/isa/icu.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 27
-#endif /*JREMOD*/
static int mseprobe(struct isa_device *);
static int mseattach(struct isa_device *);
@@ -77,6 +73,18 @@ struct isa_driver msedriver = {
mseprobe, mseattach, "mse"
};
+static d_open_t mseopen;
+static d_close_t mseclose;
+static d_read_t mseread;
+static d_select_t mseselect;
+
+#define CDEV_MAJOR 27
+struct cdevsw mse_cdevsw =
+ { mseopen, mseclose, mseread, nowrite, /*27*/
+ noioc, nostop, nullreset, nodevtotty,/* mse */
+ mseselect, nommap, NULL, "mse", NULL, -1 };
+
+
/*
* Software control structure for mouse. The sc_enablemouse(),
* sc_disablemouse() and sc_getmouse() routines must be called spl'd().
@@ -96,6 +104,10 @@ struct mse_softc {
int sc_buttons;
int sc_bytesread;
u_char sc_bytes[PROTOBYTES];
+#ifdef DEVFS
+ void *devfs_token;
+ void *n_devfs_token;
+#endif
} mse_sc[NMSE];
/* Flags */
@@ -238,17 +250,31 @@ int
mseattach(idp)
struct isa_device *idp;
{
- struct mse_softc *sc = &mse_sc[idp->id_unit];
+ char name[32];
+ int unit = idp->id_unit;
+ struct mse_softc *sc = &mse_sc[unit];
sc->sc_port = idp->id_iobase;
- kdc_mse[idp->id_unit].kdc_state = DC_IDLE;
+ kdc_mse[unit].kdc_state = DC_IDLE;
+#ifdef DEVFS
+ sprintf(name,"mse%d", unit);
+ /* path name devsw minor */
+ sc->devfs_token = devfs_add_devsw( "/", name, &mse_cdevsw, unit << 1,
+ /*type uid gid perm*/
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"nmse%d", unit);
+ /* path name devsw minor */
+ sc->n_devfs_token = devfs_add_devsw("/", name, &mse_cdevsw, (unit<<1)+1,
+ /*type uid gid perm*/
+ DV_CHR, 0, 0, 0600);
+#endif
return (1);
}
/*
* Exclusive open the mouse, initialize it and enable interrupts.
*/
-int
+static int
mseopen(dev, flags, fmt, p)
dev_t dev;
int flags;
@@ -281,7 +307,7 @@ mseopen(dev, flags, fmt, p)
/*
* mseclose: just turn off mouse innterrupts.
*/
-int
+static int
mseclose(dev, flags, fmt, p)
dev_t dev;
int flags;
@@ -304,7 +330,7 @@ mseclose(dev, flags, fmt, p)
* using bytes 4 and 5.
* (Yes this is cheesy, but it makes the X386 server happy, so...)
*/
-int
+static int
mseread(dev, uio, ioflag)
dev_t dev;
struct uio *uio;
@@ -366,7 +392,7 @@ mseread(dev, uio, ioflag)
/*
* mseselect: check for mouse input to be processed.
*/
-int
+static int
mseselect(dev, rw, p)
dev_t dev;
int rw;
@@ -575,12 +601,6 @@ mse_getati(port, dx, dy, but)
outb(port + MSE_PORTB, MSE_INPORT_INTREN);
}
-#ifdef JREMOD
-struct cdevsw mse_cdevsw =
- { mseopen, mseclose, mseread, nowrite, /*27*/
- noioc, nostop, nullreset, nodevtotty,/* mse */
- mseselect, nommap, NULL };
-
static mse_devsw_installed = 0;
static void mse_drvinit(void *unused)
@@ -588,23 +608,13 @@ static void mse_drvinit(void *unused)
dev_t dev;
if( ! mse_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&mse_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&mse_cdevsw, NULL);
mse_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "mse", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(msedev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,mse_drvinit,NULL)
-#endif /* JREMOD */
#endif /* NMSE */
diff --git a/sys/i386/isa/pcaudio.c b/sys/i386/isa/pcaudio.c
index 7a285ea1..d0bb085 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.20 1995/11/30 05:58:53 julian Exp $
+ * $Id: pcaudio.c,v 1.21 1995/12/01 23:09:20 julian Exp $
*/
#include "pca.h"
@@ -39,6 +39,7 @@
#include <sys/file.h>
#include <sys/proc.h>
#include <sys/devconf.h>
+#include <sys/kernel.h>
#include <machine/clock.h>
#include <machine/pcaudioio.h>
@@ -52,11 +53,6 @@
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /* DEVFS */
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#endif /* JREMOD */
-#define CDEV_MAJOR 24
#define BUF_SIZE 8192
#define SAMPLE_RATE 8000
@@ -85,6 +81,8 @@ static char buffer1[BUF_SIZE];
static char buffer2[BUF_SIZE];
static char volume_table[256];
+static void *pca_devfs_token;
+static void *pcac_devfs_token;
static int pca_sleep = 0;
static int pca_initialized = 0;
@@ -96,6 +94,18 @@ struct isa_driver pcadriver = {
pcaprobe, pcaattach, "pca",
};
+static d_open_t pcaopen;
+static d_close_t pcaclose;
+static d_write_t pcawrite;
+static d_ioctl_t pcaioctl;
+static d_select_t pcaselect;
+
+#define CDEV_MAJOR 24
+struct cdevsw pca_cdevsw =
+ { pcaopen, pcaclose, noread, pcawrite, /*24*/
+ pcaioctl, nostop, nullreset, nodevtotty,/* pcaudio */
+ pcaselect, nommap, NULL, "pca", NULL, -1 };
+
inline void conv(const void *table, void *buff, unsigned long n)
{
@@ -250,17 +260,6 @@ pca_registerdev(struct isa_device *id)
dev_attach(&kdc_pca[id->id_unit]);
}
-#ifdef DEVFS
-
-void pcadevfs_init(caddr_t data) /* data not used */
-{
- void * x;
-/* path name devsw minor type uid gid perm*/
- x=devfs_add_devsw("/", "pcaudio", CDEV_MAJOR, 0, DV_CHR, 0, 0, 0666);
- x=devfs_add_devsw("/", "pcaudioctl", CDEV_MAJOR, 128, DV_CHR, 0, 0, 0666);
-}
-#endif /*DEVFS*/
-
int
pcaattach(struct isa_device *dvp)
@@ -269,14 +268,18 @@ pcaattach(struct isa_device *dvp)
pca_init();
pca_registerdev(dvp);
#ifdef DEVFS
- pcadevfs_init(NULL);
+/* path name devsw minor type uid gid perm*/
+ pca_devfs_token = devfs_add_devsw("/", "pcaudio", &pca_cdevsw, 0,
+ DV_CHR, 0, 0, 0666);
+ pcac_devfs_token = devfs_add_devsw("/", "pcaudioctl", &pca_cdevsw, 128,
+ DV_CHR, 0, 0, 0666);
#endif /*DEVFS*/
return 1;
}
-int
+static int
pcaopen(dev_t dev, int flags, int fmt, struct proc *p)
{
/* audioctl device can always be opened */
@@ -304,7 +307,7 @@ pcaopen(dev_t dev, int flags, int fmt, struct proc *p)
}
-int
+static int
pcaclose(dev_t dev, int flags, int fmt, struct proc *p)
{
/* audioctl device can always be closed */
@@ -320,7 +323,7 @@ pcaclose(dev_t dev, int flags, int fmt, struct proc *p)
}
-int
+static int
pcawrite(dev_t dev, struct uio *uio, int flag)
{
int count, error, which;
@@ -364,7 +367,7 @@ pcawrite(dev_t dev, struct uio *uio, int flag)
}
-int
+static int
pcaioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
{
audio_info_t *auptr;
@@ -487,12 +490,6 @@ pcaselect(dev_t dev, int rw, struct proc *p)
}
}
-#ifdef JREMOD
-struct cdevsw pca_cdevsw =
- { pcaopen, pcaclose, noread, pcawrite, /*24*/
- pcaioctl, nostop, nullreset, nodevtotty,/* pcaudio */
- pcaselect, nommap, NULL };
-
static pca_devsw_installed = 0;
static void pca_drvinit(void *unused)
@@ -500,14 +497,13 @@ static void pca_drvinit(void *unused)
dev_t dev;
if( ! pca_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&pca_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&pca_cdevsw, NULL);
pca_devsw_installed = 1;
}
}
SYSINIT(pcadev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,pca_drvinit,NULL)
-#endif /* JREMOD */
#endif
diff --git a/sys/i386/isa/pcvt/pcvt_drv.c b/sys/i386/isa/pcvt/pcvt_drv.c
index 4060aaa..dca8922 100644
--- a/sys/i386/isa/pcvt/pcvt_drv.c
+++ b/sys/i386/isa/pcvt/pcvt_drv.c
@@ -118,7 +118,7 @@ static d_mmap_t pcmmap;
static struct cdevsw pcdevsw = {
pcopen, pcclose, pcread, pcwrite,
pcioctl, nullstop, noreset, pcdevtotty,
- ttselect, pcmmap, nostrategy,
+ ttselect, pcmmap, nostrategy, "vt", NULL, -1
};
#if PCVT_NETBSD > 100 /* NetBSD-current Feb 20 1995 */
diff --git a/sys/i386/isa/psm.c b/sys/i386/isa/psm.c
index 0ab8355..010f9db 100644
--- a/sys/i386/isa/psm.c
+++ b/sys/i386/isa/psm.c
@@ -58,6 +58,10 @@
#include <sys/file.h>
#include <sys/proc.h>
#include <sys/vnode.h>
+#include <sys/conf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#if 0
#include <sys/syslog.h> /* For debugging */
#endif
@@ -66,14 +70,6 @@
#include <i386/isa/isa_device.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 21
-#endif /*JREMOD*/
#define DATA 0 /* Offset for data port, read-write */
#define CNTRL 4 /* Offset for control port, write-only */
@@ -125,6 +121,10 @@ static struct psm_softc { /* Driver status information */
unsigned char status; /* Mouse button status */
unsigned char button; /* Previous mouse button status bits */
int x, y; /* accumulated motion in the X,Y axis */
+#ifdef DEVFS
+ void *devfs_token;
+ void *n_devfs_token;
+#endif
} psm_softc[NPSM];
#define OPEN 1 /* Device is open */
@@ -132,6 +132,18 @@ static struct psm_softc { /* Driver status information */
struct isa_driver psmdriver = { psmprobe, psmattach, "psm" };
+static d_open_t psmopen;
+static d_close_t psmclose;
+static d_read_t psmread;
+static d_ioctl_t psmioctl;
+static d_select_t psmselect;
+
+#define CDEV_MAJOR 21
+static struct cdevsw psm_cdevsw =
+ { psmopen, psmclose, psmread, nowrite, /*21*/
+ psmioctl, nostop, nullreset, nodevtotty,
+ psmselect, nommap, NULL, "psm", NULL, -1 };
+
#define AUX_PORT 0x60 /* AUX_PORT base (S.Yuen) */
static void psm_write_dev(int inport, u_char value)
@@ -212,11 +224,13 @@ int psmattach(struct isa_device *dvp)
return(0); /* XXX eh? usually 1 indicates success */
}
-int psmopen(dev_t dev, int flag, int fmt, struct proc *p)
+static int
+psmopen(dev_t dev, int flag, int fmt, struct proc *p)
{
int unit = PSMUNIT(dev);
struct psm_softc *sc;
int ioport;
+ char name[32];
/* Validate unit number */
@@ -254,11 +268,24 @@ int psmopen(dev_t dev, int flag, int fmt, struct proc *p)
/* Enable Bus Mouse interrupts */
psm_write_dev(ioport, PSM_DEV_ENABLE);
+
psm_poll_status();
outb(ioport+CNTRL, PSM_ENABLE);
psm_command(ioport, PSM_INT_ENABLE);
/* Successful open */
+#ifdef DEVFS
+ sprintf(name,"psm%d", unit);
+ /* path name devsw minor */
+ sc->devfs_token = devfs_add_devsw( "/", name, &psm_cdevsw, unit << 1,
+ /*type uid gid perm*/
+ DV_CHR, 0, 0, 0666);
+ sprintf(name,"npsm%d", unit);
+ /* path name devsw minor */
+ sc->n_devfs_token = devfs_add_devsw("/", name, &psm_cdevsw, (unit<<1)+1,
+ /*type uid gid perm*/
+ DV_CHR, 0, 0, 0666);
+#endif
return(0);
}
@@ -273,7 +300,8 @@ void psm_poll_status(void)
}
-int psmclose(dev_t dev, int flag, int fmt, struct proc *p)
+static int
+psmclose(dev_t dev, int flag, int fmt, struct proc *p)
{
int unit, ioport;
struct psm_softc *sc;
@@ -299,7 +327,8 @@ int psmclose(dev_t dev, int flag, int fmt, struct proc *p)
return(0);
}
-int psmread(dev_t dev, struct uio *uio, int flag)
+static int
+psmread(dev_t dev, struct uio *uio, int flag)
{
int s;
int error = 0; /* keep compiler quiet, even though initialisation
@@ -364,7 +393,8 @@ int psmread(dev_t dev, struct uio *uio, int flag)
return(error);
}
-int psmioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p)
+static int
+psmioctl(dev_t dev, int cmd, caddr_t addr, int flag, struct proc *p)
{
struct psm_softc *sc;
struct mouseinfo info;
@@ -443,7 +473,8 @@ void psmintr(unit)
selwakeup(&sc->rsel);
}
-int psmselect(dev_t dev, int rw, struct proc *p)
+static int
+psmselect(dev_t dev, int rw, struct proc *p)
{
int s, ret;
struct psm_softc *sc = &psm_softc[PSMUNIT(dev)];
@@ -467,11 +498,6 @@ int psmselect(dev_t dev, int rw, struct proc *p)
return(ret);
}
-#ifdef JREMOD
-struct cdevsw psm_cdevsw =
- { psmopen, psmclose, psmread, nowrite, /*21*/
- psmioctl, nostop, nullreset, nodevtotty,/* psm mice */
- psmselect, nommap, NULL };
static psm_devsw_installed = 0;
@@ -480,24 +506,14 @@ static void psm_drvinit(void *unused)
dev_t dev;
if( ! psm_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&psm_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&psm_cdevsw, NULL);
psm_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "psm", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(psmdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,psm_drvinit,NULL)
-#endif /* JREMOD */
#endif
diff --git a/sys/i386/isa/rc.c b/sys/i386/isa/rc.c
index e4e3325..83db4c6 100644
--- a/sys/i386/isa/rc.c
+++ b/sys/i386/isa/rc.c
@@ -47,6 +47,9 @@
#include <sys/kernel.h>
#include <sys/syslog.h>
#include <sys/devconf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/clock.h>
@@ -57,14 +60,6 @@
#include <i386/isa/ic/cd180.h>
#include <i386/isa/rcreg.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 63
-#endif /*JREMOD*/
/* Prototypes */
int rcprobe __P((struct isa_device *));
@@ -105,6 +100,20 @@ struct isa_driver rcdriver = {
rcprobe, rcattach, "rc"
};
+static d_open_t rcopen;
+static d_close_t rcclose;
+static d_read_t rcread;
+static d_write_t rcwrite;
+static d_ioctl_t rcioctl;
+static d_stop_t rcstop;
+static d_ttycv_t rcdevtotty;
+
+#define CDEV_MAJOR 63
+struct cdevsw rc_cdevsw =
+ { rcopen, rcclose, rcread, rcwrite, /*63*/
+ rcioctl, rcstop, nxreset, rcdevtotty,/* rc */
+ ttselect, nommap, NULL, "rc", NULL, -1 };
+
/* Per-board structure */
static struct rc_softc {
u_int rcb_probed; /* 1 - probed, 2 - attached */
@@ -134,6 +143,9 @@ static struct rc_chans {
u_char *rc_obufend; /* end of output buf */
u_char rc_ibuf[4 * RC_IBUFSIZE]; /* input buffer */
u_char rc_obuf[RC_OBUFSIZE]; /* output buffer */
+#ifdef DEVFS
+ void *devfs_token;
+#endif
} rc_chans[NRC * CD180_NCHAN];
static int rc_scheduled_event = 0;
@@ -249,6 +261,7 @@ int rcattach(dvp)
struct rc_chans *rc = &rc_chans[dvp->id_unit * CD180_NCHAN];
static int rc_wakeup_started = 0;
struct tty *tp;
+ char name[32];
/* Thorooughly test the device */
if (rcb->rcb_probed != RC_PROBED)
@@ -279,6 +292,13 @@ int rcattach(dvp)
tp->t_lflag = tp->t_iflag = tp->t_oflag = 0;
tp->t_cflag = TTYDEF_CFLAG;
tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
+#ifdef DEVFS
+/* FIX THIS to reflect real devices */
+ sprintf(name,"rc%d.%d",dvp->id_unit,chan);
+ rc->devfs_token = devfs_add_devsw( "/", name,
+ &rc_cdevsw,(dvp->id_unit * CD180_NCHAN) + chan ,
+ DV_CHR, 0, 0, 0600);
+#endif
}
rcb->rcb_probed = RC_ATTACHED;
if (!rc_wakeup_started) {
@@ -693,7 +713,8 @@ done1:
goto repeat;
}
-void rcstop(tp, rw)
+static void
+rcstop(tp, rw)
register struct tty *tp;
int rw;
{
@@ -726,7 +747,8 @@ void rcstop(tp, rw)
enable_intr();
}
-int rcopen(dev, flag, mode, p)
+static int
+rcopen(dev, flag, mode, p)
dev_t dev;
int flag, mode;
struct proc *p;
@@ -817,7 +839,8 @@ out:
return error;
}
-int rcclose(dev, flag, mode, p)
+static int
+rcclose(dev, flag, mode, p)
dev_t dev;
int flag, mode;
struct proc *p;
@@ -874,7 +897,8 @@ register struct rc_chans *rc;
}
/* Read from line */
-int rcread(dev, uio, flag)
+static int
+rcread(dev, uio, flag)
dev_t dev;
struct uio *uio;
int flag;
@@ -885,7 +909,8 @@ int rcread(dev, uio, flag)
}
/* Write to line */
-int rcwrite(dev, uio, flag)
+static int
+rcwrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
int flag;
@@ -1091,7 +1116,8 @@ struct rc_softc *rcb;
(void) rc_param(rc->rc_tp, &rc->rc_tp->t_termios);
}
-int rcioctl(dev, cmd, data, flag, p)
+static int
+rcioctl(dev, cmd, data, flag, p)
dev_t dev;
int cmd, flag;
caddr_t data;
@@ -1409,7 +1435,7 @@ char *comment;
}
#endif /* RCDEBUG */
-struct tty *
+static struct tty *
rcdevtotty(dev)
dev_t dev;
{
@@ -1501,12 +1527,6 @@ rc_wait0(nec, unit, chan, line)
unit, chan, line);
}
-#ifdef JREMOD
-struct cdevsw rc_cdevsw =
- { rcopen, rcclose, rcread, rcwrite, /*63*/
- rcioctl, rcstop, nxreset, rcdevtotty,/* rc */
- ttselect, nommap, NULL };
-
static rc_devsw_installed = 0;
static void rc_drvinit(void *unused)
@@ -1514,23 +1534,13 @@ static void rc_drvinit(void *unused)
dev_t dev;
if( ! rc_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&rc_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&rc_cdevsw, NULL);
rc_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "rc", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(rcdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,rc_drvinit,NULL)
-#endif /* JREMOD */
#endif /* NRC */
diff --git a/sys/i386/isa/scd.c b/sys/i386/isa/scd.c
index edffabf..a111bba 100644
--- a/sys/i386/isa/scd.c
+++ b/sys/i386/isa/scd.c
@@ -41,7 +41,7 @@
*/
-/* $Id: scd.c,v 1.11 1995/11/29 10:47:50 julian Exp $ */
+/* $Id: scd.c,v 1.12 1995/11/29 14:39:53 julian Exp $ */
/* Please send any comments to micke@dynas.se */
@@ -64,6 +64,10 @@
#include <sys/dkbad.h>
#include <sys/disklabel.h>
#include <sys/devconf.h>
+#include <sys/kernel.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/clock.h>
#include <machine/stdarg.h>
@@ -72,14 +76,6 @@
#include <i386/isa/isa_device.h>
#include <i386/isa/scdreg.h>
-#ifdef JREMOD
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 45
-#define BDEV_MAJOR 16
-#endif /*JREMOD */
#define scd_part(dev) ((minor(dev)) & 7)
#define scd_unit(dev) (((minor(dev)) & 0x38) >> 3)
@@ -148,6 +144,12 @@ static struct scd_data {
short audio_status;
struct buf head; /* head of buf queue */
struct scd_mbx mbx;
+#ifdef DEVFS
+ void *ra_devfs_token;
+ void *rc_devfs_token;
+ void *a_devfs_token;
+ void *c_devfs_token;
+#endif
} scd_data[NSCD];
/* prototypes */
@@ -184,12 +186,30 @@ static int scd_toc_header(int unit, struct ioc_toc_header *th);
static int scd_toc_entrys(int unit, struct ioc_read_toc_entry *te);
#define SCD_LASTPLUS1 170 /* don't ask, xcdplayer passes this in */
-extern int hz;
-
static int scd_probe(struct isa_device *dev);
static int scd_attach(struct isa_device *dev);
struct isa_driver scddriver = { scd_probe, scd_attach, "scd" };
+static d_open_t scdopen;
+static d_close_t scdclose;
+static d_ioctl_t scdioctl;
+static d_psize_t scdsize;
+static d_strategy_t scdstrategy;
+
+#define CDEV_MAJOR 45
+#define BDEV_MAJOR 16
+extern struct cdevsw scd_cdevsw;
+struct bdevsw scd_bdevsw =
+ { scdopen, scdclose, scdstrategy, scdioctl, /*16*/
+ nxdump, scdsize, 0, "scd", &scd_cdevsw, -1 };
+
+struct cdevsw scd_cdevsw =
+ { scdopen, scdclose, rawread, nowrite, /*45*/
+ scdioctl, nostop, nullreset, nodevtotty,/* sony cd */
+ seltrue, nommap, scdstrategy, "scd",
+ &scd_bdevsw, -1 };
+
+
static struct kern_devconf kdc_scd[NSCD] = { {
0, 0, 0, /* filled in by dev_attach */
"scd", 0, { MDDT_ISA, 0, "bio" },
@@ -213,7 +233,9 @@ scd_registerdev(struct isa_device *id)
int scd_attach(struct isa_device *dev)
{
- struct scd_data *cd = scd_data + dev->id_unit;
+ int unit = dev->id_unit;
+ struct scd_data *cd = scd_data + unit;
+ char name[32];
cd->iobase = dev->id_iobase; /* Already set by probe, but ... */
@@ -227,10 +249,33 @@ int scd_attach(struct isa_device *dev)
cd->flags = SCDINIT;
cd->audio_status = CD_AS_AUDIO_INVALID;
+#ifdef DEVFS
+#define SCD_UID 0
+#define SCD_GID 13
+ sprintf(name, "rscd%da",unit);
+ cd->ra_devfs_token = devfs_add_devsw(
+ "/", name, &scd_cdevsw, (unit * 8 ) + 0,
+ DV_CHR, SCD_UID, SCD_GID, 0600);
+
+ sprintf(name, "rscd%dc",unit);
+ cd->rc_devfs_token = devfs_add_devsw(
+ "/", name, &scd_cdevsw, (unit * 8 ) + RAW_PART,
+ DV_CHR, SCD_UID, SCD_GID, 0600);
+
+ sprintf(name, "scd%da",unit);
+ cd->a_devfs_token = devfs_add_devsw(
+ "/", name, &scd_bdevsw, (unit * 8 ) + 0,
+ DV_BLK, SCD_UID, SCD_GID, 0600);
+
+ sprintf(name, "scd%dc",unit);
+ cd->c_devfs_token = devfs_add_devsw(
+ "/", name, &scd_bdevsw, (unit * 8 ) + RAW_PART,
+ DV_BLK, SCD_UID, SCD_GID, 0600);
+#endif
return 1;
}
-int
+static int
scdopen(dev_t dev, int flags, int fmt, struct proc *p)
{
int unit,part,phys;
@@ -283,7 +328,7 @@ scdopen(dev_t dev, int flags, int fmt, struct proc *p)
return 0;
}
-int
+static int
scdclose(dev_t dev, int flags, int fmt, struct proc *p)
{
int unit,part,phys;
@@ -313,7 +358,7 @@ scdclose(dev_t dev, int flags, int fmt, struct proc *p)
return 0;
}
-void
+static void
scdstrategy(struct buf *bp)
{
struct scd_data *cd;
@@ -416,7 +461,7 @@ scd_start(int unit)
return;
}
-int
+static int
scdioctl(dev_t dev, int cmd, caddr_t addr, int flags, struct proc *p)
{
struct scd_data *cd;
@@ -492,7 +537,7 @@ scdioctl(dev_t dev, int cmd, caddr_t addr, int flags, struct proc *p)
}
}
-int
+static int
scdsize(dev_t dev)
{
return -1;
@@ -1529,46 +1574,22 @@ scd_toc_entrys (int unit, struct ioc_read_toc_entry *te)
}
-#ifdef JREMOD
-struct bdevsw scd_bdevsw =
- { scdopen, scdclose, scdstrategy, scdioctl, /*16*/
- nxdump, scdsize, 0 };
-
-struct cdevsw scd_cdevsw =
- { scdopen, scdclose, rawread, nowrite, /*45*/
- scdioctl, nostop, nullreset, nodevtotty,/* sony cd */
- seltrue, nommap, scdstrategy };
-
static scd_devsw_installed = 0;
static void scd_drvinit(void *unused)
{
dev_t dev;
- dev_t dev_chr;
if( ! scd_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&scd_cdevsw,NULL);
- dev_chr = dev;
- dev = makedev(BDEV_MAJOR,0);
- bdevsw_add(&dev,&scd_bdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&scd_cdevsw, NULL);
+ dev = makedev(BDEV_MAJOR, 0);
+ bdevsw_add(&dev,&scd_bdevsw, NULL);
scd_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "rscd", major(dev_chr), 0, DV_CHR, 0, 0, 0600);
- x=devfs_add_devsw(
- "/", "scd", major(dev), 0, DV_BLK, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(scddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,scd_drvinit,NULL)
-#endif /* JREMOD */
#endif /* NSCD > 0 */
diff --git a/sys/i386/isa/si.c b/sys/i386/isa/si.c
index 1b732d9..cc1d6a7 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.21 1995/12/06 23:50:27 bde Exp $
+ * $Id: si.c,v 1.22 1995/12/07 12:46:06 davidg Exp $
*/
#ifndef lint
@@ -53,6 +53,9 @@ static char si_copyright1[] = "@(#) (C) Specialix International, 1990,1992",
#include <sys/syslog.h>
#include <sys/malloc.h>
#include <sys/devconf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/clock.h>
@@ -84,12 +87,8 @@ static char si_copyright1[] = "@(#) (C) Specialix International, 1990,1992",
enum si_mctl { GET, SET, BIS, BIC };
-#ifdef JREMOD
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 68
-#endif /*JREMOD*/
+static const char devchar[] = "ABCDEFGHIJK";
+static const char portchar[] = "0123456789abcdefghijklmnopqrstuvwxyz";
static void si_command __P((struct si_port *, int, int));
@@ -110,6 +109,25 @@ extern int siprobe __P((struct isa_device *id));
extern int siattach __P((struct isa_device *id));
static void si_modem_state __P((struct si_port *pp, struct tty *tp, int hi_ip));
+struct isa_driver sidriver =
+ { siprobe, siattach, "si" };
+
+
+static d_open_t siopen;
+static d_close_t siclose;
+static d_read_t siread;
+static d_write_t siwrite;
+static d_ioctl_t siioctl;
+static d_stop_t sistop;
+static d_ttycv_t sidevtotty;
+
+#define CDEV_MAJOR 68
+struct cdevsw si_cdevsw =
+ { siopen, siclose, siread, siwrite, /*68*/
+ siioctl, sistop, nxreset, sidevtotty,/* si */
+ ttselect, nxmmap, NULL, "si", NULL, -1 };
+
+
#ifdef SI_DEBUG /* use: ``options "SI_DEBUG"'' in your config file */
/* XXX: should be varargs, I know.. but where's vprintf()? */
static void si_dprintf __P((/* struct si_port *pp, int flags, char *str, int a1, int a2, int a3, int a4, int a5, int a6 */));
@@ -142,6 +160,16 @@ struct si_softc {
int sc_eisa_iobase; /* EISA io port address */
int sc_eisa_irqbits;
struct kern_devconf sc_kdc;
+#ifdef DEVFS
+ struct {
+ void *ttyd;
+ void *ttyl;
+ void *ttyi;
+ void *cuaa;
+ void *cual;
+ void *cuai;
+ } devfs_token[32]; /* what is the max per card? */
+#endif
};
struct si_softc si_softc[NSI]; /* up to 4 elements */
@@ -460,6 +488,7 @@ siattach(id)
struct speedtab *spt;
int nmodule, nport, x, y;
int uart_type;
+ char name[32];
DPRINT((0, DBG_AUTOBOOT, "si%d: siattach\n", id->id_unit));
@@ -663,14 +692,39 @@ mem_fail:
done_chartimes = 1;
}
+#ifdef DEVFS
+/* path name devsw minor type uid gid perm*/
+ for ( x = 0; x < nport; x++ ) {
+ sprintf(name,"tty%c%c",devchar[unit],portchar[x + 1]);
+ sc->devfs_token[x].ttyd = devfs_add_devsw(
+ "/", name, &si_cdevsw, unit,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"ttyi%c%c",devchar[unit],portchar[x + 1]);
+ sc->devfs_token[x].ttyi = devfs_add_devsw(
+ "/", name, &si_cdevsw, unit + 32,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"ttyl%c%c",devchar[unit],portchar[x + 1]);
+ sc->devfs_token[x].ttyl = devfs_add_devsw(
+ "/", name, &si_cdevsw, unit + 64,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"cua%c%c",devchar[unit],portchar[x + 1]);
+ sc->devfs_token[x].cuaa = devfs_add_devsw(
+ "/", name, &si_cdevsw, unit + 128,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"cuai%c%c",devchar[unit],portchar[x + 1]);
+ sc->devfs_token[x].cuai = devfs_add_devsw(
+ "/", name, &si_cdevsw, unit + 160,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"cual%c%c",devchar[unit],portchar[x + 1]);
+ sc->devfs_token[x].cual = devfs_add_devsw(
+ "/", name, &si_cdevsw, unit + 192,
+ DV_CHR, 0, 0, 0600);
+ }
+#endif
return (1);
}
-struct isa_driver sidriver =
- { siprobe, siattach, "si" };
-
-
-int
+static int
siopen(dev, flag, mode, p)
dev_t dev;
int flag, mode;
@@ -841,7 +895,7 @@ out:
return(error);
}
-int
+static int
siclose(dev, flag, mode, p)
dev_t dev;
int flag, mode;
@@ -961,7 +1015,7 @@ sidtrwakeup(chan)
/*
* User level stuff - read and write
*/
-int
+static int
siread(dev, uio, flag)
register dev_t dev;
struct uio *uio;
@@ -981,7 +1035,7 @@ siread(dev, uio, flag)
}
-int
+static int
siwrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -1020,7 +1074,7 @@ out:
}
-struct tty *
+static struct tty *
sidevtotty(dev_t dev)
{
struct si_port *pp;
@@ -1035,7 +1089,7 @@ sidevtotty(dev_t dev)
return (pp->sp_tty);
}
-int
+static int
siioctl(dev, cmd, data, flag, p)
dev_t dev;
int cmd;
@@ -2305,40 +2359,19 @@ si_mctl2str(cmd)
#endif /* DEBUG */
-#ifdef JREMOD
-struct cdevsw si_cdevsw =
- { siopen, siclose, siread, siwrite, /*68*/
- siioctl, sistop, nxreset, sidevtotty,/* si */
- ttselect, nxmmap, NULL };
static si_devsw_installed = 0;
static void si_drvinit(void *unused)
{
dev_t dev;
- dev_t dev_chr;
if( ! si_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&si_cdevsw,NULL);
- dev_chr = dev;
-#if defined(BDEV_MAJOR)
- dev = makedev(BDEV_MAJOR,0);
- bdevsw_add(&dev,&si_bdevsw,NULL);
-#endif /*BDEV_MAJOR*/
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&si_cdevsw, NULL);
si_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "si", major(dev_chr), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(sidev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,si_drvinit,NULL)
-#endif /* JREMOD */
diff --git a/sys/i386/isa/sio.c b/sys/i386/isa/sio.c
index b6b090f..d44d7bc 100644
--- a/sys/i386/isa/sio.c
+++ b/sys/i386/isa/sio.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
- * $Id: sio.c,v 1.123 1995/11/29 15:00:07 bde Exp $
+ * $Id: sio.c,v 1.124 1995/12/06 23:43:07 bde Exp $
*/
#include "sio.h"
@@ -59,6 +59,9 @@
#include <sys/malloc.h>
#include <sys/syslog.h>
#include <sys/devconf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/clock.h>
@@ -95,12 +98,6 @@
#define com_scr 7 /* scratch register for 16450-16550 (R/W) */
-#ifdef JREMOD
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 28
-#endif /*JREMOD*/
#include "crd.h"
@@ -251,6 +248,14 @@ struct com_s {
*/
u_char obuf1[256];
u_char obuf2[256];
+#ifdef DEVFS
+ void *devfs_token_ttyd;
+ void *devfs_token_ttyl;
+ void *devfs_token_ttyi;
+ void *devfs_token_cuaa;
+ void *devfs_token_cual;
+ void *devfs_token_cuai;
+#endif
};
/*
@@ -285,6 +290,8 @@ static void disc_optim __P((struct tty *tp, struct termios *t,
static int LoadSoftModem __P((int unit,int base_io, u_long size, u_char *ptr));
#endif /* DSI_SOFT_MODEM */
+static char driver_name[] = "sio";
+
/* table and macro for fast conversion from a unit number to its com struct */
static struct com_s *p_com_addr[NSIO];
#define com_addr(unit) (p_com_addr[unit])
@@ -292,9 +299,24 @@ static struct com_s *p_com_addr[NSIO];
static struct timeval intr_timestamp;
struct isa_driver siodriver = {
- sioprobe, sioattach, "sio"
+ sioprobe, sioattach, driver_name
};
+static d_open_t sioopen;
+static d_close_t sioclose;
+static d_read_t sioread;
+static d_write_t siowrite;
+static d_ioctl_t sioioctl;
+static d_stop_t siostop;
+static d_ttycv_t siodevtotty;
+
+#define CDEV_MAJOR 28
+struct cdevsw sio_cdevsw =
+ { sioopen, sioclose, sioread, siowrite, /*28*/
+ sioioctl, siostop, nxreset, siodevtotty,/* sio */
+ ttselect, nommap, NULL, driver_name, NULL, -1 };
+
+
static int comconsole = -1;
static speed_t comdefaultrate = TTYDEF_SPEED;
static u_int com_events; /* input chars + weighted output completions */
@@ -338,9 +360,10 @@ static struct speedtab comspeedtab[] = {
{ -1, -1 }
};
+static char chardev[] = "0123456789abcdefghijklmnopqrstuvwxyz";
static struct kern_devconf kdc_sio[NSIO] = { {
0, 0, 0, /* filled in by dev_attach */
- "sio", 0, { MDDT_ISA, 0, "tty" },
+ driver_name, 0, { MDDT_ISA, 0, "tty" },
isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
&kdc_isa0, /* parent */
0, /* parentdata */
@@ -359,7 +382,7 @@ static int sioinit(struct pccard_dev *, int); /* init device */
static struct pccard_drv sio_info =
{
- "sio",
+ driver_name,
card_intr,
siounload,
siosuspend,
@@ -696,6 +719,7 @@ sioattach(isdp)
Port_t iobase;
int s;
int unit;
+ char name[32];
isdp->id_ri_flags |= RI_FAST;
iobase = isdp->id_iobase;
@@ -880,10 +904,37 @@ determined_type: ;
com_addr(unit) = com;
splx(s);
+#ifdef DEVFS
+/* path name devsw minor type uid gid perm*/
+ sprintf(name,"ttyd%c",chardev[unit]);
+ com->devfs_token_ttyd = devfs_add_devsw(
+ "/", name, &sio_cdevsw, unit,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"ttyid%c",chardev[unit]);
+ com->devfs_token_ttyi = devfs_add_devsw(
+ "/", name, &sio_cdevsw, unit+32,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"ttyld%c",chardev[unit]);
+ com->devfs_token_ttyl = devfs_add_devsw(
+ "/", name, &sio_cdevsw, unit+64,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"cuaa%c",chardev[unit]);
+ com->devfs_token_cuaa = devfs_add_devsw(
+ "/", name, &sio_cdevsw, unit+128,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"cuaia%c",chardev[unit]);
+ com->devfs_token_cuai = devfs_add_devsw(
+ "/", name, &sio_cdevsw, unit+160,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"cuala%c",chardev[unit]);
+ com->devfs_token_cual = devfs_add_devsw(
+ "/", name, &sio_cdevsw, unit+192,
+ DV_CHR, 0, 0, 0600);
+#endif
return (1);
}
-int
+static int
sioopen(dev, flag, mode, p)
dev_t dev;
int flag;
@@ -1055,7 +1106,7 @@ out:
return (error);
}
-int
+static int
sioclose(dev, flag, mode, p)
dev_t dev;
int flag;
@@ -1150,7 +1201,7 @@ comhardclose(com)
splx(s);
}
-int
+static int
sioread(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -1170,7 +1221,7 @@ sioread(dev, uio, flag)
return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
}
-int
+static int
siowrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -1429,7 +1480,7 @@ cont:
}
}
-int
+static int
sioioctl(dev, cmd, data, flag, p)
dev_t dev;
int cmd;
@@ -2012,7 +2063,7 @@ comstart(tp)
splx(s);
}
-void
+static void
siostop(tp, rw)
struct tty *tp;
int rw;
@@ -2041,7 +2092,7 @@ siostop(tp, rw)
/* XXX should clear h/w fifos too. */
}
-struct tty *
+static struct tty *
siodevtotty(dev)
dev_t dev;
{
@@ -2559,12 +2610,6 @@ error:
}
#endif /* DSI_SOFT_MODEM */
-#ifdef JREMOD
-struct cdevsw sio_cdevsw =
- { sioopen, sioclose, sioread, siowrite, /*28*/
- sioioctl, siostop, nxreset, siodevtotty,/* sio */
- ttselect, nommap, NULL };
-
static sio_devsw_installed = 0;
static void sio_drvinit(void *unused)
@@ -2572,23 +2617,12 @@ static void sio_drvinit(void *unused)
dev_t dev;
if( ! sio_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&sio_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&sio_cdevsw, NULL);
sio_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "sio", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(siodev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,sio_drvinit,NULL)
-#endif /* JREMOD */
-
#endif /* NSIO > 0 */
diff --git a/sys/i386/isa/sound/soundcard.c b/sys/i386/isa/sound/soundcard.c
index 1b4ee3b..ad4888f 100644
--- a/sys/i386/isa/sound/soundcard.c
+++ b/sys/i386/isa/sound/soundcard.c
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: soundcard.c,v 1.35 1995/12/01 01:38:49 julian Exp $
+ * $Id: soundcard.c,v 1.36 1995/12/06 23:51:21 bde Exp $
*/
#include "sound_config.h"
@@ -36,15 +36,11 @@
#include "dev_table.h"
#include <i386/isa/isa_device.h>
-
-#ifdef JREMOD
#include <sys/conf.h>
#include <sys/kernel.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
-#define CDEV_MAJOR 30
-#endif /*JREMOD*/
u_int snd1_imask;
@@ -69,12 +65,27 @@ static int soundcards_installed = 0; /* Number of installed
static int soundcard_configured = 0;
static struct fileinfo files[SND_NDEVS];
+static void * snd_devfs_token[SND_NDEVS];
+static void * sndstat_devfs_token;
struct selinfo selinfo[SND_NDEVS >> 4];
int sndprobe (struct isa_device *dev);
int sndattach (struct isa_device *dev);
static void sound_mem_init(void);
+static d_open_t sndopen;
+static d_close_t sndclose;
+static d_read_t sndread;
+static d_write_t sndwrite;
+static d_ioctl_t sndioctl;
+static d_select_t sndselect;
+
+#define CDEV_MAJOR 30
+struct cdevsw snd_cdevsw =
+ { sndopen, sndclose, sndread, sndwrite, /*30*/
+ sndioctl, nostop, nullreset, nodevtotty,/* sound */
+ sndselect, nommap, NULL, "snd", NULL, -1 };
+
struct isa_driver opldriver = {sndprobe, sndattach, "opl"};
struct isa_driver sbdriver = {sndprobe, sndattach, "sb"};
struct isa_driver sbxvidriver = {sndprobe, sndattach, "sbxvi"};
@@ -126,7 +137,7 @@ int x;
}
-int
+static int
sndread (dev_t dev, struct uio *buf, int ioflag)
{
int count = buf->uio_resid;
@@ -136,7 +147,7 @@ sndread (dev_t dev, struct uio *buf, int ioflag)
FIX_RETURN (sound_read_sw (dev, &files[dev], buf, count));
}
-int
+static int
sndwrite (dev_t dev, struct uio *buf, int ioflag)
{
int count = buf->uio_resid;
@@ -146,7 +157,7 @@ sndwrite (dev_t dev, struct uio *buf, int ioflag)
FIX_RETURN (sound_write_sw (dev, &files[dev], buf, count));
}
-int
+static int
sndopen (dev_t dev, int flags, int fmt, struct proc *p)
{
int retval;
@@ -174,7 +185,7 @@ sndopen (dev_t dev, int flags, int fmt, struct proc *p)
FIX_RETURN(sound_open_sw (dev, &files[dev]));
}
-int
+static int
sndclose (dev_t dev, int flags, int fmt, struct proc *p)
{
@@ -184,7 +195,7 @@ sndclose (dev_t dev, int flags, int fmt, struct proc *p)
FIX_RETURN (0);
}
-int
+static int
sndioctl (dev_t dev, int cmd, caddr_t arg, int flags, struct proc *p)
{
dev = minor (dev);
@@ -192,7 +203,7 @@ sndioctl (dev_t dev, int cmd, caddr_t arg, int flags, struct proc *p)
FIX_RETURN (sound_ioctl_sw (dev, &files[dev], cmd, (unsigned int) arg));
}
-int
+static int
sndselect (dev_t dev, int rw, struct proc *p)
{
dev = minor (dev);
@@ -302,6 +313,7 @@ sndattach (struct isa_device *dev)
static int generic_midi_initialized = 0;
unsigned long mem_start = 0xefffffffUL;
struct address_info hw_config;
+ char name[32];
unit = driver_to_voxunit(dev->id_driver);
hw_config.io_base = dev->id_iobase;
@@ -356,6 +368,62 @@ sndattach (struct isa_device *dev)
}
#endif
+#ifdef DEVFS
+/* XXX */ /* find out where to store the tokens.. */
+/* XXX */ /* should only create devices if that card has them */
+#define SND_UID 0
+#define SND_GID 13
+
+
+ sprintf(name,"mixer%d",unit);
+ snd_devfs_token[unit]=devfs_add_devsw(
+ "/", name, &snd_cdevsw, (unit << 4)+SND_DEV_CTL,
+ DV_CHR, SND_UID, SND_GID, 0660);
+
+#ifndef EXCLUDE_SEQUENCER
+ sprintf(name,"sequencer%d",unit);
+ snd_devfs_token[unit]=devfs_add_devsw(
+ "/", name, &snd_cdevsw, (unit << 4)+SND_DEV_SEQ,
+ DV_CHR, SND_UID, SND_GID, 0660);
+ sprintf(name,"music%d",unit);
+ snd_devfs_token[unit]=devfs_add_devsw(
+ "/", name, &snd_cdevsw, (unit << 4)+SND_DEV_SEQ2,
+ DV_CHR, SND_UID, SND_GID, 0660);
+#endif
+
+#ifndef EXCLUDE_MIDI
+ sprintf(name,"midi%d",unit);
+ snd_devfs_token[unit]=devfs_add_devsw(
+ "/", name, &snd_cdevsw, (unit << 4)+SND_DEV_MIDIN,
+ DV_CHR, SND_UID, SND_GID, 0660);
+#endif
+
+#ifndef EXCLUDE_AUDIO
+ sprintf(name,"dsp%d",unit);
+ snd_devfs_token[unit]=devfs_add_devsw(
+ "/", name, &snd_cdevsw, (unit << 4)+SND_DEV_DSP,
+ DV_CHR, SND_UID, SND_GID, 0660);
+ sprintf(name,"audio%d",unit);
+ snd_devfs_token[unit]=devfs_add_devsw(
+ "/", name, &snd_cdevsw, (unit << 4)+SND_DEV_AUDIO,
+ DV_CHR, SND_UID, SND_GID, 0660);
+ sprintf(name,"dspW%d",unit);
+ snd_devfs_token[unit]=devfs_add_devsw(
+ "/", name, &snd_cdevsw, (unit << 4)+SND_DEV_DSP16,
+ DV_CHR, SND_UID, SND_GID, 0660);
+#endif
+
+ sprintf(name,"pss%d",unit);
+ snd_devfs_token[unit]=devfs_add_devsw(
+ "/", name, &snd_cdevsw, (unit << 4)+SND_DEV_SNDPROC,
+ DV_CHR, SND_UID, SND_GID, 0660);
+
+ if ( ! sndstat_devfs_token) {
+ sndstat_devfs_token = devfs_add_devsw(
+ "/", "sndstat", &snd_cdevsw, 6,
+ DV_CHR, SND_UID, SND_GID, 0660);
+ }
+#endif /* DEVFS */
return TRUE;
}
@@ -484,36 +552,21 @@ snd_release_irq(int vect)
{
}
-#endif
-#ifdef JREMOD
-struct cdevsw snd_cdevsw =
- { sndopen, sndclose, sndread, sndwrite, /*30*/
- sndioctl, nostop, nullreset, nodevtotty,/* sound */
- sndselect, nommap, NULL };
-
static snd_devsw_installed = 0;
-static void snd_drvinit(void *unused)
+static void
+snd_drvinit(void *unused)
{
dev_t dev;
if( ! snd_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&snd_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&snd_cdevsw, NULL);
snd_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "snd", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(snddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,snd_drvinit,NULL)
-#endif /* JREMOD */
+#endif
diff --git a/sys/i386/isa/spigot.c b/sys/i386/isa/spigot.c
index ac74e31..e542887 100644
--- a/sys/i386/isa/spigot.c
+++ b/sys/i386/isa/spigot.c
@@ -64,6 +64,10 @@ error "Can only have 1 spigot configured."
#include <sys/devconf.h>
#include <sys/errno.h>
#include <sys/mman.h>
+#include <sys/conf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /* DEVFS */
#include <machine/frame.h>
#include <machine/spigot.h>
@@ -72,13 +76,6 @@ error "Can only have 1 spigot configured."
#include <i386/isa/isa.h>
#include <i386/isa/isa_device.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 11
-#endif /*JREMOD*/
struct spigot_softc {
u_long flags;
@@ -86,6 +83,9 @@ struct spigot_softc {
struct proc *p;
u_long signal_num;
u_short irq;
+#ifdef DEVFS
+ void *devfs_token;
+#endif
} spigot_softc[NSPIGOT];
/* flags in softc */
@@ -99,6 +99,21 @@ int spigot_attach(struct isa_device *id);
struct isa_driver spigotdriver = {spigot_probe, spigot_attach, "spigot"};
+static d_open_t spigot_open;
+static d_close_t spigot_close;
+static d_rdwr_t spigot_rw;
+static d_read_t spigot_read;
+static d_write_t spigot_write;
+static d_ioctl_t spigot_ioctl;
+static d_select_t spigot_select;
+static d_mmap_t spigot_mmap;
+
+#define CDEV_MAJOR 11
+struct cdevsw spigot_cdevsw =
+ { spigot_open, spigot_close, spigot_read, spigot_write, /*11*/
+ spigot_ioctl, nostop, nullreset, nodevtotty,/* Spigot */
+ spigot_select, spigot_mmap, NULL, "spigot", NULL, -1 };
+
static struct kern_devconf kdc_spigot[NSPIGOT] = { {
0, /* kdc_next -> filled in by dev_attach() */
0, /* kdc_rlink -> filled in by dev_attach() */
@@ -155,17 +170,26 @@ struct spigot_softc *ss=(struct spigot_softc *)&spigot_softc[devp->id_unit];
int
spigot_attach(struct isa_device *devp)
{
-struct spigot_softc *ss=(struct spigot_softc *)&spigot_softc[devp->id_unit];
+ char name[32];
+ int unit;
+ struct spigot_softc *ss= &spigot_softc[unit = devp->id_unit];
- kdc_spigot[devp->id_unit].kdc_state = DC_UNKNOWN;
+ kdc_spigot[unit].kdc_state = DC_UNKNOWN;
ss->maddr = kvtop(devp->id_maddr);
ss->irq = devp->id_irq;
+#ifdef DEVFS
+ sprintf(name,"spigot%d",unit);
+/* path name devsw minor type uid gid perm*/
+ ss->devfs_token = devfs_add_devsw( "/", name,
+ &spigot_cdevsw, unit,
+ DV_CHR, 0, 0, 0600);
+#endif
return 1;
}
-int
+static int
spigot_open(dev_t dev, int flags, int fmt, struct proc *p)
{
struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[UNIT(dev)];
@@ -183,7 +207,7 @@ struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[UNIT(dev)];
return 0;
}
-int
+static int
spigot_close(dev_t dev, int flags, int fmt, struct proc *p)
{
struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[UNIT(dev)];
@@ -197,20 +221,20 @@ struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[UNIT(dev)];
return 0;
}
-int
+static int
spigot_write(dev_t dev, struct uio *uio, int ioflag)
{
return ENXIO;
}
-int
+static int
spigot_read(dev_t dev, struct uio *uio, int ioflag)
{
return ENXIO;
}
-int
+static int
spigot_ioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
{
int error;
@@ -249,7 +273,7 @@ struct spigot_info *info;
return 0;
}
-int
+static int
spigot_select(dev_t dev, int rw, struct proc *p)
{
@@ -269,7 +293,7 @@ struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[unit];
psignal(ss->p, ss->signal_num);
}
-int
+static int
spigot_mmap(dev_t dev, int offset, int nprot)
{
struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[0];
@@ -286,12 +310,6 @@ struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[0];
}
-#ifdef JREMOD
-struct cdevsw spigot_cdevsw =
- { spigot_open, spigot_close, spigot_read, spigot_write, /*11*/
- spigot_ioctl, nostop, nullreset, nodevtotty,/* Spigot */
- spigot_select, spigot_mmap, NULL };
-
static spigot_devsw_installed = 0;
static void spigot_drvinit(void *unused)
@@ -299,23 +317,13 @@ static void spigot_drvinit(void *unused)
dev_t dev;
if( ! spigot_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&spigot_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&spigot_cdevsw, NULL);
spigot_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "spigot", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(spigotdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,spigot_drvinit,NULL)
-#endif /* JREMOD */
#endif /* NSPIGOT */
diff --git a/sys/i386/isa/spkr.c b/sys/i386/isa/spkr.c
index 9d45e33..160c18b 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.19 1995/11/29 10:47:57 julian Exp $
+ * $Id: spkr.c,v 1.20 1995/11/29 14:39:59 julian Exp $
*/
#include "speaker.h"
@@ -18,21 +18,29 @@
#include <sys/buf.h>
#include <sys/proc.h>
#include <sys/uio.h>
+#include <sys/conf.h>
#include <i386/isa/isa.h>
#include <i386/isa/timerreg.h>
#include <machine/clock.h>
#include <machine/speaker.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#define CDEV_MAJOR 26
-#endif /*JREMOD*/
#ifdef DEVFS
#include <sys/devfsext.h>
+void *devfs_token;
#endif
+static d_open_t spkropen;
+static d_close_t spkrclose;
+static d_write_t spkrwrite;
+static d_ioctl_t spkrioctl;
+
+#define CDEV_MAJOR 26
+struct cdevsw spkr_cdevsw =
+ { spkropen, spkrclose, noread, spkrwrite, /*26*/
+ spkrioctl, nostop, nullreset, nodevtotty,/* spkr */
+ seltrue, nommap, NULL, "spkr", NULL, -1 };
/**************** MACHINE DEPENDENT PART STARTS HERE *************************
*
@@ -569,11 +577,6 @@ struct proc *p;
return(EINVAL);
}
-#ifdef JREMOD
-struct cdevsw spkr_cdevsw =
- { spkropen, spkrclose, noread, spkrwrite, /*26*/
- spkrioctl, nostop, nullreset, nodevtotty,/* spkr */
- seltrue, nommap, NULL };
static spkr_devsw_installed = 0;
@@ -582,24 +585,19 @@ static void spkr_drvinit(void *unused)
dev_t dev;
if( ! spkr_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&spkr_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&spkr_cdevsw, NULL);
spkr_devsw_installed = 1;
#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "spkr", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
+ devfs_token = devfs_add_devsw("/", "spkr",
+ &spkr_cdevsw, 0,
+ DV_CHR, 0, 0, 0600);
#endif
}
}
SYSINIT(spkrdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,spkr_drvinit,NULL)
-#endif /* JREMOD */
#endif /* NSPEAKER > 0 */
/* spkr.c ends here */
diff --git a/sys/i386/isa/syscons.c b/sys/i386/isa/syscons.c
index 6c736ca..db7c92d 100644
--- a/sys/i386/isa/syscons.c
+++ b/sys/i386/isa/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.133 1995/12/06 23:50:36 bde Exp $
+ * $Id: syscons.c,v 1.134 1995/12/07 12:46:08 davidg Exp $
*/
#include "sc.h"
@@ -45,6 +45,9 @@
#include <sys/errno.h>
#include <sys/malloc.h>
#include <sys/devconf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif
#include <machine/clock.h>
#include <machine/cons.h>
@@ -69,6 +72,7 @@
#define MAXCONS 16
#endif
+
/* this may break on older VGA's but is usefull on real 32 bit systems */
#define bcopyw bcopy
@@ -84,6 +88,7 @@ static default_attr kernel_default = {
static scr_stat main_console;
static scr_stat *console[MAXCONS];
+static void *sc_devfs_token[MAXCONS];
scr_stat *cur_console;
static scr_stat *new_scp, *old_scp;
static term_stat kernel_console;
@@ -159,8 +164,7 @@ static d_mmap_t scmmap;
static struct cdevsw scdevsw = {
scopen, scclose, scread, scwrite,
scioctl, nullstop, noreset, scdevtotty,
- ttselect, scmmap, nostrategy,
-};
+ ttselect, scmmap, nostrategy, "sc", NULL, -1 };
/*
* Calculate hardware attributes word using logical attributes mask and
@@ -283,7 +287,9 @@ scresume(void *dummy)
int
scattach(struct isa_device *dev)
{
- scr_stat *scp;
+ scr_stat *scp;
+ int vc;
+ char name[32];
scinit();
configuration = dev->id_flags;
@@ -345,6 +351,13 @@ scattach(struct isa_device *dev)
apm_hook_establish(APM_HOOK_RESUME , &scp->r_hook);
#endif
+#ifdef DEVFS
+ for ( vc = 0 ; vc < MAXCONS; vc++) {
+ sprintf(name,"ttyv%x", vc);
+ sc_devfs_token[vc] = devfs_add_devsw("/" ,name, &scdevsw, vc,
+ DV_CHR, 0, 0, 0600 );
+ }
+#endif
register_cdev("sc", &scdevsw);
return 0;
diff --git a/sys/i386/isa/tw.c b/sys/i386/isa/tw.c
index 7eb75e0..f8406f0 100644
--- a/sys/i386/isa/tw.c
+++ b/sys/i386/isa/tw.c
@@ -138,23 +138,18 @@
#include "uio.h"
#include "syslog.h"
#include "select.h"
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#define MIN(a,b) ((a)<(b)?(a):(b))
#ifdef HIRESTIME
-#include "time.h"
+#include <sys/time.h>
#endif /* HIRESTIME */
#include "i386/isa/isa_device.h"
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 19
-#endif /*JREMOD*/
/*
@@ -211,6 +206,17 @@ struct isa_driver twdriver = {
twprobe, twattach, "tw"
};
+static d_open_t twopen;
+static d_close_t twclose;
+static d_read_t twread;
+static d_write_t twwrite;
+static d_select_t twselect;
+
+#define CDEV_MAJOR 19
+struct cdevsw tw_cdevsw =
+ { twopen, twclose, twread, twwrite, /*19*/
+ noioc, nullstop, nullreset, nodevtotty, /* tw */
+ twselect, nommap, nostrat, "tw", NULL, -1 };
/*
* Software control structure for TW523
*/
@@ -240,6 +246,9 @@ struct tw_sc {
int sc_xtimes[22]; /* Times for bits in current xmit packet */
int sc_rtimes[22]; /* Times for bits in current rcv packet */
#endif /* HIRESTIME */
+#ifdef DEVFS
+ void *devfs_token; /* store the devfs handle */
+#endif
} tw_sc[NTW];
static void twdelay25();
@@ -348,11 +357,20 @@ int twattach(idp)
struct isa_device *idp;
{
struct tw_sc *sc;
+ char name[32];
+ int unit;
- sc = &tw_sc[idp->id_unit];
+ sc = &tw_sc[unit = idp->id_unit];
sc->sc_port = idp->id_iobase;
sc->sc_state = 0;
+#ifdef DEVFS
+/* path name devsw minor type uid gid perm*/
+ sprintf(name,"tw%d", unit);
+ sc->devfs_token = devfs_add_devsw( "/", name, &tw_cdevsw, unit,
+ DV_CHR, 0, 0, 0600);
+#endif
+
return (1);
}
@@ -992,11 +1010,6 @@ static int twchecktime(int target, int tol)
}
#endif /* HIRESTIME */
-#ifdef JREMOD
-struct cdevsw tw_cdevsw =
- { twopen, twclose, twread, twwrite, /*19*/
- noioc, nullstop, nullreset, nodevtotty,/* tw */
- twselect, nommap, nostrat };
static tw_devsw_installed = 0;
@@ -1005,23 +1018,13 @@ static void tw_drvinit(void *unused)
dev_t dev;
if( ! tw_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&tw_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&tw_cdevsw, NULL);
tw_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "tw", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(twdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,tw_drvinit,NULL)
-#endif /* JREMOD */
#endif NTW
diff --git a/sys/i386/isa/wcd.c b/sys/i386/isa/wcd.c
index f56dc46..2b57f3a 100644
--- a/sys/i386/isa/wcd.c
+++ b/sys/i386/isa/wcd.c
@@ -29,17 +29,33 @@
#include <sys/devconf.h>
#include <sys/disklabel.h>
#include <sys/cdio.h>
-#include <i386/include/cpufunc.h>
-#include <i386/isa/atapi.h>
-
-#ifdef JREMOD
#include <sys/conf.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
+#include <i386/include/cpufunc.h>
+#include <i386/isa/atapi.h>
+
+static d_open_t wcdropen;
+static d_open_t wcdbopen;
+static d_close_t wcdrclose;
+static d_close_t wcdbclose;
+static d_ioctl_t wcdioctl;
+static d_strategy_t wcdstrategy;
+
#define CDEV_MAJOR 69
#define BDEV_MAJOR 19
-#endif /*JREMOD */
+extern struct cdevsw wcd_cdevsw;
+struct bdevsw wcd_bdevsw =
+ { wcdbopen, wcdbclose, wcdstrategy, wcdioctl, /*19*/
+ nxdump, zerosize, 0, "wcd", &wcd_cdevsw, -1 };
+
+struct cdevsw wcd_cdevsw =
+ { wcdropen, wcdrclose, rawread, nowrite, /*69*/
+ wcdioctl, nostop, nullreset, nodevtotty,/* atapi */
+ seltrue, nommap, wcdstrategy, "wcd",
+ &wcd_bdevsw, -1 };
+
extern int wcdattach(struct atapi*, int, struct atapi_params*, int, struct kern_devconf*);
@@ -205,6 +221,12 @@ struct wcd {
struct subchan subchan; /* Subchannel info */
struct kern_devconf cf; /* Driver configuration info */
char description[80]; /* Device description */
+#ifdef DEVFS
+ void *ra_devfs_token;
+ void *rc_devfs_token;
+ void *a_devfs_token;
+ void *c_devfs_token;
+#endif
};
struct wcd *wcdtab[NUNIT]; /* Drive info by unit number */
@@ -262,6 +284,8 @@ wcdattach (struct atapi *ata, int unit, struct atapi_params *ap, int debug,
{
struct wcd *t;
struct atapires result;
+ int lun;
+ char name[32];
if (wcdnlun >= NUNIT) {
printf ("wcd: too many units\n");
@@ -281,7 +305,7 @@ wcdattach (struct atapi *ata, int unit, struct atapi_params *ap, int debug,
bzero (t, sizeof (struct wcd));
t->ata = ata;
t->unit = unit;
- t->lun = wcdnlun++;
+ lun = t->lun = wcdnlun++;
t->param = ap;
t->flags = F_MEDIA_CHANGED;
t->refcnt = 0;
@@ -325,6 +349,29 @@ wcdattach (struct atapi *ata, int unit, struct atapi_params *ap, int debug,
ap->model, sizeof(ap->model));
dev_attach (&t->cf);
+#ifdef DEVFS
+#define WDC_UID 0
+#define WDC_GID 13
+ sprintf(name, "rwcd%da",lun);
+ t->ra_devfs_token = devfs_add_devsw(
+ "/", name, &wcd_cdevsw, (lun * 8),
+ DV_CHR, WDC_UID, WDC_GID, 0600);
+
+ sprintf(name, "rwcd%dc",lun);
+ t->rc_devfs_token = devfs_add_devsw(
+ "/", name, &wcd_cdevsw, (lun * 8) + RAW_PART,
+ DV_CHR, WDC_UID, WDC_GID, 0600);
+
+ sprintf(name, "wcd%da",lun);
+ t->a_devfs_token = devfs_add_devsw(
+ "/", name, &wcd_bdevsw, (lun * 8),
+ DV_BLK, WDC_UID, WDC_GID, 0600);
+
+ sprintf(name, "wcd%dc",lun);
+ t->c_devfs_token = devfs_add_devsw(
+ "/", name, &wcd_bdevsw, (lun * 8) + RAW_PART,
+ DV_BLK, WDC_UID, WDC_GID, 0600);
+#endif
return (1);
}
@@ -1074,21 +1121,13 @@ static int wcd_eject (struct wcd *t)
#include <sys/lkm.h>
/*
- * Device table entries.
- * These get copied at modload time into the kernels
- * lkm dummy device driver entries (see sys/i386/i386/conf.c).
- */
-struct bdevsw dev_wcd = { wcdbopen, wcdbclose, wcdstrategy, wcdioctl,
- nodump, nopsize, 0 };
-struct cdevsw dev_rwcd = { wcdropen, wcdrclose, rawread, nowrite, wcdioctl,
- nostop, nullreset, nodevtotty, seltrue, nommap,
- wcdstrategy };
-/*
* Construct lkm_dev structures (see lkm.h).
* Our bdevsw/cdevsw slot numbers are 19/69.
*/
-MOD_DEV(wcd, LM_DT_BLOCK, 19, &dev_wcd);
-MOD_DEV(rwcd, LM_DT_CHAR, 69, &dev_rwcd);
+
+
+MOD_DEV(wcd, LM_DT_BLOCK, BDEV_MAJOR, &wcd_bdevsw);
+MOD_DEV(rwcd, LM_DT_CHAR, CDEV_MAJOR, &wcd_cdevsw);
/*
* Function called when loading the driver.
@@ -1169,47 +1208,22 @@ int wcd_mod (struct lkm_table *lkmtp, int cmd, int ver)
}
#endif /* WCD_MODULE */
-#ifdef JREMOD
-struct bdevsw wcd_bdevsw =
- { wcdbopen, wcdbclose, wcdstrategy, wcdioctl, /*19*/
- nxdump, zerosize, 0 };
-
-struct cdevsw wcd_cdevsw =
- { wcdropen, wcdrclose, rawread, nowrite, /*69*/
- wcdioctl, nostop, nullreset, nodevtotty,/* atapi */
- seltrue, nommap, wcdstrategy };
-
static wcd_devsw_installed = 0;
static void wcd_drvinit(void *unused)
{
dev_t dev;
- dev_t dev_chr;
if( ! wcd_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&wcd_cdevsw,NULL);
- dev_chr = dev;
- dev = makedev(BDEV_MAJOR,0);
- bdevsw_add(&dev,&wcd_bdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&wcd_cdevsw, NULL);
+ dev = makedev(BDEV_MAJOR, 0);
+ bdevsw_add(&dev,&wcd_bdevsw, NULL);
wcd_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "rwcd", major(dev_chr), 0, DV_CHR, 0, 0, 0600);
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "wcd", major(dev), 0, DV_BLK, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(wcddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,wcd_drvinit,NULL)
-#endif /* JREMOD */
#endif /* NWCD && NWDC && ATAPI */
diff --git a/sys/i386/isa/wd.c b/sys/i386/isa/wd.c
index 354b0bb..1822a8b 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.95 1995/11/29 14:40:08 julian Exp $
+ * $Id: wd.c,v 1.96 1995/12/07 12:46:12 davidg Exp $
*/
/* TODO:
@@ -78,6 +78,9 @@
#include <sys/uio.h>
#include <sys/malloc.h>
#include <sys/devconf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/bootinfo.h>
#include <machine/clock.h>
#include <machine/cons.h>
@@ -108,13 +111,6 @@ extern void wdstart(int ctrlr);
#define WDOPT_SLEEPHACK 0x4000
#define WDOPT_MULTIMASK 0x00ff
-#ifdef JREMOD
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 3
-#define BDEV_MAJOR 0
-#endif /*JREMOD */
static int wd_goaway(struct kern_devconf *, int);
static int wdc_goaway(struct kern_devconf *, int);
@@ -305,6 +301,27 @@ struct isa_driver wdcdriver = {
wdprobe, wdattach, "wdc",
};
+static d_open_t wdopen;
+static d_close_t wdclose;
+static d_ioctl_t wdioctl;
+static d_dump_t wddump;
+static d_size_t wdsize;
+static d_strategy_t wdstrategy;
+
+#define CDEV_MAJOR 3
+#define BDEV_MAJOR 0
+extern struct cdevsw wd_cdevsw;
+struct bdevsw wd_bdevsw =
+ { wdopen, wdclose, wdstrategy, wdioctl, /*0*/
+ wddump, wdsize, 0, "wd", &wd_cdevsw, -1 };
+
+struct cdevsw wd_cdevsw =
+ { wdopen, wdclose, rawread, rawwrite, /*3*/
+ wdioctl, nostop, nullreset, nodevtotty,/* wd */
+ seltrue, nommap, wdstrategy, "wd",
+ &wd_bdevsw, -1 };
+
+
/*
* Probe for controller.
*/
@@ -2127,46 +2144,22 @@ wdwait(struct disk *du, u_char bits_wanted, int timeout)
return (-1);
}
-#ifdef JREMOD
-struct bdevsw wd_bdevsw =
- { wdopen, wdclose, wdstrategy, wdioctl, /*0*/
- wddump, wdsize, 0 };
-
-struct cdevsw wd_cdevsw =
- { wdopen, wdclose, rawread, rawwrite, /*3*/
- wdioctl, nostop, nullreset, nodevtotty,/* wd */
- seltrue, nommap, wdstrategy };
-
static wd_devsw_installed = 0;
static void wd_drvinit(void *unused)
{
dev_t dev;
- dev_t dev_chr;
if( ! wd_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&wd_cdevsw,NULL);
- dev_chr = dev;
dev = makedev(BDEV_MAJOR,0);
bdevsw_add(&dev,&wd_bdevsw,NULL);
wd_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "rwd", major(dev_chr), 0, DV_CHR, 0, 0, 0600);
- x=devfs_add_devsw(
- "/", "wd", major(dev), 0, DV_BLK, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(wddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,wd_drvinit,NULL)
-#endif /* JREMOD */
#endif /* NWDC > 0 */
diff --git a/sys/i386/isa/wt.c b/sys/i386/isa/wt.c
index 7e4a062..6fc75d8 100644
--- a/sys/i386/isa/wt.c
+++ b/sys/i386/isa/wt.c
@@ -19,7 +19,7 @@
* the original CMU copyright notice.
*
* Version 1.3, Thu Nov 11 12:09:13 MSK 1993
- * $Id: wt.c,v 1.22 1995/11/29 10:48:03 julian Exp $
+ * $Id: wt.c,v 1.23 1995/11/29 14:40:11 julian Exp $
*
*/
@@ -69,6 +69,10 @@
#include <sys/mtio.h>
#include <sys/proc.h>
#include <sys/devconf.h>
+#include <sys/conf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <vm/vm_param.h>
#include <machine/clock.h>
@@ -76,14 +80,6 @@
#include <i386/isa/isa_device.h>
#include <i386/isa/wtreg.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 10
-#define BDEV_MAJOR 3
-#endif /*JREMOD */
/*
* Uncomment this to enable internal device tracing.
@@ -167,6 +163,10 @@ typedef struct {
unsigned short DATAPORT, CMDPORT, STATPORT, CTLPORT, SDMAPORT, RDMAPORT;
unsigned char BUSY, NOEXCEP, RESETMASK, RESETVAL;
unsigned char ONLINE, RESET, REQUEST, IEN;
+#ifdef DEVFS
+ void *devfs_token;
+ void *devfs_token_r;
+#endif
} wtinfo_t;
wtinfo_t wttab[NWT]; /* tape info by unit number */
@@ -196,6 +196,28 @@ static struct kern_devconf kdc_wt[NWT] = { {
DC_CLS_TAPE /* class */
} };
+static d_open_t wtopen;
+static d_close_t wtclose;
+static d_ioctl_t wtioctl;
+static d_dump_t wtdump;
+static d_psize_t wtsize;
+static d_strategy_t wtstrategy;
+
+#define CDEV_MAJOR 10
+#define BDEV_MAJOR 3
+
+extern struct cdevsw wt_cdevsw;
+struct bdevsw wt_bdevsw =
+ { wtopen, wtclose, wtstrategy, wtioctl, /*3*/
+ wtdump, wtsize, B_TAPE, "wt", &wt_cdevsw, -1 };
+
+struct cdevsw wt_cdevsw =
+ { wtopen, wtclose, rawread, rawwrite, /*10*/
+ wtioctl, nostop, nullreset, nodevtotty,/* wt */
+ seltrue, nommap, wtstrategy, "wt",
+ &wt_bdevsw, -1 };
+
+
static inline void
wt_registerdev(struct isa_device *id)
{
@@ -261,6 +283,7 @@ static int
wtattach (struct isa_device *id)
{
wtinfo_t *t = wttab + id->id_unit;
+ char name[32];
if (t->type == ARCHIVE) {
printf ("wt%d: type <Archive>\n", t->unit);
@@ -271,6 +294,16 @@ wtattach (struct isa_device *id)
t->dens = -1; /* unknown density */
kdc_wt[id->id_unit].kdc_state = DC_IDLE;
+#ifdef DEVFS
+ sprintf(name,"rwt%d",id->id_unit);
+ t->devfs_token_r = devfs_add_devsw(
+ "/", name, &wt_cdevsw, id->id_unit,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"wt%d",id->id_unit);
+ t->devfs_token = devfs_add_devsw(
+ "/", name, &wt_bdevsw, id->id_unit,
+ DV_BLK, 0, 0, 0600);
+#endif
return (1);
}
@@ -975,46 +1008,22 @@ static int wtstatus (wtinfo_t *t)
}
-#ifdef JREMOD
-struct bdevsw wt_bdevsw =
- { wtopen, wtclose, wtstrategy, wtioctl, /*3*/
- wtdump, wtsize, B_TAPE };
-
-struct cdevsw wt_cdevsw =
- { wtopen, wtclose, rawread, rawwrite, /*10*/
- wtioctl, nostop, nullreset, nodevtotty,/* wt */
- seltrue, nommap, wtstrategy };
-
static wt_devsw_installed = 0;
static void wt_drvinit(void *unused)
{
dev_t dev;
- dev_t dev_chr;
if( ! wt_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&wt_cdevsw,NULL);
- dev_chr = dev;
- dev = makedev(BDEV_MAJOR,0);
- bdevsw_add(&dev,&wt_bdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&wt_cdevsw, NULL);
+ dev = makedev(BDEV_MAJOR, 0);
+ bdevsw_add(&dev,&wt_bdevsw, NULL);
wt_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "rwt", major(dev_chr), 0, DV_CHR, 0, 0, 0600);
- x=devfs_add_devsw(
- "/", "wt", major(dev), 0, DV_BLK, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(wtdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,wt_drvinit,NULL)
-#endif /* JREMOD */
#endif /* NWT */
diff --git a/sys/isa/fd.c b/sys/isa/fd.c
index 1af2cbf..e1b3436 100644
--- a/sys/isa/fd.c
+++ b/sys/isa/fd.c
@@ -1,4 +1,4 @@
-/*-
+/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
@@ -43,7 +43,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
- * $Id: fd.c,v 1.71 1995/11/20 12:41:38 phk Exp $
+ * $Id: fd.c,v 1.72 1995/11/28 09:41:00 julian Exp $
*
*/
@@ -87,11 +87,7 @@
#include <sys/devfsext.h>
#endif
-#ifdef JREMOD
-#define CDEV_MAJOR 9
-#define BDEV_MAJOR 2
-static void fd_devsw_install();
-#endif /*JREMOD */
+
static int fd_goaway(struct kern_devconf *, int);
static int fdc_goaway(struct kern_devconf *, int);
static int fd_externalize(struct kern_devconf *, struct sysctl_req *);
@@ -250,6 +246,10 @@ struct fd_data {
int track; /* where we think the head is */
int options; /* user configurable options, see ioctl_fd.h */
int dkunit; /* disk stats unit number */
+#ifdef DEVFS
+ void *rfd_devfs_token;
+ void *fd_devfs_token;
+#endif
} fd_data[NFD];
/***********************************************************************\
@@ -342,6 +342,24 @@ struct isa_driver fdcdriver = {
fdprobe, fdattach, "fdc",
};
+static d_open_t Fdopen; /* NOTE, not fdopen */
+static d_close_t fdclose;
+static d_ioctl_t fdioctl;
+static d_strategy_t fdstrategy;
+
+#define CDEV_MAJOR 9
+#define BDEV_MAJOR 2
+extern struct cdevsw fd_cdevsw;
+struct bdevsw fd_bdevsw =
+ { Fdopen, fdclose, fdstrategy, fdioctl, /*2*/
+ nxdump, zerosize, 0, "fd", &fd_cdevsw, -1 };
+
+struct cdevsw fd_cdevsw =
+ { Fdopen, fdclose, rawread, rawwrite, /*9*/
+ fdioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, fdstrategy, "fd",
+ &fd_bdevsw, -1 };
+
struct isa_device *fdcdevs[NFDC];
/*
@@ -518,9 +536,6 @@ fdprobe(struct isa_device *dev)
#ifndef DEV_LKM
fdc_registerdev(dev);
#endif
-#ifdef JREMOD
- fd_devsw_install();
-#endif /*JREMOD*/
/* First - lets reset the floppy controller */
outb(dev->id_iobase+FDOUT, 0);
@@ -554,7 +569,6 @@ fdattach(struct isa_device *dev)
int ic_type = 0;
#ifdef DEVFS
char name[64];
- void *key;
#endif /* DEVFS */
fdc->fdcu = fdcu;
@@ -750,10 +764,12 @@ fdattach(struct isa_device *dev)
}
kdc_fd[fdu].kdc_state = DC_IDLE;
#ifdef DEVFS
- key = dev_add("/disks/rfloppy",name,(caddr_t)Fdopen,fdu * 8,
- DV_CHR,0,0,0644);
- key = dev_add("/disks/floppy",name,(caddr_t)Fdopen,fdu * 8,
- DV_BLK,0,0,0644);
+ fd->rfd_devfs_token = devfs_add_devsw(
+ "/",name,&fd_cdevsw, fdu * 8,
+ DV_CHR,0,0,0644);
+ fd->fd_devfs_token = devfs_add_devsw(
+ "/",name, &fd_bdevsw, fdu * 8,
+ DV_BLK,0,0,0644);
#endif /* DEVFS */
if (dk_ndrive < DK_NDRIVE) {
sprintf(dk_names[dk_ndrive], "fd%d", fdu);
@@ -1893,32 +1909,23 @@ fdioctl(dev, cmd, addr, flag, p)
}
-#ifdef JREMOD
-struct bdevsw fd_bdevsw =
- { Fdopen, fdclose, fdstrategy, fdioctl, /*2*/
- nxdump, zerosize, 0 };
-
-struct cdevsw fd_cdevsw =
- { Fdopen, fdclose, rawread, rawwrite, /*9*/
- fdioctl, nostop, nullreset, nodevtotty,/* Fd (!=fd) */
- seltrue, nommap, fdstrategy };
-
static fd_devsw_installed = 0;
-static void fd_devsw_install()
+static void fd_drvinit(void *notused )
{
- dev_t descript;
+ dev_t dev;
+
if( ! fd_devsw_installed ) {
- descript = makedev(CDEV_MAJOR,0);
- cdevsw_add(&descript,&fd_cdevsw,NULL);
-#if defined(BDEV_MAJOR)
- descript = makedev(BDEV_MAJOR,0);
- bdevsw_add(&descript,&fd_bdevsw,NULL);
-#endif /*BDEV_MAJOR*/
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&fd_cdevsw, NULL);
+ dev = makedev(BDEV_MAJOR, 0);
+ bdevsw_add(&dev,&fd_bdevsw, NULL);
fd_devsw_installed = 1;
}
}
-#endif /* JREMOD */
+
+SYSINIT(fddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,fd_drvinit,NULL)
+
#endif
/*
* Hello emacs, these are the
diff --git a/sys/isa/joy.c b/sys/isa/joy.c
index 25d2311..2955d1c 100644
--- a/sys/isa/joy.c
+++ b/sys/isa/joy.c
@@ -34,6 +34,11 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/kernel.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/joystick.h>
@@ -41,15 +46,6 @@
#include <i386/isa/isa_device.h>
#include <i386/isa/timerreg.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 51
-#endif /*JREMOD*/
-
/* The game port can manage 4 buttons and 4 variable resistors (usually 2
* joysticks, each with 2 buttons and 2 pots.) via the port at address 0x201.
* Getting the state of the buttons is done by reading the game port:
@@ -77,6 +73,9 @@ static struct {
int port;
int x_off[2], y_off[2];
int timeout[2];
+#ifdef DEVFS
+ void *devfs_token;
+#endif
} joy[NJOY];
@@ -86,6 +85,17 @@ int joyprobe (struct isa_device *), joyattach (struct isa_device *);
struct isa_driver joydriver = {joyprobe, joyattach, "joy"};
+#define CDEV_MAJOR 51
+static d_open_t joyopen;
+static d_close_t joyclose;
+static d_read_t joyread;
+static d_ioctl_t joyioctl;
+
+struct cdevsw joy_cdevsw =
+ { joyopen, joyclose, joyread, nowrite, /*51*/
+ joyioctl, nostop, nullreset, nodevtotty,/*joystick */
+ seltrue, nommap, NULL, "joy", NULL, -1 };
+
static int get_tick ();
@@ -104,14 +114,22 @@ joyprobe (struct isa_device *dev)
int
joyattach (struct isa_device *dev)
{
- joy[dev->id_unit].port = dev->id_iobase;
- joy[dev->id_unit].timeout[0] = joy[dev->id_unit].timeout[1] = 0;
- printf("joy%d: joystick\n", dev->id_unit);
-
+ int unit = dev->id_unit;
+ char name[32];
+
+ joy[unit].port = dev->id_iobase;
+ joy[unit].timeout[0] = joy[unit].timeout[1] = 0;
+ printf("joy%d: joystick\n", unit);
+#ifdef DEVFS
+ sprintf(name, "joy%d", unit);
+ joy[dev->id_unit].devfs_token = devfs_add_devsw( "/", "joy",
+ &joy_cdevsw, 0,
+ DV_CHR, 0, 0, 0600);
+#endif
return 1;
}
-int
+static int
joyopen (dev_t dev, int flags, int fmt, struct proc *p)
{
int unit = UNIT (dev);
@@ -123,7 +141,7 @@ joyopen (dev_t dev, int flags, int fmt, struct proc *p)
joy[unit].timeout[i] = JOY_TIMEOUT;
return 0;
}
-int
+static int
joyclose (dev_t dev, int flags, int fmt, struct proc *p)
{
int unit = UNIT (dev);
@@ -133,7 +151,7 @@ joyclose (dev_t dev, int flags, int fmt, struct proc *p)
return 0;
}
-int
+static int
joyread (dev_t dev, struct uio *uio, int flag)
{
int unit = UNIT(dev);
@@ -169,7 +187,9 @@ joyread (dev_t dev, struct uio *uio, int flag)
c.b2 = ~(state >> 1) & 1;
return uiomove ((caddr_t)&c, sizeof(struct joystick), uio);
}
-int joyioctl (dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
+
+static int
+joyioctl (dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
{
int unit = UNIT (dev);
int i = joypart (dev);
@@ -202,6 +222,7 @@ int joyioctl (dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
}
return 0;
}
+
static int
get_tick ()
{
@@ -215,12 +236,6 @@ get_tick ()
}
-#ifdef JREMOD
-struct cdevsw joy_cdevsw =
- { joyopen, joyclose, joyread, nowrite, /*51*/
- joyioctl, nostop, nullreset, nodevtotty,/*joystick */
- seltrue, nommap, NULL};
-
static joy_devsw_installed = 0;
static void joy_drvinit(void *unused)
@@ -231,20 +246,9 @@ static void joy_drvinit(void *unused)
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&joy_cdevsw,NULL);
joy_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "joy", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(joydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,joy_drvinit,NULL)
-#endif /* JREMOD */
-
#endif /* NJOY > 0 */
diff --git a/sys/isa/sio.c b/sys/isa/sio.c
index b6b090f..d44d7bc 100644
--- a/sys/isa/sio.c
+++ b/sys/isa/sio.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
- * $Id: sio.c,v 1.123 1995/11/29 15:00:07 bde Exp $
+ * $Id: sio.c,v 1.124 1995/12/06 23:43:07 bde Exp $
*/
#include "sio.h"
@@ -59,6 +59,9 @@
#include <sys/malloc.h>
#include <sys/syslog.h>
#include <sys/devconf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <machine/clock.h>
@@ -95,12 +98,6 @@
#define com_scr 7 /* scratch register for 16450-16550 (R/W) */
-#ifdef JREMOD
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 28
-#endif /*JREMOD*/
#include "crd.h"
@@ -251,6 +248,14 @@ struct com_s {
*/
u_char obuf1[256];
u_char obuf2[256];
+#ifdef DEVFS
+ void *devfs_token_ttyd;
+ void *devfs_token_ttyl;
+ void *devfs_token_ttyi;
+ void *devfs_token_cuaa;
+ void *devfs_token_cual;
+ void *devfs_token_cuai;
+#endif
};
/*
@@ -285,6 +290,8 @@ static void disc_optim __P((struct tty *tp, struct termios *t,
static int LoadSoftModem __P((int unit,int base_io, u_long size, u_char *ptr));
#endif /* DSI_SOFT_MODEM */
+static char driver_name[] = "sio";
+
/* table and macro for fast conversion from a unit number to its com struct */
static struct com_s *p_com_addr[NSIO];
#define com_addr(unit) (p_com_addr[unit])
@@ -292,9 +299,24 @@ static struct com_s *p_com_addr[NSIO];
static struct timeval intr_timestamp;
struct isa_driver siodriver = {
- sioprobe, sioattach, "sio"
+ sioprobe, sioattach, driver_name
};
+static d_open_t sioopen;
+static d_close_t sioclose;
+static d_read_t sioread;
+static d_write_t siowrite;
+static d_ioctl_t sioioctl;
+static d_stop_t siostop;
+static d_ttycv_t siodevtotty;
+
+#define CDEV_MAJOR 28
+struct cdevsw sio_cdevsw =
+ { sioopen, sioclose, sioread, siowrite, /*28*/
+ sioioctl, siostop, nxreset, siodevtotty,/* sio */
+ ttselect, nommap, NULL, driver_name, NULL, -1 };
+
+
static int comconsole = -1;
static speed_t comdefaultrate = TTYDEF_SPEED;
static u_int com_events; /* input chars + weighted output completions */
@@ -338,9 +360,10 @@ static struct speedtab comspeedtab[] = {
{ -1, -1 }
};
+static char chardev[] = "0123456789abcdefghijklmnopqrstuvwxyz";
static struct kern_devconf kdc_sio[NSIO] = { {
0, 0, 0, /* filled in by dev_attach */
- "sio", 0, { MDDT_ISA, 0, "tty" },
+ driver_name, 0, { MDDT_ISA, 0, "tty" },
isa_generic_externalize, 0, 0, ISA_EXTERNALLEN,
&kdc_isa0, /* parent */
0, /* parentdata */
@@ -359,7 +382,7 @@ static int sioinit(struct pccard_dev *, int); /* init device */
static struct pccard_drv sio_info =
{
- "sio",
+ driver_name,
card_intr,
siounload,
siosuspend,
@@ -696,6 +719,7 @@ sioattach(isdp)
Port_t iobase;
int s;
int unit;
+ char name[32];
isdp->id_ri_flags |= RI_FAST;
iobase = isdp->id_iobase;
@@ -880,10 +904,37 @@ determined_type: ;
com_addr(unit) = com;
splx(s);
+#ifdef DEVFS
+/* path name devsw minor type uid gid perm*/
+ sprintf(name,"ttyd%c",chardev[unit]);
+ com->devfs_token_ttyd = devfs_add_devsw(
+ "/", name, &sio_cdevsw, unit,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"ttyid%c",chardev[unit]);
+ com->devfs_token_ttyi = devfs_add_devsw(
+ "/", name, &sio_cdevsw, unit+32,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"ttyld%c",chardev[unit]);
+ com->devfs_token_ttyl = devfs_add_devsw(
+ "/", name, &sio_cdevsw, unit+64,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"cuaa%c",chardev[unit]);
+ com->devfs_token_cuaa = devfs_add_devsw(
+ "/", name, &sio_cdevsw, unit+128,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"cuaia%c",chardev[unit]);
+ com->devfs_token_cuai = devfs_add_devsw(
+ "/", name, &sio_cdevsw, unit+160,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"cuala%c",chardev[unit]);
+ com->devfs_token_cual = devfs_add_devsw(
+ "/", name, &sio_cdevsw, unit+192,
+ DV_CHR, 0, 0, 0600);
+#endif
return (1);
}
-int
+static int
sioopen(dev, flag, mode, p)
dev_t dev;
int flag;
@@ -1055,7 +1106,7 @@ out:
return (error);
}
-int
+static int
sioclose(dev, flag, mode, p)
dev_t dev;
int flag;
@@ -1150,7 +1201,7 @@ comhardclose(com)
splx(s);
}
-int
+static int
sioread(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -1170,7 +1221,7 @@ sioread(dev, uio, flag)
return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
}
-int
+static int
siowrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -1429,7 +1480,7 @@ cont:
}
}
-int
+static int
sioioctl(dev, cmd, data, flag, p)
dev_t dev;
int cmd;
@@ -2012,7 +2063,7 @@ comstart(tp)
splx(s);
}
-void
+static void
siostop(tp, rw)
struct tty *tp;
int rw;
@@ -2041,7 +2092,7 @@ siostop(tp, rw)
/* XXX should clear h/w fifos too. */
}
-struct tty *
+static struct tty *
siodevtotty(dev)
dev_t dev;
{
@@ -2559,12 +2610,6 @@ error:
}
#endif /* DSI_SOFT_MODEM */
-#ifdef JREMOD
-struct cdevsw sio_cdevsw =
- { sioopen, sioclose, sioread, siowrite, /*28*/
- sioioctl, siostop, nxreset, siodevtotty,/* sio */
- ttselect, nommap, NULL };
-
static sio_devsw_installed = 0;
static void sio_drvinit(void *unused)
@@ -2572,23 +2617,12 @@ static void sio_drvinit(void *unused)
dev_t dev;
if( ! sio_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&sio_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&sio_cdevsw, NULL);
sio_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "sio", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(siodev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,sio_drvinit,NULL)
-#endif /* JREMOD */
-
#endif /* NSIO > 0 */
diff --git a/sys/isa/syscons.c b/sys/isa/syscons.c
index 6c736ca..db7c92d 100644
--- a/sys/isa/syscons.c
+++ b/sys/isa/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.133 1995/12/06 23:50:36 bde Exp $
+ * $Id: syscons.c,v 1.134 1995/12/07 12:46:08 davidg Exp $
*/
#include "sc.h"
@@ -45,6 +45,9 @@
#include <sys/errno.h>
#include <sys/malloc.h>
#include <sys/devconf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif
#include <machine/clock.h>
#include <machine/cons.h>
@@ -69,6 +72,7 @@
#define MAXCONS 16
#endif
+
/* this may break on older VGA's but is usefull on real 32 bit systems */
#define bcopyw bcopy
@@ -84,6 +88,7 @@ static default_attr kernel_default = {
static scr_stat main_console;
static scr_stat *console[MAXCONS];
+static void *sc_devfs_token[MAXCONS];
scr_stat *cur_console;
static scr_stat *new_scp, *old_scp;
static term_stat kernel_console;
@@ -159,8 +164,7 @@ static d_mmap_t scmmap;
static struct cdevsw scdevsw = {
scopen, scclose, scread, scwrite,
scioctl, nullstop, noreset, scdevtotty,
- ttselect, scmmap, nostrategy,
-};
+ ttselect, scmmap, nostrategy, "sc", NULL, -1 };
/*
* Calculate hardware attributes word using logical attributes mask and
@@ -283,7 +287,9 @@ scresume(void *dummy)
int
scattach(struct isa_device *dev)
{
- scr_stat *scp;
+ scr_stat *scp;
+ int vc;
+ char name[32];
scinit();
configuration = dev->id_flags;
@@ -345,6 +351,13 @@ scattach(struct isa_device *dev)
apm_hook_establish(APM_HOOK_RESUME , &scp->r_hook);
#endif
+#ifdef DEVFS
+ for ( vc = 0 ; vc < MAXCONS; vc++) {
+ sprintf(name,"ttyv%x", vc);
+ sc_devfs_token[vc] = devfs_add_devsw("/" ,name, &scdevsw, vc,
+ DV_CHR, 0, 0, 0600 );
+ }
+#endif
register_cdev("sc", &scdevsw);
return 0;
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c
index 49e8b9f..5696ae5 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.4 1995/11/29 12:38:46 julian Exp $
+ * $Id: kern_conf.c,v 1.5 1995/11/30 05:59:09 julian Exp $
*/
#include <sys/param.h>
@@ -70,6 +70,7 @@ int TTYPE##_add(dev_t *descrip, \
if (oldentry) { \
bcopy(&TTYPE[i], oldentry, sizeof(struct TTYPE)); \
} \
+ newentry->d_maj = i; \
/* replace with new */ \
bcopy(newentry, &TTYPE[i], sizeof(struct TTYPE)); \
\
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index cc3ec92..acc5a43 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.19 1995/12/05 21:51:28 bde Exp $
+ * $Id: kern_descrip.c,v 1.20 1995/12/07 12:46:38 davidg Exp $
*/
#include <sys/param.h>
@@ -62,13 +62,18 @@
#include <vm/vm_param.h>
#include <vm/vm_extern.h>
-#ifdef JREMOD
-#include <sys/conf.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
+
+static d_open_t fdopen;
+#define NUMFDESC 64
+
#define CDEV_MAJOR 22
-#endif /*JREMOD*/
+struct cdevsw fildesc_cdevsw =
+ { fdopen, noclose, noread, nowrite, /*22*/
+ noioc, nostop, nullreset, nodevtotty,/*fd(!=Fd)*/
+ noselect, nommap, nostrat };
int finishdup(struct filedesc *fdp, int old, int new, int *retval);
/*
@@ -896,7 +901,7 @@ flock(p, uap, retval)
* references to this file will be direct to the other driver.
*/
/* ARGSUSED */
-int
+static int
fdopen(dev, mode, type, p)
dev_t dev;
int mode, type;
@@ -1035,34 +1040,35 @@ SYSCTL_INT(_kern, KERN_MAXFILESPERPROC, maxfilesperproc,
SYSCTL_INT(_kern, KERN_MAXFILES, maxfiles, CTLFLAG_RW, &maxfiles, 0, "");
-#ifdef JREMOD
-static struct cdevsw fildesc_cdevsw =
- { fdopen, noclose, noread, nowrite, /*22*/
- noioc, nostop, nullreset, nodevtotty,/*fd(!=Fd)*/
- noselect, nommap, nostrat };
-
static fildesc_devsw_installed = 0;
+static void *devfs_token_stdin;
+static void *devfs_token_stdout;
+static void *devfs_token_stderr;
+static void *devfs_token_fildesc[NUMFDESC];
static void fildesc_drvinit(void *unused)
{
dev_t dev;
+ int i;
+ char name[32];
if( ! fildesc_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&fildesc_cdevsw,NULL);
fildesc_devsw_installed = 1;
#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
-/* path name devsw minor type uid gid perm*/
- x=devfs_add_devsw("/","stdin",major(dev),0,DV_CHR,
- 0, 0, 0600);
- x=devfs_add_devsw("/","stdout",major(dev),1,DV_CHR,
- 0, 0, 0600);
- x=devfs_add_devsw("/","stderr",major(dev),2,DV_CHR,
- 0, 0, 0600);
+ for ( i = 0 ; i < NUMFDESC ; i++ ) {
+ sprintf(name,"%d",i);
+ devfs_token_fildesc[i] = devfs_add_devsw("fd",name,
+ &fildesc_cdevsw,0,
+ DV_CHR, 0, 0, 0666);
}
+ devfs_token_stdin =
+ dev_link("/","stdin",devfs_token_fildesc[0]);
+ devfs_token_stdout =
+ dev_link("/","stdout",devfs_token_fildesc[1]);
+ devfs_token_stderr =
+ dev_link("/","stderr",devfs_token_fildesc[2]);
#endif
}
}
@@ -1070,4 +1076,4 @@ static void fildesc_drvinit(void *unused)
SYSINIT(fildescdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,
fildesc_drvinit,NULL)
-#endif /* JREMOD */
+
diff --git a/sys/kern/kern_lkm.c b/sys/kern/kern_lkm.c
index bcebe68..8aa9ac4 100644
--- a/sys/kern/kern_lkm.c
+++ b/sys/kern/kern_lkm.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: kern_lkm.c,v 1.22 1995/11/29 17:45:59 wollman Exp $
+ * $Id: kern_lkm.c,v 1.23 1995/12/07 12:46:43 davidg Exp $
*/
#include <sys/param.h>
@@ -49,18 +49,15 @@
#include <sys/exec.h>
#include <sys/imgact.h>
#include <sys/lkm.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/vm_kern.h>
#include <vm/vm_extern.h>
-#ifdef JREMOD
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 32
-#endif /*JREMOD */
#define PAGESIZE 1024 /* kmem_alloc() allocation quantum */
@@ -89,8 +86,19 @@ static int _lkm_vfs __P((struct lkm_table *lkmtp, int cmd));
static int _lkm_syscall __P((struct lkm_table *lkmtp, int cmd));
static void lkmunreserve __P((void));
+static d_open_t lkmcopen;
+static d_close_t lkmcclose;
+static d_ioctl_t lkmcioctl;
+
+#define CDEV_MAJOR 32
+struct cdevsw lkmc_cdevsw =
+ { lkmcopen, lkmcclose, noread, nowrite, /*32*/
+ lkmcioctl, nostop, nullreset, nodevtotty,
+ noselect, nommap, NULL, "lkm", NULL, -1 };
+
+
/*ARGSUSED*/
-int
+static int
lkmcopen(dev, flag, devtype, p)
dev_t dev;
int flag;
@@ -149,7 +157,7 @@ lkmunreserve()
lkm_state = LKMS_IDLE;
}
-int
+static int
lkmcclose(dev, flag, mode, p)
dev_t dev;
int flag;
@@ -181,7 +189,7 @@ lkmcclose(dev, flag, mode, p)
}
/*ARGSUSED*/
-int
+static int
lkmcioctl(dev, cmd, data, flag, p)
dev_t dev;
int cmd;
@@ -690,9 +698,7 @@ _lkm_dev(lkmtp, cmd)
{
struct lkm_dev *args = lkmtp->private.lkm_dev;
int i;
-#ifdef JREMOD
dev_t descrip;
-#endif /* JREMOD */
int err = 0;
switch(cmd) {
@@ -702,35 +708,6 @@ _lkm_dev(lkmtp, cmd)
return(EEXIST);
switch(args->lkm_devtype) {
case LM_DT_BLOCK:
-#ifndef JREMOD
- if ((i = args->lkm_offset) == -1) { /* auto */
- /*
- * Search the table looking for a slot...
- */
- for (i = 0; i < nblkdev; i++)
- if (bdevsw[i].d_open == lkmenodev)
- break; /* found it! */
- /* out of allocable slots? */
- if (i == nblkdev) {
- err = ENFILE;
- break;
- }
- } else { /* assign */
- if (i < 0 || i >= nblkdev) {
- err = EINVAL;
- break;
- }
- }
-
- /* save old */
- bcopy(&bdevsw[i], &(args->lkm_olddev.bdev), sizeof(struct bdevsw));
-
- /* replace with new */
- bcopy(args->lkm_dev.bdev, &bdevsw[i], sizeof(struct bdevsw));
-
- /* done! */
- args->lkm_offset = i; /* slot in bdevsw[] */
-#else /* JREMOD */
if ((i = args->lkm_offset) == -1)
descrip = (dev_t) -1;
else
@@ -740,50 +717,9 @@ _lkm_dev(lkmtp, cmd)
break;
}
args->lkm_offset = major(descrip) ;
-#endif /* JREMOD */
break;
case LM_DT_CHAR:
-#ifndef JREMOD
- if ((i = args->lkm_offset) == -1) { /* auto */
- /*
- * Search the table looking for a slot...
- */
- for (i = 0; i < nchrdev; i++)
- if (cdevsw[i].d_open == lkmenodev)
- break; /* found it! */
- /* out of allocable slots? */
- if (i == nchrdev) {
- err = ENFILE;
- break;
- }
- } else { /* assign */
- if (i < 0 || i >= nchrdev) {
- err = EINVAL;
- break;
- }
- }
-
- /* save old */
- bcopy(&cdevsw[i], &(args->lkm_olddev.cdev), sizeof(struct cdevsw));
-
- /* replace with new */
- bcopy(args->lkm_dev.cdev, &cdevsw[i], sizeof(struct cdevsw));
-
- /* done! */
- args->lkm_offset = i; /* slot in cdevsw[] */
-
-#else /* JREMOD */
- if ((i = args->lkm_offset) == -1)
- descrip = (dev_t) -1;
- else
- descrip = makedev(args->lkm_offset,0);
- if ( err = cdevsw_add(&descrip, args->lkm_dev.cdev,
- &(args->lkm_olddev.cdev))) {
- break;
- }
- args->lkm_offset = major(descrip) ;
-#endif /* JREMOD */
break;
default:
@@ -799,22 +735,13 @@ _lkm_dev(lkmtp, cmd)
switch(args->lkm_devtype) {
case LM_DT_BLOCK:
/* replace current slot contents with old contents */
-#ifndef JREMOD
- bcopy(&(args->lkm_olddev.bdev), &bdevsw[i], sizeof(struct bdevsw));
-#else /* JREMOD */
descrip = makedev(i,0);
bdevsw_add(&descrip, &(args->lkm_olddev.bdev),NULL);
-#endif /* JREMOD */
break;
case LM_DT_CHAR:
/* replace current slot contents with old contents */
-#ifndef JREMOD
- bcopy(&(args->lkm_olddev.cdev), &cdevsw[i], sizeof(struct cdevsw));
-#else /* JREMOD */
- descrip = makedev(i,0);
cdevsw_add(&descrip, &(args->lkm_olddev.cdev),NULL);
-#endif /* JREMOD */
break;
default:
@@ -996,35 +923,24 @@ lkm_nullcmd(lkmtp, cmd)
return (0);
}
-#ifdef JREMOD
-struct cdevsw lkm_cdevsw =
- { lkmcopen, lkmcclose, noread, nowrite, /*32*/
- lkmcioctl, nostop, nullreset, nodevtotty,
- noselect, nommap, NULL };
-
static lkm_devsw_installed = 0;
+static void *lkmc_devfs_token;
static void lkm_drvinit(void *unused)
{
dev_t dev;
if( ! lkm_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&lkm_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&lkmc_cdevsw, NULL);
lkm_devsw_installed = 1;
#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "lkm", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
+ lkmc_devfs_token = devfs_add_devsw( "/", "lkm", &lkmc_cdevsw, 0,
+ DV_CHR, 0, 0, 0660);
#endif
}
}
SYSINIT(lkmdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,lkm_drvinit,NULL)
-#endif /* JREMOD */
diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c
index 04a2e6c..5b8a86f 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.12 1995/11/29 14:40:35 julian Exp $
+ * $Id: subr_log.c,v 1.13 1995/12/02 18:58:52 bde Exp $
*/
/*
@@ -47,21 +47,28 @@
#include <sys/msgbuf.h>
#include <sys/file.h>
#include <sys/signalvar.h>
-
-#ifdef JREMOD
-#include <sys/conf.h>
#include <sys/kernel.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
-#define CDEV_MAJOR 7
-#endif /*JREMOD*/
#define LOG_RDPRI (PZERO + 1)
#define LOG_ASYNC 0x04
#define LOG_RDWAIT 0x08
+static d_open_t logopen;
+static d_close_t logclose;
+static d_read_t logread;
+static d_ioctl_t logioctl;
+static d_select_t logselect;
+
+#define CDEV_MAJOR 7
+struct cdevsw log_cdevsw =
+ { logopen, logclose, logread, nowrite, /*7*/
+ logioctl, nostop, nullreset, nodevtotty,/* klog */
+ logselect, nommap, NULL, "log", NULL, -1 };
+
struct logsoftc {
int sc_state; /* see above for possibilities */
struct selinfo sc_selp; /* process waiting on select call */
@@ -71,7 +78,7 @@ struct logsoftc {
int log_open; /* also used in log() */
/*ARGSUSED*/
-int
+static int
logopen(dev, flags, mode, p)
dev_t dev;
int flags, mode;
@@ -85,7 +92,7 @@ logopen(dev, flags, mode, p)
}
/*ARGSUSED*/
-int
+static int
logclose(dev, flag, mode, p)
dev_t dev;
int flag, mode;
@@ -98,7 +105,7 @@ logclose(dev, flag, mode, p)
}
/*ARGSUSED*/
-int
+static int
logread(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -144,7 +151,7 @@ logread(dev, uio, flag)
}
/*ARGSUSED*/
-int
+static int
logselect(dev, rw, p)
dev_t dev;
int rw;
@@ -187,7 +194,7 @@ logwakeup()
}
/*ARGSUSED*/
-int
+static int
logioctl(dev, com, data, flag, p)
dev_t dev;
int com;
@@ -234,15 +241,11 @@ logioctl(dev, com, data, flag, p)
return (0);
}
-#ifdef JREMOD
-struct cdevsw log_cdevsw =
- { logopen, logclose, logread, nowrite, /*7*/
- logioctl, nostop, nullreset, nodevtotty,/* klog */
- logselect, nommap, NULL };
-
static log_devsw_installed = 0;
+static void *log_devfs_token;
-static void log_drvinit(void *unused)
+static void
+log_drvinit(void *unused)
{
dev_t dev;
@@ -251,18 +254,12 @@ static void log_drvinit(void *unused)
cdevsw_add(&dev,&log_cdevsw,NULL);
log_devsw_installed = 1;
#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "log", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
+ log_devfs_token = devfs_add_devsw(
+ "/", "log", &log_cdevsw, 0, DV_CHR, 0, 0, 0600);
#endif
}
}
SYSINIT(logdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,log_drvinit,NULL)
-#endif /* JREMOD */
diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c
index 7f2e4d7..4624a28 100644
--- a/sys/kern/tty_cons.c
+++ b/sys/kern/tty_cons.c
@@ -36,26 +36,22 @@
* SUCH DAMAGE.
*
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
- * $Id: cons.c,v 1.35 1995/11/29 10:47:17 julian Exp $
+ * $Id: cons.c,v 1.36 1995/11/29 14:39:24 julian Exp $
*/
#include <sys/param.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <sys/systm.h>
#include <sys/conf.h>
+#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/tty.h>
#include <machine/cons.h>
#include <machine/stdarg.h>
-#ifdef JREMOD
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 0
-#endif /*JREMOD*/
-
/* XXX this should be config(8)ed. */
#include "sc.h"
#include "vt.h"
@@ -73,6 +69,19 @@ static struct consdev constab[] = {
{ 0 },
};
+static d_open_t cnopen;
+static d_close_t cnclose;
+static d_read_t cnread;
+static d_write_t cnwrite;
+static d_ioctl_t cnioctl;
+static d_select_t cnselect;
+
+#define CDEV_MAJOR 0
+struct cdevsw cn_cdevsw =
+ { cnopen, cnclose, cnread, cnwrite, /*0*/
+ cnioctl, nullstop, nullreset, nodevtotty,/* console */
+ cnselect, nommap, NULL, "console", NULL, -1 };
+
struct tty *constty = 0; /* virtual console output device */
struct tty *cn_tty; /* XXX: console tty struct for tprintf */
int cons_unavail = 0; /* XXX:
@@ -86,6 +95,9 @@ static d_close_t *cn_phys_close; /* physical device close function */
static d_open_t *cn_phys_open; /* physical device open function */
static struct consdev *cn_tab; /* physical console device info */
static struct tty *cn_tp; /* physical console tty struct */
+#ifdef DEVFS
+void *cn_devfs_token; /* represents the devfs entry */
+#endif /* DEVFS */
void
cninit()
@@ -148,7 +160,7 @@ cninit_finish()
cn_tty = cn_tp;
}
-int
+static int
cnopen(dev, flag, mode, p)
dev_t dev;
int flag, mode;
@@ -171,7 +183,7 @@ cnopen(dev, flag, mode, p)
return (retval);
}
-int
+static int
cnclose(dev, flag, mode, p)
dev_t dev;
int flag, mode;
@@ -204,7 +216,7 @@ cnclose(dev, flag, mode, p)
return ((*cn_phys_close)(dev, flag, mode, p));
}
-int
+static int
cnread(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -216,7 +228,7 @@ cnread(dev, uio, flag)
return ((*cdevsw[major(dev)].d_read)(dev, uio, flag));
}
-int
+static int
cnwrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -231,7 +243,7 @@ cnwrite(dev, uio, flag)
return ((*cdevsw[major(dev)].d_write)(dev, uio, flag));
}
-int
+static int
cnioctl(dev, cmd, data, flag, p)
dev_t dev;
int cmd;
@@ -258,7 +270,7 @@ cnioctl(dev, cmd, data, flag, p)
return ((*cdevsw[major(dev)].d_ioctl)(dev, cmd, data, flag, p));
}
-int
+static int
cnselect(dev, rw, p)
dev_t dev;
int rw;
@@ -312,18 +324,11 @@ pg(const char *p, ...) {
return(cngetc());
}
-
-#ifdef JREMOD
-struct cdevsw cn_cdevsw =
- { cnopen, cnclose, cnread, cnwrite, /*0*/
- cnioctl, nullstop, nullreset, nodevtotty,/* console */
- cnselect, nommap, NULL };
-
static cn_devsw_installed = 0;
-static void cn_drvinit(void *unused)
+static void
+cn_drvinit(void *unused)
{
- void * x;
dev_t dev;
if( ! cn_devsw_installed ) {
@@ -331,13 +336,19 @@ static void cn_drvinit(void *unused)
cdevsw_add(&dev,&cn_cdevsw,NULL);
cn_devsw_installed = 1;
#ifdef DEVFS
- /* path,name,major,minor,type,uid,gid,perm */
- x=devfs_add_devsw("/","console",major(dev),0,DV_CHR,0,0,0640);
+ cn_devfs_token = devfs_add_devsw(
+ "/",
+ "console",
+ &cn_cdevsw,
+ 0,
+ DV_CHR,
+ 0,
+ 0,
+ 0640);
#endif
}
}
SYSINIT(cndev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cn_drvinit,NULL)
-#endif /* JREMOD */
diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c
index 1f9e0d9..9897365 100644
--- a/sys/kern/tty_pty.c
+++ b/sys/kern/tty_pty.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tty_pty.c 8.2 (Berkeley) 9/23/93
- * $Id: tty_pty.c,v 1.27 1995/12/02 07:30:19 julian Exp $
+ * $Id: tty_pty.c,v 1.28 1995/12/02 13:08:20 julian Exp $
*/
/*
@@ -60,6 +60,33 @@ void ptyattach __P((int n));
void ptsstart __P((struct tty *tp));
void ptcwakeup __P((struct tty *tp, int flag));
+static d_open_t ptsopen;
+static d_close_t ptsclose;
+static d_read_t ptsread;
+static d_write_t ptswrite;
+static d_ioctl_t ptyioctl;
+static d_stop_t ptsstop;
+static d_ttycv_t ptydevtotty;
+static d_open_t ptcopen;
+static d_close_t ptcclose;
+static d_read_t ptcread;
+static d_write_t ptcwrite;
+static d_ioctl_t ptcioctl;
+static d_select_t ptcselect;
+
+#define CDEV_MAJOR_S 5
+#define CDEV_MAJOR_C 6
+struct cdevsw pts_cdevsw =
+ { ptsopen, ptsclose, ptsread, ptswrite, /*5*/
+ ptyioctl, ptsstop, nullreset, ptydevtotty,/* ttyp */
+ ttselect, nommap, NULL, "pts", NULL, -1 };
+
+struct cdevsw ptc_cdevsw =
+ { ptcopen, ptcclose, ptcread, ptcwrite, /*6*/
+ ptyioctl, nullstop, nullreset, ptydevtotty,/* ptyp */
+ ptcselect, nommap, NULL, "ptc", NULL, -1 };
+
+
#if NPTY == 1
#undef NPTY
#define NPTY 32 /* crude XXX */
@@ -114,7 +141,7 @@ ptyattach(n)
}
/*ARGSUSED*/
-int
+static int
ptsopen(dev, flag, devtype, p)
dev_t dev;
int flag, devtype;
@@ -152,7 +179,7 @@ ptsopen(dev, flag, devtype, p)
return (error);
}
-int
+static int
ptsclose(dev, flag, mode, p)
dev_t dev;
int flag, mode;
@@ -168,7 +195,7 @@ ptsclose(dev, flag, mode, p)
return (err);
}
-int
+static int
ptsread(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -223,7 +250,7 @@ again:
* Wakeups of controlling tty will happen
* indirectly, when tty driver calls ptsstart.
*/
-int
+static int
ptswrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -273,7 +300,7 @@ ptcwakeup(tp, flag)
}
}
-int
+static int
ptcopen(dev, flag, devtype, p)
dev_t dev;
int flag, devtype;
@@ -300,7 +327,7 @@ ptcopen(dev, flag, devtype, p)
return (0);
}
-int
+static int
ptcclose(dev, flags, fmt, p)
dev_t dev;
int flags;
@@ -330,7 +357,7 @@ ptcclose(dev, flags, fmt, p)
return (0);
}
-int
+static int
ptcread(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -392,7 +419,7 @@ ptcread(dev, uio, flag)
return (error);
}
-void
+static void
ptsstop(tp, flush)
register struct tty *tp;
int flush;
@@ -416,7 +443,7 @@ ptsstop(tp, flush)
ptcwakeup(tp, flag);
}
-int
+static int
ptcselect(dev, rw, p)
dev_t dev;
int rw;
@@ -471,7 +498,7 @@ ptcselect(dev, rw, p)
return (0);
}
-int
+static int
ptcwrite(dev, uio, flag)
dev_t dev;
register struct uio *uio;
@@ -570,7 +597,7 @@ block:
goto again;
}
-struct tty *
+static struct tty *
ptydevtotty(dev)
dev_t dev;
{
@@ -581,7 +608,7 @@ ptydevtotty(dev)
}
/*ARGSUSED*/
-int
+static int
ptyioctl(dev, cmd, data, flag, p)
dev_t dev;
int cmd;
@@ -738,38 +765,29 @@ ptyioctl(dev, cmd, data, flag, p)
return (error);
}
-#define CDEV_MAJOR_S 5
-#define CDEV_MAJOR_C 6
-#ifdef JREMOD
-struct cdevsw pts_cdevsw =
- { ptsopen, ptsclose, ptsread, ptswrite, /*5*/
- ptyioctl, ptsstop, nullreset, ptydevtotty,/* ttyp */
- ttselect, nommap, NULL };
-
-struct cdevsw ptc_cdevsw =
- { ptcopen, ptcclose, ptcread, ptcwrite, /*6*/
- ptyioctl, nullstop, nullreset, ptydevtotty,/* ptyp */
- ptcselect, nommap, NULL };
-
static ptc_devsw_installed = 0;
+#ifdef DEVFS
+#define MAXUNITS (8 * 32)
+static void *devfs_token_pts[MAXUNITS];
+static void *devfs_token_ptc[MAXUNITS];
+const char jnames[] = "pqrsPQRS";
+const char knames[] = "0123456789abcdefghijklmnopqrstuv";
+#endif
-static void ptc_drvinit(void *unused)
+static void
+ptc_drvinit(void *unused)
{
#ifdef DEVFS
int i,j,k;
- char jnames[] = "pqrsPQRS";
- char knames[] = "0123456789abcdefghijklmnopqrstuv";
- char devname[16];
-#define MAXUNITS (8 * 32)
+ char name[16];
#endif
dev_t dev;
- dev_t dev_c;
if( ! ptc_devsw_installed ) {
- dev = makedev(CDEV_MAJOR_S,0);
- cdevsw_add(&dev,&pts_cdevsw,NULL);
- dev_c = makedev(CDEV_MAJOR_C,0);
- cdevsw_add(&dev_c,&ptc_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR_S, 0);
+ cdevsw_add(&dev, &pts_cdevsw, NULL);
+ dev = makedev(CDEV_MAJOR_C, 0);
+ cdevsw_add(&dev, &ptc_cdevsw, NULL);
ptc_devsw_installed = 1;
#ifdef DEVFS
/*XXX*/
@@ -778,14 +796,18 @@ static void ptc_drvinit(void *unused)
#define NPTY MAXUNITS
#endif
for ( i = 0 ; i<NPTY ; i++ ) {
- void * x;
+ void *x;
j = i / 32;
k = i % 32;
- sprintf(devname,"pty%c%c",jnames[j],knames[k]);
- x=devfs_add_devsw("/",devname,major(dev_c),0,DV_CHR,0,0,0600);
- sprintf(devname,"tty%c%c",jnames[j],knames[k]);
- x=devfs_add_devsw("/",devname,major(dev),0,DV_CHR,0,0,0600);
+ sprintf(name,"pty%c%c",jnames[j],knames[k]);
+ devfs_token_pts[i] =
+ devfs_add_devsw("/",name,&pts_cdevsw,i,
+ DV_CHR,0,0,0600);
+ sprintf(name,"tty%c%c",jnames[j],knames[k]);
+ devfs_token_ptc[i] =
+ devfs_add_devsw("/",name,&ptc_cdevsw,i,
+ DV_CHR,0,0,0600);
}
#endif
}
@@ -793,5 +815,4 @@ static void ptc_drvinit(void *unused)
SYSINIT(ptcdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR_C,ptc_drvinit,NULL)
-#endif /* JREMOD */
diff --git a/sys/kern/tty_snoop.c b/sys/kern/tty_snoop.c
index 8e16b2f..27ffe9f 100644
--- a/sys/kern/tty_snoop.c
+++ b/sys/kern/tty_snoop.c
@@ -30,15 +30,25 @@
#include <sys/uio.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
-
-#include <sys/snoop.h>
-
-#ifdef JREMOD
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
+
+#include <sys/snoop.h>
+
+static d_open_t snpopen;
+static d_close_t snpclose;
+static d_read_t snpread;
+static d_write_t snpwrite;
+static d_ioctl_t snpioctl;
+static d_select_t snpselect;
+
#define CDEV_MAJOR 53
-#endif /*JREMOD*/
+struct cdevsw snp_cdevsw =
+ { snpopen, snpclose, snpread, snpwrite, /*53*/
+ snpioctl, nostop, nullreset, nodevtotty,/* snoop */
+ snpselect, nommap, NULL, "snp", NULL, -1 };
+
#ifndef MIN
#define MIN(a,b) (((a)<(b))?(a):(b))
@@ -63,7 +73,7 @@ devtotty (dev)
* length for function keys...
*/
-int
+static int
snpwrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -104,7 +114,7 @@ tty_input:
}
-int
+static int
snpread(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -270,7 +280,7 @@ snpin(snp, buf, n)
return n;
}
-int
+static int
snpopen(dev, flag, mode, p)
dev_t dev;
int flag, mode;
@@ -346,7 +356,7 @@ detach_notty:
return (0);
}
-int
+static int
snpclose(dev, flags, fmt, p)
dev_t dev;
int flags;
@@ -376,7 +386,7 @@ snpdown(snp)
}
-int
+static int
snpioctl(dev, cmd, data, flags, p)
dev_t dev;
int cmd;
@@ -473,7 +483,7 @@ snpioctl(dev, cmd, data, flags, p)
}
-int
+static int
snpselect(dev, rw, p)
dev_t dev;
int rw;
@@ -500,29 +510,26 @@ snpselect(dev, rw, p)
return 0;
}
-#ifdef JREMOD
-struct cdevsw snp_cdevsw =
- { snpopen, snpclose, snpread, snpwrite, /*53*/
- snpioctl, nostop, nullreset, nodevtotty,/* snoop */
- snpselect, nommap, NULL };
-
+static void *snp_devfs_token[NSNP];
static snp_devsw_installed = 0;
-static void snp_drvinit(void *unused)
+static void
+snp_drvinit(void *unused)
{
dev_t dev;
+ char name[32];
+ int i;
if( ! snp_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&snp_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&snp_cdevsw, NULL);
snp_devsw_installed = 1;
#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "snp", major(dev), 0, DV_CHR, 0, 0, 0600);
+ for ( i = 0 ; i < NSNP ; i++) {
+ sprintf(name,"snp%d",i);
+ snp_devfs_token[i] =
+ devfs_add_devsw( "/", name, &snp_cdevsw, i,
+ DV_CHR, 0, 0, 0600);
}
#endif
}
@@ -530,6 +537,5 @@ static void snp_drvinit(void *unused)
SYSINIT(snpdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,snp_drvinit,NULL)
-#endif /* JREMOD */
#endif
diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c
index a970e03..d34536c 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.6 1995/11/29 10:48:30 julian Exp $
+ * $Id: tty_tty.c,v 1.7 1995/11/29 14:40:38 julian Exp $
*/
/*
@@ -45,19 +45,28 @@
#include <sys/tty.h>
#include <sys/vnode.h>
#include <sys/file.h>
-
-#ifdef JREMOD
#include <sys/kernel.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
+
+static d_open_t cttyopen;
+static d_read_t cttyread;
+static d_write_t cttywrite;
+static d_ioctl_t cttyioctl;
+static d_select_t cttyselect;
+
#define CDEV_MAJOR 1
-#endif /*JREMOD*/
+struct cdevsw ctty_cdevsw =
+ { cttyopen, nullclose, cttyread, cttywrite, /*1*/
+ cttyioctl, nullstop, nullreset, nodevtotty,/* tty */
+ cttyselect, nommap, NULL, "ctty", NULL, -1 };
+
#define cttyvp(p) ((p)->p_flag & P_CONTROLT ? (p)->p_session->s_ttyvp : NULL)
/*ARGSUSED*/
-int
+static int
cttyopen(dev, flag, mode, p)
dev_t dev;
int flag, mode;
@@ -88,7 +97,7 @@ cttyopen(dev, flag, mode, p)
}
/*ARGSUSED*/
-int
+static int
cttyread(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -106,7 +115,7 @@ cttyread(dev, uio, flag)
}
/*ARGSUSED*/
-int
+static int
cttywrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
@@ -124,7 +133,7 @@ cttywrite(dev, uio, flag)
}
/*ARGSUSED*/
-int
+static int
cttyioctl(dev, cmd, addr, flag, p)
dev_t dev;
int cmd;
@@ -149,7 +158,7 @@ cttyioctl(dev, cmd, addr, flag, p)
}
/*ARGSUSED*/
-int
+static int
cttyselect(dev, flag, p)
dev_t dev;
int flag;
@@ -162,15 +171,11 @@ cttyselect(dev, flag, p)
return (VOP_SELECT(ttyvp, flag, FREAD|FWRITE, NOCRED, p));
}
-#ifdef JREMOD
-struct cdevsw ctty_cdevsw =
- { cttyopen, nullclose, cttyread, cttywrite, /*1*/
- cttyioctl, nullstop, nullreset, nodevtotty,/* tty */
- cttyselect, nommap, NULL };
-
static ctty_devsw_installed = 0;
+static void *ctty_devfs_token;
-static void ctty_drvinit(void *unused)
+static void
+ctty_drvinit(void *unused)
{
dev_t dev;
@@ -179,18 +184,12 @@ static void ctty_drvinit(void *unused)
cdevsw_add(&dev,&ctty_cdevsw,NULL);
ctty_devsw_installed = 1;
#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "tty", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
+ ctty_devfs_token = devfs_add_devsw( "/", "tty",
+ &ctty_cdevsw, 0, DV_CHR, 0, 0, 0600);
#endif
}
}
SYSINIT(cttydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,ctty_drvinit,NULL)
-#endif /* JREMOD */
diff --git a/sys/miscfs/devfs/devfs_tree.c b/sys/miscfs/devfs/devfs_tree.c
index 0110f8b..6f32322 100644
--- a/sys/miscfs/devfs/devfs_tree.c
+++ b/sys/miscfs/devfs/devfs_tree.c
@@ -2,7 +2,7 @@
/*
* Written by Julian Elischer (julian@DIALix.oz.au)
*
- * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_tree.c,v 1.8 1995/10/10 07:12:25 julian Exp $
+ * $Header: /home/ncvs/src/sys/miscfs/devfs/devfs_tree.c,v 1.9 1995/11/29 10:48:36 julian Exp $
*/
#include "param.h"
@@ -908,15 +908,18 @@ int dev_add_entry(char *name, dn_p parent, int type, union typeinfo *by, devnm_p
\***********************************************************************/
void *devfs_add_devsw(char *path,
char *name,
- int major,
+ void *devsw,
int minor,
int chrblk,
uid_t uid,
gid_t gid,
int perms)
{
+ int major;
devnm_p new_dev;
dn_p dnp; /* devnode for parent directory */
+ struct cdevsw *cd;
+ struct bdevsw *bd;
int retval;
union typeinfo by;
@@ -926,13 +929,19 @@ void *devfs_add_devsw(char *path,
switch(chrblk)
{
case DV_CHR:
- by.Cdev.cdevsw = cdevsw + major;
+ cd = devsw;
+ major = cd->d_maj;
+ if ( major == -1 ) return NULL;
+ by.Cdev.cdevsw = cd;
by.Cdev.dev = makedev(major, minor);
if( dev_add_entry(name, dnp, DEV_CDEV, &by,&new_dev))
return NULL;
break;
case DV_BLK:
- by.Bdev.bdevsw = bdevsw + major;
+ bd = devsw;
+ major = bd->d_maj;
+ if ( major == -1 ) return NULL;
+ by.Bdev.bdevsw = bd;
by.Bdev.dev = makedev(major, minor);
if( dev_add_entry(name, dnp, DEV_BDEV, &by, &new_dev))
return NULL;
diff --git a/sys/miscfs/fdesc/fdesc_vnops.c b/sys/miscfs/fdesc/fdesc_vnops.c
index e4eaafc..bec6bc7 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.13 1995/12/03 14:54:10 bde Exp $
+ * $Id: fdesc_vnops.c,v 1.14 1995/12/05 19:12:05 bde Exp $
*/
/*
@@ -58,8 +58,11 @@
#include <sys/dirent.h>
#include <sys/socketvar.h>
#include <sys/tty.h>
+#include <sys/conf.h>
#include <miscfs/fdesc/fdesc.h>
+extern struct cdevsw ctty_cdevsw;
+
#define cttyvp(p) ((p)->p_flag & P_CONTROLT ? (p)->p_session->s_ttyvp : NULL)
#define FDL_WANT 0x01
@@ -363,7 +366,7 @@ fdesc_open(ap)
break;
case Fctty:
- error = cttyopen(devctty, ap->a_mode, 0, ap->a_p);
+ error = (*ctty_cdevsw.d_open)(devctty, ap->a_mode, 0, ap->a_p);
break;
}
@@ -710,7 +713,7 @@ fdesc_read(ap)
switch (VTOFDESC(ap->a_vp)->fd_type) {
case Fctty:
- error = cttyread(devctty, ap->a_uio, ap->a_ioflag);
+ error = (*ctty_cdevsw.d_read)(devctty, ap->a_uio, ap->a_ioflag);
break;
default:
@@ -734,7 +737,7 @@ fdesc_write(ap)
switch (VTOFDESC(ap->a_vp)->fd_type) {
case Fctty:
- error = cttywrite(devctty, ap->a_uio, ap->a_ioflag);
+ error = (*ctty_cdevsw.d_write)(devctty, ap->a_uio, ap->a_ioflag);
break;
default:
@@ -760,8 +763,8 @@ fdesc_ioctl(ap)
switch (VTOFDESC(ap->a_vp)->fd_type) {
case Fctty:
- error = cttyioctl(devctty, ap->a_command, ap->a_data,
- ap->a_fflag, ap->a_p);
+ error = (*ctty_cdevsw.d_ioctl)(devctty, ap->a_command,
+ ap->a_data, ap->a_fflag, ap->a_p);
break;
default:
@@ -786,7 +789,7 @@ fdesc_select(ap)
switch (VTOFDESC(ap->a_vp)->fd_type) {
case Fctty:
- error = cttyselect(devctty, ap->a_fflags, ap->a_p);
+ error = (*ctty_cdevsw.d_select)(devctty, ap->a_fflags, ap->a_p);
break;
default:
diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c
index 38e694e..3a04353 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.6 (Berkeley) 4/9/94
- * $Id: spec_vnops.c,v 1.20 1995/12/05 21:51:45 bde Exp $
+ * $Id: spec_vnops.c,v 1.21 1995/12/07 12:47:17 davidg Exp $
*/
#include <sys/param.h>
@@ -159,10 +159,8 @@ spec_open(ap)
case VCHR:
if ((u_int)maj >= nchrdev)
return (ENXIO);
-#ifdef JREMOD
if ( cdevsw[maj].d_open == NULL)
return ENXIO;
-#endif /*JREMOD*/
if (ap->a_cred != FSCRED && (ap->a_mode & FWRITE)) {
/*
* When running in very secure mode, do not allow
@@ -194,10 +192,8 @@ spec_open(ap)
case VBLK:
if ((u_int)maj >= nblkdev)
return (ENXIO);
-#ifdef JREMOD
if ( bdevsw[maj].d_open == NULL)
return ENXIO;
-#endif /*JREMOD*/
/*
* When running in very secure mode, do not allow
* opens for writing of any disk block devices.
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index db072c3..8a1840c 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.17 1995/12/02 19:37:19 bde Exp $
+ * $Id: bpf.c,v 1.18 1995/12/06 23:51:53 bde Exp $
*/
#include "bpfilter.h"
@@ -80,14 +80,11 @@
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <sys/kernel.h>
-
-#ifdef JREMOD
#include <sys/conf.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
-#define CDEV_MAJOR 23
-#endif /*JREMOD*/
+
/*
* Older BSDs don't have kernel malloc.
@@ -145,6 +142,20 @@ static void catchpacket __P((struct bpf_d *, u_char *, u_int,
u_int, void (*)(const void *, void *, u_int)));
static void reset_d __P((struct bpf_d *));
+static d_open_t bpfopen;
+static d_close_t bpfclose;
+static d_read_t bpfread;
+static d_write_t bpfwrite;
+static d_ioctl_t bpfioctl;
+static d_select_t bpfselect;
+
+#define CDEV_MAJOR 23
+struct cdevsw bpf_cdevsw =
+ { bpfopen, bpfclose, bpfread, bpfwrite, /*23*/
+ bpfioctl, nostop, nullreset, nodevtotty,/* bpf */
+ bpfselect, nommap, NULL, "bpf", NULL, -1 };
+
+
static int
bpf_movein(uio, linktype, mp, sockp, datlen)
register struct uio *uio;
@@ -321,7 +332,7 @@ bpf_detachd(d)
* EBUSY if file is open by another process.
*/
/* ARGSUSED */
-int
+static int
bpfopen(dev, flags, fmt, p)
dev_t dev;
int flags;
@@ -353,7 +364,7 @@ bpfopen(dev, flags, fmt, p)
* deallocating its buffers, and marking it free.
*/
/* ARGSUSED */
-int
+static int
bpfclose(dev, flags, fmt, p)
dev_t dev;
int flags;
@@ -425,7 +436,7 @@ bpf_sleep(d)
/*
* bpfread - read next chunk of packets from buffers
*/
-int
+static int
bpfread(dev, uio, ioflag)
dev_t dev;
register struct uio *uio;
@@ -540,7 +551,7 @@ bpf_wakeup(d)
#endif
}
-int
+static int
bpfwrite(dev, uio, ioflag)
dev_t dev;
struct uio *uio;
@@ -617,7 +628,7 @@ reset_d(d)
* BIOCVERSION Get filter language version.
*/
/* ARGSUSED */
-int
+static int
bpfioctl(dev, cmd, addr, flags, p)
dev_t dev;
int cmd;
@@ -1006,7 +1017,7 @@ bpf_ifname(ifp, ifr)
#if BSD >= 199103
#define bpf_select bpfselect
#else
-int
+static int
bpfselect(dev, rw)
register dev_t dev;
int rw;
@@ -1322,30 +1333,26 @@ bpfattach(driverp, ifp, dlt, hdrlen)
printf("bpf: %s%d attached\n", ifp->if_name, ifp->if_unit);
}
-
-#ifdef JREMOD
-struct cdevsw bpf_cdevsw =
- { bpfopen, bpfclose, bpfread, bpfwrite, /*23*/
- bpfioctl, nostop, nullreset, nodevtotty,/* bpf */
- bpfselect, nommap, NULL };
+static void *bpf_devfs_token[NBPFILTER];
static bpf_devsw_installed = 0;
static void bpf_drvinit(void *unused)
{
dev_t dev;
+ int i;
+ char name[32];
if( ! bpf_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&bpf_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&bpf_cdevsw, NULL);
bpf_devsw_installed = 1;
#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "bpf", major(dev), 0, DV_CHR, 0, 0, 0600);
+ for ( i = 0 ; i < NBPFILTER ; i++ ) {
+ sprintf(name,"bpf%d",i);
+ bpf_devfs_token[i] =
+ devfs_add_devsw( "/", name,
+ &bpf_cdevsw, i, DV_CHR, 0, 0, 0600);
}
#endif
}
@@ -1353,6 +1360,4 @@ static void bpf_drvinit(void *unused)
SYSINIT(bpfdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,bpf_drvinit,NULL)
-#endif /* JREMOD */
-
#endif
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index 12e3e1a..97678c5 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -33,6 +33,9 @@
#ifdef __FreeBSD__
#include <sys/kernel.h>
#endif
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <sys/conf.h>
#include <machine/cpu.h>
@@ -67,12 +70,6 @@ static void tunattach __P((void *));
PSEUDO_SET(tunattach, if_tun);
#endif
-#ifdef JREMOD
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 52
-#endif /*JREMOD*/
#define TUNDEBUG if (tundebug) printf
int tundebug = 0;
@@ -82,15 +79,27 @@ struct tun_softc tunctl[NTUN];
int tunoutput __P((struct ifnet *, struct mbuf *, struct sockaddr *,
struct rtentry *rt));
int tunifioctl __P((struct ifnet *, int, caddr_t));
+static int tuninit __P((int));
-static struct cdevsw tuncdevsw = {
+static d_open_t tunopen;
+static d_close_t tunclose;
+static d_read_t tunread;
+static d_write_t tunwrite;
+static d_ioctl_t tunioctl;
+static d_select_t tunselect;
+
+#define CDEV_MAJOR 52
+static struct cdevsw tun_cdevsw = {
tunopen, tunclose, tunread, tunwrite,
tunioctl, nullstop, noreset, nodevtotty,
- tunselect, nommap, nostrategy
+ tunselect, nommap, nostrategy, "tun", NULL, -1
};
-extern dev_t tuncdev;
-static int tuninit __P((int));
+
+static tun_devsw_installed = 0;
+#ifdef DEVFS
+static void *tun_devfs_token[NTUN];
+#endif
static void
tunattach(dummy)
@@ -98,13 +107,20 @@ tunattach(dummy)
{
register int i;
struct ifnet *ifp;
+ dev_t dev;
+ char name[32];
- /*
- * In case we are an LKM, set up device switch.
- */
- cdevsw[major(tuncdev)] = tuncdevsw;
-
- for (i = 0; i < NTUN; i++) {
+ if( tun_devsw_installed ) return;
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&tun_cdevsw, NULL);
+ tun_devsw_installed = 1;
+ for ( i = 0; i < NTUN; i++ ) {
+#ifdef DEVFS
+ sprintf(name, "tun%d", i );
+ tun_devfs_token[i] = devfs_add_devsw(
+ "/", name, &tun_cdevsw , i,
+ DV_CHR, 0, 0, 0600);
+#endif
tunctl[i].tun_flags = TUN_INITED;
ifp = &tunctl[i].tun_if;
@@ -131,7 +147,7 @@ tunattach(dummy)
* tunnel open - must be superuser & the device must be
* configured in
*/
-int
+static int
tunopen(dev, flag, mode, p)
dev_t dev;
int flag, mode;
@@ -159,7 +175,7 @@ tunopen(dev, flag, mode, p)
* tunclose - close the device - mark i/f down & delete
* routing info
*/
-int
+static int
tunclose(dev_t dev, int foo, int bar, struct proc *p)
{
register int unit = minor(dev), s;
@@ -370,7 +386,7 @@ tunoutput(ifp, m0, dst, rt)
/*
* the cdevsw interface is now pretty minimal.
*/
-int
+static int
tunioctl(dev, cmd, data, flag, p)
dev_t dev;
int cmd;
@@ -437,7 +453,7 @@ tunioctl(dev, cmd, data, flag, p)
* The cdevsw read interface - reads a packet at a time, or at
* least as much of a packet as can be read.
*/
-int
+static int
tunread(dev_t dev, struct uio *uio, int flag)
{
int unit = minor(dev);
@@ -488,7 +504,7 @@ tunread(dev_t dev, struct uio *uio, int flag)
/*
* the cdevsw write interface - an atomic write is a packet - or else!
*/
-int
+static int
tunwrite(dev_t dev, struct uio *uio, int flag)
{
int unit = minor (dev);
@@ -576,7 +592,7 @@ tunwrite(dev_t dev, struct uio *uio, int flag)
* really. The write detect always returns true, write never blocks
* anyway, it either accepts the packet or drops it.
*/
-int
+static int
tunselect(dev_t dev, int rw, struct proc *p)
{
int unit = minor(dev), s;
@@ -605,36 +621,5 @@ tunselect(dev_t dev, int rw, struct proc *p)
return 0;
}
-#ifdef JREMOD
-struct cdevsw tun_cdevsw =
- { tunopen, tunclose, tunread, tunwrite, /*52*/
- tunioctl, nostop, nullreset, nodevtotty,/* tunnel */
- tunselect, nommap, NULL };
-
-static tun_devsw_installed = 0;
-
-static void tun_drvinit(void *unused)
-{
- dev_t dev;
-
- if( ! tun_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&tun_cdevsw,NULL);
- tun_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "tun", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
- }
-}
-
-SYSINIT(tundev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,tun_drvinit,NULL)
-
-#endif /* JREMOD */
#endif /* NTUN */
diff --git a/sys/pccard/pccard.c b/sys/pccard/pccard.c
index 8954995..3a7eccb 100644
--- a/sys/pccard/pccard.c
+++ b/sys/pccard/pccard.c
@@ -42,6 +42,10 @@
#include <sys/devconf.h>
#include <sys/malloc.h>
#include <sys/devconf.h>
+#include <sys/conf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <i386/isa/isa.h>
#include <i386/isa/isa_device.h>
@@ -50,13 +54,6 @@
#include <pccard/card.h>
#include <pccard/slot.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 50
-#endif /*JREMOD*/
extern struct kern_devconf kdc_cpu0;
@@ -97,6 +94,20 @@ static struct pccard_drv *drivers; /* Card drivers */
static unsigned long pccard_mem; /* Physical memory */
static unsigned char *pccard_kmem; /* Kernel virtual address */
+static d_open_t crdopen;
+static d_close_t crdclose;
+static d_read_t crdread;
+static d_write_t crdwrite;
+static d_ioctl_t crdioctl;
+static d_select_t crdselect;
+
+#define CDEV_MAJOR 50
+struct cdevsw crd_cdevsw =
+ { crdopen, crdclose, crdread, crdwrite, /*50*/
+ crdioctl, nostop, nullreset, nodevtotty,/* pcmcia */
+ crdselect, nommap, NULL, "crd", NULL, -1 };
+
+
/*
* pccard_configure - called by autoconf code.
* Probes for various PC-CARD controllers, and
@@ -590,7 +601,7 @@ slot_irq_handler(int sp)
/*
* Device driver interface.
*/
-int
+static int
crdopen(dev_t dev, int oflags, int devtype, struct proc *p)
{
struct slot *sp;
@@ -609,7 +620,7 @@ struct slot *sp;
* Close doesn't de-allocate any resources, since
* slots may be assigned to drivers already.
*/
-int
+static int
crdclose(dev_t dev, int fflag, int devtype, struct proc *p)
{
return(0);
@@ -619,7 +630,7 @@ crdclose(dev_t dev, int fflag, int devtype, struct proc *p)
* read interface. Map memory at lseek offset,
* then transfer to user space.
*/
-int
+static int
crdread(dev_t dev, struct uio *uio, int ioflag)
{
struct slot *sp = pccard_slots[minor(dev)];
@@ -669,7 +680,7 @@ crdread(dev_t dev, struct uio *uio, int ioflag)
* Handles wrap around so that only one memory
* window is used.
*/
-int
+static int
crdwrite(dev_t dev, struct uio *uio, int ioflag)
{
struct slot *sp = pccard_slots[minor(dev)];
@@ -721,7 +732,7 @@ struct slot *sp = pccard_slots[minor(dev)];
* ioctl calls - allows setting/getting of memory and I/O
* descriptors, and assignment of drivers.
*/
-int
+static int
crdioctl(dev_t dev, int cmd, caddr_t data, int fflag, struct proc *p)
{
int s;
@@ -853,7 +864,7 @@ crdioctl(dev_t dev, int cmd, caddr_t data, int fflag, struct proc *p)
* select - Selects on exceptions will return true
* when a change in card status occurs.
*/
-int
+static int
crdselect(dev_t dev, int rw, struct proc *p)
{
int s;
@@ -905,29 +916,25 @@ find_driver(char *name)
return(0);
}
-#ifdef JREMOD
-struct cdevsw crd_cdevsw =
- { crdopen, crdclose, crdread, crdwrite, /*50*/
- crdioctl, nostop, nullreset, nodevtotty,/* pcmcia */
- crdselect, nommap, NULL };
-
static crd_devsw_installed = 0;
-static void crd_drvinit(void *unused)
+static void
+crd_drvinit(void *unused)
{
dev_t dev;
if( ! crd_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&crd_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&crd_cdevsw, NULL);
crd_devsw_installed = 1;
#ifdef DEVFS
+/* expand on this when ever you know what the f*ck pccard devices
+look like and when you know where to store the devfs_token
+I had a quick look but thios driver is not one for a quick look */
{
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "crd", major(dev), 0, DV_CHR, 0, 0, 0600);
+ void *devfs_token;
+ devfs_token=devfs_add_devsw(
+ "/", "crd", &crd_cdevsw, 0, DV_CHR, 0, 0, 0600);
}
#endif
}
@@ -935,5 +942,4 @@ static void crd_drvinit(void *unused)
SYSINIT(crddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,crd_drvinit,NULL)
-#endif /* JREMOD */
diff --git a/sys/pci/meteor.c b/sys/pci/meteor.c
index b964503..f12173b 100644
--- a/sys/pci/meteor.c
+++ b/sys/pci/meteor.c
@@ -60,6 +60,9 @@
#include <sys/signalvar.h>
#include <sys/devconf.h>
#include <sys/mman.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /* DEVFS */
#include <machine/clock.h>
#include <vm/vm.h>
@@ -74,14 +77,6 @@
#endif
#include <machine/ioctl_meteor.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /* DEVFS */
-#define CDEV_MAJOR 67
-#endif /* JREMOD */
-
extern int meteor_intr __P((void *arg));
@@ -148,6 +143,9 @@ typedef struct {
#define METEOR_SINGLE_ODD 0x00200000
#define METEOR_SINGLE_MASK 0x00300000
u_char saa7196_i2c[NUM_SAA7196_I2C_REGS]; /* saa7196 register values */
+#ifdef DEVFS
+ void *devfs_token;
+#endif
} meteor_reg_t;
meteor_reg_t meteor[NMETEOR];
@@ -175,6 +173,20 @@ struct pci_device met_device = {
DATA_SET (pcidevice_set, met_device);
+static d_open_t meteor_open;
+static d_close_t meteor_close;
+static d_read_t meteor_read;
+static d_write_t meteor_write;
+static d_ioctl_t meteor_ioctl;
+static d_mmap_t meteor_mmap;
+
+#define CDEV_MAJOR 67
+struct cdevsw meteor_cdevsw =
+ { meteor_open, meteor_close, meteor_read, meteor_write, /*67*/
+ meteor_ioctl, nostop, nullreset, nodevtotty,/* Meteor */
+ seltrue, meteor_mmap, NULL, "meteor", NULL, -1 };
+
+
static u_long saa7116_pci_default[NUM_SAA7116_PCI_REGS] = {
/* PCI Memory registers */
/* BITS Type Description */
@@ -630,6 +642,10 @@ static void met_attach(pcici_t tag, int unit)
mtr->rows = 480;
mtr->depth = 2; /* two bytes per pixel */
mtr->frames = 1; /* one frame */
+#ifdef DEVFS
+ mtr->devfs_token = devfs_add_devsw( "/", "meteor", &meteor_cdevsw, unit,
+ DV_CHR, 0, 0, 0600);
+#endif
}
static void
@@ -1265,12 +1281,6 @@ meteor_mmap(dev_t dev, int offset, int nprot)
}
-#ifdef JREMOD
-struct cdevsw meteor_cdevsw =
- { meteor_open, meteor_close, meteor_read, meteor_write, /*67*/
- meteor_ioctl, nostop, nullreset, nodevtotty,/* Meteor */
- seltrue, meteor_mmap, NULL };
-
static meteor_devsw_installed = 0;
static void meteor_drvinit(void *unused)
@@ -1278,23 +1288,12 @@ static void meteor_drvinit(void *unused)
dev_t dev;
if( ! meteor_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&meteor_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&meteor_cdevsw, NULL);
meteor_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "meteor", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(meteordev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,meteor_drvinit,NULL)
-#endif /* JREMOD */
-
#endif /* NMETEOR > 0 */
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c
index d3210d9..9fd6a4a 100644
--- a/sys/scsi/cd.c
+++ b/sys/scsi/cd.c
@@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
- * $Id: cd.c,v 1.46 1995/11/29 10:48:55 julian Exp $
+ * $Id: cd.c,v 1.47 1995/11/29 14:40:51 julian Exp $
*/
#define SPLCD splbio
@@ -31,24 +31,20 @@
#include <sys/uio.h>
#include <sys/malloc.h>
#include <sys/cdio.h>
-
#include <sys/errno.h>
#include <sys/disklabel.h>
-#include <scsi/scsi_all.h>
-#include <scsi/scsi_cd.h>
-#include <scsi/scsi_disk.h> /* rw_big and start_stop come from there */
-#include <scsi/scsiconf.h>
#include <sys/devconf.h>
#include <sys/dkstat.h>
-
-#ifdef JREMOD
#include <sys/kernel.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
-#define CDEV_MAJOR 15
-#define BDEV_MAJOR 6
-#endif /*JREMOD */
+
+#include <scsi/scsi_all.h>
+#include <scsi/scsi_cd.h>
+#include <scsi/scsi_disk.h> /* rw_big and start_stop come from there */
+#include <scsi/scsiconf.h>
+
/* static function prototypes */
static errval cd_get_parms __P((int, int));
@@ -65,6 +61,26 @@ static errval cd_play_tracks __P((u_int32, u_int32, u_int32, u_int32, u_int32));
static errval cd_read_subchannel __P((u_int32, u_int32, u_int32, int, struct cd_sub_channel_info *, u_int32));
static errval cd_getdisklabel __P((u_int8));
+static d_open_t cdopen;
+static d_close_t cdclose;
+static d_ioctl_t cdioctl;
+static d_psize_t cdsize;
+static d_strategy_t cdstrategy;
+
+#define CDEV_MAJOR 15
+#define BDEV_MAJOR 6
+extern struct cdevsw cd_cdevsw;
+struct bdevsw cd_bdevsw =
+ { cdopen, cdclose, cdstrategy, cdioctl, /*6*/
+ nxdump, cdsize, 0, "cd", &cd_cdevsw, -1 };
+
+struct cdevsw cd_cdevsw =
+ { cdopen, cdclose, rawread, nowrite, /*15*/
+ cdioctl, nostop, nullreset, nodevtotty,/* cd */
+ seltrue, nommap, cdstrategy, "cd",
+ &cd_bdevsw, -1 };
+
+
int32 cdstrats, cdqueues;
#define CDUNIT(DEV) ((minor(DEV)&0xF8) >> 3) /* 5 bit unit */
@@ -94,6 +110,12 @@ struct scsi_data {
u_int32 xfer_block_wait;
struct buf_queue_head buf_queue;
int dkunit;
+#ifdef DEVFS
+ void *ra_devfs_token;
+ void *rc_devfs_token;
+ void *a_devfs_token;
+ void *c_devfs_token;
+#endif
};
static int cdunit(dev_t dev) { return CDUNIT(dev); }
@@ -111,18 +133,18 @@ SCSI_DEVICE_ENTRIES(cd)
static struct scsi_device cd_switch =
{
- NULL, /* use default error handler */
- cdstart, /* we have a queue, which is started by this */
- NULL, /* we do not have an async handler */
- NULL, /* use default 'done' routine */
- "cd", /* we are to be refered to by this name */
- 0, /* no device specific flags */
+ NULL, /* use default error handler */
+ cdstart, /* we have a queue, which is started by this */
+ NULL, /* we do not have an async handler */
+ NULL, /* use default 'done' routine */
+ "cd", /* we are to be refered to by this name */
+ 0, /* no device specific flags */
{0, 0},
- 0, /* Link flags */
+ 0, /* Link flags */
cdattach,
"CD-ROM",
cdopen,
- sizeof(struct scsi_data),
+ sizeof(struct scsi_data),
T_READONLY,
cdunit,
cdsetunit,
@@ -183,6 +205,7 @@ cdattach(struct scsi_link *sc_link)
u_int32 unit;
struct cd_parms *dp;
struct scsi_data *cd = sc_link->sd;
+ char name[32];
unit = sc_link->dev_unit;
dp = &(cd->params);
@@ -212,6 +235,29 @@ cdattach(struct scsi_link *sc_link)
cd->flags |= CDINIT;
cd_registerdev(unit);
+#ifdef DEVFS
+#define CD_UID 0
+#define CD_GID 13
+ sprintf(name, "rcd%da",unit);
+ cd->ra_devfs_token = devfs_add_devsw(
+ "/", name, &cd_cdevsw, unit * 8,
+ DV_CHR, CD_UID, CD_GID, 0660);
+
+ sprintf(name, "rcd%dc",unit);
+ cd->rc_devfs_token = devfs_add_devsw(
+ "/", name, &cd_cdevsw, (unit * 8 ) + RAW_PART,
+ DV_CHR, CD_UID, CD_GID, 0600);
+
+ sprintf(name, "cd%da",unit);
+ cd->a_devfs_token = devfs_add_devsw(
+ "/", name, &cd_bdevsw, (unit * 8 ) + 0,
+ DV_BLK, CD_UID, CD_GID, 0660);
+
+ sprintf(name, "cd%dc",unit);
+ cd->c_devfs_token = devfs_add_devsw(
+ "/", name, &cd_bdevsw, (unit * 8 ) + RAW_PART,
+ DV_BLK, CD_UID, CD_GID, 0600);
+#endif
return 0;
}
@@ -1306,47 +1352,21 @@ cdsize(dev_t dev)
return (-1);
}
-#ifdef JREMOD
-struct bdevsw cd_bdevsw =
- { cdopen, cdclose, cdstrategy, cdioctl, /*6*/
- nxdump, cdsize, 0 };
-#endif /*JREMOD*/
-
-#ifdef JREMOD
-struct cdevsw cd_cdevsw =
- { cdopen, cdclose, rawread, nowrite, /*15*/
- cdioctl, nostop, nullreset, nodevtotty,/* cd */
- seltrue, nommap, cdstrategy };
-
static cd_devsw_installed = 0;
static void cd_drvinit(void *unused)
{
dev_t dev;
- dev_t dev_chr;
if( ! cd_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&cd_cdevsw,NULL);
- dev_chr = dev;
-#if defined(BDEV_MAJOR)
- dev = makedev(BDEV_MAJOR,0);
- bdevsw_add(&dev,&cd_bdevsw,NULL);
-#endif /*BDEV_MAJOR*/
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&cd_cdevsw, NULL);
+ dev = makedev(BDEV_MAJOR, 0);
+ bdevsw_add(&dev,&cd_bdevsw, NULL);
cd_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "cd", major(dev_chr), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(cddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cd_drvinit,NULL)
-#endif /* JREMOD */
diff --git a/sys/scsi/ch.c b/sys/scsi/ch.c
index 9724593..360a8c8 100644
--- a/sys/scsi/ch.c
+++ b/sys/scsi/ch.c
@@ -2,7 +2,7 @@
* Written by grefen@convex.com (probably moved by now)
* Based on scsi drivers by Julian Elischer (julian@tfs.com)
*
- * $Id: ch.c,v 1.24 1995/11/29 14:40:54 julian Exp $
+ * $Id: ch.c,v 1.25 1995/12/06 23:44:14 bde Exp $
*/
#include <sys/types.h>
@@ -10,27 +10,23 @@
#include <sys/param.h>
#include <sys/systm.h>
-
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/buf.h>
#include <sys/proc.h>
#include <sys/chio.h>
#include <sys/malloc.h>
-
-#include <scsi/scsi_all.h>
-#include <scsi/scsi_changer.h>
-#include <scsi/scsiconf.h>
-#include <sys/devconf.h>
-
-#ifdef JREMOD
#include <sys/conf.h>
#include <sys/kernel.h>
+#include <sys/devconf.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
-#define CDEV_MAJOR 17
-#endif /*JREMOD*/
+
+#include <scsi/scsi_all.h>
+#include <scsi/scsi_changer.h>
+#include <scsi/scsiconf.h>
+
errval ch_getelem __P((u_int32 unit, short *stat, int type, u_int32 from,
@@ -64,6 +60,9 @@ struct scsi_data {
u_long op_matrix; /* possible opertaions */
u_int16 lsterr; /* details of lasterror */
u_char stor; /* posible Storage locations */
+#ifdef DEVFS
+ void *devfs_token;
+#endif
};
static int chunit(dev_t dev) { return CHUNIT(dev); }
@@ -76,6 +75,16 @@ errval ch_ioctl(dev_t dev, int cmd, caddr_t addr, int flag,
errval ch_close(dev_t dev, int flag, int fmt, struct proc *p,
struct scsi_link *sc_link);
+static d_open_t chopen;
+static d_close_t chclose;
+static d_ioctl_t chioctl;
+
+#define CDEV_MAJOR 17
+struct cdevsw ch_cdevsw =
+ { chopen, chclose, noread, nowrite, /*17*/
+ chioctl, nostop, nullreset, nodevtotty,/* ch */
+ noselect, nommap, nostrat, "ch", NULL, -1 };
+
SCSI_DEVICE_ENTRIES(ch)
struct scsi_device ch_switch =
@@ -139,6 +148,7 @@ errval
chattach(struct scsi_link *sc_link)
{
u_int32 unit;
+ char name[32];
struct scsi_data *ch = sc_link->sd;
@@ -157,6 +167,11 @@ chattach(struct scsi_link *sc_link)
}
ch_registerdev(unit);
+#ifdef DEVFS
+ sprintf(name,"ch%d",unit);
+ ch->devfs_token = devfs_add_devsw( "/", name, &ch_cdevsw, unit << 4,
+ DV_CHR, 0, 0, 0600);
+#endif
return 0;
}
@@ -511,11 +526,6 @@ ch_mode_sense(unit, flags)
return (0);
}
-#ifdef JREMOD
-struct cdevsw ch_cdevsw =
- { chopen, chclose, noread, nowrite, /*17*/
- chioctl, nostop, nullreset, nodevtotty,/* ch */
- noselect, nommap, nostrat };
static ch_devsw_installed = 0;
@@ -524,22 +534,12 @@ static void ch_drvinit(void *unused)
dev_t dev;
if( ! ch_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&ch_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&ch_cdevsw, NULL);
ch_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "ch", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(chdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,ch_drvinit,NULL)
-#endif /* JREMOD */
diff --git a/sys/scsi/od.c b/sys/scsi/od.c
index 3137a51..568d343 100644
--- a/sys/scsi/od.c
+++ b/sys/scsi/od.c
@@ -28,7 +28,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: od.c,v 1.4 1995/11/29 10:48:57 julian Exp $
+ * $Id: od.c,v 1.5 1995/11/29 14:40:57 julian Exp $
*/
/*
@@ -53,6 +53,9 @@
#include <sys/dkstat.h>
#include <sys/disklabel.h>
#include <sys/diskslice.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <scsi/scsi_all.h>
#include <scsi/scsi_disk.h>
#include <scsi/scsiconf.h>
@@ -60,15 +63,7 @@
#include <sys/devconf.h>
#include <sys/dkstat.h>
#include <machine/md_var.h>
-#include <i386/i386/cons.h> /* XXX */
-#ifdef JREMOD
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 70
-#define BDEV_MAJOR 20
-#endif /*JREMOD */
u_int32 odstrats, odqueues;
@@ -103,6 +98,10 @@ struct scsi_data {
struct diskslices *dk_slices; /* virtual drives */
struct buf_queue_head buf_queue;
int dkunit; /* disk stats unit number */
+#ifdef DEVFS
+ void *b_devfs_token; /*eventually move to common disk struct */
+ void *c_devfs_token; /*eventually move to common disk struct */
+#endif
};
static int odunit(dev_t dev) { return ODUNIT(dev); }
@@ -116,6 +115,28 @@ errval od_close __P((dev_t dev, int fflag, int fmt, struct proc *p,
struct scsi_link *sc_link));
void od_strategy(struct buf *bp, struct scsi_link *sc_link);
+static d_open_t odopen;
+static d_close_t odclose;
+static d_ioctl_t odioctl;
+static d_psize_t odsize;
+static d_strategy_t odstrategy;
+
+#define CDEV_MAJOR 70
+#define BDEV_MAJOR 20
+extern struct cdevsw od_cdevsw;
+struct bdevsw od_bdevsw =
+ { odopen, odclose, odstrategy, odioctl, /*20*/
+ nxdump, odsize, 0, "od", &od_cdevsw, -1 };
+
+struct cdevsw od_cdevsw =
+ { odopen, odclose, rawread, rawwrite, /*70*/
+ odioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, odstrategy, "od",
+ &od_bdevsw, -1 };
+
+/*
+ * Actually include the interface routines
+ */
SCSI_DEVICE_ENTRIES(od)
struct scsi_device od_switch =
@@ -188,6 +209,7 @@ odattach(struct scsi_link *sc_link)
{
u_int32 unit;
struct disk_parms *dp;
+ char name[32];
struct scsi_data *od = sc_link->sd;
@@ -231,6 +253,15 @@ odattach(struct scsi_link *sc_link)
od->flags |= ODINIT;
od_registerdev(unit);
+#ifdef DEVFS
+/* FIX PROPERLY WHEN DISKSLICE CODE IS UNDERSTOOD */
+ sprintf(name, "rod%d", unit);
+ od->c_devfs_token = devfs_add_devsw( "/", name, &od_cdevsw, 0,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name, "od%d", unit);
+ od->b_devfs_token = devfs_add_devsw( "/", name, &od_bdevsw, 0,
+ DV_BLK, 0, 0, 0600);
+#endif
return 0;
}
@@ -806,45 +837,21 @@ od_sense_handler(struct scsi_xfer *xs)
return SCSIRET_DO_RETRY;
}
-#ifdef JREMOD
-struct bdevsw od_bdevsw =
- { odopen, odclose, odstrategy, odioctl, /*20*/
- nxdump, odsize, 0 };
-
-struct cdevsw od_cdevsw =
- { odopen, odclose, rawread, rawwrite, /*70*/
- odioctl, nostop, nullreset, nodevtotty,/* od */
- seltrue, nommap, odstrategy };
-
static od_devsw_installed = 0;
static void od_drvinit(void *unused)
{
dev_t dev;
- dev_t dev_chr;
if( ! od_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&od_cdevsw,NULL);
- dev_chr = dev;
- dev = makedev(BDEV_MAJOR,0);
- bdevsw_add(&dev,&od_bdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&od_cdevsw, NULL);
+ dev = makedev(BDEV_MAJOR, 0);
+ bdevsw_add(&dev,&od_bdevsw, NULL);
od_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "rod", major(dev_chr), 0, DV_CHR, 0, 0, 0600);
- x=devfs_add_devsw(
- "/", "od", major(dev), 0, DV_BLK, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(oddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,od_drvinit,NULL)
-#endif /* JREMOD */
diff --git a/sys/scsi/pt.c b/sys/scsi/pt.c
index 75eb13b..12fa2fb 100644
--- a/sys/scsi/pt.c
+++ b/sys/scsi/pt.c
@@ -37,7 +37,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: pt.c,v 1.7 1995/11/29 10:48:59 julian Exp $
+ * $Id: pt.c,v 1.8 1995/11/29 14:40:59 julian Exp $
*/
/*
@@ -50,17 +50,14 @@
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/proc.h>
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-
-#ifdef JREMOD
#include <sys/conf.h>
#include <sys/kernel.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
-#define CDEV_MAJOR 61
-#endif /*JREMOD*/
+#include <scsi/scsi_all.h>
+#include <scsi/scsiconf.h>
+
struct scsi_data {
struct buf_queue_head buf_queue;
@@ -70,8 +67,20 @@ void ptstart(u_int32 unit, u_int32 flags);
void pt_strategy(struct buf *bp, struct scsi_link *sc_link);
int pt_sense(struct scsi_xfer *scsi_xfer);
+static d_open_t ptopen;
+static d_close_t ptclose;
+static d_ioctl_t ptioctl;
+static d_strategy_t ptstrategy;
+
+#define CDEV_MAJOR 61
+struct cdevsw pt_cdevsw =
+ { ptopen, ptclose, rawread, rawwrite, /*61*/
+ ptioctl, nostop, nullreset, nodevtotty,/* pt */
+ seltrue, nommap, ptstrategy, "pt", NULL, -1 };
+
SCSI_DEVICE_ENTRIES(pt)
+
struct scsi_device pt_switch =
{
pt_sense,
@@ -259,12 +268,6 @@ int pt_sense(struct scsi_xfer *xs)
}
}
-#ifdef JREMOD
-struct cdevsw pt_cdevsw =
- { ptopen, ptclose, rawread, rawwrite, /*61*/
- ptioctl, nostop, nullreset, nodevtotty,/* pt */
- seltrue, nommap, ptstrategy };
-
static pt_devsw_installed = 0;
static void pt_drvinit(void *unused)
@@ -272,16 +275,16 @@ static void pt_drvinit(void *unused)
dev_t dev;
if( ! pt_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&pt_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&pt_cdevsw, NULL);
pt_devsw_installed = 1;
#ifdef DEVFS
{
- int x;
+ void *x;
/* default for a simple device with no probe routine (usually delete this) */
x=devfs_add_devsw(
/* path name devsw minor type uid gid perm*/
- "/", "pt", major(dev), 0, DV_CHR, 0, 0, 0600);
+ "/", "pt", &pt_cdevsw, 0, DV_CHR, 0, 0, 0600);
}
#endif
}
@@ -289,5 +292,4 @@ static void pt_drvinit(void *unused)
SYSINIT(ptdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,pt_drvinit,NULL)
-#endif /* JREMOD */
diff --git a/sys/scsi/sctarg.c b/sys/scsi/sctarg.c
index 42592eb..de3e748 100644
--- a/sys/scsi/sctarg.c
+++ b/sys/scsi/sctarg.c
@@ -1,5 +1,5 @@
/*
- * sctarg: Processor Type driver.
+ * sctarg: Target mode user interface
*
* Copyright (C) 1995, HD Associates, Inc.
* PO Box 276
@@ -37,7 +37,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: sctarg.c,v 1.7 1995/11/29 10:49:01 julian Exp $
+ * $Id: sctarg.c,v 1.8 1995/11/29 14:41:00 julian Exp $
*/
/*
@@ -50,17 +50,14 @@
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/proc.h>
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-
-#ifdef JREMOD
#include <sys/conf.h>
#include <sys/kernel.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
-#define CDEV_MAJOR 65
-#endif /*JREMOD*/
+#include <scsi/scsi_all.h>
+#include <scsi/scsiconf.h>
+
#define OPEN 0x01
@@ -76,6 +73,17 @@ errval sctarg_close(dev_t dev, int flag, int fmt, struct proc *p,
struct scsi_link *sc_link);
void sctarg_strategy(struct buf *bp, struct scsi_link *sc_link);
+static d_open_t sctargopen;
+static d_close_t sctargclose;
+static d_ioctl_t sctargioctl;
+static d_strategy_t sctargstrategy;
+
+#define CDEV_MAJOR 65
+struct cdevsw sctarg_cdevsw =
+ { sctargopen, sctargclose, rawread, rawwrite, /*65*/
+ sctargioctl, nostop, nullreset, nodevtotty,/* sctarg */
+ seltrue, nommap, sctargstrategy, "sctarg", NULL, -1 };
+
SCSI_DEVICE_ENTRIES(sctarg)
struct scsi_device sctarg_switch =
@@ -276,35 +284,25 @@ sctarg_strategy(struct buf *bp, struct scsi_link *sc_link)
return;
}
-#ifdef JREMOD
-struct cdevsw sctarg_cdevsw =
- { sctargopen, sctargclose, rawread, rawwrite, /*65*/
- sctargioctl, nostop, nullreset, nodevtotty,/* sctarg */
- seltrue, nommap, sctargstrategy };
-
static sctarg_devsw_installed = 0;
static void sctarg_drvinit(void *unused)
{
dev_t dev;
+ void *x;
if( ! sctarg_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&sctarg_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&sctarg_cdevsw, NULL);
sctarg_devsw_installed = 1;
#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "sctarg", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
+ /* XXX should be in ADAPTER code */
+ x=devfs_add_devsw( "/scsi", "sctarg", &sctarg_cdevsw, 0,
+ DV_CHR, 0, 0, 0600);
#endif
}
}
SYSINIT(sctargdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,sctarg_drvinit,NULL)
-#endif /* JREMOD */
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index 7b5e106..fa70096 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992
*
- * $Id: sd.c,v 1.74 1995/11/29 14:41:02 julian Exp $
+ * $Id: sd.c,v 1.75 1995/12/07 12:47:48 davidg Exp $
*/
#define SPLSD splbio
@@ -30,6 +30,10 @@
#include <sys/dkstat.h>
#include <sys/errno.h>
#include <sys/malloc.h>
+#include <sys/conf.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <scsi/scsi_all.h>
#include <scsi/scsi_disk.h>
@@ -39,17 +43,7 @@
#include <vm/vm_param.h>
#include <vm/pmap.h>
#include <machine/md_var.h>
-#include <i386/i386/cons.h> /* XXX */
-
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 13
-#define BDEV_MAJOR 4
-#endif /*JREMOD */
+#include <i386/i386/cons.h> /* XXX *//* for aborting dump */
u_int32 sdstrats, sdqueues;
@@ -84,6 +78,10 @@ struct scsi_data {
struct diskslices *dk_slices; /* virtual drives */
struct buf_queue_head buf_queue;
int dkunit; /* disk stats unit number */
+#ifdef DEVFS
+ void *c_devfs_token;
+ void *b_devfs_token;
+#endif
};
static int sdunit(dev_t dev) { return SDUNIT(dev); }
@@ -97,6 +95,27 @@ static errval sd_close __P((dev_t dev, int fflag, int fmt, struct proc *p,
struct scsi_link *sc_link));
static void sd_strategy(struct buf *bp, struct scsi_link *sc_link);
+static d_open_t sdopen;
+static d_close_t sdclose;
+static d_ioctl_t sdioctl;
+static d_dump_t sddump;
+static d_psize_t sdsize;
+static d_strategy_t sdstrategy;
+
+#define CDEV_MAJOR 13
+#define BDEV_MAJOR 4
+extern struct cdevsw sd_cdevsw; /* hold off the complaints for a second */
+struct bdevsw sd_bdevsw =
+ { sdopen, sdclose, sdstrategy, sdioctl, /*4*/
+ sddump, sdsize, 0, "sd", &sd_cdevsw, -1 };
+
+struct cdevsw sd_cdevsw =
+ { sdopen, sdclose, rawread, rawwrite, /*13*/
+ sdioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, sdstrategy, "sd",
+ &sd_bdevsw, -1 };
+
+
SCSI_DEVICE_ENTRIES(sd)
static struct scsi_device sd_switch =
@@ -169,6 +188,7 @@ sdattach(struct scsi_link *sc_link)
{
u_int32 unit;
struct disk_parms *dp;
+ char name[32];
struct scsi_data *sd = sc_link->sd;
@@ -209,6 +229,15 @@ sdattach(struct scsi_link *sc_link)
sd->flags |= SDINIT;
sd_registerdev(unit);
+#ifdef DEVFS
+/* Fix minor numbers */
+ sprintf(name,"rsd%d",unit);
+ sd->c_devfs_token = devfs_add_devsw( "/", name, &sd_cdevsw, 0,
+ DV_CHR, 0, 0, 0600);
+ sprintf(name,"sd%d",unit);
+ sd->b_devfs_token = devfs_add_devsw( "/", name, &sd_bdevsw, 0,
+ DV_BLK, 0, 0, 0600);
+#endif
return 0;
}
@@ -963,45 +992,20 @@ sddump(dev_t dev)
return (0);
}
-#ifdef JREMOD
-struct bdevsw sd_bdevsw =
- { sdopen, sdclose, sdstrategy, sdioctl, /*4*/
- sddump, sdsize, 0 };
-
-struct cdevsw sd_cdevsw =
- { sdopen, sdclose, rawread, rawwrite, /*13*/
- sdioctl, nostop, nullreset, nodevtotty,/* sd */
- seltrue, nommap, sdstrategy };
-
static sd_devsw_installed = 0;
static void sd_drvinit(void *unused)
{
dev_t dev;
- dev_t dev_chr;
if( ! sd_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&sd_cdevsw,NULL);
- dev_chr = dev;
- dev = makedev(BDEV_MAJOR,0);
- bdevsw_add(&dev,&sd_bdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&sd_cdevsw, NULL);
+ dev = makedev(BDEV_MAJOR, 0);
+ bdevsw_add(&dev,&sd_bdevsw, NULL);
sd_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "rsd", major(dev_chr), 0, DV_CHR, 0, 0, 0600);
- x=devfs_add_devsw(
- "/", "sd", major(dev), 0, DV_BLK, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(sddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,sd_drvinit,NULL)
-#endif /* JREMOD */
-
diff --git a/sys/scsi/ssc.c b/sys/scsi/ssc.c
index d94def1..2a0988b 100644
--- a/sys/scsi/ssc.c
+++ b/sys/scsi/ssc.c
@@ -49,38 +49,49 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*End copyright
- * $Id: ssc.c,v 1.6 1995/11/29 14:41:03 julian Exp $
+ * $Id: ssc.c,v 1.7 1995/12/05 19:36:33 bde Exp $
*/
#include <sys/types.h>
+#include <sys/param.h>
#include <sys/conf.h>
-#include <scsi/scsiconf.h>
#include <sys/scsiio.h>
-
+#include <sys/kernel.h>
#include <sys/errno.h>
#include <sys/stat.h>
-#include <sys/param.h>
#include <sys/buf.h>
#include <sys/systm.h>
-
-#ifdef JREMOD
-#include <sys/kernel.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
+#include <scsi/scsiconf.h>
+
+static d_open_t sscopen;
+static d_close_t sscclose;
+static d_ioctl_t sscioctl;
+
+extern d_open_t suopen;
+extern d_close_t suclose;
+extern d_ioctl_t suioctl;
+
#define CDEV_MAJOR 49
-#endif /*JREMOD*/
+struct cdevsw ssc_cdevsw =
+ { sscopen, sscclose, noread, nowrite, /*49*/
+ sscioctl, nostop, nullreset, nodevtotty,
+ noselect, nxmmap, nostrategy, "ssc", NULL, -1 };
static dev_t sscdev = NODEV;
-int sscopen(dev_t dev, int flag, int type, struct proc *p)
+static int
+sscopen(dev_t dev, int flag, int type, struct proc *p)
{
if (sscdev != NODEV)
return suopen(sscdev, flag, type, p);
return 0;
}
-int sscclose(dev_t dev, int fflag, int type, struct proc *p)
+static int
+sscclose(dev_t dev, int fflag, int type, struct proc *p)
{
if (sscdev != NODEV)
@@ -88,7 +99,8 @@ int sscclose(dev_t dev, int fflag, int type, struct proc *p)
return 0;
}
-int sscioctl(dev_t dev, int cmd, caddr_t data, int fflag, struct proc *p)
+static int
+sscioctl(dev_t dev, int cmd, caddr_t data, int fflag, struct proc *p)
{
if (cmd == SCIOCADDR)
{
@@ -121,42 +133,25 @@ int sscioctl(dev_t dev, int cmd, caddr_t data, int fflag, struct proc *p)
* good reason other than I'm not sure how you would use them.
*/
-
-#ifdef JREMOD
-struct cdevsw ssc_cdevsw =
- { sscopen, sscclose, noread, nowrite, /*49*/
- sscioctl, nostop, nullreset, nodevtotty,/* scsi super */
- noselect, nommap, nostrategy };
-
static ssc_devsw_installed = 0;
+static void *ssc_devfs_token;
-static void ssc_drvinit(void *unused)
+static void
+ssc_drvinit(void *unused)
{
dev_t dev;
- dev_t dev_chr;
if( ! ssc_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&ssc_cdevsw,NULL);
- dev_chr = dev;
-#if defined(BDEV_MAJOR)
- dev = makedev(BDEV_MAJOR,0);
- bdevsw_add(&dev,&ssc_bdevsw,NULL);
-#endif /*BDEV_MAJOR*/
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&ssc_cdevsw, NULL);
ssc_devsw_installed = 1;
#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "ssc", major(dev_chr), 0, DV_CHR, 0, 0, 0600);
- }
+ ssc_devfs_token = devfs_add_devsw(
+ "/scsi", "ssc", &ssc_cdevsw, 0,
+ DV_CHR, 0, 0, 0600);
#endif
}
}
SYSINIT(sscdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,ssc_drvinit,NULL)
-#endif /* JREMOD */
-
diff --git a/sys/scsi/st.c b/sys/scsi/st.c
index 4dc59c5..86cb8c6 100644
--- a/sys/scsi/st.c
+++ b/sys/scsi/st.c
@@ -12,7 +12,7 @@
* on the understanding that TFS is not responsible for the correct
* functioning of this software in any circumstances.
*
- * $Id: st.c,v 1.47 1995/11/30 07:43:47 pst Exp $
+ * $Id: st.c,v 1.48 1995/12/06 23:44:23 bde Exp $
*/
/*
@@ -39,21 +39,17 @@
#include <sys/buf.h>
#include <sys/proc.h>
#include <sys/mtio.h>
+#include <sys/conf.h>
+#include <sys/kernel.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
#include <scsi/scsi_all.h>
#include <scsi/scsi_tape.h>
#include <scsi/scsiconf.h>
#include <sys/devconf.h>
-#ifdef JREMOD
-#include <sys/conf.h>
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
-#define CDEV_MAJOR 14
-#define BDEV_MAJOR 5
-#endif /*JREMOD */
/* Defines for device specific stuff */
@@ -229,6 +225,30 @@ struct scsi_data {
struct buf_queue_head buf_queue;
struct scsi_xfer scsi_xfer; /* scsi xfer struct for this drive */
u_int32 xfer_block_wait; /* is a process waiting? */
+#ifdef DEVFS
+ struct {
+ void *rst;
+ void *nrst;
+ void *enrst;
+ /* end of aliases */
+ void *rst_0;
+ void *nrst_0;
+ void *enrst_0;
+ void *ctl_0;
+ void *rst_1;
+ void *nrst_1;
+ void *enrst_1;
+ void *ctl_1;
+ void *rst_2;
+ void *nrst_2;
+ void *enrst_2;
+ void *ctl_2;
+ void *rst_3;
+ void *nrst_3;
+ void *enrst_3;
+ void *ctl_3;
+ } devfs_token;
+#endif
};
static int stunit(dev_t dev) { return STUNIT(dev); }
@@ -242,6 +262,22 @@ static errval st_close(dev_t dev, int flag, int fmt, struct proc *p,
struct scsi_link *sc_link);
static void st_strategy(struct buf *bp, struct scsi_link *sc_link);
+d_open_t stopen;
+d_close_t stclose;
+d_ioctl_t stioctl;
+d_strategy_t ststrategy;
+
+#define CDEV_MAJOR 14
+#define BDEV_MAJOR 5
+struct bdevsw st_bdevsw =
+ { stopen, stclose, ststrategy, stioctl, /*5*/
+ nxdump, zerosize, 0 };
+
+struct cdevsw st_cdevsw =
+ { stopen, stclose, rawread, rawwrite, /*14*/
+ stioctl, nostop, nullreset, nodevtotty,/* st */
+ seltrue, nommap, ststrategy };
+
SCSI_DEVICE_ENTRIES(st)
static struct scsi_device st_switch =
@@ -325,10 +361,11 @@ st_registerdev(int unit)
* a device suitable for this driver
*/
-errval
+static errval
stattach(struct scsi_link *sc_link)
{
u_int32 unit;
+ char name[32];
struct scsi_data *st = sc_link->sd;
@@ -371,7 +408,81 @@ stattach(struct scsi_link *sc_link)
*/
st->flags |= ST_INITIALIZED;
st_registerdev(unit);
-
+#ifdef DEVFS
+#define ST_GID 13
+#define ST_UID 0
+ sprintf(name,"rst%d.0",unit);
+ st->devfs_token.rst_0 = devfs_add_devsw( "/tape", name,
+ &st_cdevsw, (unit << 4 ) + 0,
+ DV_CHR, ST_UID, ST_GID, 0660 );
+ sprintf(name,"nrst%d.0",unit);
+ st->devfs_token.nrst_0 = devfs_add_devsw( "/tape", name,
+ &st_cdevsw, (unit << 4 ) + 1,
+ DV_CHR, ST_UID, ST_GID, 0660 );
+ sprintf(name,"enrst%d.0",unit);
+ st->devfs_token.enrst_0 = devfs_add_devsw( "/tape", name,
+ &st_cdevsw, (unit << 4 ) + 2,
+ DV_CHR, ST_UID, ST_GID, 0660 );
+ sprintf(name,"st%dctl.0",unit);
+ st->devfs_token.ctl_0 = devfs_add_devsw( "/tape", name,
+ &st_cdevsw, (unit << 4 ) + 3,
+ DV_CHR, ST_UID, ST_GID, 0600 );
+ sprintf(name,"rst%d.1",unit);
+ st->devfs_token.rst_1 = devfs_add_devsw( "/tape", name,
+ &st_cdevsw, (unit << 4 ) + 4,
+ DV_CHR, ST_UID, ST_GID, 0660 );
+ sprintf(name,"nrst%d.1",unit);
+ st->devfs_token.nrst_1 = devfs_add_devsw( "/tape", name,
+ &st_cdevsw, (unit << 4 ) + 5,
+ DV_CHR, ST_UID, ST_GID, 0660 );
+ sprintf(name,"enrst%d.1",unit);
+ st->devfs_token.enrst_1 = devfs_add_devsw( "/tape", name,
+ &st_cdevsw, (unit << 4 ) + 6,
+ DV_CHR, ST_UID, ST_GID, 0660 );
+ sprintf(name,"st%dctl.1",unit);
+ st->devfs_token.ctl_1 = devfs_add_devsw( "/tape", name,
+ &st_cdevsw, (unit << 4 ) + 7,
+ DV_CHR, ST_UID, ST_GID, 0600 );
+ sprintf(name,"rst%d.2",unit);
+ st->devfs_token.rst_2 = devfs_add_devsw( "/tape", name,
+ &st_cdevsw, (unit << 4 ) + 8,
+ DV_CHR, ST_UID, ST_GID, 0660 );
+ sprintf(name,"nrst%d.2",unit);
+ st->devfs_token.nrst_2 = devfs_add_devsw( "/tape", name,
+ &st_cdevsw, (unit << 4 ) + 9,
+ DV_CHR, ST_UID, ST_GID, 0660 );
+ sprintf(name,"enrst%d.2",unit);
+ st->devfs_token.enrst_2 = devfs_add_devsw( "/tape", name,
+ &st_cdevsw, (unit << 4 ) + 10,
+ DV_CHR, ST_UID, ST_GID, 0660 );
+ sprintf(name,"st%dctl.2",unit);
+ st->devfs_token.ctl_2 = devfs_add_devsw( "/tape", name,
+ &st_cdevsw, (unit << 4 ) + 11,
+ DV_CHR, ST_UID, ST_GID, 0600 );
+ sprintf(name,"rst%d.3",unit);
+ st->devfs_token.rst_3 = devfs_add_devsw( "/tape", name,
+ &st_cdevsw, (unit << 4 ) + 12,
+ DV_CHR, ST_UID, ST_GID, 0660 );
+ sprintf(name,"nrst%d.3",unit);
+ st->devfs_token.nrst_3 = devfs_add_devsw( "/tape", name,
+ &st_cdevsw, (unit << 4 ) + 13,
+ DV_CHR, ST_UID, ST_GID, 0660 );
+ sprintf(name,"enrst%d.3",unit);
+ st->devfs_token.enrst_3 = devfs_add_devsw( "/tape", name,
+ &st_cdevsw, (unit << 4 ) + 14,
+ DV_CHR, ST_UID, ST_GID, 0660 );
+ sprintf(name,"st%dctl.3",unit);
+ st->devfs_token.ctl_3 = devfs_add_devsw( "/tape", name,
+ &st_cdevsw, (unit << 4 ) + 15,
+ DV_CHR, ST_UID, ST_GID, 0600 );
+ /** add links **/
+ sprintf(name,"rst%d",unit);
+ st->devfs_token.rst = dev_link( "/", name, st->devfs_token.rst_0);
+ sprintf(name,"nrst%d",unit);
+ st->devfs_token.nrst = dev_link( "/", name, st->devfs_token.nrst_0);
+ sprintf(name,"enrst%d",unit);
+ st->devfs_token.enrst = dev_link( "/", name, st->devfs_token.enrst_0);
+#endif
return 0;
}
@@ -380,7 +491,7 @@ stattach(struct scsi_link *sc_link)
* Use the inquiry routine in 'scsi_base' to get drive info so we can
* Further tailor our behaviour.
*/
-void
+static void
st_identify_drive(unit)
u_int32 unit;
{
@@ -458,7 +569,7 @@ st_identify_drive(unit)
* this will remove any setting made by the system operator or previous
* operations.
*/
-void
+static void
st_loadquirks(sc_link)
struct scsi_link *sc_link;
{
@@ -513,7 +624,7 @@ st_loadquirks(sc_link)
/*
* open the device.
*/
-errval
+static errval
st_open(dev_t dev, int flags, int fmt, struct proc *p,
struct scsi_link *sc_link)
{
@@ -599,7 +710,7 @@ struct scsi_link *sc_link)
* close the device.. only called if we are the LAST
* occurence of an open device
*/
-errval
+static errval
st_close(dev_t dev, int flag, int fmt, struct proc *p,
struct scsi_link *sc_link)
{
@@ -636,7 +747,7 @@ st_close(dev_t dev, int flag, int fmt, struct proc *p,
* Copy in all the default parameters from the selected device mode.
* and try guess any that seem to be defaulted.
*/
-errval
+static errval
st_mount_tape(dev, flags)
dev_t dev;
u_int32 flags;
@@ -766,7 +877,7 @@ st_unmount(int unit, boolean eject)
* initial operation, make a decision as to how we should be set
* to run (regarding blocking and EOD marks)
*/
-errval
+static errval
st_decide_mode(unit, first_read)
u_int32 unit;
boolean first_read;
@@ -904,7 +1015,7 @@ done:
* The transfer is described by a buf and will include
* only one physical transfer.
*/
-void
+static void
st_strategy(struct buf *bp, struct scsi_link *sc_link)
{
u_int32 unit;
@@ -1003,7 +1114,7 @@ done:
* continues to be drained.
* ststart() is called at splbio
*/
-void
+static void
ststart(unit, flags)
u_int32 unit;
u_int32 flags;
@@ -1133,7 +1244,7 @@ badnews:
* Perform special action on behalf of the user;
* knows about the internals of this device
*/
-errval
+static errval
st_ioctl(dev_t dev, int cmd, caddr_t arg, int flag,
struct proc *p, struct scsi_link *sc_link)
{
@@ -1364,7 +1475,7 @@ st_read(unit, buf, size, flags)
/*
* Ask the drive what it's min and max blk sizes are.
*/
-errval
+static errval
st_rd_blk_lim(unit, flags)
u_int32 unit, flags;
{
@@ -1506,7 +1617,7 @@ st_mode_sense(unit, flags, page, pagelen, pagecode)
* Send a filled out parameter structure to the drive to
* set it into the desire modes etc.
*/
-errval
+static errval
st_mode_select(unit, flags, page, pagelen)
u_int32 unit, flags;
struct tape_pages *page;
@@ -1573,7 +1684,8 @@ static int noisy_st = 0;
* Set the compression mode of the drive to on (1) or off (0) *
still doesn't work! grrr!
\***************************************************************/
-errval st_comp(unit,mode)
+static errval
+st_comp(unit,mode)
u_int32 unit,mode;
{
struct tape_pages page;
@@ -1621,7 +1733,7 @@ u_int32 unit,mode;
/*
* skip N blocks/filemarks/seq filemarks/eom
*/
-errval
+static errval
st_space(unit, number, what, flags)
u_int32 unit, what, flags;
int32 number;
@@ -1706,7 +1818,7 @@ st_space(unit, number, what, flags)
/*
* write N filemarks
*/
-errval
+static errval
st_write_filemarks(unit, number, flags)
u_int32 unit, flags;
int32 number;
@@ -1758,7 +1870,7 @@ st_write_filemarks(unit, number, flags)
* nmarks returns the number of marks to skip (or, if position
* true, which were skipped) to get back original position.
*/
-int32
+static int32
st_chkeod(unit, position, nmarks, flags)
u_int32 unit;
boolean position;
@@ -1788,7 +1900,7 @@ st_chkeod(unit, position, nmarks, flags)
/*
* load/unload (with retension if true)
*/
-errval
+static errval
st_load(unit, type, flags)
u_int32 unit, type, flags;
{
@@ -1824,7 +1936,7 @@ st_load(unit, type, flags)
/*
* Rewind the device
*/
-errval
+static errval
st_rewind(unit, immed, flags)
u_int32 unit, flags;
boolean immed;
@@ -1856,7 +1968,7 @@ st_rewind(unit, immed, flags)
/*
** Erase the device
*/
-errval
+static errval
st_erase(unit, immed, flags)
u_int32 unit, flags;
boolean immed;
@@ -1900,7 +2012,7 @@ st_erase(unit, immed, flags)
* The unix error number to pass back... (0 = report no error)
* (SCSIRET_CONTINUE = continue processing)
*/
-errval
+static errval
st_interpret_sense(xs)
struct scsi_xfer *xs;
{
@@ -2039,7 +2151,7 @@ st_interpret_sense(xs)
* The rest of the code for this quirk is in ILI processing and BLANK CHECK
* error processing, both part of st_interpret_sense.
*/
-errval
+static errval
st_touch_tape(unit)
u_int32 unit;
{
@@ -2079,43 +2191,22 @@ bad: free(buf, M_TEMP);
return 0;
}
-#ifdef JREMOD
-struct bdevsw st_bdevsw =
- { stopen, stclose, ststrategy, stioctl, /*5*/
- nxdump, zerosize, 0 };
-
-struct cdevsw st_cdevsw =
- { stopen, stclose, rawread, rawwrite, /*14*/
- stioctl, nostop, nullreset, nodevtotty,/* st */
- seltrue, nommap, ststrategy };
-
static st_devsw_installed = 0;
-static void st_drvinit(void *unused)
+static void
+st_drvinit(void *unused)
{
dev_t dev;
- dev_t dev_chr;
if( ! st_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&st_cdevsw,NULL);
- dev_chr = dev;
- dev = makedev(BDEV_MAJOR,0);
- bdevsw_add(&dev,&st_bdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&st_cdevsw, NULL);
+ dev = makedev(BDEV_MAJOR, 0);
+ bdevsw_add(&dev,&st_bdevsw, NULL);
st_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "rst", major(dev_chr), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(stdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,st_drvinit,NULL)
-#endif /* JREMOD */
diff --git a/sys/scsi/su.c b/sys/scsi/su.c
index a7dac94..1bbefa1 100644
--- a/sys/scsi/su.c
+++ b/sys/scsi/su.c
@@ -44,27 +44,41 @@
* SUCH DAMAGE.
*End copyright
*
- * $Id: su.c,v 1.7 1995/11/29 10:49:06 julian Exp $
+ * $Id: su.c,v 1.8 1995/11/29 14:41:06 julian Exp $
*
* Tabstops 4
+ * XXX devfs entries for this device should be handled by generic scsiconfig
+ * Add a bdevsw interface.. ?
*/
#include <sys/types.h>
#include <sys/conf.h>
-#include <scsi/scsiconf.h>
#include <sys/errno.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <sys/buf.h>
#include <sys/systm.h>
-
-#ifdef JREMOD
#include <sys/kernel.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
+#include <scsi/scsiconf.h>
#define CDEV_MAJOR 18
-#endif /*JREMOD*/
+
+
+ d_open_t suopen; /* these three used by ssc */
+ d_close_t suclose;
+ d_ioctl_t suioctl;
+static d_read_t suread;
+static d_write_t suwrite;
+static d_select_t suselect;
+static d_strategy_t sustrategy;
+
+struct cdevsw su_cdevsw =
+ { suopen, suclose, suread, suwrite, /*18*/
+ suioctl, nostop, nullreset, nodevtotty,/* scsi */
+ suselect, nxmmap, sustrategy, "su", NULL, -1 };
+
/* Build an old style device number (unit encoded in the minor number)
* from a base old one (no flag bits) and a full new one
@@ -88,7 +102,10 @@ static struct bdevsw bnxio = {
nxioctl,
nxdump,
nxpsize,
- 0
+ 0,
+ "NON",
+ NULL,
+ -1
};
static struct cdevsw cnxio = {
@@ -102,7 +119,10 @@ static struct cdevsw cnxio = {
nxdevtotty,
nxselect,
nxmmap,
- nxstrategy
+ nxstrategy,
+ "NON",
+ NULL,
+ -1
};
/* getsws: Look up the base dev switch for a given "by minor number" style
@@ -192,7 +212,8 @@ suopen(dev_t dev, int flag, int type, struct proc *p)
return (*bdev->d_open)(base, flag, S_IFBLK, p);
}
-int suclose(dev_t dev, int fflag, int type, struct proc *p)
+int
+suclose(dev_t dev, int fflag, int type, struct proc *p)
{
struct cdevsw *cdev;
struct bdevsw *bdev;
@@ -206,7 +227,8 @@ int suclose(dev_t dev, int fflag, int type, struct proc *p)
return (*bdev->d_open)(base, fflag, S_IFBLK, p);
}
-void sustrategy(struct buf *bp)
+static void
+sustrategy(struct buf *bp)
{
dev_t base;
struct bdevsw *bdev;
@@ -224,7 +246,8 @@ void sustrategy(struct buf *bp)
bp->b_dev = dev;
}
-int suioctl(dev_t dev, int cmd, caddr_t data, int fflag, struct proc *p)
+int
+suioctl(dev_t dev, int cmd, caddr_t data, int fflag, struct proc *p)
{
struct cdevsw *cdev;
dev_t base;
@@ -237,7 +260,8 @@ int suioctl(dev_t dev, int cmd, caddr_t data, int fflag, struct proc *p)
return (*cdev->d_ioctl)(base, cmd, data, fflag, p);
}
-int sudump(dev_t dev)
+static int
+sudump(dev_t dev)
{
dev_t base;
struct bdevsw *bdev;
@@ -247,7 +271,8 @@ int sudump(dev_t dev)
return (*bdev->d_dump)(base);
}
-int supsize(dev_t dev)
+static int
+supsize(dev_t dev)
{
dev_t base;
struct bdevsw *bdev;
@@ -257,7 +282,8 @@ int supsize(dev_t dev)
return (*bdev->d_psize)(base);
}
-int suread(dev_t dev, struct uio *uio, int ioflag)
+static int
+suread(dev_t dev, struct uio *uio, int ioflag)
{
dev_t base;
struct cdevsw *cdev;
@@ -267,7 +293,8 @@ int suread(dev_t dev, struct uio *uio, int ioflag)
return (*cdev->d_read)(base, uio, ioflag);
}
-int suwrite(dev_t dev, struct uio *uio, int ioflag)
+static int
+suwrite(dev_t dev, struct uio *uio, int ioflag)
{
dev_t base;
struct cdevsw *cdev;
@@ -277,7 +304,8 @@ int suwrite(dev_t dev, struct uio *uio, int ioflag)
return (*cdev->d_write)(base, uio, ioflag);
}
-int suselect(dev_t dev, int which, struct proc *p)
+static int
+suselect(dev_t dev, int which, struct proc *p)
{
dev_t base;
struct cdevsw *cdev;
@@ -287,35 +315,20 @@ int suselect(dev_t dev, int which, struct proc *p)
return (*cdev->d_select)(base, which, p);
}
-#ifdef JREMOD
-struct cdevsw su_cdevsw =
- { suopen, suclose, suread, suwrite, /*18*/
- suioctl, nostop, nullreset, nodevtotty,/* scsi */
- suselect, nxmmap, sustrategy }; /* 'generic' */
-
static su_devsw_installed = 0;
-static void su_drvinit(void *unused)
+static void
+su_drvinit(void *unused)
{
dev_t dev;
if( ! su_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&su_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&su_cdevsw, NULL);
su_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "su", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(sudev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,su_drvinit,NULL)
-#endif /* JREMOD */
diff --git a/sys/scsi/uk.c b/sys/scsi/uk.c
index 0cf4cf6..53302e2 100644
--- a/sys/scsi/uk.c
+++ b/sys/scsi/uk.c
@@ -2,7 +2,7 @@
* Driver for a device we can't identify.
* by Julian Elischer (julian@tfs.com)
*
- * $Id: uk.c,v 1.10 1995/11/29 10:49:07 julian Exp $
+ * $Id: uk.c,v 1.11 1995/11/29 14:41:07 julian Exp $
*
* If you find that you are adding any code to this file look closely
* at putting it in "scsi_driver.c" instead.
@@ -10,34 +10,41 @@
#include <sys/param.h>
#include <sys/systm.h>
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-#ifdef JREMOD
#include <sys/conf.h>
#include <sys/kernel.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
-#define CDEV_MAJOR 31
-#endif /*JREMOD*/
+#include <scsi/scsi_all.h>
+#include <scsi/scsiconf.h>
+static d_open_t ukopen;
+static d_close_t ukclose;
+static d_ioctl_t ukioctl;
+
+#define CDEV_MAJOR 31
+struct cdevsw uk_cdevsw =
+ { ukopen, ukclose, noread, nowrite, /*31*/
+ ukioctl, nostop, nullreset, nodevtotty,/* unknown */
+ seltrue, nommap, NULL, "uk" ,NULL, -1 };
+
SCSI_DEVICE_ENTRIES(uk)
struct scsi_device uk_switch =
{
- NULL,
- NULL,
- NULL,
- NULL,
- "uk",
- 0,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ "uk",
+ 0,
{0, 0},
SDEV_ONCE_ONLY, /* Only one open allowed */
0,
"Unknown",
ukopen,
- 0,
+ 0,
T_UNKNOWN,
0,
0,
@@ -47,11 +54,6 @@ struct scsi_device uk_switch =
0,
};
-#ifdef JREMOD
-struct cdevsw uk_cdevsw =
- { ukopen, ukclose, noread, nowrite, /*31*/
- ukioctl, nostop, nullreset, nodevtotty,/* unknown */
- seltrue, nommap, NULL }; /* scsi */
static uk_devsw_installed = 0;
@@ -60,22 +62,12 @@ static void uk_drvinit(void *unused)
dev_t dev;
if( ! uk_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&uk_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&uk_cdevsw, NULL);
uk_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "uk", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(ukdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,uk_drvinit,NULL)
-#endif /* JREMOD */
diff --git a/sys/scsi/worm.c b/sys/scsi/worm.c
index 8878bd2..b065bf8 100644
--- a/sys/scsi/worm.c
+++ b/sys/scsi/worm.c
@@ -37,7 +37,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: worm.c,v 1.12 1995/11/29 14:41:09 julian Exp $
+ * $Id: worm.c,v 1.13 1995/12/05 07:14:27 julian Exp $
*/
/* XXX This is PRELIMINARY.
@@ -55,24 +55,23 @@
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/proc.h>
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-#include <scsi/scsi_disk.h>
-
-#ifdef JREMOD
#include <sys/conf.h>
#include <sys/kernel.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
-#define CDEV_MAJOR 62
-#endif /*JREMOD*/
+#include <scsi/scsi_all.h>
+#include <scsi/scsiconf.h>
+#include <scsi/scsi_disk.h>
struct scsi_data {
struct buf_queue_head buf_queue;
u_int32 n_blks; /* Number of blocks (0 for bogus) */
u_int32 blk_size; /* Size of each blocks */
+#ifdef DEVFS
+ void *devfs_token; /* more elaborate later */
+#endif
};
static void wormstart(u_int32 unit, u_int32 flags);
@@ -85,22 +84,34 @@ static errval worm_close(dev_t dev, int flag, int fmt, struct proc *p,
struct scsi_link *sc_link);
static void worm_strategy(struct buf *bp, struct scsi_link *sc_link);
+static d_open_t wormopen;
+static d_close_t wormclose;
+static d_ioctl_t wormioctl;
+d_strategy_t wormstrategy;
+
+#define CDEV_MAJOR 62
+struct cdevsw worm_cdevsw =
+ { wormopen, wormclose, rawread, rawwrite, /*62*/
+ wormioctl, nostop, nullreset, nodevtotty,/* worm */
+ seltrue, nommap, wormstrategy };
+
+
SCSI_DEVICE_ENTRIES(worm)
static struct scsi_device worm_switch =
{
- NULL,
- wormstart, /* we have a queue, and this is how we service it */
- NULL,
- NULL,
- "worm",
- 0,
+ NULL,
+ wormstart, /* we have a queue, and this is how we service it */
+ NULL,
+ NULL,
+ "worm",
+ 0,
{0, 0},
SDEV_ONCE_ONLY, /* Only one open allowed */
wormattach,
"Write-Once",
wormopen,
- sizeof(struct scsi_data),
+ sizeof(struct scsi_data),
T_WORM,
0,
0,
@@ -147,7 +158,13 @@ wormattach(struct scsi_link *sc_link)
if (worm_size(sc_link, SCSI_NOSLEEP | SCSI_NOMASK) == 0)
printf("- can't get capacity.");
else
- printf("with %ld %ld byte blocks.", worm->n_blks, worm->blk_size);
+ printf("with %ld %ld byte blocks.",
+ worm->n_blks, worm->blk_size);
+#ifdef DEVFS
+
+ worm->devfs_token = devfs_add_devsw( "/", "rworm", &worm_cdevsw, 0,
+ DV_CHR, 0, 0, 0600);
+#endif
return 0;
}
@@ -358,15 +375,10 @@ worm_close(dev_t dev, int flag, int fmt, struct proc *p,
return 0;
}
-#ifdef JREMOD
-struct cdevsw worm_cdevsw =
- { wormopen, wormclose, rawread, rawwrite, /*62*/
- wormioctl, nostop, nullreset, nodevtotty,/* worm */
- seltrue, nommap, wormstrategy };
-
static worm_devsw_installed = 0;
-static void worm_drvinit(void *unused)
+static void
+worm_drvinit(void *unused)
{
dev_t dev;
@@ -374,19 +386,9 @@ static void worm_drvinit(void *unused)
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&worm_cdevsw,NULL);
worm_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "rworm", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(wormdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,worm_drvinit,NULL)
-#endif /* JREMOD */
diff --git a/sys/sys/conf.h b/sys/sys/conf.h
index 1fc0c04..d29f7e0 100644
--- a/sys/sys/conf.h
+++ b/sys/sys/conf.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)conf.h 8.3 (Berkeley) 1/21/94
- * $Id: conf.h,v 1.23 1995/11/29 14:41:17 julian Exp $
+ * $Id: conf.h,v 1.24 1995/12/05 19:53:14 bde Exp $
*/
#ifndef _SYS_CONF_H_
@@ -58,6 +58,7 @@ typedef int d_close_t __P((dev_t, int, int, struct proc *));
typedef int d_ioctl_t __P((dev_t, int, caddr_t, int, struct proc *));
typedef int d_dump_t __P((dev_t));
typedef int d_psize_t __P((dev_t));
+typedef int d_size_t __P((dev_t));
typedef int d_read_t __P((dev_t, struct uio *, int));
typedef int d_write_t __P((dev_t, struct uio *, int));
@@ -87,6 +88,9 @@ struct bdevsw {
d_dump_t *d_dump;
d_psize_t *d_psize;
int d_flags;
+ char *d_name; /* name of the driver e.g. audio */
+ struct cdevsw *d_cdev; /* cross pointer to the cdev */
+ int d_maj; /* the major number we were assigned */
};
#ifdef KERNEL
@@ -105,6 +109,9 @@ struct cdevsw {
d_select_t *d_select;
d_mmap_t *d_mmap;
d_strategy_t *d_strategy;
+ char *d_name;
+ struct bdevsw *d_bdev; /* cross pointer to the bdev */
+ int d_maj; /* the major number we were assigned */
};
#ifdef KERNEL
@@ -153,12 +160,10 @@ d_devtotty_t nodevtotty;
d_select_t noselect;
d_mmap_t nommap;
-#ifdef JREMOD
/* Bogus defines for compatibility. */
#define noioc noioctl
#define nostrat nostrategy
#define zerosize nopsize
-#endif /*JREMOD*/
/*
* XXX d_strategy seems to be unused for cdevs that aren't associated with
* bdevs and called without checking for it being non-NULL for bdevs.
@@ -197,10 +202,8 @@ d_rdwr_t rawwrite;
l_read_t l_noread;
l_write_t l_nowrite;
-#ifdef JREMOD
int bdevsw_add __P((dev_t *descrip,struct bdevsw *new,struct bdevsw *old));
int cdevsw_add __P((dev_t *descrip,struct cdevsw *new,struct cdevsw *old));
-#endif
dev_t chrtoblk __P((dev_t dev));
int getmajorbyname __P((const char *name));
int isdisk __P((dev_t dev, int type));
diff --git a/sys/sys/cons.h b/sys/sys/cons.h
index 8fbd43f..8fa2d90 100644
--- a/sys/sys/cons.h
+++ b/sys/sys/cons.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)cons.h 7.2 (Berkeley) 5/9/91
- * $Id: cons.h,v 1.10 1995/09/10 18:57:26 bde Exp $
+ * $Id: cons.h,v 1.11 1995/09/10 21:34:50 bde Exp $
*/
#ifndef _MACHINE_CONS_H_
@@ -106,14 +106,6 @@ extern int cons_unavail;
struct proc; struct uio;
-/* cdevsw[] entries */
-extern int cnopen(dev_t, int, int, struct proc *);
-extern int cnclose(dev_t, int, int, struct proc *);
-extern int cnread(dev_t, struct uio *, int);
-extern int cnwrite(dev_t, struct uio *, int);
-extern int cnioctl(dev_t, int, caddr_t, int, struct proc *);
-extern int cnselect(dev_t, int, struct proc *);
-
/* other kernel entry points */
extern void cninit(void);
extern void cninit_finish(void);
diff --git a/sys/sys/devfsext.h b/sys/sys/devfsext.h
index 3e33f76..31f16e4 100644
--- a/sys/sys/devfsext.h
+++ b/sys/sys/devfsext.h
@@ -1,14 +1,14 @@
/* usual BSD style copyright here */
/* Written by Julian Elischer (julian@dialix.oz.au)*/
/*
- * $Id: devfsext.h,v 1.2 1995/09/08 04:46:04 julian Exp $
+ * $Id: devfsext.h,v 1.3 1995/11/29 10:49:13 julian Exp $
*/
#ifndef _SYS_DEVFSECT_H_
#define _SYS_DEVFSECT_H_ 1
void *devfs_add_devsw(char *path,
char *name,
- int major,
+ void *devsw,
int minor,
int chrblk,
uid_t uid,
diff --git a/sys/sys/linedisc.h b/sys/sys/linedisc.h
index 1fc0c04..d29f7e0 100644
--- a/sys/sys/linedisc.h
+++ b/sys/sys/linedisc.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)conf.h 8.3 (Berkeley) 1/21/94
- * $Id: conf.h,v 1.23 1995/11/29 14:41:17 julian Exp $
+ * $Id: conf.h,v 1.24 1995/12/05 19:53:14 bde Exp $
*/
#ifndef _SYS_CONF_H_
@@ -58,6 +58,7 @@ typedef int d_close_t __P((dev_t, int, int, struct proc *));
typedef int d_ioctl_t __P((dev_t, int, caddr_t, int, struct proc *));
typedef int d_dump_t __P((dev_t));
typedef int d_psize_t __P((dev_t));
+typedef int d_size_t __P((dev_t));
typedef int d_read_t __P((dev_t, struct uio *, int));
typedef int d_write_t __P((dev_t, struct uio *, int));
@@ -87,6 +88,9 @@ struct bdevsw {
d_dump_t *d_dump;
d_psize_t *d_psize;
int d_flags;
+ char *d_name; /* name of the driver e.g. audio */
+ struct cdevsw *d_cdev; /* cross pointer to the cdev */
+ int d_maj; /* the major number we were assigned */
};
#ifdef KERNEL
@@ -105,6 +109,9 @@ struct cdevsw {
d_select_t *d_select;
d_mmap_t *d_mmap;
d_strategy_t *d_strategy;
+ char *d_name;
+ struct bdevsw *d_bdev; /* cross pointer to the bdev */
+ int d_maj; /* the major number we were assigned */
};
#ifdef KERNEL
@@ -153,12 +160,10 @@ d_devtotty_t nodevtotty;
d_select_t noselect;
d_mmap_t nommap;
-#ifdef JREMOD
/* Bogus defines for compatibility. */
#define noioc noioctl
#define nostrat nostrategy
#define zerosize nopsize
-#endif /*JREMOD*/
/*
* XXX d_strategy seems to be unused for cdevs that aren't associated with
* bdevs and called without checking for it being non-NULL for bdevs.
@@ -197,10 +202,8 @@ d_rdwr_t rawwrite;
l_read_t l_noread;
l_write_t l_nowrite;
-#ifdef JREMOD
int bdevsw_add __P((dev_t *descrip,struct bdevsw *new,struct bdevsw *old));
int cdevsw_add __P((dev_t *descrip,struct cdevsw *new,struct cdevsw *old));
-#endif
dev_t chrtoblk __P((dev_t dev));
int getmajorbyname __P((const char *name));
int isdisk __P((dev_t dev, int type));
diff --git a/sys/sys/tty.h b/sys/sys/tty.h
index a0694e1..5023bcd 100644
--- a/sys/sys/tty.h
+++ b/sys/sys/tty.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)tty.h 8.6 (Berkeley) 1/21/94
- * $Id: tty.h,v 1.30 1995/07/31 22:48:46 bde Exp $
+ * $Id: tty.h,v 1.31 1995/07/31 22:50:08 bde Exp $
*/
#ifndef _SYS_TTY_H_
@@ -261,18 +261,6 @@ int ttywflush __P((struct tty *tp));
struct tty *ttymalloc __P((void));
void ttyfree __P((struct tty *));
-/* From tty_tty.c. */
-/*
- * XXX misplaced - these are just the cdev functions for a particular
- * driver.
- */
-int cttyioctl __P((dev_t dev, int cmd, caddr_t addr, int flag,
- struct proc *p));
-int cttyopen __P((dev_t dev, int flag, int mode, struct proc *p));
-int cttyread __P((dev_t dev, struct uio *uio, int flag));
-int cttyselect __P((dev_t dev, int flag, struct proc *p));
-int cttywrite __P((dev_t dev, struct uio *uio, int flag));
-
#endif /* KERNEL */
#endif /* !_SYS_TTY_H_ */
diff --git a/sys/vm/vm_swap.c b/sys/vm/vm_swap.c
index c91b10e..db7b2ad 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.27 1995/11/29 14:41:20 julian Exp $
+ * $Id: vm_swap.c,v 1.28 1995/12/07 12:48:28 davidg Exp $
*/
#include <sys/param.h>
@@ -45,21 +45,26 @@
#include <sys/vnode.h>
#include <sys/file.h>
#include <sys/rlist.h>
-
+#include <sys/kernel.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
#include <vm/vm_extern.h>
#include <miscfs/specfs/specdev.h>
-#ifdef JREMOD
-#include <sys/kernel.h>
-#ifdef DEVFS
-#include <sys/devfsext.h>
-#endif /*DEVFS*/
+
#define CDEV_MAJOR 4
#define BDEV_MAJOR 1
-#endif /*JREMOD */
+
+struct bdevsw sw_bdevsw =
+ { noopen, noclose, swstrategy, noioc, /*1*/
+ nodump, zerosize, NULL, "sw", NULL, -1 };
+
+struct cdevsw sw_cdevsw =
+ { nullopen, nullclose, rawread, rawwrite, /*4*/
+ noioc, nostop, noreset, nodevtotty,/* swap */
+ noselect, nommap, swstrategy, "sw", NULL, -1 };
+
/*
* Indirect driver for multi-controller paging.
@@ -264,45 +269,20 @@ swaponvp(p, vp, dev, nblks)
return (0);
}
-#ifdef JREMOD
-struct bdevsw sw_bdevsw =
- { noopen, noclose, swstrategy, noioc, /*1*/
- nodump, zerosize, 0 };
-
-struct cdevsw sw_cdevsw =
- { nullopen, nullclose, rawread, rawwrite, /*4*/
- noioc, nostop, noreset, nodevtotty,/* swap */
- noselect, nommap, swstrategy };
-
static sw_devsw_installed = 0;
static void sw_drvinit(void *unused)
{
dev_t dev;
- dev_t dev_chr;
if( ! sw_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&sw_cdevsw,NULL);
- dev_chr = dev;
dev = makedev(BDEV_MAJOR,0);
bdevsw_add(&dev,&sw_bdevsw,NULL);
sw_devsw_installed = 1;
-#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "rsw", major(dev_chr), 0, DV_CHR, 0, 0, 0600);
- x=devfs_add_devsw(
- "/", "sw", major(dev), 0, DV_BLK, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(swdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,sw_drvinit,NULL)
-#endif /* JREMOD */
-
OpenPOWER on IntegriCloud