diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2009-11-21 16:07:54 -0500 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2009-11-21 16:08:36 -0500 |
commit | 483e6de8423236fd6af30de585caa72a507758f1 (patch) | |
tree | eb889e0d2978c3975304a54e2cd7ac4606d73a98 /etc | |
parent | e2d90eacaa1d352dbf19d7b9c05b1bc0ee1dc942 (diff) | |
download | pfsense-483e6de8423236fd6af30de585caa72a507758f1.zip pfsense-483e6de8423236fd6af30de585caa72a507758f1.tar.gz |
Rework includes/require. This saves about 4 megabytes.
Simplify get_memory(). Tested on mips/i386
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/authgui.inc | 1 | ||||
-rw-r--r-- | etc/inc/captiveportal.inc | 2 | ||||
-rw-r--r-- | etc/inc/filter.inc | 2 | ||||
-rw-r--r-- | etc/inc/functions.inc | 7 | ||||
-rw-r--r-- | etc/inc/interfaces.inc | 1 | ||||
-rw-r--r-- | etc/inc/priv.inc | 2 | ||||
-rw-r--r-- | etc/inc/rrd.inc | 1 | ||||
-rw-r--r-- | etc/inc/services.inc | 1 | ||||
-rw-r--r-- | etc/inc/util.inc | 45 | ||||
-rw-r--r-- | etc/inc/voucher.inc | 1 | ||||
-rw-r--r-- | etc/inc/vpn.inc | 4 | ||||
-rw-r--r-- | etc/inc/vslb.inc | 3 | ||||
-rwxr-xr-x | etc/rc.bootup | 12 | ||||
-rwxr-xr-x | etc/rc.filter_configure | 1 | ||||
-rwxr-xr-x | etc/rc.filter_configure_sync | 2 | ||||
-rwxr-xr-x | etc/rc.interfaces_carp_configure | 1 | ||||
-rwxr-xr-x | etc/rc.interfaces_lan_configure | 1 | ||||
-rwxr-xr-x | etc/rc.interfaces_opt_configure | 1 | ||||
-rwxr-xr-x | etc/rc.interfaces_wan_configure | 1 | ||||
-rwxr-xr-x | etc/rc.newipsecdns | 4 | ||||
-rwxr-xr-x | etc/rc.newwanip | 1 | ||||
-rwxr-xr-x | etc/rc.prunecaptiveportal | 14 | ||||
-rwxr-xr-x | etc/rc.restart_webgui | 2 | ||||
-rw-r--r-- | etc/rc.savevoucher | 3 |
24 files changed, 51 insertions, 62 deletions
diff --git a/etc/inc/authgui.inc b/etc/inc/authgui.inc index 59845c0..5332582 100644 --- a/etc/inc/authgui.inc +++ b/etc/inc/authgui.inc @@ -37,6 +37,7 @@ pfSense_MODULE: authgui */ +include_once("auth.inc"); include_once("priv.inc"); /* We only support htpasswd backed HTTP Basic auth and session diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc index 0c745b3..dbed597 100644 --- a/etc/inc/captiveportal.inc +++ b/etc/inc/captiveportal.inc @@ -41,8 +41,6 @@ */ /* include all configuration functions */ -require_once("globals.inc"); -require_once("util.inc"); require_once("radius_authentication.inc"); require_once("radius_accounting.inc"); require_once("radius.inc"); diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 3586e4f..c6fea3e 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -40,8 +40,6 @@ /* DISABLE_PHP_LINT_CHECKING */ /* include all configuration functions */ -require_once("config.inc"); -require_once("shaper.inc"); /* holds the items that will be executed *AFTER* the filter is fully loaded */ $after_filter_configure_run = array(); diff --git a/etc/inc/functions.inc b/etc/inc/functions.inc index f2ee6e2..e05fa59 100644 --- a/etc/inc/functions.inc +++ b/etc/inc/functions.inc @@ -78,14 +78,9 @@ require_once("interfaces.inc"); require_once("gwlb.inc"); require_once("services.inc"); require_once("pfsense-utils.inc"); -require_once("captiveportal.inc"); require_once("filter.inc"); +require_once("shaper.inc"); require_once("system.inc"); -require_once("ipsec.inc"); -require_once("vpn.inc"); require_once("vslb.inc"); -require_once("cmd_chain.inc"); -require_once("rrd.inc"); -require_once("itemid.inc"); ?>
\ No newline at end of file diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 08afbb0..175edf9 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -43,6 +43,7 @@ /* include all configuration functions */ require_once("globals.inc"); +require_once("cmd_chain.inc"); function interfaces_bring_up($interface) { if(!$interface) { diff --git a/etc/inc/priv.inc b/etc/inc/priv.inc index 03b2e8c..9afaa78 100644 --- a/etc/inc/priv.inc +++ b/etc/inc/priv.inc @@ -44,8 +44,6 @@ pfSense_MODULE: auth */ -require_once("priv.defs.inc"); -require_once("auth.inc"); /* * USER PRIVILEGE DEFINITIONS diff --git a/etc/inc/rrd.inc b/etc/inc/rrd.inc index a915d53..b98180d 100644 --- a/etc/inc/rrd.inc +++ b/etc/inc/rrd.inc @@ -33,7 +33,6 @@ */ /* include all configuration functions */ -require_once("config.inc"); function dump_rrd_to_xml($rrddatabase, $xmldumpfile) { $rrdtool = "/usr/bin/nice -n20 /usr/local/bin/rrdtool"; diff --git a/etc/inc/services.inc b/etc/inc/services.inc index decaf03..0622fe3 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -39,7 +39,6 @@ */ /* include all configuration functions */ -require_once("functions.inc"); function services_dhcpd_configure() { global $config, $g; diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 3706279..3d8cd43 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -885,37 +885,18 @@ function make_dirs($path, $mode = 0755) { * [0]real and [1]available */ function get_memory() { - if(file_exists("/var/log/dmesg.boot")) { - $mem = `cat /var/log/dmesg.boot | grep memory`; - $matches = ""; - if (preg_match_all("/real memory = .* \((.*) MB/", $mem, $matches)) - $real = $matches[1]; - if (preg_match_all("/avail memory = .* \((.*) MB/", $mem, $matches)) - $avail = $matches[1]; - if(!$real && !$avail) { - $real = trim(`sysctl hw.physmem | cut -d' ' -f2`); - $avail = trim(`sysctl hw.realmem | cut -d' ' -f2`); - $real_mem = $real / 1024; - $avail_mem = $avail / 1024; - return array($real_mem,$avail_mem); - } - return array($real[0],$avail[0]); - } else { - $mem = `dmesg -a`; - $matches = ""; - if (preg_match_all("/real memory = .* \((.*) MB/", $mem, $matches)) - $real = $matches[1]; - if (preg_match_all("/avail memory = .* \((.*) MB/", $mem, $matches)) - $avail = $matches[1]; - if(!$real && !$avail) { - $real = trim(`sysctl hw.physmem | cut -d' ' -f2`); - $avail = trim(`sysctl hw.realmem | cut -d' ' -f2`); - $real_mem = $real / 1024; - $avail_mem = $avail / 1024; - return array($real_mem,$avail_mem); - } - return array($real[0],$avail[0]); - } + $matches = ""; + if(file_exists("/var/log/dmesg.boot")) + $mem = `cat /var/log/dmesg.boot | grep memory`; + else + $mem = `dmesg -a | grep memory`; + if (preg_match_all("/avail memory.* \((.*)MB\)/", $mem, $matches)) + return array($matches[1][0], $matches[1][0]); + if(!$real && !$avail) { + $real = trim(`sysctl hw.physmem | cut -d' ' -f2`); + $avail = trim(`sysctl hw.realmem | cut -d' ' -f2`); + return array(($real/1024),($avail/1024)); + } } function mute_kernel_msgs() { @@ -1039,4 +1020,4 @@ function msort($array, $id="id", $sort_ascending=true) { } } -?> +?>
\ No newline at end of file diff --git a/etc/inc/voucher.inc b/etc/inc/voucher.inc index 700f197..2db6d19 100644 --- a/etc/inc/voucher.inc +++ b/etc/inc/voucher.inc @@ -32,7 +32,6 @@ */ /* include all configuration functions */ -require_once("config.inc"); /* *Authenticate a voucher and return the remaining time credit in minutes diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index 6073e6f..d987a42 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -42,8 +42,6 @@ */ /* include all configuration functions */ -require_once ("functions.inc"); -require_once("certs.inc"); function vpn_ipsec_failover_configure() { global $config, $g; @@ -1687,4 +1685,4 @@ function reload_tunnel_spd_policy($phase1, $phase2, $old_phase1, $old_phase2) { return true; } -?>
\ No newline at end of file +?> diff --git a/etc/inc/vslb.inc b/etc/inc/vslb.inc index a5cebcb..86616c7 100644 --- a/etc/inc/vslb.inc +++ b/etc/inc/vslb.inc @@ -36,7 +36,6 @@ /* DISABLE_PHP_LINT_CHECKING */ /* include all configuration functions */ -require_once("config.inc"); class Monitor { private $conf = array(); @@ -271,4 +270,4 @@ function relayd_configure() { } } -?>
\ No newline at end of file +?> diff --git a/etc/rc.bootup b/etc/rc.bootup index 2b59052..8e2ebca 100755 --- a/etc/rc.bootup +++ b/etc/rc.bootup @@ -85,12 +85,14 @@ echo " done.\n"; echo "Initializing..."; echo "."; require_once("/etc/inc/globals.inc"); +echo "."; require_once("/etc/inc/led.inc"); led_normalize(); +echo "."; if (led_count() >= 3) { led_kitt(); } -echo "."; + /* let the other functions know we're booting */ $pkg_interface = 'console'; $g['booting'] = true; @@ -106,8 +108,16 @@ require_once("/etc/inc/config.inc"); echo "."; require_once("/etc/inc/functions.inc"); echo "."; +require_once("/etc/inc/ipsec.inc"); +echo "."; +require_once("/etc/inc/vpn.inc"); +echo "."; require_once("openvpn.inc"); echo "."; +require_once("/etc/inc/captiveportal.inc"); +echo "."; +require_once("/etc/inc/rrd.inc"); +echo "."; /* get system memory amount */ $memory = get_memory(); diff --git a/etc/rc.filter_configure b/etc/rc.filter_configure index 2f34d15..852d584 100755 --- a/etc/rc.filter_configure +++ b/etc/rc.filter_configure @@ -30,6 +30,7 @@ */ require_once("config.inc"); +require_once("functions.inc"); require_once("filter.inc"); /* invalidate interface cache */ diff --git a/etc/rc.filter_configure_sync b/etc/rc.filter_configure_sync index ec2e83a..8597e62 100755 --- a/etc/rc.filter_configure_sync +++ b/etc/rc.filter_configure_sync @@ -30,7 +30,7 @@ */ require_once("config.inc"); -require_once("filter.inc"); +require_once("functions.inc"); /* invalidate interface cache */ get_interface_arr(true); diff --git a/etc/rc.interfaces_carp_configure b/etc/rc.interfaces_carp_configure index 10153b4..6faa589 100755 --- a/etc/rc.interfaces_carp_configure +++ b/etc/rc.interfaces_carp_configure @@ -30,6 +30,7 @@ */ require_once("config.inc"); +require_once("functions.inc"); require_once("filter.inc"); interfaces_carp_configure(); diff --git a/etc/rc.interfaces_lan_configure b/etc/rc.interfaces_lan_configure index 7eb5a6e..d5c16fd 100755 --- a/etc/rc.interfaces_lan_configure +++ b/etc/rc.interfaces_lan_configure @@ -30,6 +30,7 @@ */ require_once("config.inc"); +require_once("functions.inc"); require_once("filter.inc"); interface_configure("lan"); diff --git a/etc/rc.interfaces_opt_configure b/etc/rc.interfaces_opt_configure index d3d309b..3ccb8b9 100755 --- a/etc/rc.interfaces_opt_configure +++ b/etc/rc.interfaces_opt_configure @@ -30,6 +30,7 @@ */ require_once("config.inc"); +require_once("functions.inc"); require_once("filter.inc"); interfaces_configure(); diff --git a/etc/rc.interfaces_wan_configure b/etc/rc.interfaces_wan_configure index 505c3ab..350cdfe 100755 --- a/etc/rc.interfaces_wan_configure +++ b/etc/rc.interfaces_wan_configure @@ -30,6 +30,7 @@ */ require_once("config.inc"); +require_once("functions.inc"); require_once("filter.inc"); interface_configure("wan"); diff --git a/etc/rc.newipsecdns b/etc/rc.newipsecdns index 42675e3..d6509f9 100755 --- a/etc/rc.newipsecdns +++ b/etc/rc.newipsecdns @@ -32,7 +32,9 @@ /* parse the configuration and include all functions used below */ require_once("functions.inc"); - + require_once("ipsec.inc"); + require_once("vpn.inc"); + /* make sure to wait until the boot scripts have finished */ while (file_exists("{$g['varrun_path']}/booting")) { sleep(1); diff --git a/etc/rc.newwanip b/etc/rc.newwanip index a8a77aa..5918084 100755 --- a/etc/rc.newwanip +++ b/etc/rc.newwanip @@ -35,7 +35,6 @@ require_once("globals.inc"); require_once("config.inc"); require_once("functions.inc"); -require_once("gwlb.inc"); /* WAN IP address has changed */ diff --git a/etc/rc.prunecaptiveportal b/etc/rc.prunecaptiveportal index 3b130c8..bff2667 100755 --- a/etc/rc.prunecaptiveportal +++ b/etc/rc.prunecaptiveportal @@ -30,10 +30,12 @@ POSSIBILITY OF SUCH DAMAGE. */ - /* parse the configuration and include all functions used below */ - /* config.inc retrives the util.inc and globals.inc */ - require_once("config.inc"); - require_once("captiveportal.inc"); - - captiveportal_prune_old(); +/* parse the configuration and include all functions used below */ +/* config.inc retrives the util.inc and globals.inc */ +require_once("config.inc"); +require_once("functions.inc"); +require_once("captiveportal.inc"); + +captiveportal_prune_old(); + ?> diff --git a/etc/rc.restart_webgui b/etc/rc.restart_webgui index 812dcdf..eef95d5 100755 --- a/etc/rc.restart_webgui +++ b/etc/rc.restart_webgui @@ -4,6 +4,8 @@ require("config.inc"); require("functions.inc"); +require("captiveportal.inc"); +require("rrd.inc"); mwexec("killall -9 lighttpd"); diff --git a/etc/rc.savevoucher b/etc/rc.savevoucher index 338fd49..4ccc4d4 100644 --- a/etc/rc.savevoucher +++ b/etc/rc.savevoucher @@ -29,6 +29,9 @@ */ /* parse the configuration and include all functions used below */ + require_once("functions.inc"); + require_once("config.inc"); + require_once("captiveportal.inc"); require_once("voucher.inc"); voucher_save_db_to_config(); |