Module Name:    src
Committed By:   manu
Date:           Mon Sep 16 00:01:17 UTC 2019

Modified Files:
        src/sys/kern: kern_subr.c

Log Message:
Accept root device specification as NAME=label


To generate a diff of this commit:
cvs rdiff -u -r1.226 -r1.227 src/sys/kern/kern_subr.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/kern/kern_subr.c
diff -u src/sys/kern/kern_subr.c:1.226 src/sys/kern/kern_subr.c:1.227
--- src/sys/kern/kern_subr.c:1.226	Sun Sep 15 23:59:33 2019
+++ src/sys/kern/kern_subr.c	Mon Sep 16 00:01:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_subr.c,v 1.226 2019/09/15 23:59:33 manu Exp $	*/
+/*	$NetBSD: kern_subr.c,v 1.227 2019/09/16 00:01:16 manu Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2002, 2007, 2008 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.226 2019/09/15 23:59:33 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.227 2019/09/16 00:01:16 manu Exp $");
 
 #include "opt_ddb.h"
 #include "opt_md.h"
@@ -691,13 +691,18 @@ getdisk(const char *str, int len, int de
 static const char *
 getwedgename(const char *name, int namelen)
 {
-	const char *wpfx = "wedge:";
-	const int wpfxlen = strlen(wpfx);
+	const char *wpfx1 = "wedge:";
+	const char *wpfx2 = "NAME=";
+	const int wpfx1len = strlen(wpfx1);
+	const int wpfx2len = strlen(wpfx2);
 
-	if (namelen < wpfxlen || strncmp(name, wpfx, wpfxlen) != 0)
-		return NULL;
+	if (namelen > wpfx1len && strncmp(name, wpfx1, wpfx1len) == 0)
+		return name + wpfx1len;
+
+	if (namelen > wpfx2len && strncasecmp(name, wpfx2, wpfx2len) == 0)
+		return name + wpfx2len;
 
-	return name + wpfxlen;
+	return NULL;
 }
 
 static device_t

Reply via email to