Remove remaining 4.x compat shims. No resulting changes (verified by

md5).
This commit is contained in:
John Baldwin 2012-09-07 18:41:19 +00:00
parent 01361d6952
commit 51ba7b6f3e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=240209
4 changed files with 35 additions and 53 deletions

View File

@ -400,7 +400,7 @@ twe_startio(struct twe_softc *sc)
{
struct twe_request *tr;
TWE_Command *cmd;
twe_bio *bp;
struct bio *bp;
int error;
debug_called(4);
@ -431,10 +431,10 @@ twe_startio(struct twe_softc *sc)
/* connect the bio to the command */
tr->tr_complete = twe_completeio;
tr->tr_private = bp;
tr->tr_data = TWE_BIO_DATA(bp);
tr->tr_length = TWE_BIO_LENGTH(bp);
tr->tr_data = bp->bio_data;
tr->tr_length = bp->bio_bcount;
cmd = TWE_FIND_COMMAND(tr);
if (TWE_BIO_IS_READ(bp)) {
if (bp->bio_cmd == BIO_READ) {
tr->tr_flags |= TWE_CMD_DATAIN;
cmd->io.opcode = TWE_OP_READ;
} else {
@ -444,9 +444,9 @@ twe_startio(struct twe_softc *sc)
/* build a suitable I/O command (assumes 512-byte rounded transfers) */
cmd->io.size = 3;
cmd->io.unit = TWE_BIO_UNIT(bp);
cmd->io.unit = *(int *)(bp->bio_driver1);
cmd->io.block_count = (tr->tr_length + TWE_BLOCK_SIZE - 1) / TWE_BLOCK_SIZE;
cmd->io.lba = TWE_BIO_LBA(bp);
cmd->io.lba = bp->bio_pblkno;
}
/* did we find something to do? */
@ -461,8 +461,9 @@ twe_startio(struct twe_softc *sc)
break;
tr->tr_status = TWE_CMD_ERROR;
if (tr->tr_private != NULL) {
bp = (twe_bio *)(tr->tr_private);
TWE_BIO_SET_ERROR(bp, error);
bp = (struct bio *)(tr->tr_private);
bp->bio_error = error;
bp->bio_flags |= BIO_ERROR;
tr->tr_private = NULL;
twed_intr(bp);
twe_release_request(tr);
@ -1012,15 +1013,17 @@ twe_completeio(struct twe_request *tr)
{
TWE_Command *cmd = TWE_FIND_COMMAND(tr);
struct twe_softc *sc = tr->tr_sc;
twe_bio *bp = (twe_bio *)tr->tr_private;
struct bio *bp = tr->tr_private;
debug_called(4);
if (tr->tr_status == TWE_CMD_COMPLETE) {
if (cmd->generic.status)
if (twe_report_request(tr))
TWE_BIO_SET_ERROR(bp, EIO);
if (twe_report_request(tr)) {
bp->bio_error = EIO;
bp->bio_flags |= BIO_ERROR;
}
} else {
twe_panic(sc, "twe_completeio on incomplete command");

View File

@ -49,6 +49,7 @@
#include <sys/sysctl.h>
#include <sys/sx.h>
#include <sys/bio.h>
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/disk.h>
@ -61,6 +62,8 @@
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
#include <geom/geom_disk.h>
#define TWE_DRIVER_NAME twe
#define TWED_DRIVER_NAME twed
#define TWE_MALLOC_CLASS M_TWE
@ -108,27 +111,6 @@
#define twe_printf(sc, fmt, args...) device_printf(sc->twe_dev, fmt , ##args)
#define twed_printf(twed, fmt, args...) device_printf(twed->twed_dev, fmt , ##args)
# include <sys/bio.h>
# include <geom/geom_disk.h>
typedef struct bio twe_bio;
typedef struct bio_queue_head twe_bioq;
# define TWE_BIO_QINIT(bq) bioq_init(&bq);
# define TWE_BIO_QINSERT(bq, bp) bioq_insert_tail(&bq, bp)
# define TWE_BIO_QFIRST(bq) bioq_first(&bq)
# define TWE_BIO_QREMOVE(bq, bp) bioq_remove(&bq, bp)
# define TWE_BIO_IS_READ(bp) ((bp)->bio_cmd == BIO_READ)
# define TWE_BIO_DATA(bp) (bp)->bio_data
# define TWE_BIO_LENGTH(bp) (bp)->bio_bcount
# define TWE_BIO_LBA(bp) (bp)->bio_pblkno
# define TWE_BIO_SOFTC(bp) (bp)->bio_disk->d_drv1
# define TWE_BIO_UNIT(bp) *(int *)(bp->bio_driver1)
# define TWE_BIO_SET_ERROR(bp, err) do { (bp)->bio_error = err; (bp)->bio_flags |= BIO_ERROR;} while(0)
# define TWE_BIO_HAS_ERROR(bp) ((bp)->bio_flags & BIO_ERROR)
# define TWE_BIO_RESID(bp) (bp)->bio_resid
# define TWE_BIO_DONE(bp) biodone(bp)
# define TWE_BIO_STATS_START(bp)
# define TWE_BIO_STATS_END(bp)
#define TWE_IO_LOCK(sc) mtx_lock(&(sc)->twe_io_lock)
#define TWE_IO_UNLOCK(sc) mtx_unlock(&(sc)->twe_io_lock)
#define TWE_IO_ASSERT_LOCKED(sc) mtx_assert(&(sc)->twe_io_lock, MA_OWNED)

View File

@ -720,9 +720,9 @@ twed_open(struct disk *dp)
* Handle an I/O request.
*/
static void
twed_strategy(twe_bio *bp)
twed_strategy(struct bio *bp)
{
struct twed_softc *sc = (struct twed_softc *)TWE_BIO_SOFTC(bp);
struct twed_softc *sc = bp->bio_disk->d_drv1;
debug_called(4);
@ -731,16 +731,14 @@ twed_strategy(twe_bio *bp)
/* bogus disk? */
if (sc == NULL || sc->twed_drive->td_disk == NULL) {
TWE_BIO_SET_ERROR(bp, EINVAL);
bp->bio_error = EINVAL;
bp->bio_flags |= BIO_ERROR;
printf("twe: bio for invalid disk!\n");
TWE_BIO_DONE(bp);
biodone(bp);
TWED_BIO_OUT;
return;
}
/* perform accounting */
TWE_BIO_STATS_START(bp);
/* queue the bio on the controller */
TWE_IO_LOCK(sc->twed_controller);
twe_enqueue_bio(sc->twed_controller, bp);
@ -779,16 +777,15 @@ twed_dump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t l
* Handle completion of an I/O request.
*/
void
twed_intr(twe_bio *bp)
twed_intr(struct bio *bp)
{
debug_called(4);
/* if no error, transfer completed */
if (!TWE_BIO_HAS_ERROR(bp))
TWE_BIO_RESID(bp) = 0;
if (!(bp->bio_flags & BIO_ERROR))
bp->bio_resid = 0;
TWE_BIO_STATS_END(bp);
TWE_BIO_DONE(bp);
biodone(bp);
TWED_BIO_OUT;
}

View File

@ -114,7 +114,7 @@ struct twe_softc
{
/* controller queues and arrays */
TAILQ_HEAD(, twe_request) twe_free; /* command structures available for reuse */
twe_bioq twe_bioq; /* outstanding I/O operations */
struct bio_queue_head twe_bioq; /* outstanding I/O operations */
TAILQ_HEAD(, twe_request) twe_ready; /* requests ready for the controller */
TAILQ_HEAD(, twe_request) twe_busy; /* requests busy in the controller */
TAILQ_HEAD(, twe_request) twe_complete; /* active commands (busy or waiting for completion) */
@ -166,7 +166,7 @@ extern int twe_detach_drive(struct twe_softc *sc,
int unit); /* detach drive */
extern void twe_clear_pci_parity_error(struct twe_softc *sc);
extern void twe_clear_pci_abort(struct twe_softc *sc);
extern void twed_intr(twe_bio *bp); /* return bio from core */
extern void twed_intr(struct bio *bp); /* return bio from core */
extern struct twe_request *twe_allocate_request(struct twe_softc *sc, int tag); /* allocate request structure */
extern void twe_free_request(struct twe_request *tr); /* free request structure */
extern int twe_map_request(struct twe_request *tr); /* make request visible to controller, do s/g */
@ -249,24 +249,24 @@ TWEQ_REQUEST_QUEUE(complete, TWEQ_COMPLETE)
static __inline void
twe_initq_bio(struct twe_softc *sc)
{
TWE_BIO_QINIT(sc->twe_bioq);
bioq_init(&sc->twe_bioq);
TWEQ_INIT(sc, TWEQ_BIO);
}
static __inline void
twe_enqueue_bio(struct twe_softc *sc, twe_bio *bp)
twe_enqueue_bio(struct twe_softc *sc, struct bio *bp)
{
TWE_BIO_QINSERT(sc->twe_bioq, bp);
bioq_insert_tail(&sc->twe_bioq, bp);
TWEQ_ADD(sc, TWEQ_BIO);
}
static __inline twe_bio *
static __inline struct bio *
twe_dequeue_bio(struct twe_softc *sc)
{
twe_bio *bp;
struct bio *bp;
if ((bp = TWE_BIO_QFIRST(sc->twe_bioq)) != NULL) {
TWE_BIO_QREMOVE(sc->twe_bioq, bp);
if ((bp = bioq_first(&sc->twe_bioq)) != NULL) {
bioq_remove(&sc->twe_bioq, bp);
TWEQ_REMOVE(sc, TWEQ_BIO);
}
return(bp);