summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2005-09-29 23:02:18 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2005-09-29 23:02:18 +0000
commitae5b8f689cfbab1c885b2994c30fcae6426cd8ea (patch)
treea5656271f1cd35baa1c3b40c423ced518c33c584 /sys
parent77ba0228677547ab5a13dce7ade677414f766b89 (diff)
Avoid i/o's when spoofonly = 1 in readdisklabel(). Same as other DOS
partition archs with an extra bit to avoid i/o for hfs. ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/macppc/macppc/disksubr.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/arch/macppc/macppc/disksubr.c b/sys/arch/macppc/macppc/disksubr.c
index 83df3e09682..f5f0cd6f88e 100644
--- a/sys/arch/macppc/macppc/disksubr.c
+++ b/sys/arch/macppc/macppc/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.11 2005/03/30 07:52:32 deraadt Exp $ */
+/* $OpenBSD: disksubr.c,v 1.12 2005/09/29 23:02:17 krw Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -104,6 +104,10 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *),
bp = geteblk((int)lp->d_secsize);
bp->b_dev = dev;
+ /* don't read the on-disk label if we are in spoofed-only mode */
+ if (spoofonly)
+ goto done;
+
/* DPME (HFS) disklabel */
bp->b_blkno = 1;
@@ -160,10 +164,6 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *),
}
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 = hfspartoff;
bp->b_cylin = hfspartoff/lp->d_secpercyl; /* XXX */
@@ -201,6 +201,11 @@ hfs_done:
if (part_blkno < extoff)
part_blkno = extoff;
+ if (spoofonly) {
+ bzero(dp, NDOSPART * sizeof(*dp));
+ goto donot;
+ }
+
/* read boot record */
bp->b_blkno = part_blkno;
bp->b_bcount = lp->d_secsize;