summaryrefslogtreecommitdiff
path: root/sys/arch/sparc
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2010-09-22 06:40:26 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2010-09-22 06:40:26 +0000
commit83018e34c552b5700c5ac28bf696aaa3a17bd340 (patch)
treeee30239a31556afdfeeb9b96973a4e7477ac1abf /sys/arch/sparc
parente691fb7bf4efc5936e953f3fbb2989323614af79 (diff)
Add DIOCGPDINFO to drivers that were lacking it. Where there
is no easily available physical information outside of the stored disklabel just make it a synonym for DIOCGDINFO. Commit on the theory it is unlikely to harm, and fallout can be addressed in the mass re-compile that will follow j2k10. Should allow auto-allocation of disks to work with all devices. ok deraadt@
Diffstat (limited to 'sys/arch/sparc')
-rw-r--r--sys/arch/sparc/dev/presto.c17
-rw-r--r--sys/arch/sparc/dev/xd.c3
-rw-r--r--sys/arch/sparc/dev/xy.c3
3 files changed, 14 insertions, 9 deletions
diff --git a/sys/arch/sparc/dev/presto.c b/sys/arch/sparc/dev/presto.c
index cfdf91d664c..c9e7e01deb3 100644
--- a/sys/arch/sparc/dev/presto.c
+++ b/sys/arch/sparc/dev/presto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: presto.c,v 1.19 2010/09/22 01:18:57 matthew Exp $ */
+/* $OpenBSD: presto.c,v 1.20 2010/09/22 06:40:25 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(dev_t, struct presto_softc *);
+void presto_getdisklabel(dev_t, struct presto_softc *, struct disklabel *, int);
int presto_match(struct device *, void *, void *);
struct cfattach presto_ca = {
@@ -209,7 +209,7 @@ prestoopen(dev_t dev, int flag, int fmt, struct proc *proc)
return (ENXIO);
/* read the disk label */
- presto_getdisklabel(dev, sc);
+ presto_getdisklabel(dev, sc, sc->sc_dk.dk_label, 0);
/* only allow valid partitions */
part = DISKPART(dev);
@@ -324,6 +324,10 @@ prestoioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *proc)
sc = (struct presto_softc *)device_lookup(&presto_cd, unit);
switch (cmd) {
+ case DIOCGPDINFO:
+ presto_getdisklabel(dev, sc, (struct disklabel *)data, 1);
+ break;
+
case DIOCGDINFO:
bcopy(sc->sc_dk.dk_label, data, sizeof(struct disklabel));
return (0);
@@ -351,10 +355,9 @@ 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(dev_t dev, struct presto_softc *sc)
+presto_getdisklabel(dev_t dev, struct presto_softc *sc, struct disklabel *lp,
+ int spoofonly);
{
- struct disklabel *lp = sc->sc_dk.dk_label;
-
bzero(sc->sc_dk.dk_label, sizeof(struct disklabel));
lp->d_secsize = DEV_BSIZE;
@@ -373,5 +376,5 @@ presto_getdisklabel(dev_t dev, struct presto_softc *sc)
lp->d_magic2 = DISKMAGIC;
lp->d_checksum = dkcksum(lp);
- readdisklabel(DISKLABELDEV(dev), prestostrategy, sc->sc_dk.dk_label, 0);
+ readdisklabel(DISKLABELDEV(dev), prestostrategy, lp, spoofonly);
}
diff --git a/sys/arch/sparc/dev/xd.c b/sys/arch/sparc/dev/xd.c
index befdf6bfb83..c61b96affc5 100644
--- a/sys/arch/sparc/dev/xd.c
+++ b/sys/arch/sparc/dev/xd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xd.c,v 1.51 2010/09/22 01:18:57 matthew Exp $ */
+/* $OpenBSD: xd.c,v 1.52 2010/09/22 06:40:25 krw Exp $ */
/* $NetBSD: xd.c,v 1.37 1997/07/29 09:58:16 fair Exp $ */
/*
@@ -839,6 +839,7 @@ xdioctl(dev, command, addr, flag, p)
return 0;
case DIOCGDINFO: /* get disk label */
+ case DIOCGPDINFO: /* no separate 'physical' info available. */
bcopy(xd->sc_dk.dk_label, addr, sizeof(struct disklabel));
return 0;
diff --git a/sys/arch/sparc/dev/xy.c b/sys/arch/sparc/dev/xy.c
index 42b10c2e715..8857c2e4e84 100644
--- a/sys/arch/sparc/dev/xy.c
+++ b/sys/arch/sparc/dev/xy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xy.c,v 1.49 2010/09/22 01:18:57 matthew Exp $ */
+/* $OpenBSD: xy.c,v 1.50 2010/09/22 06:40:25 krw Exp $ */
/* $NetBSD: xy.c,v 1.26 1997/07/19 21:43:56 pk Exp $ */
/*
@@ -800,6 +800,7 @@ xyioctl(dev, command, addr, flag, p)
return 0;
case DIOCGDINFO: /* get disk label */
+ case DIOCGPDINFO: /* no separate 'physical' info available. */
bcopy(xy->sc_dk.dk_label, addr, sizeof(struct disklabel));
return 0;