summaryrefslogtreecommitdiff
path: root/sys/arch/mvme88k
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/mvme88k
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/mvme88k')
-rw-r--r--sys/arch/mvme88k/mvme88k/disksubr.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/sys/arch/mvme88k/mvme88k/disksubr.c b/sys/arch/mvme88k/mvme88k/disksubr.c
index 2f25fbf3e16..a0aea8214cc 100644
--- a/sys/arch/mvme88k/mvme88k/disksubr.c
+++ b/sys/arch/mvme88k/mvme88k/disksubr.c
@@ -64,15 +64,34 @@ dk_establish()
* 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)();
struct disklabel *lp;
struct cpu_disklabel *clp;
+ int spoofonly;
{
struct buf *bp;
char *msg = NULL;
+ /* minimal requirements for archetypal disk label */
+ if (lp->d_secsize == 0)
+ lp->d_secsize = DEV_BSIZE;
+ if (lp->d_secperunit == 0)
+ lp->d_secperunit = 0x1fffffff;
+ lp->d_npartitions = RAW_PART + 1;
+ for (i = 0; i < RAW_PART; i++) {
+ lp->d_partitions[i].p_size = 0;
+ lp->d_partitions[i].p_offset = 0;
+ }
+ if (lp->d_partitions[0].p_size == 0)
+ 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);
+
/* obtain buffer to probe drive with */
bp = geteblk((int)lp->d_secsize);