summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/wt.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1995-12-08 11:19:42 +0000
committerjulian <julian@FreeBSD.org>1995-12-08 11:19:42 +0000
commit1900eea896e2aaeae8a9fa8affa5fded2068c9b4 (patch)
tree5150d199464d64c1021f91b2c2f112d48546a8bf /sys/i386/isa/wt.c
parentaaf9d7f10ecc63adae1dc4f55cfd31a2926c605a (diff)
downloadFreeBSD-src-1900eea896e2aaeae8a9fa8affa5fded2068c9b4.zip
FreeBSD-src-1900eea896e2aaeae8a9fa8affa5fded2068c9b4.tar.gz
Pass 3 of the great devsw changes
most devsw referenced functions are now static, as they are in the same file as their devsw structure. I've also added DEVFS support for nearly every device in the system, however many of the devices have 'incorrect' names under DEVFS because I couldn't quickly work out the correct naming conventions. (but devfs won't be coming on line for a month or so anyhow so that doesn't matter) If you "OWN" a device which would normally have an entry in /dev then search for the devfs_add_devsw() entries and munge to make them right.. check out similar devices to see what I might have done in them in you can't see what's going on.. for a laugh compare conf.c conf.h defore and after... :) I have not doen DEVFS entries for any DISKSLICE devices yet as that will be a much more complicated job.. (pass 5 :) pass 4 will be to make the devsw tables of type (cdevsw * ) rather than (cdevsw) seems to work here.. complaints to the usual places.. :)
Diffstat (limited to 'sys/i386/isa/wt.c')
-rw-r--r--sys/i386/isa/wt.c83
1 files changed, 46 insertions, 37 deletions
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 */
OpenPOWER on IntegriCloud