Make diskerr() always log with printf.

This commit is contained in:
Poul-Henning Kamp 2000-11-26 19:29:15 +00:00
parent a1bb9fabb1
commit cb7e609a3c
11 changed files with 23 additions and 32 deletions

View File

@ -2224,8 +2224,7 @@ retrier(struct fdc_data *fdc)
/* Trick diskerr */
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,
diskerr(bp, "hard error", fdc->fd->skip / DEV_BSIZE,
(struct disklabel *)NULL);
bp->bio_dev = sav_bio_dev;
if (fdc->flags & FDC_STAT_VALID)

View File

@ -2224,8 +2224,7 @@ retrier(struct fdc_data *fdc)
/* Trick diskerr */
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,
diskerr(bp, "hard error", fdc->fd->skip / DEV_BSIZE,
(struct disklabel *)NULL);
bp->bio_dev = sav_bio_dev;
if (fdc->flags & FDC_STAT_VALID)

View File

@ -332,43 +332,36 @@ hp0g: hard error reading fsbn 12345 of 12344-12347 (hp0 bn %d cn %d tn %d sn %d)
* if the offset of the error in the transfer and a disk label
* are both available. blkdone should be -1 if the position of the error
* is unknown; the disklabel pointer may be null from drivers that have not
* been converted to use them. The message is printed with printf
* if pri is LOG_PRINTF, otherwise it uses log at the specified priority.
* The message should be completed (with at least a newline) with printf
* or addlog, respectively. There is no trailing space.
* been converted to use them. The message is printed with printf.
* The message should be completed with at least a newline. There is no
* trailing space.
*/
void
diskerr(bp, what, pri, blkdone, lp)
diskerr(bp, what, blkdone, lp)
struct bio *bp;
char *what;
int pri, blkdone;
int blkdone;
register struct disklabel *lp;
{
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;
daddr_t sn;
if (pri != LOG_PRINTF) {
log(pri, "%s", "");
pr = addlog;
} else
pr = printf;
sname = dsname(bp->bio_dev, unit, slice, part, partname);
(*pr)("%s%s: %s %sing fsbn ", sname, partname, what,
printf("%s%s: %s %sing fsbn ", sname, partname, what,
bp->bio_cmd == BIO_READ ? "read" : "writ");
sn = bp->bio_blkno;
if (bp->bio_bcount <= DEV_BSIZE)
(*pr)("%ld", (long)sn);
printf("%ld", (long)sn);
else {
if (blkdone >= 0) {
sn += blkdone;
(*pr)("%ld of ", (long)sn);
printf("%ld of ", (long)sn);
}
(*pr)("%ld-%ld", (long)bp->bio_blkno,
printf("%ld-%ld", (long)bp->bio_blkno,
(long)(bp->bio_blkno + (bp->bio_bcount - 1) / DEV_BSIZE));
}
if (lp && (blkdone >= 0 || bp->bio_bcount <= lp->d_secsize)) {
@ -383,10 +376,10 @@ diskerr(bp, what, pri, blkdone, lp)
* independent of slices, labels and bad sector remapping,
* but some drivers don't set bp->b_pblkno.
*/
(*pr)(" (%s bn %ld; cn %ld", sname, (long)sn,
printf(" (%s bn %ld; cn %ld", sname, (long)sn,
(long)(sn / lp->d_secpercyl));
sn %= (long)lp->d_secpercyl;
(*pr)(" tn %ld sn %ld)", (long)(sn / lp->d_nsectors),
printf(" tn %ld sn %ld)", (long)(sn / lp->d_nsectors),
(long)(sn % lp->d_nsectors));
}
}

View File

@ -192,7 +192,7 @@ reread_mbr:
DEV_STRATEGY(bp, 1);
if (bufwait(bp) != 0) {
diskerr(&bp->b_io, "reading primary partition table: error",
LOG_PRINTF, 0, (struct disklabel *)NULL);
0, (struct disklabel *)NULL);
printf("\n");
error = EIO;
goto done;
@ -408,7 +408,7 @@ mbr_extended(dev, lp, ssp, ext_offset, ext_size, base_ext_offset, nsectors,
DEV_STRATEGY(bp, 1);
if (bufwait(bp) != 0) {
diskerr(&bp->b_io, "reading extended partition table: error",
LOG_PRINTF, 0, (struct disklabel *)NULL);
0, (struct disklabel *)NULL);
printf("\n");
goto done;
}

View File

@ -2665,7 +2665,7 @@ retrier(struct fdc_data *fdc)
/* Trick diskerr */
bp->bio_dev = makedev(major(bp->bio_dev),
(FDUNIT(minor(bp->bio_dev))<<3)|RAW_PART);
diskerr(bp, "hard error", LOG_PRINTF,
diskerr(bp, "hard error",
fdc->fd->skip / DEV_BSIZE,
(struct disklabel *)NULL);
bp->bio_dev = sav_bio_dev;

View File

@ -252,7 +252,7 @@ reread_mbr:
DEV_STRATEGY(bp, 1);
if (bufwait(bp) != 0) {
diskerr(&bp->b_io, "reading primary partition table: error",
LOG_PRINTF, 0, (struct disklabel *)NULL);
0, (struct disklabel *)NULL);
printf("\n");
error = EIO;
goto done;
@ -553,7 +553,7 @@ mbr_extended(dev, lp, ssp, ext_offset, ext_size, base_ext_offset, nsectors,
BUF_STRATEGY(bp, 1);
if (bufwait(bp) != 0) {
diskerr(bp, "reading extended partition table: error",
LOG_PRINTF, 0, (struct disklabel *)NULL);
0, (struct disklabel *)NULL);
printf("\n");
goto done;
}

View File

@ -2665,7 +2665,7 @@ retrier(struct fdc_data *fdc)
/* Trick diskerr */
bp->bio_dev = makedev(major(bp->bio_dev),
(FDUNIT(minor(bp->bio_dev))<<3)|RAW_PART);
diskerr(bp, "hard error", LOG_PRINTF,
diskerr(bp, "hard error",
fdc->fd->skip / DEV_BSIZE,
(struct disklabel *)NULL);
bp->bio_dev = sav_bio_dev;

View File

@ -1880,7 +1880,7 @@ wderror(struct bio *bp, struct softc *du, char *mesg)
if (bp == NULL)
printf("wd%d: %s", du->dk_lunit, mesg);
else
diskerr(bp, mesg, LOG_PRINTF, du->dk_skip,
diskerr(bp, mesg, du->dk_skip,
dsgetlabel(bp->bio_dev, du->dk_slices));
printf(" (status %b error %b)\n",
du->dk_status, WDCS_BITS, du->dk_error, WDERR_BITS);

View File

@ -459,7 +459,7 @@ struct bio_queue_head;
int bounds_check_with_label __P((struct bio *bp, struct disklabel *lp,
int wlabel));
void diskerr __P((struct bio *bp, char *what, int pri, int blkdone,
void diskerr __P((struct bio *bp, char *what, int blkdone,
struct disklabel *lp));
void disksort __P((struct buf *ap, struct buf *bp));
char *readdisklabel __P((dev_t dev, struct disklabel *lp));

View File

@ -459,7 +459,7 @@ struct bio_queue_head;
int bounds_check_with_label __P((struct bio *bp, struct disklabel *lp,
int wlabel));
void diskerr __P((struct bio *bp, char *what, int pri, int blkdone,
void diskerr __P((struct bio *bp, char *what, int blkdone,
struct disklabel *lp));
void disksort __P((struct buf *ap, struct buf *bp));
char *readdisklabel __P((dev_t dev, struct disklabel *lp));

View File

@ -459,7 +459,7 @@ struct bio_queue_head;
int bounds_check_with_label __P((struct bio *bp, struct disklabel *lp,
int wlabel));
void diskerr __P((struct bio *bp, char *what, int pri, int blkdone,
void diskerr __P((struct bio *bp, char *what, int blkdone,
struct disklabel *lp));
void disksort __P((struct buf *ap, struct buf *bp));
char *readdisklabel __P((dev_t dev, struct disklabel *lp));