diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2011-05-22 15:11:41 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2011-05-22 15:11:41 +0000 |
commit | 9d8c5abf463476c091ff629506bb92e2d49801b9 (patch) | |
tree | 66838338544538d1d8e635cac548de96a02ac941 /sys/arch | |
parent | 87900470d5edab64ef70cdf782b90594f8116d23 (diff) |
socppc is a pure MBR architecture (just like landisk and armish), so
it does not need macppc DPME logic
ok kettenis
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/socppc/socppc/disksubr.c | 101 |
1 files changed, 2 insertions, 99 deletions
diff --git a/sys/arch/socppc/socppc/disksubr.c b/sys/arch/socppc/socppc/disksubr.c index 1fb5a3b6d1b..9bcbcf4c169 100644 --- a/sys/arch/socppc/socppc/disksubr.c +++ b/sys/arch/socppc/socppc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.15 2011/04/16 03:21:15 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.16 2011/05/22 15:11:40 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -37,9 +37,6 @@ #include <sys/disklabel.h> #include <sys/disk.h> -int readdpmelabel(struct buf *, void (*)(struct buf *), - struct disklabel *, int *, int); - /* * Attempt to read a disk label from a device * using the indicated strategy routine. @@ -69,10 +66,6 @@ readdisklabel(dev_t dev, void (*strat)(struct buf *), bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - error = readdpmelabel(bp, strat, lp, NULL, spoofonly); - if (error == 0) - goto done; - error = readdoslabel(bp, strat, lp, NULL, spoofonly); if (error == 0) goto done; @@ -97,95 +90,6 @@ done: return (error); } -int -readdpmelabel(struct buf *bp, void (*strat)(struct buf *), - struct disklabel *lp, int *partoffp, int spoofonly) -{ - int i, part_cnt, n, hfspartoff = -1; - u_int64_t hfspartend = DL_GETDSIZE(lp); - struct part_map_entry *part; - - /* First check for a DPME (HFS) disklabel */ - bp->b_blkno = 1; - bp->b_bcount = lp->d_secsize; - CLR(bp->b_flags, B_READ | B_WRITE | B_DONE); - SET(bp->b_flags, B_BUSY | B_READ | B_RAW); - (*strat)(bp); - if (biowait(bp)) - return (bp->b_error); - - /* if successful, wander through DPME partition table */ - part = (struct part_map_entry *)bp->b_data; - /* if first partition is not valid, assume not HFS/DPME partitioned */ - if (part->pmSig != PART_ENTRY_MAGIC) - return (EINVAL); /* not a DPME partition */ - part_cnt = part->pmMapBlkCnt; - n = 8; - for (i = 0; i < part_cnt; i++) { - struct partition *pp; - char *s; - - bp->b_blkno = 1+i; - bp->b_bcount = lp->d_secsize; - CLR(bp->b_flags, B_READ | B_WRITE | B_DONE); - SET(bp->b_flags, B_BUSY | B_READ | B_RAW); - (*strat)(bp); - if (biowait(bp)) - return (bp->b_error); - - part = (struct part_map_entry *)bp->b_data; - /* toupper the string, in case caps are different... */ - for (s = part->pmPartType; *s; s++) - if ((*s >= 'a') && (*s <= 'z')) - *s = (*s - 'a' + 'A'); - - if (strcmp(part->pmPartType, PART_TYPE_OPENBSD) == 0) { - hfspartoff = part->pmPyPartStart - LABELSECTOR; - hfspartend = hfspartoff + part->pmPartBlkCnt; - if (partoffp) { - *partoffp = hfspartoff; - return (0); - } else { - DL_SETBSTART(lp, hfspartoff); - DL_SETBEND(lp, - hfspartend < DL_GETDSIZE(lp) ? hfspartend : - DL_GETDSIZE(lp)); - } - continue; - } - - if (n >= MAXPARTITIONS || partoffp) - continue; - - /* Currently we spoof HFS partitions only. */ - if (strcmp(part->pmPartType, PART_TYPE_MAC) == 0) { - pp = &lp->d_partitions[n]; - DL_SETPOFFSET(pp, part->pmPyPartStart); - DL_SETPSIZE(pp, part->pmPartBlkCnt); - pp->p_fstype = FS_HFS; - n++; - } - } - - if (hfspartoff == -1) - return (EINVAL); - - if (spoofonly) - return (0); - - /* next, dig out disk label */ - bp->b_blkno = hfspartoff + LABELSECTOR; - bp->b_bcount = lp->d_secsize; - CLR(bp->b_flags, B_READ | B_WRITE | B_DONE); - SET(bp->b_flags, B_BUSY | B_READ | B_RAW); - (*strat)(bp); - if (biowait(bp)) - return (bp->b_error); - - return checkdisklabel(bp->b_data + LABELOFFSET, lp, hfspartoff, - hfspartend); -} - /* * Write disk label back to device after modification. */ @@ -200,8 +104,7 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp) bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; - if (readdpmelabel(bp, strat, lp, &partoff, 1) != 0 && - readdoslabel(bp, strat, lp, &partoff, 1) != 0) + if (readdoslabel(bp, strat, lp, &partoff, 1) != 0) goto done; /* Read it in, slap the new label in, and write it back out */ |