summaryrefslogtreecommitdiffstats
path: root/sys/scsi/od.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1995-11-29 10:49:16 +0000
committerjulian <julian@FreeBSD.org>1995-11-29 10:49:16 +0000
commitf2f63c6ece7d25485976323df6d684743fe14bb6 (patch)
tree5ed2d747156a38098db0e540f833114bc9dd1b51 /sys/scsi/od.c
parentbe48321f04abe146ffbc5091fe940b107f46c175 (diff)
downloadFreeBSD-src-f2f63c6ece7d25485976323df6d684743fe14bb6.zip
FreeBSD-src-f2f63c6ece7d25485976323df6d684743fe14bb6.tar.gz
OK, that's it..
That's EVERY SINGLE driver that has an entry in conf.c.. my next trick will be to define cdevsw[] and bdevsw[] as empty arrays and remove all those DAMNED defines as well.. Each of these drivers has a SYSINIT linker set entry that comes in very early.. and asks teh driver to add it's own entry to the two devsw[] tables. some slight reworking of the commits from yesterday (added the SYSINIT stuff and some usually wrong but token DEVFS entries to all these devices. BTW does anyone know where the 'ata' entries in conf.c actually reside? seems we don't actually have a 'ataopen() etc... If you want to add a new device in conf.c please make sure I know so I can keep it up to date too.. as before, this is all dependent on #if defined(JREMOD) (and #ifdef DEVFS in parts)
Diffstat (limited to 'sys/scsi/od.c')
-rw-r--r--sys/scsi/od.c53
1 files changed, 52 insertions, 1 deletions
diff --git a/sys/scsi/od.c b/sys/scsi/od.c
index 60a8836..dca9c67 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.2 1995/11/19 22:22:21 dyson Exp $
+ * $Id: od.c,v 1.3 1995/11/20 12:42:28 phk Exp $
*/
/*
@@ -62,6 +62,14 @@
#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;
#define SECSIZE 512
@@ -797,3 +805,46 @@ 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);
+ 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 */
+
OpenPOWER on IntegriCloud