summaryrefslogtreecommitdiff
path: root/sys/arch/sparc
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-10-03 21:19:02 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-10-03 21:19:02 +0000
commit2847382ad0f79d42676104f5b99c1b14a78a5b90 (patch)
tree3e173e06925848427cc197fb15b7a2d7b3e5c12c /sys/arch/sparc
parent17219f15915dee86717b444ef5a7e0c11c2e9bb4 (diff)
Add a "spoofonly" argument to readdisklabel() which will be used to
implement an ioctl to get a spoofed label even for disks that have a label on them.
Diffstat (limited to 'sys/arch/sparc')
-rw-r--r--sys/arch/sparc/dev/fd.c4
-rw-r--r--sys/arch/sparc/dev/xd.c4
-rw-r--r--sys/arch/sparc/dev/xy.c4
-rw-r--r--sys/arch/sparc/sparc/disksubr.c9
4 files changed, 13 insertions, 8 deletions
diff --git a/sys/arch/sparc/dev/fd.c b/sys/arch/sparc/dev/fd.c
index 5abf64edaca..b1d8864e257 100644
--- a/sys/arch/sparc/dev/fd.c
+++ b/sys/arch/sparc/dev/fd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fd.c,v 1.22 1997/09/20 12:24:17 deraadt Exp $ */
+/* $OpenBSD: fd.c,v 1.23 1998/10/03 21:18:58 millert Exp $ */
/* $NetBSD: fd.c,v 1.51 1997/05/24 20:16:19 pk Exp $ */
/*-
@@ -1814,7 +1814,7 @@ fdgetdisklabel(dev)
/*
* Call the generic disklabel extraction routine.
*/
- errstring = readdisklabel(dev, fdstrategy, lp, clp);
+ errstring = readdisklabel(dev, fdstrategy, lp, clp, 0);
if (errstring) {
printf("%s: %s\n", fd->sc_dv.dv_xname, errstring);
return;
diff --git a/sys/arch/sparc/dev/xd.c b/sys/arch/sparc/dev/xd.c
index 43307349c5e..dba45d7667a 100644
--- a/sys/arch/sparc/dev/xd.c
+++ b/sys/arch/sparc/dev/xd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xd.c,v 1.12 1998/03/01 08:42:19 johns Exp $ */
+/* $OpenBSD: xd.c,v 1.13 1998/10/03 21:18:58 millert Exp $ */
/* $NetBSD: xd.c,v 1.37 1997/07/29 09:58:16 fair Exp $ */
/*
@@ -306,7 +306,7 @@ xdgetdisklabel(xd, b)
err = readdisklabel(MAKEDISKDEV(0, xd->sc_dev.dv_unit, RAW_PART),
xddummystrat,
- xd->sc_dk.dk_label, xd->sc_dk.dk_cpulabel);
+ xd->sc_dk.dk_label, xd->sc_dk.dk_cpulabel, 0);
if (err) {
printf("%s: %s\n", xd->sc_dev.dv_xname, err);
return(XD_ERR_FAIL);
diff --git a/sys/arch/sparc/dev/xy.c b/sys/arch/sparc/dev/xy.c
index 50d250b5c32..0f548225f38 100644
--- a/sys/arch/sparc/dev/xy.c
+++ b/sys/arch/sparc/dev/xy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xy.c,v 1.10 1997/08/08 21:46:51 niklas Exp $ */
+/* $OpenBSD: xy.c,v 1.11 1998/10/03 21:18:58 millert Exp $ */
/* $NetBSD: xy.c,v 1.26 1997/07/19 21:43:56 pk Exp $ */
/*
@@ -246,7 +246,7 @@ xygetdisklabel(xy, b)
err = readdisklabel(MAKEDISKDEV(0, xy->sc_dev.dv_unit, RAW_PART),
xydummystrat,
- xy->sc_dk.dk_label, xy->sc_dk.dk_cpulabel);
+ xy->sc_dk.dk_label, xy->sc_dk.dk_cpulabel, 0);
if (err) {
printf("%s: %s\n", xy->sc_dev.dv_xname, err);
return(XY_ERR_FAIL);
diff --git a/sys/arch/sparc/sparc/disksubr.c b/sys/arch/sparc/sparc/disksubr.c
index 80376d7e33e..3de46d07cc5 100644
--- a/sys/arch/sparc/sparc/disksubr.c
+++ b/sys/arch/sparc/sparc/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.20 1998/05/02 03:57:51 millert Exp $ */
+/* $OpenBSD: disksubr.c,v 1.21 1998/10/03 21:18:56 millert Exp $ */
/* $NetBSD: disksubr.c,v 1.16 1996/04/28 20:25:59 thorpej Exp $ */
/*
@@ -132,11 +132,12 @@ dk_establish(dk, dev)
* Returns null on success and an error string on failure.
*/
char *
-readdisklabel(dev, strat, lp, clp)
+readdisklabel(dev, strat, lp, clp, spoofonly)
dev_t dev;
void (*strat) __P((struct buf *));
struct disklabel *lp;
struct cpu_disklabel *clp;
+ int spoofonly;
{
struct buf *bp;
struct disklabel *dlp;
@@ -157,6 +158,10 @@ readdisklabel(dev, strat, lp, clp)
lp->d_bbsize = 8192;
lp->d_sbsize = 64*1024; /* XXX ? */
+ /* don't read the on-disk label if we are in spoofed-only mode */
+ if (spoofonly)
+ return (NULL);
+
/* obtain buffer to probe drive with */
bp = geteblk((int)lp->d_secsize);