[EMAIL PROTECTED] (Mon, Feb 24, 2003 at 07:10:59AM +0100) wrote:
> In message <[EMAIL PROTECTED]>, Hiten Pandya writes:
> >
> >--2oS5YaxWCcQjTEyO
> >Content-Type: text/plain; charset=us-ascii
> >Content-Disposition: inline
> >
> >Hello gang.  Nothing big, but important...
> >
> >Can someone tell me if the machdep.guessed_bootdev sysctl is helpful at
> >all?  I think it's a waste, and it's pretty limited and only available
> >on the i386.
> 
> It isn't and it should be deleted I think.
> 

Okay. I have attached a patch which will nuke the sysctl, and replace
it's use in picobsd's mfs_tree rc scripts with something better, but
which still needs review.  I have not tested the patch, but this patch
should not fail, hopefully.

Cheers.

-- 
Hiten Pandya ([EMAIL PROTECTED], [EMAIL PROTECTED])
http://www.unixdaemons.com/~hiten/
Index: src/release/picobsd/mfs_tree/etc/rc
===================================================================
RCS file: /home/ncvs/src/release/picobsd/mfs_tree/etc/rc,v
retrieving revision 1.9
diff -u -r1.9 rc
--- src/release/picobsd/mfs_tree/etc/rc 17 Nov 2002 20:19:34 -0000      1.9
+++ src/release/picobsd/mfs_tree/etc/rc 24 Feb 2003 06:21:31 -0000
@@ -7,7 +7,7 @@
 
 HOME=/; export HOME
 PATH=/bin; export PATH
-dev=`sysctl -n machdep.guessed_bootdev`
+dev=`mount | grep 'on / ' | awk '{ print $1 }'`
 [ -c "${dev}" ] || dev="/dev/fd0"
 
 trap "echo 'Reboot interrupted'; exit 1" 3
Index: src/release/picobsd/mfs_tree/stand/update
===================================================================
RCS file: /home/ncvs/src/release/picobsd/mfs_tree/stand/update,v
retrieving revision 1.5
diff -u -r1.5 update
--- src/release/picobsd/mfs_tree/stand/update   11 Mar 2002 05:15:44 -0000      1.5
+++ src/release/picobsd/mfs_tree/stand/update   24 Feb 2003 06:20:08 -0000
@@ -5,7 +5,7 @@
 thefiles=$*
 [ -z "$thefiles" ] && \
     thefiles="/etc/rc.conf /etc/rc.firewall /etc/master.passwd"
-dev=`sysctl -n machdep.guessed_bootdev`
+dev=`mount | grep 'on / ' | awk '{ print $1 }'`
 [ -c "${dev}" ] || dev="/dev/fd0"
 mount ${dev} /mnt
 if [ "$?" != "0" ] ; then
Index: src/sbin/sysctl/sysctl.c
===================================================================
RCS file: /home/ncvs/src/sbin/sysctl/sysctl.c,v
retrieving revision 1.51
diff -u -r1.51 sysctl.c
--- src/sbin/sysctl/sysctl.c    22 Jan 2003 00:34:22 -0000      1.51
+++ src/sbin/sysctl/sysctl.c    24 Feb 2003 06:05:01 -0000
@@ -451,55 +451,6 @@
        return 0;
 }
 
-#ifdef __i386__
-/*
- * Code to map a bootdev major number into a suitable device name.
- * Major numbers are mapped into names as in boot2.c
- */
-struct _foo {
-       int majdev;
-       char *name;
-} maj2name[] = {
-       30,     "ad",
-       0,      "wd",
-       1,      "wfd",
-       2,      "fd",
-       4,      "da",
-       -1,     NULL    /* terminator */
-};
-
-static int
-machdep_bootdev(u_long value)
-{
-       int majdev, unit, slice, part;
-       struct _foo *p;
-
-       if (value & B_MAGICMASK != B_DEVMAGIC) {
-               printf("invalid (0x%08x)", value);
-               return 0;
-       }
-       majdev = B_TYPE(value);
-       unit = B_UNIT(value);
-       slice = B_SLICE(value);
-       part = B_PARTITION(value);
-       if (majdev == 2) {      /* floppy, as known to the boot block... */
-               printf("/dev/fd%d", unit);
-               return 0;
-       }
-       for (p = maj2name; p->name != NULL && p->majdev != majdev ; p++) ;
-       if (p->name != NULL) {  /* found */
-               if (slice == WHOLE_DISK_SLICE)
-                       printf("/dev/%s%d%c", p->name, unit, part);
-               else
-                       printf("/dev/%s%ds%d%c",
-                           p->name, unit, slice - BASE_SLICE + 1, part + 'a');
-       } else
-               printf("unknown (major %d unit %d slice %d part %d)",
-                       majdev, unit, slice, part);
-       return 0;
-}
-#endif
-
 /*
  * This formats and outputs the value of one variable
  *
@@ -593,10 +544,6 @@
                if (!nflag)
                        printf("%s%s", name, sep);
                fmt++;
-#ifdef __i386__
-               if (!strcmp(name, "machdep.guessed_bootdev"))
-                       return machdep_bootdev(*(unsigned long *)p);
-#endif
                val = "";
                while (len >= sizeof(long)) {
                        if(*fmt == 'U')
Index: src/sys/i386/i386/machdep.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/i386/machdep.c,v
retrieving revision 1.554
diff -u -r1.554 machdep.c
--- src/sys/i386/i386/machdep.c 20 Feb 2003 05:35:52 -0000      1.554
+++ src/sys/i386/i386/machdep.c 24 Feb 2003 06:03:34 -0000
@@ -1175,10 +1175,6 @@
 SYSCTL_INT(_machdep, CPU_WALLCLOCK, wall_cmos_clock,
        CTLFLAG_RW, &wall_cmos_clock, 0, "");
 
-u_long bootdev;                /* not a dev_t - encoding is different */
-SYSCTL_ULONG(_machdep, OID_AUTO, guessed_bootdev,
-       CTLFLAG_RD, &bootdev, 0, "Maybe the Boot device (not in dev_t format)");
-
 /*
  * Initialize 386 and configure to run kernel
  */
Index: src/sys/pc98/i386/machdep.c
===================================================================
RCS file: /home/ncvs/src/sys/pc98/i386/machdep.c,v
retrieving revision 1.308
diff -u -r1.308 machdep.c
--- src/sys/pc98/i386/machdep.c 23 Feb 2003 13:26:21 -0000      1.308
+++ src/sys/pc98/i386/machdep.c 24 Feb 2003 06:06:53 -0000
@@ -1195,10 +1195,6 @@
 SYSCTL_INT(_machdep, CPU_WALLCLOCK, wall_cmos_clock,
        CTLFLAG_RW, &wall_cmos_clock, 0, "");
 
-u_long bootdev;                /* not a dev_t - encoding is different */
-SYSCTL_ULONG(_machdep, OID_AUTO, guessed_bootdev,
-       CTLFLAG_RD, &bootdev, 0, "Maybe the Boot device (not in dev_t format)");
-
 /*
  * Initialize 386 and configure to run kernel
  */

Reply via email to