Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/config Extend syntax of config phrase, a quoted stri...



details:   https://anonhg.NetBSD.org/src/rev/127aebe7c589
branches:  trunk
changeset: 815105:127aebe7c589
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Fri Apr 29 18:18:22 2016 +0000

description:
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.

diffstat:

 usr.bin/config/config.5 |   8 +++++++-
 usr.bin/config/gram.y   |  14 ++++++++++----
 usr.bin/config/sem.c    |  10 ++++++++--
 3 files changed, 25 insertions(+), 7 deletions(-)

diffs (97 lines):

diff -r 189f8e7a57f8 -r 127aebe7c589 usr.bin/config/config.5
--- a/usr.bin/config/config.5   Fri Apr 29 16:26:48 2016 +0000
+++ b/usr.bin/config/config.5   Fri Apr 29 18:18:22 2016 +0000
@@ -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 @@
 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
diff -r 189f8e7a57f8 -r 127aebe7c589 usr.bin/config/gram.y
--- a/usr.bin/config/gram.y     Fri Apr 29 16:26:48 2016 +0000
+++ b/usr.bin/config/gram.y     Fri Apr 29 18:18:22 2016 +0000
@@ -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 @@
 #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 @@
 
 /* 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); }
 ;
diff -r 189f8e7a57f8 -r 127aebe7c589 usr.bin/config/sem.c
--- a/usr.bin/config/sem.c      Fri Apr 29 16:26:48 2016 +0000
+++ b/usr.bin/config/sem.c      Fri Apr 29 18:18:22 2016 +0000
@@ -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 @@
                 */
                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



Home | Main Index | Thread Index | Old Index