When reading in the MD MAKEDEV.conf, perform block / char major
substitutions that may be present in that file. PR port-cobalt/55009
This commit is contained in:
parent
9dd46b30d9
commit
deb994054d
|
@ -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 @@ BEGIN {
|
|||
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 @@ BEGIN {
|
|||
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue