diff options
Diffstat (limited to 'sys/arch/vax')
-rw-r--r-- | sys/arch/vax/mba/hp.c | 8 | ||||
-rw-r--r-- | sys/arch/vax/mscp/mscp_disk.c | 21 | ||||
-rw-r--r-- | sys/arch/vax/vax/disksubr.c | 29 | ||||
-rw-r--r-- | sys/arch/vax/vsa/hdc9224.c | 22 |
4 files changed, 42 insertions, 38 deletions
diff --git a/sys/arch/vax/mba/hp.c b/sys/arch/vax/mba/hp.c index 21e603384d6..a1216c49385 100644 --- a/sys/arch/vax/mba/hp.c +++ b/sys/arch/vax/mba/hp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hp.c,v 1.16 2007/02/15 00:53:26 krw Exp $ */ +/* $OpenBSD: hp.c,v 1.17 2007/06/05 00:38:19 deraadt Exp $ */ /* $NetBSD: hp.c,v 1.22 2000/02/12 16:09:33 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. @@ -167,7 +167,7 @@ hpattach(parent, self, aux) /*printf(": %s", msg);*/ } printf(": %.*s, size = %d sectors\n", - (int)sizeof(dl->d_typename), dl->d_typename, dl->d_secperunit); + (int)sizeof(dl->d_typename), dl->d_typename, DL_GETDSIZE(dl)); /* * check if this was what we booted from. */ @@ -194,7 +194,7 @@ hpstrategy(bp) goto done; bp->b_rawblkno = - bp->b_blkno + lp->d_partitions[DISKPART(bp->b_dev)].p_offset; + bp->b_blkno + DL_GETPOFFSET(&lp->d_partitions[DISKPART(bp->b_dev)]); bp->b_cylinder = bp->b_rawblkno / lp->d_secpercyl; s = splbio(); @@ -455,7 +455,7 @@ hpsize(dev) return -1; sc = hp_cd.cd_devs[unit]; - size = sc->sc_disk.dk_label->d_partitions[DISKPART(dev)].p_size * + size = DL_GETPSIZE(&sc->sc_disk.dk_label->d_partitions[DISKPART(dev)]) * (sc->sc_disk.dk_label->d_secsize / DEV_BSIZE); return size; diff --git a/sys/arch/vax/mscp/mscp_disk.c b/sys/arch/vax/mscp/mscp_disk.c index 8f84693992b..e7c293a3ccc 100644 --- a/sys/arch/vax/mscp/mscp_disk.c +++ b/sys/arch/vax/mscp/mscp_disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mscp_disk.c,v 1.19 2007/03/13 21:05:24 miod Exp $ */ +/* $OpenBSD: mscp_disk.c,v 1.20 2007/06/05 00:38:19 deraadt Exp $ */ /* $NetBSD: mscp_disk.c,v 1.30 2001/11/13 07:38:28 lukem Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. @@ -170,7 +170,7 @@ ra_putonline(ra) ra->ra_state = DK_OPEN; } - printf(": size %d sectors\n", dl->d_secperunit); + printf(": size %lld sectors\n", DL_GETDSIZE(dl)); return MSCP_DONE; } @@ -444,7 +444,7 @@ rasize(dev) if (ra_putonline(ra) == MSCP_FAILED) return -1; - return ra->ra_disk.dk_label->d_partitions[DISKPART(dev)].p_size * + return DL_GETPSIZE(&ra->ra_disk.dk_label->d_partitions[DISKPART(dev)]) * (ra->ra_disk.dk_label->d_secsize / DEV_BSIZE); } @@ -648,7 +648,7 @@ rxstrategy(bp) * Determine the size of the transfer, and make sure it is * within the boundaries of the partition. */ - if (bp->b_blkno >= rx->ra_disk.dk_label->d_secperunit) { + if (bp->b_blkno >= DL_GETDSIZE(rx->ra_disk.dk_label)) { bp->b_resid = bp->b_bcount; goto done; } @@ -828,10 +828,10 @@ rronline(usc, mp) rx->ra_state = DK_OPEN; dl = rx->ra_disk.dk_label; - dl->d_secperunit = (daddr_t)mp->mscp_onle.onle_unitsize; + DL_SETDSIZE(dl, (daddr_t)mp->mscp_onle.onle_unitsize); if (dl->d_secpercyl) { - dl->d_ncylinders = dl->d_secperunit/dl->d_secpercyl; + dl->d_ncylinders = DL_GETDSIZE(dl) / dl->d_secpercyl; dl->d_type = DTYPE_MSCP; dl->d_rpm = 3600; } else { @@ -870,9 +870,10 @@ rrmakelabel(dl, type) dl->d_typename[p++] = n + '0'; dl->d_typename[p] = 0; dl->d_npartitions = MAXPARTITIONS; - dl->d_partitions[0].p_size = dl->d_partitions[2].p_size = - dl->d_secperunit; - dl->d_partitions[0].p_offset = dl->d_partitions[2].p_offset = 0; + DL_SETPSIZE(&dl->d_partitions[0], DL_GETDSIZE(dl)); + DL_SETPSIZE(&dl->d_partitions[2], DL_GETDSIZE(dl)); + DL_SETPOFFSET(&dl->d_partitions[0], 0); + DL_SETPOFFSET(&dl->d_partitions[2], 0); dl->d_interleave = dl->d_headswitch = 1; dl->d_magic = dl->d_magic2 = DISKMAGIC; dl->d_checksum = dkcksum(dl); @@ -971,7 +972,7 @@ rrfillin(bp, mp) #endif lp = rx->ra_disk.dk_label; - mp->mscp_seq.seq_lbn = lp->d_partitions[part].p_offset + bp->b_blkno; + mp->mscp_seq.seq_lbn = DL_GETPOFFSET(&lp->d_partitions[part]) + bp->b_blkno; mp->mscp_unit = rx->ra_hwunit; mp->mscp_seq.seq_bytecount = bp->b_bcount; } diff --git a/sys/arch/vax/vax/disksubr.c b/sys/arch/vax/vax/disksubr.c index a4da2292245..3f62f6c26c3 100644 --- a/sys/arch/vax/vax/disksubr.c +++ b/sys/arch/vax/vax/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.39 2007/06/02 02:35:27 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.40 2007/06/05 00:38:19 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1999/06/30 18:48:06 ragge Exp $ */ /* @@ -60,9 +60,9 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, struct cpu_disklabel *osdep, int wlabel) { struct partition *p = lp->d_partitions + DISKPART(bp->b_dev); - int labelsector = lp->d_partitions[RAW_PART].p_offset; - int maxsz = p->p_size, - sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT; + int labelsector = DL_GETPOFFSET(&lp->d_partitions[RAW_PART]); + int maxsz = DL_GETPSIZE(p); + int sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT; /* avoid division by zero */ if (lp->d_secpercyl == 0) { @@ -71,7 +71,7 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, } /* overwriting disk label ? */ - if (bp->b_blkno + p->p_offset <= LABELSECTOR + labelsector && + if (bp->b_blkno + DL_GETPOFFSET(p) <= LABELSECTOR + labelsector && (bp->b_flags & B_READ) == 0 && wlabel == 0) { bp->b_error = EROFS; goto bad; @@ -95,7 +95,7 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, } /* calculate cylinder for disksort to order transfers with */ - bp->b_cylinder = (bp->b_blkno + p->p_offset) / lp->d_secpercyl; + bp->b_cylinder = (bp->b_blkno + DL_GETPOFFSET(p)) / lp->d_secpercyl; return (1); bad: @@ -127,20 +127,20 @@ readdisklabel(dev, strat, lp, osdep, spoofonly) /* minimal requirements for archetypal disk label */ if (lp->d_secsize < DEV_BSIZE) lp->d_secsize = DEV_BSIZE; - if (lp->d_secperunit == 0) - lp->d_secperunit = 0x1fffffff; + if (DL_GETDSIZE(lp) == 0) + DL_SETDSIZE(lp, MAXDISKSIZE); if (lp->d_secpercyl == 0) { msg = "invalid geometry"; goto done; } 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; + DL_SETPSIZE(&lp->d_partitions[i], 0); + DL_SETPOFFSET(&lp->d_partitions[i], 0); } - if (lp->d_partitions[i].p_size == 0) - lp->d_partitions[i].p_size = lp->d_secperunit; - lp->d_partitions[i].p_offset = 0; + if (DL_GETPSIZE(&lp->d_partitions[i]) == 0) + DL_SETPSIZE(&lp->d_partitions[i], DL_GETDSIZE(lp)); + DL_SETPOFFSET(&lp->d_partitions[i], 0); lp->d_bbsize = 8192; lp->d_sbsize = 64 * 1024; @@ -222,7 +222,8 @@ setdisklabel(olp, nlp, openmask, osdep) return (EBUSY); opp = &olp->d_partitions[i]; npp = &nlp->d_partitions[i]; - if (npp->p_offset != opp->p_offset || npp->p_size < opp->p_size) + if (DL_GETPOFFSET(npp) != DL_GETPOFFSET(opp) || + DL_GETPSIZE(npp) < DL_GETPSIZE(opp)) return (EBUSY); /* * Copy internally-set partition information diff --git a/sys/arch/vax/vsa/hdc9224.c b/sys/arch/vax/vsa/hdc9224.c index 692f059a240..0402691fdd9 100644 --- a/sys/arch/vax/vsa/hdc9224.c +++ b/sys/arch/vax/vsa/hdc9224.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hdc9224.c,v 1.14 2007/02/15 00:53:26 krw Exp $ */ +/* $OpenBSD: hdc9224.c,v 1.15 2007/06/05 00:38:19 deraadt Exp $ */ /* $NetBSD: hdc9224.c,v 1.16 2001/07/26 15:05:09 wiz Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. @@ -366,8 +366,8 @@ hdattach(struct device *parent, struct device *self, void *aux) msg = readdisklabel(MAKEDISKDEV(HDMAJOR, hd->sc_dev.dv_unit, RAW_PART), hdstrategy, dl, NULL, 0); printf("%s: %luMB, %lu sectors\n", - hd->sc_dev.dv_xname, dl->d_secperunit / (1048576 / DEV_BSIZE), - dl->d_secperunit); + hd->sc_dev.dv_xname, DL_GETDSIZE(dl) / (1048576 / DEV_BSIZE), + DL_GETDSIZE(dl)); if (msg) { /*printf("%s: %s\n", hd->sc_dev.dv_xname, msg);*/ } @@ -464,7 +464,7 @@ hdstrategy(struct buf *bp) * this also truncates the block number at 4G, but there shouldn't be * any MFM disk that large. */ - bn = bp->b_blkno + lp->d_partitions[DISKPART(bp->b_dev)].p_offset; + bn = bp->b_blkno + DL_GETPOFFSET(&lp->d_partitions[DISKPART(bp->b_dev)]); bp->b_cylinder = bn; s = splbio(); @@ -636,7 +636,7 @@ hdsize(dev_t dev) if (unit >= hd_cd.cd_ndevs || hd_cd.cd_devs[unit] == 0) return -1; hd = hd_cd.cd_devs[unit]; - size = hd->sc_disk.dk_label->d_partitions[DISKPART(dev)].p_size * + size = DL_GETPSIZE(&hd->sc_disk.dk_label->d_partitions[DISKPART(dev)]) * (hd->sc_disk.dk_label->d_secsize / DEV_BSIZE); return (size); @@ -866,16 +866,18 @@ hdmakelabel(struct disklabel *dl, struct hdgeom *g) dl->d_rpm = 3600; dl->d_secsize = DEV_BSIZE; - dl->d_secperunit = g->lbn_count; + DL_SETDSIZE(dl, g->lbn_count); dl->d_nsectors = g->nspt; dl->d_ntracks = g->ntracks; dl->d_secpercyl = dl->d_nsectors * dl->d_ntracks; - dl->d_ncylinders = dl->d_secperunit / dl->d_secpercyl; + dl->d_ncylinders = DL_GETDSIZE(dl) / dl->d_secpercyl; dl->d_npartitions = MAXPARTITIONS; - dl->d_partitions[0].p_size = dl->d_partitions[2].p_size = - dl->d_secperunit; - dl->d_partitions[0].p_offset = dl->d_partitions[2].p_offset = 0; + DL_SETPSIZE(&dl->d_partitions[0], DL_GETDSIZE(dl)); + DL_SETPSIZE(&dl->d_partitions[2], DL_GETDSIZE(dl)); + + DL_SETPOFFSET(&dl->d_partitions[0], 0); + DL_SETPOFFSET(&dl->d_partitions[2], 0); dl->d_interleave = dl->d_headswitch = 1; dl->d_magic = dl->d_magic2 = DISKMAGIC; dl->d_checksum = dkcksum(dl); |