summaryrefslogtreecommitdiff
path: root/sys/arch/hppa
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/hppa')
-rw-r--r--sys/arch/hppa/hppa/disksubr.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/sys/arch/hppa/hppa/disksubr.c b/sys/arch/hppa/hppa/disksubr.c
index d0f40529112..09711c3afa4 100644
--- a/sys/arch/hppa/hppa/disksubr.c
+++ b/sys/arch/hppa/hppa/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.52 2007/06/02 02:35:26 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.53 2007/06/05 00:38:15 deraadt Exp $ */
/*
* Copyright (c) 1999 Michael Shalayeff
@@ -143,20 +143,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);
minilabel = fallbacklabel = *lp;
/* get a buffer and initialize it */
@@ -287,9 +287,9 @@ readdoslabel(bp, strat, lp, osdep, partoffp, cylp, spoofonly)
cyl = DPCYL(dp2->dp_scyl, dp2->dp_ssect);
/* XXX build a temporary disklabel */
- lp->d_partitions[0].p_size = letoh32(dp2->dp_size);
- lp->d_partitions[0].p_offset =
- letoh32(dp2->dp_start) + part_blkno;
+ DL_SETPSIZE(&lp->d_partitions[0], letoh32(dp2->dp_size));
+ DL_SETPOFFSET(&lp->d_partitions[0],
+ letoh32(dp2->dp_start) + part_blkno);
if (lp->d_ntracks == 0)
lp->d_ntracks = dp2->dp_ehd + 1;
if (lp->d_nsectors == 0)
@@ -308,17 +308,17 @@ donot:
if (dp2->dp_typ == DOSPTYP_OPENBSD)
continue;
- if (letoh32(dp2->dp_size) > lp->d_secperunit)
+ if (letoh32(dp2->dp_size) > DL_GETDSIZE(lp))
continue;
- if (letoh32(dp2->dp_start) > lp->d_secperunit)
+ if (letoh32(dp2->dp_start) > DL_GETDSIZE(lp))
continue;
if (letoh32(dp2->dp_size) == 0)
continue;
if (letoh32(dp2->dp_start))
- pp->p_offset =
- letoh32(dp2->dp_start) + part_blkno;
+ DL_SETPOFFSET(pp,
+ letoh32(dp2->dp_start) + part_blkno);
- pp->p_size = letoh32(dp2->dp_size);
+ DL_SETPSIZE(pp, letoh32(dp2->dp_size));
switch (dp2->dp_typ) {
case DOSPTYP_UNUSED:
@@ -381,9 +381,9 @@ donot:
goto notfat;
/* Looks like a FAT filesystem. Spoof 'i'. */
- lp->d_partitions['i' - 'a'].p_size =
- lp->d_partitions[RAW_PART].p_size;
- lp->d_partitions['i' - 'a'].p_offset = 0;
+ DL_SETPSIZE(&lp->d_partitions['i' - 'a'],
+ DL_GETPSIZE(&lp->d_partitions[RAW_PART]));
+ DL_SETPOFFSET(&lp->d_partitions['i' - 'a'], 0);
lp->d_partitions['i' - 'a'].p_fstype = FS_MSDOS;
}
notfat:
@@ -512,8 +512,8 @@ readliflabel (bp, strat, lp, osdep, partoffp, cylp, spoofonly)
lp->d_bbsize = 8192;
lp->d_sbsize = 8192;
for (i = 0; i < MAXPARTITIONS; 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);
lp->d_partitions[i].p_fstype = 0;
}
@@ -533,13 +533,13 @@ readliflabel (bp, strat, lp, osdep, partoffp, cylp, spoofonly)
} else
continue;
- pp->p_size = hl->hl_parts[i].hlp_length * 2;
- pp->p_offset = hl->hl_parts[i].hlp_start * 2;
+ DL_SETPSIZE(pp, hl->hl_parts[i].hlp_length * 2);
+ DL_SETPOFFSET(pp, hl->hl_parts[i].hlp_start * 2);
pp->p_fstype = fstype;
}
- lp->d_partitions[RAW_PART].p_size = lp->d_secperunit;
- lp->d_partitions[RAW_PART].p_offset = 0;
+ DL_SETPSIZE(&lp->d_partitions[RAW_PART], DL_GETDSIZE(lp));
+ DL_SETPOFFSET(&lp->d_partitions[RAW_PART], 0);
lp->d_partitions[RAW_PART].p_fstype = FS_UNUSED;
lp->d_npartitions = MAXPARTITIONS;
lp->d_magic = DISKMAGIC;
@@ -607,8 +607,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
@@ -694,7 +694,7 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp,
{
#define blockpersec(count, lp) ((count) * (((lp)->d_secsize) / DEV_BSIZE))
struct partition *p = lp->d_partitions + DISKPART(bp->b_dev);
- int labelsector = blockpersec(lp->d_partitions[RAW_PART].p_offset, lp) +
+ int labelsector = blockpersec(DL_GETPOFFSET(&lp->d_partitions[RAW_PART]), lp) +
osdep->labelsector;
int sz = howmany(bp->b_bcount, DEV_BSIZE);
@@ -705,8 +705,8 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp,
}
/* beyond partition? */
- if (bp->b_blkno + sz > blockpersec(p->p_size, lp)) {
- sz = blockpersec(p->p_size, lp) - bp->b_blkno;
+ if (bp->b_blkno + sz > blockpersec(DL_GETPSIZE(p), lp)) {
+ sz = blockpersec(DL_GETPSIZE(p), lp) - bp->b_blkno;
if (sz == 0) {
/* If exactly at end of disk, return EOF. */
bp->b_resid = bp->b_bcount;
@@ -722,15 +722,15 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp,
}
/* Overwriting disk label? */
- if (bp->b_blkno + blockpersec(p->p_offset, lp) <= labelsector &&
- bp->b_blkno + blockpersec(p->p_offset, lp) + sz > labelsector &&
+ if (bp->b_blkno + blockpersec(DL_GETPOFFSET(p), lp) <= labelsector &&
+ bp->b_blkno + blockpersec(DL_GETPOFFSET(p), lp) + sz > labelsector &&
(bp->b_flags & B_READ) == 0 && !wlabel) {
bp->b_error = EROFS;
goto bad;
}
/* calculate cylinder for disksort to order transfers with */
- bp->b_cylinder = (bp->b_blkno + blockpersec(p->p_offset, lp)) /
+ bp->b_cylinder = (bp->b_blkno + blockpersec(DL_GETPOFFSET(p), lp)) /
lp->d_secpercyl;
return (1);