summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-01-04 08:50:26 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-01-04 08:50:26 +0000
commitbaccd07aab4c2be8288de93d65b05876980f47b9 (patch)
tree99626972edc13fabc90044bc614afd8a14764e7d /sys/dev
parente27d09bdbdf823a38f32fd8f43c2ae5adfcc4f1f (diff)
readdisklabel() with correct dev_t
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/isa/mcd.c15
-rw-r--r--sys/dev/isa/wd.c17
-rw-r--r--sys/dev/vnd.c16
3 files changed, 28 insertions, 20 deletions
diff --git a/sys/dev/isa/mcd.c b/sys/dev/isa/mcd.c
index 64ec2eee784..3436a03642e 100644
--- a/sys/dev/isa/mcd.c
+++ b/sys/dev/isa/mcd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mcd.c,v 1.18 1996/12/05 13:15:28 deraadt Exp $ */
+/* $OpenBSD: mcd.c,v 1.19 1997/01/04 08:50:25 deraadt Exp $ */
/* $NetBSD: mcd.c,v 1.49 1996/05/12 23:53:11 mycroft Exp $ */
/*
@@ -92,6 +92,8 @@
#define MCDUNIT(dev) DISKUNIT(dev)
#define MAKEMCDDEV(maj, unit, part) MAKEDISKDEV(maj, unit, part)
+#define MCDLABELDEV(dev) (MAKEMCDDEV(major(dev), MCDUNIT(dev), RAW_PART))
+
/* toc */
#define MCD_MAXTOCS 104 /* from the Linux driver */
@@ -191,7 +193,7 @@ struct cfdriver mcd_cd = {
NULL, "mcd", DV_DISK
};
-void mcdgetdisklabel __P((struct mcd_softc *));
+void mcdgetdisklabel __P((dev_t, struct mcd_softc *));
int mcd_get_parms __P((struct mcd_softc *));
void mcdstrategy __P((struct buf *));
void mcdstart __P((struct mcd_softc *));
@@ -341,7 +343,7 @@ mcdopen(dev, flag, fmt, p)
goto bad2;
/* Fabricate a disk label. */
- mcdgetdisklabel(sc);
+ mcdgetdisklabel(dev, sc);
}
}
@@ -676,7 +678,8 @@ mcdioctl(dev, cmd, addr, flag, p)
* whether the scsi cd driver is linked in.
*/
void
-mcdgetdisklabel(sc)
+mcdgetdisklabel(dev, sc)
+ dev_t dev;
struct mcd_softc *sc;
{
struct disklabel *lp = sc->sc_dk.dk_label;
@@ -716,8 +719,8 @@ mcdgetdisklabel(sc)
/*
* Call the generic disklabel extraction routine
*/
- errstring = readdisklabel(MAKEMCDDEV(0, sc->sc_dev.dv_unit, RAW_PART),
- mcdstrategy, lp, sc->sc_dk.dk_cpulabel);
+ errstring = readdisklabel(MCDLABELDEV(dev), mcdstrategy, lp,
+ sc->sc_dk.dk_cpulabel);
if (errstring) {
printf("%s: %s\n", sc->sc_dev.dv_xname, errstring);
return;
diff --git a/sys/dev/isa/wd.c b/sys/dev/isa/wd.c
index 9eabee7e782..3858438158f 100644
--- a/sys/dev/isa/wd.c
+++ b/sys/dev/isa/wd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wd.c,v 1.23 1996/11/29 22:55:08 niklas Exp $ */
+/* $OpenBSD: wd.c,v 1.24 1997/01/04 08:50:24 deraadt Exp $ */
/* $NetBSD: wd.c,v 1.150 1996/05/12 23:54:03 mycroft Exp $ */
/*
@@ -92,7 +92,7 @@ struct cfdriver wd_cd = {
NULL, "wd", DV_DISK
};
-void wdgetdisklabel __P((struct wd_softc *));
+void wdgetdisklabel __P((dev_t, struct wd_softc *));
int wd_get_parms __P((struct wd_softc *));
void wdstrategy __P((struct buf *));
@@ -433,7 +433,7 @@ wdopen(dev, flag, fmt, p)
}
/* Load the partition info if not already loaded. */
- wdgetdisklabel(wd);
+ wdgetdisklabel(dev, wd);
}
}
@@ -508,7 +508,8 @@ wdclose(dev, flag, fmt, p)
* Fabricate a default disk label, and try to read the correct one.
*/
void
-wdgetdisklabel(wd)
+wdgetdisklabel(dev, wd)
+ dev_t dev;
struct wd_softc *wd;
{
struct disklabel *lp = wd->sc_dk.dk_label;
@@ -550,8 +551,8 @@ wdgetdisklabel(wd)
if (d_link->sc_state > RECAL)
d_link->sc_state = RECAL;
- errstring = readdisklabel(MAKEWDDEV(0, wd->sc_dev.dv_unit, RAW_PART),
- wdstrategy, lp, wd->sc_dk.dk_cpulabel);
+ errstring = readdisklabel(WDLABELDEV(dev), wdstrategy, lp,
+ wd->sc_dk.dk_cpulabel);
if (errstring) {
/*
* This probably happened because the drive's default
@@ -561,8 +562,8 @@ wdgetdisklabel(wd)
*/
if (d_link->sc_state > GEOMETRY)
d_link->sc_state = GEOMETRY;
- errstring = readdisklabel(MAKEWDDEV(0, wd->sc_dev.dv_unit, RAW_PART),
- wdstrategy, lp, wd->sc_dk.dk_cpulabel);
+ errstring = readdisklabel(WDLABELDEV(dev), wdstrategy, lp,
+ wd->sc_dk.dk_cpulabel);
}
if (errstring) {
printf("%s: %s\n", wd->sc_dev.dv_xname, errstring);
diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c
index 1a70e51bb0d..1cb5a70d445 100644
--- a/sys/dev/vnd.c
+++ b/sys/dev/vnd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vnd.c,v 1.7 1996/12/21 05:21:13 deraadt Exp $ */
+/* $OpenBSD: vnd.c,v 1.8 1997/01/04 08:50:22 deraadt Exp $ */
/* $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $ */
/*
@@ -95,6 +95,9 @@ int vnddebug = 0x00;
#define b_cylin b_resid
#define vndunit(x) DISKUNIT(x)
+#define MAKEVNDDEV(maj, unit, part) MAKEDISKDEV(maj, unit, part)
+
+#define VNDLABELDEV(dev) (MAKEVNDDEV(major(dev), vndunit(dev), RAW_PART))
struct vndbuf {
struct buf vb_buf;
@@ -141,7 +144,7 @@ int vndsetcred __P((struct vnd_softc *, struct ucred *));
void vndthrottle __P((struct vnd_softc *, struct vnode *));
void vndiodone __P((struct buf *));
void vndshutdown __P((void));
-void vndgetdisklabel __P((struct vnd_softc *));
+void vndgetdisklabel __P((dev_t, struct vnd_softc *));
static int vndlock __P((struct vnd_softc *));
static void vndunlock __P((struct vnd_softc *));
@@ -189,7 +192,7 @@ vndopen(dev, flags, mode, p)
if ((sc->sc_flags & VNF_INITED) && (sc->sc_flags & VNF_HAVELABEL) == 0) {
sc->sc_flags |= VNF_HAVELABEL;
- vndgetdisklabel(sc);
+ vndgetdisklabel(dev, sc);
}
part = DISKPART(dev);
@@ -228,7 +231,8 @@ bad:
* Load the label information on the named device
*/
void
-vndgetdisklabel(sc)
+vndgetdisklabel(dev, sc)
+ dev_t dev;
struct vnd_softc *sc;
{
struct disklabel *lp = sc->sc_dk.dk_label;
@@ -268,8 +272,8 @@ vndgetdisklabel(sc)
/*
* Call the generic disklabel extraction routine
*/
- errstring = readdisklabel(MAKEDISKDEV(0, sc->sc_dev.dv_unit, RAW_PART),
- vndstrategy, lp, sc->sc_dk.dk_cpulabel);
+ errstring = readdisklabel(VNDLABELDEV(dev), vndstrategy, lp,
+ sc->sc_dk.dk_cpulabel);
if (errstring) {
printf("%s: %s\n", sc->sc_dev.dv_xname, errstring);
return;