diff options
author | julian <julian@FreeBSD.org> | 1995-11-29 10:49:16 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 1995-11-29 10:49:16 +0000 |
commit | f2f63c6ece7d25485976323df6d684743fe14bb6 (patch) | |
tree | 5ed2d747156a38098db0e540f833114bc9dd1b51 /sys/scsi/sd.c | |
parent | be48321f04abe146ffbc5091fe940b107f46c175 (diff) | |
download | FreeBSD-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/sd.c')
-rw-r--r-- | sys/scsi/sd.c | 57 |
1 files changed, 55 insertions, 2 deletions
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index 501aff5..586812d 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.71 1995/11/20 02:12:34 davidg Exp $ + * $Id: sd.c,v 1.72 1995/11/20 12:42:32 phk Exp $ */ #define SPLSD splbio @@ -39,6 +39,16 @@ #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 */ + u_int32 sdstrats, sdqueues; #define SECSIZE 512 @@ -236,7 +246,7 @@ sd_open(dev, mode, fmt, p, sc_link) * "unit attention" errors should occur here if the * drive has been restarted or the pack changed. * just ingnore the result, it's a decoy instruction - * The error code will act on the error though + * The error handlers will act on the error though * and invalidate any media information we had. */ scsi_test_unit_ready(sc_link, 0); @@ -950,3 +960,46 @@ 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); + 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 */ + |