Remove the require_kld function I just committed and replace with a nicer solution.

Reported by:	pjd
Approved by:	cperciva
This commit is contained in:
flz 2006-05-18 16:04:56 +00:00
parent 3d58ab6ef3
commit 2b8bb5dee2
3 changed files with 4 additions and 33 deletions

View File

@ -84,7 +84,7 @@ init_variables()
fi fi
if [ "${_file}" != "${_file%.uzip}" ]; then if [ "${_file}" != "${_file%.uzip}" ]; then
# Load geom_uzip kernel module if needed # 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" _dev="/dev/${_md}.uzip"
fi fi
for _i in `df ${_file} 2>/dev/null`; do _fs=${_i}; done 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 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 for _md in ${_mdconfig_list}; do
init_variables ${_md} init_variables ${_md}

View File

@ -89,7 +89,7 @@ init_variables()
if [ "${_file}" != "${_file%.uzip}" ]; then if [ "${_file}" != "${_file%.uzip}" ]; then
# Load geom_uzip kernel module if needed # 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" _dev="/dev/${_md}.uzip"
fi fi
for _i in `df ${_file} 2>/dev/null`; do _fs=${_i}; done 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 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 for _md in ${_mdconfig2_list}; do
init_variables ${_md} init_variables ${_md}

View File

@ -1379,35 +1379,6 @@ ltr()
echo "${_out}" 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. # Creates a list of providers for GELI encryption.
geli_make_list() geli_make_list()
{ {