Construct the minor number for the root device taking into account the

slice number passed in by the bootblocks.  This means the kernel will
not use the compatability slice to obtain the root filesystem when
booting from a sliced disk.

Use the extraction macros from reboot.h rather than stating them in full
again.
This commit is contained in:
Mike Smith 1998-03-08 15:06:55 +00:00
parent 130f8c6e14
commit f2dddd5e99
2 changed files with 20 additions and 16 deletions

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
* $Id: autoconf.c,v 1.84 1998/01/24 02:54:12 eivind Exp $
* $Id: autoconf.c,v 1.85 1998/01/30 11:32:39 phk Exp $
*/
/*
@ -443,25 +443,26 @@ static char devname[][2] = {
static void
setroot()
{
int majdev, mindev, unit, part, adaptor;
int majdev, mindev, unit, part, adaptor, slice;
dev_t orootdev;
/*printf("howto %x bootdev %x ", boothowto, bootdev);*/
if (boothowto & RB_DFLTROOT ||
(bootdev & B_MAGICMASK) != (u_long)B_DEVMAGIC)
return;
majdev = (bootdev >> B_TYPESHIFT) & B_TYPEMASK;
majdev = B_TYPE(bootdev);
adaptor = B_ADAPTOR(bootdev);
unit = B_UNIT(bootdev);
slice = B_SLICE(bootdev);
if (majdev > sizeof(devname) / sizeof(devname[0]))
return;
adaptor = (bootdev >> B_ADAPTORSHIFT) & B_ADAPTORMASK;
unit = (bootdev >> B_UNITSHIFT) & B_UNITMASK;
if (majdev == FDMAJOR) {
part = RAW_PART;
mindev = unit << FDUNITSHIFT;
}
else {
part = (bootdev >> B_PARTITIONSHIFT) & B_PARTITIONMASK;
mindev = (unit << PARTITIONSHIFT) + part;
mindev = (slice << 16) + (unit << PARTITIONSHIFT) + part;
}
orootdev = rootdev;
rootdev = makedev(majdev, mindev);
@ -471,9 +472,10 @@ setroot()
*/
if (rootdev == orootdev)
return;
printf("changing root device to %c%c%d%c\n",
printf("changing root device to %c%c%ds%d%c\n",
devname[majdev][0], devname[majdev][1],
mindev >> (majdev == FDMAJOR ? FDUNITSHIFT : PARTITIONSHIFT),
(mindev & 0xf) >> (majdev == FDMAJOR ? FDUNITSHIFT : PARTITIONSHIFT),
slice,
part + 'a');
}

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
* $Id: autoconf.c,v 1.84 1998/01/24 02:54:12 eivind Exp $
* $Id: autoconf.c,v 1.85 1998/01/30 11:32:39 phk Exp $
*/
/*
@ -443,25 +443,26 @@ static char devname[][2] = {
static void
setroot()
{
int majdev, mindev, unit, part, adaptor;
int majdev, mindev, unit, part, adaptor, slice;
dev_t orootdev;
/*printf("howto %x bootdev %x ", boothowto, bootdev);*/
if (boothowto & RB_DFLTROOT ||
(bootdev & B_MAGICMASK) != (u_long)B_DEVMAGIC)
return;
majdev = (bootdev >> B_TYPESHIFT) & B_TYPEMASK;
majdev = B_TYPE(bootdev);
adaptor = B_ADAPTOR(bootdev);
unit = B_UNIT(bootdev);
slice = B_SLICE(bootdev);
if (majdev > sizeof(devname) / sizeof(devname[0]))
return;
adaptor = (bootdev >> B_ADAPTORSHIFT) & B_ADAPTORMASK;
unit = (bootdev >> B_UNITSHIFT) & B_UNITMASK;
if (majdev == FDMAJOR) {
part = RAW_PART;
mindev = unit << FDUNITSHIFT;
}
else {
part = (bootdev >> B_PARTITIONSHIFT) & B_PARTITIONMASK;
mindev = (unit << PARTITIONSHIFT) + part;
mindev = (slice << 16) + (unit << PARTITIONSHIFT) + part;
}
orootdev = rootdev;
rootdev = makedev(majdev, mindev);
@ -471,9 +472,10 @@ setroot()
*/
if (rootdev == orootdev)
return;
printf("changing root device to %c%c%d%c\n",
printf("changing root device to %c%c%ds%d%c\n",
devname[majdev][0], devname[majdev][1],
mindev >> (majdev == FDMAJOR ? FDUNITSHIFT : PARTITIONSHIFT),
(mindev & 0xf) >> (majdev == FDMAJOR ? FDUNITSHIFT : PARTITIONSHIFT),
slice,
part + 'a');
}