diff options
author | phk <phk@FreeBSD.org> | 1999-05-31 11:29:30 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1999-05-31 11:29:30 +0000 |
commit | 6a5dc97620c08ad609e1b3c3c042f150feb46dd3 (patch) | |
tree | 6cfc9338ae83f67fd38a853cd0782713c73cad13 /sys/dev/ata | |
parent | 881e2636833297a207a791fabd8befc818b1b3fb (diff) | |
download | FreeBSD-src-6a5dc97620c08ad609e1b3c3c042f150feb46dd3.zip FreeBSD-src-6a5dc97620c08ad609e1b3c3c042f150feb46dd3.tar.gz |
Simplify cdevsw registration.
The cdevsw_add() function now finds the major number(s) in the
struct cdevsw passed to it. cdevsw_add_generic() is no longer
needed, cdevsw_add() does the same thing.
cdevsw_add() will print an message if the d_maj field looks bogus.
Remove nblkdev and nchrdev variables. Most places they were used
bogusly. Instead check a dev_t for validity by seeing if devsw()
or bdevsw() returns NULL.
Move bdevsw() and devsw() functions to kern/kern_conf.c
Bump __FreeBSD_version to 400006
This commit removes:
72 bogus makedev() calls
26 bogus SYSINIT functions
if_xe.c bogusly accessed cdevsw[], author/maintainer please fix.
I4b and vinum not changed. Patches emailed to authors. LINT
probably broken until they catch up.
Diffstat (limited to 'sys/dev/ata')
-rw-r--r-- | sys/dev/ata/ata-disk.c | 10 | ||||
-rw-r--r-- | sys/dev/ata/atapi-cd.c | 4 | ||||
-rw-r--r-- | sys/dev/ata/atapi-fd.c | 4 | ||||
-rw-r--r-- | sys/dev/ata/atapi-tape.c | 6 |
4 files changed, 13 insertions, 11 deletions
diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index b46f770..bc5eeee 100644 --- a/sys/dev/ata/ata-disk.c +++ b/sys/dev/ata/ata-disk.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: ata-disk.c,v 1.11 1999/05/17 15:58:45 sos Exp $ + * $Id: ata-disk.c,v 1.12 1999/05/30 16:51:12 phk Exp $ */ #include "ata.h" @@ -88,6 +88,7 @@ static struct cdevsw ad_cdevsw = { /* maxio */ 0, /* bmaj */ BDEV_MAJOR, }; +static struct cdevsw fakewd_cdevsw; /* misc defines */ #define UNIT(dev) (minor(dev)>>3 & 0x1f) /* assume 8 minor # per unit */ @@ -663,8 +664,11 @@ ad_drvinit(void) static int32_t ad_devsw_installed = 0; if (!ad_devsw_installed) { - cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &ad_cdevsw); - cdevsw_add_generic(0, 3, &ad_cdevsw); /* grap wd entries too */ + cdevsw_add(&ad_cdevsw); + fakewd_cdevsw = ad_cdevsw; + fakewd_cdevsw.d_maj = 3; + fakewd_cdevsw.d_bmaj = 0; + cdevsw_add(&fakewd_cdevsw); /* grap wd entries too */ ad_devsw_installed = 1; } /* register callback for when interrupts are enabled */ diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c index aaec644..200b648 100644 --- a/sys/dev/ata/atapi-cd.c +++ b/sys/dev/ata/atapi-cd.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: atapi-cd.c,v 1.8 1999/05/17 15:58:46 sos Exp $ + * $Id: atapi-cd.c,v 1.9 1999/05/30 16:51:14 phk Exp $ */ #include "ata.h" @@ -1426,7 +1426,7 @@ acd_drvinit(void *unused) static int32_t acd_devsw_installed = 0; if (!acd_devsw_installed) { - cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &acd_cdevsw); + cdevsw_add(&acd_cdevsw); acd_devsw_installed = 1; } } diff --git a/sys/dev/ata/atapi-fd.c b/sys/dev/ata/atapi-fd.c index d63a039..e89d636 100644 --- a/sys/dev/ata/atapi-fd.c +++ b/sys/dev/ata/atapi-fd.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: atapi-fd.c,v 1.8 1999/05/20 09:12:05 sos Exp $ + * $Id: atapi-fd.c,v 1.9 1999/05/30 16:51:15 phk Exp $ */ #include "ata.h" @@ -482,7 +482,7 @@ afd_drvinit(void *unused) static int32_t afd_devsw_installed = 0; if (!afd_devsw_installed) { - cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &afd_cdevsw); + cdevsw_add(&afd_cdevsw); afd_devsw_installed = 1; } } diff --git a/sys/dev/ata/atapi-tape.c b/sys/dev/ata/atapi-tape.c index 7699d89..a471232 100644 --- a/sys/dev/ata/atapi-tape.c +++ b/sys/dev/ata/atapi-tape.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: atapi-tape.c,v 1.8 1999/05/17 15:58:47 sos Exp $ + * $Id: atapi-tape.c,v 1.9 1999/05/30 16:51:16 phk Exp $ */ #include "ata.h" @@ -554,9 +554,7 @@ ast_drvinit(void *unused) static int32_t ast_devsw_installed = 0; if (!ast_devsw_installed) { - dev_t dev = makedev(CDEV_MAJOR, 0); - - cdevsw_add(&dev, &ast_cdevsw, NULL); + cdevsw_add(&ast_cdevsw); ast_devsw_installed = 1; } } |