From f90c382c0c6c8b94d43903c8df4b52b4574fadd8 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Fri, 20 Sep 2002 12:52:03 +0000 Subject: Make FreeBSD "struct disklabel" agnostic, step 311 of 723: Rename diskerr() to disk_err() for naming consistency. Drop the by now entirely useless struct disklabel argument. Add a flag argument for new-line termination. Fix a couple of printf-format-casts to %j instead of %l. Correctly print the name of all bio commands. Move the function from subr_disklabel.c to subr_disk.c, and from to . Use the new disk_err() throughout, #include as needed. Bump __FreeBSD_version for the sake of the aac disk drivers #ifdefs. Remove unused disklabel members of softc for aac, amr and mlx, which seem to originally have been intended for diskerr() use, but which only rotted and got Copy&Pasted at least two times to many. Sponsored by: DARPA & NAI Labs. --- sys/dev/aac/aac_disk.c | 8 ++++++-- sys/dev/aac/aacvar.h | 1 - sys/dev/amr/amrvar.h | 1 - sys/dev/ata/ata-disk.c | 10 ++++------ sys/dev/fdc/fdc.c | 5 +++-- sys/dev/mlx/mlxvar.h | 1 - 6 files changed, 13 insertions(+), 13 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/aac/aac_disk.c b/sys/dev/aac/aac_disk.c index 000d8415f8f7..91ceee0985a8 100644 --- a/sys/dev/aac/aac_disk.c +++ b/sys/dev/aac/aac_disk.c @@ -305,7 +305,6 @@ void aac_biodone(struct bio *bp) { struct aac_disk *sc; - int blkno; debug_called(4); @@ -313,10 +312,15 @@ aac_biodone(struct bio *bp) devstat_end_transaction_bio(&sc->ad_stats, bp); if (bp->bio_flags & BIO_ERROR) { +#if __FreeBSD_version > 500039 + disk_err(bp, "hard error", -1, 1); +#elif __FreeBSD_version > 500005 + int blkno; blkno = (sc->ad_label.d_nsectors) ? 0 : -1; -#if __FreeBSD_version > 500005 diskerr(bp, (char *)bp->bio_driver1, blkno, &sc->ad_label); #else + int blkno; + blkno = (sc->ad_label.d_nsectors) ? 0 : -1; diskerr(bp, (char *)bp->bio_driver1, 0, blkno, &sc->ad_label); #endif } diff --git a/sys/dev/aac/aacvar.h b/sys/dev/aac/aacvar.h index d82f29edda64..0f615f10944c 100644 --- a/sys/dev/aac/aacvar.h +++ b/sys/dev/aac/aacvar.h @@ -120,7 +120,6 @@ struct aac_disk struct aac_container *ad_container; struct disk ad_disk; struct devstat ad_stats; - struct disklabel ad_label; int ad_flags; #define AAC_DISK_OPEN (1<<0) int ad_cylinders; diff --git a/sys/dev/amr/amrvar.h b/sys/dev/amr/amrvar.h index 4436b3c60584..ad08b67c5864 100644 --- a/sys/dev/amr/amrvar.h +++ b/sys/dev/amr/amrvar.h @@ -223,7 +223,6 @@ struct amrd_softc struct amr_logdrive *amrd_drive; struct disk amrd_disk; struct devstat amrd_stats; - struct disklabel amrd_label; int amrd_unit; int amrd_flags; #define AMRD_OPEN (1<<0) /* drive is open (can't detach) */ diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index 1211e0ad0494..b4a86562b387 100644 --- a/sys/dev/ata/ata-disk.c +++ b/sys/dev/ata/ata-disk.c @@ -563,19 +563,17 @@ ad_interrupt(struct ad_request *request) /* do we have a corrected soft error ? */ if (adp->device->channel->status & ATA_S_CORR) - diskerr(request->bp, "soft error (ECC corrected)", - request->blockaddr + (request->donecount / DEV_BSIZE), - &adp->disk.d_label); + disk_err(request->bp, "soft error (ECC corrected)", + request->blockaddr + (request->donecount / DEV_BSIZE), 1); /* did any real errors happen ? */ if ((adp->device->channel->status & ATA_S_ERROR) || (request->flags & ADR_F_DMA_USED && dma_stat & ATA_BMSTAT_ERROR)) { adp->device->channel->error = ATA_INB(adp->device->channel->r_io, ATA_ERROR); - diskerr(request->bp, (adp->device->channel->error & ATA_E_ICRC) ? + disk_err(request->bp, (adp->device->channel->error & ATA_E_ICRC) ? "UDMA ICRC error" : "hard error", - request->blockaddr + (request->donecount / DEV_BSIZE), - &adp->disk.d_label); + request->blockaddr + (request->donecount / DEV_BSIZE), 1); /* if this is a UDMA CRC error, reinject request */ if (request->flags & ADR_F_DMA_USED && diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index 8c94574b80b1..5e4d3812ba8a 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -62,6 +62,7 @@ #include #include #include +#include #include #include #include @@ -2512,8 +2513,8 @@ retrier(struct fdc_data *fdc) default: fail: if ((fd->options & FDOPT_NOERRLOG) == 0) { - diskerr(bp, "hard error", fdc->fd->skip / DEV_BSIZE, - (struct disklabel *)NULL); + disk_err(bp, "hard error", + fdc->fd->skip / DEV_BSIZE, 0); if (fdc->flags & FDC_STAT_VALID) { printf( " (ST0 %b ST1 %b ST2 %b cyl %u hd %u sec %u)\n", diff --git a/sys/dev/mlx/mlxvar.h b/sys/dev/mlx/mlxvar.h index 84dad18eb403..f5b68e53afa9 100644 --- a/sys/dev/mlx/mlxvar.h +++ b/sys/dev/mlx/mlxvar.h @@ -230,7 +230,6 @@ struct mlxd_softc struct mlx_sysdrive *mlxd_drive; struct disk mlxd_disk; struct devstat mlxd_stats; - struct disklabel mlxd_label; int mlxd_unit; int mlxd_flags; #define MLXD_OPEN (1<<0) /* drive is open (can't shut down) */ -- cgit v1.3