summaryrefslogtreecommitdiff
path: root/sys/scsi/sd.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2009-08-13 15:23:14 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2009-08-13 15:23:14 +0000
commitcf6459c8f783ece5445be14e8e2e7201f7cd6632 (patch)
treea5a86e9615b432c0d3ef13f965013ddf06ea6bff /sys/scsi/sd.c
parent46faf138ca97f0462a1c22674098875302fe10d0 (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/scsi/sd.c')
-rw-r--r--sys/scsi/sd.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index 8f9d44c4e6d..e74777e44f9 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.156 2009/06/17 01:30:30 thib Exp $ */
+/* $OpenBSD: sd.c,v 1.157 2009/08/13 15:23:11 deraadt Exp $ */
/* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */
/*-
@@ -81,7 +81,7 @@ int sdactivate(struct device *, enum devact);
int sddetach(struct device *, int);
void sdminphys(struct buf *);
-void sdgetdisklabel(dev_t, struct sd_softc *, struct disklabel *, int);
+int sdgetdisklabel(dev_t, struct sd_softc *, struct disklabel *, int);
void sdstart(void *);
void sdrestart(void *);
void sddone(struct scsi_xfer *);
@@ -398,7 +398,10 @@ sdopen(dev_t dev, int flag, int fmt, struct proc *p)
SC_DEBUG(sc_link, SDEV_DB3, ("Params loaded\n"));
/* Load the partition info if not already loaded. */
- sdgetdisklabel(dev, sd, sd->sc_dk.dk_label, 0);
+ if (sdgetdisklabel(dev, sd, sd->sc_dk.dk_label, 0) == EIO) {
+ error = EIO;
+ goto bad;
+ }
SC_DEBUG(sc_link, SDEV_DB3, ("Disklabel loaded\n"));
}
@@ -992,12 +995,12 @@ sd_ioctl_inquiry(struct sd_softc *sd, struct dk_inquiry *di)
/*
* Load the label information on the named device
*/
-void
+int
sdgetdisklabel(dev_t dev, struct sd_softc *sd, struct disklabel *lp,
int spoofonly)
{
size_t len;
- char *errstring, packname[sizeof(lp->d_packname) + 1];
+ char packname[sizeof(lp->d_packname) + 1];
char product[17], vendor[9];
bzero(lp, sizeof(struct disklabel));
@@ -1057,10 +1060,7 @@ sdgetdisklabel(dev_t dev, struct sd_softc *sd, struct disklabel *lp,
/*
* Call the generic disklabel extraction routine
*/
- errstring = readdisklabel(DISKLABELDEV(dev), sdstrategy, lp, spoofonly);
- if (errstring) {
- /*printf("%s: %s\n", sd->sc_dev.dv_xname, errstring);*/
- }
+ return readdisklabel(DISKLABELDEV(dev), sdstrategy, lp, spoofonly);
}