Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern - Print a name of root device even if it is a netwo...



details:   https://anonhg.NetBSD.org/src/rev/b8f1d38b5276
branches:  trunk
changeset: 481262:b8f1d38b5276
user:      enami <enami%NetBSD.org@localhost>
date:      Tue Jan 25 09:23:59 2000 +0000

description:
- Print a name of root device even if it is a network device.
- If RB_ASKNAME, only dumpdv holds the results asked interactively.
  Examie dumpspec only when !RB_ASKNAME.  This allows us to override
  dumps on none in kernel config file by booting kernel with RB_ASKNAME.
- Slightly rearrange code so that it more matches to comment.

diffstat:

 sys/kern/kern_subr.c |  61 ++++++++++++++++++---------------------------------
 1 files changed, 22 insertions(+), 39 deletions(-)

diffs (126 lines):

diff -r 0e1d73ec6605 -r b8f1d38b5276 sys/kern/kern_subr.c
--- a/sys/kern/kern_subr.c      Tue Jan 25 09:17:35 2000 +0000
+++ b/sys/kern/kern_subr.c      Tue Jan 25 09:23:59 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_subr.c,v 1.54 2000/01/25 03:42:36 enami Exp $     */
+/*     $NetBSD: kern_subr.c,v 1.55 2000/01/25 09:23:59 enami Exp $     */
 
 /*-
  * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc.
@@ -540,7 +540,7 @@
        int bootpartition;
 {
        struct device *dv;
-       int len, print_newline = 0;
+       int len;
 #ifdef MEMORY_DISK_HOOKS
        int i;
 #endif
@@ -670,11 +670,11 @@
                                break;
                        }
                        if (len == 4 && strcmp(buf, "none") == 0) {
-                               dumpspec = "none";
+                               dumpdv = NULL;
                                break;
                        }
                        dv = getdisk(buf, len, 1, &ndumpdev, 1);
-                       if (dv) {
+                       if (dv != NULL) {
                                dumpdv = dv;
                                break;
                        }
@@ -788,13 +788,12 @@
 
        switch (rootdv->dv_class) {
        case DV_IFNET:
-               /* Nothing. */
+               printf("root on %s", rootdv->dv_xname);
                break;
 
        case DV_DISK:
                printf("root on %s%c", rootdv->dv_xname,
                    DISKPART(rootdev) + 'a');
-               print_newline = 1;
                break;
 
        default:
@@ -805,16 +804,7 @@
 
        /*
         * Now configure the dump device.
-        */
-
-       if (dumpspec != NULL && strcmp(dumpspec, "none") == 0) {
-               /*
-                * Operator doesn't want a dump device.
-                */
-               goto nodumpdev;
-       }
-
-       /*
+        *
         * If we haven't figured out the dump device, do so, with
         * the following rules:
         *
@@ -829,22 +819,14 @@
         *          of the root device.
         */
 
-       if (boothowto & RB_ASKNAME) {
-               if (dumpdv == NULL) {
+       if (boothowto & RB_ASKNAME) {           /* (a) */
+               if (dumpdv == NULL)
+                       goto nodumpdev;
+       } else if (dumpspec != NULL) {          /* (b) */
+               if (strcmp(dumpspec, "none") == 0 || dumpdev == NODEV) {
                        /*
-                        * Just return; dumpdev is already set to NODEV
-                        * and we don't want to print a newline in this
-                        * case.
-                        */
-                       return;
-               }
-               goto out;
-       }
-
-       if (dumpspec != NULL) {
-               if (dumpdev == NODEV) {
-                       /*
-                        * Looks like they tried to pick a network
+                        * Operator doesn't want a dump device.
+                        * Or looks like they tried to pick a network
                         * device.  Oops.
                         */
                        goto nodumpdev;
@@ -869,21 +851,22 @@
                         */
                        goto nodumpdev;
                }
-       } else if (rootdv->dv_class == DV_IFNET)
-               goto nodumpdev;
-       else {
-               dumpdv = rootdv;
-               dumpdev = MAKEDISKDEV(major(rootdev), dumpdv->dv_unit, 1);
+       } else {                                /* (c) */
+               if (rootdv->dv_class == DV_IFNET)
+                       goto nodumpdev;
+               else {
+                       dumpdv = rootdv;
+                       dumpdev = MAKEDISKDEV(major(rootdev),
+                           dumpdv->dv_unit, 1);
+               }
        }
 
- out:
        printf(" dumps on %s%c\n", dumpdv->dv_xname, DISKPART(dumpdev) + 'a');
        return;
 
  nodumpdev:
        dumpdev = NODEV;
-       if (print_newline)
-               printf("\n");
+       printf("\n");
 }
 
 static int



Home | Main Index | Thread Index | Old Index