From 2b8bb5dee2d247cff23441f5355959f826ec5457 Mon Sep 17 00:00:00 2001 From: flz Date: Thu, 18 May 2006 16:04:56 +0000 Subject: Remove the require_kld function I just committed and replace with a nicer solution. Reported by: pjd Approved by: cperciva --- etc/rc.d/mdconfig | 4 ++-- etc/rc.d/mdconfig2 | 4 ++-- etc/rc.subr | 29 ----------------------------- 3 files changed, 4 insertions(+), 33 deletions(-) diff --git a/etc/rc.d/mdconfig b/etc/rc.d/mdconfig index 8ee3b2a..b02990f 100644 --- a/etc/rc.d/mdconfig +++ b/etc/rc.d/mdconfig @@ -84,7 +84,7 @@ init_variables() fi if [ "${_file}" != "${_file%.uzip}" ]; then # Load geom_uzip kernel module if needed - require_kld geom_uzip + kldstat -q -m g_uzip || kldload geom_uzip || err 1 "geom_uzip failed to load." _dev="/dev/${_md}.uzip" fi for _i in `df ${_file} 2>/dev/null`; do _fs=${_i}; done @@ -103,7 +103,7 @@ mdconfig_start() { local _md _mp _config _type _dev _file _fs _newfs _fsck_cmd - require_kld g_md + kldstat -q -m g_md || kldload geom_md || err 1 "geom_md failed to load." for _md in ${_mdconfig_list}; do init_variables ${_md} diff --git a/etc/rc.d/mdconfig2 b/etc/rc.d/mdconfig2 index 8dc36a4..09ef160 100644 --- a/etc/rc.d/mdconfig2 +++ b/etc/rc.d/mdconfig2 @@ -89,7 +89,7 @@ init_variables() if [ "${_file}" != "${_file%.uzip}" ]; then # Load geom_uzip kernel module if needed - require_kld geom_uzip + kldstat -q -m g_uzip || kldload geom_uzip || err 1 "geom_uzip failed to load." _dev="/dev/${_md}.uzip" fi for _i in `df ${_file} 2>/dev/null`; do _fs=${_i}; done @@ -111,7 +111,7 @@ mdconfig2_start() { local _md _fs _mp _mounted _dev _config _type _file _owner _perms _files _populate _fsck_cmd _i - require_kld g_md + kldstat -q -m g_md || kldload geom_md || err 1 "geom_md failed to load." for _md in ${_mdconfig2_list}; do init_variables ${_md} diff --git a/etc/rc.subr b/etc/rc.subr index 9c6a158..1037bbc 100644 --- a/etc/rc.subr +++ b/etc/rc.subr @@ -1379,35 +1379,6 @@ ltr() echo "${_out}" } -# require_kld name -# Ensure given module is loaded. -# Try to load it if it's not. -require_kld() -{ - local _name _line _ret - - _name=$1 - _me="require_kld" - - _ret=`kldstat -v | while read _line; do - case ${_line} in - *" ${_name}") - echo "yes" - ;; - *) - ;; - esac; - done` - - if [ -z "${_ret}" ]; then - if kldload ${_name}; then - info "${_name} module loaded." - else - err 1 "${_me}: ${_name} module failed to load." - fi - fi -} - # Creates a list of providers for GELI encryption. geli_make_list() { -- cgit v1.1