summaryrefslogtreecommitdiffstats
path: root/sys/scsi/ch.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/scsi/ch.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/scsi/ch.c')
-rw-r--r--sys/scsi/ch.c56
1 files changed, 28 insertions, 28 deletions
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 */
OpenPOWER on IntegriCloud