summaryrefslogtreecommitdiff
path: root/sys/arch/i386
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/i386
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/i386')
-rw-r--r--sys/arch/i386/i386/disksubr.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/arch/i386/i386/disksubr.c b/sys/arch/i386/i386/disksubr.c
index 71c9bfc2292..128dead0b9c 100644
--- a/sys/arch/i386/i386/disksubr.c
+++ b/sys/arch/i386/i386/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.33 1998/02/24 04:22:41 deraadt Exp $ */
+/* $OpenBSD: disksubr.c,v 1.34 1998/10/03 21:18:54 millert Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -74,11 +74,12 @@ dk_establish(dk, dev)
* Returns null on success and an error string on failure.
*/
char *
-readdisklabel(dev, strat, lp, osdep)
+readdisklabel(dev, strat, lp, osdep, spoofonly)
dev_t dev;
void (*strat) __P((struct buf *));
register struct disklabel *lp;
struct cpu_disklabel *osdep;
+ int spoofonly;
{
struct dos_partition *dp = osdep->dosparts, *dp2;
struct dkbad *bdp = &DKBAD(osdep);
@@ -241,6 +242,10 @@ donot:
lp->d_npartitions = MAXPARTITIONS;
}
+ /* don't read the on-disk label if we are in spoofed-only mode */
+ if (spoofonly)
+ goto done;
+
/* next, dig out disk label */
bp->b_blkno = dospartoff + LABELSECTOR;
bp->b_cylin = cyl;