Sync with Chris' changes to the alpha setroot() and friends to resolve some

problems with entering "halt" at prompts.
This commit is contained in:
scottr 1996-10-04 14:07:03 +00:00
parent 8672fd704e
commit d036bd234e
1 changed files with 19 additions and 15 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.32 1996/08/09 10:30:23 mrg Exp $ */ /* $NetBSD: autoconf.c,v 1.33 1996/10/04 14:07:03 scottr Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -74,7 +74,7 @@
struct device *booted_device; struct device *booted_device;
int booted_partition; int booted_partition;
struct device *parsedisk __P((char *, int, int, dev_t *)); static struct device *parsedisk __P((char *, int, int, dev_t *));
static struct device *getdisk __P((char *, int, int, dev_t *)); static struct device *getdisk __P((char *, int, int, dev_t *));
static int findblkmajor __P((struct device *)); static int findblkmajor __P((struct device *));
static int getstr __P((char *, int)); static int getstr __P((char *, int));
@ -171,12 +171,12 @@ getdisk(str, len, defpart, devp)
printf(" %s", dv->dv_xname); printf(" %s", dv->dv_xname);
#endif #endif
} }
printf("\n"); printf(" halt\n");
} }
return (dv); return (dv);
} }
struct device * static struct device *
parsedisk(str, len, defpart, devp) parsedisk(str, len, defpart, devp)
char *str; char *str;
int len, defpart; int len, defpart;
@ -188,6 +188,10 @@ parsedisk(str, len, defpart, devp)
if (len == 0) if (len == 0)
return (NULL); return (NULL);
if (len == 4 && !strcmp(str, "halt"))
boot(RB_HALT, NULL);
cp = str + len - 1; cp = str + len - 1;
c = *cp; c = *cp;
if (c >= 'a' && c <= ('a' + MAXPARTITIONS - 1)) { if (c >= 'a' && c <= ('a' + MAXPARTITIONS - 1)) {
@ -264,17 +268,18 @@ setroot(void)
if (boothowto & RB_ASKNAME) { if (boothowto & RB_ASKNAME) {
for (;;) { for (;;) {
printf("root device"); printf("root device");
if (bootdv != NULL) if (bootdv != NULL) {
printf(" (default %s%c)", bootdv->dv_xname, printf(" (default %s", bootdv->dv_xname);
bootdv->dv_class == DV_DISK ? 'a' : ' '); if (bootdv->dv_class == DV_DISK)
printf("a");
printf(")");
}
printf(": "); printf(": ");
len = getstr(buf, sizeof(buf)); len = getstr(buf, sizeof(buf));
if (len == 0 && bootdv != NULL) { if (len == 0 && bootdv != NULL) {
strcpy(buf, bootdv->dv_xname); strcpy(buf, bootdv->dv_xname);
len = strlen(buf); len = strlen(buf);
} }
if (len == 4 && !strcmp(buf, "halt"))
boot(RB_HALT, NULL);
if (len > 0 && buf[len - 1] == '*') { if (len > 0 && buf[len - 1] == '*') {
buf[--len] = '\0'; buf[--len] = '\0';
dv = getdisk(buf, len, 1, &nrootdev); dv = getdisk(buf, len, 1, &nrootdev);
@ -301,9 +306,10 @@ setroot(void)
} }
for (;;) { for (;;) {
printf("swap device"); printf("swap device");
if (rootdv != NULL) printf(" (default %s", rootdv->dv_xname);
printf(" (default %s%c)", rootdv->dv_xname, if (rootdv->dv_class == DV_DISK)
rootdv->dv_class == DV_DISK ? 'b' : ' '); printf("b");
printf(")");
printf(": "); printf(": ");
len = getstr(buf, sizeof(buf)); len = getstr(buf, sizeof(buf));
if (len == 0) { if (len == 0) {
@ -324,8 +330,6 @@ setroot(void)
swapdv = rootdv; swapdv = rootdv;
break; break;
} }
if (len == 4 && !strcmp(buf, "halt"))
boot(RB_HALT, NULL);
dv = getdisk(buf, len, 1, &nswapdev); dv = getdisk(buf, len, 1, &nswapdev);
if (dv) { if (dv) {
if (dv->dv_class == DV_IFNET) if (dv->dv_class == DV_IFNET)
@ -369,7 +373,7 @@ gotswap:
} else { } else {
/* /*
* `root DEV swap DEV': honour rootdev/swdevt. * `root DEV swap DEV': honor rootdev/swdevt.
* rootdev/swdevt/mountroot already properly set. * rootdev/swdevt/mountroot already properly set.
*/ */
return; return;