diff options
author | Hugh Graham <hugh@cvs.openbsd.org> | 2001-04-09 00:59:32 +0000 |
---|---|---|
committer | Hugh Graham <hugh@cvs.openbsd.org> | 2001-04-09 00:59:32 +0000 |
commit | 91640a3884b37c48311b7caa9f77810074d9c212 (patch) | |
tree | b9cf5c5cb79d49118d8e95a9c4f1cb2d136f4f1e | |
parent | 376b13d07aef6922765ef79e074d9b8588968c03 (diff) |
Amputate some dead and broken code and rework the rest to do the
right thing if booting off something other than sd0a.
RB_ASKNAME will be reimplemented later.
-rw-r--r-- | sys/arch/vax/vax/rootfil.c | 69 | ||||
-rw-r--r-- | sys/arch/vax/vax/swapgeneric.c | 97 |
2 files changed, 30 insertions, 136 deletions
diff --git a/sys/arch/vax/vax/rootfil.c b/sys/arch/vax/vax/rootfil.c index 33da1dd8a24..cce8d0ed145 100644 --- a/sys/arch/vax/vax/rootfil.c +++ b/sys/arch/vax/vax/rootfil.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rootfil.c,v 1.9 2000/10/09 23:11:57 bjc Exp $ */ +/* $OpenBSD: rootfil.c,v 1.10 2001/04/09 00:59:30 hugh Exp $ */ /* $NetBSD: rootfil.c,v 1.14 1996/10/13 03:35:58 christos Exp $ */ /* @@ -66,14 +66,12 @@ #include "sd.h" #include "asc.h" -#define DOSWAP /* Change swdevt, argdev, and dumpdev too */ -#ifdef MAJA -u_long bootdev; /* should be dev_t, but not until 32 bits */ -#endif extern dev_t rootdev, dumpdev; -#define PARTITIONMASK 0x7 -#define PARTITIONSHIFT 3 +struct ngcconf { + struct cfdriver *ng_cf; + dev_t ng_root; +}; /* * Attempt to find the device from which we were booted. @@ -85,13 +83,25 @@ setroot() { int majdev, mindev, unit, part, controller, adaptor; dev_t temp = 0, orootdev; - struct swdevt *swp; + struct ngcconf *nc; + extern struct ngcconf ngcconf[]; extern int boothowto; + char name[128]; char *uname; - if (boothowto & RB_DFLTROOT || - (bootdev & B_MAGICMASK) != (u_long)B_DEVMAGIC) - return; + if ((bootdev & B_MAGICMASK) != (u_long)B_DEVMAGIC) { + printf("RPB data looks bogus, prompting user\n"); + boothowto |= RB_ASKNAME; + } + + if (((boothowto & RB_DFLTROOT) || (rootdev != NODEV)) + && !(boothowto & RB_ASKNAME)) + return; + + if (boothowto & RB_ASKNAME) { + printf("root device selection is not currently supported\n"); + } + majdev = bdevtomaj(B_TYPE(bootdev)); if (majdev >= nblkdev || majdev == -1) return; @@ -126,40 +136,21 @@ setroot() return; } + mindev *= MAXPARTITIONS; + mindev += part; orootdev = rootdev; rootdev = makedev(majdev, mindev); - swdevt[0].sw_dev = dumpdev = - makedev(major(rootdev), 1); + + swdevt[0].sw_dev = dumpdev = makedev(major(rootdev), 1); + /* * If the original rootdev is the same as the one * just calculated, don't need to adjust the swap configuration. */ if (rootdev == orootdev) - return; - - printf("Changing root device to %s%c\n", uname, part + 'a'); - -#ifdef DOSWAP - mindev &= ~PARTITIONMASK; - for (swp = swdevt; swp->sw_dev != NODEV; swp++) { - if (majdev == major(swp->sw_dev) && - mindev == (minor(swp->sw_dev) & ~PARTITIONMASK)) { - temp = swdevt[0].sw_dev; - swdevt[0].sw_dev = swp->sw_dev; - swp->sw_dev = temp; - break; - } - } - if (swp->sw_dev == NODEV) - return; - - /* - * If argdev and dumpdev were the same as the old primary swap - * device, move them to the new primary swap device. - */ - if (temp == dumpdev) - dumpdev = swdevt[0].sw_dev; -#endif + printf("Setting root device to %s%c\n", uname, part + 'a'); + else + printf("Changing root device to %s%c\n", uname, part + 'a'); } /* @@ -187,5 +178,3 @@ swapconf() } } } - - diff --git a/sys/arch/vax/vax/swapgeneric.c b/sys/arch/vax/vax/swapgeneric.c index 8fcd9bf6050..ceb05191e4c 100644 --- a/sys/arch/vax/vax/swapgeneric.c +++ b/sys/arch/vax/vax/swapgeneric.c @@ -1,4 +1,4 @@ -/* $OpenBSD: swapgeneric.c,v 1.7 2000/04/27 01:10:13 bjc Exp $ */ +/* $OpenBSD: swapgeneric.c,v 1.8 2001/04/09 00:59:31 hugh Exp $ */ /* $NetBSD: swapgeneric.c,v 1.13 1996/10/13 03:36:01 christos Exp $ */ /*- @@ -102,98 +102,3 @@ struct ngcconf { #endif { 0 }, }; - -void -setconf() -{ - struct ngcconf *nc; - register char *cp, *gp; - int unit, swaponroot = 0, i; - char name[128]; - - if (rootdev != NODEV) - goto doswap; - unit = 0; - /* - * First try new config devices. - */ - if (boothowto & RB_ASKNAME) { -nretry: - swaponroot = 0; - printf("root device? "); - gets(name); - if (name[strlen(name) - 1] == '*') - name[strlen(name) - 1] = swaponroot++; - for (nc = ngcconf; nc->ng_cf; nc++) - for (i = 0; i < nc->ng_cf->cd_ndevs; i++) - if (nc->ng_cf->cd_devs[i] && - strcmp(name, ((struct device *) - (nc->ng_cf->cd_devs[i]))->dv_xname) == 0) - goto ngotit; - - printf("Use one of "); - for (nc = ngcconf; nc->ng_cf; nc++) - printf("%s%%d ", nc->ng_cf->cd_name); - printf("\n"); - - goto nretry; -ngotit: - rootdev = makedev(major(nc->ng_root), i * 8); - goto doswap; - - } else { - for (nc = ngcconf; nc->ng_cf; nc++) - for (i = 0; i < nc->ng_cf->cd_ndevs; i++) - if (nc->ng_cf->cd_devs[i]) { - printf("root on %s%d\n", - nc->ng_cf->cd_name, i); - rootdev = makedev(major(nc->ng_root), - i * 8); - goto doswap; - } - - } - - printf("no suitable root\n"); - asm("halt"); - -doswap: - swdevt[0].sw_dev = argdev = dumpdev = - makedev(major(rootdev), minor(rootdev)+1); - /* swap size and dumplo set during autoconfigure */ - if (swaponroot) - rootdev = dumpdev; -} - -void -gets(cp) - char *cp; -{ - register char *lp; - register c; - - lp = cp; - for (;;) { - cnputc(c = (cngetc()&0x7f)); - switch (c) { - case '\n': - case '\r': - *lp++ = '\0'; - return; - case '\b': - case '#': - case '\177': - lp--; - if (lp < cp) - lp = cp; - continue; - case '@': - case 'u'&037: - lp = cp; - cnputc('\n'); - continue; - default: - *lp++ = c; - } - } -} |