summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-10-04 01:02:27 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-10-04 01:02:27 +0000
commit432b5d34b72b7dcc09623fee452499f26108c507 (patch)
treeeffce495fd0214e9692dc760e9bde7277e5e7aea /sys
parent55f2b84036b2cbe1d60b2fb03998ad77faa74678 (diff)
Add DIOCGPDINFO support
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/hp300/dev/hd.c21
-rw-r--r--sys/arch/hp300/dev/sd.c19
-rw-r--r--sys/arch/hp300/dev/sdvar.h4
3 files changed, 27 insertions, 17 deletions
diff --git a/sys/arch/hp300/dev/hd.c b/sys/arch/hp300/dev/hd.c
index 5a8a5c9e7a5..95920e3f231 100644
--- a/sys/arch/hp300/dev/hd.c
+++ b/sys/arch/hp300/dev/hd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hd.c,v 1.10 1998/10/03 21:18:57 millert Exp $ */
+/* $OpenBSD: hd.c,v 1.11 1998/10/04 01:02:26 millert Exp $ */
/* $NetBSD: rd.c,v 1.33 1997/07/10 18:14:08 kleink Exp $ */
/*
@@ -223,7 +223,7 @@ int hdident __P((struct device *, struct hd_softc *,
struct hpibbus_attach_args *));
void hdreset __P((struct hd_softc *));
void hdustart __P((struct hd_softc *));
-int hdgetinfo __P((dev_t));
+int hdgetinfo __P((dev_t, struct hd_softc *, struct disklabel *, int));
void hdrestart __P((void *));
struct buf *hdfinish __P((struct hd_softc *, struct buf *));
@@ -472,12 +472,12 @@ hdreset(rs)
* Read or constuct a disklabel
*/
int
-hdgetinfo(dev)
+hdgetinfo(dev, rs, lp, spoofonly)
dev_t dev;
+ struct hd_softc *rs;
+ struct disklabel *lp;
+ int spoofonly;
{
- int unit = hdunit(dev);
- struct hd_softc *rs = hd_cd.cd_devs[unit];
- struct disklabel *lp = rs->sc_dkdev.dk_label;
char *errstring;
/*
@@ -522,7 +522,8 @@ hdgetinfo(dev)
/*
* Now try to read the disklabel
*/
- errstring = readdisklabel(hdlabdev(dev), hdstrategy, lp, NULL, 0);
+ errstring = readdisklabel(hdlabdev(dev), hdstrategy, lp, NULL,
+ spoofonly);
if (errstring) {
printf("%s: WARNING: %s, defining `c' partition as entire disk\n",
rs->sc_dev.dv_xname, errstring);
@@ -567,7 +568,7 @@ hdopen(dev, flags, mode, p)
*/
if (rs->sc_dkdev.dk_openmask == 0) {
rs->sc_flags |= HDF_OPENING;
- error = hdgetinfo(dev);
+ error = hdgetinfo(dev, rs, rs->sc_dkdev.dk_label, 0);
rs->sc_flags &= ~HDF_OPENING;
wakeup((caddr_t)rs);
if (error)
@@ -1121,6 +1122,10 @@ hdioctl(dev, cmd, data, flag, p)
int error, flags;
switch (cmd) {
+ case DIOCGPDINFO:
+ error = hdgetinfo(dev, sc, (struct disklabel *)data, 1);
+ return (error);
+
case DIOCGDINFO:
*(struct disklabel *)data = *lp;
return (0);
diff --git a/sys/arch/hp300/dev/sd.c b/sys/arch/hp300/dev/sd.c
index 602605d396b..d4000fd797c 100644
--- a/sys/arch/hp300/dev/sd.c
+++ b/sys/arch/hp300/dev/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.20 1998/10/03 21:18:57 millert Exp $ */
+/* $OpenBSD: sd.c,v 1.21 1998/10/04 01:02:25 millert Exp $ */
/* $NetBSD: sd.c,v 1.34 1997/07/10 18:14:10 kleink Exp $ */
/*
@@ -386,12 +386,12 @@ sdgetcapacity(sc, dev)
* Read or constuct a disklabel
*/
int
-sdgetinfo(dev)
+sdgetinfo(dev, sc, lp, spoofonly)
dev_t dev;
+ struct sd_softc *sc;
+ struct disklabel *lp;
+ int spoofonly;
{
- int unit = sdunit(dev);
- struct sd_softc *sc = sd_cd.cd_devs[unit];
- struct disklabel *lp = sc->sc_dkdev.dk_label;
char *errstring;
bzero((caddr_t)lp, sizeof *lp);
@@ -499,7 +499,8 @@ sdgetinfo(dev)
lp->d_magic2 = DISKMAGIC;
lp->d_checksum = dkcksum(lp);
- errstring = readdisklabel(sdlabdev(dev), sdstrategy, lp, NULL, 0);
+ errstring = readdisklabel(sdlabdev(dev), sdstrategy, lp, NULL,
+ spoofonly);
}
if (errstring) {
@@ -546,7 +547,7 @@ sdopen(dev, flags, mode, p)
*/
if (sc->sc_dkdev.dk_openmask == 0) {
sc->sc_flags |= SDF_OPENING;
- error = sdgetinfo(dev);
+ error = sdgetinfo(dev, sc, sc->sc_dkdev.dk_label, 0);
sc->sc_flags &= ~SDF_OPENING;
wakeup((caddr_t)sc);
if (error)
@@ -1075,6 +1076,10 @@ sdioctl(dev, cmd, data, flag, p)
int error, flags;
switch (cmd) {
+ case DIOCGPDINFO:
+ error = sdgetinfo(dev, sc, (struct disklabel *)data, 1);
+ return (error);
+
case DIOCGDINFO:
*(struct disklabel *)data = *lp;
return (0);
diff --git a/sys/arch/hp300/dev/sdvar.h b/sys/arch/hp300/dev/sdvar.h
index 540cd804726..ee41b424efd 100644
--- a/sys/arch/hp300/dev/sdvar.h
+++ b/sys/arch/hp300/dev/sdvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sdvar.h,v 1.8 1997/04/16 11:56:16 downsj Exp $ */
+/* $OpenBSD: sdvar.h,v 1.9 1998/10/04 01:02:25 millert Exp $ */
/* $NetBSD: sdvar.h,v 1.7 1997/03/31 07:40:07 scottr Exp $ */
/*
@@ -91,7 +91,7 @@ void sdgo __P((void *));
void sdintr __P((void *, int));
int sdgetcapacity __P((struct sd_softc *, dev_t));
-int sdgetinfo __P((dev_t));
+int sdgetinfo __P((dev_t, struct sd_softc *, struct disklabel *, int));
/* sd_compat.c */
void sdmakedisklabel __P((int, struct disklabel *));