Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/xen/i386 parse bootdev parameter for partition and ...



details:   https://anonhg.NetBSD.org/src/rev/8db00285c865
branches:  trunk
changeset: 565837:8db00285c865
user:      cl <cl%NetBSD.org@localhost>
date:      Wed Apr 21 18:06:51 2004 +0000

description:
parse bootdev parameter for partition and set booted_partition accordingly

diffstat:

 sys/arch/xen/i386/autoconf.c |  38 ++++++++++++++++++++++++++++----------
 1 files changed, 28 insertions(+), 10 deletions(-)

diffs (78 lines):

diff -r f63998550b77 -r 8db00285c865 sys/arch/xen/i386/autoconf.c
--- a/sys/arch/xen/i386/autoconf.c      Wed Apr 21 18:06:06 2004 +0000
+++ b/sys/arch/xen/i386/autoconf.c      Wed Apr 21 18:06:51 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.2 2004/04/17 12:56:27 cl Exp $  */
+/*     $NetBSD: autoconf.c,v 1.3 2004/04/21 18:06:51 cl Exp $  */
 /*     NetBSD: autoconf.c,v 1.75 2003/12/30 12:33:22 pk Exp    */
 
 /*-
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.2 2004/04/17 12:56:27 cl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.3 2004/04/21 18:06:51 cl Exp $");
 
 #include "opt_compat_oldboot.h"
 #include "opt_multiprocessor.h"
@@ -398,6 +398,7 @@
 {
        struct btinfo_bootdisk *bid;
        struct device *dv;
+       char bootdev[16]; /* sizeof(dv_xname) */
 #ifdef COMPAT_OLDBOOT
        int i, majdev, unit, part;
        char buf[32];
@@ -476,6 +477,29 @@
                        return;
        }
 
+       xen_parse_cmdline(bootdev, NULL);
+       if (bootdev[0] == 0)
+               strcat(bootdev, "xbd0");
+
+       for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
+               if (is_valid_disk(dv) == 0)
+                       continue;
+
+               if (strncmp(bootdev, dv->dv_xname, strlen(dv->dv_xname)))
+                       continue;
+
+               if (strlen(bootdev) != strlen(dv->dv_xname)) {
+                       booted_partition =
+                               toupper(bootdev[strlen(dv->dv_xname)]) - 'A';
+               }
+
+               booted_device = dv;
+               break;
+       }
+
+       if (booted_device)
+               return;
+
 #ifdef COMPAT_OLDBOOT
 #if 0
        printf("howto %x bootdev %x ", boothowto, bootdev);
@@ -530,13 +554,6 @@
                        goto found;
                }
        }
-       if (dev->dv_class == DV_DISK) {
-               char bootdev[16]; /* sizeof(dv_xname) */
-
-               xen_parse_cmdline(bootdev, NULL);
-               if (strncmp(bootdev, dev->dv_xname, 16) == 0)
-                       goto found;
-       }
 #endif
        if (dev->dv_class == DV_IFNET) {
                struct btinfo_netif *bin = lookup_bootinfo(BTINFO_NETIF);
@@ -603,5 +620,6 @@
        name = dv->dv_cfdata->cf_name;
 
        return (strcmp(name, "sd") == 0 || strcmp(name, "wd") == 0 ||
-           strcmp(name, "ld") == 0 || strcmp(name, "ed") == 0);
+           strcmp(name, "ld") == 0 || strcmp(name, "ed") == 0 ||
+           strcmp(name, "xbd") == 0);
 }



Home | Main Index | Thread Index | Old Index