diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-08-13 15:23:14 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-08-13 15:23:14 +0000 |
commit | cf6459c8f783ece5445be14e8e2e7201f7cd6632 (patch) | |
tree | a5a86e9615b432c0d3ef13f965013ddf06ea6bff /sys/dev/ata/wd.c | |
parent | 46faf138ca97f0462a1c22674098875302fe10d0 (diff) |
Replace the error strings that were being passed around with much simpler
errnos. Note that the error strings are being ignored, since we long ago
decided to not spam the console, and there is no other nice way to use the
errors (without changing the ioctls to pass it back)
The errno is now useful, since we can pass b_error from failing IO up, and
the drive can decide how to use that
ok miod
Diffstat (limited to 'sys/dev/ata/wd.c')
-rw-r--r-- | sys/dev/ata/wd.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c index b70a68ba61e..40558d85d74 100644 --- a/sys/dev/ata/wd.c +++ b/sys/dev/ata/wd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wd.c,v 1.75 2009/06/17 01:30:30 thib Exp $ */ +/* $OpenBSD: wd.c,v 1.76 2009/08/13 15:23:12 deraadt Exp $ */ /* $NetBSD: wd.c,v 1.193 1999/02/28 17:15:27 explorer Exp $ */ /* @@ -169,7 +169,7 @@ struct cfdriver wd_cd = { }; void wdgetdefaultlabel(struct wd_softc *, struct disklabel *); -void wdgetdisklabel(dev_t dev, struct wd_softc *, struct disklabel *, int); +int wdgetdisklabel(dev_t dev, struct wd_softc *, struct disklabel *, int); void wdstrategy(struct buf *); void wdstart(void *); void __wdstart(struct wd_softc*, struct buf *); @@ -703,7 +703,11 @@ wdopen(dev_t dev, int flag, int fmt, struct proc *p) wd_get_params(wd, AT_WAIT, &wd->sc_params); /* Load the partition info if not already loaded. */ - wdgetdisklabel(dev, wd, wd->sc_dk.dk_label, 0); + if (wdgetdisklabel(dev, wd, + wd->sc_dk.dk_label, 0) == EIO) { + error = EIO; + goto bad; + } } } @@ -816,11 +820,11 @@ wdgetdefaultlabel(struct wd_softc *wd, struct disklabel *lp) /* * Fabricate a default disk label, and try to read the correct one. */ -void +int wdgetdisklabel(dev_t dev, struct wd_softc *wd, struct disklabel *lp, int spoofonly) { - char *errstring; + int error; WDCDEBUG_PRINT(("wdgetdisklabel\n"), DEBUG_FUNCS); @@ -828,13 +832,11 @@ wdgetdisklabel(dev_t dev, struct wd_softc *wd, struct disklabel *lp, if (wd->drvp->state > RECAL) wd->drvp->drive_flags |= DRIVE_RESET; - errstring = readdisklabel(DISKLABELDEV(dev), wdstrategy, lp, + error = readdisklabel(DISKLABELDEV(dev), wdstrategy, lp, spoofonly); if (wd->drvp->state > RECAL) wd->drvp->drive_flags |= DRIVE_RESET; - if (errstring) { - /*printf("%s: %s\n", wd->sc_dev.dv_xname, errstring);*/ - } + return (error); } int |