Search bdevsw[] instead of the half-baked builtin table of devices
in the RB_ASKNAME case. I had thought that I made this change in rev.1.18, but rev.1.18 only affects obscure subcases of the RB_DFLTROOT case (subcases where the compiled in default root is not found in bdevsw[] -- then the root device is set to the first device in the half-baked table that is also in bdevsw[]). Removed yet more vestiges of config-time swap configuration.
This commit is contained in:
parent
b68de0bf6a
commit
2c8a6c11d8
@ -34,7 +34,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* from: @(#)swapgeneric.c 5.5 (Berkeley) 5/9/91
|
* from: @(#)swapgeneric.c 5.5 (Berkeley) 5/9/91
|
||||||
* $Id: swapgeneric.c,v 1.24 1998/09/15 10:03:43 gibbs Exp $
|
* $Id: swapgeneric.c,v 1.25 1998/10/25 19:26:18 bde Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -96,8 +96,8 @@ struct genericconf {
|
|||||||
void setconf(void)
|
void setconf(void)
|
||||||
{
|
{
|
||||||
register struct genericconf *gc;
|
register struct genericconf *gc;
|
||||||
int bd;
|
char *cp;
|
||||||
int unit, swaponroot = 0;
|
int bd, unit;
|
||||||
|
|
||||||
if (rootdev != NODEV)
|
if (rootdev != NODEV)
|
||||||
return;
|
return;
|
||||||
@ -106,21 +106,33 @@ void setconf(void)
|
|||||||
retry:
|
retry:
|
||||||
printf("root device? ");
|
printf("root device? ");
|
||||||
gets(name);
|
gets(name);
|
||||||
for (gc = genericconf; gc->gc_name; gc++)
|
cp = name;
|
||||||
if (gc->gc_name[0] == name[0] &&
|
while (cp != '\0' && (*cp < '0' || *cp > '9'))
|
||||||
gc->gc_name[1] == name[1])
|
cp++;
|
||||||
|
if (cp == name) {
|
||||||
|
printf("missing device name\n");
|
||||||
|
goto bad;
|
||||||
|
}
|
||||||
|
if (*cp == '\0') {
|
||||||
|
printf("missing unit number\n");
|
||||||
|
goto bad;
|
||||||
|
}
|
||||||
|
unit = *cp - '0';
|
||||||
|
*cp++ = '\0';
|
||||||
|
for (bd = 0; bd < nblkdev; bd++)
|
||||||
|
if (bdevsw[bd] != NULL &&
|
||||||
|
strcmp(bdevsw[bd]->d_name, name) == 0)
|
||||||
goto gotit;
|
goto gotit;
|
||||||
goto bad;
|
goto bad;
|
||||||
gotit:
|
gotit:
|
||||||
if (name[3] == '*') {
|
while (*cp >= '0' && *cp <= '9')
|
||||||
name[3] = name[4];
|
unit += 10 * unit + *cp++ - '0';
|
||||||
swaponroot++;
|
if (*cp != '\0') {
|
||||||
|
printf("junk after unit number\n");
|
||||||
|
goto bad;
|
||||||
}
|
}
|
||||||
if (name[2] >= '0' && name[2] <= '7' && name[3] == 0) {
|
rootdev = makedev(bd, dkmakeminor(unit, 0, 0));
|
||||||
unit = name[2] - '0';
|
return;
|
||||||
goto found;
|
|
||||||
}
|
|
||||||
printf("bad/missing unit number\n");
|
|
||||||
bad:
|
bad:
|
||||||
printf("use dk%%d\n");
|
printf("use dk%%d\n");
|
||||||
goto retry;
|
goto retry;
|
||||||
|
Loading…
Reference in New Issue
Block a user