Source-Changes-HG archive

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

[src/trunk]: src/etc When reading in the MD MAKEDEV.conf, perform block / cha...



details:   https://anonhg.NetBSD.org/src/rev/cdf430125460
branches:  trunk
changeset: 972922:cdf430125460
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Jun 13 19:46:23 2020 +0000

description:
When reading in the MD MAKEDEV.conf, perform block / char major
substitutions that may be present in that file.

PR port-cobalt/55009

diffstat:

 etc/MAKEDEV.awk |  31 +++++++++++++++++++++++++++----
 1 files changed, 27 insertions(+), 4 deletions(-)

diffs (56 lines):

diff -r 189d4e0a7b23 -r cdf430125460 etc/MAKEDEV.awk
--- a/etc/MAKEDEV.awk   Sat Jun 13 19:15:43 2020 +0000
+++ b/etc/MAKEDEV.awk   Sat Jun 13 19:46:23 2020 +0000
@@ -1,6 +1,6 @@
 #!/usr/bin/awk -
 #
-#      $NetBSD: MAKEDEV.awk,v 1.28 2019/11/03 12:03:35 martin Exp $
+#      $NetBSD: MAKEDEV.awk,v 1.29 2020/06/13 19:46:23 thorpej Exp $
 #
 # Copyright (c) 2003 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -104,10 +104,33 @@
        getline < cfgfile               # blank line
        MDDEV = 0               # MD device targets
        while (getline < cfgfile) {
+               #
+               # Perform the same blk / chr subsitution that happens below.
+               #
+               md_deventry = $0
+               if (match(md_deventry, /%[a-z0-9]*_(blk|chr)%/)) {
+                       nam = substr(md_deventry, RSTART + 1, RLENGTH - 6);
+                       typ = substr(md_deventry, RSTART + RLENGTH - 4, 3);
+                       dev = ""
+                       if (typ == "blk") {
+                               if (nam in blk) {
+                                       dev = blk[nam];
+                               }
+                       } else {
+                               if (nam in chr) {
+                                       dev = chr[nam];
+                               }
+                       }
+                       if (dev != "") {
+                               parsed = substr(md_deventry, 1, RSTART - 1) dev
+                               md_deventry = substr(md_deventry, RSTART + RLENGTH)
+                       }
+                       md_deventry = parsed md_deventry
+               }
                if (MDDEV)
-                       MDDEV = MDDEV "\n" $0
+                       MDDEV = MDDEV "\n" md_deventry
                else
-                       MDDEV = $0
+                       MDDEV = md_deventry
        }
        close(cfgfile)
 
@@ -225,7 +248,7 @@
        print "# Generated from:"
 
        # MAKEDEV.awk (this script) RCS Id
-       ARCSID = "$NetBSD: MAKEDEV.awk,v 1.28 2019/11/03 12:03:35 martin Exp $"
+       ARCSID = "$NetBSD: MAKEDEV.awk,v 1.29 2020/06/13 19:46:23 thorpej Exp $"
        gsub(/\$/, "", ARCSID)
        print "#        " ARCSID
        



Home | Main Index | Thread Index | Old Index