diff options
author | phk <phk@FreeBSD.org> | 2003-02-24 21:49:27 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-02-24 21:49:27 +0000 |
commit | 83d0e58172de7563f59519892b23c2fd0e80ca56 (patch) | |
tree | 7de667f8904ef0bba742bdca938e64ad8392740e /sys | |
parent | dd594d3b57c8fb3337401b9102e319ecee6af106 (diff) | |
download | FreeBSD-src-83d0e58172de7563f59519892b23c2fd0e80ca56.zip FreeBSD-src-83d0e58172de7563f59519892b23c2fd0e80ca56.tar.gz |
NO_GEOM cleanup:
Move to new "struct disk *" centered API".
OK'ed by: emoore
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/amr/amr.c | 2 | ||||
-rw-r--r-- | sys/dev/amr/amr_disk.c | 45 | ||||
-rw-r--r-- | sys/dev/amr/amrvar.h | 1 |
3 files changed, 13 insertions, 35 deletions
diff --git a/sys/dev/amr/amr.c b/sys/dev/amr/amr.c index e75c2af..6d11bec 100644 --- a/sys/dev/amr/amr.c +++ b/sys/dev/amr/amr.c @@ -883,7 +883,7 @@ amr_bio_command(struct amr_softc *sc, struct amr_command **acp) ac->ac_flags |= AMR_CMD_DATAOUT; cmd = AMR_CMD_LWRITE; } - amrd = (struct amrd_softc *)bio->bio_dev->si_drv1; + amrd = (struct amrd_softc *)bio->bio_disk->d_drv1; driveno = amrd->amrd_drive - sc->amr_drive; blkcount = (bio->bio_bcount + AMR_BLKSIZE - 1) / AMR_BLKSIZE; diff --git a/sys/dev/amr/amr_disk.c b/sys/dev/amr/amr_disk.c index bed1260..2960bda6 100644 --- a/sys/dev/amr/amr_disk.c +++ b/sys/dev/amr/amr_disk.c @@ -84,32 +84,10 @@ static int amrd_probe(device_t dev); static int amrd_attach(device_t dev); static int amrd_detach(device_t dev); -static d_open_t amrd_open; -static d_strategy_t amrd_strategy; - -#define AMRD_CDEV_MAJOR 133 - -static struct cdevsw amrd_cdevsw = { - /* open */ amrd_open, - /* close */ nullclose, - /* read */ physread, - /* write */ physwrite, - /* ioctl */ noioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ amrd_strategy, - /* name */ "amrd", - /* maj */ AMRD_CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_DISK, -#if __FreeBSD_version < 500000 - /* bmaj */ -1 -#endif -}; +static disk_open_t amrd_open; +static disk_strategy_t amrd_strategy; static devclass_t amrd_devclass; -static struct cdevsw amrddisk_cdevsw; #ifdef FREEBSD_4 static int disks_registered = 0; #endif @@ -130,9 +108,9 @@ static driver_t amrd_driver = { DRIVER_MODULE(amrd, amr, amrd_driver, amrd_devclass, 0, 0); static int -amrd_open(dev_t dev, int flags, int fmt, d_thread_t *td) +amrd_open(struct disk *dp) { - struct amrd_softc *sc = (struct amrd_softc *)dev->si_drv1; + struct amrd_softc *sc = (struct amrd_softc *)dp->d_drv1; #if __FreeBSD_version < 500000 /* old buf style */ struct disklabel *label; #endif @@ -175,7 +153,7 @@ amrd_open(dev_t dev, int flags, int fmt, d_thread_t *td) static void amrd_strategy(struct bio *bio) { - struct amrd_softc *sc = (struct amrd_softc *)bio->bio_dev->si_drv1; + struct amrd_softc *sc = (struct amrd_softc *)bio->bio_disk->d_drv1; /* bogus disk? */ if (sc == NULL) { @@ -202,7 +180,7 @@ void amrd_intr(void *data) { struct bio *bio = (struct bio *)data; - struct amrd_softc *sc = (struct amrd_softc *)bio->bio_dev->si_drv1; + struct amrd_softc *sc = (struct amrd_softc *)bio->bio_disk->d_drv1; debug_called(2); @@ -250,15 +228,16 @@ amrd_attach(device_t dev) DEVSTAT_TYPE_STORARRAY | DEVSTAT_TYPE_IF_OTHER, DEVSTAT_PRIORITY_ARRAY); - sc->amrd_dev_t = disk_create(sc->amrd_unit, &sc->amrd_disk, 0, &amrd_cdevsw, &amrddisk_cdevsw); - sc->amrd_dev_t->si_drv1 = sc; + sc->amrd_disk.d_drv1 = sc; + sc->amrd_disk.d_maxsize = (AMR_NSEG - 1) * PAGE_SIZE; + sc->amrd_disk.d_open = amrd_open; + sc->amrd_disk.d_strategy = amrd_strategy; + sc->amrd_disk.d_name = "amrd"; + disk_create(sc->amrd_unit, &sc->amrd_disk, 0, NULL, NULL); #ifdef FREEBSD_4 disks_registered++; #endif - /* set maximum I/O size to match the maximum s/g size */ - sc->amrd_dev_t->si_iosize_max = (AMR_NSEG - 1) * PAGE_SIZE; - return (0); } diff --git a/sys/dev/amr/amrvar.h b/sys/dev/amr/amrvar.h index 0ea90a9..bc6f4ae 100644 --- a/sys/dev/amr/amrvar.h +++ b/sys/dev/amr/amrvar.h @@ -250,7 +250,6 @@ extern int amr_cam_command(struct amr_softc *sc, struct amr_command **acp); struct amrd_softc { device_t amrd_dev; - dev_t amrd_dev_t; struct amr_softc *amrd_controller; struct amr_logdrive *amrd_drive; struct disk amrd_disk; |