diff options
author | yar <yar@FreeBSD.org> | 2006-07-25 17:10:35 +0000 |
---|---|---|
committer | yar <yar@FreeBSD.org> | 2006-07-25 17:10:35 +0000 |
commit | eb3e86a4280ee5ba2a694d695b1a2509439cefcb (patch) | |
tree | 9b6e8c0d48ffe6629ffeabb44beb5276f59fc504 /etc | |
parent | 2bff479b50a4916562c67f2f434625bd2123fee2 (diff) | |
download | FreeBSD-src-eb3e86a4280ee5ba2a694d695b1a2509439cefcb.zip FreeBSD-src-eb3e86a4280ee5ba2a694d695b1a2509439cefcb.tar.gz |
Add diagnostics to load_kld().
Diffstat (limited to 'etc')
-rw-r--r-- | etc/rc.subr | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/etc/rc.subr b/etc/rc.subr index 2928d3b..52acd32 100644 --- a/etc/rc.subr +++ b/etc/rc.subr @@ -1358,12 +1358,12 @@ mount_md() # Code common to scripts that need to load a kernel module # if it isn't in the kernel yet. Syntax: -# load_kld [-e regexp] [-m modname] filename +# load_kld [-e regex] [-m module] file # where -e or -m chooses the way to check if the module # is already loaded: -# regexp is egrep'd in the output from `kldstat -v', -# modname is passed to `kldstat -m'. -# The default way is as though `-m filename' were specified. +# regex is egrep'd in the output from `kldstat -v', +# module is passed to `kldstat -m'. +# The default way is as though `-m file' were specified. load_kld() { local _loaded _mod _opt _re @@ -1372,9 +1372,13 @@ load_kld() case "$_opt" in e) _re="$OPTARG" ;; m) _mod="$OPTARG" ;; + *) err 3 'USAGE: load_kld [-e regex] [-m module] file' ;; esac done shift $(($OPTIND - 1)) + if [ $# -ne 1 ]; then + err 3 'USAGE: load_kld [-e regex] [-m module] file' + fi _mod=${_mod:-$1} _loaded=false if [ -n "$_re" ]; then @@ -1390,7 +1394,11 @@ load_kld() if ! kldload "$1"; then warn "Unable to load kernel module $1" return 1 + else + info "$1 kernel module loaded." fi + else + debug "load_kld: $1 kernel module already loaded." fi return 0 } |