diff options
-rw-r--r-- | sys/i386/isa/diskslice_machdep.c | 35 | ||||
-rw-r--r-- | sys/kern/subr_disklabel.c | 19 | ||||
-rw-r--r-- | sys/kern/subr_diskmbr.c | 35 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_disksubr.c | 19 |
4 files changed, 50 insertions, 58 deletions
diff --git a/sys/i386/isa/diskslice_machdep.c b/sys/i386/isa/diskslice_machdep.c index 1a77f4d..91641f6 100644 --- a/sys/i386/isa/diskslice_machdep.c +++ b/sys/i386/isa/diskslice_machdep.c @@ -35,7 +35,7 @@ * * from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91 * from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $ - * $Id: diskslice_machdep.c,v 1.4 1995/02/16 15:19:19 bde Exp $ + * $Id: diskslice_machdep.c,v 1.5 1995/02/21 08:37:09 bde Exp $ */ #include <stddef.h> @@ -62,8 +62,10 @@ dsinit(dname, dev, strat, lp, sspp) int max_ncyls; int max_nsectors; int max_ntracks; + char partname[2]; u_long secpercyl; int slice; + char *sname; struct diskslice *sp; struct diskslices *ssp; @@ -111,7 +113,8 @@ dsinit(dname, dev, strat, lp, sspp) max_nsectors = 0; max_ntracks = 0; dp0 = (struct dos_partition *)(cp + DOSPARTOFF); - for (dp = dp0, slice = 1; slice <= NDOSPART; dp++, slice++) { + for (dp = dp0, slice = BASE_SLICE; slice < BASE_SLICE + NDOSPART; + dp++, slice++) { int nsectors; int ntracks; @@ -135,7 +138,8 @@ dsinit(dname, dev, strat, lp, sspp) */ error = 0; secpercyl = max_nsectors * max_ntracks; - for (dp = dp0, slice = 1; slice <= NDOSPART; dp++, slice++) { + for (dp = dp0, slice = BASE_SLICE; slice < BASE_SLICE + NDOSPART; + dp++, slice++) { u_long esector; u_long esector1; u_long ssector; @@ -148,22 +152,19 @@ dsinit(dname, dev, strat, lp, sspp) esector = DPSECT(dp->dp_esect) - 1 + dp->dp_ehd * max_nsectors + DPCYL(dp->dp_ecyl, dp->dp_esect) * secpercyl; esector1 = dp->dp_start + dp->dp_size - 1; + sname = dsname(dname, dkunit(dev), slice, RAW_PART, partname); if (ssector != dp->dp_start || esector != esector1) error = EINVAL; #if 1 else - printf("%s%ds%d: start %lu, end = %lu, size %lu: OK\n", - dname, dkunit(dev), slice, ssector, esector, - dp->dp_size); + printf("%s: start %lu, end = %lu, size %lu: OK\n", + sname, ssector, esector, dp->dp_size); if (ssector != dp->dp_start) - printf( - "%s%ds%d: C/H/S start %lu != start %lu: invalid\n", - dname, dkunit(dev), slice, ssector, - dp->dp_start); + printf("%s: C/H/S start %lu != start %lu: invalid\n", + sname, ssector, dp->dp_start); if (esector != esector1) - printf( - "%s%ds%d: C/H/S end %lu != end %lu: invalid\n", - dname, dkunit(dev), slice, esector, esector1); + printf("%s: C/H/S end %lu != end %lu: invalid\n", + sname, esector, esector1); #endif } if (error != 0) @@ -201,10 +202,11 @@ dsinit(dname, dev, strat, lp, sspp) /* Initialize normal slices. */ sp += BASE_SLICE; - for (dp = dp0, slice = 1; slice <= NDOSPART; dp++, slice++, sp++) { + for (dp = dp0, slice = BASE_SLICE; slice < BASE_SLICE + NDOSPART; + dp++, slice++, sp++) { if (dp->dp_typ == DOSPTYP_386BSD && ssp->dss_first_bsd_slice == COMPATIBILITY_SLICE) { - ssp->dss_first_bsd_slice = BASE_SLICE + slice - 1; + ssp->dss_first_bsd_slice = slice; ssp->dss_slices[COMPATIBILITY_SLICE].ds_offset = dp->dp_start; ssp->dss_slices[COMPATIBILITY_SLICE].ds_size @@ -213,7 +215,8 @@ dsinit(dname, dev, strat, lp, sspp) sp->ds_offset = dp->dp_start; sp->ds_size = dp->dp_size; #if 0 - lp->d_subtype |= (lp->d_subtype & 3) + (slice - 1) | DSTYPE_INDOSPART; + lp->d_subtype |= (lp->d_subtype & 3) + | (slice - BASE_SLICE) | DSTYPE_INDOSPART; #endif } diff --git a/sys/kern/subr_disklabel.c b/sys/kern/subr_disklabel.c index 82ade54..e90fc43 100644 --- a/sys/kern/subr_disklabel.c +++ b/sys/kern/subr_disklabel.c @@ -42,7 +42,7 @@ * SUCH DAMAGE. * * @(#)ufs_disksubr.c 8.5 (Berkeley) 1/21/94 - * $Id: ufs_disksubr.c,v 1.8 1994/12/22 04:42:31 bde Exp $ + * $Id: ufs_disksubr.c,v 1.9 1995/02/16 14:47:38 bde Exp $ */ #include <sys/param.h> @@ -621,7 +621,7 @@ diskerr(bp, dname, what, pri, blkdone, lp) int part = dkpart(bp->b_dev); register void (*pr) __P((const char *, ...)); char partname[2]; - char slicename[32]; + char *sname; int sn; if (pri != LOG_PRINTF) { @@ -629,15 +629,9 @@ diskerr(bp, dname, what, pri, blkdone, lp) pr = addlog; } else pr = printf; - slicename[0] = partname[0] = '\0'; - if (slice != WHOLE_DISK_SLICE || part != RAW_PART) { - partname[0] = 'a' + part; - partname[1] = '\0'; - if (slice != COMPATIBILITY_SLICE) - sprintf(slicename, "s%d", slice - 1); - } - (*pr)("%s%d%s%s: %s %sing fsbn ", dname, unit, slicename, partname, - what, bp->b_flags & B_READ ? "read" : "writ"); + sname = dsname("", unit, slice, part, partname); + (*pr)("%s%s: %s %sing fsbn ", sname, partname, what, + bp->b_flags & B_READ ? "read" : "writ"); sn = bp->b_blkno; if (bp->b_bcount <= DEV_BSIZE) (*pr)("%d", sn); @@ -661,8 +655,7 @@ diskerr(bp, dname, what, pri, blkdone, lp) * independent of slices, labels and bad sector remapping, * but some drivers don't set bp->b_pblkno. */ - (*pr)(" (%s%d%s bn %d; cn %d", dname, unit, slicename, sn, - sn / lp->d_secpercyl); + (*pr)(" (%s bn %d; cn %d", sname, sn, sn / lp->d_secpercyl); sn %= lp->d_secpercyl; (*pr)(" tn %d sn %d)", sn / lp->d_nsectors, sn % lp->d_nsectors); } diff --git a/sys/kern/subr_diskmbr.c b/sys/kern/subr_diskmbr.c index 1a77f4d..91641f6 100644 --- a/sys/kern/subr_diskmbr.c +++ b/sys/kern/subr_diskmbr.c @@ -35,7 +35,7 @@ * * from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91 * from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $ - * $Id: diskslice_machdep.c,v 1.4 1995/02/16 15:19:19 bde Exp $ + * $Id: diskslice_machdep.c,v 1.5 1995/02/21 08:37:09 bde Exp $ */ #include <stddef.h> @@ -62,8 +62,10 @@ dsinit(dname, dev, strat, lp, sspp) int max_ncyls; int max_nsectors; int max_ntracks; + char partname[2]; u_long secpercyl; int slice; + char *sname; struct diskslice *sp; struct diskslices *ssp; @@ -111,7 +113,8 @@ dsinit(dname, dev, strat, lp, sspp) max_nsectors = 0; max_ntracks = 0; dp0 = (struct dos_partition *)(cp + DOSPARTOFF); - for (dp = dp0, slice = 1; slice <= NDOSPART; dp++, slice++) { + for (dp = dp0, slice = BASE_SLICE; slice < BASE_SLICE + NDOSPART; + dp++, slice++) { int nsectors; int ntracks; @@ -135,7 +138,8 @@ dsinit(dname, dev, strat, lp, sspp) */ error = 0; secpercyl = max_nsectors * max_ntracks; - for (dp = dp0, slice = 1; slice <= NDOSPART; dp++, slice++) { + for (dp = dp0, slice = BASE_SLICE; slice < BASE_SLICE + NDOSPART; + dp++, slice++) { u_long esector; u_long esector1; u_long ssector; @@ -148,22 +152,19 @@ dsinit(dname, dev, strat, lp, sspp) esector = DPSECT(dp->dp_esect) - 1 + dp->dp_ehd * max_nsectors + DPCYL(dp->dp_ecyl, dp->dp_esect) * secpercyl; esector1 = dp->dp_start + dp->dp_size - 1; + sname = dsname(dname, dkunit(dev), slice, RAW_PART, partname); if (ssector != dp->dp_start || esector != esector1) error = EINVAL; #if 1 else - printf("%s%ds%d: start %lu, end = %lu, size %lu: OK\n", - dname, dkunit(dev), slice, ssector, esector, - dp->dp_size); + printf("%s: start %lu, end = %lu, size %lu: OK\n", + sname, ssector, esector, dp->dp_size); if (ssector != dp->dp_start) - printf( - "%s%ds%d: C/H/S start %lu != start %lu: invalid\n", - dname, dkunit(dev), slice, ssector, - dp->dp_start); + printf("%s: C/H/S start %lu != start %lu: invalid\n", + sname, ssector, dp->dp_start); if (esector != esector1) - printf( - "%s%ds%d: C/H/S end %lu != end %lu: invalid\n", - dname, dkunit(dev), slice, esector, esector1); + printf("%s: C/H/S end %lu != end %lu: invalid\n", + sname, esector, esector1); #endif } if (error != 0) @@ -201,10 +202,11 @@ dsinit(dname, dev, strat, lp, sspp) /* Initialize normal slices. */ sp += BASE_SLICE; - for (dp = dp0, slice = 1; slice <= NDOSPART; dp++, slice++, sp++) { + for (dp = dp0, slice = BASE_SLICE; slice < BASE_SLICE + NDOSPART; + dp++, slice++, sp++) { if (dp->dp_typ == DOSPTYP_386BSD && ssp->dss_first_bsd_slice == COMPATIBILITY_SLICE) { - ssp->dss_first_bsd_slice = BASE_SLICE + slice - 1; + ssp->dss_first_bsd_slice = slice; ssp->dss_slices[COMPATIBILITY_SLICE].ds_offset = dp->dp_start; ssp->dss_slices[COMPATIBILITY_SLICE].ds_size @@ -213,7 +215,8 @@ dsinit(dname, dev, strat, lp, sspp) sp->ds_offset = dp->dp_start; sp->ds_size = dp->dp_size; #if 0 - lp->d_subtype |= (lp->d_subtype & 3) + (slice - 1) | DSTYPE_INDOSPART; + lp->d_subtype |= (lp->d_subtype & 3) + | (slice - BASE_SLICE) | DSTYPE_INDOSPART; #endif } diff --git a/sys/ufs/ufs/ufs_disksubr.c b/sys/ufs/ufs/ufs_disksubr.c index 82ade54..e90fc43 100644 --- a/sys/ufs/ufs/ufs_disksubr.c +++ b/sys/ufs/ufs/ufs_disksubr.c @@ -42,7 +42,7 @@ * SUCH DAMAGE. * * @(#)ufs_disksubr.c 8.5 (Berkeley) 1/21/94 - * $Id: ufs_disksubr.c,v 1.8 1994/12/22 04:42:31 bde Exp $ + * $Id: ufs_disksubr.c,v 1.9 1995/02/16 14:47:38 bde Exp $ */ #include <sys/param.h> @@ -621,7 +621,7 @@ diskerr(bp, dname, what, pri, blkdone, lp) int part = dkpart(bp->b_dev); register void (*pr) __P((const char *, ...)); char partname[2]; - char slicename[32]; + char *sname; int sn; if (pri != LOG_PRINTF) { @@ -629,15 +629,9 @@ diskerr(bp, dname, what, pri, blkdone, lp) pr = addlog; } else pr = printf; - slicename[0] = partname[0] = '\0'; - if (slice != WHOLE_DISK_SLICE || part != RAW_PART) { - partname[0] = 'a' + part; - partname[1] = '\0'; - if (slice != COMPATIBILITY_SLICE) - sprintf(slicename, "s%d", slice - 1); - } - (*pr)("%s%d%s%s: %s %sing fsbn ", dname, unit, slicename, partname, - what, bp->b_flags & B_READ ? "read" : "writ"); + sname = dsname("", unit, slice, part, partname); + (*pr)("%s%s: %s %sing fsbn ", sname, partname, what, + bp->b_flags & B_READ ? "read" : "writ"); sn = bp->b_blkno; if (bp->b_bcount <= DEV_BSIZE) (*pr)("%d", sn); @@ -661,8 +655,7 @@ diskerr(bp, dname, what, pri, blkdone, lp) * independent of slices, labels and bad sector remapping, * but some drivers don't set bp->b_pblkno. */ - (*pr)(" (%s%d%s bn %d; cn %d", dname, unit, slicename, sn, - sn / lp->d_secpercyl); + (*pr)(" (%s bn %d; cn %d", sname, sn, sn / lp->d_secpercyl); sn %= lp->d_secpercyl; (*pr)(" tn %d sn %d)", sn / lp->d_nsectors, sn % lp->d_nsectors); } |