Merge with i386/isa/diskslice_machdep.c 1.30
This commit is contained in:
parent
1fbdc08dfe
commit
df317c7516
@ -35,10 +35,10 @@
|
||||
*
|
||||
* 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.27 1997/12/02 21:06:20 phk Exp $
|
||||
* from: i386/isa Id: diskslice_machdep.c,v 1.30 1998/07/25 16:35:06 bde Exp
|
||||
* $Id: diskslice_machdep.c,v 1.1 1998/06/10 10:52:32 dfr Exp $
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/conf.h>
|
||||
@ -137,8 +137,8 @@ check_part(sname, dp, offset, nsectors, ntracks, mbr_offset )
|
||||
error = (ssector == ssector1 && esector == esector1) ? 0 : EINVAL;
|
||||
if (bootverbose)
|
||||
printf("%s: type 0x%x, start %lu, end = %lu, size %lu %s\n",
|
||||
sname, dp->dp_typ, ssector1, esector1, dp->dp_size,
|
||||
error ? "" : ": OK");
|
||||
sname, dp->dp_typ, ssector1, esector1,
|
||||
(u_long)dp->dp_size, error ? "" : ": OK");
|
||||
if (ssector != ssector1 && bootverbose)
|
||||
printf("%s: C/H/S start %d/%d/%d (%lu) != start %lu: invalid\n",
|
||||
sname, chs_scyl, dp->dp_shd, chs_ssect,
|
||||
@ -174,21 +174,6 @@ dsinit(dname, dev, strat, lp, sspp)
|
||||
struct diskslice *sp;
|
||||
struct diskslices *ssp;
|
||||
|
||||
/*
|
||||
* Allocate a dummy slices "struct" and initialize it to contain
|
||||
* only an empty compatibility slice (pointing to itself) and a
|
||||
* whole disk slice (covering the disk as described by the label).
|
||||
* If there is an error, then the dummy struct becomes final.
|
||||
*/
|
||||
ssp = malloc(offsetof(struct diskslices, dss_slices)
|
||||
+ BASE_SLICE * sizeof *sp, M_DEVBUF, M_WAITOK);
|
||||
*sspp = ssp;
|
||||
ssp->dss_first_bsd_slice = COMPATIBILITY_SLICE;
|
||||
ssp->dss_nslices = BASE_SLICE;
|
||||
sp = &ssp->dss_slices[0];
|
||||
bzero(sp, BASE_SLICE * sizeof *sp);
|
||||
sp[WHOLE_DISK_SLICE].ds_size = lp->d_secperunit;
|
||||
|
||||
mbr_offset = DOSBBSECTOR;
|
||||
reread_mbr:
|
||||
/* Read master boot record. */
|
||||
@ -200,7 +185,7 @@ dsinit(dname, dev, strat, lp, sspp)
|
||||
(*strat)(bp);
|
||||
if (biowait(bp) != 0) {
|
||||
diskerr(bp, dname, "error reading primary partition table",
|
||||
LOG_PRINTF, 0, lp);
|
||||
LOG_PRINTF, 0, (struct disklabel *)NULL);
|
||||
printf("\n");
|
||||
error = EIO;
|
||||
goto done;
|
||||
@ -315,21 +300,18 @@ dsinit(dname, dev, strat, lp, sspp)
|
||||
}
|
||||
|
||||
/*
|
||||
* Free the dummy slices "struct" and allocate a real new one.
|
||||
* Initialize special slices as above.
|
||||
* We are passed a pointer to a suitably initialized minimal
|
||||
* slices "struct" with no dangling pointers in it. Replace it
|
||||
* by a maximal one. This usually oversizes the "struct", but
|
||||
* enlarging it while searching for logical drives would be
|
||||
* inconvenient.
|
||||
*/
|
||||
free(ssp, M_DEVBUF);
|
||||
ssp = malloc(offsetof(struct diskslices, dss_slices)
|
||||
#define MAX_SLICES_SUPPORTED MAX_SLICES /* was (BASE_SLICE + NDOSPART) */
|
||||
+ MAX_SLICES_SUPPORTED * sizeof *sp, M_DEVBUF, M_WAITOK);
|
||||
free(*sspp, M_DEVBUF);
|
||||
ssp = dsmakeslicestruct(MAX_SLICES, lp);
|
||||
*sspp = ssp;
|
||||
ssp->dss_first_bsd_slice = COMPATIBILITY_SLICE;
|
||||
sp = &ssp->dss_slices[0];
|
||||
bzero(sp, MAX_SLICES_SUPPORTED * sizeof *sp);
|
||||
sp[WHOLE_DISK_SLICE].ds_size = lp->d_secperunit;
|
||||
|
||||
/* Initialize normal slices. */
|
||||
sp += BASE_SLICE;
|
||||
sp = &ssp->dss_slices[BASE_SLICE];
|
||||
for (dospart = 0, dp = dp0; dospart < NDOSPART; dospart++, dp++, sp++) {
|
||||
sp->ds_offset = mbr_offset + dp->dp_start;
|
||||
sp->ds_size = dp->dp_size;
|
||||
@ -392,7 +374,7 @@ extended(dname, dev, strat, lp, ssp, ext_offset, ext_size, base_ext_offset,
|
||||
(*strat)(bp);
|
||||
if (biowait(bp) != 0) {
|
||||
diskerr(bp, dname, "error reading extended partition table",
|
||||
LOG_PRINTF, 0, lp);
|
||||
LOG_PRINTF, 0, (struct disklabel *)NULL);
|
||||
printf("\n");
|
||||
goto done;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user