Project

General

Profile

« Previous | Next » 

Revision 3d74b803

Added by Jim Pingle over 12 years ago

Use is_module_loaded() to test these to avoid code duplication.

View differences:

etc/inc/pfsense-utils.inc
1566 1566
	if (!in_array($config['system']['crypto_hardware'], $crypto_modules))
1567 1567
		return false;
1568 1568

  
1569
	$is_loaded = `/sbin/kldstat | /usr/bin/grep -c {$config['system']['crypto_hardware']}`;
1570
	if (!empty($config['system']['crypto_hardware']) && ($is_loaded == 0)) {
1569
	if (!empty($config['system']['crypto_hardware']) && !is_module_loaded($config['system']['crypto_hardware'])) {
1571 1570
		log_error("Loading {$config['system']['crypto_hardware']} cryptographic accelerator module.");
1572 1571
		mwexec("/sbin/kldload {$config['system']['crypto_hardware']}");
1573 1572
	}
......
1583 1582
	if (!in_array($config['system']['thermal_hardware'], $thermal_hardware_modules))
1584 1583
		return false;
1585 1584

  
1586
	$is_loaded = `/sbin/kldstat | /usr/bin/grep -c {$config['system']['thermal_hardware']}`;
1587
	if (!empty($config['system']['thermal_hardware']) && ($is_loaded == 0)) {
1585
	if (!empty($config['system']['thermal_hardware']) && !is_module_loaded($config['system']['thermal_hardware'])) {
1588 1586
		log_error("Loading {$config['system']['thermal_hardware']} thermal monitor module.");
1589 1587
		mwexec("/sbin/kldload {$config['system']['thermal_hardware']}");
1590 1588
	}

Also available in: Unified diff