- Use dev_name2blk[] array prepared by config(8) instead of handcrafting

local data.
This commit is contained in:
nisimura 1999-05-25 09:32:27 +00:00
parent 058f5a1517
commit fec53c08d6

View File

@ -1,4 +1,4 @@
/* $NetBSD: autoconf.c,v 1.33 1999/04/24 08:01:10 simonb Exp $ */ /* $NetBSD: autoconf.c,v 1.34 1999/05/25 09:32:27 nisimura Exp $ */
/* /*
* Copyright (c) 1988 University of Utah. * Copyright (c) 1988 University of Utah.
@ -43,7 +43,7 @@
*/ */
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.33 1999/04/24 08:01:10 simonb Exp $"); __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.34 1999/05/25 09:32:27 nisimura Exp $");
/* /*
* Setup the system to run on the current machine. * Setup the system to run on the current machine.
@ -88,14 +88,9 @@ tc_option_t tc_slot_info[TC_MAX_LOGICAL_SLOTS];
void configure_scsi __P((void)); void configure_scsi __P((void));
void findroot __P((struct device **, int *)); void findroot __P((struct device **, int *));
struct devnametobdevmaj pmax_nam2blk[] = {
{ "rz", 21 },
{ "md", 17 },
{ NULL, 0 },
};
extern struct devnametobdevmaj dev_name2blk[];
/* /*
* Determine mass storage and memory configuration for a machine. * Determine mass storage and memory configuration for a machine.
@ -147,7 +142,7 @@ cpu_rootconf()
printf("boot device: %s\n", printf("boot device: %s\n",
booted_device ? booted_device->dv_xname : "<unknown>"); booted_device ? booted_device->dv_xname : "<unknown>");
setroot(booted_device, booted_partition, pmax_nam2blk); setroot(booted_device, booted_partition, dev_name2blk);
} }
u_long bootdev = 0; /* should be dev_t, but not until 32 bits */ u_long bootdev = 0; /* should be dev_t, but not until 32 bits */
@ -175,9 +170,9 @@ findroot(devpp, partp)
return; return;
majdev = B_TYPE(bootdev); majdev = B_TYPE(bootdev);
for (i = 0; pmax_nam2blk[i].d_name != NULL; i++) { for (i = 0; dev_name2blk[i].d_name != NULL; i++) {
if (majdev == pmax_nam2blk[i].d_maj) { if (majdev == dev_name2blk[i].d_maj) {
bootdv_name = pmax_nam2blk[i].d_name; bootdv_name = dev_name2blk[i].d_name;
break; break;
} }
} }
@ -228,21 +223,21 @@ makebootdev(cp)
else else
part = 0; part = 0;
cp += 2; cp += 2;
for (majdev = 0; pmax_nam2blk[majdev].d_name != NULL; for (majdev = 0; dev_name2blk[majdev].d_name != NULL;
majdev++) { majdev++) {
if (cp[0] == pmax_nam2blk[majdev].d_name[0] && if (cp[0] == dev_name2blk[majdev].d_name[0] &&
cp[1] == pmax_nam2blk[majdev].d_name[1]) { cp[1] == dev_name2blk[majdev].d_name[1]) {
bootdev = MAKEBOOTDEV( bootdev = MAKEBOOTDEV(
pmax_nam2blk[majdev].d_maj, 0, 0, dev_name2blk[majdev].d_maj, 0, 0,
unit, part); unit, part);
return; return;
} }
} }
goto defdev; goto defdev;
} }
for (majdev = 0; pmax_nam2blk[majdev].d_name != NULL; majdev++) for (majdev = 0; dev_name2blk[majdev].d_name != NULL; majdev++)
if (cp[0] == pmax_nam2blk[majdev].d_name[0] && if (cp[0] == dev_name2blk[majdev].d_name[0] &&
cp[1] == pmax_nam2blk[majdev].d_name[1] && cp[1] == dev_name2blk[majdev].d_name[1] &&
cp[2] == '(') cp[2] == '(')
goto fndmaj; goto fndmaj;
defdev: defdev:
@ -250,7 +245,7 @@ defdev:
return; return;
fndmaj: fndmaj:
majdev = pmax_nam2blk[majdev].d_maj; majdev = dev_name2blk[majdev].d_maj;
for (ctrl = 0, cp += 3; *cp >= '0' && *cp <= '9'; ) for (ctrl = 0, cp += 3; *cp >= '0' && *cp <= '9'; )
ctrl = ctrl * 10 + *cp++ - '0'; ctrl = ctrl * 10 + *cp++ - '0';
if (*cp == ',') if (*cp == ',')