Source-Changes-HG archive

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

[src/trunk]: src/sys remove all vesitages of dk_establish().



details:   https://anonhg.NetBSD.org/src/rev/2bc0c9de7a3d
branches:  trunk
changeset: 536524:2bc0c9de7a3d
user:      chs <chs%NetBSD.org@localhost>
date:      Wed Sep 18 01:46:23 2002 +0000

description:
remove all vesitages of dk_establish().

diffstat:

 sys/arch/powerpc/powerpc/ofw_machdep.c |  208 +--------------------------------
 sys/dev/scsipi/cd.c                    |    8 +-
 sys/dev/scsipi/sd.c                    |    8 +-
 sys/sys/disk.h                         |    7 +-
 4 files changed, 6 insertions(+), 225 deletions(-)

diffs (298 lines):

diff -r a4665017f7ad -r 2bc0c9de7a3d sys/arch/powerpc/powerpc/ofw_machdep.c
--- a/sys/arch/powerpc/powerpc/ofw_machdep.c    Wed Sep 18 01:45:49 2002 +0000
+++ b/sys/arch/powerpc/powerpc/ofw_machdep.c    Wed Sep 18 01:46:23 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ofw_machdep.c,v 1.12 2002/09/06 13:18:43 gehenna Exp $ */
+/*     $NetBSD: ofw_machdep.c,v 1.13 2002/09/18 01:46:23 chs Exp $     */
 
 /*
  * Copyright (C) 1996 Wolfgang Solfrank.
@@ -117,209 +117,3 @@
 {
        OF_boot(str);
 }
-
-#ifdef __BROKEN_DK_ESTABLISH
-/*
- * Establish a list of all available disks to allow specifying the
- * root/swap/dump dev.
- */
-struct ofb_disk {
-       LIST_ENTRY(ofb_disk) ofb_list;
-       struct disk *ofb_dk;
-       struct device *ofb_dev;
-       int ofb_phandle;
-       int ofb_unit;
-};
-
-#include <machine/autoconf.h>
-
-static LIST_HEAD(ofb_list, ofb_disk) ofb_head; /* LIST_INIT?           XXX */
-
-void
-dk_establish(struct disk *dk, struct device *dev)
-{
-       struct ofb_disk *od;
-       struct ofbus_softc *ofp = (void *)dev;
-
-       MALLOC(od, struct ofb_disk *, sizeof *od, M_TEMP, M_NOWAIT);
-       if (!od)
-               panic("dk_establish");
-       od->ofb_dk = dk;
-       od->ofb_dev = dev;
-       od->ofb_phandle = ofp->sc_phandle;
-       if (dev->dv_class == DV_DISK)                           /* XXX */
-               od->ofb_unit = ofp->sc_unit;
-       else
-               od->ofb_unit = -1;
-       LIST_INSERT_HEAD(&ofb_head, od, ofb_list);
-}
-
-/*
- * Cleanup the list.
- */
-void
-dk_cleanup(void)
-{
-       struct ofb_disk *od, *nd;
-
-       for (od = ofb_head.lh_first; od; od = nd) {
-               nd = od->ofb_list.le_next;
-               LIST_REMOVE(od, ofb_list);
-               FREE(od, M_TEMP);
-       }
-}
-
-static void
-dk_setroot(struct ofb_disk *od, int part)
-{
-       const struct bdevsw *bdev;
-       char type[8];
-       int unit;
-       struct disklabel *lp;
-       dev_t tmpdev;
-       char *cp;
-       int bmajor;
-
-       if (OF_getprop(od->ofb_phandle, "device_type", type, sizeof type) < 0)
-               panic("OF_getproperty");
-
-       if (strcmp(type, "block") == 0) {
-               bmajor = devsw_name2blk(od->ofb_dev->dv_xname, NULL, 0);
-               if (bmajor == -1)
-                       panic("dk_setroot: impossible");
-               bdev = bdevsw_lookup(makedev(bmajor, 0));
-               if (bdev == NULL)
-                       panic("dk_setroot: impossible");
-
-               /*
-                * Find the unit.
-                */
-               unit = 0;
-               for (cp = od->ofb_dk->dk_name; *cp; cp++) {
-                       if (*cp >= '0' && *cp <= '9')
-                               unit = unit * 10 + *cp - '0';
-                       else
-                               /* Start anew */
-                               unit = 0;
-               }
-
-               /*
-                * Find a default partition; try partition `a', then
-                * fall back on RAW_PART.
-                */
-               if (part == -1) {
-                       /*
-                        * Open the disk to force an update of the in-core
-                        * disklabel.  Use RAW_PART because all disk
-                        * drivers allow RAW_PART to be opened.
-                        */
-                       tmpdev = MAKEDISKDEV(bmajor, unit, RAW_PART);
-
-                       if ((*bdev->d_open)(tmpdev, FREAD, S_IFBLK, 0)) {
-                               /*
-                                * Open failed.  Device is probably not
-                                * configured.  setroot() can handle this.
-                                */
-                               return;
-                       }
-                       (void)(*bdev->d_close)(tmpdev, FREAD, S_IFBLK, 0);
-                       lp = od->ofb_dk->dk_label;
-
-                       /* Check for a valid `a' partition. */
-                       if (lp->d_partitions[0].p_size > 0 &&
-                           lp->d_partitions[0].p_fstype != FS_UNUSED)
-                               part = 0;
-                       else
-                               part = RAW_PART;
-               }
-               booted_device = od->ofb_dev;
-               booted_partition = part;
-       } else if (strcmp(type, "network") == 0) {
-               booted_device = od->ofb_dev;
-               booted_partition = 0;
-       }
-
-       /* "Not found."  setroot() will ask for the root device. */
-}
-
-/*
- * Try to find a disk with the given name.
- * This allows either the OpenFirmware device name,
- * or the NetBSD device name, both with optional trailing partition.
- */
-int
-dk_match(char *name)
-{
-       struct ofb_disk *od;
-       char *cp;
-       int phandle;
-       int part, unit;
-       int l;
-
-       for (od = ofb_head.lh_first; od; od = od->ofb_list.le_next) {
-               /*
-                * First try the NetBSD name.
-                */
-               l = strlen(od->ofb_dev->dv_xname);
-               if (!memcmp(name, od->ofb_dev->dv_xname, l)) {
-                       if (name[l] == '\0') {
-                               /* Default partition, (or none at all) */
-                               dk_setroot(od, -1);
-                               return 0;
-                       }
-                       if (name[l + 1] == '\0') {
-                               switch (name[l]) {
-                               case '*':
-                                       /* Default partition */
-                                       dk_setroot(od, -1);
-                                       return 0;
-                               default:
-                                       if (name[l] >= 'a'
-                                           && name[l] < 'a' + MAXPARTITIONS) {
-                                               /* specified partition */
-                                               dk_setroot(od, name[l] - 'a');
-                                               return 0;
-                                       }
-                                       break;
-                               }
-                       }
-               }
-       }
-       /*
-        * Now try the OpenFirmware name
-        */
-       l = strlen(name);
-       for (cp = name + l; --cp >= name;)
-               if (*cp == '/' || *cp == ':')
-                       break;
-       if (cp >= name && *cp == ':')
-               *cp++ = 0;
-       else
-               cp = name + l;
-       part = *cp >= 'a' && *cp < 'a' + MAXPARTITIONS
-               ? *cp - 'a'
-               : -1;
-       while (cp > name && cp[-1] != '@' && cp[-1] != '/')
-               --cp;
-       if (cp > name && cp[-1] == '@') {
-               for (unit = 0; *++cp >= '0' && *cp <= '9';)
-                       unit = unit * 10 + *cp - '0';
-       } else
-               unit = -1;
-
-       if ((phandle = OF_finddevice(name)) != -1) {
-               for (od = ofb_head.lh_first; od; od = od->ofb_list.le_next) {
-                       if (phandle == od->ofb_phandle) {
-                               /* Check for matching units */
-                               if (od->ofb_dk &&
-                                   unit != -1 &&
-                                   od->ofb_unit != unit)
-                                       continue;
-                               dk_setroot(od, part);
-                               return 0;
-                       }
-               }
-       }
-       return ENODEV;
-}
-#endif /* __BROKEN_DK_ESTABLISH */
diff -r a4665017f7ad -r 2bc0c9de7a3d sys/dev/scsipi/cd.c
--- a/sys/dev/scsipi/cd.c       Wed Sep 18 01:45:49 2002 +0000
+++ b/sys/dev/scsipi/cd.c       Wed Sep 18 01:46:23 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cd.c,v 1.166 2002/09/06 13:18:43 gehenna Exp $ */
+/*     $NetBSD: cd.c,v 1.167 2002/09/18 01:46:23 chs Exp $     */
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.166 2002/09/06 13:18:43 gehenna Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.167 2002/09/18 01:46:23 chs Exp $");
 
 #include "rnd.h"
 
@@ -207,10 +207,6 @@
        cd->sc_dk.dk_name = cd->sc_dev.dv_xname;
        disk_attach(&cd->sc_dk);
 
-#ifdef __BROKEN_DK_ESTABLISH
-       dk_establish(&cd->sc_dk, &cd->sc_dev);          /* XXX */
-#endif
-
        printf("\n");
 
 #if NRND > 0
diff -r a4665017f7ad -r 2bc0c9de7a3d sys/dev/scsipi/sd.c
--- a/sys/dev/scsipi/sd.c       Wed Sep 18 01:45:49 2002 +0000
+++ b/sys/dev/scsipi/sd.c       Wed Sep 18 01:46:23 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sd.c,v 1.187 2002/09/06 13:18:43 gehenna Exp $ */
+/*     $NetBSD: sd.c,v 1.188 2002/09/18 01:46:24 chs Exp $     */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.187 2002/09/06 13:18:43 gehenna Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.188 2002/09/18 01:46:24 chs Exp $");
 
 #include "opt_scsi.h"
 #include "rnd.h"
@@ -179,10 +179,6 @@
        sd->sc_dk.dk_name = sd->sc_dev.dv_xname;
        disk_attach(&sd->sc_dk);
 
-#ifdef __BROKEN_DK_ESTABLISH
-       dk_establish(&sd->sc_dk, &sd->sc_dev);          /* XXX */
-#endif
-
        /*
         * Use the subdriver to request information regarding the drive.
         */
diff -r a4665017f7ad -r 2bc0c9de7a3d sys/sys/disk.h
--- a/sys/sys/disk.h    Wed Sep 18 01:45:49 2002 +0000
+++ b/sys/sys/disk.h    Wed Sep 18 01:46:23 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disk.h,v 1.18 2002/08/30 15:43:43 hannken Exp $        */
+/*     $NetBSD: disk.h,v 1.19 2002/09/18 01:46:25 chs Exp $    */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -185,11 +185,6 @@
 void   disk_unbusy __P((struct disk *, long));
 void   disk_resetstat __P((struct disk *));
 struct disk *disk_find __P((char *));
-
-#ifdef __BROKEN_DK_ESTABLISH           /* XXX DEPRECATED */
-struct device;
-void   dk_establish __P((struct disk *, struct device *));
-#endif
 #endif
 
 #endif /* _SYS_DISK_H_ */



Home | Main Index | Thread Index | Old Index