svn commit: r329441 - head/etc/rc.d

Warner Losh imp at FreeBSD.org
Sat Feb 17 06:57:24 UTC 2018


Author: imp
Date: Sat Feb 17 06:57:21 2018
New Revision: 329441
URL: https://svnweb.freebsd.org/changeset/base/329441

Log:
  If we're passed an argument, then treat it as a single NOMATCH event
  to parse rather than searching for all events. Pass with new -p arg to
  devmatch. devmatch will use that one event rather than walking the
  entire tree.
  
  kldload will stop at the first failure. So we need to loop.  Also,
  symbolic links may confused kldload into trying (and failing) to load
  multiple modules at once, so guard against that.
  
  Noticed by: hps (with similar patch)
  Sponsored by: Netflix

Modified:
  head/etc/rc.d/devmatch

Modified: head/etc/rc.d/devmatch
==============================================================================
--- head/etc/rc.d/devmatch	Sat Feb 17 06:57:17 2018	(r329440)
+++ head/etc/rc.d/devmatch	Sat Feb 17 06:57:21 2018	(r329441)
@@ -37,17 +37,26 @@ desc="Use devmatch(8) to load kernel modules"
 
 start_cmd="${name}_start"
 stop_cmd=':'
+[ -n "$2" ] && one_nomatch="-p '$2'"
 
 devmatch_start()
 {
 	local x
 
-	x=$(devmatch | sort -u)
+	x=$(devmatch ${one_nomatch} | sort -u)
 
 	[ -n "$x" ] || return
 
+	# While kldload can accept multiple modules
+	# on the line at once, we loop here in case
+	# there's some weird error with one of them.
+	# We also optimize against the false positives
+	# or drivers that have symbolic links that
+	# confuse devmatch by running it -n.
 	echo "Autoloading modules: ${x}"
-	kldload ${x}
+	for m in ${x}; do
+		kldload -n ${m}
+	done
 }
 
 load_rc_config $name


More information about the svn-src-head mailing list