Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Feb 2018 06:57:21 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r329441 - head/etc/rc.d
Message-ID:  <201802170657.w1H6vLsG027601@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802170657.w1H6vLsG027601>