diff options
author | phk <phk@FreeBSD.org> | 1999-08-14 11:40:51 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1999-08-14 11:40:51 +0000 |
commit | 5f45261e990bb420f6394e615c3495668886dfe9 (patch) | |
tree | 66dfc8aa5c9515f4ec0197d4ad3f1c2445413016 /sys/pc98 | |
parent | 5ff2615ae3524707b482556fcc6668d139f2cd67 (diff) | |
download | FreeBSD-src-5f45261e990bb420f6394e615c3495668886dfe9.zip FreeBSD-src-5f45261e990bb420f6394e615c3495668886dfe9.tar.gz |
Spring cleaning around strategy and disklabels/slices:
Introduce BUF_STRATEGY(struct buf *, int flag) macro, and use it throughout.
please see comment in sys/conf.h about the flag argument.
Remove strategy argument from all the diskslice/label/bad144
implementations, it should be found from the dev_t.
Remove bogus and unused strategy1 routines.
Remove open/close arguments from dssize(). Pick them up from dev_t.
Remove unused and unfinished setgeom support from diskslice/label/bad144 code.
Diffstat (limited to 'sys/pc98')
-rw-r--r-- | sys/pc98/cbus/fdc.c | 9 | ||||
-rw-r--r-- | sys/pc98/pc98/atcompat_diskslice.c | 22 | ||||
-rw-r--r-- | sys/pc98/pc98/diskslice_machdep.c | 31 | ||||
-rw-r--r-- | sys/pc98/pc98/fd.c | 9 | ||||
-rw-r--r-- | sys/pc98/pc98/wd.c | 33 | ||||
-rw-r--r-- | sys/pc98/pc98/wfd.c | 19 |
6 files changed, 44 insertions, 79 deletions
diff --git a/sys/pc98/cbus/fdc.c b/sys/pc98/cbus/fdc.c index b06b7d5..e032a42 100644 --- a/sys/pc98/cbus/fdc.c +++ b/sys/pc98/cbus/fdc.c @@ -47,7 +47,7 @@ * SUCH DAMAGE. * * from: @(#)fd.c 7.4 (Berkeley) 5/25/91 - * $Id: fd.c,v 1.66 1999/07/04 14:58:44 phk Exp $ + * $Id: fd.c,v 1.67 1999/07/29 01:02:59 mdodd Exp $ * */ @@ -2624,7 +2624,7 @@ fdformat(dev, finfo, p) /* now do the format */ bp->b_dev = dev; - fdstrategy(bp); + BUF_STRATEGY(bp, 0); /* ...and wait for it to complete */ s = splbio(); @@ -2687,7 +2687,7 @@ fdioctl(dev, cmd, addr, flag, p) dl->d_secpercyl = fdt->size / fdt->tracks; dl->d_type = DTYPE_FLOPPY; - if (readdisklabel(dkmodpart(dev, RAW_PART), fdstrategy, dl) + if (readdisklabel(dkmodpart(dev, RAW_PART), dl) == NULL) error = 0; else @@ -2718,8 +2718,7 @@ fdioctl(dev, cmd, addr, flag, p) (u_long)0)) != 0) break; - error = writedisklabel(dev, fdstrategy, - (struct disklabel *)buffer); + error = writedisklabel(dev, (struct disklabel *)buffer); break; case FD_FORM: if ((flag & FWRITE) == 0) diff --git a/sys/pc98/pc98/atcompat_diskslice.c b/sys/pc98/pc98/atcompat_diskslice.c index 9bc0f1f..b2c1d38 100644 --- a/sys/pc98/pc98/atcompat_diskslice.c +++ b/sys/pc98/pc98/atcompat_diskslice.c @@ -35,7 +35,7 @@ * * from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91 * from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $ - * $Id: atcompat_diskslice.c,v 1.15 1999/05/12 08:33:18 kato Exp $ + * $Id: atcompat_diskslice.c,v 1.16 1999/06/26 02:47:14 mckusick Exp $ */ /* @@ -75,7 +75,6 @@ static int check_part __P((char *sname, struct dos_partition *dp, u_long offset, int nsectors, int ntracks, u_long mbr_offset)); static void atcompat_extended __P((char *dname, dev_t dev, - d_strategy_t *strat, struct disklabel *lp, struct diskslices *ssp, u_long ext_offset, u_long ext_size, u_long base_ext_offset, int nsectors, int ntracks, @@ -161,13 +160,11 @@ check_part(sname, dp, offset, nsectors, ntracks, mbr_offset ) return (error); } -int atcompat_dsinit __P((char *dname, dev_t dev, d_strategy_t *strat, - struct disklabel *lp, struct diskslices **sspp)); +int atcompat_dsinit __P((char *dname, dev_t dev, struct disklabel *lp, struct diskslices **sspp)); int -atcompat_dsinit(dname, dev, strat, lp, sspp) +atcompat_dsinit(dname, dev, lp, sspp) char *dname; dev_t dev; - d_strategy_t *strat; struct disklabel *lp; struct diskslices **sspp; { @@ -195,7 +192,7 @@ reread_mbr: bp->b_blkno = mbr_offset; bp->b_bcount = lp->d_secsize; bp->b_flags |= B_READ; - (*strat)(bp); + BUF_STRATEGY(bp, 1); if (biowait(bp) != 0) { diskerr(bp, dname, "error reading primary partition table", LOG_PRINTF, 0, (struct disklabel *)NULL); @@ -346,7 +343,7 @@ reread_mbr: for (dospart = 0; dospart < NDOSPART; dospart++, sp++) if (sp->ds_type == DOSPTYP_EXTENDED || sp->ds_type == DOSPTYP_EXTENDEDX) - atcompat_extended(dname, bp->b_dev, strat, lp, ssp, + atcompat_extended(dname, bp->b_dev, lp, ssp, sp->ds_offset, sp->ds_size, sp->ds_offset, max_nsectors, max_ntracks, mbr_offset); @@ -359,12 +356,11 @@ done: } static void -atcompat_extended(dname, dev, strat, lp, ssp, ext_offset, ext_size, - base_ext_offset, nsectors, ntracks, mbr_offset) +atcompat_extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset, + nsectors, ntracks, mbr_offset) char *dname; dev_t dev; struct disklabel *lp; - d_strategy_t *strat; struct diskslices *ssp; u_long ext_offset; u_long ext_size; @@ -390,7 +386,7 @@ atcompat_extended(dname, dev, strat, lp, ssp, ext_offset, ext_size, bp->b_blkno = ext_offset; bp->b_bcount = lp->d_secsize; bp->b_flags |= B_READ; - (*strat)(bp); + BUF_STRATEGY(bp, 1); if (biowait(bp) != 0) { diskerr(bp, dname, "error reading extended partition table", LOG_PRINTF, 0, (struct disklabel *)NULL); @@ -457,7 +453,7 @@ atcompat_extended(dname, dev, strat, lp, ssp, ext_offset, ext_size, /* If we found any more slices, recursively find all the subslices. */ for (dospart = 0; dospart < NDOSPART; dospart++) if (ext_sizes[dospart] != 0) - atcompat_extended(dname, dev, strat, lp, ssp, + atcompat_extended(dname, dev, lp, ssp, ext_offsets[dospart], ext_sizes[dospart], base_ext_offset, nsectors, ntracks, mbr_offset); diff --git a/sys/pc98/pc98/diskslice_machdep.c b/sys/pc98/pc98/diskslice_machdep.c index 0a263ab..3841c81 100644 --- a/sys/pc98/pc98/diskslice_machdep.c +++ b/sys/pc98/pc98/diskslice_machdep.c @@ -35,7 +35,7 @@ * * from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91 * from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $ - * $Id: diskslice_machdep.c,v 1.20 1999/06/26 02:47:15 mckusick Exp $ + * $Id: diskslice_machdep.c,v 1.21 1999/08/08 10:06:27 kato Exp $ */ /* @@ -74,17 +74,16 @@ static struct dos_partition historical_bogus_partition_table[NDOSPART] = { static int check_part __P((char *sname, struct dos_partition *dp, u_long offset, int nsectors, int ntracks, u_long mbr_offset)); -static void extended __P((char *dname, dev_t dev, d_strategy_t *strat, - struct disklabel *lp, struct diskslices *ssp, - u_long ext_offset, u_long ext_size, - u_long base_ext_offset, int nsectors, int ntracks, - u_long mbr_offset)); +static void extended __P((char *dname, dev_t dev, struct disklabel *lp, + struct diskslices *ssp, u_long ext_offset, + u_long ext_size, u_long base_ext_offset, + int nsectors, int ntracks, u_long mbr_offset)); #ifdef PC98 #define DPBLKNO(cyl,hd,sect) ((cyl)*(lp->d_secpercyl)) #ifdef COMPAT_ATDISK -int atcompat_dsinit __P((char *dname, dev_t dev, d_strategy_t *strat, - struct disklabel *lp, struct diskslices **sspp)); +int atcompat_dsinit __P((char *dname, dev_t dev, + struct disklabel *lp, struct diskslices **sspp)); #endif #endif @@ -201,10 +200,9 @@ check_part(sname, dp, offset, nsectors, ntracks, mbr_offset ) } int -dsinit(dname, dev, strat, lp, sspp) +dsinit(dname, dev, lp, sspp) char *dname; dev_t dev; - d_strategy_t *strat; struct disklabel *lp; struct diskslices **sspp; { @@ -248,7 +246,7 @@ reread_mbr: if (bp->b_bcount < 1024) bp->b_bcount = 1024; #endif - (*strat)(bp); + BUF_STRATEGY(bp, 1); if (biowait(bp) != 0) { diskerr(bp, dname, "error reading primary partition table", LOG_PRINTF, 0, (struct disklabel *)NULL); @@ -325,7 +323,7 @@ reread_mbr: /* IBM-PC HDD */ bp->b_flags = B_INVAL | B_AGE; brelse(bp); - return atcompat_dsinit(dname, dev, strat, lp, sspp); + return atcompat_dsinit(dname, dev, lp, sspp); } #endif dp0 = (struct dos_partition *)(cp + 512); @@ -488,7 +486,7 @@ reread_mbr: for (dospart = 0; dospart < NDOSPART; dospart++, sp++) if (sp->ds_type == DOSPTYP_EXTENDED || sp->ds_type == DOSPTYP_EXTENDEDX) - extended(dname, bp->b_dev, strat, lp, ssp, + extended(dname, bp->b_dev, lp, ssp, sp->ds_offset, sp->ds_size, sp->ds_offset, max_nsectors, max_ntracks, mbr_offset); #endif @@ -503,12 +501,11 @@ done: /* PC98 does not use this function */ void -extended(dname, dev, strat, lp, ssp, ext_offset, ext_size, base_ext_offset, +extended(dname, dev, lp, ssp, ext_offset, ext_size, base_ext_offset, nsectors, ntracks, mbr_offset) char *dname; dev_t dev; struct disklabel *lp; - d_strategy_t *strat; struct diskslices *ssp; u_long ext_offset; u_long ext_size; @@ -538,7 +535,7 @@ extended(dname, dev, strat, lp, ssp, ext_offset, ext_size, base_ext_offset, bp->b_blkno = ext_offset; bp->b_bcount = lp->d_secsize; bp->b_flags |= B_READ; - (*strat)(bp); + BUF_STRATEGY(bp, 1); if (biowait(bp) != 0) { diskerr(bp, dname, "error reading extended partition table", LOG_PRINTF, 0, (struct disklabel *)NULL); @@ -625,7 +622,7 @@ extended(dname, dev, strat, lp, ssp, ext_offset, ext_size, base_ext_offset, /* If we found any more slices, recursively find all the subslices. */ for (dospart = 0; dospart < NDOSPART; dospart++) if (ext_sizes[dospart] != 0) - extended(dname, dev, strat, lp, ssp, + extended(dname, dev, lp, ssp, ext_offsets[dospart], ext_sizes[dospart], base_ext_offset, nsectors, ntracks, mbr_offset); diff --git a/sys/pc98/pc98/fd.c b/sys/pc98/pc98/fd.c index b06b7d5..e032a42 100644 --- a/sys/pc98/pc98/fd.c +++ b/sys/pc98/pc98/fd.c @@ -47,7 +47,7 @@ * SUCH DAMAGE. * * from: @(#)fd.c 7.4 (Berkeley) 5/25/91 - * $Id: fd.c,v 1.66 1999/07/04 14:58:44 phk Exp $ + * $Id: fd.c,v 1.67 1999/07/29 01:02:59 mdodd Exp $ * */ @@ -2624,7 +2624,7 @@ fdformat(dev, finfo, p) /* now do the format */ bp->b_dev = dev; - fdstrategy(bp); + BUF_STRATEGY(bp, 0); /* ...and wait for it to complete */ s = splbio(); @@ -2687,7 +2687,7 @@ fdioctl(dev, cmd, addr, flag, p) dl->d_secpercyl = fdt->size / fdt->tracks; dl->d_type = DTYPE_FLOPPY; - if (readdisklabel(dkmodpart(dev, RAW_PART), fdstrategy, dl) + if (readdisklabel(dkmodpart(dev, RAW_PART), dl) == NULL) error = 0; else @@ -2718,8 +2718,7 @@ fdioctl(dev, cmd, addr, flag, p) (u_long)0)) != 0) break; - error = writedisklabel(dev, fdstrategy, - (struct disklabel *)buffer); + error = writedisklabel(dev, (struct disklabel *)buffer); break; case FD_FORM: if ((flag & FWRITE) == 0) diff --git a/sys/pc98/pc98/wd.c b/sys/pc98/pc98/wd.c index ae8e02e..c5098b8 100644 --- a/sys/pc98/pc98/wd.c +++ b/sys/pc98/pc98/wd.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)wd.c 7.2 (Berkeley) 5/9/91 - * $Id: wd.c,v 1.84 1999/05/31 11:28:44 phk Exp $ + * $Id: wd.c,v 1.85 1999/08/09 10:35:04 phk Exp $ */ /* TODO: @@ -246,7 +246,6 @@ static void wderror(struct buf *bp, struct disk *du, char *mesg); static void wdflushirq(struct disk *du, int old_ipl); static int wdreset(struct disk *du); static void wdsleep(int ctrlr, char *wmesg); -static void wdstrategy1(struct buf *bp); static timeout_t wdtimeout; static int wdunwedge(struct disk *du); static int wdwait(struct disk *du, u_char bits_wanted, int timeout); @@ -756,16 +755,6 @@ done: biodone(bp); } -static void -wdstrategy1(struct buf *bp) -{ - /* - * XXX - do something to make wdstrategy() but not this block while - * we're doing dsinit() and dsioctl(). - */ - wdstrategy(bp); -} - /* * Routine to queue a command to the controller. The unit's * request is linked into the active list for the controller. @@ -1389,8 +1378,7 @@ wdopen(dev_t dev, int flags, int fmt, struct proc *p) label.d_ncylinders = du->dk_dd.d_ncylinders; label.d_secpercyl = du->dk_dd.d_secpercyl; label.d_secperunit = du->dk_dd.d_secperunit; - error = dsopen("wd", dev, fmt, 0, &du->dk_slices, &label, wdstrategy1, - (ds_setgeom_t *)NULL, &wd_cdevsw); + error = dsopen("wd", dev, fmt, 0, &du->dk_slices, &label); } du->dk_flags &= ~DKFL_LABELLING; wdsleep(du->dk_ctrlr, "wdopn2"); @@ -1409,7 +1397,7 @@ wdopen(dev_t dev, int flags, int fmt, struct proc *p) du->dk_flags |= DKFL_LABELLING; du->dk_state = WANTOPEN; - error = dsinit(dkmodpart(dev, RAW_PART), wdstrategy, + error = dsinit(dkmodpart(dev, RAW_PART), &du->dk_dd, &du->dk_slices); if (error != 0) { du->dk_flags &= ~DKFL_LABELLING; @@ -1438,13 +1426,13 @@ wdopen(dev_t dev, int flags, int fmt, struct proc *p) * XXX can now handle changes directly since dsinit() doesn't * do too much. */ - msg = correct_readdisklabel(dkmodpart(dev, RAW_PART), wdstrategy, - &du->dk_dd); + msg = correct_readdisklabel(dkmodpart(dev, RAW_PART), + &du->dk_dd); /* XXX check value returned by wdwsetctlr(). */ wdwsetctlr(du); if (msg == NULL && du->dk_dd.d_flags & D_BADSECT) - msg = readbad144(dkmodpart(dev, RAW_PART), wdstrategy, - &du->dk_dd, &du->dk_bad); + msg = readbad144(dkmodpart(dev, RAW_PART), + &du->dk_dd, &du->dk_bad); du->dk_flags &= ~DKFL_LABELLING; if (msg != NULL) { log(LOG_WARNING, "wd%d: cannot find label (%s)\n", @@ -2130,8 +2118,7 @@ wdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) du = wddrives[lunit]; wdsleep(du->dk_ctrlr, "wdioct"); - error = dsioctl("wd", dev, cmd, addr, flags, &du->dk_slices, - wdstrategy1, (ds_setgeom_t *)NULL); + error = dsioctl("wd", dev, cmd, addr, flags, &du->dk_slices); if (error != ENOIOCTL) return (error); #ifdef PC98 @@ -2176,7 +2163,7 @@ wdformat(struct buf *bp) { bp->b_flags |= B_FORMAT; - wdstrategy(bp); + BUF_STRATEGY(bp, 0); /* * phk put this here, better that return(wdstrategy(bp)); * XXX @@ -2200,7 +2187,7 @@ wdsize(dev_t dev) #ifdef PC98 outb(0x432,(du->dk_unit)%2); #endif - return (dssize(dev, &du->dk_slices, wdopen, wdclose)); + return (dssize(dev, &du->dk_slices)); } int diff --git a/sys/pc98/pc98/wfd.c b/sys/pc98/pc98/wfd.c index 3030b86..9cf0684 100644 --- a/sys/pc98/pc98/wfd.c +++ b/sys/pc98/pc98/wfd.c @@ -23,7 +23,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: wfd.c,v 1.25 1999/05/31 11:26:38 phk Exp $ + * $Id: wfd.c,v 1.26 1999/06/24 03:09:11 msmith Exp $ */ /* @@ -167,7 +167,6 @@ static int wfd_request_wait (struct wfd *t, u_char cmd, u_char a1, u_char a2, u_char a9, char *addr, int count); static void wfd_describe (struct wfd *t); static int wfd_eject (struct wfd *t, int closeit); -static void wfdstrategy1(struct buf *bp); /* * Dump the array in hexadecimal format for debugging purposes. @@ -392,8 +391,7 @@ int wfdopen (dev_t dev, int flags, int fmt, struct proc *p) label.d_secperunit = label.d_secpercyl * t->cap.cyls; /* Initialize slice tables. */ - errcode = dsopen("wfd", dev, fmt, 0, &t->dk_slices, &label, - wfdstrategy1, (ds_setgeom_t *)NULL, &wfd_cdevsw); + errcode = dsopen("wfd", dev, fmt, 0, &t->dk_slices, &label); if (errcode != 0) return errcode; @@ -421,16 +419,6 @@ int wfdclose (dev_t dev, int flags, int fmt, struct proc *p) return (0); } -static void -wfdstrategy1(struct buf *bp) -{ - /* - * XXX - do something to make wdstrategy() but not this block while - * we're doing dsinit() and dsioctl(). - */ - wfdstrategy(bp); -} - /* * Actually translate the requested transfer into one the physical driver can * understand. The transfer is described by a buf and will include only one @@ -656,8 +644,7 @@ int wfdioctl (dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p) struct wfd *t = wfdtab[lun]; int error = 0; - error = dsioctl("wfd", dev, cmd, addr, flag, &t->dk_slices, - wfdstrategy1, (ds_setgeom_t *)NULL); + error = dsioctl("wfd", dev, cmd, addr, flag, &t->dk_slices); if (error != ENOIOCTL) return (error); |