Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/luna68k/stand/boot Use the default boot device if a...
details: https://anonhg.NetBSD.org/src/rev/2a407888e76e
branches: trunk
changeset: 340362:2a407888e76e
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Tue Sep 01 13:55:25 2015 +0000
description:
Use the default boot device if a kernel name without device is specificed.
diffstat:
sys/arch/luna68k/stand/boot/devopen.c | 97 +++++++++++++++++++---------------
1 files changed, 55 insertions(+), 42 deletions(-)
diffs (122 lines):
diff -r 0fce2e9dc318 -r 2a407888e76e sys/arch/luna68k/stand/boot/devopen.c
--- a/sys/arch/luna68k/stand/boot/devopen.c Tue Sep 01 13:46:50 2015 +0000
+++ b/sys/arch/luna68k/stand/boot/devopen.c Tue Sep 01 13:55:25 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: devopen.c,v 1.10 2015/09/01 13:46:50 tsutsui Exp $ */
+/* $NetBSD: devopen.c,v 1.11 2015/09/01 13:55:25 tsutsui Exp $ */
/*
* Copyright (c) 1992 OMRON Corporation.
@@ -138,58 +138,71 @@
for (cp = str, i = 0; *cp != '\0' && *cp != '(' && i < MAXDEVNAME; i++)
devname[i] = *cp++;
if (*cp != '(') {
- return -1;
- }
- devname[i] = '\0';
- /* compare dev type name */
- for (dp = devsw; dp->dv_name; dp++)
- if (!strcmp(devname, dp->dv_name))
- break;
- cp++;
- if (dp->dv_name == NULL) {
- return -1;
- }
- dev = dp - devsw;
- /* get mixed controller and unit number */
- haveunit = false;
- for (; *cp != ',' && *cp != ')'; cp++) {
- if (*cp == '\0')
+ /* no device name is specified; assume default */
+ cp = str;
+ /* compare dev type name */
+ for (dp = devsw; dp->dv_name; dp++)
+ if (!strcmp(default_bootdev, dp->dv_name))
+ break;
+ if (dp->dv_name == NULL) {
return -1;
- if (*cp >= '0' && *cp <= '9') {
- unit = unit * 10 + *cp - '0';
- haveunit = true;
+ }
+ dev = dp - devsw;
+ unit = default_unit;
+ } else {
+ devname[i] = '\0';
+ /* compare dev type name */
+ for (dp = devsw; dp->dv_name; dp++)
+ if (!strcmp(devname, dp->dv_name))
+ break;
+ cp++;
+ if (dp->dv_name == NULL) {
+ return -1;
}
- }
- if (unit < 0 || CTLR(unit) >= 2 || TARGET(unit) > 7) {
+ dev = dp - devsw;
+ /* get mixed controller and unit number */
+ haveunit = false;
+ for (; *cp != ',' && *cp != ')'; cp++) {
+ if (*cp == '\0')
+ return -1;
+ if (*cp >= '0' && *cp <= '9') {
+ unit = unit * 10 + *cp - '0';
+ haveunit = true;
+ }
+ }
+ if (unit < 0 || CTLR(unit) >= 2 || TARGET(unit) > 7) {
#ifdef DEBUG
- printf("%s: invalid unit number (%d)\n", __func__, unit);
+ printf("%s: invalid unit number (%d)\n",
+ __func__, unit);
#endif
- return -1;
- }
- if (!haveunit && strcmp(devname, default_bootdev) == 0)
- unit = default_unit;
- /* get optional partition number */
- if (*cp == ',')
+ return -1;
+ }
+ if (!haveunit && strcmp(devname, default_bootdev) == 0)
+ unit = default_unit;
+ /* get optional partition number */
+ if (*cp == ',')
+ cp++;
+
+ for (; /* *cp != ',' && */ *cp != ')'; cp++) {
+ if (*cp == '\0')
+ return -1;
+ if (*cp >= '0' && *cp <= '9')
+ part = part * 10 + *cp - '0';
+ }
+ if (part < 0 || part >= MAXPARTITIONS) {
+#ifdef DEBUG
+ printf("%s: invalid partition number (%d)\n",
+ __func__, part);
+#endif
+ return -1;
+ }
cp++;
-
- for (; /* *cp != ',' && */ *cp != ')'; cp++) {
- if (*cp == '\0')
- return -1;
- if (*cp >= '0' && *cp <= '9')
- part = part * 10 + *cp - '0';
- }
- if (part < 0 || part >= MAXPARTITIONS) {
-#ifdef DEBUG
- printf("%s: invalid partition number (%d)\n", __func__, part);
-#endif
- return -1;
}
/* check out end of dev spec */
*devp = dev;
*unitp = unit;
*partp = part;
if (fname != NULL) {
- cp++;
if (*cp == '\0')
*fname = "netbsd";
else
Home |
Main Index |
Thread Index |
Old Index