summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2007-06-04 16:38:59 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2007-06-04 16:38:59 +0000
commitac7cd85124b3e28b614613b705b9de6151dfbe59 (patch)
treef50126f6d6e8926112d2e0fdc7b0074855f3003b
parent76d293a011c9a855659a2bfdf5c969a95e9f7db8 (diff)
Bring presto's readdisklabel() usage into line with other uses. i.e.
don't call it at attach but at open, so that the correct device can be used in the DISKLABELDEV() invocation. Commit and get into miod's test schedule. '... commit your diff ...' miod@
-rw-r--r--sys/arch/sparc/dev/presto.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/arch/sparc/dev/presto.c b/sys/arch/sparc/dev/presto.c
index f79450dc536..17337f75072 100644
--- a/sys/arch/sparc/dev/presto.c
+++ b/sys/arch/sparc/dev/presto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: presto.c,v 1.7 2007/06/01 00:07:48 krw Exp $ */
+/* $OpenBSD: presto.c,v 1.8 2007/06/04 16:38:58 krw Exp $ */
/*
* Copyright (c) 2003, Miodrag Vallat.
* All rights reserved.
@@ -71,7 +71,7 @@ struct presto_softc {
void prestostrategy(struct buf *);
void presto_attach(struct device *, struct device *, void *);
-void presto_getdisklabel(struct presto_softc *);
+void presto_getdisklabel(dev_t, struct presto_softc *);
int presto_match(struct device *, void *, void *);
struct cfattach presto_ca = {
@@ -167,9 +167,6 @@ presto_attach(struct device *parent, struct device *self, void *args)
sc->sc_dk.dk_driver = &presto_dk;
sc->sc_dk.dk_name = sc->sc_dev.dv_xname;
disk_attach(&sc->sc_dk);
-
- /* read the disk label immediately */
- presto_getdisklabel(sc);
}
/*
@@ -216,6 +213,9 @@ prestoopen(dev_t dev, int flag, int fmt, struct proc *proc)
if (sc == NULL)
return (ENXIO);
+ /* read the disk label */
+ presto_getdisklabel(dev, sc);
+
/* only allow valid partitions */
part = DISKPART(dev);
if (part != RAW_PART &&
@@ -368,7 +368,7 @@ prestoioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *proc)
* Read the disklabel. If none is present, use a fictitious one instead.
*/
void
-presto_getdisklabel(struct presto_softc *sc)
+presto_getdisklabel(dev_t dev, struct presto_softc *sc)
{
struct disklabel *lp = sc->sc_dk.dk_label;
@@ -392,6 +392,6 @@ presto_getdisklabel(struct presto_softc *sc)
lp->d_magic2 = DISKMAGIC;
lp->d_checksum = dkcksum(lp);
- readdisklabel(DISKLABELDEV(sc->sc_dev.dv_unit), prestostrategy,
- sc->sc_dk.dk_label, sc->sc_dk.dk_cpulabel, 0);
+ readdisklabel(DISKLABELDEV(dev), prestostrategy, sc->sc_dk.dk_label,
+ sc->sc_dk.dk_cpulabel, 0);
}