Commit 5dd05b18 authored by Franco Fichtner's avatar Franco Fichtner

inc: shrink usage of kld* utilities further

(cherry picked from commit 09173813)
parent 23fc5b8b
......@@ -379,9 +379,9 @@ function load_crypto_module()
{
global $config;
if (!empty($config['system']['crypto_hardware']) && !is_module_loaded($config['system']['crypto_hardware'])) {
if (!empty($config['system']['crypto_hardware'])) {
log_error(sprintf(gettext('Loading %s cryptographic accelerator module.'), $config['system']['crypto_hardware']));
mwexecf('/sbin/kldload %s', $config['system']['crypto_hardware']);
mwexecf('/sbin/kldload %s', $config['system']['crypto_hardware'], true);
}
if (isset($config['system']['cryptodev_enable'])) {
......@@ -395,9 +395,9 @@ function load_thermal_module()
{
global $config;
if (!empty($config['system']['thermal_hardware']) && !is_module_loaded($config['system']['thermal_hardware'])) {
if (!empty($config['system']['thermal_hardware'])) {
log_error(sprintf(gettext('Loading %s thermal monitor module.'), $config['system']['thermal_hardware']));
mwexecf('/sbin/kldload %s', $config['system']['thermal_hardware']);
mwexecf('/sbin/kldload %s', $config['system']['thermal_hardware'], true);
}
}
......
......@@ -116,11 +116,6 @@ function unlock($cfglckkey = null)
}
}
function is_module_loaded($module_name)
{
return !mwexecf('/sbin/kldstat -qn %s', $module_name, true);
}
/* validate non-negative numeric string, or equivalent numeric variable */
function is_numericint($arg) {
return (((is_int($arg) && $arg >= 0) || (is_string($arg) && strlen($arg) > 0 && ctype_digit($arg))) ? true : false);
......
......@@ -116,7 +116,7 @@ defCmdT("top | head -n5", "/usr/bin/top | /usr/bin/head -n5");
defCmdT("sysctl hw.physmem","/sbin/sysctl hw.physmem");
if (is_module_loaded('ipfw')) {
if (!mwexecf('/sbin/kldstat -qn %s', 'ipfw', true)) {
defCmdT('ipfw queue show', '/sbin/ipfw queue show');
defCmdT('ipfw pipe show', '/sbin/ipfw pipe show');
defCmdT('ipfw show', '/sbin/ipfw show');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment