diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1997-10-27 16:09:54 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1997-10-27 16:09:54 +0000 |
commit | 96e6df083c6864d6c08e45c17cd87546b628eca7 (patch) | |
tree | 076457c1db7c1a9f873f863a5d9cbc0fa08515a5 /sys/arch/alpha/stand | |
parent | 6ca2ba895066d6cd4663b01f000e57d19e69191e (diff) |
Add back device parsing but don't treat paths like 2.2/alpha/bsd as
a device spec. Instead of returning ENXIO just treat it as a regular
filename and continue.
Diffstat (limited to 'sys/arch/alpha/stand')
-rw-r--r-- | sys/arch/alpha/stand/boot/devopen.c | 90 |
1 files changed, 87 insertions, 3 deletions
diff --git a/sys/arch/alpha/stand/boot/devopen.c b/sys/arch/alpha/stand/boot/devopen.c index bac90dab979..7bff235c727 100644 --- a/sys/arch/alpha/stand/boot/devopen.c +++ b/sys/arch/alpha/stand/boot/devopen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: devopen.c,v 1.5 1997/10/27 04:55:04 millert Exp $ */ +/* $OpenBSD: devopen.c,v 1.6 1997/10/27 16:09:53 millert Exp $ */ /* $NetBSD: devopen.c,v 1.1 1995/11/23 02:39:37 cgd Exp $ */ /*- @@ -60,9 +60,93 @@ devopen(f, fname, file) cp = (char *)fname; ncp = namebuf; - dp = devsw; - ctlr = unit = part = 0; + /* look for a string like '5/rz0/vmunix' or '5/rz3f/vmunix */ + if ((c = *cp) >= '0' && c <= '9') { + ctlr = c - '0'; + /* skip the '/' */ + if (*++cp != '/') + goto defdev; + cp++; + while ((c = *cp) != '\0') { + if (c == '/') + break; + if (c >= '0' && c <= '9') { + /* read unit number */ + unit = c - '0'; + + /* look for a partition */ + if ((c = *++cp) >= 'a' && c <= 'h') { + part = c - 'a'; + c = *++cp; + } + if (c != '/') + goto defdev; + break; + } + if (ncp < namebuf + sizeof(namebuf) - 1) + *ncp++ = c; + cp++; + } + *ncp = '\0'; + } else if (strchr(cp, '(')) { + /* expect a string like 'rz(0,0,0)vmunix' */ + while ((c = *cp) != '\0') { + if (c == '(') { + cp++; + break; + } + if (ncp < namebuf + sizeof(namebuf) - 1) + *ncp++ = c; + cp++; + } + + /* get controller number */ + if ((c = *cp) >= '0' && c <= '9') { + ctlr = c - '0'; + c = *++cp; + } + + if (c == ',') { + /* get SCSI device number */ + if ((c = *++cp) >= '0' && c <= '9') { + unit = c - '0'; + c = *++cp; + } + + if (c == ',') { + /* get partition number */ + if ((c = *++cp) >= '0' && c <= '9') { + part = c - '0'; + c = *++cp; + } + } + } + if (c != ')') + goto defdev; + cp++; + *ncp = '\0'; + } else { +defdev: + /* No valid device specification */ + cp = (char *)fname; + ncp = namebuf; + dp = devsw; + ctlr = unit = part = 0; + goto fnd; + } + + for (dp = devsw, i = 0; i < ndevs; dp++, i++) + if (dp->dv_name && strcmp(namebuf, dp->dv_name) == 0) + goto fnd; + printf("Unknown device '%s'\nKnown devices are:", namebuf); + for (dp = devsw, i = 0; i < ndevs; dp++, i++) + if (dp->dv_name) + printf(" %s", dp->dv_name); + printf("\n"); + return (ENXIO); + +fnd: rc = (dp->dv_open)(f, ctlr, unit, part); if (rc) return (rc); |