From aaaef0b54e307450b19dcd1fb6ec921cc62d1acf Mon Sep 17 00:00:00 2001 From: phk Date: Sat, 15 Apr 2000 05:54:02 +0000 Subject: Complete the bio/buf divorce for all code below devfs::strategy Exceptions: Vinum untouched. This means that it cannot be compiled. Greg Lehey is on the case. CCD not converted yet, casts to struct buf (still safe) atapi-cd casts to struct buf to examine B_PHYS --- sys/alpha/alpha/machdep.c | 36 ++++----- sys/amd64/amd64/machdep.c | 36 ++++----- sys/cam/scsi/scsi_cd.c | 90 +++++++++++------------ sys/cam/scsi/scsi_da.c | 88 +++++++++++----------- sys/cam/scsi/scsi_pass.c | 60 +++++++-------- sys/cam/scsi/scsi_pt.c | 82 ++++++++++----------- sys/cam/scsi/scsi_sa.c | 138 +++++++++++++++++----------------- sys/cam/scsi/scsi_target.c | 104 +++++++++++++------------- sys/contrib/dev/fla/fla.c | 44 +++++------ sys/dev/amr/amr.c | 36 ++++----- sys/dev/amr/amr_disk.c | 30 ++++---- sys/dev/amr/amrvar.h | 4 +- sys/dev/ata/ata-disk.c | 38 +++++----- sys/dev/ata/ata-disk.h | 4 +- sys/dev/ata/atapi-cd.c | 60 ++++++++------- sys/dev/ata/atapi-cd.h | 2 +- sys/dev/ata/atapi-fd.c | 54 +++++++------- sys/dev/ata/atapi-fd.h | 2 +- sys/dev/ata/atapi-tape.c | 54 +++++++------- sys/dev/ata/atapi-tape.h | 2 +- sys/dev/ccd/ccd.c | 11 +-- sys/dev/fdc/fdc.c | 139 +++++++++++++++++------------------ sys/dev/ida/ida.c | 24 +++--- sys/dev/ida/ida_disk.c | 30 ++++---- sys/dev/ida/idavar.h | 8 +- sys/dev/mcd/mcd.c | 66 ++++++++--------- sys/dev/md/md.c | 79 ++++++++++---------- sys/dev/mlx/mlx.c | 44 +++++------ sys/dev/mlx/mlx_disk.c | 26 +++---- sys/dev/mlx/mlxvar.h | 4 +- sys/dev/scd/scd.c | 64 ++++++++-------- sys/dev/vn/vn.c | 70 +++++++++--------- sys/fs/cd9660/cd9660_vnops.c | 4 +- sys/fs/msdosfs/msdosfs_vnops.c | 4 +- sys/fs/ntfs/ntfs_vnops.c | 2 +- sys/fs/nwfs/nwfs_io.c | 4 +- sys/geom/geom_ccd.c | 11 +-- sys/i386/i386/machdep.c | 36 ++++----- sys/i386/isa/labpc.c | 90 +++++++++++------------ sys/i386/isa/matcd/matcd.c | 70 +++++++++--------- sys/i386/isa/mcd.c | 66 ++++++++--------- sys/i386/isa/scd.c | 64 ++++++++-------- sys/i386/isa/wt.c | 28 +++---- sys/isa/fd.c | 139 +++++++++++++++++------------------ sys/isa/fdc.h | 4 +- sys/isofs/cd9660/cd9660_vnops.c | 4 +- sys/kern/subr_disk.c | 22 +++--- sys/kern/subr_disklabel.c | 22 +++--- sys/kern/subr_diskmbr.c | 4 +- sys/kern/subr_diskslice.c | 80 ++++++++++---------- sys/kern/vfs_bio.c | 10 ++- sys/kern/vfs_cluster.c | 2 +- sys/kern/vfs_default.c | 2 +- sys/miscfs/devfs/devfs_vnops.c | 6 +- sys/msdosfs/msdosfs_vnops.c | 4 +- sys/nfs/nfs_bio.c | 6 +- sys/nfs/nfs_vnops.c | 2 +- sys/nfsclient/nfs_bio.c | 6 +- sys/nfsclient/nfs_vnops.c | 2 +- sys/ntfs/ntfs_vnops.c | 2 +- sys/nwfs/nwfs_io.c | 4 +- sys/pc98/cbus/fdc.c | 151 +++++++++++++++++++------------------- sys/pc98/i386/machdep.c | 36 ++++----- sys/pc98/pc98/diskslice_machdep.c | 2 +- sys/pc98/pc98/fd.c | 151 +++++++++++++++++++------------------- sys/pc98/pc98/machdep.c | 36 ++++----- sys/pc98/pc98/wd.c | 142 +++++++++++++++++------------------ sys/pc98/pc98/wd_cd.c | 68 ++++++++--------- sys/pc98/pc98/wd_cd.h | 2 +- sys/sys/bio.h | 11 ++- sys/sys/buf.h | 11 ++- sys/sys/conf.h | 5 +- sys/sys/disklabel.h | 4 +- sys/sys/diskmbr.h | 4 +- sys/sys/diskpc98.h | 4 +- sys/sys/diskslice.h | 3 +- sys/sys/linedisc.h | 5 +- sys/ufs/mfs/mfs_vnops.c | 8 +- sys/ufs/ufs/ufs_disksubr.c | 22 +++--- sys/ufs/ufs/ufs_vnops.c | 4 +- sys/vm/swap_pager.c | 4 +- sys/vm/vm_pager.c | 10 +-- sys/vm/vm_swap.c | 6 +- 83 files changed, 1474 insertions(+), 1444 deletions(-) (limited to 'sys') diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c index c5c6ad7..055f652 100644 --- a/sys/alpha/alpha/machdep.c +++ b/sys/alpha/alpha/machdep.c @@ -1919,55 +1919,55 @@ Debugger(const char *msg) * if needed, and signal errors or early completion. */ int -bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel) +bounds_check_with_label(struct bio *bp, struct disklabel *lp, int wlabel) { #if 0 - struct partition *p = lp->d_partitions + dkpart(bp->b_dev); + struct partition *p = lp->d_partitions + dkpart(bp->bio_dev); int labelsect = lp->d_partitions[0].p_offset; int maxsz = p->p_size, - sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT; + sz = (bp->bio_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT; /* overwriting disk label ? */ /* XXX should also protect bootstrap in first 8K */ - if (bp->b_blkno + p->p_offset <= LABELSECTOR + labelsect && + if (bp->bio_blkno + p->p_offset <= LABELSECTOR + labelsect && #if LABELSECTOR != 0 - bp->b_blkno + p->p_offset + sz > LABELSECTOR + labelsect && + bp->bio_blkno + p->p_offset + sz > LABELSECTOR + labelsect && #endif - (bp->b_iocmd == BIO_WRITE) && wlabel == 0) { - bp->b_error = EROFS; + (bp->bio_cmd == BIO_WRITE) && wlabel == 0) { + bp->bio_error = EROFS; goto bad; } #if defined(DOSBBSECTOR) && defined(notyet) /* overwriting master boot record? */ - if (bp->b_blkno + p->p_offset <= DOSBBSECTOR && - (bp->b_iocmd == BIO_WRITE) && wlabel == 0) { - bp->b_error = EROFS; + if (bp->bio_blkno + p->p_offset <= DOSBBSECTOR && + (bp->bio_cmd == BIO_WRITE) && wlabel == 0) { + bp->bio_error = EROFS; goto bad; } #endif /* beyond partition? */ - if (bp->b_blkno < 0 || bp->b_blkno + sz > maxsz) { + if (bp->bio_blkno < 0 || bp->bio_blkno + sz > maxsz) { /* if exactly at end of disk, return an EOF */ - if (bp->b_blkno == maxsz) { - bp->b_resid = bp->b_bcount; + if (bp->bio_blkno == maxsz) { + bp->bio_resid = bp->bio_bcount; return(0); } /* or truncate if part of it fits */ - sz = maxsz - bp->b_blkno; + sz = maxsz - bp->bio_blkno; if (sz <= 0) { - bp->b_error = EINVAL; + bp->bio_error = EINVAL; goto bad; } - bp->b_bcount = sz << DEV_BSHIFT; + bp->bio_bcount = sz << DEV_BSHIFT; } - bp->b_pblkno = bp->b_blkno + p->p_offset; + bp->bio_pblkno = bp->bio_blkno + p->p_offset; return(1); bad: - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; #endif return(-1); diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 72bb9a7..67dc0b8 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -2362,54 +2362,54 @@ Debugger(const char *msg) * if needed, and signal errors or early completion. */ int -bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel) +bounds_check_with_label(struct bio *bp, struct disklabel *lp, int wlabel) { - struct partition *p = lp->d_partitions + dkpart(bp->b_dev); + struct partition *p = lp->d_partitions + dkpart(bp->bio_dev); int labelsect = lp->d_partitions[0].p_offset; int maxsz = p->p_size, - sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT; + sz = (bp->bio_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT; /* overwriting disk label ? */ /* XXX should also protect bootstrap in first 8K */ - if (bp->b_blkno + p->p_offset <= LABELSECTOR + labelsect && + if (bp->bio_blkno + p->p_offset <= LABELSECTOR + labelsect && #if LABELSECTOR != 0 - bp->b_blkno + p->p_offset + sz > LABELSECTOR + labelsect && + bp->bio_blkno + p->p_offset + sz > LABELSECTOR + labelsect && #endif - (bp->b_iocmd == BIO_WRITE) && wlabel == 0) { - bp->b_error = EROFS; + (bp->bio_cmd == BIO_WRITE) && wlabel == 0) { + bp->bio_error = EROFS; goto bad; } #if defined(DOSBBSECTOR) && defined(notyet) /* overwriting master boot record? */ - if (bp->b_blkno + p->p_offset <= DOSBBSECTOR && - (bp->b_iocmd == BIO_WRITE) && wlabel == 0) { - bp->b_error = EROFS; + if (bp->bio_blkno + p->p_offset <= DOSBBSECTOR && + (bp->bio_cmd == BIO_WRITE) && wlabel == 0) { + bp->bio_error = EROFS; goto bad; } #endif /* beyond partition? */ - if (bp->b_blkno < 0 || bp->b_blkno + sz > maxsz) { + if (bp->bio_blkno < 0 || bp->bio_blkno + sz > maxsz) { /* if exactly at end of disk, return an EOF */ - if (bp->b_blkno == maxsz) { - bp->b_resid = bp->b_bcount; + if (bp->bio_blkno == maxsz) { + bp->bio_resid = bp->bio_bcount; return(0); } /* or truncate if part of it fits */ - sz = maxsz - bp->b_blkno; + sz = maxsz - bp->bio_blkno; if (sz <= 0) { - bp->b_error = EINVAL; + bp->bio_error = EINVAL; goto bad; } - bp->b_bcount = sz << DEV_BSHIFT; + bp->bio_bcount = sz << DEV_BSHIFT; } - bp->b_pblkno = bp->b_blkno + p->p_offset; + bp->bio_pblkno = bp->bio_blkno + p->p_offset; return(1); bad: - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; return(-1); } diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index 3985570..0ca386a 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -124,7 +124,7 @@ struct cd_softc { cam_pinfo pinfo; cd_state state; volatile cd_flags flags; - struct buf_queue_head buf_queue; + struct bio_queue_head bio_queue; LIST_HEAD(, ccb_hdr) pending_ccbs; struct cd_params params; struct disk disk; @@ -344,7 +344,7 @@ cdoninvalidate(struct cam_periph *periph) { int s; struct cd_softc *softc; - struct buf *q_bp; + struct bio *q_bp; struct ccb_setasync csa; softc = (struct cd_softc *)periph->softc; @@ -374,11 +374,11 @@ cdoninvalidate(struct cam_periph *periph) * XXX Handle any transactions queued to the card * with XPT_ABORT_CCB. */ - while ((q_bp = bufq_first(&softc->buf_queue)) != NULL){ - bufq_remove(&softc->buf_queue, q_bp); - q_bp->b_resid = q_bp->b_bcount; - q_bp->b_error = ENXIO; - q_bp->b_ioflags |= BIO_ERROR; + while ((q_bp = bioq_first(&softc->bio_queue)) != NULL){ + bioq_remove(&softc->bio_queue, q_bp); + q_bp->bio_resid = q_bp->bio_bcount; + q_bp->bio_error = ENXIO; + q_bp->bio_flags |= BIO_ERROR; biodone(q_bp); } splx(s); @@ -575,7 +575,7 @@ cdregister(struct cam_periph *periph, void *arg) bzero(softc, sizeof(*softc)); LIST_INIT(&softc->pending_ccbs); softc->state = CD_STATE_PROBE; - bufq_init(&softc->buf_queue); + bioq_init(&softc->bio_queue); if (SID_IS_REMOVABLE(&cgd->inq_data)) softc->flags |= CD_FLAG_DISC_REMOVABLE; if ((cgd->inq_data.flags & SID_CmdQue) != 0) @@ -1008,7 +1008,7 @@ cdshorttimeout(void *arg) * Check to see if there is any more pending or outstanding I/O for * this device. If not, move it out of the active slot. */ - if ((bufq_first(&changer->cur_device->buf_queue) == NULL) + if ((bioq_first(&changer->cur_device->bio_queue) == NULL) && (changer->cur_device->device_stats.busy_count == 0)) { changer->flags |= CHANGER_MANUAL_CALL; cdrunchangerqueue(changer); @@ -1135,7 +1135,7 @@ cdrunchangerqueue(void *arg) * to do. If so, requeue it at the end of the queue. If * not, there is no need to requeue it. */ - if (bufq_first(&changer->cur_device->buf_queue) != NULL) { + if (bioq_first(&changer->cur_device->bio_queue) != NULL) { changer->cur_device->pinfo.generation = ++changer->devq.generation; @@ -1217,7 +1217,7 @@ cdchangerschedule(struct cd_softc *softc) softc->flags &= ~CD_FLAG_SCHED_ON_COMP; cdrunchangerqueue(softc->changer); } - } else if ((bufq_first(&softc->buf_queue) == NULL) + } else if ((bioq_first(&softc->bio_queue) == NULL) && (softc->device_stats.busy_count == 0)) { softc->changer->flags |= CHANGER_MANUAL_CALL; cdrunchangerqueue(softc->changer); @@ -1328,18 +1328,18 @@ cdgetccb(struct cam_periph *periph, u_int32_t priority) * only one physical transfer. */ static void -cdstrategy(struct buf *bp) +cdstrategy(struct bio *bp) { struct cam_periph *periph; struct cd_softc *softc; u_int unit, part; int s; - unit = dkunit(bp->b_dev); - part = dkpart(bp->b_dev); + unit = dkunit(bp->bio_dev); + part = dkpart(bp->bio_dev); periph = cam_extend_get(cdperiphs, unit); if (periph == NULL) { - bp->b_error = ENXIO; + bp->bio_error = ENXIO; goto bad; } @@ -1359,14 +1359,14 @@ cdstrategy(struct buf *bp) */ if ((softc->flags & CD_FLAG_INVALID)) { splx(s); - bp->b_error = ENXIO; + bp->bio_error = ENXIO; goto bad; } /* * Place it in the queue of disk activities for this disk */ - bufqdisksort(&softc->buf_queue, bp); + bioqdisksort(&softc->bio_queue, bp); splx(s); @@ -1381,11 +1381,11 @@ cdstrategy(struct buf *bp) return; bad: - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; /* * Correctly set the buf to indicate a completed xfer */ - bp->b_resid = bp->b_bcount; + bp->bio_resid = bp->bio_bcount; biodone(bp); return; } @@ -1394,7 +1394,7 @@ static void cdstart(struct cam_periph *periph, union ccb *start_ccb) { struct cd_softc *softc; - struct buf *bp; + struct bio *bp; struct ccb_scsiio *csio; struct scsi_read_capacity_data *rcap; int s; @@ -1409,7 +1409,7 @@ cdstart(struct cam_periph *periph, union ccb *start_ccb) int oldspl; s = splbio(); - bp = bufq_first(&softc->buf_queue); + bp = bioq_first(&softc->bio_queue); if (periph->immediate_priority <= periph->pinfo.priority) { start_ccb->ccb_h.ccb_state = CD_CCB_WAITING; @@ -1422,23 +1422,23 @@ cdstart(struct cam_periph *periph, union ccb *start_ccb) splx(s); xpt_release_ccb(start_ccb); } else { - bufq_remove(&softc->buf_queue, bp); + bioq_remove(&softc->bio_queue, bp); devstat_start_transaction(&softc->device_stats); scsi_read_write(&start_ccb->csio, /*retries*/4, /* cbfcnp */ cddone, - (bp->b_ioflags & BIO_ORDERED) != 0 ? + (bp->bio_flags & BIO_ORDERED) != 0 ? MSG_ORDERED_Q_TAG : MSG_SIMPLE_Q_TAG, - /* read */bp->b_iocmd == BIO_READ, + /* read */bp->bio_cmd == BIO_READ, /* byte2 */ 0, /* minimum_cmd_size */ 10, - /* lba */ bp->b_pblkno, - bp->b_bcount / softc->params.blksize, - /* data_ptr */ bp->b_data, - /* dxfer_len */ bp->b_bcount, + /* lba */ bp->bio_pblkno, + bp->bio_bcount / softc->params.blksize, + /* data_ptr */ bp->bio_data, + /* dxfer_len */ bp->bio_bcount, /* sense_len */ SSD_FULL_SIZE, /* timeout */ 30000); start_ccb->ccb_h.ccb_state = CD_CCB_BUFFER_IO; @@ -1460,7 +1460,7 @@ cdstart(struct cam_periph *periph, union ccb *start_ccb) } start_ccb->ccb_h.ccb_bp = bp; - bp = bufq_first(&softc->buf_queue); + bp = bioq_first(&softc->bio_queue); splx(s); xpt_action(start_ccb); @@ -1513,11 +1513,11 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) switch (csio->ccb_h.ccb_state & CD_CCB_TYPE_MASK) { case CD_CCB_BUFFER_IO: { - struct buf *bp; + struct bio *bp; int error; int oldspl; - bp = (struct buf *)done_ccb->ccb_h.ccb_bp; + bp = (struct bio *)done_ccb->ccb_h.ccb_bp; error = 0; if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { @@ -1542,22 +1542,22 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) if (error != 0) { int s; - struct buf *q_bp; + struct bio *q_bp; xpt_print_path(periph->path); printf("cddone: got error %#x back\n", error); s = splbio(); - while ((q_bp = bufq_first(&softc->buf_queue)) != NULL) { - bufq_remove(&softc->buf_queue, q_bp); - q_bp->b_resid = q_bp->b_bcount; - q_bp->b_error = EIO; - q_bp->b_ioflags |= BIO_ERROR; + while ((q_bp = bioq_first(&softc->bio_queue)) != NULL) { + bioq_remove(&softc->bio_queue, q_bp); + q_bp->bio_resid = q_bp->bio_bcount; + q_bp->bio_error = EIO; + q_bp->bio_flags |= BIO_ERROR; biodone(q_bp); } splx(s); - bp->b_resid = bp->b_bcount; - bp->b_error = error; - bp->b_ioflags |= BIO_ERROR; + bp->bio_resid = bp->bio_bcount; + bp->bio_error = error; + bp->bio_flags |= BIO_ERROR; cam_release_devq(done_ccb->ccb_h.path, /*relsim_flags*/0, /*reduction*/0, @@ -1565,11 +1565,11 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) /*getcount_only*/0); } else { - bp->b_resid = csio->resid; - bp->b_error = 0; - if (bp->b_resid != 0) { + bp->bio_resid = csio->resid; + bp->bio_error = 0; + if (bp->bio_resid != 0) { /* Short transfer ??? */ - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; } } @@ -1584,7 +1584,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) if (softc->flags & CD_FLAG_CHANGER) cdchangerschedule(softc); - devstat_end_transaction_buf(&softc->device_stats, bp); + devstat_end_transaction_bio(&softc->device_stats, bp); biodone(bp); break; } diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index 9208154..53ce964 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -99,7 +99,7 @@ struct disk_params { }; struct da_softc { - struct buf_queue_head buf_queue; + struct bio_queue_head bio_queue; struct devstat device_stats; SLIST_ENTRY(da_softc) links; LIST_HEAD(, ccb_hdr) pending_ccbs; @@ -481,7 +481,7 @@ daclose(dev_t dev, int flag, int fmt, struct proc *p) * only one physical transfer. */ static void -dastrategy(struct buf *bp) +dastrategy(struct bio *bp) { struct cam_periph *periph; struct da_softc *softc; @@ -489,11 +489,11 @@ dastrategy(struct buf *bp) u_int part; int s; - unit = dkunit(bp->b_dev); - part = dkpart(bp->b_dev); + unit = dkunit(bp->bio_dev); + part = dkpart(bp->bio_dev); periph = cam_extend_get(daperiphs, unit); if (periph == NULL) { - bp->b_error = ENXIO; + bp->bio_error = ENXIO; goto bad; } softc = (struct da_softc *)periph->softc; @@ -516,14 +516,14 @@ dastrategy(struct buf *bp) */ if ((softc->flags & DA_FLAG_PACK_INVALID)) { splx(s); - bp->b_error = ENXIO; + bp->bio_error = ENXIO; goto bad; } /* * Place it in the queue of disk activities for this disk */ - bufqdisksort(&softc->buf_queue, bp); + bioqdisksort(&softc->bio_queue, bp); splx(s); @@ -534,12 +534,12 @@ dastrategy(struct buf *bp) return; bad: - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; /* * Correctly set the buf to indicate a completed xfer */ - bp->b_resid = bp->b_bcount; + bp->bio_resid = bp->bio_bcount; biodone(bp); return; } @@ -772,7 +772,7 @@ daoninvalidate(struct cam_periph *periph) { int s; struct da_softc *softc; - struct buf *q_bp; + struct bio *q_bp; struct ccb_setasync csa; softc = (struct da_softc *)periph->softc; @@ -802,11 +802,11 @@ daoninvalidate(struct cam_periph *periph) * XXX Handle any transactions queued to the card * with XPT_ABORT_CCB. */ - while ((q_bp = bufq_first(&softc->buf_queue)) != NULL){ - bufq_remove(&softc->buf_queue, q_bp); - q_bp->b_resid = q_bp->b_bcount; - q_bp->b_error = ENXIO; - q_bp->b_ioflags |= BIO_ERROR; + while ((q_bp = bioq_first(&softc->bio_queue)) != NULL){ + bioq_remove(&softc->bio_queue, q_bp); + q_bp->bio_resid = q_bp->bio_bcount; + q_bp->bio_error = ENXIO; + q_bp->bio_flags |= BIO_ERROR; biodone(q_bp); } splx(s); @@ -924,7 +924,7 @@ daregister(struct cam_periph *periph, void *arg) bzero(softc, sizeof(*softc)); LIST_INIT(&softc->pending_ccbs); softc->state = DA_STATE_PROBE; - bufq_init(&softc->buf_queue); + bioq_init(&softc->bio_queue); if (SID_IS_REMOVABLE(&cgd->inq_data)) softc->flags |= DA_FLAG_PACK_REMOVABLE; if ((cgd->inq_data.flags & SID_CmdQue) != 0) @@ -1016,14 +1016,14 @@ dastart(struct cam_periph *periph, union ccb *start_ccb) case DA_STATE_NORMAL: { /* Pull a buffer from the queue and get going on it */ - struct buf *bp; + struct bio *bp; int s; /* * See if there is a buf with work for us to do.. */ s = splbio(); - bp = bufq_first(&softc->buf_queue); + bp = bioq_first(&softc->bio_queue); if (periph->immediate_priority <= periph->pinfo.priority) { CAM_DEBUG_PRINT(CAM_DEBUG_SUBTRACE, ("queuing for immediate ccb\n")); @@ -1040,11 +1040,11 @@ dastart(struct cam_periph *periph, union ccb *start_ccb) int oldspl; u_int8_t tag_code; - bufq_remove(&softc->buf_queue, bp); + bioq_remove(&softc->bio_queue, bp); devstat_start_transaction(&softc->device_stats); - if ((bp->b_ioflags & BIO_ORDERED) != 0 + if ((bp->bio_flags & BIO_ORDERED) != 0 || (softc->flags & DA_FLAG_NEED_OTAG) != 0) { softc->flags &= ~DA_FLAG_NEED_OTAG; softc->ordered_tag_count++; @@ -1056,13 +1056,13 @@ dastart(struct cam_periph *periph, union ccb *start_ccb) /*retries*/4, dadone, tag_code, - bp->b_iocmd == BIO_READ, + bp->bio_cmd == BIO_READ, /*byte2*/0, softc->minimum_cmd_size, - bp->b_pblkno, - bp->b_bcount / softc->params.secsize, - bp->b_data, - bp->b_bcount, + bp->bio_pblkno, + bp->bio_bcount / softc->params.secsize, + bp->bio_data, + bp->bio_bcount, /*sense_len*/SSD_FULL_SIZE, DA_DEFAULT_TIMEOUT * 1000); start_ccb->ccb_h.ccb_state = DA_CCB_BUFFER_IO; @@ -1083,7 +1083,7 @@ dastart(struct cam_periph *periph, union ccb *start_ccb) } start_ccb->ccb_h.ccb_bp = bp; - bp = bufq_first(&softc->buf_queue); + bp = bioq_first(&softc->bio_queue); splx(s); xpt_action(start_ccb); @@ -1136,10 +1136,10 @@ dadone(struct cam_periph *periph, union ccb *done_ccb) switch (csio->ccb_h.ccb_state & DA_CCB_TYPE_MASK) { case DA_CCB_BUFFER_IO: { - struct buf *bp; + struct bio *bp; int oldspl; - bp = (struct buf *)done_ccb->ccb_h.ccb_bp; + bp = (struct bio *)done_ccb->ccb_h.ccb_bp; if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { int error; int s; @@ -1161,7 +1161,7 @@ dadone(struct cam_periph *periph, union ccb *done_ccb) return; } if (error != 0) { - struct buf *q_bp; + struct bio *q_bp; s = splbio(); @@ -1183,24 +1183,24 @@ dadone(struct cam_periph *periph, union ccb *done_ccb) * the client can retry these I/Os in the * proper order should it attempt to recover. */ - while ((q_bp = bufq_first(&softc->buf_queue)) + while ((q_bp = bioq_first(&softc->bio_queue)) != NULL) { - bufq_remove(&softc->buf_queue, q_bp); - q_bp->b_resid = q_bp->b_bcount; - q_bp->b_error = EIO; - q_bp->b_ioflags |= BIO_ERROR; + bioq_remove(&softc->bio_queue, q_bp); + q_bp->bio_resid = q_bp->bio_bcount; + q_bp->bio_error = EIO; + q_bp->bio_flags |= BIO_ERROR; biodone(q_bp); } splx(s); - bp->b_error = error; - bp->b_resid = bp->b_bcount; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = error; + bp->bio_resid = bp->bio_bcount; + bp->bio_flags |= BIO_ERROR; } else { - bp->b_resid = csio->resid; - bp->b_error = 0; - if (bp->b_resid != 0) { + bp->bio_resid = csio->resid; + bp->bio_error = 0; + if (bp->bio_resid != 0) { /* Short transfer ??? */ - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; } } if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) @@ -1210,9 +1210,9 @@ dadone(struct cam_periph *periph, union ccb *done_ccb) /*timeout*/0, /*getcount_only*/0); } else { - bp->b_resid = csio->resid; + bp->bio_resid = csio->resid; if (csio->resid > 0) - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; } /* @@ -1226,7 +1226,7 @@ dadone(struct cam_periph *periph, union ccb *done_ccb) if (softc->device_stats.busy_count == 0) softc->flags |= DA_FLAG_WENT_IDLE; - devstat_end_transaction_buf(&softc->device_stats, bp); + devstat_end_transaction_bio(&softc->device_stats, bp); biodone(bp); break; } diff --git a/sys/cam/scsi/scsi_pass.c b/sys/cam/scsi/scsi_pass.c index c7cc2cc..32a395e 100644 --- a/sys/cam/scsi/scsi_pass.c +++ b/sys/cam/scsi/scsi_pass.c @@ -75,7 +75,7 @@ struct pass_softc { pass_state state; pass_flags flags; u_int8_t pd_type; - struct buf_queue_head buf_queue; + struct bio_queue_head bio_queue; union ccb saved_ccb; struct devstat device_stats; dev_t dev; @@ -180,7 +180,7 @@ passoninvalidate(struct cam_periph *periph) { int s; struct pass_softc *softc; - struct buf *q_bp; + struct bio *q_bp; struct ccb_setasync csa; softc = (struct pass_softc *)periph->softc; @@ -210,11 +210,11 @@ passoninvalidate(struct cam_periph *periph) * XXX Handle any transactions queued to the card * with XPT_ABORT_CCB. */ - while ((q_bp = bufq_first(&softc->buf_queue)) != NULL){ - bufq_remove(&softc->buf_queue, q_bp); - q_bp->b_resid = q_bp->b_bcount; - q_bp->b_error = ENXIO; - q_bp->b_ioflags |= BIO_ERROR; + while ((q_bp = bioq_first(&softc->bio_queue)) != NULL){ + bioq_remove(&softc->bio_queue, q_bp); + q_bp->bio_resid = q_bp->bio_bcount; + q_bp->bio_error = ENXIO; + q_bp->bio_flags |= BIO_ERROR; biodone(q_bp); } splx(s); @@ -315,7 +315,7 @@ passregister(struct cam_periph *periph, void *arg) bzero(softc, sizeof(*softc)); softc->state = PASS_STATE_NORMAL; softc->pd_type = SID_TYPE(&cgd->inq_data); - bufq_init(&softc->buf_queue); + bioq_init(&softc->bio_queue); periph->softc = softc; @@ -459,7 +459,7 @@ passclose(dev_t dev, int flag, int fmt, struct proc *p) * only one physical transfer. */ static void -passstrategy(struct buf *bp) +passstrategy(struct bio *bp) { struct cam_periph *periph; struct pass_softc *softc; @@ -471,16 +471,16 @@ passstrategy(struct buf *bp) * really work right now. So, we just pass back EINVAL to tell the * user to go away. */ - bp->b_error = EINVAL; + bp->bio_error = EINVAL; goto bad; - /* unit = dkunit(bp->b_dev); */ + /* unit = dkunit(bp->bio_dev); */ /* XXX KDM fix this */ - unit = minor(bp->b_dev) & 0xff; + unit = minor(bp->bio_dev) & 0xff; periph = cam_extend_get(passperiphs, unit); if (periph == NULL) { - bp->b_error = ENXIO; + bp->bio_error = ENXIO; goto bad; } softc = (struct pass_softc *)periph->softc; @@ -489,8 +489,8 @@ passstrategy(struct buf *bp) * Odd number of bytes or negative offset */ /* valid request? */ - if (bp->b_blkno < 0) { - bp->b_error = EINVAL; + if (bp->bio_blkno < 0) { + bp->bio_error = EINVAL; goto bad; } @@ -501,7 +501,7 @@ passstrategy(struct buf *bp) */ s = splbio(); - bufq_insert_tail(&softc->buf_queue, bp); + bioq_insert_tail(&softc->bio_queue, bp); splx(s); @@ -512,12 +512,12 @@ passstrategy(struct buf *bp) return; bad: - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; /* * Correctly set the buf to indicate a completed xfer */ - bp->b_resid = bp->b_bcount; + bp->bio_resid = bp->bio_bcount; biodone(bp); return; } @@ -533,10 +533,10 @@ passstart(struct cam_periph *periph, union ccb *start_ccb) switch (softc->state) { case PASS_STATE_NORMAL: { - struct buf *bp; + struct bio *bp; s = splbio(); - bp = bufq_first(&softc->buf_queue); + bp = bioq_first(&softc->bio_queue); if (periph->immediate_priority <= periph->pinfo.priority) { start_ccb->ccb_h.ccb_type = PASS_CCB_WAITING; SLIST_INSERT_HEAD(&periph->ccb_list, &start_ccb->ccb_h, @@ -549,7 +549,7 @@ passstart(struct cam_periph *periph, union ccb *start_ccb) xpt_release_ccb(start_ccb); } else { - bufq_remove(&softc->buf_queue, bp); + bioq_remove(&softc->bio_queue, bp); devstat_start_transaction(&softc->device_stats); @@ -561,11 +561,11 @@ passstart(struct cam_periph *periph, union ccb *start_ccb) * For now, just biodone it with EIO so we don't * hang. */ - bp->b_error = EIO; - bp->b_ioflags |= BIO_ERROR; - bp->b_resid = bp->b_bcount; + bp->bio_error = EIO; + bp->bio_flags |= BIO_ERROR; + bp->bio_resid = bp->bio_bcount; biodone(bp); - bp = bufq_first(&softc->buf_queue); + bp = bioq_first(&softc->bio_queue); splx(s); xpt_action(start_ccb); @@ -590,14 +590,14 @@ passdone(struct cam_periph *periph, union ccb *done_ccb) switch (csio->ccb_h.ccb_type) { case PASS_CCB_BUFFER_IO: { - struct buf *bp; + struct bio *bp; cam_status status; u_int8_t scsi_status; devstat_trans_flags ds_flags; status = done_ccb->ccb_h.status; scsi_status = done_ccb->csio.scsi_status; - bp = (struct buf *)done_ccb->ccb_h.ccb_bp; + bp = (struct bio *)done_ccb->ccb_h.ccb_bp; /* XXX handle errors */ if (!(((status & CAM_STATUS_MASK) == CAM_REQ_CMP) && (scsi_status == SCSI_STATUS_OK))) { @@ -615,8 +615,8 @@ passdone(struct cam_periph *periph, union ccb *done_ccb) * XXX unfreeze the queue after we complete * the abort process */ - bp->b_error = error; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = error; + bp->bio_flags |= BIO_ERROR; } if ((done_ccb->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) @@ -626,7 +626,7 @@ passdone(struct cam_periph *periph, union ccb *done_ccb) else ds_flags = DEVSTAT_NO_DATA; - devstat_end_transaction_buf(&softc->device_stats, bp); + devstat_end_transaction_bio(&softc->device_stats, bp); biodone(bp); break; } diff --git a/sys/cam/scsi/scsi_pt.c b/sys/cam/scsi/scsi_pt.c index cd4e98c..2f6e4db 100644 --- a/sys/cam/scsi/scsi_pt.c +++ b/sys/cam/scsi/scsi_pt.c @@ -76,7 +76,7 @@ typedef enum { #define ccb_bp ppriv_ptr1 struct pt_softc { - struct buf_queue_head buf_queue; + struct bio_queue_head bio_queue; struct devstat device_stats; LIST_HEAD(, ccb_hdr) pending_ccbs; pt_state state; @@ -215,17 +215,17 @@ ptclose(dev_t dev, int flag, int fmt, struct proc *p) * only one physical transfer. */ static void -ptstrategy(struct buf *bp) +ptstrategy(struct bio *bp) { struct cam_periph *periph; struct pt_softc *softc; u_int unit; int s; - unit = minor(bp->b_dev); + unit = minor(bp->bio_dev); periph = cam_extend_get(ptperiphs, unit); if (periph == NULL) { - bp->b_error = ENXIO; + bp->bio_error = ENXIO; goto bad; } softc = (struct pt_softc *)periph->softc; @@ -242,14 +242,14 @@ ptstrategy(struct buf *bp) */ if ((softc->flags & PT_FLAG_DEVICE_INVALID)) { splx(s); - bp->b_error = ENXIO; + bp->bio_error = ENXIO; goto bad; } /* * Place it in the queue of disk activities for this disk */ - bufq_insert_tail(&softc->buf_queue, bp); + bioq_insert_tail(&softc->bio_queue, bp); splx(s); @@ -260,12 +260,12 @@ ptstrategy(struct buf *bp) return; bad: - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; /* * Correctly set the buf to indicate a completed xfer */ - bp->b_resid = bp->b_bcount; + bp->bio_resid = bp->bio_bcount; biodone(bp); } @@ -339,7 +339,7 @@ ptctor(struct cam_periph *periph, void *arg) bzero(softc, sizeof(*softc)); LIST_INIT(&softc->pending_ccbs); softc->state = PT_STATE_NORMAL; - bufq_init(&softc->buf_queue); + bioq_init(&softc->bio_queue); softc->io_timeout = SCSI_PT_DEFAULT_TIMEOUT * 1000; @@ -382,7 +382,7 @@ ptoninvalidate(struct cam_periph *periph) { int s; struct pt_softc *softc; - struct buf *q_bp; + struct bio *q_bp; struct ccb_setasync csa; softc = (struct pt_softc *)periph->softc; @@ -412,11 +412,11 @@ ptoninvalidate(struct cam_periph *periph) * XXX Handle any transactions queued to the card * with XPT_ABORT_CCB. */ - while ((q_bp = bufq_first(&softc->buf_queue)) != NULL){ - bufq_remove(&softc->buf_queue, q_bp); - q_bp->b_resid = q_bp->b_bcount; - q_bp->b_error = ENXIO; - q_bp->b_ioflags |= BIO_ERROR; + while ((q_bp = bioq_first(&softc->bio_queue)) != NULL){ + bioq_remove(&softc->bio_queue, q_bp); + q_bp->bio_resid = q_bp->bio_bcount; + q_bp->bio_error = ENXIO; + q_bp->bio_flags |= BIO_ERROR; biodone(q_bp); } @@ -506,7 +506,7 @@ static void ptstart(struct cam_periph *periph, union ccb *start_ccb) { struct pt_softc *softc; - struct buf *bp; + struct bio *bp; int s; softc = (struct pt_softc *)periph->softc; @@ -515,7 +515,7 @@ ptstart(struct cam_periph *periph, union ccb *start_ccb) * See if there is a buf with work for us to do.. */ s = splbio(); - bp = bufq_first(&softc->buf_queue); + bp = bioq_first(&softc->bio_queue); if (periph->immediate_priority <= periph->pinfo.priority) { CAM_DEBUG_PRINT(CAM_DEBUG_SUBTRACE, ("queuing for immediate ccb\n")); @@ -531,7 +531,7 @@ ptstart(struct cam_periph *periph, union ccb *start_ccb) } else { int oldspl; - bufq_remove(&softc->buf_queue, bp); + bioq_remove(&softc->bio_queue, bp); devstat_start_transaction(&softc->device_stats); @@ -539,10 +539,10 @@ ptstart(struct cam_periph *periph, union ccb *start_ccb) /*retries*/4, ptdone, MSG_SIMPLE_Q_TAG, - bp->b_iocmd == BIO_READ, + bp->bio_cmd == BIO_READ, /*byte2*/0, - bp->b_bcount, - bp->b_data, + bp->bio_bcount, + bp->bio_data, /*sense_len*/SSD_FULL_SIZE, /*timeout*/softc->io_timeout); @@ -558,7 +558,7 @@ ptstart(struct cam_periph *periph, union ccb *start_ccb) splx(oldspl); start_ccb->ccb_h.ccb_bp = bp; - bp = bufq_first(&softc->buf_queue); + bp = bioq_first(&softc->bio_queue); splx(s); xpt_action(start_ccb); @@ -582,10 +582,10 @@ ptdone(struct cam_periph *periph, union ccb *done_ccb) case PT_CCB_BUFFER_IO: case PT_CCB_BUFFER_IO_UA: { - struct buf *bp; + struct bio *bp; int oldspl; - bp = (struct buf *)done_ccb->ccb_h.ccb_bp; + bp = (struct bio *)done_ccb->ccb_h.ccb_bp; if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { int error; int s; @@ -606,7 +606,7 @@ ptdone(struct cam_periph *periph, union ccb *done_ccb) return; } if (error != 0) { - struct buf *q_bp; + struct bio *q_bp; s = splbio(); @@ -625,24 +625,24 @@ ptdone(struct cam_periph *periph, union ccb *done_ccb) * the client can retry these I/Os in the * proper order should it attempt to recover. */ - while ((q_bp = bufq_first(&softc->buf_queue)) + while ((q_bp = bioq_first(&softc->bio_queue)) != NULL) { - bufq_remove(&softc->buf_queue, q_bp); - q_bp->b_resid = q_bp->b_bcount; - q_bp->b_error = EIO; - q_bp->b_ioflags |= BIO_ERROR; + bioq_remove(&softc->bio_queue, q_bp); + q_bp->bio_resid = q_bp->bio_bcount; + q_bp->bio_error = EIO; + q_bp->bio_flags |= BIO_ERROR; biodone(q_bp); } splx(s); - bp->b_error = error; - bp->b_resid = bp->b_bcount; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = error; + bp->bio_resid = bp->bio_bcount; + bp->bio_flags |= BIO_ERROR; } else { - bp->b_resid = csio->resid; - bp->b_error = 0; - if (bp->b_resid != 0) { + bp->bio_resid = csio->resid; + bp->bio_error = 0; + if (bp->bio_resid != 0) { /* Short transfer ??? */ - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; } } if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) @@ -652,9 +652,9 @@ ptdone(struct cam_periph *periph, union ccb *done_ccb) /*timeout*/0, /*getcount_only*/0); } else { - bp->b_resid = csio->resid; - if (bp->b_resid != 0) - bp->b_ioflags |= BIO_ERROR; + bp->bio_resid = csio->resid; + if (bp->bio_resid != 0) + bp->bio_flags |= BIO_ERROR; } /* @@ -665,7 +665,7 @@ ptdone(struct cam_periph *periph, union ccb *done_ccb) LIST_REMOVE(&done_ccb->ccb_h, periph_links.le); splx(oldspl); - devstat_end_transaction_buf(&softc->device_stats, bp); + devstat_end_transaction_bio(&softc->device_stats, bp); biodone(bp); break; } diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c index 138c51a..0e1b46e 100644 --- a/sys/cam/scsi/scsi_sa.c +++ b/sys/cam/scsi/scsi_sa.c @@ -190,7 +190,7 @@ struct sa_softc { sa_state state; sa_flags flags; sa_quirks quirks; - struct buf_queue_head buf_queue; + struct bio_queue_head bio_queue; int queue_count; struct devstat device_stats; struct sa_devs devs; @@ -620,21 +620,21 @@ saclose(dev_t dev, int flag, int fmt, struct proc *p) * only one physical transfer. */ static void -sastrategy(struct buf *bp) +sastrategy(struct bio *bp) { struct cam_periph *periph; struct sa_softc *softc; u_int unit; int s; - if (SA_IS_CTRL(bp->b_dev)) { - bp->b_error = EINVAL; + if (SA_IS_CTRL(bp->bio_dev)) { + bp->bio_error = EINVAL; goto bad; } - unit = SAUNIT(bp->b_dev); + unit = SAUNIT(bp->bio_dev); periph = cam_extend_get(saperiphs, unit); if (periph == NULL) { - bp->b_error = ENXIO; + bp->bio_error = ENXIO; goto bad; } softc = (struct sa_softc *)periph->softc; @@ -643,13 +643,13 @@ sastrategy(struct buf *bp) if (softc->flags & SA_FLAG_INVALID) { splx(s); - bp->b_error = ENXIO; + bp->bio_error = ENXIO; goto bad; } if (softc->flags & SA_FLAG_TAPE_FROZEN) { splx(s); - bp->b_error = EPERM; + bp->bio_error = EPERM; goto bad; } @@ -658,7 +658,7 @@ sastrategy(struct buf *bp) /* * If it's a null transfer, return immediatly */ - if (bp->b_bcount == 0) + if (bp->bio_bcount == 0) goto done; /* valid request? */ @@ -668,19 +668,19 @@ sastrategy(struct buf *bp) * be a multiple of our block size. */ if (((softc->blk_mask != ~0) && - ((bp->b_bcount & softc->blk_mask) != 0)) || + ((bp->bio_bcount & softc->blk_mask) != 0)) || ((softc->blk_mask == ~0) && - ((bp->b_bcount % softc->min_blk) != 0))) { + ((bp->bio_bcount % softc->min_blk) != 0))) { xpt_print_path(periph->path); printf("Invalid request. Fixed block device " "requests must be a multiple " "of %d bytes\n", softc->min_blk); - bp->b_error = EINVAL; + bp->bio_error = EINVAL; goto bad; } - } else if ((bp->b_bcount > softc->max_blk) || - (bp->b_bcount < softc->min_blk) || - (bp->b_bcount & softc->blk_mask) != 0) { + } else if ((bp->bio_bcount > softc->max_blk) || + (bp->bio_bcount < softc->min_blk) || + (bp->bio_bcount & softc->blk_mask) != 0) { xpt_print_path(periph->path); printf("Invalid request. Variable block device " @@ -690,7 +690,7 @@ sastrategy(struct buf *bp) } printf("between %d and %d bytes\n", softc->min_blk, softc->max_blk); - bp->b_error = EINVAL; + bp->bio_error = EINVAL; goto bad; } @@ -704,13 +704,13 @@ sastrategy(struct buf *bp) /* * Place it at the end of the queue. */ - bufq_insert_tail(&softc->buf_queue, bp); + bioq_insert_tail(&softc->bio_queue, bp); softc->queue_count++; CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("sastrategy: enqueuing a %d " - "%s byte %s queue count now %d\n", (int) bp->b_bcount, + "%s byte %s queue count now %d\n", (int) bp->bio_bcount, (softc->flags & SA_FLAG_FIXED)? "fixed" : "variable", - (bp->b_iocmd == BIO_READ)? "read" : "write", softc->queue_count)); + (bp->bio_cmd == BIO_READ)? "read" : "write", softc->queue_count)); splx(s); @@ -721,13 +721,13 @@ sastrategy(struct buf *bp) return; bad: - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; done: /* * Correctly set the buf to indicate a completed xfer */ - bp->b_resid = bp->b_bcount; + bp->bio_resid = bp->bio_bcount; biodone(bp); } @@ -1221,7 +1221,7 @@ static void saoninvalidate(struct cam_periph *periph) { struct sa_softc *softc; - struct buf *q_bp; + struct bio *q_bp; struct ccb_setasync csa; int s; @@ -1252,11 +1252,11 @@ saoninvalidate(struct cam_periph *periph) * XXX Handle any transactions queued to the card * with XPT_ABORT_CCB. */ - while ((q_bp = bufq_first(&softc->buf_queue)) != NULL){ - bufq_remove(&softc->buf_queue, q_bp); - q_bp->b_resid = q_bp->b_bcount; - q_bp->b_error = ENXIO; - q_bp->b_ioflags |= BIO_ERROR; + while ((q_bp = bioq_first(&softc->bio_queue)) != NULL){ + bioq_remove(&softc->bio_queue, q_bp); + q_bp->bio_resid = q_bp->bio_bcount; + q_bp->bio_error = ENXIO; + q_bp->bio_flags |= BIO_ERROR; biodone(q_bp); } softc->queue_count = 0; @@ -1367,7 +1367,7 @@ saregister(struct cam_periph *periph, void *arg) softc->fileno = (daddr_t) -1; softc->blkno = (daddr_t) -1; - bufq_init(&softc->buf_queue); + bioq_init(&softc->bio_queue); periph->softc = softc; cam_extend_set(saperiphs, periph->unit_number, periph); @@ -1464,14 +1464,14 @@ sastart(struct cam_periph *periph, union ccb *start_ccb) case SA_STATE_NORMAL: { /* Pull a buffer from the queue and get going on it */ - struct buf *bp; + struct bio *bp; int s; /* * See if there is a buf with work for us to do.. */ s = splbio(); - bp = bufq_first(&softc->buf_queue); + bp = bioq_first(&softc->bio_queue); if (periph->immediate_priority <= periph->pinfo.priority) { CAM_DEBUG_PRINT(CAM_DEBUG_SUBTRACE, ("queuing for immediate ccb\n")); @@ -1485,25 +1485,25 @@ sastart(struct cam_periph *periph, union ccb *start_ccb) splx(s); xpt_release_ccb(start_ccb); } else if ((softc->flags & SA_FLAG_ERR_PENDING) != 0) { - struct buf *done_bp; + struct bio *done_bp; softc->queue_count--; - bufq_remove(&softc->buf_queue, bp); - bp->b_resid = bp->b_bcount; - bp->b_ioflags |= BIO_ERROR; + bioq_remove(&softc->bio_queue, bp); + bp->bio_resid = bp->bio_bcount; + bp->bio_flags |= BIO_ERROR; if ((softc->flags & SA_FLAG_EOM_PENDING) != 0) { - if (bp->b_iocmd == BIO_WRITE) - bp->b_error = ENOSPC; + if (bp->bio_cmd == BIO_WRITE) + bp->bio_error = ENOSPC; else - bp->b_error = EIO; + bp->bio_error = EIO; } if ((softc->flags & SA_FLAG_EOF_PENDING) != 0) { - bp->b_error = EIO; + bp->bio_error = EIO; } if ((softc->flags & SA_FLAG_EIO_PENDING) != 0) { - bp->b_error = EIO; + bp->bio_error = EIO; } done_bp = bp; - bp = bufq_first(&softc->buf_queue); + bp = bioq_first(&softc->bio_queue); /* * Only if we have no other buffers queued up * do we clear the pending error flag. @@ -1521,18 +1521,18 @@ sastart(struct cam_periph *periph, union ccb *start_ccb) } else { u_int32_t length; - bufq_remove(&softc->buf_queue, bp); + bioq_remove(&softc->bio_queue, bp); softc->queue_count--; if ((softc->flags & SA_FLAG_FIXED) != 0) { if (softc->blk_shift != 0) { length = - bp->b_bcount >> softc->blk_shift; + bp->bio_bcount >> softc->blk_shift; } else if (softc->media_blksize != 0) { length = - bp->b_bcount / softc->media_blksize; + bp->bio_bcount / softc->media_blksize; } else { - bp->b_error = EIO; + bp->bio_error = EIO; xpt_print_path(periph->path); printf("zero blocksize for " "FIXED length writes?\n"); @@ -1543,7 +1543,7 @@ sastart(struct cam_periph *periph, union ccb *start_ccb) CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("Fixed Record Count is %d\n", length)); } else { - length = bp->b_bcount; + length = bp->bio_bcount; CAM_DEBUG(start_ccb->ccb_h.path, CAM_DEBUG_INFO, ("Variable Record Count is %d\n", length)); } @@ -1568,16 +1568,16 @@ sastart(struct cam_periph *periph, union ccb *start_ccb) * have to do deal with 512 byte or 1KB intermediate * records. */ - softc->dsreg = (bp->b_iocmd == BIO_READ)? + softc->dsreg = (bp->bio_cmd == BIO_READ)? MTIO_DSREG_RD : MTIO_DSREG_WR; scsi_sa_read_write(&start_ccb->csio, 0, sadone, - MSG_SIMPLE_Q_TAG, (bp->b_iocmd == BIO_READ), + MSG_SIMPLE_Q_TAG, (bp->bio_cmd == BIO_READ), FALSE, (softc->flags & SA_FLAG_FIXED) != 0, - length, bp->b_data, bp->b_bcount, SSD_FULL_SIZE, + length, bp->bio_data, bp->bio_bcount, SSD_FULL_SIZE, 120 * 60 * 1000); start_ccb->ccb_h.ccb_type = SA_CCB_BUFFER_IO; start_ccb->ccb_h.ccb_bp = bp; - bp = bufq_first(&softc->buf_queue); + bp = bioq_first(&softc->bio_queue); splx(s); xpt_action(start_ccb); } @@ -1607,11 +1607,11 @@ sadone(struct cam_periph *periph, union ccb *done_ccb) switch (csio->ccb_h.ccb_type) { case SA_CCB_BUFFER_IO: { - struct buf *bp; + struct bio *bp; int error; softc->dsreg = MTIO_DSREG_REST; - bp = (struct buf *)done_ccb->ccb_h.ccb_bp; + bp = (struct bio *)done_ccb->ccb_h.ccb_bp; error = 0; if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { if ((error = saerror(done_ccb, 0, 0)) == ERESTART) { @@ -1624,7 +1624,7 @@ sadone(struct cam_periph *periph, union ccb *done_ccb) if (error == EIO) { int s; - struct buf *q_bp; + struct bio *q_bp; /* * Catastrophic error. Mark the tape as frozen @@ -1639,29 +1639,29 @@ sadone(struct cam_periph *periph, union ccb *done_ccb) s = splbio(); softc->flags |= SA_FLAG_TAPE_FROZEN; - while ((q_bp = bufq_first(&softc->buf_queue)) != NULL) { - bufq_remove(&softc->buf_queue, q_bp); - q_bp->b_resid = q_bp->b_bcount; - q_bp->b_error = EIO; - q_bp->b_ioflags |= BIO_ERROR; + while ((q_bp = bioq_first(&softc->bio_queue)) != NULL) { + bioq_remove(&softc->bio_queue, q_bp); + q_bp->bio_resid = q_bp->bio_bcount; + q_bp->bio_error = EIO; + q_bp->bio_flags |= BIO_ERROR; biodone(q_bp); } splx(s); } if (error != 0) { - bp->b_resid = bp->b_bcount; - bp->b_error = error; - bp->b_ioflags |= BIO_ERROR; + bp->bio_resid = bp->bio_bcount; + bp->bio_error = error; + bp->bio_flags |= BIO_ERROR; /* * In the error case, position is updated in saerror. */ } else { - bp->b_resid = csio->resid; - bp->b_error = 0; + bp->bio_resid = csio->resid; + bp->bio_error = 0; if (csio->resid != 0) { - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; } - if (bp->b_iocmd == BIO_WRITE) { + if (bp->bio_cmd == BIO_WRITE) { softc->flags |= SA_FLAG_TAPE_WRITTEN; softc->filemarks = 0; } @@ -1669,10 +1669,10 @@ sadone(struct cam_periph *periph, union ccb *done_ccb) if ((softc->flags & SA_FLAG_FIXED) != 0) { u_int32_t l; if (softc->blk_shift != 0) { - l = bp->b_bcount >> + l = bp->bio_bcount >> softc->blk_shift; } else { - l = bp->b_bcount / + l = bp->bio_bcount / softc->media_blksize; } softc->blkno += (daddr_t) l; @@ -1688,13 +1688,13 @@ sadone(struct cam_periph *periph, union ccb *done_ccb) if (error || (softc->flags & SA_FLAG_ERR_PENDING)) cam_release_devq(done_ccb->ccb_h.path, 0, 0, 0, 0); #ifdef CAMDEBUG - if (error || bp->b_resid) { + if (error || bp->bio_resid) { CAM_DEBUG(periph->path, CAM_DEBUG_INFO, ("error %d resid %ld count %ld\n", error, - bp->b_resid, bp->b_bcount)); + bp->bio_resid, bp->bio_bcount)); } #endif - devstat_end_transaction_buf(&softc->device_stats, bp); + devstat_end_transaction_bio(&softc->device_stats, bp); biodone(bp); break; } diff --git a/sys/cam/scsi/scsi_target.c b/sys/cam/scsi/scsi_target.c index 6b6dfec..e5cc611 100644 --- a/sys/cam/scsi/scsi_target.c +++ b/sys/cam/scsi/scsi_target.c @@ -124,13 +124,13 @@ struct targ_softc { * Userland buffers for SEND commands waiting for * SEND ATIOs to be queued by an initiator. */ - struct buf_queue_head snd_buf_queue; + struct bio_queue_head snd_bio_queue; /* * Userland buffers for RCV commands waiting for * RCV ATIOs to be queued by an initiator. */ - struct buf_queue_head rcv_buf_queue; + struct bio_queue_head rcv_bio_queue; struct devstat device_stats; dev_t targ_dev; struct selinfo snd_select; @@ -152,7 +152,7 @@ struct targ_cmd_desc { u_int data_increment;/* Amount to send before next disconnect */ void* data; /* The data. Can be from backing_store or not */ void* backing_store;/* Backing store allocated for this descriptor*/ - struct buf *bp; /* Buffer for this transfer */ + struct bio *bp; /* Buffer for this transfer */ u_int max_size; /* Size of backing_store */ u_int32_t timeout; u_int8_t status; /* Status to return to initiator */ @@ -457,8 +457,8 @@ targctor(struct cam_periph *periph, void *arg) TAILQ_INIT(&softc->snd_ccb_queue); TAILQ_INIT(&softc->rcv_ccb_queue); TAILQ_INIT(&softc->unknown_atio_queue); - bufq_init(&softc->snd_buf_queue); - bufq_init(&softc->rcv_buf_queue); + bioq_init(&softc->snd_bio_queue); + bioq_init(&softc->rcv_bio_queue); softc->accept_tio_list = NULL; SLIST_INIT(&softc->immed_notify_slist); softc->state = TARG_STATE_NORMAL; @@ -1029,12 +1029,12 @@ targpoll(dev_t dev, int poll_events, struct proc *p) s = splcam(); if ((poll_events & (POLLOUT | POLLWRNORM)) != 0) { if (TAILQ_FIRST(&softc->rcv_ccb_queue) != NULL - && bufq_first(&softc->rcv_buf_queue) == NULL) + && bioq_first(&softc->rcv_bio_queue) == NULL) revents |= poll_events & (POLLOUT | POLLWRNORM); } if ((poll_events & (POLLIN | POLLRDNORM)) != 0) { if (TAILQ_FIRST(&softc->snd_ccb_queue) != NULL - && bufq_first(&softc->snd_buf_queue) == NULL) + && bioq_first(&softc->snd_bio_queue) == NULL) revents |= poll_events & (POLLIN | POLLRDNORM); } @@ -1117,24 +1117,24 @@ targwrite(dev_t dev, struct uio *uio, int ioflag) * only one physical transfer. */ static void -targstrategy(struct buf *bp) +targstrategy(struct bio *bp) { struct cam_periph *periph; struct targ_softc *softc; u_int unit; int s; - unit = minor(bp->b_dev); + unit = minor(bp->bio_dev); /* ioctl is the only supported operation of the control device */ if (TARG_IS_CONTROL_DEV(unit)) { - bp->b_error = EINVAL; + bp->bio_error = EINVAL; goto bad; } periph = cam_extend_get(targperiphs, unit); if (periph == NULL) { - bp->b_error = ENXIO; + bp->bio_error = ENXIO; goto bad; } softc = (struct targ_softc *)periph->softc; @@ -1153,9 +1153,9 @@ targstrategy(struct buf *bp) splx(s); if (softc->state == TARG_STATE_EXCEPTION && (softc->exceptions & TARG_EXCEPT_DEVICE_INVALID) == 0) - bp->b_error = EBUSY; + bp->bio_error = EBUSY; else - bp->b_error = ENXIO; + bp->bio_error = ENXIO; goto bad; } @@ -1164,15 +1164,15 @@ targstrategy(struct buf *bp) * SEND or RECEIVE commands. * */ - bp->b_resid = bp->b_bcount; - if (bp->b_iocmd == BIO_READ) { + bp->bio_resid = bp->bio_bcount; + if (bp->bio_cmd == BIO_READ) { CAM_DEBUG(periph->path, CAM_DEBUG_PERIPH, ("Queued a SEND buffer\n")); - bufq_insert_tail(&softc->snd_buf_queue, bp); + bioq_insert_tail(&softc->snd_bio_queue, bp); } else { CAM_DEBUG(periph->path, CAM_DEBUG_PERIPH, ("Queued a RECEIVE buffer\n")); - bufq_insert_tail(&softc->rcv_buf_queue, bp); + bioq_insert_tail(&softc->rcv_bio_queue, bp); } splx(s); @@ -1185,12 +1185,12 @@ targstrategy(struct buf *bp) return; bad: - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; /* * Correctly set the buf to indicate a completed xfer */ - bp->b_resid = bp->b_bcount; + bp->bio_resid = bp->bio_bcount; biodone(bp); } @@ -1199,15 +1199,15 @@ targrunqueue(struct cam_periph *periph, struct targ_softc *softc) { struct ccb_queue *pending_queue; struct ccb_accept_tio *atio; - struct buf_queue_head *bufq; - struct buf *bp; + struct bio_queue_head *bioq; + struct bio *bp; struct targ_cmd_desc *desc; struct ccb_hdr *ccbh; int s; s = splbio(); pending_queue = NULL; - bufq = NULL; + bioq = NULL; ccbh = NULL; /* Only run one request at a time to maintain data ordering. */ if (softc->state != TARG_STATE_NORMAL @@ -1217,7 +1217,7 @@ targrunqueue(struct cam_periph *periph, struct targ_softc *softc) return; } - if (((bp = bufq_first(&softc->snd_buf_queue)) != NULL + if (((bp = bioq_first(&softc->snd_bio_queue)) != NULL || (softc->flags & TARG_FLAG_SEND_EOF) != 0) && (ccbh = TAILQ_FIRST(&softc->snd_ccb_queue)) != NULL) { @@ -1226,11 +1226,11 @@ targrunqueue(struct cam_periph *periph, struct targ_softc *softc) else { CAM_DEBUG(periph->path, CAM_DEBUG_PERIPH, ("De-Queued a SEND buffer %ld\n", - bp->b_bcount)); + bp->bio_bcount)); } - bufq = &softc->snd_buf_queue; + bioq = &softc->snd_bio_queue; pending_queue = &softc->snd_ccb_queue; - } else if (((bp = bufq_first(&softc->rcv_buf_queue)) != NULL + } else if (((bp = bioq_first(&softc->rcv_bio_queue)) != NULL || (softc->flags & TARG_FLAG_RECEIVE_EOF) != 0) && (ccbh = TAILQ_FIRST(&softc->rcv_ccb_queue)) != NULL) { @@ -1239,9 +1239,9 @@ targrunqueue(struct cam_periph *periph, struct targ_softc *softc) else { CAM_DEBUG(periph->path, CAM_DEBUG_PERIPH, ("De-Queued a RECEIVE buffer %ld\n", - bp->b_bcount)); + bp->bio_bcount)); } - bufq = &softc->rcv_buf_queue; + bioq = &softc->rcv_bio_queue; pending_queue = &softc->rcv_ccb_queue; } @@ -1259,10 +1259,10 @@ targrunqueue(struct cam_periph *periph, struct targ_softc *softc) atio->ccb_h.flags &= ~CAM_DIR_MASK; atio->ccb_h.flags |= CAM_DIR_NONE; } else { - bufq_remove(bufq, bp); - desc->data = &bp->b_data[bp->b_bcount - bp->b_resid]; + bioq_remove(bioq, bp); + desc->data = &bp->bio_data[bp->bio_bcount - bp->bio_resid]; desc->data_increment = - MIN(desc->data_resid, bp->b_resid); + MIN(desc->data_resid, bp->bio_resid); desc->data_increment = MIN(desc->data_increment, 32); } @@ -1634,7 +1634,7 @@ targdone(struct cam_periph *periph, union ccb *done_ccb) struct ccb_scsiio *csio; struct ccb_accept_tio *atio; struct targ_cmd_desc *desc; - struct buf *bp; + struct bio *bp; int error; CAM_DEBUG(periph->path, CAM_DEBUG_PERIPH, @@ -1686,23 +1686,23 @@ targdone(struct cam_periph *periph, union ccb *done_ccb) desc->data_resid -= desc->data_increment; if ((bp = desc->bp) != NULL) { - bp->b_resid -= desc->data_increment; - bp->b_error = error; + bp->bio_resid -= desc->data_increment; + bp->bio_error = error; CAM_DEBUG(periph->path, CAM_DEBUG_PERIPH, ("Buffer I/O Completed - Resid %ld:%d\n", - bp->b_resid, desc->data_resid)); + bp->bio_resid, desc->data_resid)); /* * Send the buffer back to the client if * either the command has completed or all * buffer space has been consumed. */ if (desc->data_resid == 0 - || bp->b_resid == 0 + || bp->bio_resid == 0 || error != 0) { - if (bp->b_resid != 0) + if (bp->bio_resid != 0) /* Short transfer */ - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; CAM_DEBUG(periph->path, CAM_DEBUG_PERIPH, ("Completing a buffer\n")); @@ -1729,7 +1729,7 @@ targdone(struct cam_periph *periph, union ccb *done_ccb) if (atio->cdb_io.cdb_bytes[0] == SEND) { if (desc->bp != NULL) TAILQ_INSERT_HEAD( - &softc->snd_buf_queue.queue, + &softc->snd_bio_queue.queue, bp, b_act); TAILQ_INSERT_HEAD(&softc->snd_ccb_queue, &atio->ccb_h, @@ -1737,7 +1737,7 @@ targdone(struct cam_periph *periph, union ccb *done_ccb) } else { if (desc->bp != NULL) TAILQ_INSERT_HEAD( - &softc->rcv_buf_queue.queue, + &softc->rcv_bio_queue.queue, bp, b_act); TAILQ_INSERT_HEAD(&softc->rcv_ccb_queue, &atio->ccb_h, @@ -1747,8 +1747,8 @@ targdone(struct cam_periph *periph, union ccb *done_ccb) targrunqueue(periph, softc); } else { if (desc->bp != NULL) { - bp->b_ioflags |= BIO_ERROR; - bp->b_error = ENXIO; + bp->bio_flags |= BIO_ERROR; + bp->bio_error = ENXIO; biodone(bp); } freedescr(desc); @@ -1807,7 +1807,7 @@ targfireexception(struct cam_periph *periph, struct targ_softc *softc) * the waking process will wakeup, call our poll routine again, * and pick up the exception. */ - struct buf *bp; + struct bio *bp; if (softc->state != TARG_STATE_NORMAL) /* Already either tearing down or in exception state */ @@ -1815,15 +1815,15 @@ targfireexception(struct cam_periph *periph, struct targ_softc *softc) softc->state = TARG_STATE_EXCEPTION; - while ((bp = bufq_first(&softc->snd_buf_queue)) != NULL) { - bufq_remove(&softc->snd_buf_queue, bp); - bp->b_ioflags |= BIO_ERROR; + while ((bp = bioq_first(&softc->snd_bio_queue)) != NULL) { + bioq_remove(&softc->snd_bio_queue, bp); + bp->bio_flags |= BIO_ERROR; biodone(bp); } - while ((bp = bufq_first(&softc->rcv_buf_queue)) != NULL) { - bufq_remove(&softc->snd_buf_queue, bp); - bp->b_ioflags |= BIO_ERROR; + while ((bp = bioq_first(&softc->rcv_bio_queue)) != NULL) { + bioq_remove(&softc->snd_bio_queue, bp); + bp->bio_flags |= BIO_ERROR; biodone(bp); } @@ -2159,11 +2159,11 @@ abort_pending_transactions(struct cam_periph *periph, u_int initiator_id, CAM_DEBUG(periph->path, CAM_DEBUG_PERIPH, ("Aborting ATIO\n")); if (desc->bp != NULL) { - desc->bp->b_ioflags |= BIO_ERROR; + desc->bp->bio_flags |= BIO_ERROR; if (softc->state != TARG_STATE_TEARDOWN) - desc->bp->b_error = errno; + desc->bp->bio_error = errno; else - desc->bp->b_error = ENXIO; + desc->bp->bio_error = ENXIO; biodone(desc->bp); desc->bp = NULL; } diff --git a/sys/contrib/dev/fla/fla.c b/sys/contrib/dev/fla/fla.c index 7a81de8..baa7de0 100644 --- a/sys/contrib/dev/fla/fla.c +++ b/sys/contrib/dev/fla/fla.c @@ -116,7 +116,7 @@ static struct fla_s { int unit; unsigned nsect; struct doc2k_stat ds; - struct buf_queue_head buf_queue; + struct bio_queue_head bio_queue; struct devstat stats; struct disk disk; dev_t dev; @@ -184,7 +184,7 @@ flaioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) } static void -flastrategy(struct buf *bp) +flastrategy(struct bio *bp) { int unit, error; int s; @@ -192,15 +192,15 @@ flastrategy(struct buf *bp) enum doc2k_work what; if (fla_debug > 1) - printf("flastrategy(%p) %s %lx, %d, %ld, %p)\n", - bp, devtoname(bp->b_dev), bp->b_flags, bp->b_blkno, - bp->b_bcount / DEV_BSIZE, bp->b_data); + printf("flastrategy(%p) %s %x, %d, %ld, %p)\n", + bp, devtoname(bp->bio_dev), bp->bio_flags, bp->bio_blkno, + bp->bio_bcount / DEV_BSIZE, bp->bio_data); - sc = bp->b_dev->si_drv1; + sc = bp->bio_dev->si_drv1; s = splbio(); - bufqdisksort(&sc->buf_queue, bp); + bioqdisksort(&sc->bio_queue, bp); if (sc->busy) { splx(s); @@ -210,43 +210,43 @@ flastrategy(struct buf *bp) sc->busy++; while (1) { - bp = bufq_first(&sc->buf_queue); + bp = bioq_first(&sc->bio_queue); if (bp) - bufq_remove(&sc->buf_queue, bp); + bioq_remove(&sc->bio_queue, bp); splx(s); if (!bp) break; devstat_start_transaction(&sc->stats); - bp->b_resid = bp->b_bcount; - unit = dkunit(bp->b_dev); + bp->bio_resid = bp->bio_bcount; + unit = dkunit(bp->bio_dev); - if (bp->b_iocmd == BIO_DELETE) + if (bp->bio_cmd == BIO_DELETE) what = DOC2K_ERASE; - else if (bp->b_iocmd == BIO_READ) + else if (bp->bio_cmd == BIO_READ) what = DOC2K_READ; else what = DOC2K_WRITE; LEAVE(); - error = doc2k_rwe( unit, what, bp->b_pblkno, - bp->b_bcount / DEV_BSIZE, bp->b_data); + error = doc2k_rwe( unit, what, bp->bio_pblkno, + bp->bio_bcount / DEV_BSIZE, bp->bio_data); ENTER(); if (fla_debug > 1 || error) { printf("fla%d: %d = rwe(%p, %d, %d, %d, %ld, %p)\n", - unit, error, bp, unit, what, bp->b_pblkno, - bp->b_bcount / DEV_BSIZE, bp->b_data); + unit, error, bp, unit, what, bp->bio_pblkno, + bp->bio_bcount / DEV_BSIZE, bp->bio_data); } if (error) { - bp->b_error = EIO; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EIO; + bp->bio_flags |= BIO_ERROR; } else { - bp->b_resid = 0; + bp->bio_resid = 0; } - devstat_end_transaction_buf(&sc->stats, bp); + devstat_end_transaction_bio(&sc->stats, bp); biodone(bp); s = splbio(); @@ -322,7 +322,7 @@ flaattach (device_t dev) unit, sc->ds.type, sc->ds.unitSize, sc->ds.mediaSize, sc->ds.chipSize, sc->ds.interleaving, sc->ds.window); - bufq_init(&sc->buf_queue); + bioq_init(&sc->bio_queue); devstat_add_entry(&softc[unit].stats, "fla", unit, DEV_BSIZE, DEVSTAT_NO_ORDERED_TAGS, diff --git a/sys/dev/amr/amr.c b/sys/dev/amr/amr.c index 54ab85a..de6f965 100644 --- a/sys/dev/amr/amr.c +++ b/sys/dev/amr/amr.c @@ -337,7 +337,7 @@ amr_attach(struct amr_softc *sc) */ TAILQ_INIT(&sc->amr_work); TAILQ_INIT(&sc->amr_freecmds); - bufq_init(&sc->amr_bufq); + bioq_init(&sc->amr_bioq); /* * Configure for this controller type. @@ -503,7 +503,7 @@ amr_detach(device_t dev) * an operation which may add or delete system disks. (Call amr_startup to * resume normal operation.) * - * Note that we can assume that the bufq on the controller is empty, as we won't + * Note that we can assume that the bioq on the controller is empty, as we won't * allow shutdown if any device is open. */ int @@ -608,14 +608,14 @@ amr_intr(void *arg) * disk resource, then poke the disk resource to start as much work as it can. */ int -amr_submit_buf(struct amr_softc *sc, struct buf *bp) +amr_submit_buf(struct amr_softc *sc, struct bio *bp) { int s; debug("called"); s = splbio(); - bufq_insert_tail(&sc->amr_bufq, bp); + bioq_insert_tail(&sc->amr_bioq, bp); splx(s); sc->amr_waitbufs++; amr_startio(sc); @@ -884,7 +884,7 @@ amr_startio(struct amr_softc *sc) { struct amr_command *ac; struct amrd_softc *amrd; - struct buf *bp; + struct bio *bp; int blkcount; int driveno; int cmd; @@ -899,7 +899,7 @@ amr_startio(struct amr_softc *sc) for (;;) { /* see if there's work to be done */ - if ((bp = bufq_first(&sc->amr_bufq)) == NULL) + if ((bp = bioq_first(&sc->amr_bioq)) == NULL) break; /* get a command */ if ((ac = amr_alloccmd(sc)) == NULL) @@ -910,16 +910,16 @@ amr_startio(struct amr_softc *sc) break; } /* get the buf containing our work */ - bufq_remove(&sc->amr_bufq, bp); + bioq_remove(&sc->amr_bioq, bp); sc->amr_waitbufs--; splx(s); /* connect the buf to the command */ ac->ac_complete = amr_completeio; ac->ac_private = bp; - ac->ac_data = bp->b_data; - ac->ac_length = bp->b_bcount; - if (bp->b_iocmd == BIO_READ) { + ac->ac_data = bp->bio_data; + ac->ac_length = bp->bio_bcount; + if (bp->bio_cmd == BIO_READ) { ac->ac_flags |= AMR_CMD_DATAIN; cmd = AMR_CMD_LREAD; } else { @@ -931,20 +931,20 @@ amr_startio(struct amr_softc *sc) amr_mapcmd(ac); /* build a suitable I/O command (assumes 512-byte rounded transfers) */ - amrd = (struct amrd_softc *)bp->b_dev->si_drv1; + amrd = (struct amrd_softc *)bp->bio_dev->si_drv1; driveno = amrd->amrd_drive - sc->amr_drive; - blkcount = (bp->b_bcount + AMR_BLKSIZE - 1) / AMR_BLKSIZE; + blkcount = (bp->bio_bcount + AMR_BLKSIZE - 1) / AMR_BLKSIZE; - if ((bp->b_pblkno + blkcount) > sc->amr_drive[driveno].al_size) + if ((bp->bio_pblkno + blkcount) > sc->amr_drive[driveno].al_size) device_printf(sc->amr_dev, "I/O beyond end of unit (%u,%d > %u)\n", - bp->b_pblkno, blkcount, sc->amr_drive[driveno].al_size); + bp->bio_pblkno, blkcount, sc->amr_drive[driveno].al_size); /* * Build the I/O command. */ ac->ac_mailbox.mb_command = cmd; ac->ac_mailbox.mb_blkcount = blkcount; - ac->ac_mailbox.mb_lba = bp->b_pblkno; + ac->ac_mailbox.mb_lba = bp->bio_pblkno; ac->ac_mailbox.mb_physaddr = ac->ac_sgphys; ac->ac_mailbox.mb_drive = driveno; ac->ac_mailbox.mb_nsgelem = ac->ac_nsgent; @@ -968,15 +968,15 @@ static void amr_completeio(struct amr_command *ac) { struct amr_softc *sc = ac->ac_sc; - struct buf *bp = (struct buf *)ac->ac_private; + struct bio *bp = (struct bio *)ac->ac_private; int notify, release; notify = 1; release = 1; if (ac->ac_status != AMR_STATUS_SUCCESS) { /* could be more verbose here? */ - bp->b_error = EIO; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EIO; + bp->bio_flags |= BIO_ERROR; switch(ac->ac_status) { /* XXX need more information on I/O error reasons */ diff --git a/sys/dev/amr/amr_disk.c b/sys/dev/amr/amr_disk.c index 10cf0d6..3fd566b 100644 --- a/sys/dev/amr/amr_disk.c +++ b/sys/dev/amr/amr_disk.c @@ -172,29 +172,29 @@ amrd_ioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p) * be a multiple of a sector in length. */ static void -amrd_strategy(struct buf *bp) +amrd_strategy(struct bio *bp) { - struct amrd_softc *sc = (struct amrd_softc *)bp->b_dev->si_drv1; + struct amrd_softc *sc = (struct amrd_softc *)bp->bio_dev->si_drv1; debug("called to %s %d bytes at b_blkno 0x%x b_pblkno 0x%x", - (bp->b_flags & B_READ) ? "read" : "write", bp->b_bcount, bp->b_blkno, bp->b_pblkno); + (bp->b_flags & B_READ) ? "read" : "write", bp->bio_bcount, bp->bio_blkno, bp->bio_pblkno); /* bogus disk? */ if (sc == NULL) { - bp->b_error = EINVAL; + bp->bio_error = EINVAL; goto bad; } #if 0 /* XXX may only be temporarily offline - sleep? */ if (sc->amrd_drive->ld_state == AMR_SYSD_OFFLINE) { - bp->b_error = ENXIO; + bp->bio_error = ENXIO; goto bad; } #endif /* do-nothing operation */ - if (bp->b_bcount == 0) + if (bp->bio_bcount == 0) goto done; devstat_start_transaction(&sc->amrd_stats); @@ -202,13 +202,13 @@ amrd_strategy(struct buf *bp) return; bad: - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; done: /* * Correctly set the buf to indicate a completed transfer */ - bp->b_resid = bp->b_bcount; + bp->bio_resid = bp->bio_bcount; biodone(bp); return; } @@ -216,24 +216,24 @@ amrd_strategy(struct buf *bp) void amrd_intr(void *data) { - struct buf *bp = (struct buf *)data; - struct amrd_softc *sc = (struct amrd_softc *)bp->b_dev->si_drv1; + struct bio *bp = (struct bio *)data; + struct amrd_softc *sc = (struct amrd_softc *)bp->bio_dev->si_drv1; debug("called"); - if (bp->b_ioflags & BIO_ERROR) { - bp->b_error = EIO; + if (bp->bio_flags & BIO_ERROR) { + bp->bio_error = EIO; debug("i/o error\n"); } else { #if 0 int i; for (i = 0; i < 512; i += 16) - debug(" %04x %16D", i, bp->b_data + i, " "); + debug(" %04x %16D", i, bp->bio_data + i, " "); #endif - bp->b_resid = 0; + bp->bio_resid = 0; } - devstat_end_transaction_buf(&sc->amrd_stats, bp); + devstat_end_transaction_bio(&sc->amrd_stats, bp); biodone(bp); } diff --git a/sys/dev/amr/amrvar.h b/sys/dev/amr/amrvar.h index 84777b5..5edfb1f 100644 --- a/sys/dev/amr/amrvar.h +++ b/sys/dev/amr/amrvar.h @@ -136,7 +136,7 @@ struct amr_softc struct callout_handle amr_timeout; /* periodic status check */ /* per-controller queues */ - struct buf_queue_head amr_bufq; /* pending I/O */ + struct bio_queue_head amr_bioq; /* pending I/O */ int amr_waitbufs; struct amr_command *amr_busycmd[AMR_MAXCMD]; int amr_busycmdcount; @@ -239,7 +239,7 @@ struct amrd_softc /* * Interface between driver core and disk driver (should be using a bus?) */ -extern int amr_submit_buf(struct amr_softc *sc, struct buf *bp); +extern int amr_submit_buf(struct amr_softc *sc, struct bio *bp); extern int amr_submit_ioctl(struct amr_softc *sc, struct amr_logdrive *drive, u_long cmd, caddr_t addr, int32_t flag, struct proc *p); extern void amrd_intr(void *data); diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index b830046..2f0460f 100644 --- a/sys/dev/ata/ata-disk.c +++ b/sys/dev/ata/ata-disk.c @@ -202,7 +202,7 @@ ad_attach(struct ata_softc *scp, int32_t device) dev->si_iosize_max = 256 * DEV_BSIZE; adp->dev2 = dev; - bufq_init(&adp->queue); + bioq_init(&adp->queue); } void @@ -234,20 +234,20 @@ adopen(dev_t dev, int32_t flags, int32_t fmt, struct proc *p) } static void -adstrategy(struct buf *bp) +adstrategy(struct bio *bp) { - struct ad_softc *adp = bp->b_dev->si_drv1; + struct ad_softc *adp = bp->bio_dev->si_drv1; int32_t s; /* if it's a null transfer, return immediatly. */ - if (bp->b_bcount == 0) { - bp->b_resid = 0; + if (bp->bio_bcount == 0) { + bp->bio_resid = 0; biodone(bp); return; } s = splbio(); - bufqdisksort(&adp->queue, bp); + bioqdisksort(&adp->queue, bp); ata_start(adp->controller); splx(s); } @@ -319,7 +319,7 @@ addump(dev_t dev) void ad_start(struct ad_softc *adp) { - struct buf *bp = bufq_first(&adp->queue); + struct bio *bp = bioq_first(&adp->queue); struct ad_request *request; if (!bp) @@ -334,13 +334,13 @@ ad_start(struct ad_softc *adp) bzero(request, sizeof(struct ad_request)); request->device = adp; request->bp = bp; - request->blockaddr = bp->b_pblkno; - request->bytecount = bp->b_bcount; - request->data = bp->b_data; - request->flags = (bp->b_iocmd == BIO_READ) ? ADR_F_READ : 0; + request->blockaddr = bp->bio_pblkno; + request->bytecount = bp->bio_bcount; + request->data = bp->bio_data; + request->flags = (bp->bio_cmd == BIO_READ) ? ADR_F_READ : 0; /* remove from drive queue */ - bufq_remove(&adp->queue, bp); + bioq_remove(&adp->queue, bp); /* link onto controller queue */ TAILQ_INSERT_TAIL(&adp->controller->ata_queue, request, chain); @@ -538,8 +538,8 @@ oops: /* finish up transfer */ if (request->flags & ADR_F_ERROR) { - request->bp->b_error = EIO; - request->bp->b_ioflags |= BIO_ERROR; + request->bp->bio_error = EIO; + request->bp->bio_flags |= BIO_ERROR; } else { request->bytecount -= request->currentsize; @@ -550,8 +550,8 @@ oops: } } - request->bp->b_resid = request->bytecount; - devstat_end_transaction_buf(&adp->stats, request->bp); + request->bp->bio_resid = request->bytecount; + devstat_end_transaction_bio(&adp->stats, request->bp); biodone(request->bp); /* disarm timeout for this transfer */ @@ -598,9 +598,9 @@ ad_timeout(struct ad_request *request) TAILQ_INSERT_HEAD(&adp->controller->ata_queue, request, chain); else { /* retries all used up, return error */ - request->bp->b_error = EIO; - request->bp->b_ioflags |= BIO_ERROR; - devstat_end_transaction_buf(&adp->stats, request->bp); + request->bp->bio_error = EIO; + request->bp->bio_flags |= BIO_ERROR; + devstat_end_transaction_bio(&adp->stats, request->bp); biodone(request->bp); free(request, M_AD); } diff --git a/sys/dev/ata/ata-disk.h b/sys/dev/ata/ata-disk.h index 91e9fad..4a184d9 100644 --- a/sys/dev/ata/ata-disk.h +++ b/sys/dev/ata/ata-disk.h @@ -44,7 +44,7 @@ struct ad_softc { #define AD_F_32B_ENABLED 0x0004 #define AD_F_TAG_ENABLED 0x0008 - struct buf_queue_head queue; /* head of request queue */ + struct bio_queue_head queue; /* head of request queue */ struct devstat stats; /* devstat entry */ struct disk disk; /* disklabel/slice stuff */ dev_t dev1, dev2; /* device place holder */ @@ -65,7 +65,7 @@ struct ad_request { #define ADR_F_FORCE_PIO 0x0008 int8_t *data; /* pointer to data buf */ - struct buf *bp; /* associated buf ptr */ + struct bio *bp; /* associated bio ptr */ u_int8_t tag; /* tag ID of this request */ TAILQ_ENTRY(ad_request) chain; /* list management */ }; diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c index 61c1795..15a6a2b 100644 --- a/sys/dev/ata/atapi-cd.c +++ b/sys/dev/ata/atapi-cd.c @@ -231,7 +231,7 @@ acd_init_lun(struct atapi_softc *atp, struct devstat *stats) if (!(cdp = malloc(sizeof(struct acd_softc), M_ACD, M_NOWAIT))) return NULL; bzero(cdp, sizeof(struct acd_softc)); - bufq_init(&cdp->buf_queue); + bioq_init(&cdp->bio_queue); cdp->atp = atp; cdp->lun = ata_get_lun(&acd_lun_map); cdp->flags &= ~(F_WRITTEN|F_DISK_OPEN|F_TRACK_OPEN); @@ -1085,23 +1085,23 @@ acdioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flags, struct proc *p) } static void -acdstrategy(struct buf *bp) +acdstrategy(struct bio *bp) { - struct acd_softc *cdp = bp->b_dev->si_drv1; + struct acd_softc *cdp = bp->bio_dev->si_drv1; int32_t s; /* if it's a null transfer, return immediatly. */ - if (bp->b_bcount == 0) { - bp->b_resid = 0; + if (bp->bio_bcount == 0) { + bp->bio_resid = 0; biodone(bp); return; } - bp->b_pblkno = bp->b_blkno; - bp->b_resid = bp->b_bcount; + bp->bio_pblkno = bp->bio_blkno; + bp->bio_resid = bp->bio_bcount; s = splbio(); - bufqdisksort(&cdp->buf_queue, bp); + bioqdisksort(&cdp->bio_queue, bp); ata_start(cdp->atp->controller); splx(s); } @@ -1110,7 +1110,7 @@ void acd_start(struct atapi_softc *atp) { struct acd_softc *cdp = atp->driver; - struct buf *bp = bufq_first(&cdp->buf_queue); + struct bio *bp = bioq_first(&cdp->bio_queue); u_int32_t lba, count; int8_t ccb[16]; @@ -1118,13 +1118,13 @@ acd_start(struct atapi_softc *atp) int i; cdp = cdp->driver[cdp->changer_info->current_slot]; - bp = bufq_first(&cdp->buf_queue); + bp = bioq_first(&cdp->bio_queue); /* check for work pending on any other slot */ for (i = 0; i < cdp->changer_info->slots; i++) { if (i == cdp->changer_info->current_slot) continue; - if (bufq_first(&(cdp->driver[i]->buf_queue))) { + if (bioq_first(&(cdp->driver[i]->bio_queue))) { if (!bp || time_second > (cdp->timestamp + 10)) { acd_select_slot(cdp->driver[i]); return; @@ -1134,29 +1134,33 @@ acd_start(struct atapi_softc *atp) } if (!bp) return; - bufq_remove(&cdp->buf_queue, bp); + bioq_remove(&cdp->bio_queue, bp); /* reject all queued entries if media changed */ if (cdp->atp->flags & ATAPI_F_MEDIA_CHANGED) { - bp->b_error = EIO; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EIO; + bp->bio_flags |= BIO_ERROR; biodone(bp); return; } bzero(ccb, sizeof(ccb)); - count = (bp->b_bcount + (cdp->block_size - 1)) / cdp->block_size; - if (bp->b_flags & B_PHYS) - lba = bp->b_offset / cdp->block_size; + count = (bp->bio_bcount + (cdp->block_size - 1)) / cdp->block_size; + { + /* XXX Hack until b_offset is always initialized */ + struct buf *bup = (struct buf *)bp; + if (bup->b_flags & B_PHYS) + lba = bup->b_offset / cdp->block_size; else - lba = bp->b_blkno / (cdp->block_size / DEV_BSIZE); + lba = bp->bio_blkno / (cdp->block_size / DEV_BSIZE); + } - if (bp->b_iocmd == BIO_READ) { + if (bp->bio_cmd == BIO_READ) { /* if transfer goes beyond EOM adjust it to be within limits */ if (lba + count > cdp->info.volsize) { /* if we are entirely beyond EOM return EOF */ if ((count = cdp->info.volsize - lba) <= 0) { - bp->b_resid = bp->b_bcount; + bp->bio_resid = bp->bio_bcount; biodone(bp); return; } @@ -1181,26 +1185,26 @@ acd_start(struct atapi_softc *atp) devstat_start_transaction(cdp->stats); - atapi_queue_cmd(cdp->atp, ccb, bp->b_data, count * cdp->block_size, - (bp->b_iocmd == BIO_READ)?ATPR_F_READ : 0, 30, acd_done, bp); + atapi_queue_cmd(cdp->atp, ccb, bp->bio_data, count * cdp->block_size, + (bp->bio_cmd == BIO_READ)?ATPR_F_READ : 0, 30, acd_done, bp); } static int32_t acd_done(struct atapi_request *request) { - struct buf *bp = request->driver; + struct bio *bp = request->driver; struct acd_softc *cdp = request->device->driver; if (request->error) { - bp->b_error = request->error; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = request->error; + bp->bio_flags |= BIO_ERROR; } else { - bp->b_resid = bp->b_bcount - request->donecount; - if (bp->b_iocmd == BIO_WRITE) + bp->bio_resid = bp->bio_bcount - request->donecount; + if (bp->bio_cmd == BIO_WRITE) cdp->flags |= F_WRITTEN; } - devstat_end_transaction_buf(cdp->stats, bp); + devstat_end_transaction_bio(cdp->stats, bp); biodone(bp); return 0; } diff --git a/sys/dev/ata/atapi-cd.h b/sys/dev/ata/atapi-cd.h index eed3647..ca65af2 100644 --- a/sys/dev/ata/atapi-cd.h +++ b/sys/dev/ata/atapi-cd.h @@ -316,7 +316,7 @@ struct acd_softc { #define F_DISK_OPEN 0x0004 /* disk open for writing */ #define F_TRACK_OPEN 0x0008 /* track open for writing */ - struct buf_queue_head buf_queue; /* Queue of i/o requests */ + struct bio_queue_head bio_queue; /* Queue of i/o requests */ struct toc toc; /* table of disc contents */ struct { u_int32_t volsize; /* volume size in blocks */ diff --git a/sys/dev/ata/atapi-fd.c b/sys/dev/ata/atapi-fd.c index 1b7e177..b1e2051 100644 --- a/sys/dev/ata/atapi-fd.c +++ b/sys/dev/ata/atapi-fd.c @@ -91,7 +91,7 @@ afdattach(struct atapi_softc *atp) return -1; } bzero(fdp, sizeof(struct afd_softc)); - bufq_init(&fdp->buf_queue); + bioq_init(&fdp->bio_queue); fdp->atp = atp; fdp->lun = ata_get_lun(&afd_lun_map); @@ -274,20 +274,20 @@ afdioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p) } static void -afdstrategy(struct buf *bp) +afdstrategy(struct bio *bp) { - struct afd_softc *fdp = bp->b_dev->si_drv1; + struct afd_softc *fdp = bp->bio_dev->si_drv1; int32_t s; /* if it's a null transfer, return immediatly. */ - if (bp->b_bcount == 0) { - bp->b_resid = 0; + if (bp->bio_bcount == 0) { + bp->bio_resid = 0; biodone(bp); return; } s = splbio(); - bufqdisksort(&fdp->buf_queue, bp); + bioqdisksort(&fdp->bio_queue, bp); ata_start(fdp->atp->controller); splx(s); } @@ -296,7 +296,7 @@ void afd_start(struct atapi_softc *atp) { struct afd_softc *fdp = atp->driver; - struct buf *bp = bufq_first(&fdp->buf_queue); + struct bio *bp = bioq_first(&fdp->bio_queue); u_int32_t lba, count; int8_t ccb[16]; int8_t *data_ptr; @@ -304,24 +304,24 @@ afd_start(struct atapi_softc *atp) if (!bp) return; - bufq_remove(&fdp->buf_queue, bp); + bioq_remove(&fdp->bio_queue, bp); /* should reject all queued entries if media have changed. */ if (fdp->atp->flags & ATAPI_F_MEDIA_CHANGED) { - bp->b_error = EIO; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EIO; + bp->bio_flags |= BIO_ERROR; biodone(bp); return; } - lba = bp->b_pblkno; - count = bp->b_bcount / fdp->cap.sector_size; - data_ptr = bp->b_data; - bp->b_resid = 0; + lba = bp->bio_pblkno; + count = bp->bio_bcount / fdp->cap.sector_size; + data_ptr = bp->bio_data; + bp->bio_resid = 0; bzero(ccb, sizeof(ccb)); - if (bp->b_iocmd == BIO_READ) + if (bp->bio_cmd == BIO_READ) ccb[0] = ATAPI_READ_BIG; else ccb[0] = ATAPI_WRITE_BIG; @@ -338,7 +338,7 @@ afd_start(struct atapi_softc *atp) atapi_queue_cmd(fdp->atp, ccb, data_ptr, fdp->transfersize * fdp->cap.sector_size, - (bp->b_iocmd == BIO_READ) ? ATPR_F_READ : 0, 30, + (bp->bio_cmd == BIO_READ) ? ATPR_F_READ : 0, 30, afd_partial_done, bp); count -= fdp->transfersize; @@ -354,35 +354,35 @@ afd_start(struct atapi_softc *atp) ccb[8] = count; atapi_queue_cmd(fdp->atp, ccb, data_ptr, count * fdp->cap.sector_size, - (bp->b_iocmd == BIO_READ) ? ATPR_F_READ : 0, 30, afd_done, bp); + (bp->bio_cmd == BIO_READ) ? ATPR_F_READ : 0, 30, afd_done, bp); } static int32_t afd_partial_done(struct atapi_request *request) { - struct buf *bp = request->driver; + struct bio *bp = request->driver; if (request->error) { - bp->b_error = request->error; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = request->error; + bp->bio_flags |= BIO_ERROR; } - bp->b_resid += request->bytecount; + bp->bio_resid += request->bytecount; return 0; } static int32_t afd_done(struct atapi_request *request) { - struct buf *bp = request->driver; + struct bio *bp = request->driver; struct afd_softc *fdp = request->device->driver; - if (request->error || (bp->b_ioflags & BIO_ERROR)) { - bp->b_error = request->error; - bp->b_ioflags |= BIO_ERROR; + if (request->error || (bp->bio_flags & BIO_ERROR)) { + bp->bio_error = request->error; + bp->bio_flags |= BIO_ERROR; } else - bp->b_resid += (bp->b_bcount - request->donecount); - devstat_end_transaction_buf(&fdp->stats, bp); + bp->bio_resid += (bp->bio_bcount - request->donecount); + devstat_end_transaction_bio(&fdp->stats, bp); biodone(bp); return 0; } diff --git a/sys/dev/ata/atapi-fd.h b/sys/dev/ata/atapi-fd.h index b141625..d68474a 100644 --- a/sys/dev/ata/atapi-fd.h +++ b/sys/dev/ata/atapi-fd.h @@ -74,7 +74,7 @@ struct afd_softc { struct atapi_softc *atp; /* controller structure */ int32_t lun; /* logical device unit */ int32_t transfersize; /* max size of each transfer */ - struct buf_queue_head buf_queue; /* queue of i/o requests */ + struct bio_queue_head bio_queue; /* queue of i/o requests */ struct afd_header header; /* capabilities page info */ struct afd_cappage cap; /* capabilities page info */ struct disk disk; /* virtual drives */ diff --git a/sys/dev/ata/atapi-tape.c b/sys/dev/ata/atapi-tape.c index ff895d2..092891f 100644 --- a/sys/dev/ata/atapi-tape.c +++ b/sys/dev/ata/atapi-tape.c @@ -102,7 +102,7 @@ astattach(struct atapi_softc *atp) return -1; } bzero(stp, sizeof(struct ast_softc)); - bufq_init(&stp->buf_queue); + bioq_init(&stp->bio_queue); stp->atp = atp; stp->lun = ata_get_lun(&ast_lun_map); if (ast_sense(stp)) { @@ -410,45 +410,45 @@ astioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p) } static void -aststrategy(struct buf *bp) +aststrategy(struct bio *bp) { - struct ast_softc *stp = bp->b_dev->si_drv1; + struct ast_softc *stp = bp->bio_dev->si_drv1; int32_t s; /* if it's a null transfer, return immediatly. */ - if (bp->b_bcount == 0) { - bp->b_resid = 0; + if (bp->bio_bcount == 0) { + bp->bio_resid = 0; biodone(bp); return; } - if (!(bp->b_iocmd == BIO_READ) && stp->flags & F_WRITEPROTECT) { - bp->b_error = EPERM; - bp->b_ioflags |= BIO_ERROR; + if (!(bp->bio_cmd == BIO_READ) && stp->flags & F_WRITEPROTECT) { + bp->bio_error = EPERM; + bp->bio_flags |= BIO_ERROR; biodone(bp); return; } /* check for != blocksize requests */ - if (bp->b_bcount % stp->blksize) { + if (bp->bio_bcount % stp->blksize) { printf("ast%d: bad request, must be multiple of %d\n", stp->lun, stp->blksize); - bp->b_error = EIO; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EIO; + bp->bio_flags |= BIO_ERROR; biodone(bp); return; } /* warn about transfers bigger than the device suggests */ - if (bp->b_bcount > stp->blksize * stp->cap.ctl) { + if (bp->bio_bcount > stp->blksize * stp->cap.ctl) { if ((stp->flags & F_CTL_WARN) == 0) { printf("ast%d: WARNING: CTL exceeded %ld>%d\n", - stp->lun, bp->b_bcount, stp->blksize * stp->cap.ctl); + stp->lun, bp->bio_bcount, stp->blksize * stp->cap.ctl); stp->flags |= F_CTL_WARN; } } s = splbio(); - bufq_insert_tail(&stp->buf_queue, bp); + bioq_insert_tail(&stp->bio_queue, bp); ata_start(stp->atp->controller); splx(s); } @@ -457,7 +457,7 @@ void ast_start(struct atapi_softc *atp) { struct ast_softc *stp = atp->driver; - struct buf *bp = bufq_first(&stp->buf_queue); + struct bio *bp = bioq_first(&stp->bio_queue); u_int32_t blkcount; int8_t ccb[16]; @@ -466,13 +466,13 @@ ast_start(struct atapi_softc *atp) bzero(ccb, sizeof(ccb)); - if (bp->b_iocmd == BIO_READ) + if (bp->bio_cmd == BIO_READ) ccb[0] = ATAPI_READ; else ccb[0] = ATAPI_WRITE; - bufq_remove(&stp->buf_queue, bp); - blkcount = bp->b_bcount / stp->blksize; + bioq_remove(&stp->bio_queue, bp); + blkcount = bp->bio_bcount / stp->blksize; ccb[1] = 1; ccb[2] = blkcount>>16; @@ -481,27 +481,27 @@ ast_start(struct atapi_softc *atp) devstat_start_transaction(&stp->stats); - atapi_queue_cmd(stp->atp, ccb, bp->b_data, blkcount * stp->blksize, - (bp->b_iocmd == BIO_READ) ? ATPR_F_READ : 0, 60, ast_done, bp); + atapi_queue_cmd(stp->atp, ccb, bp->bio_data, blkcount * stp->blksize, + (bp->bio_cmd == BIO_READ) ? ATPR_F_READ : 0, 60, ast_done, bp); } static int32_t ast_done(struct atapi_request *request) { - struct buf *bp = request->driver; + struct bio *bp = request->driver; struct ast_softc *stp = request->device->driver; if (request->error) { - bp->b_error = request->error; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = request->error; + bp->bio_flags |= BIO_ERROR; } else { - if (!(bp->b_iocmd == BIO_READ)) + if (!(bp->bio_cmd == BIO_READ)) stp->flags |= F_DATA_WRITTEN; - bp->b_resid = bp->b_bcount - request->donecount; - ast_total += (bp->b_bcount - bp->b_resid); + bp->bio_resid = bp->bio_bcount - request->donecount; + ast_total += (bp->bio_bcount - bp->bio_resid); } - devstat_end_transaction_buf(&stp->stats, bp); + devstat_end_transaction_bio(&stp->stats, bp); biodone(bp); return 0; } diff --git a/sys/dev/ata/atapi-tape.h b/sys/dev/ata/atapi-tape.h index bccd665..1170579 100644 --- a/sys/dev/ata/atapi-tape.h +++ b/sys/dev/ata/atapi-tape.h @@ -154,7 +154,7 @@ struct ast_softc { #define F_ONSTREAM 0x0100 /* OnStream ADR device */ int32_t blksize; /* block size (512 | 1024) */ - struct buf_queue_head buf_queue; /* queue of i/o requests */ + struct bio_queue_head bio_queue; /* queue of i/o requests */ struct atapi_params *param; /* drive parameters table */ struct ast_cappage cap; /* capabilities page info */ struct devstat stats; /* devstat entry */ diff --git a/sys/dev/ccd/ccd.c b/sys/dev/ccd/ccd.c index 760734d..92f8b61 100644 --- a/sys/dev/ccd/ccd.c +++ b/sys/dev/ccd/ccd.c @@ -764,9 +764,10 @@ ccdclose(dev, flags, fmt, p) } static void -ccdstrategy(bp) - struct buf *bp; +ccdstrategy(bip) + struct bio *bip; { + struct buf *bp = (struct buf *)bip; int unit = ccdunit(bp->b_dev); struct ccd_softc *cs = &ccd_softc[unit]; int s; @@ -795,7 +796,7 @@ ccdstrategy(bp) */ wlabel = cs->sc_flags & (CCDF_WLABEL|CCDF_LABELLING); if (ccdpart(bp->b_dev) != RAW_PART) { - if (bounds_check_with_label(bp, lp, wlabel) <= 0) + if (bounds_check_with_label(&bp->b_io, lp, wlabel) <= 0) goto done; } else { int pbn; /* in sc_secsize chunks */ @@ -838,7 +839,7 @@ ccdstrategy(bp) splx(s); return; done: - biodone(bp); + bufdone(bp); } static void @@ -1112,7 +1113,7 @@ ccdintr(cs, bp) if (bp->b_ioflags & BIO_ERROR) bp->b_resid = bp->b_bcount; devstat_end_transaction_buf(&cs->device_stats, bp); - biodone(bp); + bufdone(bp); } /* diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index 948142c..c1b02b1 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -84,7 +84,6 @@ #include /* misuse a flag to identify format operation */ -#define B_FORMAT B_XXX /* configuration flags */ #define FDC_PRETEND_D0 (1 << 0) /* pretend drive 0 to be there */ @@ -863,7 +862,7 @@ fdc_attach(device_t dev) /* reset controller, turn motor off, clear fdout mirror reg */ fdout_wr(fdc, ((fdc->fdout = 0))); - bufq_init(&fdc->head); + bioq_init(&fdc->head); /* * Probe and attach any children. We should probably detect @@ -1447,7 +1446,7 @@ fdclose(dev_t dev, int flags, int mode, struct proc *p) /* fdstrategy */ /****************************************************************************/ void -fdstrategy(struct buf *bp) +fdstrategy(struct bio *bp) { unsigned nblocks, blknum, cando; int s; @@ -1456,31 +1455,31 @@ fdstrategy(struct buf *bp) fd_p fd; size_t fdblk; - fdu = FDUNIT(minor(bp->b_dev)); + fdu = FDUNIT(minor(bp->bio_dev)); fd = devclass_get_softc(fd_devclass, fdu); if (fd == 0) panic("fdstrategy: buf for nonexistent device (%#lx, %#lx)", - (u_long)major(bp->b_dev), (u_long)minor(bp->b_dev)); + (u_long)major(bp->bio_dev), (u_long)minor(bp->bio_dev)); fdc = fd->fdc; if (fd->type == NO_TYPE) { - bp->b_error = ENXIO; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = ENXIO; + bp->bio_flags |= BIO_ERROR; goto bad; }; fdblk = 128 << (fd->ft->secsize); - if (!(bp->b_flags & B_FORMAT)) { - if (bp->b_blkno < 0) { + if (!(bp->bio_cmd & BIO_FORMAT)) { + if (bp->bio_blkno < 0) { printf( "fd%d: fdstrat: bad request blkno = %lu, bcount = %ld\n", - fdu, (u_long)bp->b_blkno, bp->b_bcount); - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + fdu, (u_long)bp->bio_blkno, bp->bio_bcount); + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } - if ((bp->b_bcount % fdblk) != 0) { - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + if ((bp->bio_bcount % fdblk) != 0) { + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } } @@ -1488,33 +1487,33 @@ fdstrategy(struct buf *bp) /* * Set up block calculations. */ - if (bp->b_blkno > 20000000) { + if (bp->bio_blkno > 20000000) { /* * Reject unreasonably high block number, prevent the * multiplication below from overflowing. */ - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } - blknum = (unsigned) bp->b_blkno * DEV_BSIZE/fdblk; + blknum = (unsigned) bp->bio_blkno * DEV_BSIZE/fdblk; nblocks = fd->ft->size; - bp->b_resid = 0; - if (blknum + (bp->b_bcount / fdblk) > nblocks) { + bp->bio_resid = 0; + if (blknum + (bp->bio_bcount / fdblk) > nblocks) { if (blknum <= nblocks) { cando = (nblocks - blknum) * fdblk; - bp->b_resid = bp->b_bcount - cando; + bp->bio_resid = bp->bio_bcount - cando; if (cando == 0) goto bad; /* not actually bad but EOF */ } else { - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } } - bp->b_pblkno = bp->b_blkno; + bp->bio_pblkno = bp->bio_blkno; s = splbio(); - bufqdisksort(&fdc->head, bp); + bioqdisksort(&fdc->head, bp); untimeout(fd_turnoff, fd, fd->toffhandle); /* a good idea */ /* Tell devstat we are starting on the transaction */ @@ -1647,15 +1646,15 @@ fdstate(fdc_p fdc) unsigned blknum = 0, b_cylinder = 0; fdu_t fdu = fdc->fdu; fd_p fd; - register struct buf *bp; + register struct bio *bp; struct fd_formb *finfo = NULL; size_t fdblk; bp = fdc->bp; if (bp == NULL) { - bp = bufq_first(&fdc->head); + bp = bioq_first(&fdc->head); if (bp != NULL) { - bufq_remove(&fdc->head, bp); + bioq_remove(&fdc->head, bp); fdc->bp = bp; } } @@ -1674,24 +1673,24 @@ fdstate(fdc_p fdc) TRACE1("[fdc%d IDLE]", fdc->fdcu); return (0); } - fdu = FDUNIT(minor(bp->b_dev)); + fdu = FDUNIT(minor(bp->bio_dev)); fd = devclass_get_softc(fd_devclass, fdu); fdblk = 128 << fd->ft->secsize; if (fdc->fd && (fd != fdc->fd)) device_printf(fd->dev, "confused fd pointers\n"); - read = bp->b_iocmd == BIO_READ; + read = bp->bio_cmd == BIO_READ; if (read) idf = ISADMA_READ; else idf = ISADMA_WRITE; - format = bp->b_flags & B_FORMAT; + format = bp->bio_cmd & BIO_FORMAT; if (format) { - finfo = (struct fd_formb *)bp->b_data; + finfo = (struct fd_formb *)bp->bio_data; fd->skip = (char *)&(finfo->fd_formb_cylno(0)) - (char *)finfo; } if (fdc->state == DOSEEK || fdc->state == SEEKCOMPLETE) { - blknum = (unsigned) bp->b_pblkno * DEV_BSIZE/fdblk + + blknum = (unsigned) bp->bio_pblkno * DEV_BSIZE/fdblk + fd->skip/fdblk; b_cylinder = blknum / (fd->ft->sectrac * fd->ft->heads); } @@ -1830,8 +1829,8 @@ fdstate(fdc_p fdc) fd->track = b_cylinder; if (!(fdc->flags & FDC_NODMA)) - isa_dmastart(idf, bp->b_data+fd->skip, - format ? bp->b_bcount : fdblk, fdc->dmachan); + isa_dmastart(idf, bp->bio_data+fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); sectrac = fd->ft->sectrac; sec = blknum % (sectrac * fd->ft->heads); head = sec / sectrac; @@ -1846,8 +1845,8 @@ fdstate(fdc_p fdc) /* stuck controller? */ if (!(fdc->flags & FDC_NODMA)) isa_dmadone(idf, - bp->b_data + fd->skip, - format ? bp->b_bcount : fdblk, + bp->bio_data + fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); fdc->retry = 6; /* reset the beast */ return (retrier(fdc)); @@ -1887,11 +1886,11 @@ fdstate(fdc_p fdc) * * Umpf. */ - SET_BCDR(fdc, 1, bp->b_bcount, 0); + SET_BCDR(fdc, 1, bp->bio_bcount, 0); - (void)fdcpio(fdc,bp->b_iocmd, - bp->b_data+fd->skip, - bp->b_bcount); + (void)fdcpio(fdc,bp->bio_cmd, + bp->bio_data+fd->skip, + bp->bio_bcount); } /* formatting */ @@ -1903,8 +1902,8 @@ fdstate(fdc_p fdc) /* controller fell over */ if (!(fdc->flags & FDC_NODMA)) isa_dmadone(idf, - bp->b_data + fd->skip, - format ? bp->b_bcount : fdblk, + bp->bio_data + fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); fdc->retry = 6; return (retrier(fdc)); @@ -1922,8 +1921,8 @@ fdstate(fdc_p fdc) * the WRITE command is sent */ if (!read) - (void)fdcpio(fdc,bp->b_iocmd, - bp->b_data+fd->skip, + (void)fdcpio(fdc,bp->bio_cmd, + bp->bio_data+fd->skip, fdblk); } if (fd_cmd(fdc, 9, @@ -1940,8 +1939,8 @@ fdstate(fdc_p fdc) /* the beast is sleeping again */ if (!(fdc->flags & FDC_NODMA)) isa_dmadone(idf, - bp->b_data + fd->skip, - format ? bp->b_bcount : fdblk, + bp->bio_data + fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); fdc->retry = 6; return (retrier(fdc)); @@ -1952,8 +1951,8 @@ fdstate(fdc_p fdc) * if this is a read, then simply await interrupt * before performing PIO */ - if (read && !fdcpio(fdc,bp->b_iocmd, - bp->b_data+fd->skip,fdblk)) { + if (read && !fdcpio(fdc,bp->bio_cmd, + bp->bio_data+fd->skip,fdblk)) { fd->tohandle = timeout(fd_iotimeout, fdc, hz); return(0); /* will return later */ }; @@ -1970,7 +1969,7 @@ fdstate(fdc_p fdc) * actually perform the PIO read. The IOCOMPLETE case * removes the timeout for us. */ - (void)fdcpio(fdc,bp->b_iocmd,bp->b_data+fd->skip,fdblk); + (void)fdcpio(fdc,bp->bio_cmd,bp->bio_data+fd->skip,fdblk); fdc->state = IOCOMPLETE; /* FALLTHROUGH */ case IOCOMPLETE: /* IO DONE, post-analyze */ @@ -1978,8 +1977,8 @@ fdstate(fdc_p fdc) if (fd_read_status(fdc, fd->fdsu)) { if (!(fdc->flags & FDC_NODMA)) - isa_dmadone(idf, bp->b_data + fd->skip, - format ? bp->b_bcount : fdblk, + isa_dmadone(idf, bp->bio_data + fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); if (fdc->retry < 6) fdc->retry = 6; /* force a reset */ @@ -1992,8 +1991,8 @@ fdstate(fdc_p fdc) case IOTIMEDOUT: if (!(fdc->flags & FDC_NODMA)) - isa_dmadone(idf, bp->b_data + fd->skip, - format ? bp->b_bcount : fdblk, fdc->dmachan); + isa_dmadone(idf, bp->bio_data + fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); if (fdc->status[0] & NE7_ST0_IC) { if ((fdc->status[0] & NE7_ST0_IC) == NE7_ST0_IC_AT && fdc->status[1] & NE7_ST1_OR) { @@ -2018,7 +2017,7 @@ fdstate(fdc_p fdc) } /* All OK */ fd->skip += fdblk; - if (!format && fd->skip < bp->b_bcount - bp->b_resid) { + if (!format && fd->skip < bp->bio_bcount - bp->bio_resid) { /* set up next transfer */ fdc->state = DOSEEK; } else { @@ -2026,7 +2025,7 @@ fdstate(fdc_p fdc) fd->skip = 0; fdc->bp = NULL; device_unbusy(fd->dev); - devstat_end_transaction_buf(&fd->device_stats, bp); + devstat_end_transaction_bio(&fd->device_stats, bp); biodone(bp); fdc->fd = (fd_p) 0; fdc->fdu = -1; @@ -2137,14 +2136,14 @@ fdstate(fdc_p fdc) static int retrier(struct fdc_data *fdc) { - register struct buf *bp; + struct bio *bp; struct fd_data *fd; int fdu; bp = fdc->bp; /* XXX shouldn't this be cached somewhere? */ - fdu = FDUNIT(minor(bp->b_dev)); + fdu = FDUNIT(minor(bp->bio_dev)); fd = devclass_get_softc(fd_devclass, fdu); if (fd->options & FDOPT_NORETRY) goto fail; @@ -2164,14 +2163,14 @@ retrier(struct fdc_data *fdc) default: fail: { - dev_t sav_b_dev = bp->b_dev; + dev_t sav_bio_dev = bp->bio_dev; /* Trick diskerr */ - bp->b_dev = makedev(major(bp->b_dev), - (FDUNIT(minor(bp->b_dev))<<3)|RAW_PART); + bp->bio_dev = makedev(major(bp->bio_dev), + (FDUNIT(minor(bp->bio_dev))<<3)|RAW_PART); diskerr(bp, "hard error", LOG_PRINTF, fdc->fd->skip / DEV_BSIZE, (struct disklabel *)NULL); - bp->b_dev = sav_b_dev; + bp->bio_dev = sav_bio_dev; if (fdc->flags & FDC_STAT_VALID) { printf( @@ -2185,13 +2184,13 @@ retrier(struct fdc_data *fdc) else printf(" (No status)\n"); } - bp->b_ioflags |= BIO_ERROR; - bp->b_error = EIO; - bp->b_resid += bp->b_bcount - fdc->fd->skip; + bp->bio_flags |= BIO_ERROR; + bp->bio_error = EIO; + bp->bio_resid += bp->bio_bcount - fdc->fd->skip; fdc->bp = NULL; fdc->fd->skip = 0; device_unbusy(fd->dev); - devstat_end_transaction_buf(&fdc->fd->device_stats, bp); + devstat_end_transaction_bio(&fdc->fd->device_stats, bp); biodone(bp); fdc->state = FINDWORK; fdc->flags |= FDC_NEEDS_RESET; @@ -2231,8 +2230,8 @@ fdformat(dev, finfo, p) bzero((void *)bp, sizeof(struct buf)); BUF_LOCKINIT(bp); BUF_LOCK(bp, LK_EXCLUSIVE); - bp->b_flags = B_PHYS | B_FORMAT; - bp->b_iocmd = BIO_WRITE; + bp->b_flags = B_PHYS; + bp->b_iocmd = BIO_FORMAT; /* * calculate a fake blkno, so fdstrategy() would initiate a @@ -2261,7 +2260,7 @@ fdformat(dev, finfo, p) /* timed out */ rv = EIO; device_unbusy(fd->dev); - biodone(bp); + biodone(&bp->b_io); /* XXX: HUH ? */ } if (bp->b_ioflags & BIO_ERROR) rv = bp->b_error; diff --git a/sys/dev/ida/ida.c b/sys/dev/ida/ida.c index 447ed46..2072ab5 100644 --- a/sys/dev/ida/ida.c +++ b/sys/dev/ida/ida.c @@ -190,7 +190,7 @@ ida_init(struct ida_softc *ida) SLIST_INIT(&ida->free_qcbs); STAILQ_INIT(&ida->qcb_queue); - bufq_init(&ida->buf_queue); + bioq_init(&ida->bio_queue); ida->qcbs = (struct ida_qcb *) malloc(IDA_QCB_MAX * sizeof(struct ida_qcb), M_DEVBUF, M_NOWAIT); @@ -358,9 +358,9 @@ ida_command(struct ida_softc *ida, int command, void *data, int datasize, } void -ida_submit_buf(struct ida_softc *ida, struct buf *bp) +ida_submit_buf(struct ida_softc *ida, struct bio *bp) { - bufq_insert_tail(&ida->buf_queue, bp); + bioq_insert_tail(&ida->bio_queue, bp); ida_construct_qcb(ida); ida_start(ida); } @@ -371,9 +371,9 @@ ida_construct_qcb(struct ida_softc *ida) struct ida_hardware_qcb *hwqcb; struct ida_qcb *qcb; bus_dmasync_op_t op; - struct buf *bp; + struct bio *bp; - bp = bufq_first(&ida->buf_queue); + bp = bioq_first(&ida->bio_queue); if (bp == NULL) return; /* no more buffers */ @@ -381,7 +381,7 @@ ida_construct_qcb(struct ida_softc *ida) if (qcb == NULL) return; /* out of resources */ - bufq_remove(&ida->buf_queue, bp); + bioq_remove(&ida->bio_queue, bp); qcb->buf = bp; qcb->flags = 0; @@ -389,7 +389,7 @@ ida_construct_qcb(struct ida_softc *ida) bzero(hwqcb, sizeof(struct ida_hdr) + sizeof(struct ida_req)); bus_dmamap_load(ida->buffer_dmat, qcb->dmamap, - (void *)bp->b_data, bp->b_bcount, ida_setup_dmamap, hwqcb, 0); + (void *)bp->bio_data, bp->bio_bcount, ida_setup_dmamap, hwqcb, 0); op = qcb->flags & DMA_DATA_IN ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE; bus_dmamap_sync(ida->buffer_dmat, qcb->dmamap, op); @@ -398,13 +398,13 @@ ida_construct_qcb(struct ida_softc *ida) * XXX */ { - struct id_softc *drv = (struct id_softc *)bp->b_driver1; + struct id_softc *drv = (struct id_softc *)bp->bio_driver1; hwqcb->hdr.drive = drv->unit; } - hwqcb->req.blkno = bp->b_pblkno; - hwqcb->req.bcount = howmany(bp->b_bcount, DEV_BSIZE); - hwqcb->req.command = bp->b_iocmd == BIO_READ ? CMD_READ : CMD_WRITE; + hwqcb->req.blkno = bp->bio_pblkno; + hwqcb->req.bcount = howmany(bp->bio_bcount, DEV_BSIZE); + hwqcb->req.command = bp->bio_cmd == BIO_READ ? CMD_READ : CMD_WRITE; STAILQ_INSERT_TAIL(&ida->qcb_queue, qcb, link.stqe); } @@ -519,7 +519,7 @@ ida_done(struct ida_softc *ida, struct ida_qcb *qcb) wakeup(qcb); } else { if (error) - qcb->buf->b_ioflags |= BIO_ERROR; + qcb->buf->bio_flags |= BIO_ERROR; id_intr(qcb->buf); } diff --git a/sys/dev/ida/ida_disk.c b/sys/dev/ida/ida_disk.c index 3694f62..6f81c0d 100644 --- a/sys/dev/ida/ida_disk.c +++ b/sys/dev/ida/ida_disk.c @@ -149,32 +149,32 @@ idclose(dev_t dev, int flags, int fmt, struct proc *p) * be a multiple of a sector in length. */ static void -idstrategy(struct buf *bp) +idstrategy(struct bio *bp) { struct id_softc *drv; int s; - drv = idgetsoftc(bp->b_dev); + drv = idgetsoftc(bp->bio_dev); if (drv == NULL) { - bp->b_error = EINVAL; + bp->bio_error = EINVAL; goto bad; } /* * software write protect check */ - if (drv->flags & DRV_WRITEPROT && (bp->b_iocmd == BIO_WRITE)) { - bp->b_error = EROFS; + if (drv->flags & DRV_WRITEPROT && (bp->bio_cmd == BIO_WRITE)) { + bp->bio_error = EROFS; goto bad; } /* * If it's a null transfer, return immediately */ - if (bp->b_bcount == 0) + if (bp->bio_bcount == 0) goto done; - bp->b_driver1 = drv; + bp->bio_driver1 = drv; s = splbio(); devstat_start_transaction(&drv->stats); ida_submit_buf(drv->controller, bp); @@ -182,28 +182,28 @@ idstrategy(struct buf *bp) return; bad: - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; done: /* * Correctly set the buf to indicate a completed transfer */ - bp->b_resid = bp->b_bcount; + bp->bio_resid = bp->bio_bcount; biodone(bp); return; } void -id_intr(struct buf *bp) +id_intr(struct bio *bp) { - struct id_softc *drv = (struct id_softc *)bp->b_driver1; + struct id_softc *drv = (struct id_softc *)bp->bio_driver1; - if (bp->b_ioflags & BIO_ERROR) - bp->b_error = EIO; + if (bp->bio_flags & BIO_ERROR) + bp->bio_error = EIO; else - bp->b_resid = 0; + bp->bio_resid = 0; - devstat_end_transaction_buf(&drv->stats, bp); + devstat_end_transaction_bio(&drv->stats, bp); biodone(bp); } diff --git a/sys/dev/ida/idavar.h b/sys/dev/ida/idavar.h index c2614ee..50335ab 100644 --- a/sys/dev/ida/idavar.h +++ b/sys/dev/ida/idavar.h @@ -103,7 +103,7 @@ struct ida_qcb { } link; bus_dmamap_t dmamap; bus_addr_t hwqcb_busaddr; - struct buf *buf; /* buf associated with qcb */ + struct bio *buf; /* bio associated with qcb */ }; struct ida_softc; @@ -154,7 +154,7 @@ struct ida_softc { struct ida_qcb *qcbs; /* kernel QCB array */ SLIST_HEAD(, ida_qcb) free_qcbs; STAILQ_HEAD(, ida_qcb) qcb_queue; - struct buf_queue_head buf_queue; + struct bio_queue_head bio_queue; struct ida_access cmd; }; @@ -192,9 +192,9 @@ extern int ida_init(struct ida_softc *ida); extern void ida_attach(struct ida_softc *ida); extern int ida_command(struct ida_softc *ida, int command, void *data, int datasize, int drive, int flags); -extern void ida_submit_buf(struct ida_softc *ida, struct buf *bp); +extern void ida_submit_buf(struct ida_softc *ida, struct bio *bp); extern void ida_intr(void *data); -extern void id_intr(struct buf *bp); +extern void id_intr(struct bio *bp); #endif /* _IDAVAR_H */ diff --git a/sys/dev/mcd/mcd.c b/sys/dev/mcd/mcd.c index 70614d7..1bdc726 100644 --- a/sys/dev/mcd/mcd.c +++ b/sys/dev/mcd/mcd.c @@ -116,7 +116,7 @@ struct mcd_mbx { short nblk; int sz; u_long skip; - struct buf *bp; + struct bio *bp; int p_offset; short count; short mode; @@ -141,7 +141,7 @@ static struct mcd_data { short curr_mode; struct mcd_read2 lastpb; short debug; - struct buf_queue_head head; /* head of buf queue */ + struct bio_queue_head head; /* head of bio queue */ struct mcd_mbx mbx; } mcd_data[NMCD]; @@ -250,7 +250,7 @@ int mcd_attach(struct isa_device *dev) cd->iobase = dev->id_iobase; cd->flags |= MCDINIT; mcd_soft_reset(unit); - bufq_init(&cd->head); + bioq_init(&cd->head); #ifdef NOTYET /* wire controller for interrupts and dma */ @@ -385,48 +385,48 @@ int mcdclose(dev_t dev, int flags, int fmt, struct proc *p) } void -mcdstrategy(struct buf *bp) +mcdstrategy(struct bio *bp) { struct mcd_data *cd; int s; - int unit = mcd_unit(bp->b_dev); + int unit = mcd_unit(bp->bio_dev); cd = mcd_data + unit; /* test validity */ /*MCD_TRACE("strategy: buf=0x%lx, unit=%ld, block#=%ld bcount=%ld\n", - bp,unit,bp->b_blkno,bp->b_bcount);*/ - if (unit >= NMCD || bp->b_blkno < 0) { + bp,unit,bp->bio_blkno,bp->bio_bcount);*/ + if (unit >= NMCD || bp->bio_blkno < 0) { printf("mcdstrategy: unit = %d, blkno = %ld, bcount = %ld\n", - unit, (long)bp->b_blkno, bp->b_bcount); + unit, (long)bp->bio_blkno, bp->bio_bcount); printf("mcd: mcdstratregy failure"); - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } /* if device invalidated (e.g. media change, door open), error */ if (!(cd->flags & MCDVALID)) { MCD_TRACE("strategy: drive not valid\n"); - bp->b_error = EIO; + bp->bio_error = EIO; goto bad; } /* read only */ - if (!(bp->b_iocmd == BIO_READ)) { - bp->b_error = EROFS; + if (!(bp->bio_cmd == BIO_READ)) { + bp->bio_error = EROFS; goto bad; } /* no data to read */ - if (bp->b_bcount == 0) + if (bp->bio_bcount == 0) goto done; /* for non raw access, check partition limits */ - if (mcd_part(bp->b_dev) != RAW_PART) { + if (mcd_part(bp->bio_dev) != RAW_PART) { if (!(cd->flags & MCDLABEL)) { - bp->b_error = EIO; + bp->bio_error = EIO; goto bad; } /* adjust transfer if necessary */ @@ -434,13 +434,13 @@ MCD_TRACE("strategy: drive not valid\n"); goto done; } } else { - bp->b_pblkno = bp->b_blkno; - bp->b_resid = 0; + bp->bio_pblkno = bp->bio_blkno; + bp->bio_resid = 0; } /* queue it */ s = splbio(); - bufqdisksort(&cd->head, bp); + bioqdisksort(&cd->head, bp); splx(s); /* now check whether we can perform processing */ @@ -448,9 +448,9 @@ MCD_TRACE("strategy: drive not valid\n"); return; bad: - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; done: - bp->b_resid = bp->b_bcount; + bp->bio_resid = bp->bio_bcount; biodone(bp); return; } @@ -459,7 +459,7 @@ static void mcd_start(int unit) { struct mcd_data *cd = mcd_data + unit; struct partition *p; - struct buf *bp; + struct bio *bp; int s = splbio(); if (cd->flags & MCDMBXBSY) { @@ -467,11 +467,11 @@ static void mcd_start(int unit) return; } - bp = bufq_first(&cd->head); + bp = bioq_first(&cd->head); if (bp != 0) { /* block found to process, dequeue */ /*MCD_TRACE("mcd_start: found block bp=0x%x\n",bp,0,0,0);*/ - bufq_remove(&cd->head, bp); + bioq_remove(&cd->head, bp); splx(s); } else { /* nothing to do */ @@ -485,10 +485,10 @@ static void mcd_start(int unit) return; } - p = cd->dlabel.d_partitions + mcd_part(bp->b_dev); + p = cd->dlabel.d_partitions + mcd_part(bp->bio_dev); cd->flags |= MCDMBXBSY; - if (cd->partflags[mcd_part(bp->b_dev)] & MCDREADRAW) + if (cd->partflags[mcd_part(bp->bio_dev)] & MCDREADRAW) cd->flags |= MCDREADRAW; cd->mbx.unit = unit; cd->mbx.port = cd->iobase; @@ -993,7 +993,7 @@ mcd_doread(int state, struct mcd_mbx *mbxin) int port = mbx->port; int com_port = mbx->port + mcd_command; int data_port = mbx->port + mcd_rdata; - struct buf *bp = mbx->bp; + struct bio *bp = mbx->bp; struct mcd_data *cd = mcd_data + unit; int rm,i,k; @@ -1086,11 +1086,11 @@ retry_mode: RDELAY_WAITMODE-mbx->count); modedone: /* for first block */ - mbx->nblk = (bp->b_bcount + (mbx->sz-1)) / mbx->sz; + mbx->nblk = (bp->bio_bcount + (mbx->sz-1)) / mbx->sz; mbx->skip = 0; nextblock: - blknum = (bp->b_blkno / (mbx->sz/DEV_BSIZE)) + blknum = (bp->bio_blkno / (mbx->sz/DEV_BSIZE)) + mbx->p_offset + mbx->skip/mbx->sz; MCD_TRACE("mcd_doread: read blknum=%d for bp=%p\n", @@ -1131,7 +1131,7 @@ retry_read: RDELAY_WAITREAD-mbx->count); got_it: /* data is ready */ - addr = bp->b_data + mbx->skip; + addr = bp->bio_data + mbx->skip; outb(port+mcd_ctl2,0x04); /* XXX */ for (i=0; isz; i++) @@ -1153,7 +1153,7 @@ retry_read: } /* return buffer */ - bp->b_resid = 0; + bp->bio_resid = 0; biodone(bp); cd->flags &= ~(MCDMBXBSY|MCDREADRAW); @@ -1184,8 +1184,8 @@ readerr: } harderr: /* invalidate the buffer */ - bp->b_ioflags |= BIO_ERROR; - bp->b_resid = bp->b_bcount; + bp->bio_flags |= BIO_ERROR; + bp->bio_resid = bp->bio_bcount; biodone(bp); cd->flags &= ~(MCDMBXBSY|MCDREADRAW); diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index 8b5ca80..44a7cef 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -81,7 +81,7 @@ static struct cdevsw md_cdevsw = { struct md_s { int unit; struct devstat stats; - struct buf_queue_head buf_queue; + struct bio_queue_head bio_queue; struct disk disk; dev_t dev; int busy; @@ -135,16 +135,16 @@ mdioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) } static void -mdstrategy(struct buf *bp) +mdstrategy(struct bio *bp) { struct md_s *sc; if (md_debug > 1) - printf("mdstrategy(%p) %s %lx, %d, %ld, %p)\n", - bp, devtoname(bp->b_dev), bp->b_flags, bp->b_blkno, - bp->b_bcount / DEV_BSIZE, bp->b_data); + printf("mdstrategy(%p) %s %x, %d, %ld, %p)\n", + bp, devtoname(bp->bio_dev), bp->bio_flags, bp->bio_blkno, + bp->bio_bcount / DEV_BSIZE, bp->bio_data); - sc = bp->b_dev->si_drv1; + sc = bp->bio_dev->si_drv1; if (sc->type == MD_MALLOC) { mdstrategy_malloc(bp); } else { @@ -155,7 +155,7 @@ mdstrategy(struct buf *bp) static void -mdstrategy_malloc(struct buf *bp) +mdstrategy_malloc(struct bio *bp) { int s, i; struct md_s *sc; @@ -164,15 +164,15 @@ mdstrategy_malloc(struct buf *bp) unsigned secno, nsec, secval, uc; if (md_debug > 1) - printf("mdstrategy_malloc(%p) %s %lx, %d, %ld, %p)\n", - bp, devtoname(bp->b_dev), bp->b_flags, bp->b_blkno, - bp->b_bcount / DEV_BSIZE, bp->b_data); + printf("mdstrategy_malloc(%p) %s %x, %d, %ld, %p)\n", + bp, devtoname(bp->bio_dev), bp->bio_flags, bp->bio_blkno, + bp->bio_bcount / DEV_BSIZE, bp->bio_data); - sc = bp->b_dev->si_drv1; + sc = bp->bio_dev->si_drv1; s = splbio(); - bufqdisksort(&sc->buf_queue, bp); + bioqdisksort(&sc->bio_queue, bp); if (sc->busy) { splx(s); @@ -182,25 +182,25 @@ mdstrategy_malloc(struct buf *bp) sc->busy++; while (1) { - bp = bufq_first(&sc->buf_queue); + bp = bioq_first(&sc->bio_queue); if (bp) - bufq_remove(&sc->buf_queue, bp); + bioq_remove(&sc->bio_queue, bp); splx(s); if (!bp) break; devstat_start_transaction(&sc->stats); - if (bp->b_iocmd == BIO_DELETE) + if (bp->bio_cmd == BIO_DELETE) dop = DEVSTAT_NO_DATA; - else if (bp->b_iocmd == BIO_READ) + else if (bp->bio_cmd == BIO_READ) dop = DEVSTAT_READ; else dop = DEVSTAT_WRITE; - nsec = bp->b_bcount / DEV_BSIZE; - secno = bp->b_pblkno; - dst = bp->b_data; + nsec = bp->bio_bcount / DEV_BSIZE; + secno = bp->bio_pblkno; + dst = bp->bio_data; while (nsec--) { if (secno < sc->nsecp) { @@ -218,15 +218,16 @@ mdstrategy_malloc(struct buf *bp) secval = 0; } if (md_debug > 2) - printf("%lx %p %p %d\n", bp->b_flags, secpp, secp, secval); + printf("%x %p %p %d\n", + bp->bio_flags, secpp, secp, secval); - if (bp->b_iocmd == BIO_DELETE) { + if (bp->bio_cmd == BIO_DELETE) { if (secpp) { if (secp) FREE(secp, M_MDSECT); *secpp = 0; } - } else if (bp->b_iocmd == BIO_READ) { + } else if (bp->bio_cmd == BIO_READ) { if (secp) { bcopy(secp, dst, DEV_BSIZE); } else if (secval) { @@ -271,8 +272,8 @@ mdstrategy_malloc(struct buf *bp) secno++; dst += DEV_BSIZE; } - bp->b_resid = 0; - devstat_end_transaction_buf(&sc->stats, bp); + bp->bio_resid = 0; + devstat_end_transaction_bio(&sc->stats, bp); biodone(bp); s = splbio(); } @@ -282,22 +283,22 @@ mdstrategy_malloc(struct buf *bp) static void -mdstrategy_preload(struct buf *bp) +mdstrategy_preload(struct bio *bp) { int s; struct md_s *sc; devstat_trans_flags dop; if (md_debug > 1) - printf("mdstrategy_preload(%p) %s %lx, %d, %ld, %p)\n", - bp, devtoname(bp->b_dev), bp->b_flags, bp->b_blkno, - bp->b_bcount / DEV_BSIZE, bp->b_data); + printf("mdstrategy_preload(%p) %s %x, %d, %ld, %p)\n", + bp, devtoname(bp->bio_dev), bp->bio_flags, bp->bio_blkno, + bp->bio_bcount / DEV_BSIZE, bp->bio_data); - sc = bp->b_dev->si_drv1; + sc = bp->bio_dev->si_drv1; s = splbio(); - bufqdisksort(&sc->buf_queue, bp); + bioqdisksort(&sc->bio_queue, bp); if (sc->busy) { splx(s); @@ -307,26 +308,26 @@ mdstrategy_preload(struct buf *bp) sc->busy++; while (1) { - bp = bufq_first(&sc->buf_queue); + bp = bioq_first(&sc->bio_queue); if (bp) - bufq_remove(&sc->buf_queue, bp); + bioq_remove(&sc->bio_queue, bp); splx(s); if (!bp) break; devstat_start_transaction(&sc->stats); - if (bp->b_iocmd == BIO_DELETE) { + if (bp->bio_cmd == BIO_DELETE) { dop = DEVSTAT_NO_DATA; - } else if (bp->b_iocmd == BIO_READ) { + } else if (bp->bio_cmd == BIO_READ) { dop = DEVSTAT_READ; - bcopy(sc->pl_ptr + (bp->b_pblkno << DEV_BSHIFT), bp->b_data, bp->b_bcount); + bcopy(sc->pl_ptr + (bp->bio_pblkno << DEV_BSHIFT), bp->bio_data, bp->bio_bcount); } else { dop = DEVSTAT_WRITE; - bcopy(bp->b_data, sc->pl_ptr + (bp->b_pblkno << DEV_BSHIFT), bp->b_bcount); + bcopy(bp->bio_data, sc->pl_ptr + (bp->bio_pblkno << DEV_BSHIFT), bp->bio_bcount); } - bp->b_resid = 0; - devstat_end_transaction_buf(&sc->stats, bp); + bp->bio_resid = 0; + devstat_end_transaction_bio(&sc->stats, bp); biodone(bp); s = splbio(); } @@ -342,7 +343,7 @@ mdcreate(struct cdevsw *devsw) MALLOC(sc, struct md_s *,sizeof(*sc), M_MD, M_WAITOK); bzero(sc, sizeof(*sc)); sc->unit = mdunits++; - bufq_init(&sc->buf_queue); + bioq_init(&sc->bio_queue); devstat_add_entry(&sc->stats, "md", sc->unit, DEV_BSIZE, DEVSTAT_NO_ORDERED_TAGS, DEVSTAT_TYPE_DIRECT | DEVSTAT_TYPE_IF_OTHER, diff --git a/sys/dev/mlx/mlx.c b/sys/dev/mlx/mlx.c index 4bfc8b5..128576e 100644 --- a/sys/dev/mlx/mlx.c +++ b/sys/dev/mlx/mlx.c @@ -289,7 +289,7 @@ mlx_attach(struct mlx_softc *sc) */ TAILQ_INIT(&sc->mlx_work); TAILQ_INIT(&sc->mlx_freecmds); - bufq_init(&sc->mlx_bufq); + bioq_init(&sc->mlx_bioq); /* * Select accessor methods based on controller interface type. @@ -587,7 +587,7 @@ mlx_detach(device_t dev) * an operation which may add or delete system disks. (Call mlx_startup to * resume normal operation.) * - * Note that we can assume that the bufq on the controller is empty, as we won't + * Note that we can assume that the bioq on the controller is empty, as we won't * allow shutdown if any device is open. */ int @@ -686,14 +686,14 @@ mlx_intr(void *arg) * disk resource, then poke the disk resource to start as much work as it can. */ int -mlx_submit_buf(struct mlx_softc *sc, struct buf *bp) +mlx_submit_buf(struct mlx_softc *sc, struct bio *bp) { int s; debug_called(1); s = splbio(); - bufq_insert_tail(&sc->mlx_bufq, bp); + bioq_insert_tail(&sc->mlx_bioq, bp); sc->mlx_waitbufs++; splx(s); mlx_startio(sc); @@ -1701,14 +1701,14 @@ mlx_poll_command(struct mlx_command *mc) * controller. Leave a couple of slots free for emergencies. * * Must be called at splbio or in an equivalent fashion that prevents - * reentry or activity on the bufq. + * reentry or activity on the bioq. */ static void mlx_startio(struct mlx_softc *sc) { struct mlx_command *mc; struct mlxd_softc *mlxd; - struct buf *bp; + struct bio *bp; int blkcount; int driveno; int cmd; @@ -1723,7 +1723,7 @@ mlx_startio(struct mlx_softc *sc) for (;;) { /* see if there's work to be done */ - if ((bp = bufq_first(&sc->mlx_bufq)) == NULL) + if ((bp = bioq_first(&sc->mlx_bioq)) == NULL) break; /* get a command */ if ((mc = mlx_alloccmd(sc)) == NULL) @@ -1734,16 +1734,16 @@ mlx_startio(struct mlx_softc *sc) break; } /* get the buf containing our work */ - bufq_remove(&sc->mlx_bufq, bp); + bioq_remove(&sc->mlx_bioq, bp); sc->mlx_waitbufs--; splx(s); /* connect the buf to the command */ mc->mc_complete = mlx_completeio; mc->mc_private = bp; - mc->mc_data = bp->b_data; - mc->mc_length = bp->b_bcount; - if (bp->b_iocmd == BIO_READ) { + mc->mc_data = bp->bio_data; + mc->mc_length = bp->bio_bcount; + if (bp->bio_cmd == BIO_READ) { mc->mc_flags |= MLX_CMD_DATAIN; cmd = MLX_CMD_READSG; } else { @@ -1755,13 +1755,13 @@ mlx_startio(struct mlx_softc *sc) mlx_mapcmd(mc); /* build a suitable I/O command (assumes 512-byte rounded transfers) */ - mlxd = (struct mlxd_softc *)bp->b_dev->si_drv1; + mlxd = (struct mlxd_softc *)bp->bio_dev->si_drv1; driveno = mlxd->mlxd_drive - sc->mlx_sysdrive; - blkcount = (bp->b_bcount + MLX_BLKSIZE - 1) / MLX_BLKSIZE; + blkcount = (bp->bio_bcount + MLX_BLKSIZE - 1) / MLX_BLKSIZE; - if ((bp->b_pblkno + blkcount) > sc->mlx_sysdrive[driveno].ms_size) + if ((bp->bio_pblkno + blkcount) > sc->mlx_sysdrive[driveno].ms_size) device_printf(sc->mlx_dev, "I/O beyond end of unit (%u,%d > %u)\n", - bp->b_pblkno, blkcount, sc->mlx_sysdrive[driveno].ms_size); + bp->bio_pblkno, blkcount, sc->mlx_sysdrive[driveno].ms_size); /* * Build the I/O command. Note that the SG list type bits are set to zero, @@ -1770,7 +1770,7 @@ mlx_startio(struct mlx_softc *sc) if (sc->mlx_iftype == MLX_IFTYPE_2) { mlx_make_type1(mc, (cmd == MLX_CMD_WRITESG) ? MLX_CMD_WRITESG_OLD : MLX_CMD_READSG_OLD, blkcount & 0xff, /* xfer length low byte */ - bp->b_pblkno, /* physical block number */ + bp->bio_pblkno, /* physical block number */ driveno, /* target drive number */ mc->mc_sgphys, /* location of SG list */ mc->mc_nsgent & 0x3f); /* size of SG list (top 3 bits clear) */ @@ -1778,7 +1778,7 @@ mlx_startio(struct mlx_softc *sc) mlx_make_type5(mc, cmd, blkcount & 0xff, /* xfer length low byte */ (driveno << 3) | ((blkcount >> 8) & 0x07), /* target and length high 3 bits */ - bp->b_pblkno, /* physical block number */ + bp->bio_pblkno, /* physical block number */ mc->mc_sgphys, /* location of SG list */ mc->mc_nsgent & 0x3f); /* size of SG list (top 3 bits clear) */ } @@ -1802,12 +1802,12 @@ static void mlx_completeio(struct mlx_command *mc) { struct mlx_softc *sc = mc->mc_sc; - struct buf *bp = (struct buf *)mc->mc_private; - struct mlxd_softc *mlxd = (struct mlxd_softc *)bp->b_dev->si_drv1; + struct bio *bp = (struct bio *)mc->mc_private; + struct mlxd_softc *mlxd = (struct mlxd_softc *)bp->bio_dev->si_drv1; if (mc->mc_status != MLX_STATUS_OK) { /* could be more verbose here? */ - bp->b_error = EIO; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EIO; + bp->bio_flags |= BIO_ERROR; switch(mc->mc_status) { case MLX_STATUS_RDWROFFLINE: /* system drive has gone offline */ @@ -1820,7 +1820,7 @@ mlx_completeio(struct mlx_command *mc) device_printf(sc->mlx_dev, "I/O error - %s\n", mlx_diagnose_command(mc)); #if 0 device_printf(sc->mlx_dev, " b_bcount %ld blkcount %ld b_pblkno %d\n", - bp->b_bcount, bp->b_bcount / MLX_BLKSIZE, bp->b_pblkno); + bp->bio_bcount, bp->bio_bcount / MLX_BLKSIZE, bp->bio_pblkno); device_printf(sc->mlx_dev, " %13D\n", mc->mc_mailbox, " "); #endif break; diff --git a/sys/dev/mlx/mlx_disk.c b/sys/dev/mlx/mlx_disk.c index 5420326..50f20c5 100644 --- a/sys/dev/mlx/mlx_disk.c +++ b/sys/dev/mlx/mlx_disk.c @@ -165,26 +165,26 @@ mlxd_ioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p) * be a multiple of a sector in length. */ static void -mlxd_strategy(struct buf *bp) +mlxd_strategy(struct bio *bp) { - struct mlxd_softc *sc = (struct mlxd_softc *)bp->b_dev->si_drv1; + struct mlxd_softc *sc = (struct mlxd_softc *)bp->bio_dev->si_drv1; debug_called(1); /* bogus disk? */ if (sc == NULL) { - bp->b_error = EINVAL; + bp->bio_error = EINVAL; goto bad; } /* XXX may only be temporarily offline - sleep? */ if (sc->mlxd_drive->ms_state == MLX_SYSD_OFFLINE) { - bp->b_error = ENXIO; + bp->bio_error = ENXIO; goto bad; } /* do-nothing operation */ - if (bp->b_bcount == 0) + if (bp->bio_bcount == 0) goto done; devstat_start_transaction(&sc->mlxd_stats); @@ -192,13 +192,13 @@ mlxd_strategy(struct buf *bp) return; bad: - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; done: /* * Correctly set the buf to indicate a completed transfer */ - bp->b_resid = bp->b_bcount; + bp->bio_resid = bp->bio_bcount; biodone(bp); return; } @@ -206,17 +206,17 @@ mlxd_strategy(struct buf *bp) void mlxd_intr(void *data) { - struct buf *bp = (struct buf *)data; - struct mlxd_softc *sc = (struct mlxd_softc *)bp->b_dev->si_drv1; + struct bio *bp = (struct bio *)data; + struct mlxd_softc *sc = (struct mlxd_softc *)bp->bio_dev->si_drv1; debug_called(1); - if (bp->b_ioflags & BIO_ERROR) - bp->b_error = EIO; + if (bp->bio_flags & BIO_ERROR) + bp->bio_error = EIO; else - bp->b_resid = 0; + bp->bio_resid = 0; - devstat_end_transaction_buf(&sc->mlxd_stats, bp); + devstat_end_transaction_bio(&sc->mlxd_stats, bp); biodone(bp); } diff --git a/sys/dev/mlx/mlxvar.h b/sys/dev/mlx/mlxvar.h index cd0cd90..47a5136 100644 --- a/sys/dev/mlx/mlxvar.h +++ b/sys/dev/mlx/mlxvar.h @@ -134,7 +134,7 @@ struct mlx_softc struct mlx_command *mlx_busycmd[MLX_NSLOTS]; /* busy commands */ int mlx_busycmds; /* count of busy commands */ struct mlx_sysdrive mlx_sysdrive[MLX_MAXDRIVES]; /* system drives */ - struct buf_queue_head mlx_bufq; /* outstanding I/O operations */ + struct bio_queue_head mlx_bioq; /* outstanding I/O operations */ int mlx_waitbufs; /* number of bufs awaiting commands */ /* controller status */ @@ -237,7 +237,7 @@ struct mlxd_softc /* * Interface between driver core and disk driver (should be using a bus?) */ -extern int mlx_submit_buf(struct mlx_softc *sc, struct buf *bp); +extern int mlx_submit_buf(struct mlx_softc *sc, struct bio *bp); extern int mlx_submit_ioctl(struct mlx_softc *sc, struct mlx_sysdrive *drive, u_long cmd, caddr_t addr, int32_t flag, struct proc *p); extern void mlxd_intr(void *data); diff --git a/sys/dev/scd/scd.c b/sys/dev/scd/scd.c index 6863bf6..d0ae35e 100644 --- a/sys/dev/scd/scd.c +++ b/sys/dev/scd/scd.c @@ -104,7 +104,7 @@ struct scd_mbx { short nblk; int sz; u_long skip; - struct buf *bp; + struct bio *bp; int p_offset; short count; }; @@ -128,7 +128,7 @@ static struct scd_data { struct ioc_play_msf last_play; short audio_status; - struct buf_queue_head head; /* head of buf queue */ + struct bio_queue_head head; /* head of bio queue */ struct scd_mbx mbx; } scd_data[NSCD]; @@ -213,7 +213,7 @@ scd_attach(struct isa_device *dev) cd->flags = SCDINIT; cd->audio_status = CD_AS_AUDIO_INVALID; - bufq_init(&cd->head); + bioq_init(&cd->head); make_dev(&scd_cdevsw, dkmakeminor(unit, 0, 0), UID_ROOT, GID_OPERATOR, 0640, "rscd%da", unit); @@ -310,56 +310,56 @@ scdclose(dev_t dev, int flags, int fmt, struct proc *p) } static void -scdstrategy(struct buf *bp) +scdstrategy(struct bio *bp) { struct scd_data *cd; int s; - int unit = scd_unit(bp->b_dev); + int unit = scd_unit(bp->bio_dev); cd = scd_data + unit; XDEBUG(2, ("scd%d: DEBUG: strategy: block=%ld, bcount=%ld\n", - unit, (long)bp->b_blkno, bp->b_bcount)); + unit, (long)bp->bio_blkno, bp->bio_bcount)); - if (unit >= NSCD || bp->b_blkno < 0 || (bp->b_bcount % SCDBLKSIZE)) { + if (unit >= NSCD || bp->bio_blkno < 0 || (bp->bio_bcount % SCDBLKSIZE)) { printf("scd%d: strategy failure: blkno = %ld, bcount = %ld\n", - unit, (long)bp->b_blkno, bp->b_bcount); - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + unit, (long)bp->bio_blkno, bp->bio_bcount); + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } /* if device invalidated (e.g. media change, door open), error */ if (!(cd->flags & SCDVALID)) { printf("scd%d: media changed\n", unit); - bp->b_error = EIO; + bp->bio_error = EIO; goto bad; } /* read only */ - if (!(bp->b_iocmd == BIO_READ)) { - bp->b_error = EROFS; + if (!(bp->bio_cmd == BIO_READ)) { + bp->bio_error = EROFS; goto bad; } /* no data to read */ - if (bp->b_bcount == 0) + if (bp->bio_bcount == 0) goto done; if (!(cd->flags & SCDTOC)) { - bp->b_error = EIO; + bp->bio_error = EIO; goto bad; } /* adjust transfer if necessary */ if (bounds_check_with_label(bp,&cd->dlabel,1) <= 0) goto done; - bp->b_pblkno = bp->b_blkno; - bp->b_resid = 0; + bp->bio_pblkno = bp->bio_blkno; + bp->bio_resid = 0; /* queue it */ s = splbio(); - bufqdisksort(&cd->head, bp); + bioqdisksort(&cd->head, bp); splx(s); /* now check whether we can perform processing */ @@ -367,9 +367,9 @@ scdstrategy(struct buf *bp) return; bad: - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; done: - bp->b_resid = bp->b_bcount; + bp->bio_resid = bp->bio_bcount; biodone(bp); return; } @@ -378,7 +378,7 @@ static void scd_start(int unit) { struct scd_data *cd = scd_data + unit; - struct buf *bp; + struct bio *bp; struct partition *p; int s = splbio(); @@ -387,10 +387,10 @@ scd_start(int unit) return; } - bp = bufq_first(&cd->head); + bp = bioq_first(&cd->head); if (bp != 0) { /* block found to process, dequeue */ - bufq_remove(&cd->head, bp); + bioq_remove(&cd->head, bp); cd->flags |= SCDMBXBSY; splx(s); } else { @@ -399,7 +399,7 @@ scd_start(int unit) return; } - p = cd->dlabel.d_partitions + scd_part(bp->b_dev); + p = cd->dlabel.d_partitions + scd_part(bp->bio_dev); cd->mbx.unit = unit; cd->mbx.port = cd->iobase; @@ -793,7 +793,7 @@ scd_doread(int state, struct scd_mbx *mbxin) struct scd_mbx *mbx = (state!=SCD_S_BEGIN) ? mbxsave : mbxin; int unit = mbx->unit; int port = mbx->port; - struct buf *bp = mbx->bp; + struct bio *bp = mbx->bp; struct scd_data *cd = scd_data + unit; int reg,i; int blknum; @@ -837,14 +837,14 @@ trystat: mbx->sz = cd->blksize; /* for first block */ - mbx->nblk = (bp->b_bcount + (mbx->sz-1)) / mbx->sz; + mbx->nblk = (bp->bio_bcount + (mbx->sz-1)) / mbx->sz; mbx->skip = 0; nextblock: if (!(cd->flags & SCDVALID)) goto changed; - blknum = (bp->b_blkno / (mbx->sz/DEV_BSIZE)) + blknum = (bp->bio_blkno / (mbx->sz/DEV_BSIZE)) + mbx->p_offset + mbx->skip/mbx->sz; XDEBUG(2, ("scd%d: scd_doread: read blknum=%d\n", unit, blknum)); @@ -959,7 +959,7 @@ writeparam: got_data: /* data is ready */ - addr = bp->b_data + mbx->skip; + addr = bp->bio_data + mbx->skip; write_control(port, CBIT_DATA_READY_CLEAR); insb(port+IREG_DATA, addr, mbx->sz); @@ -1026,7 +1026,7 @@ got_param: } /* return buffer */ - bp->b_resid = 0; + bp->bio_resid = 0; biodone(bp); cd->flags &= ~SCDMBXBSY; @@ -1042,9 +1042,9 @@ readerr: } harderr: /* invalidate the buffer */ - bp->b_error = EIO; - bp->b_ioflags |= BIO_ERROR; - bp->b_resid = bp->b_bcount; + bp->bio_error = EIO; + bp->bio_flags |= BIO_ERROR; + bp->bio_resid = bp->bio_bcount; biodone(bp); cd->flags &= ~SCDMBXBSY; diff --git a/sys/dev/vn/vn.c b/sys/dev/vn/vn.c index 8acdeb7..ae2bd3d 100644 --- a/sys/dev/vn/vn.c +++ b/sys/dev/vn/vn.c @@ -275,7 +275,7 @@ vnopen(dev_t dev, int flags, int mode, struct proc *p) */ static void -vnstrategy(struct buf *bp) +vnstrategy(struct bio *bp) { int unit; struct vn_softc *vn; @@ -284,27 +284,27 @@ vnstrategy(struct buf *bp) struct uio auio; struct iovec aiov; - unit = dkunit(bp->b_dev); - vn = bp->b_dev->si_drv1; + unit = dkunit(bp->bio_dev); + vn = bp->bio_dev->si_drv1; if (vn == NULL) - vn = vnfindvn(bp->b_dev); + vn = vnfindvn(bp->bio_dev); IFOPT(vn, VN_DEBUG) printf("vnstrategy(%p): unit %d\n", bp, unit); if ((vn->sc_flags & VNF_INITED) == 0) { - bp->b_error = ENXIO; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = ENXIO; + bp->bio_flags |= BIO_ERROR; biodone(bp); return; } - bp->b_resid = bp->b_bcount; + bp->bio_resid = bp->bio_bcount; IFOPT(vn, VN_LABELS) { if (vn->sc_slices != NULL && dscheck(bp, vn->sc_slices) <= 0) { /* XXX: Normal B_ERROR processing, instead ? */ - bp->b_flags |= B_INVAL; + bp->bio_flags |= B_INVAL; biodone(bp); return; } @@ -316,17 +316,17 @@ vnstrategy(struct buf *bp) * Check for required alignment. Transfers must be a valid * multiple of the sector size. */ - if (bp->b_bcount % vn->sc_secsize != 0 || - bp->b_blkno % (vn->sc_secsize / DEV_BSIZE) != 0) { - bp->b_error = EINVAL; - bp->b_flags |= B_INVAL; - bp->b_ioflags |= BIO_ERROR; + if (bp->bio_bcount % vn->sc_secsize != 0 || + bp->bio_blkno % (vn->sc_secsize / DEV_BSIZE) != 0) { + bp->bio_error = EINVAL; + /* XXX bp->b_flags |= B_INVAL; */ + bp->bio_flags |= BIO_ERROR; biodone(bp); return; } - pbn = bp->b_blkno / (vn->sc_secsize / DEV_BSIZE); - sz = howmany(bp->b_bcount, vn->sc_secsize); + pbn = bp->bio_blkno / (vn->sc_secsize / DEV_BSIZE); + sz = howmany(bp->bio_bcount, vn->sc_secsize); /* * If out of bounds return an error. If at the EOF point, @@ -334,9 +334,9 @@ vnstrategy(struct buf *bp) */ if (pbn < 0 || pbn >= vn->sc_size) { if (pbn != vn->sc_size) { - bp->b_error = EINVAL; - bp->b_flags |= B_INVAL; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EINVAL; + /* XXX bp->b_flags |= B_INVAL; */ + bp->bio_flags |= BIO_ERROR; } biodone(bp); return; @@ -346,13 +346,13 @@ vnstrategy(struct buf *bp) * If the request crosses EOF, truncate the request. */ if (pbn + sz > vn->sc_size) { - bp->b_bcount = (vn->sc_size - pbn) * vn->sc_secsize; - bp->b_resid = bp->b_bcount; + bp->bio_bcount = (vn->sc_size - pbn) * vn->sc_secsize; + bp->bio_resid = bp->bio_bcount; } - bp->b_pblkno = pbn; + bp->bio_pblkno = pbn; } - if (vn->sc_vp && (bp->b_iocmd == BIO_DELETE)) { + if (vn->sc_vp && (bp->bio_cmd == BIO_DELETE)) { /* * Not handled for vnode-backed element yet. */ @@ -365,23 +365,23 @@ vnstrategy(struct buf *bp) * B_INVAL because (for a write anyway), the buffer is * still valid. */ - aiov.iov_base = bp->b_data; - aiov.iov_len = bp->b_bcount; + aiov.iov_base = bp->bio_data; + aiov.iov_len = bp->bio_bcount; auio.uio_iov = &aiov; auio.uio_iovcnt = 1; - auio.uio_offset = (vm_ooffset_t)bp->b_pblkno * vn->sc_secsize; + auio.uio_offset = (vm_ooffset_t)bp->bio_pblkno * vn->sc_secsize; auio.uio_segflg = UIO_SYSSPACE; - if(bp->b_iocmd == BIO_READ) + if(bp->bio_cmd == BIO_READ) auio.uio_rw = UIO_READ; else auio.uio_rw = UIO_WRITE; - auio.uio_resid = bp->b_bcount; + auio.uio_resid = bp->bio_bcount; auio.uio_procp = curproc; if (!VOP_ISLOCKED(vn->sc_vp, NULL)) { isvplocked = 1; vn_lock(vn->sc_vp, LK_EXCLUSIVE | LK_RETRY, curproc); } - if(bp->b_iocmd == BIO_READ) + if(bp->bio_cmd == BIO_READ) error = VOP_READ(vn->sc_vp, &auio, 0, vn->sc_cred); else error = VOP_WRITE(vn->sc_vp, &auio, 0, vn->sc_cred); @@ -389,11 +389,11 @@ vnstrategy(struct buf *bp) VOP_UNLOCK(vn->sc_vp, 0, curproc); isvplocked = 0; } - bp->b_resid = auio.uio_resid; + bp->bio_resid = auio.uio_resid; if (error) { - bp->b_error = error; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = error; + bp->bio_flags |= BIO_ERROR; } biodone(bp); } else if (vn->sc_object) { @@ -404,17 +404,19 @@ vnstrategy(struct buf *bp) * * Note: if we pre-reserved swap, BIO_DELETE is disabled */ +#if 0 KASSERT((bp->b_bufsize & (vn->sc_secsize - 1)) == 0, ("vnstrategy: buffer %p too small for physio", bp)); +#endif - if ((bp->b_iocmd == BIO_DELETE) && TESTOPT(vn, VN_RESERVE)) { + if ((bp->bio_cmd == BIO_DELETE) && TESTOPT(vn, VN_RESERVE)) { biodone(bp); } else { vm_pager_strategy(vn->sc_object, bp); } } else { - bp->b_ioflags |= BIO_ERROR; - bp->b_error = EINVAL; + bp->bio_flags |= BIO_ERROR; + bp->bio_error = EINVAL; biodone(bp); } } diff --git a/sys/fs/cd9660/cd9660_vnops.c b/sys/fs/cd9660/cd9660_vnops.c index 355a6a53..c685aa0 100644 --- a/sys/fs/cd9660/cd9660_vnops.c +++ b/sys/fs/cd9660/cd9660_vnops.c @@ -759,14 +759,14 @@ cd9660_strategy(ap) VOP_BMAP(vp, bp->b_lblkno, NULL, &bp->b_blkno, NULL, NULL))) { bp->b_error = error; bp->b_ioflags |= BIO_ERROR; - biodone(bp); + bufdone(bp); return (error); } if ((long)bp->b_blkno == -1) clrbuf(bp); } if ((long)bp->b_blkno == -1) { - biodone(bp); + bufdone(bp); return (0); } vp = ip->i_devvp; diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index ad0852e..24180440 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -1839,14 +1839,14 @@ msdosfs_strategy(ap) if (error) { bp->b_error = error; bp->b_ioflags |= BIO_ERROR; - biodone(bp); + bufdone(bp); return (error); } if ((long)bp->b_blkno == -1) vfs_bio_clrbuf(bp); } if (bp->b_blkno == -1) { - biodone(bp); + bufdone(bp); return (0); } /* diff --git a/sys/fs/ntfs/ntfs_vnops.c b/sys/fs/ntfs/ntfs_vnops.c index fc8f04e..fdb555f 100644 --- a/sys/fs/ntfs/ntfs_vnops.c +++ b/sys/fs/ntfs/ntfs_vnops.c @@ -394,7 +394,7 @@ ntfs_strategy(ap) } } } - biodone(bp); + bufdone(bp); return (error); } diff --git a/sys/fs/nwfs/nwfs_io.c b/sys/fs/nwfs/nwfs_io.c index ab24a29..2cf3e49 100644 --- a/sys/fs/nwfs/nwfs_io.c +++ b/sys/fs/nwfs/nwfs_io.c @@ -365,12 +365,12 @@ nwfs_doio(bp, cr, p) } } else { bp->b_resid = 0; - biodone(bp); + bufdone(bp); return (0); } } bp->b_resid = uiop->uio_resid; - biodone(bp); + bufdone(bp); return (error); } diff --git a/sys/geom/geom_ccd.c b/sys/geom/geom_ccd.c index 760734d..92f8b61 100644 --- a/sys/geom/geom_ccd.c +++ b/sys/geom/geom_ccd.c @@ -764,9 +764,10 @@ ccdclose(dev, flags, fmt, p) } static void -ccdstrategy(bp) - struct buf *bp; +ccdstrategy(bip) + struct bio *bip; { + struct buf *bp = (struct buf *)bip; int unit = ccdunit(bp->b_dev); struct ccd_softc *cs = &ccd_softc[unit]; int s; @@ -795,7 +796,7 @@ ccdstrategy(bp) */ wlabel = cs->sc_flags & (CCDF_WLABEL|CCDF_LABELLING); if (ccdpart(bp->b_dev) != RAW_PART) { - if (bounds_check_with_label(bp, lp, wlabel) <= 0) + if (bounds_check_with_label(&bp->b_io, lp, wlabel) <= 0) goto done; } else { int pbn; /* in sc_secsize chunks */ @@ -838,7 +839,7 @@ ccdstrategy(bp) splx(s); return; done: - biodone(bp); + bufdone(bp); } static void @@ -1112,7 +1113,7 @@ ccdintr(cs, bp) if (bp->b_ioflags & BIO_ERROR) bp->b_resid = bp->b_bcount; devstat_end_transaction_buf(&cs->device_stats, bp); - biodone(bp); + bufdone(bp); } /* diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 72bb9a7..67dc0b8 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -2362,54 +2362,54 @@ Debugger(const char *msg) * if needed, and signal errors or early completion. */ int -bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel) +bounds_check_with_label(struct bio *bp, struct disklabel *lp, int wlabel) { - struct partition *p = lp->d_partitions + dkpart(bp->b_dev); + struct partition *p = lp->d_partitions + dkpart(bp->bio_dev); int labelsect = lp->d_partitions[0].p_offset; int maxsz = p->p_size, - sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT; + sz = (bp->bio_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT; /* overwriting disk label ? */ /* XXX should also protect bootstrap in first 8K */ - if (bp->b_blkno + p->p_offset <= LABELSECTOR + labelsect && + if (bp->bio_blkno + p->p_offset <= LABELSECTOR + labelsect && #if LABELSECTOR != 0 - bp->b_blkno + p->p_offset + sz > LABELSECTOR + labelsect && + bp->bio_blkno + p->p_offset + sz > LABELSECTOR + labelsect && #endif - (bp->b_iocmd == BIO_WRITE) && wlabel == 0) { - bp->b_error = EROFS; + (bp->bio_cmd == BIO_WRITE) && wlabel == 0) { + bp->bio_error = EROFS; goto bad; } #if defined(DOSBBSECTOR) && defined(notyet) /* overwriting master boot record? */ - if (bp->b_blkno + p->p_offset <= DOSBBSECTOR && - (bp->b_iocmd == BIO_WRITE) && wlabel == 0) { - bp->b_error = EROFS; + if (bp->bio_blkno + p->p_offset <= DOSBBSECTOR && + (bp->bio_cmd == BIO_WRITE) && wlabel == 0) { + bp->bio_error = EROFS; goto bad; } #endif /* beyond partition? */ - if (bp->b_blkno < 0 || bp->b_blkno + sz > maxsz) { + if (bp->bio_blkno < 0 || bp->bio_blkno + sz > maxsz) { /* if exactly at end of disk, return an EOF */ - if (bp->b_blkno == maxsz) { - bp->b_resid = bp->b_bcount; + if (bp->bio_blkno == maxsz) { + bp->bio_resid = bp->bio_bcount; return(0); } /* or truncate if part of it fits */ - sz = maxsz - bp->b_blkno; + sz = maxsz - bp->bio_blkno; if (sz <= 0) { - bp->b_error = EINVAL; + bp->bio_error = EINVAL; goto bad; } - bp->b_bcount = sz << DEV_BSHIFT; + bp->bio_bcount = sz << DEV_BSHIFT; } - bp->b_pblkno = bp->b_blkno + p->p_offset; + bp->bio_pblkno = bp->bio_blkno + p->p_offset; return(1); bad: - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; return(-1); } diff --git a/sys/i386/isa/labpc.c b/sys/i386/isa/labpc.c index 7913534..ba59bc8 100644 --- a/sys/i386/isa/labpc.c +++ b/sys/i386/isa/labpc.c @@ -51,7 +51,7 @@ #include #include #include -#define b_actf b_act.tqe_next +#define b_actf bio_queue.tqe_next #include #include @@ -122,8 +122,8 @@ struct ctlr u_short sample_us; - struct buf start_queue; /* Start queue */ - struct buf *last; /* End of start queue */ + struct bio start_queue; /* Start queue */ + struct bio *last; /* End of start queue */ u_char *data; u_char *data_end; long tmo; /* Timeout in Herz */ @@ -307,13 +307,13 @@ static ointhand2_t labpcintr; static void start(struct ctlr *ctlr); static void -bp_done(struct buf *bp, int err) +bp_done(struct bio *bp, int err) { - bp->b_error = err; + bp->bio_error = err; - if (err || bp->b_resid) + if (err || bp->bio_resid) { - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; } biodone(bp); @@ -322,9 +322,9 @@ bp_done(struct buf *bp, int err) static void tmo_stop(void *p); static void -done_and_start_next(struct ctlr *ctlr, struct buf *bp, int err) +done_and_start_next(struct ctlr *ctlr, struct bio *bp, int err) { - bp->b_resid = ctlr->data_end - ctlr->data; + bp->bio_resid = ctlr->data_end - ctlr->data; ctlr->data = 0; @@ -592,7 +592,7 @@ static void tmo_stop(void *p) { struct ctlr *ctlr = (struct ctlr *)p; - struct buf *bp; + struct bio *bp; int s = spltty(); @@ -643,7 +643,7 @@ static void ad_intr(struct ctlr *ctlr) { if ((status & (OVERRUN|OVERFLOW))) { - struct buf *bp = ctlr->start_queue.b_actf; + struct bio *bp = ctlr->start_queue.b_actf; printf("ad_intr: error: bp %p, data %p, status %x", (void *)bp, (void *)ctlr->data, status); @@ -670,7 +670,7 @@ static void ad_intr(struct ctlr *ctlr) } else /* FIFO interrupt */ { - struct buf *bp = ctlr->start_queue.b_actf; + struct bio *bp = ctlr->start_queue.b_actf; if (ctlr->data) { @@ -768,7 +768,7 @@ labpcclose(dev_t dev, int flags, int fmt, struct proc *p) static void start(struct ctlr *ctlr) { - struct buf *bp; + struct bio *bp; if ((bp = ctlr->start_queue.b_actf) == 0) { @@ -778,12 +778,12 @@ start(struct ctlr *ctlr) */ CR_EXPR(ctlr, 3, &= ~(FIFOINTEN|ERRINTEN)); ctlr->cleared_intr = 1; - ctlr->start_queue.b_bcount = 0; + ctlr->start_queue.bio_bcount = 0; return; } - ctlr->data = (u_char *)bp->b_data; - ctlr->data_end = ctlr->data + bp->b_bcount; + ctlr->data = (u_char *)bp->bio_data; + ctlr->data_end = ctlr->data + bp->bio_bcount; if (ctlr->err) { @@ -800,7 +800,7 @@ start(struct ctlr *ctlr) } - (*ctlr->starter)(ctlr, bp->b_bcount); + (*ctlr->starter)(ctlr, bp->bio_bcount); if (!FIFOINTENABLED(ctlr)) /* We can store the data again */ { @@ -815,21 +815,21 @@ start(struct ctlr *ctlr) } static void -ad_strategy(struct buf *bp, struct ctlr *ctlr) +ad_strategy(struct bio *bp, struct ctlr *ctlr) { int s; s = spltty(); bp->b_actf = NULL; - if (ctlr->start_queue.b_bcount) + if (ctlr->start_queue.bio_bcount) { ctlr->last->b_actf = bp; ctlr->last = bp; } else { - ctlr->start_queue.b_bcount = 1; + ctlr->start_queue.bio_bcount = 1; ctlr->start_queue.b_actf = bp; ctlr->last = bp; start(ctlr); @@ -850,14 +850,14 @@ ad_strategy(struct buf *bp, struct ctlr *ctlr) * 2. No interrupt support yet. */ static void -da_strategy(struct buf *bp, struct ctlr *ctlr) +da_strategy(struct bio *bp, struct ctlr *ctlr) { int len; u_char *data; int port; int i; - switch(CHAN(bp->b_dev)) + switch(CHAN(bp->bio_dev)) { case 0: port = DAC0L(ctlr); @@ -868,14 +868,14 @@ da_strategy(struct buf *bp, struct ctlr *ctlr) break; case 2: /* Device 2 handles both ports interleaved. */ - if (bp->b_bcount <= 2) + if (bp->bio_bcount <= 2) { port = DAC0L(ctlr); break; } - len = bp->b_bcount / 2; - data = (u_char *)bp->b_data; + len = bp->bio_bcount / 2; + data = (u_char *)bp->bio_data; for (i = 0; i < len; i++) { @@ -885,7 +885,7 @@ da_strategy(struct buf *bp, struct ctlr *ctlr) loutb(DAC1L(ctlr), *data++); } - bp->b_resid = bp->b_bcount & 3; + bp->bio_resid = bp->bio_bcount & 3; bp_done(bp, 0); return; @@ -896,11 +896,11 @@ da_strategy(struct buf *bp, struct ctlr *ctlr) /* Port 0 or 1 falls through to here. */ - if (bp->b_bcount & 1) /* Odd transfers are illegal */ + if (bp->bio_bcount & 1) /* Odd transfers are illegal */ bp_done(bp, EIO); - len = bp->b_bcount; - data = (u_char *)bp->b_data; + len = bp->bio_bcount; + data = (u_char *)bp->bio_data; for (i = 0; i < len; i++) { @@ -908,7 +908,7 @@ da_strategy(struct buf *bp, struct ctlr *ctlr) loutb(port, *data++); } - bp->b_resid = 0; + bp->bio_resid = 0; bp_done(bp, 0); } @@ -931,28 +931,28 @@ static void flush_dcr(struct ctlr *ctlr) /* do: Digital output */ static void -digital_out_strategy(struct buf *bp, struct ctlr *ctlr) +digital_out_strategy(struct bio *bp, struct ctlr *ctlr) { int len; u_char *data; int port; int i; - int chan = CHAN(bp->b_dev); + int chan = CHAN(bp->bio_dev); ctlr->dcr_val &= ~set_input[chan]; /* Digital out: Clear bit */ flush_dcr(ctlr); port = PORTX(ctlr, chan); - len = bp->b_bcount; - data = (u_char *)bp->b_data; + len = bp->bio_bcount; + data = (u_char *)bp->bio_data; for (i = 0; i < len; i++) { loutb(port, *data++); } - bp->b_resid = 0; + bp->bio_resid = 0; bp_done(bp, 0); } @@ -960,39 +960,39 @@ digital_out_strategy(struct buf *bp, struct ctlr *ctlr) /* digital_in_strategy: Digital input */ static void -digital_in_strategy(struct buf *bp, struct ctlr *ctlr) +digital_in_strategy(struct bio *bp, struct ctlr *ctlr) { int len; u_char *data; int port; int i; - int chan = CHAN(bp->b_dev); + int chan = CHAN(bp->bio_dev); ctlr->dcr_val |= set_input[chan]; /* Digital in: Set bit */ flush_dcr(ctlr); port = PORTX(ctlr, chan); - len = bp->b_bcount; - data = (u_char *)bp->b_data; + len = bp->bio_bcount; + data = (u_char *)bp->bio_data; for (i = 0; i < len; i++) { *data++ = inb(port); } - bp->b_resid = 0; + bp->bio_resid = 0; bp_done(bp, 0); } static void -labpcstrategy(struct buf *bp) +labpcstrategy(struct bio *bp) { - struct ctlr *ctlr = labpcs[UNIT(bp->b_dev)]; + struct ctlr *ctlr = labpcs[UNIT(bp->bio_dev)]; - if (DIGITAL(bp->b_dev)) { - if (bp->b_iocmd == BIO_READ) { + if (DIGITAL(bp->bio_dev)) { + if (bp->bio_cmd == BIO_READ) { ctlr->starter = null_start; ctlr->stop = all_stop; ctlr->intr = null_intr; @@ -1007,7 +1007,7 @@ labpcstrategy(struct buf *bp) } } else { - if (bp->b_iocmd == BIO_READ) { + if (bp->bio_cmd == BIO_READ) { ctlr->starter = INTERVAL(ctlr->dev) ? ad_interval_start : ad_start; ctlr->stop = all_stop; diff --git a/sys/i386/isa/matcd/matcd.c b/sys/i386/isa/matcd/matcd.c index 9993932..4b48446 100644 --- a/sys/i386/isa/matcd/matcd.c +++ b/sys/i386/isa/matcd/matcd.c @@ -403,7 +403,7 @@ struct matcd_mbx { short nblk; int sz; u_long skip; - struct buf *bp; + struct bio *bp; int p_offset; short count; }; @@ -447,7 +447,7 @@ static struct matcd_data { #define ERR_FATAL 3 /*This cannot be recovered from*/ -static struct buf_queue_head request_head[NUMCTRLRS]; /*<18>A queue for each host interface*/ +static struct bio_queue_head request_head[NUMCTRLRS]; /*<18>A queue for each host interface*/ static int nextcontroller=0; /*<18>Number of interface units found*/ static int drivepresent=0; /*<18>Don't change this - see license*/ static int iftype; /*<20>Probe/Attach i.f. type relay*/ @@ -849,52 +849,52 @@ int matcdclose(dev_t dev, int flags, int fmt, rely on the current request starting the next one before exiting. ---------------------------------------------------------------------------*/ -void matcdstrategy(struct buf *bp) +void matcdstrategy(struct bio *bp) { struct matcd_data *cd; int s; int ldrive,controller; - ldrive=matcd_ldrive(bp->b_dev); - controller=matcd_controller(bp->b_dev); + ldrive=matcd_ldrive(bp->bio_dev); + controller=matcd_controller(bp->bio_dev); cd= &matcd_data[ldrive]; #ifdef DEBUGIO printf("matcd%d: Strategy: buf=0x%lx, block#=%ld bcount=%ld\n", - ldrive,(unsigned long)bp,bp->b_blkno,bp->b_bcount); + ldrive,(unsigned long)bp,bp->bio_blkno,bp->bio_bcount); #endif /*DEBUGIO*/ - if (ldrive >= TOTALDRIVES || bp->b_blkno < 0) { + if (ldrive >= TOTALDRIVES || bp->bio_blkno < 0) { printf("matcd%d: Bogus parameters received - kernel may be corrupted\n",ldrive); - bp->b_error=EINVAL; + bp->bio_error=EINVAL; goto bad; } if (!(cd->flags & MATCDLABEL)) { - bp->b_error = EIO; + bp->bio_error = EIO; goto bad; } - if (!(bp->b_iocmd == BIO_READ)) { - bp->b_error = EROFS; + if (!(bp->bio_cmd == BIO_READ)) { + bp->bio_error = EROFS; goto bad; } - if (bp->b_bcount==0) /*Request is zero-length - all done*/ + if (bp->bio_bcount==0) /*Request is zero-length - all done*/ goto done; - if (matcd_partition(bp->b_dev) != RAW_PART) { + if (matcd_partition(bp->bio_dev) != RAW_PART) { if (bounds_check_with_label(bp,&cd->dlabel,1) <= 0) { goto done; } } else { - bp->b_pblkno=bp->b_blkno; - bp->b_resid=0; + bp->bio_pblkno=bp->bio_blkno; + bp->bio_resid=0; } s=splbio(); /*Make sure we don't get intr'ed*/ - bufqdisksort(&request_head[controller], bp);/*Add new request (bp) to queue (dp + bioqdisksort(&request_head[controller], bp);/*Add new request (bp) to queue (dp and sort the requests in a way that may not be ideal for CD-ROM media*/ @@ -905,8 +905,8 @@ void matcdstrategy(struct buf *bp) splx(s); /*Return priorities to normal*/ return; /*All done*/ -bad: bp->b_ioflags |= BIO_ERROR; /*Request bad in some way*/ -done: bp->b_resid = bp->b_bcount; /*Show amount of data un read*/ +bad: bp->bio_flags |= BIO_ERROR; /*Request bad in some way*/ +done: bp->bio_resid = bp->bio_bcount; /*Show amount of data un read*/ biodone(bp); /*Signal we have done all we plan to*/ return; } @@ -919,17 +919,17 @@ done: bp->b_resid = bp->b_bcount; /*Show amount of data un read*/ static void matcd_start(int controller) { struct matcd_data *cd; - struct buf *bp; + struct bio *bp; struct partition *p; int part,ldrive; - bp = bufq_first(&request_head[controller]); + bp = bioq_first(&request_head[controller]); if (bp == NULL) { /*Nothing on read queue to do?*/ wakeup((caddr_t)&matcd_data->status); /*Wakeup any blocked*/ return; /* opens, ioctls, etc*/ } - ldrive=matcd_ldrive(bp->b_dev); /*Get logical drive#*/ + ldrive=matcd_ldrive(bp->bio_dev); /*Get logical drive#*/ cd=&matcd_data[ldrive]; /*Get pointer to data for this drive*/ #ifdef DEBUGIO printf("matcd%d: In start controller %d\n",ldrive,controller); @@ -947,9 +947,9 @@ static void matcd_start(int controller) get the command to do and issue it */ - bufq_remove(&request_head[controller], bp); + bioq_remove(&request_head[controller], bp); - part=matcd_partition(bp->b_dev); + part=matcd_partition(bp->bio_dev); p=cd->dlabel.d_partitions + part; if_state[controller] |= BUSBUSY;/*<18>Mark bus as busy*/ @@ -1351,7 +1351,7 @@ matcd_attach(struct isa_device *dev) #endif /*DEBUGPROBE*/ printf("matcdc%d Host interface type %d\n", nextcontroller,iftype); - bufq_init(&request_head[nextcontroller]); + bioq_init(&request_head[nextcontroller]); for (cdrive=0; cdrive<4; cdrive++) { /*We're hunting drives...*/ zero_cmd(cmd); cmd[0]=NOP; /*A reasonably harmless command. @@ -1836,7 +1836,7 @@ static void matcd_blockread(int state) int ldrive,cdrive; int port, controller; short iftype; - struct buf *bp; + struct bio *bp; struct matcd_data *cd; int i; struct matcd_read2 rbuf; @@ -1888,17 +1888,17 @@ loop: #ifdef DEBUGIO printf("matcd%d: A mbx %x bp %x b_bcount %x sz %x\n", ldrive,(unsigned int)mbx,(unsigned int)bp, - (unsigned int)bp->b_bcount,mbx->sz); + (unsigned int)bp->bio_bcount,mbx->sz); #endif /*DEBUGIO*/ - mbx->nblk = (bp->b_bcount + (mbx->sz-1)) / mbx->sz; + mbx->nblk = (bp->bio_bcount + (mbx->sz-1)) / mbx->sz; mbx->skip=0; nextblock: #ifdef DEBUGIO printf("matcd%d: at Nextblock b_blkno %d\n", - ldrive,(unsigned int)bp->b_blkno); + ldrive,(unsigned int)bp->bio_blkno); #endif /*DEBUGIO*/ - blknum=(bp->b_blkno / (mbx->sz/DEV_BSIZE)) + blknum=(bp->bio_blkno / (mbx->sz/DEV_BSIZE)) + mbx->p_offset + mbx->skip/mbx->sz; blk_to_msf(blknum,rbuf.start_msf); @@ -1940,7 +1940,7 @@ nextblock: #ifdef DEBUGIO printf("matcd%d: Data Phase\n",ldrive); #endif /*DEBUGIO*/ - addr=bp->b_data + mbx->skip; + addr=bp->bio_data + mbx->skip; #ifdef DEBUGIO printf("matcd%d: Xfer Addr %x size %x", ldrive,(unsigned int)addr,mbx->sz); @@ -1982,7 +1982,7 @@ nextblock: if (status & MATCD_ST_ERROR) { i=get_error(port,ldrive,cdrive); printf("matcd%d: %s while reading block %d [Soft]\n", - ldrive,matcderrors[i],(int)bp->b_blkno); + ldrive,matcderrors[i],(int)bp->bio_blkno); media_chk(cd,i,ldrive,0);/*<14>was wrong place*/ } @@ -1990,7 +1990,7 @@ nextblock: mbx->skip += mbx->sz; goto nextblock; /*Oooooh, you flunk the course*/ } - bp->b_resid=0; + bp->bio_resid=0; biodone(bp); /*Signal transfer complete*/ unlockbus(ldrive>>2, ldrive); /*Release bus lock*/ @@ -2014,7 +2014,7 @@ nextblock: errtyp=get_error(port,ldrive,cdrive); printf("matcd%d: %s while reading block %d\n", - ldrive,matcderrors[errtyp],(int)bp->b_blkno); + ldrive,matcderrors[errtyp],(int)bp->bio_blkno); if (media_chk(cd,errtyp,ldrive,0)==0) { errtyp=chk_error(errtyp); @@ -2035,8 +2035,8 @@ nextblock: <14> has been removed by the user. In both cases there is no retry <14> for this call. We will invalidate the label in both cases. */ - bp->b_ioflags |= BIO_ERROR; - bp->b_resid = bp->b_bcount; + bp->bio_flags |= BIO_ERROR; + bp->bio_resid = bp->bio_bcount; biodone(bp); unlockbus(ldrive>>2, ldrive); matcd_start(controller); diff --git a/sys/i386/isa/mcd.c b/sys/i386/isa/mcd.c index 70614d7..1bdc726 100644 --- a/sys/i386/isa/mcd.c +++ b/sys/i386/isa/mcd.c @@ -116,7 +116,7 @@ struct mcd_mbx { short nblk; int sz; u_long skip; - struct buf *bp; + struct bio *bp; int p_offset; short count; short mode; @@ -141,7 +141,7 @@ static struct mcd_data { short curr_mode; struct mcd_read2 lastpb; short debug; - struct buf_queue_head head; /* head of buf queue */ + struct bio_queue_head head; /* head of bio queue */ struct mcd_mbx mbx; } mcd_data[NMCD]; @@ -250,7 +250,7 @@ int mcd_attach(struct isa_device *dev) cd->iobase = dev->id_iobase; cd->flags |= MCDINIT; mcd_soft_reset(unit); - bufq_init(&cd->head); + bioq_init(&cd->head); #ifdef NOTYET /* wire controller for interrupts and dma */ @@ -385,48 +385,48 @@ int mcdclose(dev_t dev, int flags, int fmt, struct proc *p) } void -mcdstrategy(struct buf *bp) +mcdstrategy(struct bio *bp) { struct mcd_data *cd; int s; - int unit = mcd_unit(bp->b_dev); + int unit = mcd_unit(bp->bio_dev); cd = mcd_data + unit; /* test validity */ /*MCD_TRACE("strategy: buf=0x%lx, unit=%ld, block#=%ld bcount=%ld\n", - bp,unit,bp->b_blkno,bp->b_bcount);*/ - if (unit >= NMCD || bp->b_blkno < 0) { + bp,unit,bp->bio_blkno,bp->bio_bcount);*/ + if (unit >= NMCD || bp->bio_blkno < 0) { printf("mcdstrategy: unit = %d, blkno = %ld, bcount = %ld\n", - unit, (long)bp->b_blkno, bp->b_bcount); + unit, (long)bp->bio_blkno, bp->bio_bcount); printf("mcd: mcdstratregy failure"); - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } /* if device invalidated (e.g. media change, door open), error */ if (!(cd->flags & MCDVALID)) { MCD_TRACE("strategy: drive not valid\n"); - bp->b_error = EIO; + bp->bio_error = EIO; goto bad; } /* read only */ - if (!(bp->b_iocmd == BIO_READ)) { - bp->b_error = EROFS; + if (!(bp->bio_cmd == BIO_READ)) { + bp->bio_error = EROFS; goto bad; } /* no data to read */ - if (bp->b_bcount == 0) + if (bp->bio_bcount == 0) goto done; /* for non raw access, check partition limits */ - if (mcd_part(bp->b_dev) != RAW_PART) { + if (mcd_part(bp->bio_dev) != RAW_PART) { if (!(cd->flags & MCDLABEL)) { - bp->b_error = EIO; + bp->bio_error = EIO; goto bad; } /* adjust transfer if necessary */ @@ -434,13 +434,13 @@ MCD_TRACE("strategy: drive not valid\n"); goto done; } } else { - bp->b_pblkno = bp->b_blkno; - bp->b_resid = 0; + bp->bio_pblkno = bp->bio_blkno; + bp->bio_resid = 0; } /* queue it */ s = splbio(); - bufqdisksort(&cd->head, bp); + bioqdisksort(&cd->head, bp); splx(s); /* now check whether we can perform processing */ @@ -448,9 +448,9 @@ MCD_TRACE("strategy: drive not valid\n"); return; bad: - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; done: - bp->b_resid = bp->b_bcount; + bp->bio_resid = bp->bio_bcount; biodone(bp); return; } @@ -459,7 +459,7 @@ static void mcd_start(int unit) { struct mcd_data *cd = mcd_data + unit; struct partition *p; - struct buf *bp; + struct bio *bp; int s = splbio(); if (cd->flags & MCDMBXBSY) { @@ -467,11 +467,11 @@ static void mcd_start(int unit) return; } - bp = bufq_first(&cd->head); + bp = bioq_first(&cd->head); if (bp != 0) { /* block found to process, dequeue */ /*MCD_TRACE("mcd_start: found block bp=0x%x\n",bp,0,0,0);*/ - bufq_remove(&cd->head, bp); + bioq_remove(&cd->head, bp); splx(s); } else { /* nothing to do */ @@ -485,10 +485,10 @@ static void mcd_start(int unit) return; } - p = cd->dlabel.d_partitions + mcd_part(bp->b_dev); + p = cd->dlabel.d_partitions + mcd_part(bp->bio_dev); cd->flags |= MCDMBXBSY; - if (cd->partflags[mcd_part(bp->b_dev)] & MCDREADRAW) + if (cd->partflags[mcd_part(bp->bio_dev)] & MCDREADRAW) cd->flags |= MCDREADRAW; cd->mbx.unit = unit; cd->mbx.port = cd->iobase; @@ -993,7 +993,7 @@ mcd_doread(int state, struct mcd_mbx *mbxin) int port = mbx->port; int com_port = mbx->port + mcd_command; int data_port = mbx->port + mcd_rdata; - struct buf *bp = mbx->bp; + struct bio *bp = mbx->bp; struct mcd_data *cd = mcd_data + unit; int rm,i,k; @@ -1086,11 +1086,11 @@ retry_mode: RDELAY_WAITMODE-mbx->count); modedone: /* for first block */ - mbx->nblk = (bp->b_bcount + (mbx->sz-1)) / mbx->sz; + mbx->nblk = (bp->bio_bcount + (mbx->sz-1)) / mbx->sz; mbx->skip = 0; nextblock: - blknum = (bp->b_blkno / (mbx->sz/DEV_BSIZE)) + blknum = (bp->bio_blkno / (mbx->sz/DEV_BSIZE)) + mbx->p_offset + mbx->skip/mbx->sz; MCD_TRACE("mcd_doread: read blknum=%d for bp=%p\n", @@ -1131,7 +1131,7 @@ retry_read: RDELAY_WAITREAD-mbx->count); got_it: /* data is ready */ - addr = bp->b_data + mbx->skip; + addr = bp->bio_data + mbx->skip; outb(port+mcd_ctl2,0x04); /* XXX */ for (i=0; isz; i++) @@ -1153,7 +1153,7 @@ retry_read: } /* return buffer */ - bp->b_resid = 0; + bp->bio_resid = 0; biodone(bp); cd->flags &= ~(MCDMBXBSY|MCDREADRAW); @@ -1184,8 +1184,8 @@ readerr: } harderr: /* invalidate the buffer */ - bp->b_ioflags |= BIO_ERROR; - bp->b_resid = bp->b_bcount; + bp->bio_flags |= BIO_ERROR; + bp->bio_resid = bp->bio_bcount; biodone(bp); cd->flags &= ~(MCDMBXBSY|MCDREADRAW); diff --git a/sys/i386/isa/scd.c b/sys/i386/isa/scd.c index 6863bf6..d0ae35e 100644 --- a/sys/i386/isa/scd.c +++ b/sys/i386/isa/scd.c @@ -104,7 +104,7 @@ struct scd_mbx { short nblk; int sz; u_long skip; - struct buf *bp; + struct bio *bp; int p_offset; short count; }; @@ -128,7 +128,7 @@ static struct scd_data { struct ioc_play_msf last_play; short audio_status; - struct buf_queue_head head; /* head of buf queue */ + struct bio_queue_head head; /* head of bio queue */ struct scd_mbx mbx; } scd_data[NSCD]; @@ -213,7 +213,7 @@ scd_attach(struct isa_device *dev) cd->flags = SCDINIT; cd->audio_status = CD_AS_AUDIO_INVALID; - bufq_init(&cd->head); + bioq_init(&cd->head); make_dev(&scd_cdevsw, dkmakeminor(unit, 0, 0), UID_ROOT, GID_OPERATOR, 0640, "rscd%da", unit); @@ -310,56 +310,56 @@ scdclose(dev_t dev, int flags, int fmt, struct proc *p) } static void -scdstrategy(struct buf *bp) +scdstrategy(struct bio *bp) { struct scd_data *cd; int s; - int unit = scd_unit(bp->b_dev); + int unit = scd_unit(bp->bio_dev); cd = scd_data + unit; XDEBUG(2, ("scd%d: DEBUG: strategy: block=%ld, bcount=%ld\n", - unit, (long)bp->b_blkno, bp->b_bcount)); + unit, (long)bp->bio_blkno, bp->bio_bcount)); - if (unit >= NSCD || bp->b_blkno < 0 || (bp->b_bcount % SCDBLKSIZE)) { + if (unit >= NSCD || bp->bio_blkno < 0 || (bp->bio_bcount % SCDBLKSIZE)) { printf("scd%d: strategy failure: blkno = %ld, bcount = %ld\n", - unit, (long)bp->b_blkno, bp->b_bcount); - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + unit, (long)bp->bio_blkno, bp->bio_bcount); + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } /* if device invalidated (e.g. media change, door open), error */ if (!(cd->flags & SCDVALID)) { printf("scd%d: media changed\n", unit); - bp->b_error = EIO; + bp->bio_error = EIO; goto bad; } /* read only */ - if (!(bp->b_iocmd == BIO_READ)) { - bp->b_error = EROFS; + if (!(bp->bio_cmd == BIO_READ)) { + bp->bio_error = EROFS; goto bad; } /* no data to read */ - if (bp->b_bcount == 0) + if (bp->bio_bcount == 0) goto done; if (!(cd->flags & SCDTOC)) { - bp->b_error = EIO; + bp->bio_error = EIO; goto bad; } /* adjust transfer if necessary */ if (bounds_check_with_label(bp,&cd->dlabel,1) <= 0) goto done; - bp->b_pblkno = bp->b_blkno; - bp->b_resid = 0; + bp->bio_pblkno = bp->bio_blkno; + bp->bio_resid = 0; /* queue it */ s = splbio(); - bufqdisksort(&cd->head, bp); + bioqdisksort(&cd->head, bp); splx(s); /* now check whether we can perform processing */ @@ -367,9 +367,9 @@ scdstrategy(struct buf *bp) return; bad: - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; done: - bp->b_resid = bp->b_bcount; + bp->bio_resid = bp->bio_bcount; biodone(bp); return; } @@ -378,7 +378,7 @@ static void scd_start(int unit) { struct scd_data *cd = scd_data + unit; - struct buf *bp; + struct bio *bp; struct partition *p; int s = splbio(); @@ -387,10 +387,10 @@ scd_start(int unit) return; } - bp = bufq_first(&cd->head); + bp = bioq_first(&cd->head); if (bp != 0) { /* block found to process, dequeue */ - bufq_remove(&cd->head, bp); + bioq_remove(&cd->head, bp); cd->flags |= SCDMBXBSY; splx(s); } else { @@ -399,7 +399,7 @@ scd_start(int unit) return; } - p = cd->dlabel.d_partitions + scd_part(bp->b_dev); + p = cd->dlabel.d_partitions + scd_part(bp->bio_dev); cd->mbx.unit = unit; cd->mbx.port = cd->iobase; @@ -793,7 +793,7 @@ scd_doread(int state, struct scd_mbx *mbxin) struct scd_mbx *mbx = (state!=SCD_S_BEGIN) ? mbxsave : mbxin; int unit = mbx->unit; int port = mbx->port; - struct buf *bp = mbx->bp; + struct bio *bp = mbx->bp; struct scd_data *cd = scd_data + unit; int reg,i; int blknum; @@ -837,14 +837,14 @@ trystat: mbx->sz = cd->blksize; /* for first block */ - mbx->nblk = (bp->b_bcount + (mbx->sz-1)) / mbx->sz; + mbx->nblk = (bp->bio_bcount + (mbx->sz-1)) / mbx->sz; mbx->skip = 0; nextblock: if (!(cd->flags & SCDVALID)) goto changed; - blknum = (bp->b_blkno / (mbx->sz/DEV_BSIZE)) + blknum = (bp->bio_blkno / (mbx->sz/DEV_BSIZE)) + mbx->p_offset + mbx->skip/mbx->sz; XDEBUG(2, ("scd%d: scd_doread: read blknum=%d\n", unit, blknum)); @@ -959,7 +959,7 @@ writeparam: got_data: /* data is ready */ - addr = bp->b_data + mbx->skip; + addr = bp->bio_data + mbx->skip; write_control(port, CBIT_DATA_READY_CLEAR); insb(port+IREG_DATA, addr, mbx->sz); @@ -1026,7 +1026,7 @@ got_param: } /* return buffer */ - bp->b_resid = 0; + bp->bio_resid = 0; biodone(bp); cd->flags &= ~SCDMBXBSY; @@ -1042,9 +1042,9 @@ readerr: } harderr: /* invalidate the buffer */ - bp->b_error = EIO; - bp->b_ioflags |= BIO_ERROR; - bp->b_resid = bp->b_bcount; + bp->bio_error = EIO; + bp->bio_flags |= BIO_ERROR; + bp->bio_resid = bp->bio_bcount; biodone(bp); cd->flags &= ~SCDMBXBSY; diff --git a/sys/i386/isa/wt.c b/sys/i386/isa/wt.c index 0aa7015..f6e65a5 100644 --- a/sys/i386/isa/wt.c +++ b/sys/i386/isa/wt.c @@ -506,15 +506,15 @@ wtioctl (dev_t dev, u_long cmd, caddr_t arg, int flags, struct proc *p) * Strategy routine. */ static void -wtstrategy (struct buf *bp) +wtstrategy (struct bio *bp) { - int u = minor (bp->b_dev) & T_UNIT; + int u = minor (bp->bio_dev) & T_UNIT; wtinfo_t *t = wttab + u; int s; - bp->b_resid = bp->b_bcount; + bp->bio_resid = bp->bio_bcount; if (u >= NWT || t->type == UNKNOWN) { - bp->b_error = ENXIO; + bp->bio_error = ENXIO; goto err2xit; } @@ -522,12 +522,12 @@ wtstrategy (struct buf *bp) if (t->flags & TPVOL) goto xit; - if (bp->b_bcount % t->bsize != 0) { - bp->b_error = EINVAL; + if (bp->bio_bcount % t->bsize != 0) { + bp->bio_error = EINVAL; goto err2xit; } - if (bp->b_iocmd == BIO_READ) { + if (bp->bio_cmd == BIO_READ) { /* Check read access and no previous write to this tape. */ if (! (t->flags & TPREAD) || (t->flags & TPWANY)) goto errxit; @@ -561,21 +561,21 @@ wtstrategy (struct buf *bp) } } - if (! bp->b_bcount) + if (! bp->bio_bcount) goto xit; t->flags &= ~TPEXCEP; s = splbio (); - if (wtstart (t, bp->b_iocmd == BIO_READ ? ISADMA_READ : ISADMA_WRITE, - bp->b_data, bp->b_bcount)) { - wtwait (t, 0, (bp->b_iocmd == BIO_READ) ? "wtread" : "wtwrite"); - bp->b_resid -= t->dmacount; + if (wtstart (t, bp->bio_cmd == BIO_READ ? ISADMA_READ : ISADMA_WRITE, + bp->bio_data, bp->bio_bcount)) { + wtwait (t, 0, (bp->bio_cmd == BIO_READ) ? "wtread" : "wtwrite"); + bp->bio_resid -= t->dmacount; } splx (s); if (t->flags & TPEXCEP) { -errxit: bp->b_error = EIO; -err2xit: bp->b_ioflags |= BIO_ERROR; +errxit: bp->bio_error = EIO; +err2xit: bp->bio_flags |= BIO_ERROR; } xit: biodone (bp); return; diff --git a/sys/isa/fd.c b/sys/isa/fd.c index 948142c..c1b02b1 100644 --- a/sys/isa/fd.c +++ b/sys/isa/fd.c @@ -84,7 +84,6 @@ #include /* misuse a flag to identify format operation */ -#define B_FORMAT B_XXX /* configuration flags */ #define FDC_PRETEND_D0 (1 << 0) /* pretend drive 0 to be there */ @@ -863,7 +862,7 @@ fdc_attach(device_t dev) /* reset controller, turn motor off, clear fdout mirror reg */ fdout_wr(fdc, ((fdc->fdout = 0))); - bufq_init(&fdc->head); + bioq_init(&fdc->head); /* * Probe and attach any children. We should probably detect @@ -1447,7 +1446,7 @@ fdclose(dev_t dev, int flags, int mode, struct proc *p) /* fdstrategy */ /****************************************************************************/ void -fdstrategy(struct buf *bp) +fdstrategy(struct bio *bp) { unsigned nblocks, blknum, cando; int s; @@ -1456,31 +1455,31 @@ fdstrategy(struct buf *bp) fd_p fd; size_t fdblk; - fdu = FDUNIT(minor(bp->b_dev)); + fdu = FDUNIT(minor(bp->bio_dev)); fd = devclass_get_softc(fd_devclass, fdu); if (fd == 0) panic("fdstrategy: buf for nonexistent device (%#lx, %#lx)", - (u_long)major(bp->b_dev), (u_long)minor(bp->b_dev)); + (u_long)major(bp->bio_dev), (u_long)minor(bp->bio_dev)); fdc = fd->fdc; if (fd->type == NO_TYPE) { - bp->b_error = ENXIO; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = ENXIO; + bp->bio_flags |= BIO_ERROR; goto bad; }; fdblk = 128 << (fd->ft->secsize); - if (!(bp->b_flags & B_FORMAT)) { - if (bp->b_blkno < 0) { + if (!(bp->bio_cmd & BIO_FORMAT)) { + if (bp->bio_blkno < 0) { printf( "fd%d: fdstrat: bad request blkno = %lu, bcount = %ld\n", - fdu, (u_long)bp->b_blkno, bp->b_bcount); - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + fdu, (u_long)bp->bio_blkno, bp->bio_bcount); + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } - if ((bp->b_bcount % fdblk) != 0) { - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + if ((bp->bio_bcount % fdblk) != 0) { + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } } @@ -1488,33 +1487,33 @@ fdstrategy(struct buf *bp) /* * Set up block calculations. */ - if (bp->b_blkno > 20000000) { + if (bp->bio_blkno > 20000000) { /* * Reject unreasonably high block number, prevent the * multiplication below from overflowing. */ - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } - blknum = (unsigned) bp->b_blkno * DEV_BSIZE/fdblk; + blknum = (unsigned) bp->bio_blkno * DEV_BSIZE/fdblk; nblocks = fd->ft->size; - bp->b_resid = 0; - if (blknum + (bp->b_bcount / fdblk) > nblocks) { + bp->bio_resid = 0; + if (blknum + (bp->bio_bcount / fdblk) > nblocks) { if (blknum <= nblocks) { cando = (nblocks - blknum) * fdblk; - bp->b_resid = bp->b_bcount - cando; + bp->bio_resid = bp->bio_bcount - cando; if (cando == 0) goto bad; /* not actually bad but EOF */ } else { - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } } - bp->b_pblkno = bp->b_blkno; + bp->bio_pblkno = bp->bio_blkno; s = splbio(); - bufqdisksort(&fdc->head, bp); + bioqdisksort(&fdc->head, bp); untimeout(fd_turnoff, fd, fd->toffhandle); /* a good idea */ /* Tell devstat we are starting on the transaction */ @@ -1647,15 +1646,15 @@ fdstate(fdc_p fdc) unsigned blknum = 0, b_cylinder = 0; fdu_t fdu = fdc->fdu; fd_p fd; - register struct buf *bp; + register struct bio *bp; struct fd_formb *finfo = NULL; size_t fdblk; bp = fdc->bp; if (bp == NULL) { - bp = bufq_first(&fdc->head); + bp = bioq_first(&fdc->head); if (bp != NULL) { - bufq_remove(&fdc->head, bp); + bioq_remove(&fdc->head, bp); fdc->bp = bp; } } @@ -1674,24 +1673,24 @@ fdstate(fdc_p fdc) TRACE1("[fdc%d IDLE]", fdc->fdcu); return (0); } - fdu = FDUNIT(minor(bp->b_dev)); + fdu = FDUNIT(minor(bp->bio_dev)); fd = devclass_get_softc(fd_devclass, fdu); fdblk = 128 << fd->ft->secsize; if (fdc->fd && (fd != fdc->fd)) device_printf(fd->dev, "confused fd pointers\n"); - read = bp->b_iocmd == BIO_READ; + read = bp->bio_cmd == BIO_READ; if (read) idf = ISADMA_READ; else idf = ISADMA_WRITE; - format = bp->b_flags & B_FORMAT; + format = bp->bio_cmd & BIO_FORMAT; if (format) { - finfo = (struct fd_formb *)bp->b_data; + finfo = (struct fd_formb *)bp->bio_data; fd->skip = (char *)&(finfo->fd_formb_cylno(0)) - (char *)finfo; } if (fdc->state == DOSEEK || fdc->state == SEEKCOMPLETE) { - blknum = (unsigned) bp->b_pblkno * DEV_BSIZE/fdblk + + blknum = (unsigned) bp->bio_pblkno * DEV_BSIZE/fdblk + fd->skip/fdblk; b_cylinder = blknum / (fd->ft->sectrac * fd->ft->heads); } @@ -1830,8 +1829,8 @@ fdstate(fdc_p fdc) fd->track = b_cylinder; if (!(fdc->flags & FDC_NODMA)) - isa_dmastart(idf, bp->b_data+fd->skip, - format ? bp->b_bcount : fdblk, fdc->dmachan); + isa_dmastart(idf, bp->bio_data+fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); sectrac = fd->ft->sectrac; sec = blknum % (sectrac * fd->ft->heads); head = sec / sectrac; @@ -1846,8 +1845,8 @@ fdstate(fdc_p fdc) /* stuck controller? */ if (!(fdc->flags & FDC_NODMA)) isa_dmadone(idf, - bp->b_data + fd->skip, - format ? bp->b_bcount : fdblk, + bp->bio_data + fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); fdc->retry = 6; /* reset the beast */ return (retrier(fdc)); @@ -1887,11 +1886,11 @@ fdstate(fdc_p fdc) * * Umpf. */ - SET_BCDR(fdc, 1, bp->b_bcount, 0); + SET_BCDR(fdc, 1, bp->bio_bcount, 0); - (void)fdcpio(fdc,bp->b_iocmd, - bp->b_data+fd->skip, - bp->b_bcount); + (void)fdcpio(fdc,bp->bio_cmd, + bp->bio_data+fd->skip, + bp->bio_bcount); } /* formatting */ @@ -1903,8 +1902,8 @@ fdstate(fdc_p fdc) /* controller fell over */ if (!(fdc->flags & FDC_NODMA)) isa_dmadone(idf, - bp->b_data + fd->skip, - format ? bp->b_bcount : fdblk, + bp->bio_data + fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); fdc->retry = 6; return (retrier(fdc)); @@ -1922,8 +1921,8 @@ fdstate(fdc_p fdc) * the WRITE command is sent */ if (!read) - (void)fdcpio(fdc,bp->b_iocmd, - bp->b_data+fd->skip, + (void)fdcpio(fdc,bp->bio_cmd, + bp->bio_data+fd->skip, fdblk); } if (fd_cmd(fdc, 9, @@ -1940,8 +1939,8 @@ fdstate(fdc_p fdc) /* the beast is sleeping again */ if (!(fdc->flags & FDC_NODMA)) isa_dmadone(idf, - bp->b_data + fd->skip, - format ? bp->b_bcount : fdblk, + bp->bio_data + fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); fdc->retry = 6; return (retrier(fdc)); @@ -1952,8 +1951,8 @@ fdstate(fdc_p fdc) * if this is a read, then simply await interrupt * before performing PIO */ - if (read && !fdcpio(fdc,bp->b_iocmd, - bp->b_data+fd->skip,fdblk)) { + if (read && !fdcpio(fdc,bp->bio_cmd, + bp->bio_data+fd->skip,fdblk)) { fd->tohandle = timeout(fd_iotimeout, fdc, hz); return(0); /* will return later */ }; @@ -1970,7 +1969,7 @@ fdstate(fdc_p fdc) * actually perform the PIO read. The IOCOMPLETE case * removes the timeout for us. */ - (void)fdcpio(fdc,bp->b_iocmd,bp->b_data+fd->skip,fdblk); + (void)fdcpio(fdc,bp->bio_cmd,bp->bio_data+fd->skip,fdblk); fdc->state = IOCOMPLETE; /* FALLTHROUGH */ case IOCOMPLETE: /* IO DONE, post-analyze */ @@ -1978,8 +1977,8 @@ fdstate(fdc_p fdc) if (fd_read_status(fdc, fd->fdsu)) { if (!(fdc->flags & FDC_NODMA)) - isa_dmadone(idf, bp->b_data + fd->skip, - format ? bp->b_bcount : fdblk, + isa_dmadone(idf, bp->bio_data + fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); if (fdc->retry < 6) fdc->retry = 6; /* force a reset */ @@ -1992,8 +1991,8 @@ fdstate(fdc_p fdc) case IOTIMEDOUT: if (!(fdc->flags & FDC_NODMA)) - isa_dmadone(idf, bp->b_data + fd->skip, - format ? bp->b_bcount : fdblk, fdc->dmachan); + isa_dmadone(idf, bp->bio_data + fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); if (fdc->status[0] & NE7_ST0_IC) { if ((fdc->status[0] & NE7_ST0_IC) == NE7_ST0_IC_AT && fdc->status[1] & NE7_ST1_OR) { @@ -2018,7 +2017,7 @@ fdstate(fdc_p fdc) } /* All OK */ fd->skip += fdblk; - if (!format && fd->skip < bp->b_bcount - bp->b_resid) { + if (!format && fd->skip < bp->bio_bcount - bp->bio_resid) { /* set up next transfer */ fdc->state = DOSEEK; } else { @@ -2026,7 +2025,7 @@ fdstate(fdc_p fdc) fd->skip = 0; fdc->bp = NULL; device_unbusy(fd->dev); - devstat_end_transaction_buf(&fd->device_stats, bp); + devstat_end_transaction_bio(&fd->device_stats, bp); biodone(bp); fdc->fd = (fd_p) 0; fdc->fdu = -1; @@ -2137,14 +2136,14 @@ fdstate(fdc_p fdc) static int retrier(struct fdc_data *fdc) { - register struct buf *bp; + struct bio *bp; struct fd_data *fd; int fdu; bp = fdc->bp; /* XXX shouldn't this be cached somewhere? */ - fdu = FDUNIT(minor(bp->b_dev)); + fdu = FDUNIT(minor(bp->bio_dev)); fd = devclass_get_softc(fd_devclass, fdu); if (fd->options & FDOPT_NORETRY) goto fail; @@ -2164,14 +2163,14 @@ retrier(struct fdc_data *fdc) default: fail: { - dev_t sav_b_dev = bp->b_dev; + dev_t sav_bio_dev = bp->bio_dev; /* Trick diskerr */ - bp->b_dev = makedev(major(bp->b_dev), - (FDUNIT(minor(bp->b_dev))<<3)|RAW_PART); + bp->bio_dev = makedev(major(bp->bio_dev), + (FDUNIT(minor(bp->bio_dev))<<3)|RAW_PART); diskerr(bp, "hard error", LOG_PRINTF, fdc->fd->skip / DEV_BSIZE, (struct disklabel *)NULL); - bp->b_dev = sav_b_dev; + bp->bio_dev = sav_bio_dev; if (fdc->flags & FDC_STAT_VALID) { printf( @@ -2185,13 +2184,13 @@ retrier(struct fdc_data *fdc) else printf(" (No status)\n"); } - bp->b_ioflags |= BIO_ERROR; - bp->b_error = EIO; - bp->b_resid += bp->b_bcount - fdc->fd->skip; + bp->bio_flags |= BIO_ERROR; + bp->bio_error = EIO; + bp->bio_resid += bp->bio_bcount - fdc->fd->skip; fdc->bp = NULL; fdc->fd->skip = 0; device_unbusy(fd->dev); - devstat_end_transaction_buf(&fdc->fd->device_stats, bp); + devstat_end_transaction_bio(&fdc->fd->device_stats, bp); biodone(bp); fdc->state = FINDWORK; fdc->flags |= FDC_NEEDS_RESET; @@ -2231,8 +2230,8 @@ fdformat(dev, finfo, p) bzero((void *)bp, sizeof(struct buf)); BUF_LOCKINIT(bp); BUF_LOCK(bp, LK_EXCLUSIVE); - bp->b_flags = B_PHYS | B_FORMAT; - bp->b_iocmd = BIO_WRITE; + bp->b_flags = B_PHYS; + bp->b_iocmd = BIO_FORMAT; /* * calculate a fake blkno, so fdstrategy() would initiate a @@ -2261,7 +2260,7 @@ fdformat(dev, finfo, p) /* timed out */ rv = EIO; device_unbusy(fd->dev); - biodone(bp); + biodone(&bp->b_io); /* XXX: HUH ? */ } if (bp->b_ioflags & BIO_ERROR) rv = bp->b_error; diff --git a/sys/isa/fdc.h b/sys/isa/fdc.h index 334113d..90ec8da 100644 --- a/sys/isa/fdc.h +++ b/sys/isa/fdc.h @@ -64,8 +64,8 @@ struct fdc_data u_int status[7]; /* copy of the registers */ enum fdc_type fdct; /* chip version of FDC */ int fdc_errs; /* number of logged errors */ - struct buf_queue_head head; - struct buf *bp; /* active buffer */ + struct bio_queue_head head; + struct bio *bp; /* active buffer */ struct resource *res_ioport, *res_ctl, *res_irq, *res_drq; int rid_ioport, rid_ctl, rid_irq, rid_drq; int port_off; diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c index 355a6a53..c685aa0 100644 --- a/sys/isofs/cd9660/cd9660_vnops.c +++ b/sys/isofs/cd9660/cd9660_vnops.c @@ -759,14 +759,14 @@ cd9660_strategy(ap) VOP_BMAP(vp, bp->b_lblkno, NULL, &bp->b_blkno, NULL, NULL))) { bp->b_error = error; bp->b_ioflags |= BIO_ERROR; - biodone(bp); + bufdone(bp); return (error); } if ((long)bp->b_blkno == -1) clrbuf(bp); } if ((long)bp->b_blkno == -1) { - biodone(bp); + bufdone(bp); return (0); } vp = ip->i_devvp; diff --git a/sys/kern/subr_disk.c b/sys/kern/subr_disk.c index 6d812e5..0838056 100644 --- a/sys/kern/subr_disk.c +++ b/sys/kern/subr_disk.c @@ -173,25 +173,25 @@ diskclose(dev_t dev, int fflag, int devtype, struct proc *p) } static void -diskstrategy(struct buf *bp) +diskstrategy(struct bio *bp) { dev_t pdev; struct disk *dp; - dp = bp->b_dev->si_disk; + dp = bp->bio_dev->si_disk; if (!dp) { - pdev = dkmodpart(dkmodslice(bp->b_dev, WHOLE_DISK_SLICE), RAW_PART); - dp = bp->b_dev->si_disk = pdev->si_disk; - bp->b_dev->si_drv1 = pdev->si_drv1; - bp->b_dev->si_drv2 = pdev->si_drv2; - bp->b_dev->si_iosize_max = pdev->si_iosize_max; - bp->b_dev->si_bsize_phys = pdev->si_bsize_phys; - bp->b_dev->si_bsize_best = pdev->si_bsize_best; + pdev = dkmodpart(dkmodslice(bp->bio_dev, WHOLE_DISK_SLICE), RAW_PART); + dp = bp->bio_dev->si_disk = pdev->si_disk; + bp->bio_dev->si_drv1 = pdev->si_drv1; + bp->bio_dev->si_drv2 = pdev->si_drv2; + bp->bio_dev->si_iosize_max = pdev->si_iosize_max; + bp->bio_dev->si_bsize_phys = pdev->si_bsize_phys; + bp->bio_dev->si_bsize_best = pdev->si_bsize_best; } if (!dp) { - bp->b_error = ENXIO; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = ENXIO; + bp->bio_flags |= BIO_ERROR; biodone(bp); return; } diff --git a/sys/kern/subr_disklabel.c b/sys/kern/subr_disklabel.c index 551652f..8a1fc0b 100644 --- a/sys/kern/subr_disklabel.c +++ b/sys/kern/subr_disklabel.c @@ -453,14 +453,14 @@ hp0g: hard error reading fsbn 12345 of 12344-12347 (hp0 bn %d cn %d tn %d sn %d) */ void diskerr(bp, what, pri, blkdone, lp) - register struct buf *bp; + struct bio *bp; char *what; int pri, blkdone; register struct disklabel *lp; { - int unit = dkunit(bp->b_dev); - int slice = dkslice(bp->b_dev); - int part = dkpart(bp->b_dev); + int unit = dkunit(bp->bio_dev); + int slice = dkslice(bp->bio_dev); + int part = dkpart(bp->bio_dev); register int (*pr) __P((const char *, ...)); char partname[2]; char *sname; @@ -471,21 +471,21 @@ diskerr(bp, what, pri, blkdone, lp) pr = addlog; } else pr = printf; - sname = dsname(bp->b_dev, unit, slice, part, partname); + sname = dsname(bp->bio_dev, unit, slice, part, partname); (*pr)("%s%s: %s %sing fsbn ", sname, partname, what, - bp->b_iocmd == BIO_READ ? "read" : "writ"); - sn = bp->b_blkno; - if (bp->b_bcount <= DEV_BSIZE) + bp->bio_cmd == BIO_READ ? "read" : "writ"); + sn = bp->bio_blkno; + if (bp->bio_bcount <= DEV_BSIZE) (*pr)("%ld", (long)sn); else { if (blkdone >= 0) { sn += blkdone; (*pr)("%ld of ", (long)sn); } - (*pr)("%ld-%ld", (long)bp->b_blkno, - (long)(bp->b_blkno + (bp->b_bcount - 1) / DEV_BSIZE)); + (*pr)("%ld-%ld", (long)bp->bio_blkno, + (long)(bp->bio_blkno + (bp->bio_bcount - 1) / DEV_BSIZE)); } - if (lp && (blkdone >= 0 || bp->b_bcount <= lp->d_secsize)) { + if (lp && (blkdone >= 0 || bp->bio_bcount <= lp->d_secsize)) { #ifdef tahoe sn *= DEV_BSIZE / lp->d_secsize; /* XXX */ #endif diff --git a/sys/kern/subr_diskmbr.c b/sys/kern/subr_diskmbr.c index f9e2eba..0d63747 100644 --- a/sys/kern/subr_diskmbr.c +++ b/sys/kern/subr_diskmbr.c @@ -190,7 +190,7 @@ reread_mbr: bp->b_iocmd = BIO_READ; DEV_STRATEGY(bp, 1); if (biowait(bp) != 0) { - diskerr(bp, "reading primary partition table: error", + diskerr(&bp->b_io, "reading primary partition table: error", LOG_PRINTF, 0, (struct disklabel *)NULL); printf("\n"); error = EIO; @@ -406,7 +406,7 @@ mbr_extended(dev, lp, ssp, ext_offset, ext_size, base_ext_offset, nsectors, bp->b_iocmd = BIO_READ; DEV_STRATEGY(bp, 1); if (biowait(bp) != 0) { - diskerr(bp, "reading extended partition table: error", + diskerr(&bp->b_io, "reading extended partition table: error", LOG_PRINTF, 0, (struct disklabel *)NULL); printf("\n"); goto done; diff --git a/sys/kern/subr_diskslice.c b/sys/kern/subr_diskslice.c index fda1901..361bbdb 100644 --- a/sys/kern/subr_diskslice.c +++ b/sys/kern/subr_diskslice.c @@ -146,7 +146,7 @@ clone_label(lp) */ int dscheck(bp, ssp) - struct buf *bp; + struct bio *bp; struct diskslices *ssp; { daddr_t blkno; @@ -161,34 +161,34 @@ dscheck(bp, ssp) struct diskslice *sp; int s; - blkno = bp->b_blkno; + blkno = bp->bio_blkno; if (blkno < 0) { - printf("dscheck(%s): negative b_blkno %ld\n", - devtoname(bp->b_dev), (long)blkno); - bp->b_error = EINVAL; + printf("dscheck(%s): negative bio_blkno %ld\n", + devtoname(bp->bio_dev), (long)blkno); + bp->bio_error = EINVAL; goto bad; } - sp = &ssp->dss_slices[dkslice(bp->b_dev)]; + sp = &ssp->dss_slices[dkslice(bp->bio_dev)]; lp = sp->ds_label; if (ssp->dss_secmult == 1) { - if (bp->b_bcount % (u_long)DEV_BSIZE) + if (bp->bio_bcount % (u_long)DEV_BSIZE) goto bad_bcount; secno = blkno; - nsec = bp->b_bcount >> DEV_BSHIFT; + nsec = bp->bio_bcount >> DEV_BSHIFT; } else if (ssp->dss_secshift != -1) { - if (bp->b_bcount & (ssp->dss_secsize - 1)) + if (bp->bio_bcount & (ssp->dss_secsize - 1)) goto bad_bcount; if (blkno & (ssp->dss_secmult - 1)) goto bad_blkno; secno = blkno >> ssp->dss_secshift; - nsec = bp->b_bcount >> (DEV_BSHIFT + ssp->dss_secshift); + nsec = bp->bio_bcount >> (DEV_BSHIFT + ssp->dss_secshift); } else { - if (bp->b_bcount % ssp->dss_secsize) + if (bp->bio_bcount % ssp->dss_secsize) goto bad_bcount; if (blkno % ssp->dss_secmult) goto bad_blkno; secno = blkno / ssp->dss_secmult; - nsec = bp->b_bcount / ssp->dss_secsize; + nsec = bp->bio_bcount / ssp->dss_secsize; } if (lp == NULL) { labelsect = -LABELSECTOR - 1; @@ -197,7 +197,7 @@ dscheck(bp, ssp) } else { labelsect = lp->d_partitions[LABEL_PART].p_offset; if (labelsect != 0) Debugger("labelsect != 0 in dscheck()"); - pp = &lp->d_partitions[dkpart(bp->b_dev)]; + pp = &lp->d_partitions[dkpart(bp->bio_dev)]; endsecno = pp->p_size; slicerel_secno = pp->p_offset + secno; } @@ -208,16 +208,16 @@ if (labelsect != 0) Debugger("labelsect != 0 in dscheck()"); #if LABELSECTOR != 0 slicerel_secno + nsec > LABELSECTOR + labelsect && #endif - (bp->b_iocmd == BIO_WRITE) && sp->ds_wlabel == 0) { - bp->b_error = EROFS; + (bp->bio_cmd == BIO_WRITE) && sp->ds_wlabel == 0) { + bp->bio_error = EROFS; goto bad; } #if defined(DOSBBSECTOR) && defined(notyet) /* overwriting master boot record? */ - if (slicerel_secno <= DOSBBSECTOR && (bp->b_iocmd == BIO_WRITE) && + if (slicerel_secno <= DOSBBSECTOR && (bp->bio_cmd == BIO_WRITE) && sp->ds_wlabel == 0) { - bp->b_error = EROFS; + bp->bio_error = EROFS; goto bad; } #endif @@ -226,19 +226,19 @@ if (labelsect != 0) Debugger("labelsect != 0 in dscheck()"); if (secno + nsec > endsecno) { /* if exactly at end of disk, return an EOF */ if (secno == endsecno) { - bp->b_resid = bp->b_bcount; + bp->bio_resid = bp->bio_bcount; return (0); } /* or truncate if part of it fits */ nsec = endsecno - secno; if (nsec <= 0) { - bp->b_error = EINVAL; + bp->bio_error = EINVAL; goto bad; } - bp->b_bcount = nsec * ssp->dss_secsize; + bp->bio_bcount = nsec * ssp->dss_secsize; } - bp->b_pblkno = sp->ds_offset + slicerel_secno; + bp->bio_pblkno = sp->ds_offset + slicerel_secno; /* * Snoop on label accesses if the slice offset is nonzero. Fudge @@ -253,15 +253,15 @@ if (labelsect != 0) Debugger("labelsect != 0 in dscheck()"); struct iodone_chain *ic; ic = malloc(sizeof *ic , M_DEVBUF, M_WAITOK); - ic->ic_prev_flags = bp->b_flags; - ic->ic_prev_iodone = bp->b_iodone; - ic->ic_prev_iodone_chain = bp->b_iodone_chain; + ic->ic_prev_flags = bp->bio_flags; + ic->ic_prev_iodone = bp->bio_done; + ic->ic_prev_iodone_chain = bp->bio_done_chain; ic->ic_args[0].ia_long = (LABELSECTOR + labelsect - slicerel_secno) * ssp->dss_secsize; ic->ic_args[1].ia_ptr = sp; - bp->b_iodone = dsiodone; - bp->b_iodone_chain = ic; - if (!(bp->b_iocmd == BIO_READ)) { + bp->bio_done = dsiodone; + bp->bio_done_chain = ic; + if (!(bp->bio_cmd == BIO_READ)) { /* * XXX even disklabel(8) writes directly so we need * to adjust writes. Perhaps we should drop support @@ -271,20 +271,22 @@ if (labelsect != 0) Debugger("labelsect != 0 in dscheck()"); * XXX probably need to copy the data to avoid even * temporarily corrupting the in-core copy. */ +#ifdef notyet if (bp->b_vp != NULL) { s = splbio(); bp->b_vp->v_numoutput++; splx(s); } +#endif /* XXX need name here. */ msg = fixlabel((char *)NULL, sp, (struct disklabel *) - (bp->b_data + ic->ic_args[0].ia_long), + (bp->bio_data + ic->ic_args[0].ia_long), TRUE); if (msg != NULL) { printf("dscheck(%s): %s\n", - devtoname(bp->b_dev), msg); - bp->b_error = EROFS; + devtoname(bp->bio_dev), msg); + bp->bio_error = EROFS; goto bad; } } @@ -293,21 +295,21 @@ if (labelsect != 0) Debugger("labelsect != 0 in dscheck()"); bad_bcount: printf( - "dscheck(%s): b_bcount %ld is not on a sector boundary (ssize %d)\n", - devtoname(bp->b_dev), bp->b_bcount, ssp->dss_secsize); - bp->b_error = EINVAL; + "dscheck(%s): bio_bcount %ld is not on a sector boundary (ssize %d)\n", + devtoname(bp->bio_dev), bp->bio_bcount, ssp->dss_secsize); + bp->bio_error = EINVAL; goto bad; bad_blkno: printf( - "dscheck(%s): b_blkno %ld is not on a sector boundary (ssize %d)\n", - devtoname(bp->b_dev), (long)blkno, ssp->dss_secsize); - bp->b_error = EINVAL; + "dscheck(%s): bio_blkno %ld is not on a sector boundary (ssize %d)\n", + devtoname(bp->bio_dev), (long)blkno, ssp->dss_secsize); + bp->bio_error = EINVAL; goto bad; bad: - bp->b_resid = bp->b_bcount; - bp->b_ioflags |= BIO_ERROR; + bp->bio_resid = bp->bio_bcount; + bp->bio_flags |= BIO_ERROR; return (-1); } @@ -549,7 +551,7 @@ dsiodone(bp) printf("%s\n", msg); } free(ic, M_DEVBUF); - biodone(bp); + biodone((struct bio *)bp); /* XXX */ } int diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index be40650..222a644 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -703,7 +703,7 @@ vfs_backgroundwritedone(bp) bp->b_iocmd = BIO_READ; bp->b_flags &= ~(B_CACHE | B_DONE); bp->b_iodone = 0; - biodone(bp); + bufdone(bp); } /* @@ -2627,7 +2627,13 @@ biowait(register struct buf * bp) * in the biodone routine. */ void -biodone(register struct buf * bp) +biodone(struct bio * bip) +{ + bufdone((struct buf *)bip); +} + +void +bufdone(struct buf *bp) { int s; void (*biodone) __P((struct buf *)); diff --git a/sys/kern/vfs_cluster.c b/sys/kern/vfs_cluster.c index 44ac985..a19367a 100644 --- a/sys/kern/vfs_cluster.c +++ b/sys/kern/vfs_cluster.c @@ -489,7 +489,7 @@ cluster_callback(bp) tbp->b_flags &= ~B_INVAL; tbp->b_ioflags &= ~BIO_ERROR; } - biodone(tbp); + bufdone(tbp); } relpbuf(bp, &cluster_pbuf_freecnt); } diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 71504a5..b362ff1 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -167,7 +167,7 @@ vop_nostrategy (struct vop_strategy_args *ap) vprint("", ap->a_bp->b_vp); ap->a_bp->b_ioflags |= BIO_ERROR; ap->a_bp->b_error = EOPNOTSUPP; - biodone(ap->a_bp); + bufdone(ap->a_bp); return (EOPNOTSUPP); } diff --git a/sys/miscfs/devfs/devfs_vnops.c b/sys/miscfs/devfs/devfs_vnops.c index 5af57ae..3ec62f8 100644 --- a/sys/miscfs/devfs/devfs_vnops.c +++ b/sys/miscfs/devfs/devfs_vnops.c @@ -1551,7 +1551,7 @@ devfs_inactive(struct vop_inactive_args *ap) * Just call the device strategy routine struct vop_strategy_args { struct vnode *a_vp; - struct buf *a_bp; + struct bio *a_bp; } */ static int @@ -1574,10 +1574,10 @@ devfs_strategy(struct vop_strategy_args *ap) (*bioops.io_start)(bp); switch (vp->v_type) { case VCHR: - (*vp->v_rdev->si_devsw->d_strategy)(bp); + (*vp->v_rdev->si_devsw->d_strategy)(&bp->b_io); break; case VBLK: - (*vp->v_rdev->si_devsw->d_strategy)(bp); + (*vp->v_rdev->si_devsw->d_strategy)(&bp->b_io); break; default: /* XXX set error code? */ diff --git a/sys/msdosfs/msdosfs_vnops.c b/sys/msdosfs/msdosfs_vnops.c index ad0852e..24180440 100644 --- a/sys/msdosfs/msdosfs_vnops.c +++ b/sys/msdosfs/msdosfs_vnops.c @@ -1839,14 +1839,14 @@ msdosfs_strategy(ap) if (error) { bp->b_error = error; bp->b_ioflags |= BIO_ERROR; - biodone(bp); + bufdone(bp); return (error); } if ((long)bp->b_blkno == -1) vfs_bio_clrbuf(bp); } if (bp->b_blkno == -1) { - biodone(bp); + bufdone(bp); return (0); } /* diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c index 58fc691..6923feb 100644 --- a/sys/nfs/nfs_bio.c +++ b/sys/nfs/nfs_bio.c @@ -1491,7 +1491,7 @@ nfs_doio(bp, cr, p) bp->b_dirtyoff = bp->b_dirtyend = 0; bp->b_flags &= ~(B_NEEDCOMMIT | B_CLUSTEROK); bp->b_resid = 0; - biodone(bp); + bufdone(bp); return (0); } if (retv == NFSERR_STALEWRITEVERF) { @@ -1587,13 +1587,13 @@ nfs_doio(bp, cr, p) } } else { bp->b_resid = 0; - biodone(bp); + bufdone(bp); return (0); } } bp->b_resid = uiop->uio_resid; if (must_commit) nfs_clearcommit(vp->v_mount); - biodone(bp); + bufdone(bp); return (error); } diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index a331854..cae2265 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -2943,7 +2943,7 @@ again: bp->b_ioflags &= ~BIO_ERROR; bp->b_dirtyoff = bp->b_dirtyend = 0; splx(s); - biodone(bp); + bufdone(bp); } } } diff --git a/sys/nfsclient/nfs_bio.c b/sys/nfsclient/nfs_bio.c index 58fc691..6923feb 100644 --- a/sys/nfsclient/nfs_bio.c +++ b/sys/nfsclient/nfs_bio.c @@ -1491,7 +1491,7 @@ nfs_doio(bp, cr, p) bp->b_dirtyoff = bp->b_dirtyend = 0; bp->b_flags &= ~(B_NEEDCOMMIT | B_CLUSTEROK); bp->b_resid = 0; - biodone(bp); + bufdone(bp); return (0); } if (retv == NFSERR_STALEWRITEVERF) { @@ -1587,13 +1587,13 @@ nfs_doio(bp, cr, p) } } else { bp->b_resid = 0; - biodone(bp); + bufdone(bp); return (0); } } bp->b_resid = uiop->uio_resid; if (must_commit) nfs_clearcommit(vp->v_mount); - biodone(bp); + bufdone(bp); return (error); } diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index a331854..cae2265 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -2943,7 +2943,7 @@ again: bp->b_ioflags &= ~BIO_ERROR; bp->b_dirtyoff = bp->b_dirtyend = 0; splx(s); - biodone(bp); + bufdone(bp); } } } diff --git a/sys/ntfs/ntfs_vnops.c b/sys/ntfs/ntfs_vnops.c index fc8f04e..fdb555f 100644 --- a/sys/ntfs/ntfs_vnops.c +++ b/sys/ntfs/ntfs_vnops.c @@ -394,7 +394,7 @@ ntfs_strategy(ap) } } } - biodone(bp); + bufdone(bp); return (error); } diff --git a/sys/nwfs/nwfs_io.c b/sys/nwfs/nwfs_io.c index ab24a29..2cf3e49 100644 --- a/sys/nwfs/nwfs_io.c +++ b/sys/nwfs/nwfs_io.c @@ -365,12 +365,12 @@ nwfs_doio(bp, cr, p) } } else { bp->b_resid = 0; - biodone(bp); + bufdone(bp); return (0); } } bp->b_resid = uiop->uio_resid; - biodone(bp); + bufdone(bp); return (error); } diff --git a/sys/pc98/cbus/fdc.c b/sys/pc98/cbus/fdc.c index aed6c6f..daec257c 100644 --- a/sys/pc98/cbus/fdc.c +++ b/sys/pc98/cbus/fdc.c @@ -91,9 +91,6 @@ #include #endif -/* misuse a flag to identify format operation */ -#define B_FORMAT B_XXX - /* configuration flags */ #define FDC_PRETEND_D0 (1 << 0) /* pretend drive 0 to be there */ #define FDC_NO_FIFO (1 << 2) /* do not enable FIFO */ @@ -1072,7 +1069,7 @@ fdc_attach(device_t dev) /* reset controller, turn motor off, clear fdout mirror reg */ fdout_wr(fdc, ((fdc->fdout = 0))); #endif - bufq_init(&fdc->head); + bioq_init(&fdc->head); /* * Probe and attach any children. We should probably detect @@ -1774,7 +1771,7 @@ fdclose(dev_t dev, int flags, int mode, struct proc *p) /* fdstrategy */ /****************************************************************************/ void -fdstrategy(struct buf *bp) +fdstrategy(struct bio *bp) { unsigned nblocks, blknum, cando; int s; @@ -1783,31 +1780,31 @@ fdstrategy(struct buf *bp) fd_p fd; size_t fdblk; - fdu = FDUNIT(minor(bp->b_dev)); + fdu = FDUNIT(minor(bp->bio_dev)); fd = devclass_get_softc(fd_devclass, fdu); if (fd == 0) panic("fdstrategy: buf for nonexistent device (%#lx, %#lx)", - (u_long)major(bp->b_dev), (u_long)minor(bp->b_dev)); + (u_long)major(bp->bio_dev), (u_long)minor(bp->bio_dev)); fdc = fd->fdc; if (fd->type == NO_TYPE) { - bp->b_error = ENXIO; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = ENXIO; + bp->bio_flags |= BIO_ERROR; goto bad; }; fdblk = 128 << (fd->ft->secsize); - if (!(bp->b_flags & B_FORMAT)) { - if (bp->b_blkno < 0) { + if (!(bp->bio_cmd & BIO_FORMAT)) { + if (bp->bio_blkno < 0) { printf( "fd%d: fdstrat: bad request blkno = %lu, bcount = %ld\n", - fdu, (u_long)bp->b_blkno, bp->b_bcount); - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + fdu, (u_long)bp->bio_blkno, bp->bio_bcount); + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } - if ((bp->b_bcount % fdblk) != 0) { - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + if ((bp->bio_bcount % fdblk) != 0) { + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } } @@ -1815,33 +1812,33 @@ fdstrategy(struct buf *bp) /* * Set up block calculations. */ - if (bp->b_blkno > 20000000) { + if (bp->bio_blkno > 20000000) { /* * Reject unreasonably high block number, prevent the * multiplication below from overflowing. */ - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } - blknum = (unsigned) bp->b_blkno * DEV_BSIZE/fdblk; + blknum = (unsigned) bp->bio_blkno * DEV_BSIZE/fdblk; nblocks = fd->ft->size; - bp->b_resid = 0; - if (blknum + (bp->b_bcount / fdblk) > nblocks) { + bp->bio_resid = 0; + if (blknum + (bp->bio_bcount / fdblk) > nblocks) { if (blknum <= nblocks) { cando = (nblocks - blknum) * fdblk; - bp->b_resid = bp->b_bcount - cando; + bp->bio_resid = bp->bio_bcount - cando; if (cando == 0) goto bad; /* not actually bad but EOF */ } else { - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } } - bp->b_pblkno = bp->b_blkno; + bp->bio_pblkno = bp->bio_blkno; s = splbio(); - bufqdisksort(&fdc->head, bp); + bioqdisksort(&fdc->head, bp); untimeout(fd_turnoff, fd, fd->toffhandle); /* a good idea */ /* Tell devstat we are starting on the transaction */ @@ -1974,15 +1971,15 @@ fdstate(fdc_p fdc) unsigned blknum = 0, b_cylinder = 0; fdu_t fdu = fdc->fdu; fd_p fd; - register struct buf *bp; + register struct bio *bp; struct fd_formb *finfo = NULL; size_t fdblk; bp = fdc->bp; if (bp == NULL) { - bp = bufq_first(&fdc->head); + bp = bioq_first(&fdc->head); if (bp != NULL) { - bufq_remove(&fdc->head, bp); + bioq_remove(&fdc->head, bp); fdc->bp = bp; } } @@ -2001,24 +1998,24 @@ fdstate(fdc_p fdc) TRACE1("[fdc%d IDLE]", fdc->fdcu); return (0); } - fdu = FDUNIT(minor(bp->b_dev)); + fdu = FDUNIT(minor(bp->bio_dev)); fd = devclass_get_softc(fd_devclass, fdu); fdblk = 128 << fd->ft->secsize; if (fdc->fd && (fd != fdc->fd)) device_printf(fd->dev, "confused fd pointers\n"); - read = bp->b_iocmd == BIO_READ; + read = bp->bio_cmd == BIO_READ; if (read) idf = ISADMA_READ; else idf = ISADMA_WRITE; - format = bp->b_flags & B_FORMAT; + format = bp->bio_cmd & BIO_FORMAT; if (format) { - finfo = (struct fd_formb *)bp->b_data; + finfo = (struct fd_formb *)bp->bio_data; fd->skip = (char *)&(finfo->fd_formb_cylno(0)) - (char *)finfo; } if (fdc->state == DOSEEK || fdc->state == SEEKCOMPLETE) { - blknum = (unsigned) bp->b_pblkno * DEV_BSIZE/fdblk + + blknum = (unsigned) bp->bio_pblkno * DEV_BSIZE/fdblk + fd->skip/fdblk; b_cylinder = blknum / (fd->ft->sectrac * fd->ft->heads); } @@ -2205,8 +2202,8 @@ fdstate(fdc_p fdc) if (fdu != nrdu) { #endif /* EPSON_NRDISK */ if (!(fdc->flags & FDC_NODMA)) - isa_dmastart(idf, bp->b_data+fd->skip, - format ? bp->b_bcount : fdblk, fdc->dmachan); + isa_dmastart(idf, bp->bio_data+fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); sectrac = fd->ft->sectrac; sec = blknum % (sectrac * fd->ft->heads); head = sec / sectrac; @@ -2221,8 +2218,8 @@ fdstate(fdc_p fdc) /* stuck controller? */ if (!(fdc->flags & FDC_NODMA)) isa_dmadone(idf, - bp->b_data + fd->skip, - format ? bp->b_bcount : fdblk, + bp->bio_data + fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); fdc->retry = 6; /* reset the beast */ return (retrier(fdc)); @@ -2262,11 +2259,11 @@ fdstate(fdc_p fdc) * * Umpf. */ - SET_BCDR(fdc, 1, bp->b_bcount, 0); + SET_BCDR(fdc, 1, bp->bio_bcount, 0); - (void)fdcpio(fdc,bp->b_iocmd, - bp->b_data+fd->skip, - bp->b_bcount); + (void)fdcpio(fdc,bp->bio_cmd, + bp->bio_data+fd->skip, + bp->bio_bcount); } /* formatting */ @@ -2278,8 +2275,8 @@ fdstate(fdc_p fdc) /* controller fell over */ if (!(fdc->flags & FDC_NODMA)) isa_dmadone(idf, - bp->b_data + fd->skip, - format ? bp->b_bcount : fdblk, + bp->bio_data + fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); fdc->retry = 6; return (retrier(fdc)); @@ -2297,8 +2294,8 @@ fdstate(fdc_p fdc) * the WRITE command is sent */ if (!read) - (void)fdcpio(fdc,bp->b_iocmd, - bp->b_data+fd->skip, + (void)fdcpio(fdc,bp->bio_cmd, + bp->bio_data+fd->skip, fdblk); } if (fd_cmd(fdc, 9, @@ -2315,8 +2312,8 @@ fdstate(fdc_p fdc) /* the beast is sleeping again */ if (!(fdc->flags & FDC_NODMA)) isa_dmadone(idf, - bp->b_data + fd->skip, - format ? bp->b_bcount : fdblk, + bp->bio_data + fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); fdc->retry = 6; return (retrier(fdc)); @@ -2327,8 +2324,8 @@ fdstate(fdc_p fdc) * if this is a read, then simply await interrupt * before performing PIO */ - if (read && !fdcpio(fdc,bp->b_iocmd, - bp->b_data+fd->skip,fdblk)) { + if (read && !fdcpio(fdc,bp->bio_cmd, + bp->bio_data+fd->skip,fdblk)) { fd->tohandle = timeout(fd_iotimeout, fdc, hz); return(0); /* will return later */ }; @@ -2349,11 +2346,11 @@ fdstate(fdc_p fdc) nrd_addrset(fdblk * nrdblkn); while (!nrd_check_ready()) DELAY(1); if (read) epson_insw(P_NRD_DATA, - bp->b_data + fd->skip, + bp->bio_data + fd->skip, fdblk / sizeof(short)); else epson_outsw(P_NRD_DATA, - bp->b_data + fd->skip, - (format ? bp->b_bcount : fdblk) + bp->bio_data + fd->skip, + (format ? bp->bio_bcount : fdblk) / sizeof(short)); blknum = (unsigned long)bp->b_blkno*DEV_BSIZE/fdblk @@ -2375,7 +2372,7 @@ fdstate(fdc_p fdc) * actually perform the PIO read. The IOCOMPLETE case * removes the timeout for us. */ - (void)fdcpio(fdc,bp->b_iocmd,bp->b_data+fd->skip,fdblk); + (void)fdcpio(fdc,bp->bio_cmd,bp->bio_data+fd->skip,fdblk); fdc->state = IOCOMPLETE; /* FALLTHROUGH */ case IOCOMPLETE: /* IO DONE, post-analyze */ @@ -2388,8 +2385,8 @@ fdstate(fdc_p fdc) if (fd_read_status(fdc, fd->fdsu)) { if (!(fdc->flags & FDC_NODMA)) - isa_dmadone(idf, bp->b_data + fd->skip, - format ? bp->b_bcount : fdblk, + isa_dmadone(idf, bp->bio_data + fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); if (fdc->retry < 6) fdc->retry = 6; /* force a reset */ @@ -2405,8 +2402,8 @@ fdstate(fdc_p fdc) if (fdu != nrdu) { #endif /* EPSON_NRDISK */ if (!(fdc->flags & FDC_NODMA)) - isa_dmadone(idf, bp->b_data + fd->skip, - format ? bp->b_bcount : fdblk, fdc->dmachan); + isa_dmadone(idf, bp->bio_data + fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); #ifdef EPSON_NRDISK } else nrd_LED_off(); @@ -2435,7 +2432,7 @@ fdstate(fdc_p fdc) } /* All OK */ fd->skip += fdblk; - if (!format && fd->skip < bp->b_bcount - bp->b_resid) { + if (!format && fd->skip < bp->bio_bcount - bp->bio_resid) { /* set up next transfer */ fdc->state = DOSEEK; } else { @@ -2443,7 +2440,7 @@ fdstate(fdc_p fdc) fd->skip = 0; fdc->bp = NULL; device_unbusy(fd->dev); - devstat_end_transaction_buf(&fd->device_stats, bp); + devstat_end_transaction_bio(&fd->device_stats, bp); biodone(bp); fdc->fd = (fd_p) 0; fdc->fdu = -1; @@ -2563,14 +2560,14 @@ fdstate(fdc_p fdc) static int retrier(struct fdc_data *fdc) { - register struct buf *bp; + register struct bio *bp; struct fd_data *fd; int fdu; bp = fdc->bp; /* XXX shouldn't this be cached somewhere? */ - fdu = FDUNIT(minor(bp->b_dev)); + fdu = FDUNIT(minor(bp->bio_dev)); fd = devclass_get_softc(fd_devclass, fdu); if (fd->options & FDOPT_NORETRY) goto fail; @@ -2590,14 +2587,14 @@ retrier(struct fdc_data *fdc) default: fail: { - dev_t sav_b_dev = bp->b_dev; + dev_t sav_b_dev = bp->bio_dev; /* Trick diskerr */ - bp->b_dev = makedev(major(bp->b_dev), - (FDUNIT(minor(bp->b_dev))<<3)|RAW_PART); + bp->bio_dev = makedev(major(bp->bio_dev), + (FDUNIT(minor(bp->bio_dev))<<3)|RAW_PART); diskerr(bp, "hard error", LOG_PRINTF, fdc->fd->skip / DEV_BSIZE, (struct disklabel *)NULL); - bp->b_dev = sav_b_dev; + bp->bio_dev = sav_b_dev; if (fdc->flags & FDC_STAT_VALID) { printf( @@ -2611,13 +2608,13 @@ retrier(struct fdc_data *fdc) else printf(" (No status)\n"); } - bp->b_ioflags |= BIO_ERROR; - bp->b_error = EIO; - bp->b_resid += bp->b_bcount - fdc->fd->skip; + bp->bio_flags |= BIO_ERROR; + bp->bio_error = EIO; + bp->bio_resid += bp->bio_bcount - fdc->fd->skip; fdc->bp = NULL; fdc->fd->skip = 0; device_unbusy(fd->dev); - devstat_end_transaction_buf(&fdc->fd->device_stats, bp); + devstat_end_transaction_bio(&fdc->fd->device_stats, bp); biodone(bp); fdc->state = FINDWORK; fdc->flags |= FDC_NEEDS_RESET; @@ -2647,7 +2644,7 @@ 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 buf *)malloc(sizeof(struct bio), M_TEMP, M_NOWAIT); if(bp == 0) return ENOBUFS; /* @@ -2657,8 +2654,8 @@ fdformat(dev, finfo, p) bzero((void *)bp, sizeof(struct buf)); BUF_LOCKINIT(bp); BUF_LOCK(bp, LK_EXCLUSIVE); - bp->b_flags = B_PHYS | B_FORMAT; - bp->b_iocmd = BIO_WRITE; + bp->b_flags = B_PHYS; + bp->b_iocmd = BIO_FORMAT; /* * calculate a fake blkno, so fdstrategy() would initiate a @@ -2687,9 +2684,9 @@ fdformat(dev, finfo, p) /* timed out */ rv = EIO; device_unbusy(fd->dev); - biodone(bp); + bufdone(bp); } - if (bp->b_ioflags & BIO_ERROR) + if (bp->b_flags & BIO_ERROR) rv = bp->b_error; /* * allow the process to be swapped diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c index 61056d0..8e253bd 100644 --- a/sys/pc98/i386/machdep.c +++ b/sys/pc98/i386/machdep.c @@ -2658,54 +2658,54 @@ Debugger(const char *msg) * if needed, and signal errors or early completion. */ int -bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel) +bounds_check_with_label(struct bio *bp, struct disklabel *lp, int wlabel) { - struct partition *p = lp->d_partitions + dkpart(bp->b_dev); + struct partition *p = lp->d_partitions + dkpart(bp->bio_dev); int labelsect = lp->d_partitions[0].p_offset; int maxsz = p->p_size, - sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT; + sz = (bp->bio_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT; /* overwriting disk label ? */ /* XXX should also protect bootstrap in first 8K */ - if (bp->b_blkno + p->p_offset <= LABELSECTOR + labelsect && + if (bp->bio_blkno + p->p_offset <= LABELSECTOR + labelsect && #if LABELSECTOR != 0 - bp->b_blkno + p->p_offset + sz > LABELSECTOR + labelsect && + bp->bio_blkno + p->p_offset + sz > LABELSECTOR + labelsect && #endif - (bp->b_iocmd == BIO_WRITE) && wlabel == 0) { - bp->b_error = EROFS; + (bp->bio_cmd == BIO_WRITE) && wlabel == 0) { + bp->bio_error = EROFS; goto bad; } #if defined(DOSBBSECTOR) && defined(notyet) /* overwriting master boot record? */ - if (bp->b_blkno + p->p_offset <= DOSBBSECTOR && - (bp->b_iocmd == BIO_WRITE) && wlabel == 0) { - bp->b_error = EROFS; + if (bp->bio_blkno + p->p_offset <= DOSBBSECTOR && + (bp->bio_cmd == BIO_WRITE) && wlabel == 0) { + bp->bio_error = EROFS; goto bad; } #endif /* beyond partition? */ - if (bp->b_blkno < 0 || bp->b_blkno + sz > maxsz) { + if (bp->bio_blkno < 0 || bp->bio_blkno + sz > maxsz) { /* if exactly at end of disk, return an EOF */ - if (bp->b_blkno == maxsz) { - bp->b_resid = bp->b_bcount; + if (bp->bio_blkno == maxsz) { + bp->bio_resid = bp->bio_bcount; return(0); } /* or truncate if part of it fits */ - sz = maxsz - bp->b_blkno; + sz = maxsz - bp->bio_blkno; if (sz <= 0) { - bp->b_error = EINVAL; + bp->bio_error = EINVAL; goto bad; } - bp->b_bcount = sz << DEV_BSHIFT; + bp->bio_bcount = sz << DEV_BSHIFT; } - bp->b_pblkno = bp->b_blkno + p->p_offset; + bp->bio_pblkno = bp->bio_blkno + p->p_offset; return(1); bad: - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; return(-1); } diff --git a/sys/pc98/pc98/diskslice_machdep.c b/sys/pc98/pc98/diskslice_machdep.c index ac66299..a829592 100644 --- a/sys/pc98/pc98/diskslice_machdep.c +++ b/sys/pc98/pc98/diskslice_machdep.c @@ -250,7 +250,7 @@ reread_mbr: #endif DEV_STRATEGY(bp, 1); if (biowait(bp) != 0) { - diskerr(bp, "reading primary partition table: error", + diskerr(&bp->b_io, "reading primary partition table: error", LOG_PRINTF, 0, (struct disklabel *)NULL); printf("\n"); error = EIO; diff --git a/sys/pc98/pc98/fd.c b/sys/pc98/pc98/fd.c index aed6c6f..daec257c 100644 --- a/sys/pc98/pc98/fd.c +++ b/sys/pc98/pc98/fd.c @@ -91,9 +91,6 @@ #include #endif -/* misuse a flag to identify format operation */ -#define B_FORMAT B_XXX - /* configuration flags */ #define FDC_PRETEND_D0 (1 << 0) /* pretend drive 0 to be there */ #define FDC_NO_FIFO (1 << 2) /* do not enable FIFO */ @@ -1072,7 +1069,7 @@ fdc_attach(device_t dev) /* reset controller, turn motor off, clear fdout mirror reg */ fdout_wr(fdc, ((fdc->fdout = 0))); #endif - bufq_init(&fdc->head); + bioq_init(&fdc->head); /* * Probe and attach any children. We should probably detect @@ -1774,7 +1771,7 @@ fdclose(dev_t dev, int flags, int mode, struct proc *p) /* fdstrategy */ /****************************************************************************/ void -fdstrategy(struct buf *bp) +fdstrategy(struct bio *bp) { unsigned nblocks, blknum, cando; int s; @@ -1783,31 +1780,31 @@ fdstrategy(struct buf *bp) fd_p fd; size_t fdblk; - fdu = FDUNIT(minor(bp->b_dev)); + fdu = FDUNIT(minor(bp->bio_dev)); fd = devclass_get_softc(fd_devclass, fdu); if (fd == 0) panic("fdstrategy: buf for nonexistent device (%#lx, %#lx)", - (u_long)major(bp->b_dev), (u_long)minor(bp->b_dev)); + (u_long)major(bp->bio_dev), (u_long)minor(bp->bio_dev)); fdc = fd->fdc; if (fd->type == NO_TYPE) { - bp->b_error = ENXIO; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = ENXIO; + bp->bio_flags |= BIO_ERROR; goto bad; }; fdblk = 128 << (fd->ft->secsize); - if (!(bp->b_flags & B_FORMAT)) { - if (bp->b_blkno < 0) { + if (!(bp->bio_cmd & BIO_FORMAT)) { + if (bp->bio_blkno < 0) { printf( "fd%d: fdstrat: bad request blkno = %lu, bcount = %ld\n", - fdu, (u_long)bp->b_blkno, bp->b_bcount); - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + fdu, (u_long)bp->bio_blkno, bp->bio_bcount); + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } - if ((bp->b_bcount % fdblk) != 0) { - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + if ((bp->bio_bcount % fdblk) != 0) { + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } } @@ -1815,33 +1812,33 @@ fdstrategy(struct buf *bp) /* * Set up block calculations. */ - if (bp->b_blkno > 20000000) { + if (bp->bio_blkno > 20000000) { /* * Reject unreasonably high block number, prevent the * multiplication below from overflowing. */ - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } - blknum = (unsigned) bp->b_blkno * DEV_BSIZE/fdblk; + blknum = (unsigned) bp->bio_blkno * DEV_BSIZE/fdblk; nblocks = fd->ft->size; - bp->b_resid = 0; - if (blknum + (bp->b_bcount / fdblk) > nblocks) { + bp->bio_resid = 0; + if (blknum + (bp->bio_bcount / fdblk) > nblocks) { if (blknum <= nblocks) { cando = (nblocks - blknum) * fdblk; - bp->b_resid = bp->b_bcount - cando; + bp->bio_resid = bp->bio_bcount - cando; if (cando == 0) goto bad; /* not actually bad but EOF */ } else { - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto bad; } } - bp->b_pblkno = bp->b_blkno; + bp->bio_pblkno = bp->bio_blkno; s = splbio(); - bufqdisksort(&fdc->head, bp); + bioqdisksort(&fdc->head, bp); untimeout(fd_turnoff, fd, fd->toffhandle); /* a good idea */ /* Tell devstat we are starting on the transaction */ @@ -1974,15 +1971,15 @@ fdstate(fdc_p fdc) unsigned blknum = 0, b_cylinder = 0; fdu_t fdu = fdc->fdu; fd_p fd; - register struct buf *bp; + register struct bio *bp; struct fd_formb *finfo = NULL; size_t fdblk; bp = fdc->bp; if (bp == NULL) { - bp = bufq_first(&fdc->head); + bp = bioq_first(&fdc->head); if (bp != NULL) { - bufq_remove(&fdc->head, bp); + bioq_remove(&fdc->head, bp); fdc->bp = bp; } } @@ -2001,24 +1998,24 @@ fdstate(fdc_p fdc) TRACE1("[fdc%d IDLE]", fdc->fdcu); return (0); } - fdu = FDUNIT(minor(bp->b_dev)); + fdu = FDUNIT(minor(bp->bio_dev)); fd = devclass_get_softc(fd_devclass, fdu); fdblk = 128 << fd->ft->secsize; if (fdc->fd && (fd != fdc->fd)) device_printf(fd->dev, "confused fd pointers\n"); - read = bp->b_iocmd == BIO_READ; + read = bp->bio_cmd == BIO_READ; if (read) idf = ISADMA_READ; else idf = ISADMA_WRITE; - format = bp->b_flags & B_FORMAT; + format = bp->bio_cmd & BIO_FORMAT; if (format) { - finfo = (struct fd_formb *)bp->b_data; + finfo = (struct fd_formb *)bp->bio_data; fd->skip = (char *)&(finfo->fd_formb_cylno(0)) - (char *)finfo; } if (fdc->state == DOSEEK || fdc->state == SEEKCOMPLETE) { - blknum = (unsigned) bp->b_pblkno * DEV_BSIZE/fdblk + + blknum = (unsigned) bp->bio_pblkno * DEV_BSIZE/fdblk + fd->skip/fdblk; b_cylinder = blknum / (fd->ft->sectrac * fd->ft->heads); } @@ -2205,8 +2202,8 @@ fdstate(fdc_p fdc) if (fdu != nrdu) { #endif /* EPSON_NRDISK */ if (!(fdc->flags & FDC_NODMA)) - isa_dmastart(idf, bp->b_data+fd->skip, - format ? bp->b_bcount : fdblk, fdc->dmachan); + isa_dmastart(idf, bp->bio_data+fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); sectrac = fd->ft->sectrac; sec = blknum % (sectrac * fd->ft->heads); head = sec / sectrac; @@ -2221,8 +2218,8 @@ fdstate(fdc_p fdc) /* stuck controller? */ if (!(fdc->flags & FDC_NODMA)) isa_dmadone(idf, - bp->b_data + fd->skip, - format ? bp->b_bcount : fdblk, + bp->bio_data + fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); fdc->retry = 6; /* reset the beast */ return (retrier(fdc)); @@ -2262,11 +2259,11 @@ fdstate(fdc_p fdc) * * Umpf. */ - SET_BCDR(fdc, 1, bp->b_bcount, 0); + SET_BCDR(fdc, 1, bp->bio_bcount, 0); - (void)fdcpio(fdc,bp->b_iocmd, - bp->b_data+fd->skip, - bp->b_bcount); + (void)fdcpio(fdc,bp->bio_cmd, + bp->bio_data+fd->skip, + bp->bio_bcount); } /* formatting */ @@ -2278,8 +2275,8 @@ fdstate(fdc_p fdc) /* controller fell over */ if (!(fdc->flags & FDC_NODMA)) isa_dmadone(idf, - bp->b_data + fd->skip, - format ? bp->b_bcount : fdblk, + bp->bio_data + fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); fdc->retry = 6; return (retrier(fdc)); @@ -2297,8 +2294,8 @@ fdstate(fdc_p fdc) * the WRITE command is sent */ if (!read) - (void)fdcpio(fdc,bp->b_iocmd, - bp->b_data+fd->skip, + (void)fdcpio(fdc,bp->bio_cmd, + bp->bio_data+fd->skip, fdblk); } if (fd_cmd(fdc, 9, @@ -2315,8 +2312,8 @@ fdstate(fdc_p fdc) /* the beast is sleeping again */ if (!(fdc->flags & FDC_NODMA)) isa_dmadone(idf, - bp->b_data + fd->skip, - format ? bp->b_bcount : fdblk, + bp->bio_data + fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); fdc->retry = 6; return (retrier(fdc)); @@ -2327,8 +2324,8 @@ fdstate(fdc_p fdc) * if this is a read, then simply await interrupt * before performing PIO */ - if (read && !fdcpio(fdc,bp->b_iocmd, - bp->b_data+fd->skip,fdblk)) { + if (read && !fdcpio(fdc,bp->bio_cmd, + bp->bio_data+fd->skip,fdblk)) { fd->tohandle = timeout(fd_iotimeout, fdc, hz); return(0); /* will return later */ }; @@ -2349,11 +2346,11 @@ fdstate(fdc_p fdc) nrd_addrset(fdblk * nrdblkn); while (!nrd_check_ready()) DELAY(1); if (read) epson_insw(P_NRD_DATA, - bp->b_data + fd->skip, + bp->bio_data + fd->skip, fdblk / sizeof(short)); else epson_outsw(P_NRD_DATA, - bp->b_data + fd->skip, - (format ? bp->b_bcount : fdblk) + bp->bio_data + fd->skip, + (format ? bp->bio_bcount : fdblk) / sizeof(short)); blknum = (unsigned long)bp->b_blkno*DEV_BSIZE/fdblk @@ -2375,7 +2372,7 @@ fdstate(fdc_p fdc) * actually perform the PIO read. The IOCOMPLETE case * removes the timeout for us. */ - (void)fdcpio(fdc,bp->b_iocmd,bp->b_data+fd->skip,fdblk); + (void)fdcpio(fdc,bp->bio_cmd,bp->bio_data+fd->skip,fdblk); fdc->state = IOCOMPLETE; /* FALLTHROUGH */ case IOCOMPLETE: /* IO DONE, post-analyze */ @@ -2388,8 +2385,8 @@ fdstate(fdc_p fdc) if (fd_read_status(fdc, fd->fdsu)) { if (!(fdc->flags & FDC_NODMA)) - isa_dmadone(idf, bp->b_data + fd->skip, - format ? bp->b_bcount : fdblk, + isa_dmadone(idf, bp->bio_data + fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); if (fdc->retry < 6) fdc->retry = 6; /* force a reset */ @@ -2405,8 +2402,8 @@ fdstate(fdc_p fdc) if (fdu != nrdu) { #endif /* EPSON_NRDISK */ if (!(fdc->flags & FDC_NODMA)) - isa_dmadone(idf, bp->b_data + fd->skip, - format ? bp->b_bcount : fdblk, fdc->dmachan); + isa_dmadone(idf, bp->bio_data + fd->skip, + format ? bp->bio_bcount : fdblk, fdc->dmachan); #ifdef EPSON_NRDISK } else nrd_LED_off(); @@ -2435,7 +2432,7 @@ fdstate(fdc_p fdc) } /* All OK */ fd->skip += fdblk; - if (!format && fd->skip < bp->b_bcount - bp->b_resid) { + if (!format && fd->skip < bp->bio_bcount - bp->bio_resid) { /* set up next transfer */ fdc->state = DOSEEK; } else { @@ -2443,7 +2440,7 @@ fdstate(fdc_p fdc) fd->skip = 0; fdc->bp = NULL; device_unbusy(fd->dev); - devstat_end_transaction_buf(&fd->device_stats, bp); + devstat_end_transaction_bio(&fd->device_stats, bp); biodone(bp); fdc->fd = (fd_p) 0; fdc->fdu = -1; @@ -2563,14 +2560,14 @@ fdstate(fdc_p fdc) static int retrier(struct fdc_data *fdc) { - register struct buf *bp; + register struct bio *bp; struct fd_data *fd; int fdu; bp = fdc->bp; /* XXX shouldn't this be cached somewhere? */ - fdu = FDUNIT(minor(bp->b_dev)); + fdu = FDUNIT(minor(bp->bio_dev)); fd = devclass_get_softc(fd_devclass, fdu); if (fd->options & FDOPT_NORETRY) goto fail; @@ -2590,14 +2587,14 @@ retrier(struct fdc_data *fdc) default: fail: { - dev_t sav_b_dev = bp->b_dev; + dev_t sav_b_dev = bp->bio_dev; /* Trick diskerr */ - bp->b_dev = makedev(major(bp->b_dev), - (FDUNIT(minor(bp->b_dev))<<3)|RAW_PART); + bp->bio_dev = makedev(major(bp->bio_dev), + (FDUNIT(minor(bp->bio_dev))<<3)|RAW_PART); diskerr(bp, "hard error", LOG_PRINTF, fdc->fd->skip / DEV_BSIZE, (struct disklabel *)NULL); - bp->b_dev = sav_b_dev; + bp->bio_dev = sav_b_dev; if (fdc->flags & FDC_STAT_VALID) { printf( @@ -2611,13 +2608,13 @@ retrier(struct fdc_data *fdc) else printf(" (No status)\n"); } - bp->b_ioflags |= BIO_ERROR; - bp->b_error = EIO; - bp->b_resid += bp->b_bcount - fdc->fd->skip; + bp->bio_flags |= BIO_ERROR; + bp->bio_error = EIO; + bp->bio_resid += bp->bio_bcount - fdc->fd->skip; fdc->bp = NULL; fdc->fd->skip = 0; device_unbusy(fd->dev); - devstat_end_transaction_buf(&fdc->fd->device_stats, bp); + devstat_end_transaction_bio(&fdc->fd->device_stats, bp); biodone(bp); fdc->state = FINDWORK; fdc->flags |= FDC_NEEDS_RESET; @@ -2647,7 +2644,7 @@ 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 buf *)malloc(sizeof(struct bio), M_TEMP, M_NOWAIT); if(bp == 0) return ENOBUFS; /* @@ -2657,8 +2654,8 @@ fdformat(dev, finfo, p) bzero((void *)bp, sizeof(struct buf)); BUF_LOCKINIT(bp); BUF_LOCK(bp, LK_EXCLUSIVE); - bp->b_flags = B_PHYS | B_FORMAT; - bp->b_iocmd = BIO_WRITE; + bp->b_flags = B_PHYS; + bp->b_iocmd = BIO_FORMAT; /* * calculate a fake blkno, so fdstrategy() would initiate a @@ -2687,9 +2684,9 @@ fdformat(dev, finfo, p) /* timed out */ rv = EIO; device_unbusy(fd->dev); - biodone(bp); + bufdone(bp); } - if (bp->b_ioflags & BIO_ERROR) + if (bp->b_flags & BIO_ERROR) rv = bp->b_error; /* * allow the process to be swapped diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index 61056d0..8e253bd 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -2658,54 +2658,54 @@ Debugger(const char *msg) * if needed, and signal errors or early completion. */ int -bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel) +bounds_check_with_label(struct bio *bp, struct disklabel *lp, int wlabel) { - struct partition *p = lp->d_partitions + dkpart(bp->b_dev); + struct partition *p = lp->d_partitions + dkpart(bp->bio_dev); int labelsect = lp->d_partitions[0].p_offset; int maxsz = p->p_size, - sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT; + sz = (bp->bio_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT; /* overwriting disk label ? */ /* XXX should also protect bootstrap in first 8K */ - if (bp->b_blkno + p->p_offset <= LABELSECTOR + labelsect && + if (bp->bio_blkno + p->p_offset <= LABELSECTOR + labelsect && #if LABELSECTOR != 0 - bp->b_blkno + p->p_offset + sz > LABELSECTOR + labelsect && + bp->bio_blkno + p->p_offset + sz > LABELSECTOR + labelsect && #endif - (bp->b_iocmd == BIO_WRITE) && wlabel == 0) { - bp->b_error = EROFS; + (bp->bio_cmd == BIO_WRITE) && wlabel == 0) { + bp->bio_error = EROFS; goto bad; } #if defined(DOSBBSECTOR) && defined(notyet) /* overwriting master boot record? */ - if (bp->b_blkno + p->p_offset <= DOSBBSECTOR && - (bp->b_iocmd == BIO_WRITE) && wlabel == 0) { - bp->b_error = EROFS; + if (bp->bio_blkno + p->p_offset <= DOSBBSECTOR && + (bp->bio_cmd == BIO_WRITE) && wlabel == 0) { + bp->bio_error = EROFS; goto bad; } #endif /* beyond partition? */ - if (bp->b_blkno < 0 || bp->b_blkno + sz > maxsz) { + if (bp->bio_blkno < 0 || bp->bio_blkno + sz > maxsz) { /* if exactly at end of disk, return an EOF */ - if (bp->b_blkno == maxsz) { - bp->b_resid = bp->b_bcount; + if (bp->bio_blkno == maxsz) { + bp->bio_resid = bp->bio_bcount; return(0); } /* or truncate if part of it fits */ - sz = maxsz - bp->b_blkno; + sz = maxsz - bp->bio_blkno; if (sz <= 0) { - bp->b_error = EINVAL; + bp->bio_error = EINVAL; goto bad; } - bp->b_bcount = sz << DEV_BSHIFT; + bp->bio_bcount = sz << DEV_BSHIFT; } - bp->b_pblkno = bp->b_blkno + p->p_offset; + bp->bio_pblkno = bp->bio_blkno + p->p_offset; return(1); bad: - bp->b_ioflags |= BIO_ERROR; + bp->bio_flags |= BIO_ERROR; return(-1); } diff --git a/sys/pc98/pc98/wd.c b/sys/pc98/pc98/wd.c index 67eb543..fc8728f 100644 --- a/sys/pc98/pc98/wd.c +++ b/sys/pc98/pc98/wd.c @@ -194,15 +194,15 @@ struct disk { static int wdtest = 0; static struct disk *wddrives[NWD]; /* table of units */ -static struct buf_queue_head drive_queue[NWD]; /* head of queue per drive */ +static struct bio_queue_head drive_queue[NWD]; /* head of queue per drive */ static struct { int b_active; } wdutab[NWD]; /* -static struct buf wdtab[NWDC]; +static struct bio wdtab[NWDC]; */ static struct { - struct buf_queue_head controller_queue; + struct bio_queue_head controller_queue; int b_errcnt; int b_active; } wdtab[NWDC]; @@ -210,7 +210,7 @@ static struct { struct wddma wddma[NWDC]; #ifdef notyet -static struct buf rwdbuf[NWD]; /* buffers for raw IO */ +static struct bio rwdbuf[NWD]; /* buffers for raw IO */ #endif #ifdef PC98 static short wd_ctlr; @@ -220,7 +220,7 @@ static int old_epson_note; static int wdprobe(struct isa_device *dvp); static int wdattach(struct isa_device *dvp); static void wdustart(struct disk *du); -static int wdcontrol(struct buf *bp); +static int wdcontrol(struct bio *bp); static int wdcommand(struct disk *du, u_int cylinder, u_int head, u_int sector, u_int count, u_int command); static int wdsetctlr(struct disk *du); @@ -229,7 +229,7 @@ static int wdwsetctlr(struct disk *du); #endif static int wdsetmode(int mode, void *wdinfo); static int wdgetctlr(struct disk *du); -static void wderror(struct buf *bp, struct disk *du, char *mesg); +static void wderror(struct bio *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); @@ -486,10 +486,10 @@ wdattach(struct isa_device *dvp) if (eide_quirks & Q_CMD640B) { if (dvp->id_unit == PRIMARY) { printf("wdc0: CMD640B workaround enabled\n"); - bufq_init(&wdtab[PRIMARY].controller_queue); + bioq_init(&wdtab[PRIMARY].controller_queue); } } else - bufq_init(&wdtab[dvp->id_unit].controller_queue); + bioq_init(&wdtab[dvp->id_unit].controller_queue); sprintf(buf, "wdc%d", dvp->id_unit); for (i = resource_query_string(-1, "at", buf); @@ -521,7 +521,7 @@ wdattach(struct isa_device *dvp) if (wddrives[lunit] != NULL) panic("drive attached twice"); wddrives[lunit] = du; - bufq_init(&drive_queue[lunit]); + bioq_init(&drive_queue[lunit]); bzero(du, sizeof *du); du->dk_ctrlr = dvp->id_unit; if (eide_quirks & Q_CMD640B) { @@ -650,18 +650,18 @@ next: ; * be a multiple of a sector in length. */ void -wdstrategy(register struct buf *bp) +wdstrategy(register struct bio *bp) { struct disk *du; - int lunit = dkunit(bp->b_dev); + int lunit = dkunit(bp->bio_dev); int s; /* valid unit, controller, and request? */ - if (lunit >= NWD || bp->b_blkno < 0 || (du = wddrives[lunit]) == NULL - || bp->b_bcount % DEV_BSIZE != 0) { + if (lunit >= NWD || bp->bio_blkno < 0 || (du = wddrives[lunit]) == NULL + || bp->bio_bcount % DEV_BSIZE != 0) { - bp->b_error = EINVAL; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EINVAL; + bp->bio_flags |= BIO_ERROR; goto done; } @@ -670,7 +670,7 @@ wdstrategy(register struct buf *bp) #endif /* - * Do bounds checking, adjust transfer, and set b_pblkno. + * Do bounds checking, adjust transfer, and set bio_pblkno. */ if (dscheck(bp, du->dk_slices) <= 0) goto done; @@ -684,7 +684,7 @@ wdstrategy(register struct buf *bp) du->dk_state = WANTOPEN; } - bufqdisksort(&drive_queue[lunit], bp); + bioqdisksort(&drive_queue[lunit], bp); if (wdutab[lunit].b_active == 0) wdustart(du); /* start drive */ @@ -711,7 +711,7 @@ done: static void wdustart(register struct disk *du) { - register struct buf *bp; + register struct bio *bp; int ctrlr = du->dk_ctrlr_cmd640; #ifdef PC98 @@ -722,19 +722,19 @@ wdustart(register struct disk *du) return; - bp = bufq_first(&drive_queue[du->dk_lunit]); + bp = bioq_first(&drive_queue[du->dk_lunit]); if (bp == NULL) { /* yes, an assign */ return; } /* * store away which device we came from. */ - bp->b_driver1 = du; + bp->bio_driver1 = du; - bufq_remove(&drive_queue[du->dk_lunit], bp); + bioq_remove(&drive_queue[du->dk_lunit], bp); /* link onto controller queue */ - bufq_insert_tail(&wdtab[ctrlr].controller_queue, bp); + bioq_insert_tail(&wdtab[ctrlr].controller_queue, bp); /* mark the drive unit as busy */ wdutab[du->dk_lunit].b_active = 1; @@ -753,7 +753,7 @@ void wdstart(int ctrlr) { register struct disk *du; - register struct buf *bp; + register struct bio *bp; struct diskgeom *lp; /* XXX sic */ long blknum; long secpertrk, secpercyl; @@ -773,7 +773,7 @@ wdstart(int ctrlr) if (wdtab[ctrlr].b_active) return; /* is there a drive for the controller to do a transfer with? */ - bp = bufq_first(&wdtab[ctrlr].controller_queue); + bp = bioq_first(&wdtab[ctrlr].controller_queue); if (bp == NULL) { if (atapi_start && atapi_start (ctrlr_atapi)) /* mark controller active in ATAPI mode */ @@ -782,7 +782,7 @@ wdstart(int ctrlr) } /* obtain controller and drive information */ - lunit = dkunit(bp->b_dev); + lunit = dkunit(bp->bio_dev); du = wddrives[lunit]; #ifdef PC98 @@ -801,12 +801,12 @@ wdstart(int ctrlr) } /* calculate transfer details */ - blknum = bp->b_pblkno + du->dk_skip; + blknum = bp->bio_pblkno + du->dk_skip; #ifdef WDDEBUG if (du->dk_skip == 0) printf("wd%d: wdstart: %s %d@%d; map ", lunit, - (bp->b_iocmd == BIO_READ) ? "read" : "write", - bp->b_bcount, blknum); + (bp->bio_cmd == BIO_READ) ? "read" : "write", + bp->bio_bcount, blknum); else { if (old_epson_note) printf(" %d)%x", du->dk_skip, epson_inb(du->dk_altport); @@ -820,7 +820,7 @@ wdstart(int ctrlr) secpercyl = lp->d_secpercyl; if (du->dk_skip == 0) - du->dk_bc = bp->b_bcount; + du->dk_bc = bp->bio_bcount; wdtab[ctrlr].b_active = 1; /* mark controller active */ @@ -843,7 +843,7 @@ wdstart(int ctrlr) * XXX this looks like an attempt to skip bad sectors * on write. */ - if (wdtab[ctrlr].b_errcnt && (bp->b_iocmd == BIO_WRITE)) + if (wdtab[ctrlr].b_errcnt && (bp->bio_cmd == BIO_WRITE)) du->dk_bc += DEV_BSIZE; count1 = howmany( du->dk_bc, DEV_BSIZE); @@ -851,26 +851,26 @@ wdstart(int ctrlr) du->dk_flags &= ~DKFL_MULTI; if (du->dk_flags & DKFL_SINGLE) { - command = (bp->b_iocmd == BIO_READ) + command = (bp->bio_cmd == BIO_READ) ? WDCC_READ : WDCC_WRITE; count1 = 1; du->dk_currentiosize = 1; } else { if((du->dk_flags & DKFL_USEDMA) && wddma[du->dk_interface].wdd_dmaverify(du->dk_dmacookie, - (void *)((int)bp->b_data + + (void *)((int)bp->bio_data + du->dk_skip * DEV_BSIZE), du->dk_bc, - bp->b_iocmd == BIO_READ)) { + bp->bio_cmd == BIO_READ)) { du->dk_flags |= DKFL_DMA; - if(bp->b_iocmd == BIO_READ) + if(bp->bio_cmd == BIO_READ) command = WDCC_READ_DMA; else command = WDCC_WRITE_DMA; du->dk_currentiosize = count1; } else if( (count1 > 1) && (du->dk_multi > 1)) { du->dk_flags |= DKFL_MULTI; - if(bp->b_iocmd == BIO_READ) { + if(bp->bio_cmd == BIO_READ) { command = WDCC_READ_MULTI; } else { command = WDCC_WRITE_MULTI; @@ -879,7 +879,7 @@ wdstart(int ctrlr) if( du->dk_currentiosize > count1) du->dk_currentiosize = count1; } else { - if(bp->b_iocmd == BIO_READ) { + if(bp->bio_cmd == BIO_READ) { command = WDCC_READ; } else { command = WDCC_WRITE; @@ -903,10 +903,10 @@ wdstart(int ctrlr) if ((du->dk_flags & (DKFL_DMA|DKFL_SINGLE)) == DKFL_DMA) { wddma[du->dk_interface].wdd_dmaprep(du->dk_dmacookie, - (void *)((int)bp->b_data + + (void *)((int)bp->bio_data + du->dk_skip * DEV_BSIZE), du->dk_bc, - bp->b_iocmd == BIO_READ); + bp->bio_cmd == BIO_READ); } while (wdcommand(du, cylin, head, sector, count1, command) != 0) { @@ -917,7 +917,7 @@ wdstart(int ctrlr) #ifdef WDDEBUG printf("cylin %ld head %ld sector %ld addr %x sts ", cylin, head, sector, - (int)bp->b_data + du->dk_skip * DEV_BSIZE); + (int)bp->bio_data + du->dk_skip * DEV_BSIZE); if (old_epson_note) printf("%x\n", epson_inb(du->dk_altport)); else @@ -954,7 +954,7 @@ wdstart(int ctrlr) } /* If this is a read operation, just go away until it's done. */ - if (bp->b_iocmd == BIO_READ) + if (bp->bio_cmd == BIO_READ) return; /* Ready to send data? */ @@ -983,18 +983,18 @@ wdstart(int ctrlr) if (!old_epson_note) { if (du->dk_flags & DKFL_32BIT) outsl(du->dk_port + wd_data, - (void *)((int)bp->b_data + (void *)((int)bp->bio_data + du->dk_skip * DEV_BSIZE), (count * DEV_BSIZE) / sizeof(long)); else outsw(du->dk_port + wd_data, - (void *)((int)bp->b_data + (void *)((int)bp->bio_data + du->dk_skip * DEV_BSIZE), (count * DEV_BSIZE) / sizeof(short)); } else epson_outsw(du->dk_port + wd_data, - (void *)((int)bp->b_data + du->dk_skip * DEV_BSIZE), + (void *)((int)bp->bio_data + du->dk_skip * DEV_BSIZE), (count * DEV_BSIZE) / sizeof(short)); du->dk_bc -= DEV_BSIZE * count; @@ -1010,7 +1010,7 @@ void wdintr(void *unitnum) { register struct disk *du; - register struct buf *bp; + register struct bio *bp; int dmastat = 0; /* Shut up GCC */ int unit = (int)unitnum; @@ -1046,8 +1046,8 @@ wdintr(void *unitnum) wdstart (unit); return; } - bp = bufq_first(&wdtab[unit].controller_queue); - du = wddrives[dkunit(bp->b_dev)]; + bp = bioq_first(&wdtab[unit].controller_queue); + du = wddrives[dkunit(bp->bio_dev)]; #ifdef PC98 outb(0x432,(du->dk_unit)%2); @@ -1123,8 +1123,8 @@ oops: wdtab[unit].b_active = 0; } else { wderror(bp, du, "hard error"); - bp->b_error = EIO; - bp->b_ioflags |= BIO_ERROR; /* flag the error */ + bp->bio_error = EIO; + bp->bio_flags |= BIO_ERROR; /* flag the error */ } } else if (du->dk_status & WDCS_ECCCOR) wderror(bp, du, "soft ecc"); @@ -1133,7 +1133,7 @@ oops: /* * If this was a successful read operation, fetch the data. */ - if (bp->b_iocmd == BIO_READ && !(bp->b_ioflags & BIO_ERROR) + if (bp->bio_cmd == BIO_READ && !(bp->bio_flags & BIO_ERROR) && !((du->dk_flags & (DKFL_DMA|DKFL_SINGLE)) == DKFL_DMA) && wdtab[unit].b_active) { u_int chk, dummy, multisize; @@ -1158,11 +1158,11 @@ oops: /* suck in data */ if( du->dk_flags & DKFL_32BIT) insl(du->dk_port + wd_data, - (void *)((int)bp->b_data + du->dk_skip * DEV_BSIZE), + (void *)((int)bp->bio_data + du->dk_skip * DEV_BSIZE), chk / sizeof(long)); else insw(du->dk_port + wd_data, - (void *)((int)bp->b_data + du->dk_skip * DEV_BSIZE), + (void *)((int)bp->bio_data + du->dk_skip * DEV_BSIZE), chk / sizeof(short)); du->dk_bc -= chk; @@ -1175,7 +1175,7 @@ oops: } /* final cleanup on DMA */ - if (((bp->b_ioflags & BIO_ERROR) == 0) + if (((bp->bio_flags & BIO_ERROR) == 0) && ((du->dk_flags & (DKFL_DMA|DKFL_SINGLE)) == DKFL_DMA) && wdtab[unit].b_active) { int iosize; @@ -1188,7 +1188,7 @@ oops: outt: if (wdtab[unit].b_active) { - if ((bp->b_ioflags & BIO_ERROR) == 0) { + if ((bp->bio_flags & BIO_ERROR) == 0) { du->dk_skip += du->dk_currentiosize;/* add to successful sectors */ if (wdtab[unit].b_errcnt) wderror(bp, du, "soft error"); @@ -1197,7 +1197,7 @@ outt: /* see if more to transfer */ if (du->dk_bc > 0 && (du->dk_flags & DKFL_ERROR) == 0) { if( (du->dk_flags & DKFL_SINGLE) || - (bp->b_iocmd == BIO_WRITE)) { + (bp->bio_cmd == BIO_WRITE)) { wdtab[unit].b_active = 0; wdstart(unit); } else { @@ -1218,12 +1218,12 @@ outt: done: ; /* done with this transfer, with or without error */ du->dk_flags &= ~(DKFL_SINGLE|DKFL_DMA); - bufq_remove( &wdtab[unit].controller_queue, bp); + bioq_remove( &wdtab[unit].controller_queue, bp); wdtab[unit].b_errcnt = 0; - bp->b_resid = bp->b_bcount - du->dk_skip * DEV_BSIZE; + bp->bio_resid = bp->bio_bcount - du->dk_skip * DEV_BSIZE; wdutab[du->dk_lunit].b_active = 0; du->dk_skip = 0; - devstat_end_transaction_buf(&du->dk_stats, bp); + devstat_end_transaction_bio(&du->dk_stats, bp); biodone(bp); } @@ -1416,12 +1416,12 @@ wdopen(dev_t dev, int flags, int fmt, struct proc *p) * Returns 0 if operation still in progress, 1 if completed, 2 if error. */ static int -wdcontrol(register struct buf *bp) +wdcontrol(register struct bio *bp) { register struct disk *du; int ctrlr; - du = wddrives[dkunit(bp->b_dev)]; + du = wddrives[dkunit(bp->bio_dev)]; ctrlr = du->dk_ctrlr_cmd640; #ifdef PC98 @@ -1447,8 +1447,8 @@ maybe_retry: du->dk_state = WANTOPEN; if (++wdtab[ctrlr].b_errcnt < RETRIES) goto tryagainrecal; - bp->b_error = ENXIO; /* XXX needs translation */ - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = ENXIO; /* XXX needs translation */ + bp->bio_flags |= BIO_ERROR; return (2); } wdtab[ctrlr].b_errcnt = 0; @@ -1652,7 +1652,7 @@ wdsetctlr(struct disk *du) if (wdcommand(du, du->dk_dd.d_ncylinders, du->dk_dd.d_ntracks - 1, 0, du->dk_dd.d_nsectors, WDCC_IDC) != 0 || wdwait(du, WDCS_READY, TIMEOUT) < 0) { - wderror((struct buf *)NULL, du, "wdsetctlr failed"); + wderror((struct bio *)NULL, du, "wdsetctlr failed"); return (1); } } @@ -2121,7 +2121,7 @@ wddump(dev_t dev) if (wdcommand(du, 0, 0, 0, 0, WDCC_RESTORE | WD_STEP) != 0 || wdwait(du, WDCS_READY | WDCS_SEEKCMPLT, TIMEOUT) != 0 || wdsetctlr(du) != 0) { - wderror((struct buf *)NULL, du, "wddump: recalibrate failed"); + wderror((struct bio *)NULL, du, "wddump: recalibrate failed"); return (EIO); } @@ -2161,7 +2161,7 @@ wddump(dev_t dev) /* Do the write. */ if (wdcommand(du, cylin, head, sector, blkcnt, WDCC_WRITE) != 0) { - wderror((struct buf *)NULL, du, + wderror((struct bio *)NULL, du, "wddump: timeout waiting to to give command"); return (EIO); } @@ -2177,7 +2177,7 @@ wddump(dev_t dev) DELAY(5); /* ATA spec */ if (wdwait(du, WDCS_READY | WDCS_SEEKCMPLT | WDCS_DRQ, TIMEOUT) < 0) { - wderror((struct buf *)NULL, du, + wderror((struct bio *)NULL, du, "wddump: timeout waiting for DRQ"); return (EIO); } @@ -2208,7 +2208,7 @@ wddump(dev_t dev) /* Wait for completion. */ DELAY(5); /* ATA spec XXX NOT */ if (wdwait(du, WDCS_READY | WDCS_SEEKCMPLT, TIMEOUT) < 0) { - wderror((struct buf *)NULL, du, + wderror((struct bio *)NULL, du, "wddump: timeout waiting for status"); return (EIO); } @@ -2217,7 +2217,7 @@ wddump(dev_t dev) if ((du->dk_status & (WDCS_READY | WDCS_SEEKCMPLT | WDCS_DRQ | WDCS_ERR)) != (WDCS_READY | WDCS_SEEKCMPLT)) { - wderror((struct buf *)NULL, du, + wderror((struct bio *)NULL, du, "wddump: extra DRQ, or error"); return (EIO); } @@ -2234,13 +2234,13 @@ wddump(dev_t dev) } static void -wderror(struct buf *bp, struct disk *du, char *mesg) +wderror(struct bio *bp, struct disk *du, char *mesg) { if (bp == NULL) printf("wd%d: %s", du->dk_lunit, mesg); else diskerr(bp, mesg, LOG_PRINTF, du->dk_skip, - dsgetlabel(bp->b_dev, du->dk_slices)); + dsgetlabel(bp->bio_dev, du->dk_slices)); printf(" (status %b error %b)\n", du->dk_status, WDCS_BITS, du->dk_error, WDERR_BITS); } @@ -2336,7 +2336,7 @@ wdtimeout(void *cdu) msg = (timeouts > 5) ? "Last time I say: interrupt timeout. Probably a portable PC." : "interrupt timeout"; - wderror((struct buf *)NULL, du, msg); + wderror((struct bio *)NULL, du, msg); if (du->dk_dmacookie) printf("wd%d: wdtimeout() DMA status %b\n", du->dk_lunit, @@ -2386,7 +2386,7 @@ wdunwedge(struct disk *du) && wdsetctlr(du) == 0) return (0); } - wderror((struct buf *)NULL, du, "wdunwedge failed"); + wderror((struct bio *)NULL, du, "wdunwedge failed"); return (1); } diff --git a/sys/pc98/pc98/wd_cd.c b/sys/pc98/pc98/wd_cd.c index fea4ac1..b88cffb 100644 --- a/sys/pc98/pc98/wd_cd.c +++ b/sys/pc98/pc98/wd_cd.c @@ -86,7 +86,7 @@ int acdattach(struct atapi *, int, struct atapi_params *, int); static struct acd *acd_init_lun(struct atapi *, int, struct atapi_params *, int, struct devstat *); static void acd_start(struct acd *); -static void acd_done(struct acd *, struct buf *, int, struct atapires); +static void acd_done(struct acd *, struct bio *, int, struct atapires); static int acd_read_toc(struct acd *); static int acd_request_wait(struct acd *, u_char, u_char, u_char, u_char, u_char, u_char, u_char, u_char, u_char, u_char, char *, int); static void acd_describe(struct acd *); @@ -111,7 +111,7 @@ acd_init_lun(struct atapi *ata, int unit, struct atapi_params *ap, int lun, if (!(ptr = malloc(sizeof(struct acd), M_TEMP, M_NOWAIT))) return NULL; bzero(ptr, sizeof(struct acd)); - bufq_init(&ptr->buf_queue); + bioq_init(&ptr->bio_queue); ptr->ata = ata; ptr->unit = unit; ptr->lun = lun; @@ -433,33 +433,33 @@ acdclose(dev_t dev, int flags, int fmt, struct proc *p) } void -acdstrategy(struct buf *bp) +acdstrategy(struct bio *bp) { - int lun = dkunit(bp->b_dev); + int lun = dkunit(bp->bio_dev); struct acd *cdp = acdtab[lun]; int x; #ifdef NOTYET /* allow write only on CD-R/RW media */ /* all for now SOS */ - if ((bp->b_iocmd == BIO_WRITE) && !(writeable_media)) { - bp->b_error = EROFS; - bp->b_ioflags |= BIO_ERROR; + if ((bp->bio_cmd == BIO_WRITE) && !(writeable_media)) { + bp->bio_error = EROFS; + bp->bio_flags |= BIO_ERROR; biodone(bp); return; } #endif - if (bp->b_bcount == 0) { - bp->b_resid = 0; + if (bp->bio_bcount == 0) { + bp->bio_resid = 0; biodone(bp); return; } - bp->b_pblkno = bp->b_blkno; - bp->b_resid = bp->b_bcount; + bp->bio_pblkno = bp->bio_blkno; + bp->bio_resid = bp->bio_bcount; x = splbio(); - bufqdisksort(&cdp->buf_queue, bp); + bioqdisksort(&cdp->bio_queue, bp); acd_start(cdp); splx(x); } @@ -467,7 +467,7 @@ acdstrategy(struct buf *bp) static void acd_start(struct acd *cdp) { - struct buf *bp = bufq_first(&cdp->buf_queue); + struct bio *bp = bioq_first(&cdp->bio_queue); u_long lba, blocks; int cmd; int count; @@ -475,24 +475,24 @@ acd_start(struct acd *cdp) if (!bp) return; - bufq_remove(&cdp->buf_queue, bp); + bioq_remove(&cdp->bio_queue, bp); /* Should reject all queued entries if media have changed. */ if (cdp->flags & F_MEDIA_CHANGED) { - bp->b_error = EIO; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EIO; + bp->bio_flags |= BIO_ERROR; biodone(bp); return; } acd_select_slot(cdp); - if (bp->b_iocmd == BIO_WRITE) { + if (bp->bio_cmd == BIO_WRITE) { if ((cdp->flags & F_TRACK_PREPED) == 0) { if ((cdp->flags & F_TRACK_PREP) == 0) { printf("wcd%d: sequence error\n", cdp->lun); - bp->b_error = EIO; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EIO; + bp->bio_flags |= BIO_ERROR; biodone(bp); return; } else { @@ -505,22 +505,22 @@ acd_start(struct acd *cdp) } } - if (bp->b_iocmd == BIO_READ) + if (bp->bio_cmd == BIO_READ) #ifdef NOTYET - lba = bp->b_offset / cdp->block_size; + lba = bp->bio_offset / cdp->block_size; #else - lba = bp->b_blkno / (cdp->block_size / DEV_BSIZE); + lba = bp->bio_blkno / (cdp->block_size / DEV_BSIZE); #endif else - lba = cdp->next_writeable_lba + (bp->b_offset / cdp->block_size); - blocks = (bp->b_bcount + (cdp->block_size - 1)) / cdp->block_size; + lba = cdp->next_writeable_lba + (bp->bio_offset / cdp->block_size); + blocks = (bp->bio_bcount + (cdp->block_size - 1)) / cdp->block_size; - if (bp->b_iocmd == BIO_WRITE) { + if (bp->bio_cmd == BIO_WRITE) { cmd = ATAPI_WRITE_BIG; - count = -bp->b_bcount; + count = -bp->bio_bcount; } else { cmd = ATAPI_READ_BIG; - count = bp->b_bcount; + count = bp->bio_bcount; } devstat_start_transaction(cdp->device_stats); @@ -528,24 +528,24 @@ acd_start(struct acd *cdp) atapi_request_callback(cdp->ata, cdp->unit, cmd, 0, lba>>24, lba>>16, lba>>8, lba, 0, blocks>>8, blocks, 0, 0, 0, 0, 0, 0, 0, - (u_char *)bp->b_data, count, + (u_char *)bp->bio_data, count, (atapi_callback_t *)acd_done, cdp, bp); } static void -acd_done(struct acd *cdp, struct buf *bp, int resid, struct atapires result) +acd_done(struct acd *cdp, struct bio *bp, int resid, struct atapires result) { if (result.code) { atapi_error(cdp->ata, cdp->unit, result); - bp->b_error = EIO; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EIO; + bp->bio_flags |= BIO_ERROR; } else { - bp->b_resid = resid; - if (bp->b_iocmd == BIO_WRITE) + bp->bio_resid = resid; + if (bp->bio_cmd == BIO_WRITE) cdp->flags |= F_WRITTEN; } - devstat_end_transaction_buf(cdp->device_stats, bp); + devstat_end_transaction_bio(cdp->device_stats, bp); biodone(bp); acd_start(cdp); } diff --git a/sys/pc98/pc98/wd_cd.h b/sys/pc98/pc98/wd_cd.h index a666522..8a6001c 100644 --- a/sys/pc98/pc98/wd_cd.h +++ b/sys/pc98/pc98/wd_cd.h @@ -317,7 +317,7 @@ struct acd { int flags; /* Device state flags */ int refcnt; /* The number of raw opens */ struct atapi *ata; /* Controller structure */ - struct buf_queue_head buf_queue; /* Queue of i/o requests */ + struct bio_queue_head bio_queue; /* Queue of i/o requests */ struct atapi_params *param; /* Drive parameters table */ struct toc toc; /* Table of disc contents */ struct { diff --git a/sys/sys/bio.h b/sys/sys/bio.h index 5ac55a4..174851f 100644 --- a/sys/sys/bio.h +++ b/sys/sys/bio.h @@ -531,6 +531,14 @@ bioq_first(struct bio_queue_head *head) (bp)->b_resid = 0; \ } +/* + * Zero out the bio's data area. + */ +#define clrbio(bp) { \ + bzero((bp)->bio_data, (u_int)(bp)->bio_bcount); \ + (bp)->bio_resid = 0; \ +} + /* Flags to low-level allocation routines. */ #define B_CLRBUF 0x01 /* Request allocated buffer be cleared. */ #define B_SYNC 0x02 /* Do all allocations synchronously. */ @@ -572,7 +580,8 @@ int inmem __P((struct vnode *, daddr_t)); struct buf *getblk __P((struct vnode *, daddr_t, int, int, int)); struct buf *geteblk __P((int)); int biowait __P((struct buf *)); -void biodone __P((struct buf *)); +void bufdone __P((struct buf *)); +void biodone __P((struct bio *)); void cluster_callback __P((struct buf *)); int cluster_read __P((struct vnode *, u_quad_t, daddr_t, long, diff --git a/sys/sys/buf.h b/sys/sys/buf.h index 5ac55a4..174851f 100644 --- a/sys/sys/buf.h +++ b/sys/sys/buf.h @@ -531,6 +531,14 @@ bioq_first(struct bio_queue_head *head) (bp)->b_resid = 0; \ } +/* + * Zero out the bio's data area. + */ +#define clrbio(bp) { \ + bzero((bp)->bio_data, (u_int)(bp)->bio_bcount); \ + (bp)->bio_resid = 0; \ +} + /* Flags to low-level allocation routines. */ #define B_CLRBUF 0x01 /* Request allocated buffer be cleared. */ #define B_SYNC 0x02 /* Do all allocations synchronously. */ @@ -572,7 +580,8 @@ int inmem __P((struct vnode *, daddr_t)); struct buf *getblk __P((struct vnode *, daddr_t, int, int, int)); struct buf *geteblk __P((int)); int biowait __P((struct buf *)); -void biodone __P((struct buf *)); +void bufdone __P((struct buf *)); +void biodone __P((struct bio *)); void cluster_callback __P((struct buf *)); int cluster_read __P((struct vnode *, u_quad_t, daddr_t, long, diff --git a/sys/sys/conf.h b/sys/sys/conf.h index 28e5357..9052f85 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -97,13 +97,14 @@ struct specinfo { * Definitions of device driver entry switches */ +struct bio; struct buf; struct proc; struct uio; typedef int d_open_t __P((dev_t dev, int oflags, int devtype, struct proc *p)); typedef int d_close_t __P((dev_t dev, int fflag, int devtype, struct proc *p)); -typedef void d_strategy_t __P((struct buf *bp)); +typedef void d_strategy_t __P((struct bio *bp)); typedef int d_parms_t __P((dev_t dev, struct specinfo *sinfo, int ctl)); typedef int d_ioctl_t __P((dev_t dev, u_long cmd, caddr_t data, int fflag, struct proc *p)); @@ -141,7 +142,7 @@ typedef void devfs_remove_t __P((dev_t dev)); do { \ if ((!(bp)->b_iocmd) || ((bp)->b_iocmd & ((bp)->b_iocmd - 1))) \ Debugger("d_iocmd botch"); \ - (*devsw((bp)->b_dev)->d_strategy)(bp); \ + (*devsw((bp)->b_dev)->d_strategy)(&(bp)->b_io); \ } while (0) /* diff --git a/sys/sys/disklabel.h b/sys/sys/disklabel.h index 81a5182..5070056 100644 --- a/sys/sys/disklabel.h +++ b/sys/sys/disklabel.h @@ -441,9 +441,9 @@ struct buf; struct buf_queue_head; struct bio_queue_head; -int bounds_check_with_label __P((struct buf *bp, struct disklabel *lp, +int bounds_check_with_label __P((struct bio *bp, struct disklabel *lp, int wlabel)); -void diskerr __P((struct buf *bp, char *what, int pri, int blkdone, +void diskerr __P((struct bio *bp, char *what, int pri, int blkdone, struct disklabel *lp)); void disksort __P((struct buf *ap, struct buf *bp)); u_int dkcksum __P((struct disklabel *lp)); diff --git a/sys/sys/diskmbr.h b/sys/sys/diskmbr.h index 81a5182..5070056 100644 --- a/sys/sys/diskmbr.h +++ b/sys/sys/diskmbr.h @@ -441,9 +441,9 @@ struct buf; struct buf_queue_head; struct bio_queue_head; -int bounds_check_with_label __P((struct buf *bp, struct disklabel *lp, +int bounds_check_with_label __P((struct bio *bp, struct disklabel *lp, int wlabel)); -void diskerr __P((struct buf *bp, char *what, int pri, int blkdone, +void diskerr __P((struct bio *bp, char *what, int pri, int blkdone, struct disklabel *lp)); void disksort __P((struct buf *ap, struct buf *bp)); u_int dkcksum __P((struct disklabel *lp)); diff --git a/sys/sys/diskpc98.h b/sys/sys/diskpc98.h index 81a5182..5070056 100644 --- a/sys/sys/diskpc98.h +++ b/sys/sys/diskpc98.h @@ -441,9 +441,9 @@ struct buf; struct buf_queue_head; struct bio_queue_head; -int bounds_check_with_label __P((struct buf *bp, struct disklabel *lp, +int bounds_check_with_label __P((struct bio *bp, struct disklabel *lp, int wlabel)); -void diskerr __P((struct buf *bp, char *what, int pri, int blkdone, +void diskerr __P((struct bio *bp, char *what, int pri, int blkdone, struct disklabel *lp)); void disksort __P((struct buf *ap, struct buf *bp)); u_int dkcksum __P((struct disklabel *lp)); diff --git a/sys/sys/diskslice.h b/sys/sys/diskslice.h index 0031857..27a402b 100644 --- a/sys/sys/diskslice.h +++ b/sys/sys/diskslice.h @@ -84,9 +84,10 @@ struct diskslices { #define dsgetlabel(dev, ssp) (ssp->dss_slices[dkslice(dev)].ds_label) struct buf; +struct bio; struct disklabel; -int dscheck __P((struct buf *bp, struct diskslices *ssp)); +int dscheck __P((struct bio *bp, struct diskslices *ssp)); void dsclose __P((dev_t dev, int mode, struct diskslices *ssp)); void dsgone __P((struct diskslices **sspp)); int dsinit __P((dev_t dev, struct disklabel *lp, diff --git a/sys/sys/linedisc.h b/sys/sys/linedisc.h index 28e5357..9052f85 100644 --- a/sys/sys/linedisc.h +++ b/sys/sys/linedisc.h @@ -97,13 +97,14 @@ struct specinfo { * Definitions of device driver entry switches */ +struct bio; struct buf; struct proc; struct uio; typedef int d_open_t __P((dev_t dev, int oflags, int devtype, struct proc *p)); typedef int d_close_t __P((dev_t dev, int fflag, int devtype, struct proc *p)); -typedef void d_strategy_t __P((struct buf *bp)); +typedef void d_strategy_t __P((struct bio *bp)); typedef int d_parms_t __P((dev_t dev, struct specinfo *sinfo, int ctl)); typedef int d_ioctl_t __P((dev_t dev, u_long cmd, caddr_t data, int fflag, struct proc *p)); @@ -141,7 +142,7 @@ typedef void devfs_remove_t __P((dev_t dev)); do { \ if ((!(bp)->b_iocmd) || ((bp)->b_iocmd & ((bp)->b_iocmd - 1))) \ Debugger("d_iocmd botch"); \ - (*devsw((bp)->b_dev)->d_strategy)(bp); \ + (*devsw((bp)->b_dev)->d_strategy)(&(bp)->b_io); \ } while (0) /* diff --git a/sys/ufs/mfs/mfs_vnops.c b/sys/ufs/mfs/mfs_vnops.c index d1e6047..3affa85 100644 --- a/sys/ufs/mfs/mfs_vnops.c +++ b/sys/ufs/mfs/mfs_vnops.c @@ -164,10 +164,10 @@ static int mfs_strategy(ap) struct vop_strategy_args /* { struct vnode *a_vp; - struct buf *a_bp; + struct bio *a_bp; } */ *ap; { - register struct buf *bp = ap->a_bp; + register struct buf *bp = (struct buf *)ap->a_bp; register struct mfsnode *mfsp; struct vnode *vp; struct proc *p = curproc; /* XXX */ @@ -198,7 +198,7 @@ mfs_strategy(ap) bcopy(base, bp->b_data, bp->b_bcount); else bcopy(bp->b_data, base, bp->b_bcount); - biodone(bp); + bufdone(bp); } else if (mfsp->mfs_pid == p->p_pid) { /* * VOP to self @@ -277,7 +277,7 @@ mfs_doio(bp, mfsp) } if (bp->b_error) bp->b_ioflags |= BIO_ERROR; - biodone(bp); + bufdone(bp); } /* diff --git a/sys/ufs/ufs/ufs_disksubr.c b/sys/ufs/ufs/ufs_disksubr.c index 551652f..8a1fc0b 100644 --- a/sys/ufs/ufs/ufs_disksubr.c +++ b/sys/ufs/ufs/ufs_disksubr.c @@ -453,14 +453,14 @@ hp0g: hard error reading fsbn 12345 of 12344-12347 (hp0 bn %d cn %d tn %d sn %d) */ void diskerr(bp, what, pri, blkdone, lp) - register struct buf *bp; + struct bio *bp; char *what; int pri, blkdone; register struct disklabel *lp; { - int unit = dkunit(bp->b_dev); - int slice = dkslice(bp->b_dev); - int part = dkpart(bp->b_dev); + int unit = dkunit(bp->bio_dev); + int slice = dkslice(bp->bio_dev); + int part = dkpart(bp->bio_dev); register int (*pr) __P((const char *, ...)); char partname[2]; char *sname; @@ -471,21 +471,21 @@ diskerr(bp, what, pri, blkdone, lp) pr = addlog; } else pr = printf; - sname = dsname(bp->b_dev, unit, slice, part, partname); + sname = dsname(bp->bio_dev, unit, slice, part, partname); (*pr)("%s%s: %s %sing fsbn ", sname, partname, what, - bp->b_iocmd == BIO_READ ? "read" : "writ"); - sn = bp->b_blkno; - if (bp->b_bcount <= DEV_BSIZE) + bp->bio_cmd == BIO_READ ? "read" : "writ"); + sn = bp->bio_blkno; + if (bp->bio_bcount <= DEV_BSIZE) (*pr)("%ld", (long)sn); else { if (blkdone >= 0) { sn += blkdone; (*pr)("%ld of ", (long)sn); } - (*pr)("%ld-%ld", (long)bp->b_blkno, - (long)(bp->b_blkno + (bp->b_bcount - 1) / DEV_BSIZE)); + (*pr)("%ld-%ld", (long)bp->bio_blkno, + (long)(bp->bio_blkno + (bp->bio_bcount - 1) / DEV_BSIZE)); } - if (lp && (blkdone >= 0 || bp->b_bcount <= lp->d_secsize)) { + if (lp && (blkdone >= 0 || bp->bio_bcount <= lp->d_secsize)) { #ifdef tahoe sn *= DEV_BSIZE / lp->d_secsize; /* XXX */ #endif diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 7ab8429..f399511 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1766,14 +1766,14 @@ ufs_strategy(ap) if (error) { bp->b_error = error; bp->b_ioflags |= BIO_ERROR; - biodone(bp); + bufdone(bp); return (error); } if ((long)bp->b_blkno == -1) vfs_bio_clrbuf(bp); } if ((long)bp->b_blkno == -1) { - biodone(bp); + bufdone(bp); return (0); } vp = ip->i_devvp; diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index f4c598e..a7d31e4 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -826,7 +826,7 @@ swap_pager_strategy(vm_object_t object, struct buf *bp) bp->b_error = EINVAL; bp->b_ioflags |= BIO_ERROR; bp->b_flags |= B_INVAL; - biodone(bp); + bufdone(bp); printf("swap_pager_strategy: bp %p b_vp %p blk %d size %d, not page bounded\n", bp, bp->b_vp, (int)bp->b_pblkno, (int)bp->b_bcount); return; } @@ -857,7 +857,7 @@ swap_pager_strategy(vm_object_t object, struct buf *bp) swp_pager_meta_free(object, start, count); splx(s); bp->b_resid = 0; - biodone(bp); + bufdone(bp); return; } diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index 5890024..bf09d24 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -269,7 +269,7 @@ vm_pager_strategy(vm_object_t object, struct buf *bp) } else { bp->b_ioflags |= BIO_ERROR; bp->b_error = ENXIO; - biodone(bp); + bufdone(bp); } } @@ -518,7 +518,7 @@ vm_pager_chain_iodone(struct buf *nbp) bp->b_ioflags |= BIO_ERROR; bp->b_error = EINVAL; } - biodone(bp); + bufdone(bp); } } nbp->b_flags |= B_DONE; @@ -568,7 +568,7 @@ flushchainbuf(struct buf *nbp) BUF_KERNPROC(nbp); BUF_STRATEGY(nbp); } else { - biodone(nbp); + bufdone(nbp); } } @@ -587,7 +587,7 @@ waitchainbuf(struct buf *bp, int count, int done) bp->b_ioflags |= BIO_ERROR; bp->b_error = EINVAL; } - biodone(bp); + bufdone(bp); } splx(s); } @@ -599,7 +599,7 @@ autochaindone(struct buf *bp) s = splbio(); if (bp->b_chain.count == 0) - biodone(bp); + bufdone(bp); else bp->b_flags |= B_AUTOCHAINDONE; splx(s); diff --git a/sys/vm/vm_swap.c b/sys/vm/vm_swap.c index 9df828f..d6d6f76 100644 --- a/sys/vm/vm_swap.c +++ b/sys/vm/vm_swap.c @@ -105,7 +105,7 @@ swapdev_strategy(ap) if (off + sz > dmmax) { bp->b_error = EINVAL; bp->b_ioflags |= BIO_ERROR; - biodone(bp); + bufdone(bp); return 0; } seg = bp->b_blkno / dmmax; @@ -119,14 +119,14 @@ swapdev_strategy(ap) if (bp->b_blkno + sz > sp->sw_nblks) { bp->b_error = EINVAL; bp->b_ioflags |= BIO_ERROR; - biodone(bp); + bufdone(bp); return 0; } bp->b_dev = sp->sw_device; if (sp->sw_vp == NULL) { bp->b_error = ENODEV; bp->b_ioflags |= BIO_ERROR; - biodone(bp); + bufdone(bp); return 0; } -- cgit v1.1