summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r--sys/arch/sparc64/dev/fd.c13
-rw-r--r--sys/arch/sparc64/sparc64/disksubr.c38
2 files changed, 22 insertions, 29 deletions
diff --git a/sys/arch/sparc64/dev/fd.c b/sys/arch/sparc64/dev/fd.c
index f7ea60ad2e9..d326a7bfcd2 100644
--- a/sys/arch/sparc64/dev/fd.c
+++ b/sys/arch/sparc64/dev/fd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fd.c,v 1.27 2009/07/24 08:07:39 blambert Exp $ */
+/* $OpenBSD: fd.c,v 1.28 2009/08/13 15:23:12 deraadt Exp $ */
/* $NetBSD: fd.c,v 1.112 2003/08/07 16:29:35 agc Exp $ */
/*-
@@ -283,7 +283,7 @@ struct cfdriver fd_cd = {
NULL, "fd", DV_DISK
};
-void fdgetdisklabel(dev_t, struct fd_softc *, struct disklabel *, int);
+int fdgetdisklabel(dev_t, struct fd_softc *, struct disklabel *, int);
int fd_get_parms(struct fd_softc *);
void fdstrategy(struct buf *);
void fdstart(struct fd_softc *);
@@ -2007,12 +2007,10 @@ fdformat(dev, finfo, p)
return (rv);
}
-void
+int
fdgetdisklabel(dev_t dev, struct fd_softc *fd, struct disklabel *lp,
int spoofonly)
{
- char *errstring;
-
bzero(lp, sizeof(struct disklabel));
lp->d_type = DTYPE_FLOPPY;
@@ -2037,10 +2035,7 @@ fdgetdisklabel(dev_t dev, struct fd_softc *fd, struct disklabel *lp,
* Call the generic disklabel extraction routine. If there's
* not a label there, fake it.
*/
- errstring = readdisklabel(DISKLABELDEV(dev), fdstrategy, lp, spoofonly);
- if (errstring) {
- /*printf("%s: %s\n", fd->sc_dv.dv_xname, errstring);*/
- }
+ return readdisklabel(DISKLABELDEV(dev), fdstrategy, lp, spoofonly);
}
void
diff --git a/sys/arch/sparc64/sparc64/disksubr.c b/sys/arch/sparc64/sparc64/disksubr.c
index 5c210d13284..50b1d0508f0 100644
--- a/sys/arch/sparc64/sparc64/disksubr.c
+++ b/sys/arch/sparc64/sparc64/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.56 2009/06/04 21:13:02 deraadt Exp $ */
+/* $OpenBSD: disksubr.c,v 1.57 2009/08/13 15:23:11 deraadt Exp $ */
/* $NetBSD: disksubr.c,v 1.13 2000/12/17 22:39:18 pk Exp $ */
/*
@@ -39,7 +39,7 @@
#include "cd.h"
-static char *disklabel_sun_to_bsd(struct sun_disklabel *, struct disklabel *);
+static int disklabel_sun_to_bsd(struct sun_disklabel *, struct disklabel *);
static int disklabel_bsd_to_sun(struct disklabel *, struct sun_disklabel *);
static __inline u_int sun_extended_sum(struct sun_disklabel *, void *);
@@ -59,15 +59,15 @@ extern void cdstrategy(struct buf *);
*
* Returns null on success and an error string on failure.
*/
-char *
+int
readdisklabel(dev_t dev, void (*strat)(struct buf *),
struct disklabel *lp, int spoofonly)
{
struct sun_disklabel *slp;
struct buf *bp = NULL;
- char *msg;
+ int error;
- if ((msg = initdisklabel(lp)))
+ if ((error = initdisklabel(lp)))
goto done;
lp->d_flags |= D_VENDOR;
@@ -102,37 +102,35 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *),
bp->b_flags = B_BUSY | B_READ | B_RAW;
(*strat)(bp);
if (biowait(bp)) {
- msg = "disk label read error";
+ error = bp->b_error;
goto done;
}
slp = (struct sun_disklabel *)bp->b_data;
if (slp->sl_magic == SUN_DKMAGIC) {
- msg = disklabel_sun_to_bsd(slp, lp);
+ error = disklabel_sun_to_bsd(slp, lp);
goto done;
}
- msg = checkdisklabel(bp->b_data + LABELOFFSET, lp, 0, DL_GETDSIZE(lp));
- if (msg == NULL)
+ error = checkdisklabel(bp->b_data + LABELOFFSET, lp, 0, DL_GETDSIZE(lp));
+ if (error == 0)
goto done;
doslabel:
- msg = readdoslabel(bp, strat, lp, NULL, spoofonly);
- if (msg == NULL)
+ error = readdoslabel(bp, strat, lp, NULL, spoofonly);
+ if (error == 0)
goto done;
/* A CD9660/UDF label may be on a non-CD drive, so recheck */
#if defined(CD9660)
- if (iso_disklabelspoof(dev, strat, lp) == 0) {
- msg = NULL;
+ error = iso_disklabelspoof(dev, strat, lp);
+ if (error == 0)
goto done;
- }
#endif
#if defined(UDF)
- if (udf_disklabelspoof(dev, strat, lp) == 0) {
- msg = NULL;
+ error = udf_disklabelspoof(dev, strat, lp);
+ if (error == 0)
goto done;
- }
#endif
done:
@@ -140,7 +138,7 @@ done:
bp->b_flags |= B_INVAL;
brelse(bp);
}
- return (msg);
+ return (error);
}
/*
@@ -227,7 +225,7 @@ sun_extended_sum(struct sun_disklabel *sl, void *end)
*
* The BSD label is cleared out before this is called.
*/
-static char *
+static int
disklabel_sun_to_bsd(struct sun_disklabel *sl, struct disklabel *lp)
{
struct sun_preamble *preamble = (struct sun_preamble *)sl;
@@ -243,7 +241,7 @@ disklabel_sun_to_bsd(struct sun_disklabel *sl, struct disklabel *lp)
while (sp1 < sp2)
cksum ^= *sp1++;
if (cksum != 0)
- return ("SunOS disk label, bad checksum");
+ return (EINVAL); /* SunOS disk label, bad checksum */
/* Format conversion. */
lp->d_magic = DISKMAGIC;