Module Name:    src
Committed By:   christos
Date:           Mon May 12 15:53:01 UTC 2014

Modified Files:
        src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
restore defaulting to the 'a' partition for booting with root on raid as
it was before, and explain why we do things this way.


To generate a diff of this commit:
cvs rdiff -u -r1.309 -r1.310 src/sys/dev/raidframe/rf_netbsdkintf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.309 src/sys/dev/raidframe/rf_netbsdkintf.c:1.310
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.309	Thu May  8 16:36:15 2014
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Mon May 12 11:53:01 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.309 2014/05/08 20:36:15 jakllsch Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.310 2014/05/12 15:53:01 christos Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***********************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.309 2014/05/08 20:36:15 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.310 2014/05/12 15:53:01 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -527,11 +527,22 @@ rf_buildroothack(RF_ConfigSet_t *config_
 
 	/* we found something bootable... */
 
+	/*
+	 * XXX: The following code assumes that the root raid
+	 * is the first ('a') partition. This is about the best
+	 * we can do with a BSD disklabel, but we might be able
+	 * to do better with a GPT label, by setting a specified
+	 * attribute to indicate the root partition. We can then
+	 * stash the partition number in the r->root_partition
+	 * high bits (the bottom 2 bits are already used). For
+	 * now we just set booted_partition to 0 when we override
+	 * root.
+	 */
 	if (num_root == 1) {
 		device_t candidate_root;
 		if (rsc->sc_dkdev.dk_nwedges != 0) {
-			/* XXX: How do we find the real root partition? */
 			char cname[sizeof(cset->ac->devname)];
+			/* XXX: assume 'a' */
 			snprintf(cname, sizeof(cname), "%s%c",
 			    device_xname(rsc->sc_dev), 'a');
 			candidate_root = dkwedge_find_by_wname(cname);
@@ -539,8 +550,10 @@ rf_buildroothack(RF_ConfigSet_t *config_
 			candidate_root = rsc->sc_dev;
 		if (booted_device == NULL ||
 		    rsc->sc_r.root_partition == 1 ||
-		    rf_containsboot(&rsc->sc_r, booted_device))
+		    rf_containsboot(&rsc->sc_r, booted_device)) {
 			booted_device = candidate_root;
+			booted_partition = 0;	/* XXX assume 'a' */
+		}
 	} else if (num_root > 1) {
 
 		/* 
@@ -571,6 +584,7 @@ rf_buildroothack(RF_ConfigSet_t *config_
 
 		if (num_root == 1) {
 			booted_device = rsc->sc_dev;
+			booted_partition = 0;	/* XXX assume 'a' */
 		} else {
 			/* we can't guess.. require the user to answer... */
 			boothowto |= RB_ASKNAME;

Reply via email to