diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2007-06-05 00:38:25 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2007-06-05 00:38:25 +0000 |
commit | 27424f98f99646fb8b3e4ef11652da62014a7ceb (patch) | |
tree | 47b5f078f236f633651ce1bad4b1228fac2f6d7d /sys/dev/raidframe | |
parent | 91862e2af60dd7be0a8d86f5f3fe187dbb400d7f (diff) |
use six new macros to access & store the 48-bit disklabel fields related
to size. tested on almost all machines, double checked by miod and krw
next comes the type handling surrounding these values
Diffstat (limited to 'sys/dev/raidframe')
-rw-r--r-- | sys/dev/raidframe/rf_copyback.c | 4 | ||||
-rw-r--r-- | sys/dev/raidframe/rf_disks.c | 6 | ||||
-rw-r--r-- | sys/dev/raidframe/rf_openbsdkintf.c | 22 | ||||
-rw-r--r-- | sys/dev/raidframe/rf_reconstruct.c | 4 |
4 files changed, 18 insertions, 18 deletions
diff --git a/sys/dev/raidframe/rf_copyback.c b/sys/dev/raidframe/rf_copyback.c index 9b573cd9234..65b5f2ccf9c 100644 --- a/sys/dev/raidframe/rf_copyback.c +++ b/sys/dev/raidframe/rf_copyback.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rf_copyback.c,v 1.7 2002/12/16 07:01:03 tdeval Exp $ */ +/* $OpenBSD: rf_copyback.c,v 1.8 2007/06/05 00:38:22 deraadt Exp $ */ /* $NetBSD: rf_copyback.c,v 1.14 2000/03/07 02:59:50 oster Exp $ */ /* @@ -177,7 +177,7 @@ rf_CopybackReconstructedData(RF_Raid_t *raidPtr) } raidPtr->Disks[frow][fcol].blockSize = dpart.disklab->d_secsize; - raidPtr->Disks[frow][fcol].numBlocks = dpart.part->p_size - + raidPtr->Disks[frow][fcol].numBlocks = DL_GETPSIZE(dpart.part) - rf_protectedSectors; raidPtr->raid_cinfo[frow][fcol].ci_vp = vp; diff --git a/sys/dev/raidframe/rf_disks.c b/sys/dev/raidframe/rf_disks.c index 66afd87c22b..2a310d8c630 100644 --- a/sys/dev/raidframe/rf_disks.c +++ b/sys/dev/raidframe/rf_disks.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rf_disks.c,v 1.11 2006/10/13 00:30:08 cloder Exp $ */ +/* $OpenBSD: rf_disks.c,v 1.12 2007/06/05 00:38:22 deraadt Exp $ */ /* $NetBSD: rf_disks.c,v 1.31 2000/06/02 01:17:14 oster Exp $ */ /* @@ -685,8 +685,8 @@ rf_ConfigureDisk(RF_Raid_t *raidPtr, char *buf, RF_RaidDisk_t *diskPtr, } diskPtr->blockSize = dpart.disklab->d_secsize; - diskPtr->numBlocks = dpart.part->p_size - rf_protectedSectors; - diskPtr->partitionSize = dpart.part->p_size; + diskPtr->numBlocks = DL_GETPSIZE(dpart.part) - rf_protectedSectors; + diskPtr->partitionSize = DL_GETPSIZE(dpart.part); raidPtr->raid_cinfo[row][col].ci_vp = vp; raidPtr->raid_cinfo[row][col].ci_dev = va.va_rdev; diff --git a/sys/dev/raidframe/rf_openbsdkintf.c b/sys/dev/raidframe/rf_openbsdkintf.c index 5c3b1294ff9..7b2b4f2336d 100644 --- a/sys/dev/raidframe/rf_openbsdkintf.c +++ b/sys/dev/raidframe/rf_openbsdkintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rf_openbsdkintf.c,v 1.35 2007/04/28 12:32:13 krw Exp $ */ +/* $OpenBSD: rf_openbsdkintf.c,v 1.36 2007/06/05 00:38:22 deraadt Exp $ */ /* $NetBSD: rf_netbsdkintf.c,v 1.109 2001/07/27 03:30:07 oster Exp $ */ /*- @@ -600,7 +600,7 @@ raidsize(dev_t dev) if (lp->d_partitions[part].p_fstype != FS_SWAP) size = -1; else - size = lp->d_partitions[part].p_size * + size = DL_GETPSIZE(&lp->d_partitions[part]) * (lp->d_secsize / DEV_BSIZE); if (omask == 0 && raidclose(dev, 0, S_IFBLK, curproc)) @@ -1758,7 +1758,7 @@ raidstart(RF_Raid_t *raidPtr) blocknum = bp->b_blkno; if (DISKPART(bp->b_dev) != RAW_PART) { pp = &rs->sc_dkdev.dk_label->d_partitions[DISKPART(bp->b_dev)]; - blocknum += pp->p_offset; + blocknum += DL_GETPOFFSET(pp); } db1_printf(("Blocks: %d, %d\n", (int) bp->b_blkno, @@ -2096,7 +2096,7 @@ raidgetdefaultlabel(RF_Raid_t *raidPtr, struct raid_softc *rs, bzero(lp, sizeof(*lp)); /* Fabricate a label... */ - lp->d_secperunit = raidPtr->totalSectors; + DL_SETDSIZE(lp, raidPtr->totalSectors); lp->d_secsize = raidPtr->bytesPerSector; lp->d_nsectors = raidPtr->Layout.dataSectorsPerStripe; lp->d_ntracks = 4 * raidPtr->numCol; @@ -2111,8 +2111,8 @@ raidgetdefaultlabel(RF_Raid_t *raidPtr, struct raid_softc *rs, lp->d_interleave = 1; lp->d_flags = 0; - lp->d_partitions[RAW_PART].p_offset = 0; - lp->d_partitions[RAW_PART].p_size = raidPtr->totalSectors; + DL_SETPOFFSET(&lp->d_partitions[RAW_PART], 0); + DL_SETPSIZE(&lp->d_partitions[RAW_PART], raidPtr->totalSectors); lp->d_partitions[RAW_PART].p_fstype = FS_UNUSED; lp->d_npartitions = RAW_PART + 1; @@ -2165,15 +2165,15 @@ raidgetdisklabel(dev_t dev) * if that is found. */ #ifdef RAIDDEBUG - if (lp->d_secperunit != rs->sc_size) + if (DL_GETDSIZE(lp) != rs->sc_size) printf("WARNING: %s: " "total sector size in disklabel (%d) != " "the size of raid (%ld)\n", rs->sc_xname, - lp->d_secperunit, (long) rs->sc_size); + DL_GETDSIZE(lp), (long) rs->sc_size); #endif /* RAIDDEBUG */ for (i = 0; i < lp->d_npartitions; i++) { pp = &lp->d_partitions[i]; - if (pp->p_offset + pp->p_size > rs->sc_size) + if (DL_GETPOFFSET(pp) + DL_GETPSIZE(pp) > rs->sc_size) printf("WARNING: %s: end of partition `%c' " "exceeds the size of raid (%ld)\n", rs->sc_xname, 'a' + i, (long) rs->sc_size); @@ -2844,11 +2844,11 @@ rf_find_raid_components(void) /* Got the label. Does it look reasonable ? */ if (rf_reasonable_label(clabel) && (clabel->partitionSize <= - label.d_partitions[i].p_size)) { + DL_GETPSIZE(&label.d_partitions[i]))) { #ifdef RAIDDEBUG printf("Component on: %s%c: %d\n", dv->dv_xname, 'a'+i, - label.d_partitions[i].p_size); + DL_GETPSIZE(&label.d_partitions[i])); rf_print_component_label(clabel); #endif /* RAIDDEBUG */ /* diff --git a/sys/dev/raidframe/rf_reconstruct.c b/sys/dev/raidframe/rf_reconstruct.c index abe9a072f54..43896e524da 100644 --- a/sys/dev/raidframe/rf_reconstruct.c +++ b/sys/dev/raidframe/rf_reconstruct.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rf_reconstruct.c,v 1.15 2003/10/26 15:07:26 jmc Exp $ */ +/* $OpenBSD: rf_reconstruct.c,v 1.16 2007/06/05 00:38:22 deraadt Exp $ */ /* $NetBSD: rf_reconstruct.c,v 1.26 2000/06/04 02:05:13 oster Exp $ */ /* @@ -623,7 +623,7 @@ rf_ReconstructInPlace(RF_Raid_t *raidPtr, RF_RowCol_t row, RF_RowCol_t col) dpart.disklab->d_secsize; raidPtr->Disks[row][col].numBlocks = - dpart.part->p_size - rf_protectedSectors; + DL_GETPSIZE(dpart.part) - rf_protectedSectors; raidPtr->raid_cinfo[row][col].ci_vp = vp; raidPtr->raid_cinfo[row][col].ci_dev = va.va_rdev; |