summaryrefslogtreecommitdiff
path: root/sys/arch/pmax
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/pmax
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/pmax')
-rw-r--r--sys/arch/pmax/dev/rz.c8
-rw-r--r--sys/arch/pmax/pmax/disksubr.c16
2 files changed, 11 insertions, 13 deletions
diff --git a/sys/arch/pmax/dev/rz.c b/sys/arch/pmax/dev/rz.c
index ed072017170..43f5ea0a609 100644
--- a/sys/arch/pmax/dev/rz.c
+++ b/sys/arch/pmax/dev/rz.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rz.c,v 1.14 1998/05/12 15:52:09 millert Exp $ */
+/* $OpenBSD: rz.c,v 1.15 1998/10/03 21:18:58 millert Exp $ */
/* $NetBSD: rz.c,v 1.38 1998/05/08 00:05:19 simonb Exp $ */
/*
@@ -149,10 +149,6 @@ static struct size rzdefaultpart[MAXPARTITIONS] = {
};
-extern char *
-readdisklabel __P((dev_t dev, void (*strat) __P((struct buf *bp)),
- struct disklabel *lp, struct cpu_disklabel *osdep));
-
/*
* Ultrix disklabel declarations
*/
@@ -913,7 +909,7 @@ rzgetinfo(dev)
/*
* Now try to read the disklabel
*/
- if ((msg = readdisklabel(dev, rzstrategy, lp, &cd)) == NULL)
+ if ((msg = readdisklabel(dev, rzstrategy, lp, &cd, 0)) == NULL)
return;
printf("rz%d: WARNING: %s\n", unit, msg);
diff --git a/sys/arch/pmax/pmax/disksubr.c b/sys/arch/pmax/pmax/disksubr.c
index 76ffdf98e7f..b340fa04a52 100644
--- a/sys/arch/pmax/pmax/disksubr.c
+++ b/sys/arch/pmax/pmax/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.13 1998/05/10 04:01:23 millert Exp $ */
+/* $OpenBSD: disksubr.c,v 1.14 1998/10/03 21:18:56 millert Exp $ */
/* $NetBSD: disksubr.c,v 1.14 1997/01/15 00:55:43 jonathan Exp $ */
/*
@@ -55,10 +55,6 @@ compat_label __P((dev_t dev, void (*strat) __P((struct buf *bp)),
#endif
-char* readdisklabel __P((dev_t dev, void (*strat) __P((struct buf *bp)),
- register struct disklabel *lp,
- struct cpu_disklabel *osdep));
-
/*
* Attempt to read a disk label from a device
* using the indicated stategy routine.
@@ -68,11 +64,12 @@ char* readdisklabel __P((dev_t dev, void (*strat) __P((struct buf *bp)),
* 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 *bp));
register struct disklabel *lp;
struct cpu_disklabel *osdep;
+ int spoofonly;
{
register struct buf *bp;
struct disklabel *dlp;
@@ -85,6 +82,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;
@@ -93,7 +94,8 @@ readdisklabel(dev, strat, lp, osdep)
bp->b_cylin = LABELSECTOR / lp->d_secpercyl;
(*strat)(bp);
if (biowait(bp)) {
- msg = "I/O error";
+ /* XXX we return the faked label built so far */
+ msg = "disk label I/O error";
} else {
dlp = (struct disklabel *)bp->b_un.b_addr + LABELOFFSET;
if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC) {