summaryrefslogtreecommitdiff
path: root/sys/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/cd.c16
-rw-r--r--sys/scsi/sd.c18
2 files changed, 15 insertions, 19 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c
index 64b8e7adc8a..01feb0726b2 100644
--- a/sys/scsi/cd.c
+++ b/sys/scsi/cd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd.c,v 1.148 2009/06/17 01:30:30 thib Exp $ */
+/* $OpenBSD: cd.c,v 1.149 2009/08/13 15:23:11 deraadt Exp $ */
/* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */
/*
@@ -96,7 +96,7 @@ int cddetach(struct device *, int);
void cdstart(void *);
void cdrestart(void *);
void cdminphys(struct buf *);
-void cdgetdisklabel(dev_t, struct cd_softc *, struct disklabel *, int);
+int cdgetdisklabel(dev_t, struct cd_softc *, struct disklabel *, int);
void cddone(struct scsi_xfer *);
void cd_kill_buffers(struct cd_softc *);
int cd_setchan(struct cd_softc *, int, int, int, int, int);
@@ -1118,12 +1118,11 @@ cdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
* EVENTUALLY take information about different
* data tracks from the TOC and put it in the disklabel
*/
-void
+int
cdgetdisklabel(dev_t dev, struct cd_softc *cd, struct disklabel *lp,
int spoofonly)
{
struct cd_toc *toc;
- char *errstring;
int tocidx, n, audioonly = 1;
bzero(lp, sizeof(struct disklabel));
@@ -1173,12 +1172,9 @@ cdgetdisklabel(dev_t dev, struct cd_softc *cd, struct disklabel *lp,
done:
free(toc, M_TEMP);
- if (!audioonly) {
- errstring = readdisklabel(DISKLABELDEV(dev), cdstrategy, lp,
- spoofonly);
- /*if (errstring)
- printf("%s: %s\n", cd->sc_dev.dv_xname, errstring);*/
- }
+ if (audioonly)
+ return (0);
+ return readdisklabel(DISKLABELDEV(dev), cdstrategy, lp, spoofonly);
}
int
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);
}