Source-Changes-HG archive

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

[src/trunk]: src/sys Don't pass a nam2blk around at all; just have setroot() ...



details:   https://anonhg.NetBSD.org/src/rev/73b857263046
branches:  trunk
changeset: 473573:73b857263046
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Jun 07 20:16:08 1999 +0000

description:
Don't pass a nam2blk around at all; just have setroot() and friends reference
dev_name2blk[] directly.  Addresses PR #7622 (ITOH Yasufumi), although
in a different way.

diffstat:

 sys/arch/alpha/alpha/autoconf.c       |  16 +------
 sys/arch/amiga/amiga/autoconf.c       |  11 +----
 sys/arch/arm32/arm32/autoconf.c       |  25 +++--------
 sys/arch/atari/atari/autoconf.c       |  13 +-----
 sys/arch/bebox/bebox/autoconf.c       |  22 ++-------
 sys/arch/hp300/hp300/autoconf.c       |  12 +----
 sys/arch/i386/i386/autoconf.c         |  26 +++--------
 sys/arch/mac68k/mac68k/autoconf.c     |  20 ++------
 sys/arch/macppc/macppc/autoconf.c     |   4 +-
 sys/arch/mvme68k/mvme68k/autoconf.c   |  12 +----
 sys/arch/newsmips/newsmips/autoconf.c |   4 +-
 sys/arch/next68k/next68k/autoconf.c   |  12 +----
 sys/arch/ofppc/ofppc/autoconf.c       |  12 +----
 sys/arch/pc532/pc532/autoconf.c       |  12 +----
 sys/arch/pica/pica/autoconf.c         |  30 ++++----------
 sys/arch/pmax/pmax/autoconf.c         |   6 +-
 sys/arch/sparc/sparc/autoconf.c       |   4 +-
 sys/arch/sparc64/sparc64/autoconf.c   |   4 +-
 sys/arch/sun3/sun3/autoconf.c         |  17 +-------
 sys/arch/vax/vax/autoconf.c           |  15 +------
 sys/arch/x68k/x68k/autoconf.c         |  17 ++-----
 sys/kern/init_main.c                  |   4 +-
 sys/kern/kern_subr.c                  |  73 +++++++++++-----------------------
 sys/sys/conf.h                        |   4 +-
 24 files changed, 103 insertions(+), 272 deletions(-)

diffs (truncated from 1041 to 300 lines):

diff -r 8946814ba9cc -r 73b857263046 sys/arch/alpha/alpha/autoconf.c
--- a/sys/arch/alpha/alpha/autoconf.c   Mon Jun 07 19:24:38 1999 +0000
+++ b/sys/arch/alpha/alpha/autoconf.c   Mon Jun 07 20:16:08 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.33 1999/02/23 03:20:00 thorpej Exp $ */
+/* $NetBSD: autoconf.c,v 1.34 1999/06/07 20:16:09 thorpej Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -46,7 +46,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.33 1999/02/23 03:20:00 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.34 1999/06/07 20:16:09 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -69,16 +69,6 @@
 void   parse_prom_bootdev __P((void));
 int    atoi __P((char *));
 
-struct devnametobdevmaj alpha_nam2blk[] = {
-       { "st",         2 },
-       { "cd",         3 },
-       { "md",         6 },
-       { "sd",         8 },
-       { "fd",         0 },
-       { "wd",         4 },
-       { NULL,         0 },
-};
-
 /*
  * configure:
  * called at boot time, configure all devices on system
@@ -115,7 +105,7 @@
        if (booted_device == NULL)
                printf("WARNING: can't figure what device matches \"%s\"\n",
                    bootinfo.booted_dev);
-       setroot(booted_device, booted_partition, alpha_nam2blk);
+       setroot(booted_device, booted_partition);
 }
 
 void
diff -r 8946814ba9cc -r 73b857263046 sys/arch/amiga/amiga/autoconf.c
--- a/sys/arch/amiga/amiga/autoconf.c   Mon Jun 07 19:24:38 1999 +0000
+++ b/sys/arch/amiga/amiga/autoconf.c   Mon Jun 07 20:16:08 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.63 1999/04/01 00:17:46 thorpej Exp $    */
+/*     $NetBSD: autoconf.c,v 1.64 1999/06/07 20:16:10 thorpej Exp $    */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -50,13 +50,6 @@
 int cold;      /* 1 if still booting */
 #include <sys/kernel.h>
 
-struct devnametobdevmaj amiga_nam2blk[] = {
-       { "fd",         2 },
-       { "sd",         4 },
-       { "cd",         7 },
-       { "md",         15 },
-       { NULL,         0 },
-};
 u_long boot_partition;
 
 /*
@@ -126,7 +119,7 @@
 #ifdef DEBUG_KERNEL_START
        printf("survived findroot()\n");
 #endif
-       setroot(booted_device, booted_partition, amiga_nam2blk);
+       setroot(booted_device, booted_partition);
 #ifdef DEBUG_KERNEL_START
        printf("survived setroot()\n");
 #endif
diff -r 8946814ba9cc -r 73b857263046 sys/arch/arm32/arm32/autoconf.c
--- a/sys/arch/arm32/arm32/autoconf.c   Mon Jun 07 19:24:38 1999 +0000
+++ b/sys/arch/arm32/arm32/autoconf.c   Mon Jun 07 20:16:08 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.29 1999/02/07 09:34:58 jonathan Exp $   */
+/*     $NetBSD: autoconf.c,v 1.30 1999/06/07 20:16:10 thorpej Exp $    */
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -84,17 +84,6 @@
 static void set_root_device __P((void));
 #endif
 
-/* Table major numbers for the device names, NULL terminated */
-
-struct devnametobdevmaj arm32_nam2blk[] = {
-       { "wd",         16 },
-       { "fd",         17 },
-       { "md",         18 },
-       { "sd",         24 },
-       { "cd",         26 },
-       { NULL,         0 },
-};
-
 #ifndef MEMORY_DISK_IS_ROOT
 /* Decode a device name to a major and minor number */
 
@@ -114,10 +103,10 @@
        if (strncmp(name, "/dev/", 5) == 0)
                name += 5;
 
-       for (loop = 0; arm32_nam2blk[loop].d_name != NULL; ++loop) {
-               if (strncmp(name, arm32_nam2blk[loop].d_name,
-                   strlen(arm32_nam2blk[loop].d_name)) == 0) {
-                       name += strlen(arm32_nam2blk[loop].d_name);
+       for (loop = 0; dev_name2blk[loop].d_name != NULL; ++loop) {
+               if (strncmp(name, dev_name2blk[loop].d_name,
+                   strlen(dev_name2blk[loop].d_name)) == 0) {
+                       name += strlen(dev_name2blk[loop].d_name);
                        unit = part = 0;
 
                        cp = name;
@@ -130,7 +119,7 @@
                                part = *cp - 'a';
                        else if (*cp != '\0' && *cp != ' ')
                                return;
-                       sprintf(buf, "%s%d", arm32_nam2blk[loop].d_name, unit);
+                       sprintf(buf, "%s%d", dev_name2blk[loop].d_name, unit);
                        for (dv = alldevs.tqh_first; dv != NULL;
                            dv = dv->dv_list.tqe_next) {
                                if (strcmp(buf, dv->dv_xname) == 0) {
@@ -175,7 +164,7 @@
        printf("boot device: %s\n",
            booted_device != NULL ? booted_device->dv_xname : "<unknown>");
 #endif
-       setroot(booted_device, booted_partition, arm32_nam2blk);
+       setroot(booted_device, booted_partition);
 }
 
 
diff -r 8946814ba9cc -r 73b857263046 sys/arch/atari/atari/autoconf.c
--- a/sys/arch/atari/atari/autoconf.c   Mon Jun 07 19:24:38 1999 +0000
+++ b/sys/arch/atari/atari/autoconf.c   Mon Jun 07 20:16:08 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.28 1998/09/02 11:24:16 leo Exp $        */
+/*     $NetBSD: autoconf.c,v 1.29 1999/06/07 20:16:10 thorpej Exp $    */
 
 /*
  * Copyright (c) 1995 Leo Weppelman
@@ -51,15 +51,6 @@
 int atari_realconfig;
 #include <sys/kernel.h>
 
-struct devnametobdevmaj atari_nam2blk[] = {
-       { "md",         1 },
-       { "fd",         2 },
-       { "sd",         4 },
-       { "cd",         6 },
-       { "wd",         14 },
-       { NULL,         0 },
-};
-
 /*
  * called at boot time, configure all devices on system
  */
@@ -83,7 +74,7 @@
        int booted_partition;
 
        findroot(&booted_device, &booted_partition);
-       setroot(booted_device, booted_partition, atari_nam2blk);
+       setroot(booted_device, booted_partition);
 }
 
 /*ARGSUSED*/
diff -r 8946814ba9cc -r 73b857263046 sys/arch/bebox/bebox/autoconf.c
--- a/sys/arch/bebox/bebox/autoconf.c   Mon Jun 07 19:24:38 1999 +0000
+++ b/sys/arch/bebox/bebox/autoconf.c   Mon Jun 07 20:16:08 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.1 1997/10/14 06:47:20 sakamoto Exp $    */
+/*     $NetBSD: autoconf.c,v 1.2 1999/06/07 20:16:10 thorpej Exp $     */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -68,16 +68,6 @@
  */
 extern int     cold;           /* cold start flag initialized in locore.s */
 
-struct devnametobdevmaj bebox_nam2blk[] = {
-       { "wd",         0 },
-       { "sd",         4 },
-       { "cd",         6 },
-       { "mcd",        7 },
-       { "fd",         2 },
-       { "md",         17 },
-       { NULL,         0 },
-};
-
 /*
  * Determine i/o configuration for a machine.
  */
@@ -108,7 +98,7 @@
        printf("boot device: %s\n",
            booted_device ? booted_device->dv_xname : "<unknown>");
 
-       setroot(booted_device, booted_partition, bebox_nam2blk);
+       setroot(booted_device, booted_partition);
 }
 
 u_long bootdev = 0;            /* should be dev_t, but not until 32 bits */
@@ -141,16 +131,16 @@
                return;
 
        majdev = (bootdev >> B_TYPESHIFT) & B_TYPEMASK;
-       for (i = 0; bebox_nam2blk[i].d_name != NULL; i++)
-               if (majdev == bebox_nam2blk[i].d_maj)
+       for (i = 0; dev_name2blk[i].d_name != NULL; i++)
+               if (majdev == dev_name2blk[i].d_maj)
                        break;
-       if (bebox_nam2blk[i].d_name == NULL)
+       if (dev_name2blk[i].d_name == NULL)
                return;
 
        part = (bootdev >> B_PARTITIONSHIFT) & B_PARTITIONMASK;
        unit = (bootdev >> B_UNITSHIFT) & B_UNITMASK;
 
-       sprintf(buf, "%s%d", bebox_nam2blk[i].d_name, unit);
+       sprintf(buf, "%s%d", dev_name2blk[i].d_name, unit);
        for (dv = alldevs.tqh_first; dv != NULL;
            dv = dv->dv_list.tqe_next) {
                if (strcmp(buf, dv->dv_xname) == 0) {
diff -r 8946814ba9cc -r 73b857263046 sys/arch/hp300/hp300/autoconf.c
--- a/sys/arch/hp300/hp300/autoconf.c   Mon Jun 07 19:24:38 1999 +0000
+++ b/sys/arch/hp300/hp300/autoconf.c   Mon Jun 07 20:16:08 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.45 1999/04/10 17:31:02 kleink Exp $     */
+/*     $NetBSD: autoconf.c,v 1.46 1999/06/07 20:16:10 thorpej Exp $    */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -255,14 +255,6 @@
        return (0);
 }
 
-struct devnametobdevmaj hp300_nam2blk[] = {
-       { "ct",          0 },
-       { "rd",          2 },
-       { "sd",          4 },
-       { "md",         14 },
-       { NULL,          0 },
-};
-
 /*
  * Determine the device configuration for the running system.
  */
@@ -369,7 +361,7 @@
        if (booted_device != NULL && booted_device->dv_class == DV_TAPE)
                boothowto |= RB_ASKNAME;
 
-       setroot(dv, booted_partition, hp300_nam2blk);
+       setroot(dv, booted_partition);
 
        /*
         * Set bootdev based on what we found as the root.
diff -r 8946814ba9cc -r 73b857263046 sys/arch/i386/i386/autoconf.c
--- a/sys/arch/i386/i386/autoconf.c     Mon Jun 07 19:24:38 1999 +0000
+++ b/sys/arch/i386/i386/autoconf.c     Mon Jun 07 20:16:08 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.37 1999/04/01 00:37:50 thorpej Exp $    */
+/*     $NetBSD: autoconf.c,v 1.38 1999/06/07 20:16:11 thorpej Exp $    */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -78,16 +78,6 @@
  */
 extern int     cold;           /* cold start flag initialized in locore.s */
 
-struct devnametobdevmaj i386_nam2blk[] = {
-       { "wd",         0 },
-       { "sd",         4 },
-       { "cd",         6 },
-       { "mcd",        7 },
-       { "fd",         2 },
-       { "md",         17 },
-       { NULL,         0 },
-};
-
 /*
  * Determine i/o configuration for a machine.
  */
@@ -126,7 +116,7 @@
        printf("boot device: %s\n",
            booted_device ? booted_device->dv_xname : "<unknown>");
 
-       setroot(booted_device, booted_partition, i386_nam2blk);
+       setroot(booted_device, booted_partition);
 }
 
 /*
@@ -197,7 +187,7 @@
                            "%s%d", dv->dv_cfdata->cf_driver->cd_name,
                            dv->dv_unit);
 
-                       for (d = i386_nam2blk; d->d_name &&
+                       for (d = dev_name2blk; d->d_name &&



Home | Main Index | Thread Index | Old Index