summaryrefslogtreecommitdiffstats
path: root/sys/scsi
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/scsi
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/scsi')
-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
11 files changed, 513 insertions, 389 deletions
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 */
OpenPOWER on IntegriCloud