summaryrefslogtreecommitdiffstats
path: root/sys/dev/fdc
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2000-05-06 07:01:47 +0000
committerphk <phk@FreeBSD.org>2000-05-06 07:01:47 +0000
commit4b77d307471bc8c1eac6d2856702374846fb9a38 (patch)
tree22a2a29f6920da1828ab9043676426fb5bb8d197 /sys/dev/fdc
parent7ff358347cb5b5d880a52e2f74938caffab396e5 (diff)
downloadFreeBSD-src-4b77d307471bc8c1eac6d2856702374846fb9a38.zip
FreeBSD-src-4b77d307471bc8c1eac6d2856702374846fb9a38.tar.gz
Step down a level and issue format requests with a struct bio instead
of a struct buf.
Diffstat (limited to 'sys/dev/fdc')
-rw-r--r--sys/dev/fdc/fdc.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c
index f3d47b4..34acddb 100644
--- a/sys/dev/fdc/fdc.c
+++ b/sys/dev/fdc/fdc.c
@@ -58,7 +58,6 @@
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/bio.h>
-#include <sys/buf.h>
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/disklabel.h>
@@ -2203,6 +2202,12 @@ retrier(struct fdc_data *fdc)
return (1);
}
+static void
+fdbiodone(struct bio *bp)
+{
+ wakeup(bp);
+}
+
static int
fdformat(dev, finfo, p)
dev_t dev;
@@ -2212,7 +2217,7 @@ fdformat(dev, finfo, p)
fdu_t fdu;
fd_p fd;
- struct buf *bp;
+ struct bio *bp;
int rv = 0, s;
size_t fdblk;
@@ -2221,36 +2226,34 @@ fdformat(dev, finfo, p)
fdblk = 128 << fd->ft->secsize;
/* set up a buffer header for fdstrategy() */
- bp = (struct buf *)malloc(sizeof(struct buf), M_TEMP, M_NOWAIT);
+ bp = (struct bio *)malloc(sizeof(struct bio), M_TEMP, M_NOWAIT);
if(bp == 0)
- return ENOBUFS;
+ return ENOMEM;
/*
* keep the process from being swapped
*/
PHOLD(p);
- bzero((void *)bp, sizeof(struct buf));
- BUF_LOCKINIT(bp);
- BUF_LOCK(bp, LK_EXCLUSIVE);
- bp->b_flags = B_PHYS;
- bp->b_iocmd = BIO_FORMAT;
+ bzero((void *)bp, sizeof(*bp));
+ bp->bio_cmd = BIO_FORMAT;
/*
* calculate a fake blkno, so fdstrategy() would initiate a
* seek to the requested cylinder
*/
- bp->b_blkno = (finfo->cyl * (fd->ft->sectrac * fd->ft->heads)
+ bp->bio_blkno = (finfo->cyl * (fd->ft->sectrac * fd->ft->heads)
+ finfo->head * fd->ft->sectrac) * fdblk / DEV_BSIZE;
- bp->b_bcount = sizeof(struct fd_idfield_data) * finfo->fd_formb_nsecs;
- bp->b_data = (caddr_t)finfo;
+ bp->bio_bcount = sizeof(struct fd_idfield_data) * finfo->fd_formb_nsecs;
+ bp->bio_data = (caddr_t)finfo;
/* now do the format */
- bp->b_dev = dev;
- DEV_STRATEGY(bp, 0);
+ bp->bio_dev = dev;
+ bp->bio_done = fdbiodone;
+ fdstrategy(bp);
/* ...and wait for it to complete */
s = splbio();
- while(!(bp->b_flags & B_DONE)) {
+ while(!(bp->bio_flags & BIO_DONE)) {
rv = tsleep((caddr_t)bp, PRIBIO, "fdform", 20 * hz);
if (rv == EWOULDBLOCK)
break;
@@ -2261,16 +2264,13 @@ fdformat(dev, finfo, p)
/* timed out */
rv = EIO;
device_unbusy(fd->dev);
- biodone(&bp->b_io); /* XXX: HUH ? */
}
- if (bp->b_ioflags & BIO_ERROR)
- rv = bp->b_error;
+ if (bp->bio_flags & BIO_ERROR)
+ rv = bp->bio_error;
/*
* allow the process to be swapped
*/
PRELE(p);
- BUF_UNLOCK(bp);
- BUF_LOCKFREE(bp);
free(bp, M_TEMP);
return rv;
}
OpenPOWER on IntegriCloud