summaryrefslogtreecommitdiff
path: root/sys/arch/hp300
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/hp300
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/hp300')
-rw-r--r--sys/arch/hp300/dev/hd.c4
-rw-r--r--sys/arch/hp300/dev/sd.c4
-rw-r--r--sys/arch/hp300/hp300/disksubr.c11
3 files changed, 12 insertions, 7 deletions
diff --git a/sys/arch/hp300/dev/hd.c b/sys/arch/hp300/dev/hd.c
index 3d0a20e893c..5a8a5c9e7a5 100644
--- a/sys/arch/hp300/dev/hd.c
+++ b/sys/arch/hp300/dev/hd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hd.c,v 1.9 1998/05/07 05:19:34 millert Exp $ */
+/* $OpenBSD: hd.c,v 1.10 1998/10/03 21:18:57 millert Exp $ */
/* $NetBSD: rd.c,v 1.33 1997/07/10 18:14:08 kleink Exp $ */
/*
@@ -522,7 +522,7 @@ hdgetinfo(dev)
/*
* Now try to read the disklabel
*/
- errstring = readdisklabel(hdlabdev(dev), hdstrategy, lp, NULL);
+ errstring = readdisklabel(hdlabdev(dev), hdstrategy, lp, NULL, 0);
if (errstring) {
printf("%s: WARNING: %s, defining `c' partition as entire disk\n",
rs->sc_dev.dv_xname, errstring);
diff --git a/sys/arch/hp300/dev/sd.c b/sys/arch/hp300/dev/sd.c
index 5632a750324..602605d396b 100644
--- a/sys/arch/hp300/dev/sd.c
+++ b/sys/arch/hp300/dev/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.19 1998/05/07 05:19:33 millert Exp $ */
+/* $OpenBSD: sd.c,v 1.20 1998/10/03 21:18:57 millert Exp $ */
/* $NetBSD: sd.c,v 1.34 1997/07/10 18:14:10 kleink Exp $ */
/*
@@ -499,7 +499,7 @@ sdgetinfo(dev)
lp->d_magic2 = DISKMAGIC;
lp->d_checksum = dkcksum(lp);
- errstring = readdisklabel(sdlabdev(dev), sdstrategy, lp, NULL);
+ errstring = readdisklabel(sdlabdev(dev), sdstrategy, lp, NULL, 0);
}
if (errstring) {
diff --git a/sys/arch/hp300/hp300/disksubr.c b/sys/arch/hp300/hp300/disksubr.c
index 4d5c6a07281..afd5bf4cf2b 100644
--- a/sys/arch/hp300/hp300/disksubr.c
+++ b/sys/arch/hp300/hp300/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.8 1998/05/02 05:09:59 millert Exp $ */
+/* $OpenBSD: disksubr.c,v 1.9 1998/10/03 21:18:54 millert Exp $ */
/* $NetBSD: disksubr.c,v 1.9 1997/04/01 03:12:13 scottr Exp $ */
/*
@@ -65,11 +65,12 @@ dk_establish(dk, dev)
* string on failure.
*/
char *
-readdisklabel(dev, strat, lp, osdep)
+readdisklabel(dev, strat, lp, osdep, spoofonly)
dev_t dev;
void (*strat) __P((struct buf *));
struct disklabel *lp;
struct cpu_disklabel *osdep;
+ int spoofonly;
{
struct buf *bp;
struct disklabel *dlp;
@@ -89,6 +90,10 @@ readdisklabel(dev, strat, lp, osdep)
lp->d_partitions[0].p_size = 0x1fffffff;
lp->d_partitions[0].p_offset = 0;
+ /* don't read the on-disk label if we are in spoofed-only mode */
+ if (spoofonly)
+ return (NULL);
+
bp = geteblk((int)lp->d_secsize);
bp->b_dev = dev;
bp->b_blkno = LABELSECTOR;
@@ -97,7 +102,7 @@ readdisklabel(dev, strat, lp, osdep)
bp->b_cylinder = LABELSECTOR / lp->d_secpercyl;
(*strat)(bp);
if (biowait(bp))
- msg = "I/O error";
+ msg = "disk label I/O error";
else for (dlp = (struct disklabel *)bp->b_data;
dlp <= (struct disklabel *)((char *)bp->b_data +
DEV_BSIZE - sizeof(*dlp));