Module Name: src
Committed By: mlelstv
Date: Fri Apr 29 18:18:22 UTC 2016
Modified Files:
src/usr.bin/config: config.5 gram.y sem.c
Log Message:
Extend syntax of config phrase, a quoted string instead of a device name
is passed as root specification string. This can be used to specify a
wedge by name.
To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/config/config.5
cvs rdiff -u -r1.52 -r1.53 src/usr.bin/config/gram.y
cvs rdiff -u -r1.73 -r1.74 src/usr.bin/config/sem.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/config/config.5
diff -u src/usr.bin/config/config.5:1.34 src/usr.bin/config/config.5:1.35
--- src/usr.bin/config/config.5:1.34 Tue Sep 1 13:42:48 2015
+++ src/usr.bin/config/config.5 Fri Apr 29 18:18:22 2016
@@ -1,4 +1,4 @@
-.\" $NetBSD: config.5,v 1.34 2015/09/01 13:42:48 uebayasi Exp $
+.\" $NetBSD: config.5,v 1.35 2016/04/29 18:18:22 mlelstv Exp $
.\"
.\" Copyright (c) 2006, 2007 The NetBSD Foundation.
.\" All rights reserved.
@@ -662,6 +662,12 @@ and
parameters can be wildcarded with
.Dq \&?
to let the kernel automatically discover those values.
+The
+.Ar device
+can also be specified as a quoted specification string.
+The kernel interprets this string like the console input
+when prompting for a root device. E.g. "wedge:NAME"
+specifies a named disk wedge.
.Pp
At least one
.Ic config
Index: src/usr.bin/config/gram.y
diff -u src/usr.bin/config/gram.y:1.52 src/usr.bin/config/gram.y:1.53
--- src/usr.bin/config/gram.y:1.52 Tue Sep 1 13:42:48 2015
+++ src/usr.bin/config/gram.y Fri Apr 29 18:18:22 2016
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: gram.y,v 1.52 2015/09/01 13:42:48 uebayasi Exp $ */
+/* $NetBSD: gram.y,v 1.53 2016/04/29 18:18:22 mlelstv Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: gram.y,v 1.52 2015/09/01 13:42:48 uebayasi Exp $");
+__RCSID("$NetBSD: gram.y,v 1.53 2016/04/29 18:18:22 mlelstv Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -103,6 +103,7 @@ DECL_ALLOCWRAP(condexpr);
#define new_nx(n, x) new0(n, NULL, NULL, 0, x)
#define new_ns(n, s) new0(n, s, NULL, 0, NULL)
#define new_si(s, i) new0(NULL, s, NULL, i, NULL)
+#define new_spi(s, p, i) new0(NULL, s, p, i, NULL)
#define new_nsi(n,s,i) new0(n, s, NULL, i, NULL)
#define new_np(n, p) new0(n, NULL, p, 0, NULL)
#define new_s(s) new0(NULL, s, NULL, 0, NULL)
@@ -906,9 +907,14 @@ root_spec:
/* device for root fs or dump */
dev_spec:
- '?' { $$ = new_si(intern("?"),
+ '?' { $$ = new_spi(intern("?"),
+ NULL,
(long long)NODEV); }
- | WORD { $$ = new_si($1,
+ | QSTRING { $$ = new_spi($1,
+ __UNCONST("spec"),
+ (long long)NODEV); }
+ | WORD { $$ = new_spi($1,
+ NULL,
(long long)NODEV); }
| major_minor { $$ = new_si(NULL, $1); }
;
Index: src/usr.bin/config/sem.c
diff -u src/usr.bin/config/sem.c:1.73 src/usr.bin/config/sem.c:1.74
--- src/usr.bin/config/sem.c:1.73 Sat Aug 29 07:24:49 2015
+++ src/usr.bin/config/sem.c Fri Apr 29 18:18:22 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: sem.c,v 1.73 2015/08/29 07:24:49 uebayasi Exp $ */
+/* $NetBSD: sem.c,v 1.74 2016/04/29 18:18:22 mlelstv Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: sem.c,v 1.73 2015/08/29 07:24:49 uebayasi Exp $");
+__RCSID("$NetBSD: sem.c,v 1.74 2016/04/29 18:18:22 mlelstv Exp $");
#include <sys/param.h>
#include <ctype.h>
@@ -928,6 +928,12 @@ resolve(struct nvlist **nvp, const char
*/
return (0);
+ if (nv->nv_ptr != NULL && strcmp(nv->nv_ptr, "spec") == 0)
+ /*
+ * spec string, interpreted by kernel
+ */
+ return (0);
+
/*
* The normal case: things like "ra2b". Check for partition
* suffix, remove it if there, and split into name ("ra") and